2024-12-14 18:27:59 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using QFramework;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using QFramework.Example;
|
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
|
using System.ComponentModel.Design;
|
|
|
|
|
|
public class ShowAction : IAction
|
|
|
|
|
|
{
|
|
|
|
|
|
public ulong ActionID { get; set; }
|
|
|
|
|
|
public bool Deinited { get; set; }
|
|
|
|
|
|
public bool Paused { get; set; }
|
|
|
|
|
|
public ActionStatus Status { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly SimpleObjectPool<ShowAction> mPool =
|
|
|
|
|
|
new SimpleObjectPool<ShowAction>(() => new ShowAction(), null, 10);
|
|
|
|
|
|
string path;
|
2025-01-02 14:19:47 +08:00
|
|
|
|
string isShow = string.Empty;
|
|
|
|
|
|
string deviceName = string.Empty;
|
|
|
|
|
|
string isDevice = string.Empty;
|
2025-01-04 15:20:16 +08:00
|
|
|
|
string isRoot = string.Empty;
|
2025-01-02 14:19:47 +08:00
|
|
|
|
public static ShowAction Allocate(string path, Dictionary<string, string> datas, System.Action onDelayFinish = null)
|
2024-12-14 18:27:59 +08:00
|
|
|
|
{
|
|
|
|
|
|
var retNode = mPool.Allocate();
|
|
|
|
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
|
|
|
|
|
retNode.Deinited = false;
|
|
|
|
|
|
retNode.Reset();
|
|
|
|
|
|
retNode.path = path;
|
2025-01-02 14:19:47 +08:00
|
|
|
|
retNode.isShow = datas.ContainsKey("isShow") ? datas["isShow"] : string.Empty;
|
|
|
|
|
|
retNode.deviceName = datas.ContainsKey("deviceName") ? datas["deviceName"] : string.Empty;
|
|
|
|
|
|
retNode.isDevice = datas.ContainsKey("isDevice") ? datas["isDevice"] : string.Empty;
|
2025-01-04 15:20:16 +08:00
|
|
|
|
retNode.isRoot = datas.ContainsKey("isRoot") ? datas["isRoot"] : null;
|
2024-12-14 18:27:59 +08:00
|
|
|
|
return retNode;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Deinit()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!Deinited)
|
|
|
|
|
|
{
|
|
|
|
|
|
Deinited = true;
|
|
|
|
|
|
mPool.Recycle(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnExecute(float dt)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnFinish()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnStart()
|
|
|
|
|
|
{
|
2024-12-23 11:30:18 +08:00
|
|
|
|
GameObject obj = null;
|
2025-01-02 14:19:47 +08:00
|
|
|
|
if (string.IsNullOrEmpty(deviceName) == false)
|
2024-12-23 11:30:18 +08:00
|
|
|
|
{
|
2025-01-02 14:19:47 +08:00
|
|
|
|
obj = DeviceController.Instance.GetDeviceObj(deviceName);
|
2024-12-23 11:30:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-01-02 14:19:47 +08:00
|
|
|
|
if (string.IsNullOrEmpty(isDevice) == false && isDevice == "true")
|
|
|
|
|
|
{
|
|
|
|
|
|
obj = DeviceController.Instance.GetDeviceObj(path);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
obj = Utility.FindObj(path);
|
|
|
|
|
|
}
|
2024-12-23 11:30:18 +08:00
|
|
|
|
}
|
2025-01-02 14:19:47 +08:00
|
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
|
if (obj == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD> :" + path);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-01-02 14:19:47 +08:00
|
|
|
|
bool isActive = true;
|
|
|
|
|
|
bool.TryParse(isShow, out isActive);
|
2025-01-04 15:20:16 +08:00
|
|
|
|
if (string.IsNullOrEmpty(isRoot))
|
|
|
|
|
|
{
|
|
|
|
|
|
obj.SetActive(isActive);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (isRoot == "true")
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < obj.transform.childCount; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
obj.transform.GetChild(i).gameObject.SetActive(isActive);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-14 18:27:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.Finish();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Reset()
|
|
|
|
|
|
{
|
|
|
|
|
|
Status = ActionStatus.NotStart;
|
|
|
|
|
|
Paused = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|