Пример #1
0
        public ConfigTabController(Vector2 pos, Vector2 size, MenuTab tab, ConfigMenu menu) : base(pos, size)
        {
            this.menuTab  = tab;
            tab.tabCtrler = this;
            this.cfgMenu  = menu;
            this.mode     = TabMode.NULL;
            subElements   = new List <UIelement>();

            OnChange();
        }
Пример #2
0
        public ConfigMenu(ProcessManager manager) : base(manager, ProcessManager.ProcessID.OptionsMenu)
        {
            Debug.Log("ConfigMenu ctor!");
            this.manager.currentMainLoop = this; //duplicate
            this.manager.upcomingProcess = null;

            this.pages.Add(new Page(this, null, "hub", 0));
            OptionScript.configMenu = this;
            OptionScript.tabs       = new Dictionary <string, OpTab>();


            if (this.manager.musicPlayer == null)
            {
                this.manager.musicPlayer = new MusicPlayer(this.manager);
                this.manager.sideProcesses.Add(this.manager.musicPlayer);
            }
            this.manager.musicPlayer.MenuRequestsSong(randomSong, 1f, 2f);
            //this.manager.musicPlayer.song = new MenuOrSlideShowSong(this.manager.musicPlayer, randomSong, 1f, 2f);
            //this.manager.musicPlayer.song.playWhenReady = true;


            redUnlocked = (this.manager.rainWorld.progression.miscProgressionData.redUnlocked ||
                           File.Exists(string.Concat(new object[] {
                Custom.RootFolderDirectory(), "unlockred.txt"
            })) ||
                           this.manager.rainWorld.progression.miscProgressionData.redMeatEatTutorial > 2
                           );

            opened           = false;
            selectedModIndex = 0;
            menuTab          = new MenuTab();

            List <string> allLevels = new List <string>();

            this.multiplayerUnlocks = new MultiplayerUnlocks(manager.rainWorld.progression, allLevels);
            currentInterface        = null;

            OptionScript.soundFill = 0;
            freezeMenu             = false;
            BoundKey = new Dictionary <string, string>();
            //Get Vanilla Keys
            for (int i = 0; i < OptionScript.rw.options.controls.Length; i++)
            {
                Options.ControlSetup setup = OptionScript.rw.options.controls[i];
                if (setup.preset == Options.ControlSetup.Preset.KeyboardSinglePlayer)
                {
                    for (int p = 0; p < setup.keyboardKeys.Length; p++)
                    {
                        if (!BoundKey.ContainsValue(setup.keyboardKeys[p].ToString()))
                        {
                            BoundKey.Add(string.Concat("Vanilla_", i.ToString(), "_", p.ToString()), setup.keyboardKeys[p].ToString());
                        }
                    }
                }
                else
                {
                    for (int p = 0; p < setup.gamePadButtons.Length; p++)
                    {
                        string key = setup.gamePadButtons[p].ToString();
                        if (key.Length > 9 && int.TryParse(key.Substring(8, 1), out int _))
                        {
                        }
                        else
                        {
                            key = key.Substring(0, 8) + i.ToString() + key.Substring(8);
                        }
                        if (!BoundKey.ContainsValue(key))
                        {
                            BoundKey.Add(string.Concat("Vanilla_", i.ToString(), "_", p.ToString()), key);
                        }
                    }
                }
            }
        }