2025-07-08 10:46:31 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Superlazy.UI
|
|
|
|
|
{
|
|
|
|
|
public class SLUIEventList : SLUIList
|
|
|
|
|
{
|
|
|
|
|
public float duration = 999.9f;
|
|
|
|
|
|
|
|
|
|
private string path = null;
|
|
|
|
|
private string instanceID = null;
|
|
|
|
|
private int index;
|
|
|
|
|
|
|
|
|
|
public override string BindPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (path == null)
|
|
|
|
|
{
|
|
|
|
|
path = "UI." + GetInstanceID();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SLEntity Session
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (instanceID == null) instanceID = GetInstanceID().ToString();
|
|
|
|
|
|
|
|
|
|
return SLGame.Session["UI"][instanceID];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool CheckAddKey(SLEntity session, string key)
|
|
|
|
|
{
|
|
|
|
|
if (SLGame.Session["UIAdd"][instanceID][key])
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnAddKey(SLEntity session, string key)
|
|
|
|
|
{
|
|
|
|
|
var eventKey = index.ToString();
|
|
|
|
|
Session[eventKey] = session[key].Link();
|
|
|
|
|
Session[eventKey]["Duration"] = duration;
|
|
|
|
|
SLGame.Session["UIAdd"][instanceID][key] = true;
|
|
|
|
|
AddEntity(eventKey);
|
|
|
|
|
index += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool CheckRemoveKey(SLEntity session, string key)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
var removeKeys = new List<string>();
|
|
|
|
|
foreach (var item in Session)
|
|
|
|
|
{
|
|
|
|
|
item["Duration"] -= Time.deltaTime;
|
|
|
|
|
if (item["Duration"] <= 0)
|
|
|
|
|
{
|
|
|
|
|
RemoveEntity(item.ID);
|
|
|
|
|
removeKeys.Add(item.ID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var key in removeKeys)
|
|
|
|
|
{
|
|
|
|
|
Session[key] = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Enable()
|
|
|
|
|
{
|
|
|
|
|
base.Enable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Disable()
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in Session)
|
|
|
|
|
{
|
|
|
|
|
RemoveEntity(item.ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SLGame.Session["UI"][instanceID] = false;
|
|
|
|
|
|
|
|
|
|
base.Disable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Clear()
|
|
|
|
|
{
|
|
|
|
|
SLGame.Session["UIAdd"] = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|