163 lines
3.8 KiB
C#
163 lines
3.8 KiB
C#
using System;
|
|
using TH1_UI.Controller.Base;
|
|
|
|
//
|
|
public enum WinDepthType
|
|
{
|
|
BOTTOM,
|
|
MIDDLE,
|
|
TOP,
|
|
//
|
|
WIN_Main = 4900,
|
|
WIN_AVG = 28000,
|
|
WIN_ComTopEffect = 29000,// 放一些全屏特效
|
|
WIN_Loading = 29050,
|
|
WIN_Debug = 29100,
|
|
WIN_Reconnect = 30200,
|
|
WIN_Confirm = 30300,
|
|
WIN_CenterMessage = 30400,
|
|
// 冒险层级
|
|
WIN_Adventure = 0
|
|
}
|
|
//
|
|
public class ViewDepthProperty
|
|
{
|
|
public int Depth { get { return _depth; } }
|
|
//
|
|
public WinDepthType Type = WinDepthType.MIDDLE;
|
|
public int DepthSpan = 50;
|
|
static readonly int VALUE_BottomDepthStart = 1;
|
|
static readonly int VALUE_MiddleDepthStart = 5000;
|
|
static readonly int VALUE_TopDepthStart = 10000;
|
|
//
|
|
public void Start(IViewControllerInterface view)
|
|
{
|
|
if (_currLinkNode != null)
|
|
{
|
|
_currLinkNode.Detach();
|
|
}
|
|
_currLinkNode = new ViDoubleLinkNode2<IViewControllerInterface>();
|
|
_currLinkNode.Data = view;
|
|
}
|
|
//
|
|
public void Open()
|
|
{
|
|
if (_currLinkNode != null)
|
|
{
|
|
_currLinkNode.Detach();
|
|
if (Type == WinDepthType.TOP)
|
|
{
|
|
_topViewList.PushBack(_currLinkNode);
|
|
}
|
|
else if (Type == WinDepthType.MIDDLE)
|
|
{
|
|
_middleViewSortingList.PushBack(_currLinkNode);
|
|
_UpdateMiddleSortingViewDepth();
|
|
}
|
|
else if (Type == WinDepthType.BOTTOM)
|
|
{
|
|
_bottomViewSortingList.PushBack(_currLinkNode);
|
|
_UpdateBottomSortingViewDepth();
|
|
}
|
|
else
|
|
{
|
|
_depth = (int)Type;
|
|
_currLinkNode.Data.Depth = _depth;
|
|
}
|
|
_UpdateTopViewDepth();
|
|
}
|
|
}
|
|
//
|
|
public void Close()
|
|
{
|
|
if (_currLinkNode != null)
|
|
{
|
|
_currLinkNode.Detach();
|
|
}
|
|
}
|
|
//
|
|
void _UpdateBottomSortingViewDepth()
|
|
{
|
|
int depth = VALUE_BottomDepthStart;
|
|
ViDoubleLinkNode2<IViewControllerInterface> iter = _bottomViewSortingList.GetHead();
|
|
IViewControllerInterface iterPreView = null;
|
|
while (!_bottomViewSortingList.IsEnd(iter))
|
|
{
|
|
IViewControllerInterface iterView = iter.Data;
|
|
ViDoubleLink2<IViewControllerInterface>.Next(ref iter);
|
|
//
|
|
if (iterPreView == null)
|
|
{
|
|
_depth = depth;
|
|
iterView.Depth = depth;
|
|
}
|
|
else
|
|
{
|
|
depth += iterPreView.DepthProperty.DepthSpan;
|
|
_depth = depth;
|
|
iterView.Depth = depth;
|
|
}
|
|
//
|
|
iterPreView = iterView;
|
|
}
|
|
}
|
|
//
|
|
void _UpdateMiddleSortingViewDepth()
|
|
{
|
|
int depth = VALUE_MiddleDepthStart;
|
|
ViDoubleLinkNode2<IViewControllerInterface> iter = _middleViewSortingList.GetHead();
|
|
IViewControllerInterface iterPreView = null;
|
|
while (!_middleViewSortingList.IsEnd(iter))
|
|
{
|
|
IViewControllerInterface iterView = iter.Data;
|
|
ViDoubleLink2<IViewControllerInterface>.Next(ref iter);
|
|
//
|
|
if (iterPreView == null)
|
|
{
|
|
_depth = depth;
|
|
iterView.Depth = depth;
|
|
}
|
|
else
|
|
{
|
|
depth += iterPreView.DepthProperty.DepthSpan;
|
|
_depth = depth;
|
|
iterView.Depth = depth;
|
|
}
|
|
//
|
|
iterPreView = iterView;
|
|
}
|
|
}
|
|
//
|
|
void _UpdateTopViewDepth()
|
|
{
|
|
int depth = VALUE_TopDepthStart;
|
|
ViDoubleLinkNode2<IViewControllerInterface> iter = _topViewList.GetHead();
|
|
IViewControllerInterface iterPreView = null;
|
|
while (!_topViewList.IsEnd(iter))
|
|
{
|
|
IViewControllerInterface iterView = iter.Data;
|
|
ViDoubleLink2<IViewControllerInterface>.Next(ref iter);
|
|
//
|
|
if (iterPreView == null)
|
|
{
|
|
_depth = depth;
|
|
iterView.Depth = depth;
|
|
}
|
|
else
|
|
{
|
|
depth += iterPreView.DepthProperty.DepthSpan;
|
|
_depth = depth;
|
|
iterView.Depth = depth;
|
|
}
|
|
//
|
|
iterPreView = iterView;
|
|
}
|
|
}
|
|
//
|
|
int _depth;
|
|
ViDoubleLinkNode2<IViewControllerInterface> _currLinkNode = null;
|
|
static ViDoubleLink2<IViewControllerInterface> _bottomViewSortingList = new ViDoubleLink2<IViewControllerInterface>();
|
|
static ViDoubleLink2<IViewControllerInterface> _middleViewSortingList = new ViDoubleLink2<IViewControllerInterface>();
|
|
static ViDoubleLink2<IViewControllerInterface> _topViewList = new ViDoubleLink2<IViewControllerInterface>();
|
|
}
|