Beispiel #1
0
        protected override void OnPlayerIntroduced(IPlayer player)
        {
            if (!Game.IsHost)
            {
                return;
            }

            var replStr = string.Empty;
            var vars    = DevConsole.GetVariablesWithFlags(ConVarFlags.Replicator);

            foreach (var var in vars)
            {
                var str = var + " " + DevConsole.GetVariableAsString(var);
                if (replStr == string.Empty)
                {
                    replStr = str;
                }
                else
                {
                    replStr += "&" + str;
                }
            }
            var cp = PacketUtility.TakePacket <CustomPacket>();

            cp.Sc = SendCategory.UI_Important;
            cp.AddString(replStr);
            cp.Label = "Replicate";
            Game.Network.SendPacket(player.ClientIndex, cp);
        }
Beispiel #2
0
        protected override void _Start()
        {
            _canSetResolution = true;

            foreach (var userSetting in DevConsole.GetVariablesWithFlags(ConVarFlags.UserSetting))
            {
                DevConsole.ExecuteLine(userSetting + " \"" + DevConsole.GetVariableAsString(userSetting) + "\"");
            }
        }
Beispiel #3
0
        protected override void OnGameLoaded()
        {
            var settingsModal = UGuiManager.Instance.Find <Modal_Settings>();

            if (settingsModal)
            {
                settingsModal.CreatePage("server", DevConsole.GetVariablesWithFlags(ConVarFlags.Replicator).Distinct().ToList());
                settingsModal.CreatePage("gamemode", DevConsole.GetVariablesWithFlags(ConVarFlags.Gamemode).Distinct().ToList());
            }
        }
Beispiel #4
0
        public void Save()
        {
            foreach (string varName in DevConsole.GetVariablesWithFlags(ConVarFlags.UserSetting))
            {
                UpdateUserSetting(varName, DevConsole.GetVariableAsString(varName));
            }

            SaveBinds();

            var filePath = Path.Combine(Application.persistentDataPath, _settingFileName);

            _config.SaveToFile(filePath);

            if (SteamClient.IsValid)
            {
                var bytes = Encoding.UTF8.GetBytes(File.ReadAllText(filePath));
                SteamRemoteStorage.FileWrite(_settingFileName, bytes);
            }
        }
Beispiel #5
0
        private void CreatePages()
        {
            var userSettings          = DevConsole.GetVariablesWithFlags(ConVarFlags.UserSetting);
            var userSettingCategories = new List <string>();

            foreach (var cmd in userSettings)
            {
                var categoryName = cmd.Substring(0, cmd.IndexOf('.'));
                if (userSettingCategories.Contains(categoryName))
                {
                    continue;
                }
                userSettingCategories.Add(categoryName);
            }

            foreach (var category in userSettingCategories)
            {
                var categorySettings = userSettings.FindAll(x => x.StartsWith(category, StringComparison.OrdinalIgnoreCase));
                CreatePage(category, categorySettings);
            }

            var bindSettings = new List <string>()
            {
                "bind/reset",
                "bind/controls/+left",
                "bind/controls/+right"
            };

            foreach (var action in Enum.GetNames(typeof(InputActions)))
            {
                bindSettings.Add("bind/controls/+input " + action);
            }
            foreach (var defaultModal in CanvasManager.DefaultModals)
            {
                bindSettings.Add("bind/ui/modal.toggle " + defaultModal);
            }

            CreatePage("binds", bindSettings);
        }