2025-03-18 10:34:06 +08:00
|
|
|
|
using DG.Tweening;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using TMPro;
|
2025-02-10 17:23:54 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using XMLTool;
|
2025-02-21 11:49:10 +08:00
|
|
|
|
using System;
|
2025-03-18 10:34:06 +08:00
|
|
|
|
using static XMLTool.Body3D;
|
2025-02-10 17:23:54 +08:00
|
|
|
|
|
|
|
|
|
|
namespace QFramework.Example
|
|
|
|
|
|
{
|
|
|
|
|
|
public class UIBody3DData : UIPanelData
|
|
|
|
|
|
{
|
2025-02-11 16:42:39 +08:00
|
|
|
|
public Body3D.Body body = new Body3D.Body();
|
2025-02-10 17:23:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
public partial class UIBody3D : UIPanel
|
|
|
|
|
|
{
|
2025-02-14 13:20:54 +08:00
|
|
|
|
GameObject root;
|
2025-02-14 17:09:41 +08:00
|
|
|
|
public Dictionary<string, Body> bodyList { get; set; } = new Dictionary<string, Body>();
|
|
|
|
|
|
public class BodyListItem
|
|
|
|
|
|
{
|
|
|
|
|
|
public Body3D.Body root;
|
|
|
|
|
|
public List<string> bodys = new List<string>();
|
|
|
|
|
|
public int index = 0;
|
|
|
|
|
|
|
|
|
|
|
|
public string GetCurName()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (index > bodys.Count - 1 || index < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
return bodys[index];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Add()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (index < bodys.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
string name = bodys[index];
|
|
|
|
|
|
var body = root.subBody[name];
|
|
|
|
|
|
Utility.FindObj(body.Path)?.SetActive(true);
|
|
|
|
|
|
index++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Sub()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (index > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
index--;
|
|
|
|
|
|
string name = bodys[index];
|
|
|
|
|
|
var body = root.subBody[name];
|
|
|
|
|
|
Utility.FindObj(body.Path)?.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Dictionary<string, BodyListItem> bodyListIndex = new Dictionary<string, BodyListItem>();
|
2025-03-11 16:27:06 +08:00
|
|
|
|
float leftBgOriginalY = 0;
|
2025-03-13 14:47:53 +08:00
|
|
|
|
ResLoader loader;
|
2025-03-17 17:21:06 +08:00
|
|
|
|
Shader shader;
|
2025-02-10 17:23:54 +08:00
|
|
|
|
protected override void OnInit(IUIData uiData = null)
|
|
|
|
|
|
{
|
2025-03-11 10:33:07 +08:00
|
|
|
|
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuithandler).UnRegisterWhenGameObjectDestroyed(this);
|
2025-03-13 14:47:53 +08:00
|
|
|
|
loader = ResLoader.Allocate();
|
2025-03-11 16:27:06 +08:00
|
|
|
|
leftBgOriginalY = LeftBg.rectTransform.sizeDelta.y;
|
2025-02-13 11:02:16 +08:00
|
|
|
|
DragBtn.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
2025-03-11 15:22:41 +08:00
|
|
|
|
CheckHighUI(DragBtn.transform, isOn);
|
2025-02-13 17:21:18 +08:00
|
|
|
|
DragBtn.transform.Find("SubBtns").gameObject.SetActive(isOn);
|
2025-02-13 11:02:16 +08:00
|
|
|
|
Body3DController.Instance.allowDrag = isOn;
|
2025-02-13 17:39:33 +08:00
|
|
|
|
Body3DController.Instance.SetStatus(Body3DController.Status.Drag, isOn);
|
2025-02-13 11:02:16 +08:00
|
|
|
|
TypeEventSystem.Global.Send<OnBody3DDragChanged>();
|
|
|
|
|
|
});
|
|
|
|
|
|
DragBack.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
2025-02-14 13:20:54 +08:00
|
|
|
|
GameObject obj = Body3DController.Instance.PopMoveObj();
|
|
|
|
|
|
if (obj != null)
|
|
|
|
|
|
{
|
2025-03-26 14:11:26 +08:00
|
|
|
|
obj.GetComponent<IObjDrag>().OnDoubleClick();
|
2025-02-14 13:20:54 +08:00
|
|
|
|
}
|
2025-02-13 17:21:18 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
ActiveBtn.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
2025-03-11 15:22:41 +08:00
|
|
|
|
CheckHighUI(ActiveBtn.transform, isOn);
|
2025-02-13 17:21:18 +08:00
|
|
|
|
ActiveBtn.transform.Find("SubBtns").gameObject.SetActive(isOn);
|
2025-02-13 17:39:33 +08:00
|
|
|
|
Body3DController.Instance.SetStatus(Body3DController.Status.Active, isOn);
|
2025-02-13 17:21:18 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
ActiveBack.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
2025-02-14 08:58:46 +08:00
|
|
|
|
Body3DController.Instance.PopActiveObj()?.gameObject.SetActive(true);
|
2025-02-13 11:02:16 +08:00
|
|
|
|
});
|
2025-02-14 13:20:54 +08:00
|
|
|
|
ResetBtn.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
ResetCamera(0.5f);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-02-17 17:03:48 +08:00
|
|
|
|
MenuBtn.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
2025-03-12 16:25:21 +08:00
|
|
|
|
//StringEventSystem.Global.Register($"On{UIBody3DMenuTree.Name}Close", OnUIBody3DMenuTreeClose);
|
2025-02-17 17:03:48 +08:00
|
|
|
|
UIKit.OpenPanelAsync<UIBody3DMenuTree>(canvasLevel: UILevel.PopUI, new UIBody3DMenuTreeData() { body = mData.body }).ToAction().StartGlobal();
|
2025-03-12 16:25:21 +08:00
|
|
|
|
//HideSelf(true);
|
2025-02-17 17:03:48 +08:00
|
|
|
|
});
|
2025-02-19 13:07:05 +08:00
|
|
|
|
DragReset.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
while (Body3DController.Instance.moveObjs.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject obj = Body3DController.Instance.PopMoveObj();
|
|
|
|
|
|
if (obj != null)
|
|
|
|
|
|
{
|
2025-03-26 14:11:26 +08:00
|
|
|
|
obj.GetComponent<IObjDrag>().OnDoubleClick();
|
2025-02-19 13:07:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
HideAll.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
2025-03-17 14:51:03 +08:00
|
|
|
|
LeftBg.GetComponent<Mask>().enabled = true;
|
2025-03-11 16:27:06 +08:00
|
|
|
|
DOTween.To(() => LeftBg.rectTransform.sizeDelta.y,
|
|
|
|
|
|
(value) => { LeftBg.rectTransform.sizeDelta = new Vector2(LeftBg.rectTransform.sizeDelta.x, value); }, 52f, 0.5f).OnComplete(() =>
|
|
|
|
|
|
{
|
2025-03-26 14:26:52 +08:00
|
|
|
|
//LeftBg.transform.GetChild(0).gameObject.SetActive(false);
|
|
|
|
|
|
HideAll.transform.SetAsFirstSibling();
|
2025-03-11 16:27:06 +08:00
|
|
|
|
});
|
2025-02-19 14:01:21 +08:00
|
|
|
|
RightContent.GetComponent<DOTweenAnimation>().DORestart();
|
2025-02-19 13:07:05 +08:00
|
|
|
|
HideAll.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><>ʾ";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-03-26 14:26:52 +08:00
|
|
|
|
|
|
|
|
|
|
HideAll.transform.SetAsLastSibling();
|
2025-03-11 16:27:06 +08:00
|
|
|
|
DOTween.To(() => LeftBg.rectTransform.sizeDelta.y,
|
2025-03-17 14:51:03 +08:00
|
|
|
|
(value) => { LeftBg.rectTransform.sizeDelta = new Vector2(LeftBg.rectTransform.sizeDelta.x, value); }, leftBgOriginalY, 0.5f).OnComplete(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
LeftBg.GetComponent<Mask>().enabled = false;
|
|
|
|
|
|
});
|
2025-02-19 14:01:21 +08:00
|
|
|
|
RightContent.GetComponent<DOTweenAnimation>().DOPlayBackwards();
|
2025-02-19 13:07:05 +08:00
|
|
|
|
HideAll.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><><EFBFBD><EFBFBD>";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-19 14:01:21 +08:00
|
|
|
|
CloseBtn.gameObject.SetActive(!isOn);
|
2025-02-19 13:07:05 +08:00
|
|
|
|
});
|
2025-02-17 17:03:48 +08:00
|
|
|
|
|
2025-02-19 16:33:28 +08:00
|
|
|
|
|
|
|
|
|
|
MouseBtn.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
2025-03-11 15:22:41 +08:00
|
|
|
|
CheckHighUI(MouseBtn.transform, isOn);
|
2025-02-19 16:33:28 +08:00
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIKit.OpenPanelAsync<UIBody3DMouse>().ToAction().StartGlobal();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
UIKit.HidePanel<UIBody3DMouse>();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-02-21 11:49:10 +08:00
|
|
|
|
|
2025-03-14 11:24:44 +08:00
|
|
|
|
DrawBtn.onValueChanged.AddListener((isOn) =>
|
2025-02-21 11:49:10 +08:00
|
|
|
|
{
|
2025-03-14 11:24:44 +08:00
|
|
|
|
CheckHighUI(DrawBtn.transform, isOn);
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIKit.OpenPanelAsync<UIDraw>().ToAction().StartGlobal();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
UIKit.HidePanel<UIDraw>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-21 11:49:10 +08:00
|
|
|
|
|
|
|
|
|
|
});
|
2025-03-11 13:04:58 +08:00
|
|
|
|
|
2025-03-17 17:21:06 +08:00
|
|
|
|
|
|
|
|
|
|
RotMode.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
RotMode.transform.Find("Normal").gameObject.SetActive(false);
|
|
|
|
|
|
RotMode.transform.Find("High").gameObject.SetActive(true);
|
|
|
|
|
|
RotMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת";
|
|
|
|
|
|
|
|
|
|
|
|
RotMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
Show3DCamera.instance.ChangeMode(Show3DCamera.RotationType.Spherical);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
RotMode.transform.Find("Normal").gameObject.SetActive(true);
|
|
|
|
|
|
RotMode.transform.Find("High").gameObject.SetActive(false);
|
|
|
|
|
|
RotMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "ֱ<><D6B1><EFBFBD><EFBFBD>ת";
|
|
|
|
|
|
RotMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
Show3DCamera.instance.ChangeMode(Show3DCamera.RotationType.Orbit);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LineMode.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
LineMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "ȡ<><C8A1><EFBFBD>߿<EFBFBD>";
|
|
|
|
|
|
LineMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
if (shader == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
shader = Shader.Find("URP/WhiteOutline");
|
|
|
|
|
|
}
|
|
|
|
|
|
TypeEventSystem.Global.Send(new OnChangeMat() { shader = shader });
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
LineMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22>߿<EFBFBD>ģʽ";
|
|
|
|
|
|
LineMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
TypeEventSystem.Global.Send(new OnChangeMat() { shader = null });
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LockMode.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
LockMode.transform.Find("Normal").gameObject.SetActive(false);
|
|
|
|
|
|
LockMode.transform.Find("High").gameObject.SetActive(true);
|
|
|
|
|
|
LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ";
|
|
|
|
|
|
LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
LockMode.transform.Find("Normal").gameObject.SetActive(true);
|
|
|
|
|
|
LockMode.transform.Find("High").gameObject.SetActive(false);
|
|
|
|
|
|
LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ";
|
|
|
|
|
|
LockMode.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
}
|
2025-03-25 13:23:47 +08:00
|
|
|
|
TypeEventSystem.Global.Send<OnLock>(new OnLock() { isLock = isOn });
|
2025-03-17 17:21:06 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2025-03-18 10:34:06 +08:00
|
|
|
|
|
|
|
|
|
|
CloseBtn.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Hide();
|
|
|
|
|
|
TypeEventSystem.Global.Send<OnModuleQuit>();
|
|
|
|
|
|
UIKit.OpenPanelAsync<UIModuleSelect>().ToAction().StartGlobal();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
BgBtn.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
BgBtn.transform.Find("High").gameObject.SetActive(true);
|
|
|
|
|
|
BgSelect.GetComponent<DOTweenAnimation>().DOPlayForward();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
BgBtn.transform.Find("High").gameObject.SetActive(false);
|
|
|
|
|
|
BgSelect.GetComponent<DOTweenAnimation>().DOPlayBackwards();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
White.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
White.transform.Find("High").gameObject.SetActive(isOn);
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
2025-03-18 15:22:05 +08:00
|
|
|
|
StringEventSystem.Global.Send<string>("BgChange", White.name);
|
2025-03-18 10:34:06 +08:00
|
|
|
|
White.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
White.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
Black.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Black.transform.Find("High").gameObject.SetActive(isOn);
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
2025-03-18 15:22:05 +08:00
|
|
|
|
StringEventSystem.Global.Send<string>("BgChange", Black.name);
|
2025-03-18 10:34:06 +08:00
|
|
|
|
Black.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Black.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
Grey.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Grey.transform.Find("High").gameObject.SetActive(isOn);
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
2025-03-18 15:22:05 +08:00
|
|
|
|
StringEventSystem.Global.Send<string>("BgChange", Grey.name);
|
2025-03-18 10:34:06 +08:00
|
|
|
|
Grey.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Grey.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
Gradient.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Gradient.transform.Find("High").gameObject.SetActive(isOn);
|
|
|
|
|
|
if (isOn)
|
|
|
|
|
|
{
|
2025-03-18 15:22:05 +08:00
|
|
|
|
StringEventSystem.Global.Send<string>("BgChange", Gradient.name);
|
2025-03-18 10:34:06 +08:00
|
|
|
|
Gradient.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Gradient.transform.Find("Label").GetComponent<TextMeshProUGUI>().color = new Color(74f / 255f, 91f / 255f, 116f / 255f);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PicBtn.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
2025-03-18 16:23:55 +08:00
|
|
|
|
string fileName = ChinarFileController.SaveProject(".png");
|
2025-03-18 10:34:06 +08:00
|
|
|
|
if (string.IsNullOrEmpty(fileName))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
TypeEventSystem.Global.Send<BeginScreenShot>(new BeginScreenShot());
|
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
//string fileName = "Screenshot_" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
|
|
|
|
|
|
// <20><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
ScreenCapture.CaptureScreenshot(fileName);
|
|
|
|
|
|
|
|
|
|
|
|
ActionKit.DelayFrame(1, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
|
TypeEventSystem.Global.Send<EndScreenShot>(new EndScreenShot());
|
|
|
|
|
|
}).StartGlobal();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-03-18 16:23:55 +08:00
|
|
|
|
|
|
|
|
|
|
help.onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
UIKit.OpenPanelAsync<UIHelp>(canvasLevel: UILevel.PopUI).ToAction().Start(this);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-03-11 13:04:58 +08:00
|
|
|
|
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
|
|
|
|
|
|
|
2025-02-10 17:23:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-18 10:34:06 +08:00
|
|
|
|
|
2025-03-11 15:22:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UI
|
|
|
|
|
|
/// <20><>ΪUI<55><49><EFBFBD>Ƶ<EFBFBD><C6B5>µ<EFBFBD>ӷ<EFBFBD>״<EFBFBD><D7B4><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void CheckHighUI(Transform trans, bool isOn)
|
|
|
|
|
|
{
|
|
|
|
|
|
Transform target = trans.Find("High");
|
|
|
|
|
|
if (target != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
target.gameObject.SetActive(isOn);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-11 10:33:07 +08:00
|
|
|
|
private void OnModuleQuithandler(OnModuleQuit quit)
|
|
|
|
|
|
{
|
|
|
|
|
|
Hide();
|
|
|
|
|
|
}
|
2025-02-21 11:49:10 +08:00
|
|
|
|
|
2025-03-14 11:24:44 +08:00
|
|
|
|
//private void OnUIDrawClose()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// StringEventSystem.Global.UnRegister($"On{UIDraw.Name}Close", OnUIDrawClose);
|
|
|
|
|
|
// HideSelf(false);
|
|
|
|
|
|
//}
|
2025-02-19 14:01:21 +08:00
|
|
|
|
|
2025-03-12 16:25:21 +08:00
|
|
|
|
//private void OnUIBody3DMenuTreeClose()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// StringEventSystem.Global.UnRegister($"On{UIBody3DMenuTree.Name}Close", OnUIBody3DMenuTreeClose);
|
|
|
|
|
|
// HideSelf(false);
|
|
|
|
|
|
//}
|
2025-02-21 11:49:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-02-19 14:01:21 +08:00
|
|
|
|
public void HideSelf(bool isTrue)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isTrue)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
HideAll.GetComponent<DOTweenAnimation>().DORestart();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
HideAll.GetComponent<DOTweenAnimation>().DOPlayBackwards();
|
|
|
|
|
|
}
|
|
|
|
|
|
HideAll.isOn = isTrue;
|
|
|
|
|
|
CloseBtn.gameObject.SetActive(!isTrue);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 17:23:54 +08:00
|
|
|
|
protected override void OnOpen(IUIData uiData = null)
|
|
|
|
|
|
{
|
2025-02-19 13:07:05 +08:00
|
|
|
|
if (uiData != null)
|
2025-02-17 17:03:48 +08:00
|
|
|
|
{
|
|
|
|
|
|
mData = uiData as UIBody3DData ?? new UIBody3DData();
|
|
|
|
|
|
}
|
2025-02-10 17:23:54 +08:00
|
|
|
|
BodyContent.RemoveAllChildren();
|
2025-02-14 13:20:54 +08:00
|
|
|
|
root = Utility.FindObj(mData.body.Path);
|
2025-02-13 17:21:18 +08:00
|
|
|
|
root.SetActive(true);
|
2025-02-14 17:09:41 +08:00
|
|
|
|
bodyList.Clear();
|
2025-03-19 11:05:35 +08:00
|
|
|
|
TitleName.text = Global.Instance.curModule.ModuleName;
|
2025-02-12 17:36:00 +08:00
|
|
|
|
foreach (var bodyData in mData.body.subBody)
|
2025-02-10 17:23:54 +08:00
|
|
|
|
{
|
2025-02-14 17:09:41 +08:00
|
|
|
|
if (bodyData.Value.isBodyList == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
bodyList.Add(bodyData.Value.Name, bodyData.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var body = bodyData.Value;
|
|
|
|
|
|
var bodyItem = GameObject.Instantiate(BodyItem.gameObject, BodyContent);
|
2025-03-12 16:58:48 +08:00
|
|
|
|
bodyItem.transform.Find("Content/Btns").gameObject.SetActive(false);
|
|
|
|
|
|
bodyItem.transform.Find("Content/Label").GetComponent<TextMeshProUGUI>().text = body.Name;
|
2025-02-14 17:09:41 +08:00
|
|
|
|
var bodyToggle = bodyItem.GetComponent<Toggle>();
|
|
|
|
|
|
bodyToggle.isOn = body.isShow;
|
|
|
|
|
|
GameObject obj = Utility.FindObj(body.Path);
|
|
|
|
|
|
obj.SetActive(body.isShow);
|
|
|
|
|
|
bodyToggle.onValueChanged.AddListener(isOn =>
|
|
|
|
|
|
{
|
|
|
|
|
|
obj.SetActive(isOn);
|
|
|
|
|
|
});
|
2025-04-01 08:55:49 +08:00
|
|
|
|
var iconImg = bodyItem.transform.Find("Icon").GetComponent<Image>();
|
2025-03-13 14:47:53 +08:00
|
|
|
|
LoadIcon(body.Icon, body, iconImg);
|
2025-02-14 17:09:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
BodyList.RemoveAllChildren();
|
2025-02-17 17:03:48 +08:00
|
|
|
|
bodyListIndex.Clear();
|
2025-02-14 17:09:41 +08:00
|
|
|
|
foreach (var list in bodyList)
|
|
|
|
|
|
{
|
|
|
|
|
|
var body = list.Value;
|
2025-03-12 16:58:48 +08:00
|
|
|
|
//var add = GameObject.Instantiate(BodyBtn.gameObject, BodyList);
|
|
|
|
|
|
//var sub = GameObject.Instantiate(BodyBtn.gameObject, BodyList);
|
|
|
|
|
|
//add.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = body.Name + "+";
|
|
|
|
|
|
//sub.transform.Find("Label").GetComponent<TextMeshProUGUI>().text = body.Name + "-";
|
|
|
|
|
|
//sub.name = add.name = body.Name;
|
2025-02-14 17:09:41 +08:00
|
|
|
|
bodyListIndex.Add(body.Name, new BodyListItem() { index = 0, root = body });
|
2025-02-17 17:03:48 +08:00
|
|
|
|
bodyListIndex[body.Name].bodys.Clear();
|
2025-02-14 17:09:41 +08:00
|
|
|
|
foreach (var subList in body.subBody)
|
|
|
|
|
|
{
|
|
|
|
|
|
bodyListIndex[body.Name].bodys.Add(subList.Value.Name);
|
|
|
|
|
|
Utility.FindObj(subList.Value.Path)?.SetActive(false);
|
|
|
|
|
|
}
|
2025-03-12 16:58:48 +08:00
|
|
|
|
|
|
|
|
|
|
var bodyItem = GameObject.Instantiate(BodyItem.gameObject, BodyContent);
|
|
|
|
|
|
bodyItem.transform.Find("Content/Label").GetComponent<TextMeshProUGUI>().text = body.Name;
|
|
|
|
|
|
bodyItem.GetComponent<Toggle>().interactable = false;
|
|
|
|
|
|
var add = bodyItem.transform.Find("Content/Btns/Add").gameObject;
|
|
|
|
|
|
var sub = bodyItem.transform.Find("Content/Btns/Sub").gameObject;
|
|
|
|
|
|
sub.name = add.name = body.Name;
|
2025-02-14 17:09:41 +08:00
|
|
|
|
add.GetComponent<Button>().onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
bodyListIndex[add.name]?.Add();
|
|
|
|
|
|
});
|
|
|
|
|
|
sub.GetComponent<Button>().onClick.AddListener(() =>
|
2025-02-10 17:23:54 +08:00
|
|
|
|
{
|
2025-02-14 17:09:41 +08:00
|
|
|
|
bodyListIndex[add.name]?.Sub();
|
2025-02-10 17:23:54 +08:00
|
|
|
|
});
|
2025-03-12 16:58:48 +08:00
|
|
|
|
|
2025-03-13 14:47:53 +08:00
|
|
|
|
var iconImg = bodyItem.transform.Find("Icon").GetComponent<Image>();
|
|
|
|
|
|
LoadIcon(body.Icon, body, iconImg);
|
2025-02-10 17:23:54 +08:00
|
|
|
|
}
|
2025-02-13 17:21:18 +08:00
|
|
|
|
FreeCameraController.instance.gameObject.SetActive(false);
|
|
|
|
|
|
Show3DCamera.instance.gameObject.SetActive(true);
|
2025-02-14 13:20:54 +08:00
|
|
|
|
ResetCamera(-1);
|
2025-03-14 11:24:44 +08:00
|
|
|
|
loader.LoadAsync();
|
2025-02-13 11:02:16 +08:00
|
|
|
|
|
2025-02-10 17:23:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-13 14:47:53 +08:00
|
|
|
|
public void LoadIcon(string path, Body body, Image iconImg)
|
|
|
|
|
|
{
|
2025-03-14 11:24:44 +08:00
|
|
|
|
if (string.IsNullOrEmpty(body.Icon) == false)
|
|
|
|
|
|
{
|
2025-04-01 08:55:49 +08:00
|
|
|
|
iconImg.gameObject.name = body.Icon;
|
2025-03-14 11:24:44 +08:00
|
|
|
|
var localImageUrl = Global.imagePath + body.Icon;
|
|
|
|
|
|
loader.Add2Load(localImageUrl.ToNetImageResName(),
|
|
|
|
|
|
(bool success, IRes res) =>
|
2025-03-13 14:47:53 +08:00
|
|
|
|
{
|
2025-03-14 11:24:44 +08:00
|
|
|
|
if (success)
|
|
|
|
|
|
{
|
|
|
|
|
|
iconImg.sprite = Utility.GetSprite(res.Asset as Texture2D);
|
|
|
|
|
|
iconImg.SetNativeSize();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-03-13 14:47:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-14 13:20:54 +08:00
|
|
|
|
public void ResetCamera(float moveTime)
|
|
|
|
|
|
{
|
2025-03-11 13:59:38 +08:00
|
|
|
|
Show3DCamera.instance.ResetCamera(root.transform);
|
2025-02-14 13:20:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 17:23:54 +08:00
|
|
|
|
protected override void OnShow()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnHide()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnClose()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|