Exemplo n.º 1
0
        public async Task HandleJsonMessage(Room room, dynamic jsonObj)
        {
            JsonReceivedEventArgs args = new JsonReceivedEventArgs(room, jsonObj);

            if (jsonObj.command == Constants.JsonCommands.ClientCommands.POWER_UP)
            {
                await Task.Run(() => OnPowerUpEvent?.Invoke(this, args));

                return;
            }

            if (jsonObj.command == Constants.JsonCommands.ClientCommands.MOVE_TO)
            {
                await Task.Run(() => OnMoveToEvent?.Invoke(this, args));

                return;
            }

            if (jsonObj.command == Constants.JsonCommands.ClientCommands.UPGRADE_TOWER)
            {
                await Task.Run(() => UpgradeTowerEvent?.Invoke(this, args));

                return;
            }

            if (jsonObj.command == Constants.JsonCommands.ClientCommands.ARRIVED_TO)
            {
                await AnalyzeCommandBagAsync(jsonObj, args);
            }
        }
Exemplo n.º 2
0
        public override async Task Handle(Room room, dynamic jsonObj)
        {
            JsonReceivedEventArgs args = new JsonReceivedEventArgs(room, jsonObj);

            if (jsonObj.command == Constants.JsonCommands.ClientCommands.POWER_UP)
            {
                await Task.Run(() => OnPowerUpEvent?.Invoke(this, args));
            }
            else
            {
                await base.Handle((Room)room, (object)jsonObj);
            }
        }