using System; using System.Collections.Generic; using DotRecast.Core.Collections; using Game.JNGState.Logic.Data; using JNGame.Sync.System; using JNGame.Sync.View; using Plugins.JNGame.Util; using UnityEngine; namespace Game.JNGFrame.View { public abstract class VDEntityBasis : ViewData where T : IGDataBase { private readonly Dictionary> Event = new(); protected VDEntityBasis(SViewSystem root) : base(root) { } public override void Execute() { base.Execute(); //调用改动 var dataList = GetData(); foreach (var data in dataList){ if (views.TryGetValue(data.Id,out var view)) { data.WriteCodes.ForEach(code => { Event[code]?.Invoke((view.Data,data)); }); } } } public override void ViewUpdate(T data, GameObject view) { } public void Register(int code,Action<(GameObject View, T Data)> action) { Event[code] = action; } } }