private void EquipmentObserver_SetDirty(IObserver observer, Action <IObserver> callback) { QueryConsumablesInTown consumableQuery = new QueryConsumablesInTown { CID = this.CID }; consumableQuery.OnComplete += delegate(Operation op) { observer.Cache = consumableQuery; if (consumableQuery.Consumables != null) { BattleInventory battleInventory = new BattleInventory(); foreach (KeyValuePair <int, ConsumablesInfo> keyValuePair in consumableQuery.Consumables) { battleInventory.SetConsumable(keyValuePair.Key, keyValuePair.Value); } this.FrontendConn.RequestOperation(SendPacket.Create <UpdateBattleInventoryInTownMessage>(new UpdateBattleInventoryInTownMessage { BattleInventory = battleInventory })); } observer.EndSync(true); callback(observer); }; consumableQuery.OnFail += delegate(Operation op) { observer.EndSync(false); callback(observer); }; observer.Connection.RequestOperation(consumableQuery); }
private void LookObserver_SetDirty(IObserver observer, Action <IObserver> callback) { WhoIs whois = new WhoIs(WhoIsOption.Stat | WhoIsOption.Costume); whois.OnComplete += delegate(Operation op) { observer.Cache = whois; this.Look = whois.Summary; if (this.Client != null) { if (!this.lookUpdated && this.ChannelJoined != null) { this.Client.Enter(this.ChannelJoined.Channel, this.InitialPartitionID, this.InitialAction, this.Look); this.lookUpdated = true; } else if (this.Client.Player != null) { this.Client.Player.UpdateLook(this.Look); } } observer.EndSync(true); callback(observer); }; whois.OnFail += delegate(Operation op) { observer.EndSync(false); callback(observer); }; observer.Connection.RequestOperation(whois); }