private void OKExecute(object obj)
        {
            bool allMappingsValid = true;

            bool isValid;
            var  mappings = GetMappings(out isValid);

            allMappingsValid &= isValid;

            if (mappings != null)
            {
                foreach (var m in mappings)
                {
                    var mappingsValid = m.PhaidraAttribute.ValidateMappings(m);
                    if (!mappingsValid)
                    {
                        Logger.LogW($"Mappings of Attribute {m.PhaidraAttribute.Name} invalid");
                    }
                    allMappingsValid &= mappingsValid;
                }
            }
            if (allMappingsValid)
            {
                DialogResult = true;
                CloseAction?.Invoke();
            }
            else
            {
                DebugCommand.Execute(null);
            }
        }
Beispiel #2
0
    // Start is called before the first frame update
    private IEnumerator Init()
    {
        JobData.Load();
        SkillData.Load();
        EnemyData.Load();
        BattleTileData.Load();
        BattlefieldData.Load();
        BattleGroupData.Load();
        BattleStatusData.Load();
        ItemData.Load();
        EquipData.Load();
        ItemEffectData.Load();
        LanguageData.Load();
        DungeonData.Load();
        RoomData.Load();
        TreasureData.Load();
        ConversationData.Load();
        ShopData.Load();
        DungeonGroupData.Load();
        ExpData.Load();
        NewCookData.Load();

        yield return(new WaitForEndOfFrame());

        InitManager();

        MySceneManager.Instance.Load();

#if UNITY_EDITOR
        DebugCommand.Start();
#endif
    }
Beispiel #3
0
        static void Main(string[] args)
        {
            DebugCommand.SetGame(game);

            game.AddEntity(new Worker());
            game.AddEntity(new Worker());
            game.AddEntity(new Worker());
            game.AddEntity(new WheatField());
            game.AddEntity(new WheatField());
            game.AddEntity(new WheatField());
            game.AddEntity(new LumberMill());

            game.GetEntity <WheatField>()
            .AddWorker(game.GetEntities <Worker>().Where(worker => !worker.IsOccupied()).First());
            game.GetEntity <WheatField>()
            .AddWorker(game.GetEntities <Worker>().Where(worker => !worker.IsOccupied()).First());
            game.GetEntity <LumberMill>()
            .AddWorker(game.GetEntities <Worker>().Where(worker => !worker.IsOccupied()).First());

            while (true)
            {
                //Thread.Sleep(tickLength);
                game.PrintState();

                DebugCommand.AwaitCommand();

                game.Tick();
            }
        }
Beispiel #4
0
        public static string ProcessDebugCommand(DebugCommand message)
        {
            switch (message.Command)
            {
            case DebugCommands.UIList:
                return(instance.GetUIIndex());

            case DebugCommands.ShowUI:
                if (message.Args.Length < 1)
                {
                    return("require name");
                }
                instance.ShowUI(message.Args[0]);
                return("OK");

            case DebugCommands.HideUI:
                if (message.Args.Length < 1)
                {
                    return("require name");
                }
                instance.HideUI(message.Args[0]);
                return("OK");

            case DebugCommands.HeatMapRestart:
                SharedConfig.StopSampler = false;
                return("OK");

            case DebugCommands.HeatMapPause:
                SharedConfig.StopSampler = true;
                return("OK");
            }

            return(string.Empty);
        }
Beispiel #5
0
 public static void RegisterCommand(string commandString, DebugCommand commandCallback)
 {
     if (IsOn)
     {
         DebugConsole.Instance.RegisterCommandCallback(commandString, commandCallback);
     }
 }
    private void Awake()
    {
        KILL_ALL = new DebugCommand("kill_all", "Removes all NPCs from the scene.", "kill_all", () => {
            Debug.Log("Killing all NPCs");
            NPCManager.Instance.KillAllNPCs();
        });

        SET_MONEY = new DebugCommand <float>("set_money", "Sets the amount of money", "set_money <money_amount>", (x) => {
            Player.Instance.SetMoney(x);
        });

        ADD_MONEY = new DebugCommand <float>("add_money", "Adds an amout of money to the player", "add_money <amount>", (x) => {
            Player.Instance.AddMoney(x);
        });

        HELP = new DebugCommand("help", "Shows a list of Commands", "help", () => {
            showHelp = true;
        });

        commandList = new List <object> {
            KILL_ALL,
            SET_MONEY,
            ADD_MONEY,
            HELP,
        };
    }
Beispiel #7
0
    private static void ToProcessDefaultCommand(string commandStr, string[] args)
    {
        //GameDebug.Log(commandStr);

        //c:#
        if (commandStr.ToLower().Length >= 2 && commandStr.ToLower()[0] == 'c' && commandStr.ToLower()[1] == ':')
        {
            if (((int)xc.Game.GetInstance().GameMode & (int)xc.Game.EGameMode.GM_Net) == (int)xc.Game.EGameMode.GM_Net)
            {
                //commandStr = commandStr.Substring(2, command.commandStr.Length);
                SendCCommandConnect(commandStr, args);
            }
            return;
        }

        //x:#
        if (commandStr.ToLower().Length >= 2 && commandStr.ToLower()[0] == 'x' && commandStr.ToLower()[1] == ':')
        {
            if (((int)xc.Game.GetInstance().GameMode & (int)xc.Game.EGameMode.GM_Net) == (int)xc.Game.EGameMode.GM_Net)
            {
                SendGMCommandThroughMajorConnect(commandStr, args);
            }
            return;
        }

        DebugCommand.ToProcessCommand(commandStr, new List <string>(args), MainGame.DebugUI);
    }
Beispiel #8
0
        public void RestoreFromJSON(JSONNode commandsJSON)
        {
            if ((commandsJSON?.Count ?? 0) == 0)
            {
                return;
            }
            _commands.Clear();
            foreach (JSONClass commandJSON in commandsJSON.AsArray)
            {
                ICustomCommand action;
                var            commandType = commandJSON["__type"];
                switch (commandType)
                {
                case DebugCommand.Type:
                    action = new DebugCommand();
                    break;

                case DiscreteTriggerCommand.Type:
                    action = new DiscreteTriggerCommand(_containingAtom, _prefabManager);
                    break;

                default:
                    SuperController.LogError($"Keybindings: Unknown command type {commandType}");
                    continue;
                }

                action.RestoreFromJSON(commandJSON);
                _commands.Add(action);
            }
        }
    private void Awake()
    {
        _instance = this;

        _playerControls = new PlayerControls();

        _playerControls.Player.ToggleDebug.performed += context => OnToggleDebug();

        _playerControls.Player.ReturnDebug.performed += context => OnReturn();

        RESTART_LEVEL = new DebugCommand("restart_lvl", "Restarts the current level", "restart_lvl", () =>
        {
            var currentLevel = SceneManager.GetActiveScene();

            SceneManager.LoadScene(currentLevel.name);
        });

        SHOW_HELP = new DebugCommand("help", "Shows all commands", "help", () =>
        {
            showHelp = true;
        });

        commandList = new List <object>
        {
            RESTART_LEVEL,
            SHOW_HELP
        };
    }
Beispiel #10
0
            public static new DebugMessage ReadFrom(System.IO.BinaryReader reader)
            {
                DebugCommand debugCommand = Model.DebugCommand.ReadFrom(reader);
                var          result       = new DebugMessage(debugCommand);

                return(result);
            }
Beispiel #11
0
 void Update()
 {
     if (Input.anyKeyDown && !string.IsNullOrEmpty(Input.inputString))
     {
         DebugCommand cmd = new DebugCommand(Input.inputString);
         CommandManager.Do(cmd);
     }
 }
Beispiel #12
0
        public void ResetSpawnRequest()
        {
            TextLine           = 0;
            SpawnRequest       = new Request();
            SpawnRequest.Debug = new RequestDebug();
            DebugCommand debugCommand = new DebugCommand();

            DrawRequest.Debug.Debug.Add(debugCommand);
        }
Beispiel #13
0
 private void OnContextualResourceModelChanged()
 {
     ViewInBrowserCommand.UpdateContext(Environment, ContextualResourceModel);
     DebugCommand.UpdateContext(Environment, ContextualResourceModel);
     RunCommand.UpdateContext(Environment, ContextualResourceModel);
     SaveCommand.UpdateContext(Environment, ContextualResourceModel);
     QuickViewInBrowserCommand.UpdateContext(Environment, ContextualResourceModel);
     QuickDebugCommand.UpdateContext(Environment, ContextualResourceModel);
 }
Beispiel #14
0
    public void AddCommand(DebugCommand cmd)
    {
        if (m_commandList.Contains(cmd))
        {
            return;
        }

        m_commandList.Add(cmd);
    }
Beispiel #15
0
        public int SendDebugCommand(DebugCommand cmd, string param)
        {
            cursid++;
            Cmd c = new Cmd();

            c.sid   = cursid;
            c.cmd   = cmd;
            c.param = param;
            return(cursid);
        }
Beispiel #16
0
        public void ResetDrawRequest()
        {
            TextLine          = 0;
            DrawRequest       = new Request();
            DrawRequest.Debug = new RequestDebug();
            DebugCommand debugCommand = new DebugCommand();

            debugCommand.Draw = new DebugDraw();
            DrawRequest.Debug.Debug.Add(debugCommand);
        }
Beispiel #17
0
    public async Task ShouldReturnSuccessfulResult()
    {
        var command = new DebugCommand(ApplicationContext);
        var text    = command.Aliases[0];
        var message = GenerateMessage(DefaultUser.Id, DefaultUser.Id, text);

        var result = await command.Execute(message, DefaultUser);

        result.Should().BeOfType <SuccessfulResult>();
        result.Message.Should().NotBeNullOrEmpty();
    }
Beispiel #18
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await DebugCommand.Execute(Target, PlayerId, CommandString, Param1, Param2, Param3, Param4, _logger);

            return(RedirectToPage("./Cheat", new { id = member_no }));
        }
Beispiel #19
0
        private void InitializeDebugCommand()
        {
            if (DrawRequest == null)
            {
                DrawRequest = new Request();

                DrawRequest.Debug = new RequestDebug();
                DebugCommand debugCommand = new DebugCommand();
                debugCommand.Draw = new DebugDraw();
                DrawRequest.Debug.Debug.Add(debugCommand);
            }
        }
 void RegisterCommandCallback(string commandString, DebugCommand commandCallback, string CMD_Discribes)
 {
     try
     {
         _cmdTable[commandString] = new DebugCommand(commandCallback);
         _cmdTableDiscribes.Add(commandString, CMD_Discribes);
     }
     catch (Exception e)
     {
         Debug.Log(e.Message);
     }
 }
Beispiel #21
0
        public void ClearBreakpoints()
        {
            if (mClient.Connected)
            {
                DebugCommand command = new DebugCommand();
                command.Command = DebugCommand.EnCommand.ClearBreakpoints;

                byte[] bytes = Utils.StructureToByteArray(command);

                Send(bytes);
            }
        }
Beispiel #22
0
        public void Pause()
        {
            if (mClient.Connected)
            {
                DebugCommand command = new DebugCommand();
                command.Command = DebugCommand.EnCommand.Pause;

                byte[] bytes = Utils.StructureToByteArray(command);

                Send(bytes);
            }
        }
Beispiel #23
0
    void Awake()
    {
        PLAY_GAME = new DebugCommand <int>("!play", "load game", "play", (x) => //(command line, description, reads format)
        {
            SceneManager.LoadScene(x);
        });

        commandList = new List <object>
        {
            PLAY_GAME,
            SKIP
        };
    }
Beispiel #24
0
        public void UnsetBreakpoint(UInt32 address)
        {
            if (mClient.Connected)
            {
                DebugCommand command = new DebugCommand();
                command.Command = DebugCommand.EnCommand.UnsetBreakpoint;
                command.Data    = address;

                byte[] bytes = Utils.StructureToByteArray(command);

                Send(bytes);
            }
        }
Beispiel #25
0
        public void GetMemory(UInt32 address)
        {
            if (mClient.Connected)
            {
                DebugCommand command = new DebugCommand();
                command.Command = DebugCommand.EnCommand.GetMemory;
                command.Data    = address;

                byte[] bytes = Utils.StructureToByteArray(command);

                Send(bytes);
            }
        }
Beispiel #26
0
 // -------------------------- Map Commands Here ---------------------------
 // maps all commands to their function
 public void SendCommand(DebugCommand _cmd)
 {
     if (_cmd.command == "/quit" || _cmd.command == "/exit")
     {
         QuitGame();
     }
     if (_cmd.command == "/timescale")
     {
         TimeScale(_cmd.args);
     }
     // if (_cmd.command == "/your_command")
     //	call_corresponding_function(_cmd.args)
 }
Beispiel #27
0
        public static void Handle(ServerRoom room, DebugCommand message, PlayerEntity player)
        {
            if (commandDic.ContainsKey(message.Command.ToLower()))
            {
                FreeLog.Reset();

                IGameAction action = commandDic[message.Command.ToLower()];

                if (FreeLog.IsEnable())
                {
                    FreeLog.SetTrigger(string.Format("命令行 {0}: {1}", message.Command, string.Join(" ", message.Args)));
                }

                if (commandPara == null)
                {
                    commandPara = new StringPara("command", "");
                }

                if (message.Args != null)
                {
                    for (int i = 1; i <= message.Args.Length; i++)
                    {
                        room.FreeArgs.TempUsePara(new StringPara("arg" + i, message.Args[i - 1]));
                    }
                }


                room.FreeArgs.TempUsePara(commandPara);
                room.FreeArgs.TempUse("current", (FreeData)player.freeData.FreeData);

                action.Act(room.FreeArgs);

                if (message.Command == "relive")
                {
                    player.isFlagCompensation = true;
                }

                room.FreeArgs.Resume("current");
                room.FreeArgs.ResumePara("command");

                if (message.Args != null)
                {
                    for (int i = 1; i <= message.Args.Length; i++)
                    {
                        room.FreeArgs.ResumePara("arg" + i);
                    }
                }

                FreeLog.Print();
            }
        }
Beispiel #28
0
 private void Awake()
 {
     SingleMissionStaticData.pauseAble = false;
     Time.timeScale    = 0f;
     missionNumberText = missionTitlePanel.transform.Find("MissionNumberText").gameObject.GetComponent <Text>();
     enemyCounterText  = missionTitlePanel.transform.Find("EnemyCounterText").gameObject.GetComponent <Text>();
     playerLifeText    = missionTitlePanel.transform.Find("PlayerLifeText").gameObject.GetComponent <Text>();
     im = GetComponent <InputManager>();
     dc = GetComponent <DebugCommand>();
     if (SingleMissionStaticData.loadNewStage)
     {
         SetAfterNewStage();
     }
     DisplayMissionTitle();
 }
 public void OnDebugMessage(ServerRoom room, DebugCommand message, PlayerEntity player, SessionStateMachine sessionStateMachine)
 {
     FreeDebugCommandHandler.Handle(room.ContextsWrapper.FreeArgs, message, player);
     SharedCommandHandler.ProcessGameSettingCommnands(message, sessionStateMachine);
     SharedCommandHandler.ProcessDebugCommand(message, _contexts);
     SharedCommandHandler.ProcessHitBoxCommands(message);
     SharedCommandHandler.ProcessPlayerCommands(message, _contexts, player, _contexts.session.commonSession,
                                                _contexts.session.currentTimeObject);
     SharedCommandHandler.ProcessVehicleCommand(message, _contexts.vehicle, player);
     SharedCommandHandler.ProcessSceneObjectCommand(message, _contexts.sceneObject,
                                                    _contexts.session.entityFactoryObject.SceneObjectEntityFactory, player);
     SharedCommandHandler.ProcessMapObjectCommand(message, _contexts.mapObject,
                                                  _contexts.session.entityFactoryObject.MapObjectEntityFactory, player);
     SharedCommandHandler.ProcessCommands(message, _contexts, player);
 }
Beispiel #30
0
 /// <summary>
 /// ボタンを押した際の処理
 /// </summary>
 /// <param name="type"></param>
 private void ButtonPush(BType type)
 {
     if (type == BType.close)
     {
         Close();
     }
     else if (type == BType.save)
     {
         Save();
     }
     else
     {
         DebugCommand.DebugLog("挙動が設定されてません");
     }
 }
Beispiel #31
0
 //--- Local version. Use the static version above instead.
 void RegisterCommandCallback(CommandDescription command, DebugCommand commandCallback) {
     _cmdTable[command.command.ToLower()] = new DebugCommand(commandCallback);
     _commandDescriptions.Add(command.command, command);
 }
Beispiel #32
0
 public static void RegisterCommand(string commandString, DebugCommand commandCallback, string CMD_Discribes)
 {
     DebugConsole.Instance.RegisterCommandCallback(commandString, commandCallback, CMD_Discribes);
 }
Beispiel #33
0
 void RegisterCommandCallback(string commandString, DebugCommand commandCallback, string CMD_Discribes)
 {
     try
     {
         _cmdTable[commandString] = new DebugCommand(commandCallback);
         _cmdTableDiscribes.Add(commandString, CMD_Discribes);
     }
     catch (Exception e)
     {
         Debug.Log(e.Message);
     }
 }
 /// <summary>
 /// Registers a debug command that is "fired" when the specified command string is entered.
 /// </summary>
 /// <param name="commandString">The string that represents the command. For example: "FOV"</param>
 /// <param name="commandCallback">The method/function to call with the commandString is entered. 
 /// For example: "SetFOV"</param>
 public static void RegisterCommand( string commandString, DebugCommand commandCallback )
 {
     DebugConsole.Instance.RegisterCommandCallback( commandString, commandCallback );
 }
 public int SendDebugCommand(DebugCommand cmd, string param)
 {
     cursid++;
     Cmd c = new Cmd();
     c.sid = cursid;
     c.cmd = cmd;
     c.param = param;
     return cursid;
 }
 //--- Local version. Use the static version above instead.
 public void RegisterCommandCallback( string commandString, DebugCommand commandCallback )
 {
     _cmdTable.Add( commandString.ToLower(), new DebugCommand( commandCallback ) );
 }