Esempio n. 1
0
        public static LogicCommand DecodeCommand(ByteStream stream)
        {
            LogicCommand command = LogicCommandManager.CreateCommand((LogicCommandType)stream.ReadInt());

            if (command == null)
            {
                Debugger.Warning("LogicCommandManager::decodeCommand() - command is null");
            }
            else
            {
                command.Decode(stream);
            }

            return(command);
        }
Esempio n. 2
0
        public static LogicCommand LoadCommandFromJSON(LogicJSONObject jsonObject)
        {
            LogicJSONNumber jsonNumber = jsonObject.GetJSONNumber("ct");

            if (jsonNumber == null)
            {
                Debugger.Error("loadCommandFromJSON - Unknown command type");
            }
            else
            {
                LogicCommand command = LogicCommandManager.CreateCommand((LogicCommandType)jsonNumber.GetIntValue());

                if (command != null)
                {
                    command.LoadFromJSON(jsonObject.GetJSONObject("c"));
                }

                return(command);
            }

            return(null);
        }