2024-12-14 18:27:59 +08:00
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
|
|
|
|
namespace QFramework
|
|
|
|
|
{
|
|
|
|
|
public class StrEventCondition : ICondition
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private static SimpleObjectPool<StrEventCondition> mSimpleObjectPool =
|
|
|
|
|
new SimpleObjectPool<StrEventCondition>(() => new StrEventCondition(), null, 10);
|
|
|
|
|
|
|
|
|
|
private StrEventCondition() { }
|
|
|
|
|
string key;
|
2024-12-17 18:07:20 +08:00
|
|
|
|
2024-12-14 18:27:59 +08:00
|
|
|
public static StrEventCondition Allocate(string key)
|
|
|
|
|
{
|
|
|
|
|
var conditionAction = mSimpleObjectPool.Allocate();
|
|
|
|
|
conditionAction.ActionID = ActionKit.ID_GENERATOR++;
|
|
|
|
|
conditionAction.Deinited = false;
|
|
|
|
|
conditionAction.Reset();
|
|
|
|
|
conditionAction.key = key;
|
|
|
|
|
return conditionAction;
|
|
|
|
|
}
|
|
|
|
|
public bool Check()
|
|
|
|
|
{
|
2024-12-17 18:07:20 +08:00
|
|
|
return false;
|
2024-12-14 18:27:59 +08:00
|
|
|
}
|
|
|
|
|
public bool Paused { get; set; }
|
|
|
|
|
public bool Deinited { get; set; }
|
|
|
|
|
public ulong ActionID { get; set; }
|
|
|
|
|
public ActionStatus Status { get; set; }
|
|
|
|
|
public void OnStart()
|
|
|
|
|
{
|
|
|
|
|
StringEventSystem.Global.Register(key, OnEventFnished);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnEventFnished()
|
|
|
|
|
{
|
|
|
|
|
StringEventSystem.Global.UnRegister(key, OnEventFnished);
|
2024-12-17 18:07:20 +08:00
|
|
|
this.Finish();
|
2024-12-14 18:27:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnExecute(float dt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnFinish()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Deinit()
|
|
|
|
|
{
|
|
|
|
|
if (!Deinited)
|
|
|
|
|
{
|
|
|
|
|
Deinited = true;
|
|
|
|
|
mSimpleObjectPool.Recycle(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Reset()
|
|
|
|
|
{
|
|
|
|
|
Paused = false;
|
|
|
|
|
Status = ActionStatus.NotStart;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class StrEventConditionExtension
|
|
|
|
|
{
|
|
|
|
|
public static ISequence StrEventCondition(this ISequence self, string uipath)
|
|
|
|
|
{
|
|
|
|
|
return self.Append(QFramework.StrEventCondition.Allocate(uipath));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|