|
@@ -13,7 +13,7 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
public class ViewManager
|
|
|
{
|
|
|
- private static Dictionary<string, UIView> _viewDic;
|
|
|
+ private static Dictionary<string, IUIView> _viewDic;
|
|
|
private static GComponent _bottomLayer;
|
|
|
private static GComponent _topLayer;
|
|
|
private static GComponent _guideLayer;
|
|
@@ -52,7 +52,7 @@ namespace GFGGame
|
|
|
//默认关闭点击窗口移至顶层的功能,不可打开,如哪个界面需要在界面中单独设置
|
|
|
UIConfig.bringWindowToFrontOnClick = false;
|
|
|
|
|
|
- _viewDic = new Dictionary<string, UIView>();
|
|
|
+ _viewDic = new Dictionary<string, IUIView>();
|
|
|
//��ʼ����ͼ������
|
|
|
_bottomLayer = CreateLayer("BottomLayer");
|
|
|
_topLayer = CreateLayer("TopLayer");
|
|
@@ -123,7 +123,7 @@ namespace GFGGame
|
|
|
{
|
|
|
HideAllView(name);
|
|
|
}
|
|
|
- UIView obj = null;
|
|
|
+ IUIView obj = null;
|
|
|
|
|
|
if (_viewDic.ContainsKey(name))
|
|
|
{
|
|
@@ -131,7 +131,7 @@ namespace GFGGame
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- obj = CreateViewInstance(fullViewName) as UIView;
|
|
|
+ obj = CreateViewInstance(fullViewName) as IUIView;
|
|
|
obj.viewName = name;
|
|
|
_viewDic.Add(name, obj);
|
|
|
}
|
|
@@ -172,7 +172,7 @@ namespace GFGGame
|
|
|
{
|
|
|
string name = GetName(fullViewName);
|
|
|
|
|
|
- UIView obj = null;
|
|
|
+ IUIView obj = null;
|
|
|
if (_viewDic.ContainsKey(name))
|
|
|
{
|
|
|
obj = _viewDic[name];
|
|
@@ -198,14 +198,14 @@ namespace GFGGame
|
|
|
{
|
|
|
HideAllView(name);
|
|
|
}
|
|
|
- UIView obj = null;
|
|
|
+ IUIView obj = null;
|
|
|
if (_viewDic.ContainsKey(name))
|
|
|
{
|
|
|
obj = _viewDic[name];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- obj = new T() as UIView;
|
|
|
+ obj = new T() as IUIView;
|
|
|
obj.viewName = name;
|
|
|
_viewDic.Add(name, obj);
|
|
|
}
|
|
@@ -248,7 +248,7 @@ namespace GFGGame
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- UIView obj = _viewDic[name];
|
|
|
+ IUIView obj = _viewDic[name];
|
|
|
if (obj != null && obj.isShowing)
|
|
|
{
|
|
|
IUIView view = (IUIView)obj;
|
|
@@ -309,13 +309,13 @@ namespace GFGGame
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
- public static UIView GetUIView(string viewName)
|
|
|
+ public static IUIView GetUIView(string viewName)
|
|
|
{
|
|
|
- UIView obj = _viewDic[viewName];
|
|
|
+ IUIView obj = _viewDic[viewName];
|
|
|
if (obj != null && obj.isShowing)
|
|
|
{
|
|
|
|
|
|
- return obj;
|
|
|
+ return obj as IUIView;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -335,7 +335,7 @@ namespace GFGGame
|
|
|
for (int i = _viewDic.Keys.Count - 1; i >= 0; i--)//不用foreach是因为:循环过程中可能会触发dispose,导致_viewDic.Keys变化,最终报错
|
|
|
{
|
|
|
int index = i > _viewDic.Keys.Count - 1 ? _viewDic.Keys.Count - 1 : i;//直接去最后一个,不用i是因为关闭一个界面可能会连带关闭其他界面,最终i比_viewDic.Keys.Count大而报错
|
|
|
- KeyValuePair<string, UIView> kv = _viewDic.ElementAt(index);
|
|
|
+ KeyValuePair<string, IUIView> kv = _viewDic.ElementAt(index);
|
|
|
if (kv.Key != excludeViewName)
|
|
|
{
|
|
|
if (kv.Key == typeof(FunctionOpenView).Name) continue;//功能开启界面不能强制关闭
|
|
@@ -357,7 +357,7 @@ namespace GFGGame
|
|
|
for (int i = _viewDic.Keys.Count - 1; i >= 0; i--)//不用foreach是因为:循环过程中可能会触发dispose,导致_viewDic.Keys变化,最终报错
|
|
|
{
|
|
|
int index = i > _viewDic.Keys.Count - 1 ? _viewDic.Keys.Count - 1 : i;//直接去最后一个,不用i是因为关闭一个界面可能会连带关闭其他界面,最终i比_viewDic.Keys.Count大而报错
|
|
|
- KeyValuePair<string, UIView> kv = _viewDic.ElementAt(index);
|
|
|
+ KeyValuePair<string, IUIView> kv = _viewDic.ElementAt(index);
|
|
|
if (kv.Value.isShowing == true) continue;
|
|
|
// if (kv.Value.packageName == ResPathUtil.GetUIPackagePath("CommonGame") || kv.Value.packageName == ResPathUtil.GetUIPackagePath("Common") || kv.Value.packageName == ResPathUtil.GetUIPackagePath("Main")) return;//这几个包不释放
|
|
|
long currentTime = TimeHelper.ClientNowSeconds();
|