Compare commits
No commits in common. "c1e138c2c45196c603f5c9ab4a7421d0b91e418a" and "0862d8d2cb2c140f70fa0784617950b8895a3c4d" have entirely different histories.
c1e138c2c4
...
0862d8d2cb
@ -62,7 +62,6 @@ namespace QFramework.Example
|
|||||||
protected override void OnInit(IUIData uiData = null)
|
protected override void OnInit(IUIData uiData = null)
|
||||||
{
|
{
|
||||||
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this);
|
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this);
|
||||||
StringEventSystem.Global.Register($"On{UIBody3DMenuTree.Name}Close", OnUIBody3DMenuTreeClose);
|
|
||||||
loader = ResLoader.Allocate();
|
loader = ResLoader.Allocate();
|
||||||
leftBgOriginalY = LeftBg.rectTransform.sizeDelta.y;
|
leftBgOriginalY = LeftBg.rectTransform.sizeDelta.y;
|
||||||
DragBtn.onValueChanged.AddListener(isOn =>
|
DragBtn.onValueChanged.AddListener(isOn =>
|
||||||
@ -100,6 +99,7 @@ namespace QFramework.Example
|
|||||||
|
|
||||||
MenuBtn.onClick.AddListener(() =>
|
MenuBtn.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
|
//StringEventSystem.Global.Register($"On{UIBody3DMenuTree.Name}Close", OnUIBody3DMenuTreeClose);
|
||||||
UIKit.OpenPanelAsync<UIBody3DMenuTree>(canvasLevel: UILevel.PopUI, new UIBody3DMenuTreeData() { body = mData.body }).ToAction().StartGlobal();
|
UIKit.OpenPanelAsync<UIBody3DMenuTree>(canvasLevel: UILevel.PopUI, new UIBody3DMenuTreeData() { body = mData.body }).ToAction().StartGlobal();
|
||||||
//HideSelf(true);
|
//HideSelf(true);
|
||||||
});
|
});
|
||||||
@ -357,11 +357,6 @@ namespace QFramework.Example
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnUIBody3DMenuTreeClose()
|
|
||||||
{
|
|
||||||
OnShow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查是否有相关UI
|
/// 检查是否有相关UI
|
||||||
/// 因为UI设计导致的臃肿代码
|
/// 因为UI设计导致的臃肿代码
|
||||||
@ -379,7 +374,17 @@ namespace QFramework.Example
|
|||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//private void OnUIDrawClose()
|
||||||
|
//{
|
||||||
|
// StringEventSystem.Global.UnRegister($"On{UIDraw.Name}Close", OnUIDrawClose);
|
||||||
|
// HideSelf(false);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private void OnUIBody3DMenuTreeClose()
|
||||||
|
//{
|
||||||
|
// StringEventSystem.Global.UnRegister($"On{UIBody3DMenuTree.Name}Close", OnUIBody3DMenuTreeClose);
|
||||||
|
// HideSelf(false);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
public void HideSelf(bool isTrue)
|
public void HideSelf(bool isTrue)
|
||||||
@ -426,7 +431,6 @@ namespace QFramework.Example
|
|||||||
obj.SetActive(body.isShow);
|
obj.SetActive(body.isShow);
|
||||||
bodyToggle.onValueChanged.AddListener(isOn =>
|
bodyToggle.onValueChanged.AddListener(isOn =>
|
||||||
{
|
{
|
||||||
SetAllChildren<Transform>(obj.transform, isOn);
|
|
||||||
obj.SetActive(isOn);
|
obj.SetActive(isOn);
|
||||||
});
|
});
|
||||||
var iconImg = bodyItem.transform.Find("Icon").GetComponent<Image>();
|
var iconImg = bodyItem.transform.Find("Icon").GetComponent<Image>();
|
||||||
@ -472,19 +476,6 @@ namespace QFramework.Example
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAllChildren<T>(Transform parent, bool isOn)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < parent.childCount; i++)
|
|
||||||
{
|
|
||||||
Transform trans = parent.GetChild(i);
|
|
||||||
T t = trans.GetComponent<T>();
|
|
||||||
if (t != null)
|
|
||||||
{
|
|
||||||
trans.gameObject.SetActive(isOn);
|
|
||||||
}
|
|
||||||
SetAllChildren<T>(trans, isOn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void LoadIcon(string path, Body body, Image iconImg)
|
public void LoadIcon(string path, Body body, Image iconImg)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(body.Icon) == false)
|
if (string.IsNullOrEmpty(body.Icon) == false)
|
||||||
@ -510,20 +501,6 @@ namespace QFramework.Example
|
|||||||
|
|
||||||
protected override void OnShow()
|
protected override void OnShow()
|
||||||
{
|
{
|
||||||
if (mData != null && mData.body != null && mData.body.subBody != null)
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
foreach (var item in mData.body.subBody)
|
|
||||||
{
|
|
||||||
Transform trans = BodyContent.GetChild(index);
|
|
||||||
index++;
|
|
||||||
if (item.Value.isBodyList == true)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
trans.GetComponent<Toggle>().isOn = Utility.FindObj(item.Value.Path).activeSelf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHide()
|
protected override void OnHide()
|
||||||
|
|||||||
@ -204,7 +204,6 @@ namespace QFramework.Example
|
|||||||
//DOTweenAnimation contentAnim;
|
//DOTweenAnimation contentAnim;
|
||||||
protected override void OnInit(IUIData uiData = null)
|
protected override void OnInit(IUIData uiData = null)
|
||||||
{
|
{
|
||||||
mData = uiData as UIBody3DMenuTreeData ?? new UIBody3DMenuTreeData();
|
|
||||||
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this);
|
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this);
|
||||||
//contentAnim = RootContent.GetComponent<DOTweenAnimation>();
|
//contentAnim = RootContent.GetComponent<DOTweenAnimation>();
|
||||||
// please add init code here
|
// please add init code here
|
||||||
@ -233,7 +232,6 @@ namespace QFramework.Example
|
|||||||
RefreshSearchContent(str);
|
RefreshSearchContent(str);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
BuildTreeUI(mData.body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnModuleQuithandler(OnModuleQuit quit)
|
private void OnModuleQuithandler(OnModuleQuit quit)
|
||||||
@ -244,19 +242,10 @@ namespace QFramework.Example
|
|||||||
protected override void OnOpen(IUIData uiData = null)
|
protected override void OnOpen(IUIData uiData = null)
|
||||||
{
|
{
|
||||||
mData = uiData as UIBody3DMenuTreeData ?? new UIBody3DMenuTreeData();
|
mData = uiData as UIBody3DMenuTreeData ?? new UIBody3DMenuTreeData();
|
||||||
foreach (var item in mData.body.subBody)
|
//contentAnim.DORestart();
|
||||||
{
|
Content.RemoveAllChildren();
|
||||||
if (item.Value.isBodyList)
|
objBtnDataMap.Clear();
|
||||||
{
|
BuildTreeUI(mData.body);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
GameObject obj = Utility.FindObj(item.Value.Path);
|
|
||||||
Button btn = Content.Find(item.Value.Name).Find("Content/Toggle/ObjContent/Obj").GetComponent<Button>();
|
|
||||||
if (obj.activeSelf && btn.GetComponentsInChildren<Transform>().Length <= 1)
|
|
||||||
{
|
|
||||||
btn.onClick.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private void BuildTreeUI(Body3D.Body data, int depth = 0, Transform parent = null)
|
private void BuildTreeUI(Body3D.Body data, int depth = 0, Transform parent = null)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user