2025-05-29 10:36:58 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using QFramework;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using static OperationController;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace QFramework.Example
|
|
|
|
|
|
{
|
|
|
|
|
|
public class UIBtnAnimData : UIPanelData
|
|
|
|
|
|
{
|
|
|
|
|
|
public String title;
|
|
|
|
|
|
|
2025-05-29 15:08:28 +08:00
|
|
|
|
public String Obj;
|
|
|
|
|
|
public String AnimObj;
|
2025-05-29 10:36:58 +08:00
|
|
|
|
public String size;
|
|
|
|
|
|
|
|
|
|
|
|
public String pos;
|
|
|
|
|
|
|
|
|
|
|
|
public String animName;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public partial class UIBtnAnim : UIPanel
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void OnInit(IUIData uiData = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
mData = uiData as UIBtnAnimData ?? new UIBtnAnimData();
|
|
|
|
|
|
// please add init code here
|
|
|
|
|
|
TypeEventSystem.Global.Register<OnModuleQuit>((arg) => Hide()).UnRegisterWhenGameObjectDestroyed(gameObject);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnStepChanged(StepStatusOnChange change)
|
|
|
|
|
|
{
|
|
|
|
|
|
Hide();
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void OnOpen(IUIData uiData = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mData = uiData as UIBtnAnimData ?? new UIBtnAnimData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> title = mData.title.Split('|')?.ToList();
|
2025-05-29 15:08:28 +08:00
|
|
|
|
List<String> Obj = mData.Obj.Split('|')?.ToList();
|
|
|
|
|
|
List<String> targetObj = mData.AnimObj.Split('|')?.ToList();
|
2025-05-29 10:36:58 +08:00
|
|
|
|
List<String> size = mData.size.Split('|')?.ToList();
|
|
|
|
|
|
List<String> pos = mData.pos.Split('|')?.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < title.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int j = i;
|
|
|
|
|
|
|
|
|
|
|
|
GameObject ButtonItemObj = GameObject.Instantiate(Button.gameObject, Connet);
|
|
|
|
|
|
ButtonItemObj.name = title[i];
|
|
|
|
|
|
|
|
|
|
|
|
Vector2 positem = Utility.GetVector2FromStrArray(pos[j]);
|
|
|
|
|
|
Vector2 sizeData = Utility.GetVector2FromStrArray(size[j]);
|
|
|
|
|
|
|
|
|
|
|
|
ButtonItemObj.GetComponent<RectTransform>().sizeDelta = sizeData;
|
|
|
|
|
|
ButtonItemObj.GetComponent<RectTransform>().localPosition = positem;
|
2025-05-29 15:08:28 +08:00
|
|
|
|
GameObject obj = Utility.FindObj(Obj[j]);
|
2025-05-29 10:36:58 +08:00
|
|
|
|
|
2025-05-29 15:08:28 +08:00
|
|
|
|
GameObject AnimObj = Utility.FindObj(targetObj[j]);
|
2025-05-29 10:36:58 +08:00
|
|
|
|
|
2025-05-29 15:08:28 +08:00
|
|
|
|
AnimObj.GetComponent<Animation>();
|
2025-05-29 10:36:58 +08:00
|
|
|
|
|
|
|
|
|
|
ButtonItemObj.transform.Find("TitleText").GetComponent<Text>().text = title[j];
|
|
|
|
|
|
ButtonItemObj.transform.GetComponent<Button>().onClick.RemoveAllListeners();
|
|
|
|
|
|
ButtonItemObj.transform.GetComponent<Button>().onClick.AddListener(() => {
|
|
|
|
|
|
|
|
|
|
|
|
UIGuideTipData data = new UIGuideTipData();
|
|
|
|
|
|
data = UIKit.GetPanel<UIGuideTip>().Data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIKit.HidePanel<UIGuideTip>();
|
|
|
|
|
|
UIKit.HidePanel<UITextWindow>();
|
2025-05-29 15:08:28 +08:00
|
|
|
|
obj.gameObject.SetActive(false);
|
|
|
|
|
|
AnimObj.gameObject.SetActive(true);
|
2025-05-29 10:36:58 +08:00
|
|
|
|
PlayReverseAnimation(targetObj[j], mData.animName, () => {
|
2025-05-29 15:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AnimObj.gameObject.SetActive(false);
|
|
|
|
|
|
obj.gameObject.SetActive(true);
|
2025-05-29 10:36:58 +08:00
|
|
|
|
UIKit.OpenPanelAsync<UIGuideTip>(uiData: data, canvasLevel: UILevel.Common).ToAction().StartGlobal();
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-29 15:08:28 +08:00
|
|
|
|
// Debug.Log("<22><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>");
|
2025-05-29 10:36:58 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void PlayReverseAnimation(string path, string animName, Action OnFinishAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
var data = new Dictionary<string, string>
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "animName", animName },
|
|
|
|
|
|
{ "speed", "-1" } // <20><><EFBFBD><EFBFBD>-1ʵ<31>ֵ<EFBFBD><D6B5><EFBFBD>
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var action = AnimationAction.Allocate(path, data);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ûص<C3BB>
|
|
|
|
|
|
action.OnFinished += () =>
|
|
|
|
|
|
{
|
2025-05-29 15:08:28 +08:00
|
|
|
|
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɻص<C9BB><D8B5><EFBFBD><EFBFBD><EFBFBD>");
|
2025-05-29 10:36:58 +08:00
|
|
|
|
OnFinishAction?.Invoke();
|
|
|
|
|
|
action.Deinit();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
action.OnStart();
|
|
|
|
|
|
ActionKit.Sequence().Append(action).StartGlobal();
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void OnShow()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnHide()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnClose()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|