Example #1
0
        public void DrawContent(int windowId)
        {
            if (!LoadEventHandled)
            {
                LoadEventHandled = true;
                TempColor        = SettingsSystem.CurrentSettings.PlayerColor;
                NewCacheSize     = SettingsSystem.CurrentSettings.CacheSize.ToString();
            }
            //Player color
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Player Name color: ");
            GUILayout.Label(SettingsSystem.CurrentSettings.PlayerName, TempColorLabelStyle);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("R: ");
            TempColor.r = GUILayout.HorizontalScrollbar(TempColor.r, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("G: ");
            TempColor.g = GUILayout.HorizontalScrollbar(TempColor.g, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("B: ");
            TempColor.b = GUILayout.HorizontalScrollbar(TempColor.b, 0, 0, 1);
            GUILayout.EndHorizontal();
            TempColorLabelStyle.active.textColor = TempColor;
            TempColorLabelStyle.normal.textColor = TempColor;
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Random", ButtonStyle))
            {
                TempColor = PlayerColorSystem.GenerateRandomColor();
            }
            if (GUILayout.Button("Set", ButtonStyle))
            {
                StatusWindow.Singleton.ColorEventHandled   = false;
                SettingsSystem.CurrentSettings.PlayerColor = TempColor;
                SettingsSystem.Singleton.SaveSettings();
                if (MainSystem.Singleton.NetworkState == ClientState.RUNNING)
                {
                    PlayerColorSystem.Singleton.MessageSender.SendPlayerColorToServer();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            //Cache
            GUILayout.Label("Cache size");
            GUILayout.Label("Current size: " +
                            Math.Round(UniverseSyncCache.Singleton.CurrentCacheSize / (float)(1024 * 1024), 3) + "MB.");
            GUILayout.Label("Max size: " + SettingsSystem.CurrentSettings.CacheSize + "MB.");
            NewCacheSize = GUILayout.TextArea(NewCacheSize);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Set", ButtonStyle))
            {
                int tempCacheSize;
                if (int.TryParse(NewCacheSize, out tempCacheSize))
                {
                    if (tempCacheSize < 1)
                    {
                        tempCacheSize = 1;
                        NewCacheSize  = tempCacheSize.ToString();
                    }
                    if (tempCacheSize > 1000)
                    {
                        tempCacheSize = 1000;
                        NewCacheSize  = tempCacheSize.ToString();
                    }
                    SettingsSystem.CurrentSettings.CacheSize = tempCacheSize;
                    SettingsSystem.Singleton.SaveSettings();
                }
                else
                {
                    NewCacheSize = SettingsSystem.CurrentSettings.CacheSize.ToString();
                }
            }
            if (GUILayout.Button("Expire cache"))
            {
                UniverseSyncCache.Singleton.ExpireCache();
            }
            if (GUILayout.Button("Delete cache"))
            {
                UniverseSyncCache.Singleton.DeleteCache();
            }
            GUILayout.EndHorizontal();
            //Key bindings
            GUILayout.Space(10);
            var chatDescription = "Set chat key (current: " + SettingsSystem.CurrentSettings.ChatKey + ")";

            if (SettingChat)
            {
                chatDescription = "Setting chat key (click to cancel)...";
                if (Event.current.isKey)
                {
                    if (Event.current.keyCode != KeyCode.Escape)
                    {
                        SettingsSystem.CurrentSettings.ChatKey = Event.current.keyCode;
                        SettingsSystem.Singleton.SaveSettings();
                        SettingChat = false;
                    }
                    else
                    {
                        SettingChat = false;
                    }
                }
            }
            if (GUILayout.Button(chatDescription))
            {
                SettingChat = !SettingChat;
            }
            GUILayout.Space(10);
            GUILayout.Label("Generate a server LMPModControl:");
            if (GUILayout.Button("Generate blacklist LMPModControl.txt"))
            {
                ModSystem.Singleton.GenerateModControlFile(false);
            }
            if (GUILayout.Button("Generate whitelist LMPModControl.txt"))
            {
                ModSystem.Singleton.GenerateModControlFile(true);
            }
            UniverseConverterWindow.Singleton.Display = GUILayout.Toggle(UniverseConverterWindow.Singleton.Display,
                                                                         "Generate Universe from saved game", ButtonStyle);
            if (GUILayout.Button("Reset disclaimer"))
            {
                SettingsSystem.CurrentSettings.DisclaimerAccepted = false;
                SettingsSystem.Singleton.SaveSettings();
            }
            var settingCompression = GUILayout.Toggle(SettingsSystem.CurrentSettings.CompressionEnabled, "Enable compression", ButtonStyle);

            if (settingCompression != SettingsSystem.CurrentSettings.CompressionEnabled)
            {
                SettingsSystem.CurrentSettings.CompressionEnabled = settingCompression;
                SettingsSystem.Singleton.SaveSettings();
            }
            var settingInterpolation = GUILayout.Toggle(SettingsSystem.CurrentSettings.InterpolationEnabled, "Enable interpolation", ButtonStyle);

            if (settingInterpolation != SettingsSystem.CurrentSettings.InterpolationEnabled)
            {
                SettingsSystem.CurrentSettings.InterpolationEnabled = settingInterpolation;
                SettingsSystem.Singleton.SaveSettings();
            }
            GUILayout.BeginHorizontal();
            GUILayout.Label("Toolbar:", SmallOption);
            if (GUILayout.Button(ToolbarMode, ButtonStyle))
            {
                var newSetting = (int)SettingsSystem.CurrentSettings.ToolbarType + 1;
                //Overflow to 0
                if (!Enum.IsDefined(typeof(LmpToolbarType), newSetting))
                {
                    newSetting = 0;
                }
                SettingsSystem.CurrentSettings.ToolbarType = (LmpToolbarType)newSetting;
                SettingsSystem.Singleton.SaveSettings();
                UpdateToolbarString();
                ToolbarSystem.Singleton.ToolbarChanged();
            }
            GUILayout.EndHorizontal();
#if DEBUG
            if (GUILayout.Button("Check Common.dll stock parts"))
            {
                ModSystem.Singleton.CheckCommonStockParts();
            }
#endif
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", ButtonStyle))
            {
                Display = false;
            }
            GUILayout.EndVertical();
        }
Example #2
0
        public void DrawContent(int windowId)
        {
            if (!LoadEventHandled)
            {
                LoadEventHandled = true;
                TempColor        = SettingsSystem.CurrentSettings.PlayerColor;
                NewCacheSize     = SettingsSystem.CurrentSettings.CacheSize.ToString();
            }
            //Player color
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Player Name color: ");
            GUILayout.Label(SettingsSystem.CurrentSettings.PlayerName, TempColorLabelStyle);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("R: ");
            TempColor.r = GUILayout.HorizontalScrollbar(TempColor.r, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("G: ");
            TempColor.g = GUILayout.HorizontalScrollbar(TempColor.g, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("B: ");
            TempColor.b = GUILayout.HorizontalScrollbar(TempColor.b, 0, 0, 1);
            GUILayout.EndHorizontal();
            TempColorLabelStyle.active.textColor = TempColor;
            TempColorLabelStyle.normal.textColor = TempColor;
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Random", ButtonStyle))
            {
                TempColor = PlayerColorSystem.GenerateRandomColor();
            }
            if (GUILayout.Button("Set", ButtonStyle))
            {
                WindowsContainer.Get <StatusWindow>().ColorEventHandled = false;
                SettingsSystem.CurrentSettings.PlayerColor = TempColor;
                SettingsSystem.SaveSettings();
                if (MainSystem.NetworkState == ClientState.Running)
                {
                    SystemsContainer.Get <PlayerColorSystem>().MessageSender.SendPlayerColorToServer();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            //Cache
            var enableCache = GUILayout.Toggle(SettingsSystem.CurrentSettings.EnableCache, "Enable cache", ButtonStyle);

            if (enableCache != SettingsSystem.CurrentSettings.EnableCache)
            {
                if (!enableCache)
                {
                    UniverseSyncCache.DeleteCache();               //Remove all cache when deactivating it
                }
                SettingsSystem.CurrentSettings.EnableCache = enableCache;
                SettingsSystem.SaveSettings();
            }
            if (SettingsSystem.CurrentSettings.EnableCache)
            {
                GUILayout.Label("Cache size");
                GUILayout.Label($"Current size: {Math.Round(UniverseSyncCache.CurrentCacheSize / (float)(1024 * 1024), 3)} MB.");
                GUILayout.Label($"Max size: {SettingsSystem.CurrentSettings.CacheSize} MB.");
                NewCacheSize = GUILayout.TextArea(NewCacheSize);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Set", ButtonStyle))
                {
                    if (int.TryParse(NewCacheSize, out var tempCacheSize))
                    {
                        if (tempCacheSize < 1)
                        {
                            tempCacheSize = 1;
                            NewCacheSize  = tempCacheSize.ToString();
                        }
                        if (tempCacheSize > 1000)
                        {
                            tempCacheSize = 1000;
                            NewCacheSize  = tempCacheSize.ToString();
                        }
                        SettingsSystem.CurrentSettings.CacheSize = tempCacheSize;
                        SettingsSystem.SaveSettings();
                    }
                    else
                    {
                        NewCacheSize = SettingsSystem.CurrentSettings.CacheSize.ToString();
                    }
                }
                if (GUILayout.Button("Expire cache"))
                {
                    UniverseSyncCache.ExpireCache();
                }
                if (GUILayout.Button("Delete cache"))
                {
                    UniverseSyncCache.DeleteCache();
                }
                GUILayout.EndHorizontal();
            }

            //Key bindings
            GUILayout.Space(10);
            var chatDescription = $"Set chat key (current: {SettingsSystem.CurrentSettings.ChatKey})";

            if (SettingChat)
            {
                chatDescription = "Setting chat key (click to cancel)...";
                if (Event.current.isKey)
                {
                    if (Event.current.keyCode != KeyCode.Escape)
                    {
                        SettingsSystem.CurrentSettings.ChatKey = Event.current.keyCode;
                        SettingsSystem.SaveSettings();
                        SettingChat = false;
                    }
                    else
                    {
                        SettingChat = false;
                    }
                }
            }
            if (GUILayout.Button(chatDescription))
            {
                SettingChat = !SettingChat;
            }
            GUILayout.Space(10);
            GUILayout.Label("Generate a server LMPModControl:");
            if (GUILayout.Button("Generate blacklist LMPModControl.txt"))
            {
                SystemsContainer.Get <ModSystem>().GenerateModControlFile(false);
            }
            if (GUILayout.Button("Generate whitelist LMPModControl.txt"))
            {
                SystemsContainer.Get <ModSystem>().GenerateModControlFile(true);
            }
            WindowsContainer.Get <UniverseConverterWindow>().Display = GUILayout.Toggle(WindowsContainer.Get <UniverseConverterWindow>().Display, "Generate Universe from saved game", ButtonStyle);
            if (GUILayout.Button("Reset disclaimer"))
            {
                SettingsSystem.CurrentSettings.DisclaimerAccepted = false;
                SettingsSystem.SaveSettings();
            }
            var settingCompression = GUILayout.Toggle(SettingsSystem.CurrentSettings.CompressionEnabled, "Enable compression", ButtonStyle);

            if (settingCompression != SettingsSystem.CurrentSettings.CompressionEnabled)
            {
                SettingsSystem.CurrentSettings.CompressionEnabled = settingCompression;
                SettingsSystem.SaveSettings();
            }
            var settingInterpolation = GUILayout.Toggle(SettingsSystem.CurrentSettings.InterpolationEnabled, "Enable interpolation", ButtonStyle);

            if (settingInterpolation != SettingsSystem.CurrentSettings.InterpolationEnabled)
            {
                SettingsSystem.CurrentSettings.InterpolationEnabled = settingInterpolation;
                SettingsSystem.SaveSettings();
            }
            var positionFudge = GUILayout.Toggle(SettingsSystem.CurrentSettings.PositionFudgeEnable, "Enable position fudge", ButtonStyle);

            if (positionFudge != SettingsSystem.CurrentSettings.PositionFudgeEnable)
            {
                SettingsSystem.CurrentSettings.PositionFudgeEnable = positionFudge;
                SettingsSystem.SaveSettings();
            }
            var altPositionSystem = GUILayout.Toggle(SettingsSystem.CurrentSettings.UseAlternativePositionSystem, "Use alterative position system", ButtonStyle);

            if (altPositionSystem != SettingsSystem.CurrentSettings.UseAlternativePositionSystem)
            {
                SettingsSystem.CurrentSettings.UseAlternativePositionSystem = altPositionSystem;
                SettingsSystem.SaveSettings();
            }
            var packOtherVessels = GUILayout.Toggle(SettingsSystem.CurrentSettings.PackOtherControlledVessels, "Pack other vessels", ButtonStyle);

            if (packOtherVessels != SettingsSystem.CurrentSettings.PackOtherControlledVessels)
            {
                SettingsSystem.CurrentSettings.PackOtherControlledVessels = packOtherVessels;
                SettingsSystem.SaveSettings();
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("Toolbar:", SmallOption);
            if (GUILayout.Button(ToolbarMode, ButtonStyle))
            {
                var newSetting = (int)SettingsSystem.CurrentSettings.ToolbarType + 1;
                //Overflow to 0
                if (!Enum.IsDefined(typeof(LmpToolbarType), newSetting))
                {
                    newSetting = 0;
                }
                SettingsSystem.CurrentSettings.ToolbarType = (LmpToolbarType)newSetting;
                SettingsSystem.SaveSettings();
                UpdateToolbarString();
                SystemsContainer.Get <ToolbarSystem>().ToolbarChanged();
            }
            GUILayout.EndHorizontal();
#if DEBUG
            if (GUILayout.Button("Check Common.dll stock parts"))
            {
                SystemsContainer.Get <ModSystem>().CheckCommonStockParts();
            }
#endif
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", ButtonStyle))
            {
                Display = false;
            }
            GUILayout.EndVertical();
        }
Example #3
0
        public override void DrawWindowContent(int windowId)
        {
            //Player color
            GUILayout.BeginVertical(BoxStyle);
            GUI.DragWindow(MoveRect);
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Language);
            if (GUILayout.Button(LocalizationContainer.GetCurrentLanguageAsText(), ButtonStyle))
            {
                LocalizationContainer.LoadLanguage(LocalizationContainer.GetNextLanguage());
                SettingsSystem.CurrentSettings.Language = LocalizationContainer.CurrentLanguage;
                SettingsSystem.SaveSettings();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Color);
            GUILayout.Label(SettingsSystem.CurrentSettings.PlayerName, _tempColorLabelStyle);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Red, _smallOption);
            _tempColor.r = GUILayout.HorizontalScrollbar(_tempColor.r, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Green, _smallOption);
            _tempColor.g = GUILayout.HorizontalScrollbar(_tempColor.g, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Blue, _smallOption);
            _tempColor.b = GUILayout.HorizontalScrollbar(_tempColor.b, 0, 0, 1);
            GUILayout.EndHorizontal();
            _tempColorLabelStyle.active.textColor = _tempColor;
            _tempColorLabelStyle.normal.textColor = _tempColor;
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Random, ButtonStyle))
            {
                _tempColor = PlayerColorSystem.GenerateRandomColor();
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Set, ButtonStyle))
            {
                StatusWindow.Singleton.ColorEventHandled   = false;
                SettingsSystem.CurrentSettings.PlayerColor = _tempColor;
                SettingsSystem.SaveSettings();
                if (MainSystem.NetworkState == ClientState.Running)
                {
                    PlayerColorSystem.Singleton.MessageSender.SendPlayerColorToServer();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(10);
            var settingInterpolator = GUILayout.Toggle(SettingsSystem.CurrentSettings.PositionInterpolation, "Use interpolation", ButtonStyle);

            if (settingInterpolator != SettingsSystem.CurrentSettings.PositionInterpolation)
            {
                SettingsSystem.CurrentSettings.PositionInterpolation = settingInterpolator;
                SettingsSystem.SaveSettings();
            }
            GUILayout.Space(10);

            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.GenerateLmpModControl))
            {
                ModSystem.Singleton.GenerateModControlFile(false);
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.GenerateLmpModControl + " + SHA"))
            {
                ModSystem.Singleton.GenerateModControlFile(true);
            }
            _displayUniverseConverterDialog = GUILayout.Toggle(_displayUniverseConverterDialog, LocalizationContainer.OptionsWindowText.GenerateUniverse, ButtonStyle);
            GUILayout.Space(10);
#if DEBUG
            DrawAdvancedDebugOptions();
#endif
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
Example #4
0
        public void DrawContent(int windowId)
        {
            if (!LoadEventHandled)
            {
                LoadEventHandled = true;
                TempColor        = SettingsSystem.CurrentSettings.PlayerColor;
            }
            //Player color
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Player Name color: ");
            GUILayout.Label(SettingsSystem.CurrentSettings.PlayerName, TempColorLabelStyle);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("R: ", SmallOption);
            TempColor.r = GUILayout.HorizontalScrollbar(TempColor.r, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("G: ", SmallOption);
            TempColor.g = GUILayout.HorizontalScrollbar(TempColor.g, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("B: ", SmallOption);
            TempColor.b = GUILayout.HorizontalScrollbar(TempColor.b, 0, 0, 1);
            GUILayout.EndHorizontal();
            TempColorLabelStyle.active.textColor = TempColor;
            TempColorLabelStyle.normal.textColor = TempColor;
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Random", ButtonStyle))
            {
                TempColor = PlayerColorSystem.GenerateRandomColor();
            }
            if (GUILayout.Button("Set", ButtonStyle))
            {
                WindowsContainer.Get <StatusWindow>().ColorEventHandled = false;
                SettingsSystem.CurrentSettings.PlayerColor = TempColor;
                SettingsSystem.SaveSettings();
                if (MainSystem.NetworkState == ClientState.Running)
                {
                    SystemsContainer.Get <PlayerColorSystem>().MessageSender.SendPlayerColorToServer();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            //Key bindings
            var chatDescription = $"Set chat key (current: {SettingsSystem.CurrentSettings.ChatKey})";

            if (SettingChat)
            {
                chatDescription = "Setting chat key (click to cancel)...";
                if (Event.current.isKey)
                {
                    if (Event.current.keyCode != KeyCode.Escape)
                    {
                        SettingsSystem.CurrentSettings.ChatKey = Event.current.keyCode;
                        SettingsSystem.SaveSettings();
                        SettingChat = false;
                    }
                    else
                    {
                        SettingChat = false;
                    }
                }
            }
            if (GUILayout.Button(chatDescription))
            {
                SettingChat = !SettingChat;
            }
            if (GUILayout.Button("Reset disclaimer"))
            {
                SettingsSystem.CurrentSettings.DisclaimerAccepted = false;
                SettingsSystem.SaveSettings();
            }
            var settingInterpolation = GUILayout.Toggle(SettingsSystem.CurrentSettings.InterpolationEnabled, "Enable interpolation", ButtonStyle);

            if (settingInterpolation != SettingsSystem.CurrentSettings.InterpolationEnabled)
            {
                SettingsSystem.CurrentSettings.InterpolationEnabled = settingInterpolation;
                SettingsSystem.SaveSettings();
            }
            var closeBtnInConnectionWindow = GUILayout.Toggle(SettingsSystem.CurrentSettings.CloseBtnInConnectionWindow, "Show \"Close\" button in connection window", ButtonStyle);

            if (closeBtnInConnectionWindow != SettingsSystem.CurrentSettings.CloseBtnInConnectionWindow)
            {
                SettingsSystem.CurrentSettings.CloseBtnInConnectionWindow = closeBtnInConnectionWindow;
                SettingsSystem.SaveSettings();
            }
            GUILayout.Space(10);
            GUILayout.BeginVertical();
            GUILayout.Label("Positioning system:");
            var positionSetting = GUILayout.SelectionGrid(SettingsSystem.CurrentSettings.PositionSystem, new[] { "Dark", "Dagger", "Mixed" }, 3, "toggle");

            if (positionSetting != SettingsSystem.CurrentSettings.PositionSystem)
            {
                SettingsSystem.CurrentSettings.PositionSystem = positionSetting;
                SettingsSystem.SaveSettings();
            }
            GUILayout.EndVertical();
            GUILayout.Space(10);
            GUILayout.Label("Generate a server LMPModControl:");
            if (GUILayout.Button("Generate blacklist LMPModControl.txt"))
            {
                SystemsContainer.Get <ModSystem>().GenerateModControlFile(false);
            }
            if (GUILayout.Button("Generate whitelist LMPModControl.txt"))
            {
                SystemsContainer.Get <ModSystem>().GenerateModControlFile(true);
            }
            WindowsContainer.Get <UniverseConverterWindow>().Display = GUILayout.Toggle(WindowsContainer.Get <UniverseConverterWindow>().Display, "Generate Universe from saved game", ButtonStyle);
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Toolbar:", SmallOption);
            if (GUILayout.Button(ToolbarMode, ButtonStyle))
            {
                var newSetting = (int)SettingsSystem.CurrentSettings.ToolbarType + 1;
                //Overflow to 0
                if (!Enum.IsDefined(typeof(LmpToolbarType), newSetting))
                {
                    newSetting = 0;
                }
                SettingsSystem.CurrentSettings.ToolbarType = (LmpToolbarType)newSetting;
                SettingsSystem.SaveSettings();
                UpdateToolbarString();
                SystemsContainer.Get <ToolbarSystem>().ToolbarChanged();
            }
            GUILayout.EndHorizontal();
#if DEBUG
            DrawAdvancedDebugOptions();
#endif
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", ButtonStyle))
            {
                Display = false;
            }
            GUILayout.EndVertical();
        }
Example #5
0
        protected override void DrawWindowContent(int windowId)
        {
            //Player color
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Language);
            if (GUILayout.Button(LocalizationContainer.GetCurrentLanguageAsText()))
            {
                LocalizationContainer.LoadLanguage(LocalizationContainer.GetNextLanguage());
                SettingsSystem.CurrentSettings.Language = LocalizationContainer.CurrentLanguage;
                SettingsSystem.SaveSettings();
            }
            GUILayout.EndHorizontal();

            GUILayout.Label(LocalizationContainer.OptionsWindowText.Color);

            GUILayout.BeginHorizontal(Skin.box, GUILayout.ExpandWidth(true));
            GUILayout.Label(SettingsSystem.CurrentSettings.PlayerName, _tempColorLabelStyle);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Red, _smallOption);
            _tempColor.r = GUILayout.HorizontalScrollbar(_tempColor.r, 0, 0, 1);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Green, _smallOption);
            _tempColor.g = GUILayout.HorizontalScrollbar(_tempColor.g, 0, 0, 1);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Blue, _smallOption);
            _tempColor.b = GUILayout.HorizontalScrollbar(_tempColor.b, 0, 0, 1);
            GUILayout.EndHorizontal();

            _tempColorLabelStyle.fontStyle        = FontStyle.Bold;
            _tempColorLabelStyle.fontSize         = 40;
            _tempColorLabelStyle.alignment        = TextAnchor.MiddleCenter;
            _tempColorLabelStyle.active.textColor = _tempColor;
            _tempColorLabelStyle.normal.textColor = _tempColor;

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Random))
            {
                _tempColor = PlayerColorSystem.GenerateRandomColor();
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Set))
            {
                StatusWindow.Singleton.ColorEventHandled   = false;
                SettingsSystem.CurrentSettings.PlayerColor = _tempColor;
                SettingsSystem.SaveSettings();
                if (MainSystem.NetworkState == ClientState.Running)
                {
                    PlayerColorSystem.Singleton.MessageSender.SendPlayerColorToServer();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(10);
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.GenerateLmpModControl))
            {
                ModSystem.Singleton.GenerateModControlFile(false);
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.GenerateLmpModControl + " + SHA"))
            {
                ModSystem.Singleton.GenerateModControlFile(true);
            }
            _displayUniverseConverterDialog = GUILayout.Toggle(_displayUniverseConverterDialog, LocalizationContainer.OptionsWindowText.GenerateUniverse, ToggleButtonStyle);
            GUILayout.Space(10);

            DrawGeneralSettings();
            DrawNetworkSettings();
#if DEBUG
            DrawAdvancedDebugOptions();
#endif
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
        public void DrawContent(int windowId)
        {
            if (!LoadEventHandled)
            {
                LoadEventHandled = true;
                TempColor        = SettingsSystem.CurrentSettings.PlayerColor;
            }
            //Player color
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Language);
            if (GUILayout.Button(LocalizationContainer.GetCurrentLanguageAsText(), ButtonStyle))
            {
                LocalizationContainer.LoadLanguage(LocalizationContainer.GetNextLanguage());
                SettingsSystem.CurrentSettings.Language = LocalizationContainer.CurrentLanguage;
                SettingsSystem.SaveSettings();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Color);
            GUILayout.Label(SettingsSystem.CurrentSettings.PlayerName, TempColorLabelStyle);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Red, SmallOption);
            TempColor.r = GUILayout.HorizontalScrollbar(TempColor.r, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Green, SmallOption);
            TempColor.g = GUILayout.HorizontalScrollbar(TempColor.g, 0, 0, 1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Blue, SmallOption);
            TempColor.b = GUILayout.HorizontalScrollbar(TempColor.b, 0, 0, 1);
            GUILayout.EndHorizontal();
            TempColorLabelStyle.active.textColor = TempColor;
            TempColorLabelStyle.normal.textColor = TempColor;
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Random, ButtonStyle))
            {
                TempColor = PlayerColorSystem.GenerateRandomColor();
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Set, ButtonStyle))
            {
                StatusWindow.Singleton.ColorEventHandled   = false;
                SettingsSystem.CurrentSettings.PlayerColor = TempColor;
                SettingsSystem.SaveSettings();
                if (MainSystem.NetworkState == ClientState.Running)
                {
                    PlayerColorSystem.Singleton.MessageSender.SendPlayerColorToServer();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            //Key bindings
            var chatDescription = $"{LocalizationContainer.OptionsWindowText.SetChatKey} {SettingsSystem.CurrentSettings.ChatKey}";

            if (SettingChat)
            {
                chatDescription = LocalizationContainer.OptionsWindowText.SettingChatKey;
                if (Event.current.isKey)
                {
                    if (Event.current.keyCode != KeyCode.Escape)
                    {
                        SettingsSystem.CurrentSettings.ChatKey = Event.current.keyCode;
                        SettingsSystem.SaveSettings();
                        SettingChat = false;
                    }
                    else
                    {
                        SettingChat = false;
                    }
                }
            }
            if (GUILayout.Button(chatDescription))
            {
                SettingChat = !SettingChat;
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.ResetDisclaimer))
            {
                SettingsSystem.CurrentSettings.DisclaimerAccepted = false;
                SettingsSystem.SaveSettings();
            }
            var settingInterpolation = GUILayout.Toggle(SettingsSystem.CurrentSettings.InterpolationEnabled, LocalizationContainer.OptionsWindowText.Interpolation, ButtonStyle);

            if (settingInterpolation != SettingsSystem.CurrentSettings.InterpolationEnabled)
            {
                SettingsSystem.CurrentSettings.InterpolationEnabled = settingInterpolation;
                SettingsSystem.SaveSettings();
            }
            var closeBtnInConnectionWindow = GUILayout.Toggle(SettingsSystem.CurrentSettings.CloseBtnInConnectionWindow, LocalizationContainer.OptionsWindowText.ShowClose, ButtonStyle);

            if (closeBtnInConnectionWindow != SettingsSystem.CurrentSettings.CloseBtnInConnectionWindow)
            {
                SettingsSystem.CurrentSettings.CloseBtnInConnectionWindow = closeBtnInConnectionWindow;
                SettingsSystem.SaveSettings();
            }
            GUILayout.Space(10);
            GUILayout.Label(LocalizationContainer.OptionsWindowText.GenerateLmpModControl);
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.GenerateBlackList))
            {
                ModSystem.Singleton.GenerateModControlFile(false);
            }
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.GenerateWhiteList))
            {
                ModSystem.Singleton.GenerateModControlFile(true);
            }
            UniverseConverterWindow.Singleton.Display = GUILayout.Toggle(UniverseConverterWindow.Singleton.Display, LocalizationContainer.OptionsWindowText.GenerateUniverse, ButtonStyle);
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.OptionsWindowText.Toolbar, SmallOption);
            if (GUILayout.Button(ToolbarMode, ButtonStyle))
            {
                var newSetting = (int)SettingsSystem.CurrentSettings.ToolbarType + 1;
                //Overflow to 0
                if (!Enum.IsDefined(typeof(LmpToolbarType), newSetting))
                {
                    newSetting = 0;
                }
                SettingsSystem.CurrentSettings.ToolbarType = (LmpToolbarType)newSetting;
                SettingsSystem.SaveSettings();
                UpdateToolbarString();
                ToolbarSystem.Singleton.ToolbarChanged();
            }
            GUILayout.EndHorizontal();
#if DEBUG
            DrawAdvancedDebugOptions();
#endif
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(LocalizationContainer.OptionsWindowText.Close, ButtonStyle))
            {
                Display = false;
            }
            GUILayout.EndVertical();
        }