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;
|
|
|
|
|
|
|
2025-06-30 16:14:40 +08:00
|
|
|
|
|
|
|
|
|
|
public string speed;
|
|
|
|
|
|
|
2025-05-29 10:36:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
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();
|
2025-06-30 16:14:40 +08:00
|
|
|
|
string speed = mData.speed.ToString();
|
2025-05-29 10:36:58 +08:00
|
|
|
|
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(() => {
|
|
|
|
|
|
|
2025-06-30 16:14:40 +08:00
|
|
|
|
UIGuideTipData data = UIKit.GetPanel<UIGuideTip>().Data;
|
|
|
|
|
|
|
2025-05-29 10:36:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-06-30 16:14:40 +08:00
|
|
|
|
UIKit.ClosePanel<UIGuideTip>();
|
|
|
|
|
|
UIKit.ClosePanel<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
|
|
|
|
|
2025-06-30 16:14:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIKit.OpenPanel<UIGuideTip>(uiData: data, canvasLevel: UILevel.Common);
|
|
|
|
|
|
//UIKit.OpenPanelAsync<UIGuideTip>(uiData: data, canvasLevel: UILevel.Common).ToAction().StartGlobal(() => {
|
|
|
|
|
|
// UIKit.GetPanel<UIGuideTip>().isUpdate = true;
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Debug.Log("<22><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>");
|
|
|
|
|
|
}, speed);
|
2025-05-29 10:36:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-30 16:14:40 +08:00
|
|
|
|
public void PlayReverseAnimation(string path, string animName, Action OnFinishAction, string speed)
|
2025-05-29 10:36:58 +08:00
|
|
|
|
{
|
|
|
|
|
|
var data = new Dictionary<string, string>
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "animName", animName },
|
2025-06-30 16:14:40 +08:00
|
|
|
|
{ "speed",speed } // <20><><EFBFBD><EFBFBD>-1ʵ<31>ֵ<EFBFBD><D6B5><EFBFBD>
|
2025-05-29 10:36:58 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var action = AnimationAction.Allocate(path, data);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ûص<C3BB>
|
|
|
|
|
|
action.OnFinished += () =>
|
|
|
|
|
|
{
|
2025-06-30 16:14:40 +08:00
|
|
|
|
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɻص<C9BB><D8B5><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
|
|
|
|
|
|
action.Finish();
|
|
|
|
|
|
OnFinishAction?.Invoke(); action.Deinit();
|
|
|
|
|
|
|
2025-05-29 10:36:58 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
action.OnStart();
|
|
|
|
|
|
ActionKit.Sequence().Append(action).StartGlobal();
|
2025-06-30 16:14:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GameObject obj = Utility.FindObj(path);
|
|
|
|
|
|
// obj.SetActive(true);
|
|
|
|
|
|
|
|
|
|
|
|
//Animation anim = obj.GetComponent<Animation>();
|
|
|
|
|
|
// anim.clip = anim[animName].clip;
|
|
|
|
|
|
// anim[animName].speed = speed.ToFloat();
|
|
|
|
|
|
// anim.Play();
|
|
|
|
|
|
// if (OnFinishAction!=null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// OnFinishAction.Invoke();
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-29 10:36:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
protected override void OnShow()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnHide()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnClose()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|