|
@@ -45,31 +45,31 @@ namespace GFGGame
|
|
/// <summary>
|
|
/// <summary>
|
|
/// ��ʾһ����ͼ
|
|
/// ��ʾһ����ͼ
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="viewName">Ҫ��ʾ����ͼ����</param>
|
|
|
|
|
|
+ /// <param name="name">Ҫ��ʾ����ͼ����</param>
|
|
/// <param name="viewData">Ҫ���ݸ���ͼ�IJ���</param>
|
|
/// <param name="viewData">Ҫ���ݸ���ͼ�IJ���</param>
|
|
/// <param name="goBackParams">�Ӹ���ͼ���ص���ͼ��Ϣ</param>
|
|
/// <param name="goBackParams">�Ӹ���ͼ���ص���ͼ��Ϣ</param>
|
|
/// <param name="hideOthers">�Ƿ�ر�������ͼ</param>
|
|
/// <param name="hideOthers">�Ƿ�ر�������ͼ</param>
|
|
public static void Show(string viewName, object viewData = null, object[] goBackParams = null, bool hideOthers = false, bool resetGobackParams = false)
|
|
public static void Show(string viewName, object viewData = null, object[] goBackParams = null, bool hideOthers = false, bool resetGobackParams = false)
|
|
{
|
|
{
|
|
- string[] names = viewName.Split('.');
|
|
|
|
- // if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(names[names.Length - 1]))
|
|
|
|
- // {
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
|
|
+ string name = GetName(viewName);
|
|
|
|
+ if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(name))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (hideOthers)
|
|
if (hideOthers)
|
|
{
|
|
{
|
|
- HideAllView(viewName);
|
|
|
|
|
|
+ HideAllView(name);
|
|
}
|
|
}
|
|
UIView obj = null;
|
|
UIView obj = null;
|
|
|
|
|
|
- if (_viewDic.ContainsKey(viewName))
|
|
|
|
|
|
+ if (_viewDic.ContainsKey(name))
|
|
{
|
|
{
|
|
- obj = _viewDic[viewName];
|
|
|
|
|
|
+ obj = _viewDic[name];
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
obj = CreateViewInstance(viewName) as UIView;
|
|
obj = CreateViewInstance(viewName) as UIView;
|
|
- _viewDic.Add(viewName, obj);
|
|
|
|
|
|
+ _viewDic.Add(name, obj);
|
|
}
|
|
}
|
|
if (obj != null)
|
|
if (obj != null)
|
|
{
|
|
{
|
|
@@ -78,7 +78,7 @@ namespace GFGGame
|
|
if (!view.isShowing)
|
|
if (!view.isShowing)
|
|
{
|
|
{
|
|
view.Show();
|
|
view.Show();
|
|
- Debug.Log("��ǰ��" + viewName);
|
|
|
|
|
|
+ Debug.Log("��ǰ��" + name);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -86,14 +86,14 @@ namespace GFGGame
|
|
}
|
|
}
|
|
if (resetGobackParams)
|
|
if (resetGobackParams)
|
|
{
|
|
{
|
|
- if (_goBackDatas.ContainsKey(viewName) == true)
|
|
|
|
|
|
+ if (_goBackDatas.ContainsKey(name) == true)
|
|
{
|
|
{
|
|
- _goBackDatas.Remove(viewName);
|
|
|
|
|
|
+ _goBackDatas.Remove(name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (goBackParams != null)
|
|
if (goBackParams != null)
|
|
{
|
|
{
|
|
- _goBackDatas[viewName] = goBackParams;
|
|
|
|
|
|
+ _goBackDatas[name] = goBackParams;
|
|
}
|
|
}
|
|
// else
|
|
// else
|
|
}
|
|
}
|
|
@@ -102,10 +102,12 @@ namespace GFGGame
|
|
|
|
|
|
public static bool isViewOpen(string viewName)
|
|
public static bool isViewOpen(string viewName)
|
|
{
|
|
{
|
|
|
|
+ string name = GetName(viewName);
|
|
|
|
+
|
|
UIView obj = null;
|
|
UIView obj = null;
|
|
- if (_viewDic.ContainsKey(viewName))
|
|
|
|
|
|
+ if (_viewDic.ContainsKey(name))
|
|
{
|
|
{
|
|
- obj = _viewDic[viewName];
|
|
|
|
|
|
+ obj = _viewDic[name];
|
|
if (obj != null)
|
|
if (obj != null)
|
|
{
|
|
{
|
|
IUIView view = (IUIView)obj;
|
|
IUIView view = (IUIView)obj;
|
|
@@ -116,25 +118,27 @@ namespace GFGGame
|
|
}
|
|
}
|
|
public static bool Show<T>(object viewData = null, object[] goBackParams = null, bool hideOthers = false, bool resetGobackParams = false) where T : class, new()
|
|
public static bool Show<T>(object viewData = null, object[] goBackParams = null, bool hideOthers = false, bool resetGobackParams = false) where T : class, new()
|
|
{
|
|
{
|
|
- string viewName = typeof(T).FullName;
|
|
|
|
- string[] names = viewName.Split('.');
|
|
|
|
- // if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(names[names.Length - 1]))
|
|
|
|
- // {
|
|
|
|
- // return false;
|
|
|
|
- // }
|
|
|
|
|
|
+ // string[] names = typeof(T).FullName.Split('.');
|
|
|
|
+ // string viewName = names[names.Length - 1];
|
|
|
|
+ string name = GetName(typeof(T).FullName);
|
|
|
|
+
|
|
|
|
+ if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(name))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
if (hideOthers)
|
|
if (hideOthers)
|
|
{
|
|
{
|
|
- HideAllView(viewName);
|
|
|
|
|
|
+ HideAllView(name);
|
|
}
|
|
}
|
|
UIView obj = null;
|
|
UIView obj = null;
|
|
- if (_viewDic.ContainsKey(viewName))
|
|
|
|
|
|
+ if (_viewDic.ContainsKey(name))
|
|
{
|
|
{
|
|
- obj = _viewDic[viewName];
|
|
|
|
|
|
+ obj = _viewDic[name];
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
obj = new T() as UIView;
|
|
obj = new T() as UIView;
|
|
- _viewDic.Add(viewName, obj);
|
|
|
|
|
|
+ _viewDic.Add(name, obj);
|
|
}
|
|
}
|
|
if (obj != null)
|
|
if (obj != null)
|
|
{
|
|
{
|
|
@@ -143,7 +147,7 @@ namespace GFGGame
|
|
if (!view.isShowing)
|
|
if (!view.isShowing)
|
|
{
|
|
{
|
|
view.Show();
|
|
view.Show();
|
|
- Debug.Log("��ǰ��" + viewName);
|
|
|
|
|
|
+ Debug.Log("��ǰ��" + name);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -151,13 +155,13 @@ namespace GFGGame
|
|
}
|
|
}
|
|
if (goBackParams != null)
|
|
if (goBackParams != null)
|
|
{
|
|
{
|
|
- _goBackDatas[viewName] = goBackParams;
|
|
|
|
|
|
+ _goBackDatas[name] = goBackParams;
|
|
}
|
|
}
|
|
else if (resetGobackParams)
|
|
else if (resetGobackParams)
|
|
{
|
|
{
|
|
- if (_goBackDatas.ContainsKey(viewName) == true)
|
|
|
|
|
|
+ if (_goBackDatas.ContainsKey(name) == true)
|
|
{
|
|
{
|
|
- _goBackDatas.Remove(viewName);
|
|
|
|
|
|
+ _goBackDatas.Remove(name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -166,11 +170,12 @@ namespace GFGGame
|
|
|
|
|
|
public static void Hide(string viewName)
|
|
public static void Hide(string viewName)
|
|
{
|
|
{
|
|
- if (!_viewDic.ContainsKey(viewName))
|
|
|
|
|
|
+ string name = GetName(viewName);
|
|
|
|
+ if (!_viewDic.ContainsKey(name))
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- UIView obj = _viewDic[viewName];
|
|
|
|
|
|
+ UIView obj = _viewDic[name];
|
|
if (obj != null && obj.isShowing)
|
|
if (obj != null && obj.isShowing)
|
|
{
|
|
{
|
|
IUIView view = (IUIView)obj;
|
|
IUIView view = (IUIView)obj;
|
|
@@ -180,12 +185,12 @@ namespace GFGGame
|
|
|
|
|
|
public static void Hide<T>()
|
|
public static void Hide<T>()
|
|
{
|
|
{
|
|
- string viewName = typeof(T).FullName;
|
|
|
|
- if (!_viewDic.ContainsKey(viewName))
|
|
|
|
|
|
+ string name = GetName(typeof(T).FullName);
|
|
|
|
+ if (!_viewDic.ContainsKey(name))
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- object obj = _viewDic[viewName];
|
|
|
|
|
|
+ object obj = _viewDic[name];
|
|
if (obj != null)
|
|
if (obj != null)
|
|
{
|
|
{
|
|
IUIView view = (IUIView)obj;
|
|
IUIView view = (IUIView)obj;
|
|
@@ -195,10 +200,11 @@ namespace GFGGame
|
|
|
|
|
|
public static void GoBackFrom(string viewName, bool clearGoBackDatas = false)
|
|
public static void GoBackFrom(string viewName, bool clearGoBackDatas = false)
|
|
{
|
|
{
|
|
- ViewManager.Hide(viewName);
|
|
|
|
- if (_goBackDatas.ContainsKey(viewName))
|
|
|
|
|
|
+ string name = GetName(viewName);
|
|
|
|
+ ViewManager.Hide(name);
|
|
|
|
+ if (_goBackDatas.ContainsKey(name))
|
|
{
|
|
{
|
|
- object[] gobackItems = _goBackDatas[viewName];
|
|
|
|
|
|
+ object[] gobackItems = _goBackDatas[name];
|
|
string tViewName = gobackItems[0] as string;
|
|
string tViewName = gobackItems[0] as string;
|
|
|
|
|
|
object tViewData = null;
|
|
object tViewData = null;
|
|
@@ -217,8 +223,9 @@ namespace GFGGame
|
|
|
|
|
|
public static object[] GetGoBackDatas(string viewName)
|
|
public static object[] GetGoBackDatas(string viewName)
|
|
{
|
|
{
|
|
|
|
+ string name = GetName(viewName);
|
|
object[] value;
|
|
object[] value;
|
|
- _goBackDatas.TryGetValue(viewName, out value);
|
|
|
|
|
|
+ _goBackDatas.TryGetValue(name, out value);
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
public static void HideAllView(string excludeViewName = null)
|
|
public static void HideAllView(string excludeViewName = null)
|
|
@@ -268,5 +275,11 @@ namespace GFGGame
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ private static string GetName(string fullName)
|
|
|
|
+ {
|
|
|
|
+ string[] names = fullName.Split('.');
|
|
|
|
+ string name = names[names.Length - 1];
|
|
|
|
+ return name;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|