using System.Threading.Tasks; namespace Model { [ObjectEvent] public class LocationProxyComponentEvent : ObjectEvent, IAwake { public void Awake() { this.Get().Awake(); } } public class LocationProxyComponent : Component { public string LocationAddress; public void Awake() { this.LocationAddress = Game.Scene.GetComponent().LocationConfig.GetComponent().Address; } public async Task Add(long key) { Session session = Game.Scene.GetComponent().Get(this.LocationAddress); await session.Call(new ObjectAddRequest() { Key = key }); } public async Task Remove(long key) { Session session = Game.Scene.GetComponent().Get(this.LocationAddress); await session.Call(new ObjectRemoveRequest() { Key = key }); } public override void Dispose() { if (this.Id == 0) { return; } base.Dispose(); } } }