Пример #1
0
        public void Update()
        {
            if (UGuiManager.Instance.HasFocusedInput() ||
                Blocked)
            {
                return;
            }

            foreach (var bind in Binds)
            {
                var keyDown = bind.JustDown();
                var keyUp   = bind.JustUp();

                bind.IsPressed = keyDown && !keyUp;

                if (bind.Type == BindType.Hold)
                {
                    if (bind.IsPressed)
                    {
                        DevConsole.ExecuteLine(bind.Command);
                    }
                    else if (keyUp)
                    {
                        DevConsole.ExecuteLine(bind.ReleaseCommand);
                    }
                }
                else if (keyDown)
                {
                    DevConsole.ExecuteLine(bind.Command);
                }
            }
        }
Пример #2
0
 protected override void _Start()
 {
     if (LaunchParams.Contains("connect"))
     {
         DevConsole.ExecuteLine($"net.connect {LaunchParams.CommandLine.Arguments["connect"][0]}");
     }
 }
Пример #3
0
 private void ExecuteUserSettings()
 {
     foreach (var s in _config["UserSettings"])
     {
         var line = $"{s.Name} {s.StringValue}";
         DevConsole.ExecuteLine(line);
     }
 }
Пример #4
0
 public override void Update()
 {
     if (_refresh)
     {
         DevConsole.ExecuteLine("plugins.reload");
         _refresh = false;
     }
 }
Пример #5
0
 private void SaveChanges()
 {
     foreach (var kvp in _pendingChanges)
     {
         DevConsole.ExecuteLine(kvp.Value.Data.Command);
     }
     ClearChanges();
 }
Пример #6
0
        protected override void _Start()
        {
            _canSetResolution = true;

            foreach (var userSetting in DevConsole.GetVariablesWithFlags(ConVarFlags.UserSetting))
            {
                DevConsole.ExecuteLine(userSetting + " \"" + DevConsole.GetVariableAsString(userSetting) + "\"");
            }
        }
Пример #7
0
 private void OnInputSubmit(string contents)
 {
     if (!string.IsNullOrWhiteSpace(contents))
     {
         DevConsole.ExecuteLine(contents);
         InputHistory.PushFront(contents);
     }
     _inputField.text = string.Empty;
     _inputField.ActivateInputField();
 }
Пример #8
0
 private void SetPotatoMode(string[] args)
 {
     QualitySettings.vSyncCount      = 0;
     QualitySettings.maxQueuedFrames = 2;
     QualitySettings.maximumLODLevel = 0;
     QualitySettings.skinWeights     = SkinWeights.OneBone;
     SetFancy(false);
     DevConsole.ExecuteLine("graphics.postprocessing false");
     DevConsole.ExecuteLine("graphics.antialiasing 1");
     DevConsole.ExecuteLine("graphics.shadows false");
 }
Пример #9
0
        protected override void OnPlayerPacketReceived(IPlayer player, IBasePacket packet)
        {
            if (Game.IsHost ||
                FSGameLoop.GetGameInstance(true) != null ||
                !(packet is CustomPacket cp && cp.Label == "Replicate"))
            {
                return;
            }

            var replStr = cp.GetString(0);
            var cmds    = replStr.Split('&');

            if (cmds != null && cmds.Length > 0)
            {
                foreach (var cmd in cmds)
                {
                    DevConsole.ExecuteLine(cmd);
                }
            }
        }
Пример #10
0
        public async Task <GameLoadResult> CreateServerAsync(string mapName, string gamemode, string name = null, string pass = null)
        {
            if (GameServer.Instance != null)
            {
                GameServer.Instance.Destroy();
                await Task.Delay(100);
            }

            Loading     = true;
            LoadingHint = "Creating server";

            var obj    = new GameObject("[Server]");
            var server = obj.AddComponent <GameServer>();

            server.IsLocalServer = true;

            if (!string.IsNullOrEmpty(name))
            {
                DevConsole.ExecuteLine("server.name \"" + name + "\"");
            }
            if (!string.IsNullOrEmpty(pass))
            {
                DevConsole.ExecuteLine("server.password \"" + pass + "\"");
            }

            var result = await server.GameLoader.CreateGameAsync(mapName, gamemode);

            if (result != GameLoadResult.Success)
            {
                Debug.LogError("F****d: " + result);
                server.Destroy();
                if (!Game.IsHost)
                {
                    SceneManager.LoadScene(GameData.Instance.MainMenu.ScenePath);
                    UGuiManager.Instance.Popup("Couldn't load that map, something went wrong.");
                }
                Loading = false;
            }

            return(result);
        }
Пример #11
0
 public void ExecutePostLoad()
 {
     foreach (var cfg in _configs.Keys)
     {
         foreach (var section in cfg)
         {
             if (section.Name != "PostLoad")
             {
                 continue;
             }
             foreach (Setting setting in section)
             {
                 if (setting.IsArray)
                 {
                     continue;
                 }
                 var lineToExecute = setting.Name + " " + setting.RawValue;
                 DevConsole.ExecuteLine(lineToExecute);
             }
         }
     }
 }
Пример #12
0
        private Configuration Read(string path, string primaryName)
        {
            try
            {
                var config = Configuration.LoadFromFile(path);
                if (config == null)
                {
                    DevConsole.WriteLine("Invalid config path:" + path);
                    return(null);
                }
                foreach (Section section in config)
                {
                    if (section.Name == "PostLoad" ||
                        section.Name == "Binds")
                    {
                        continue;
                    }

                    foreach (Setting setting in section)
                    {
                        if (setting.IsArray)
                        {
                            continue;
                        }
                        var lineToExecute = setting.Name + " " + setting.RawValue;
                        DevConsole.ExecuteLine(lineToExecute);
                    }
                }
                return(config);
            }
            catch (System.Exception e)
            {
                DevConsole.WriteLine(e.ToString());
            }

            return(null);
        }
Пример #13
0
 private void ProcessInput(string message)
 {
     DevConsole.ExecuteLine(message);
 }
Пример #14
0
 void OnInputText(string obj)
 {
     DevConsole.ExecuteLine(obj);
 }