Inheritance: BaseUiController
Esempio n. 1
0
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // Draw the selected entry in yellow, otherwise whice.
            Color color = isSelected ? Color.OrangeRed : Color.Teal;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            // Modify the alpha to fade out text during transitions.
            color *= screen.TransitionAlpha;

            // Draw text, centered on the middle of each line.
            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
Esempio n. 2
0
 public ScreenManager(Game game)
     : base(game)
 {
     menuScreen = new MenuScreen();
     gameScreen = new GameScreen();
     keyboard = new Input();
 }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            SimpleLevel samplelevel1 = new SimpleLevel(this);

            OptionsMenu optionsScreen = GlobalGameOptions.OptionsMenu;

            MenuScreen menuScreen = new MenuScreen("", true);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);

            menuScreen.AddMenuItem("Game Levels", EntryType.Separator, null);
            menuScreen.AddMenuItem(samplelevel1.GetTitle(), EntryType.Screen, samplelevel1);

            menuScreen.AddMenuItem(optionsScreen.MenuTitle, EntryType.Screen, optionsScreen);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.GlobalExitItem, null);
            
            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }
		private void HandleIL(MenuScreen screen) {
			bool shouldSplit = false;

			if (currentSplit == 0) {
				MenuScreen prev = mem.GetPreviousMenu();
				if (state == 0 && screen == MenuScreen.Loading && (prev == MenuScreen.SinglePlayerMap || prev == MenuScreen.SinglePlayerDLCMap || prev == MenuScreen.CoopMap || prev == MenuScreen.CoopDLCMap)) {
					state++;
				} else if (state == 1 && prev == MenuScreen.Loading) {
					state++;
					mem.SetLevelScore(mem.GetPlatformLevelId(), 0);
				} else if (state == 2) {
					shouldSplit = true;
					startFrameCount = mem.FrameCount();
				}
			} else if (currentSplit < Model.CurrentState.Run.Count) {
				string[] splits = Model.CurrentState.Run[currentSplit - 1].Name.Split(' ');
				int pickups = -1;
				for (int i = 0; i < splits.Length; i++) {
					if (int.TryParse(splits[i], out pickups)) {
						break;
					}
				}

				shouldSplit = pickups > 0 && mem.GetCurrentScore() == pickups;
				if (shouldSplit) {
					lastLevelComplete++;
					splitFrameCount = mem.FrameCount();
				}
			} else {
				PersistentLevelStats level = mem.GetLevelStats(mem.GetPlatformLevelId());
				shouldSplit = level != null && level.minMillisecondsForMaxScore != int.MaxValue;
			}

			HandleSplit(shouldSplit, screen, screen == MenuScreen.SinglePlayerMap || screen == MenuScreen.SinglePlayerDLCMap || screen == MenuScreen.CoopMap || screen == MenuScreen.CoopDLCMap);
		}
Esempio n. 5
0
        /// <summary>
        /// Draw the menu item.
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="position"></param>
        /// <param name="isSelected"></param>
        /// <param name="gameTime"></param>
        public virtual void Draw(MenuScreen screen, Vector2 position,
            bool isSelected, GameTime gameTime)
        {
            Color color = isSelected ? Color.Yellow : Color.White;

            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            // Fade the text during transitions
            color = new Color(color.R, color.G, color.B, screen.TransitionAlpha);

            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(140, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0,
                                    origin, scale, SpriteEffects.None, 0);
            screen.ScreenManager.GraphicsDevice.RenderState.DepthBufferEnable = true;
            screen.ScreenManager.GraphicsDevice.RenderState.AlphaBlendEnable = false;
            screen.ScreenManager.GraphicsDevice.RenderState.AlphaTestEnable = false;
        }
        public SplashScreen(MenuScreen nextScreen)
            : base("")
        {
            ActiveTime = 7000f;
            this.NextScreen = nextScreen;

            logoPosition = Vector2.Zero;
        }
Esempio n. 7
0
        public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;

            if (isSelected)
                selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
            else
                selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
        }
Esempio n. 8
0
 public virtual void Draw(MenuScreen screen, bool isSelected, SpriteBatch spriteBatch)
 {
     #if WINDOWS_PHONE
     isSelected = false;
     #endif
     Color color = isSelected ? Color.Blue : Color.Black;
     color *= screen.TransitionAlpha;
     ScreenManager screenManager = screen.ScreenManager;
     SpriteFont font = screenManager.Font;
     Vector2 origin = new Vector2(0, font.LineSpacing / 2);
     spriteBatch.DrawString(font, Text, position, color, 0,
                            origin, 1, SpriteEffects.None, 0);
 }
        public LevelSelectScreen(MenuScreen parent)
        {
            this.Parent = parent;

            //Load the action titles
            prevEntry = "MenuUp";
            nextEntry = "MenuDown";
            selectedEntry = "MenuAccept";
            cancelMenu = "MenuCancel";

            //Customize the text colors.
            Selected = Color.Purple;
            Highlighted = Color.Purple;
            Normal = Color.Gray;
        }
Esempio n. 10
0
    public SpawnDrop spawnDrop; //where player starts the game

    #endregion Fields

    #region Methods

    void Awake()
    {
        jgs = GameObject.FindGameObjectWithTag(TagsAndLayers.gameController).GetComponent<JumpGameState>();
        musicController = GameObject.FindGameObjectWithTag(TagsAndLayers.musicController).GetComponent<MusicController>();
        gameTimer = GameObject.FindGameObjectWithTag(TagsAndLayers.gameTimer).GetComponent<GameTimer>();
        deathArea = GameObject.FindGameObjectWithTag(TagsAndLayers.deathArea).GetComponent<DeathArea>();
        spawnDrop = GameObject.FindGameObjectWithTag(TagsAndLayers.spawnDrop).GetComponent<SpawnDrop>();
        menuScreen = GameObject.FindGameObjectWithTag(TagsAndLayers.menuController).GetComponent<MenuScreen>();
        pause = Camera.main.GetComponent<Pause>();
        crosshair = Camera.main.GetComponent<Crosshair>();

        objectSpawners = GameObject.FindGameObjectsWithTag(TagsAndLayers.objectSpawner);
        jumppadPillars = GameObject.FindGameObjectsWithTag(TagsAndLayers.jumppadPillar);
        player = GameObject.FindGameObjectWithTag(TagsAndLayers.player);
    }
Esempio n. 11
0
		public override void Draw( MenuScreen screen, Vector2 position, bool isSelected, GameTime gameTime ) {
			if( texture == null ) {
				base.Draw( screen, position, isSelected, gameTime );
			} else {
				double time = gameTime.TotalGameTime.TotalSeconds;
				float pulsate = (float)Math.Sin( time * 6 ) + 1;
				float scale = 1 + pulsate * 0.05f * selectionFade;

				Color color = new Color( Vector4.One * ( 1.0f - screen.TransitionPosition ) );

				ScreenManager screenManager = screen.ScreenManager;
				SpriteBatch spriteBatch = screenManager.SpriteBatch;

				spriteBatch.Draw( texture, position, null, color, 0, textureOrigin, scale, SpriteEffects.None, 0 );
			}
		}
Esempio n. 12
0
        public Game(MenuScreen mainForm)
        {
            this.mainForm = mainForm;

            //load story line for game state
            if (!GameState.loadStoryLine(Path.Combine(Application.StartupPath, "Data", "story.dll")))
                throw new FileNotFoundException("Could not find the storyLine file, /Data/stroy.dll");//do nothing at the moment;

            hostForm = new HostForm();

            hostForm.ShowDialog();

            mainForm.Show();

            //new System.Threading.Thread(GameLoop).Start();
        }
Esempio n. 13
0
        public virtual void Draw(MenuScreen screen, Vector2 position, bool isSelected, GameTime gameTime)
        {
            // Draw the selected entry in yellow, otherwise white.
            Color color = isSelected ? Color.Gold : Color.White;

            // Modify the alpha to fade text out during transitions.
            color = new Color(color.R, color.G, color.B, screen.TransitionAlphaValue);

            // Draw text, centered on the middle of each line.
            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.GameFont;
            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, DisplayText, position, color, 0, origin, 1, SpriteEffects.None, 0);
        }
Esempio n. 14
0
    public void ShowMenu(MenuScreen menuScreen, float transitionTime = 0.5f)
    {
        if(m_currentMenu != null)
        {
            CanvasGroup screenToFadeOut = m_currentMenu;
            LeanTween.value(m_currentMenu.gameObject, m_currentMenu.alpha, 0, transitionTime)
                .setOnUpdate((float newVal)=>{screenToFadeOut.alpha = newVal;})
                .setOnComplete(()=>{screenToFadeOut.alpha = 0;});
        }

        m_currentMenu = m_menuScreens[(int)menuScreen];

        CanvasGroup screenToFadeIn = m_currentMenu;
        LeanTween.value(m_currentMenu.gameObject, m_currentMenu.alpha, 1, transitionTime)
            .setOnUpdate((float newVal)=>{screenToFadeIn.alpha = newVal;})
            .setOnComplete(()=>{screenToFadeIn.alpha = 1;});
    }
Esempio n. 15
0
        public virtual void Draw(GameTime gameTime, MenuScreen menuScreen, bool isSelected, int linesSoFar)
        {
            Color color = isSelected ? Color.Yellow : Color.Black;
            double time = gameTime.TotalGameTime.TotalSeconds;
            float pulsate = (float)Math.Sin(time * 6) + 1;
            float scale = 1 + pulsate * 0.01f * selectionFade;
            color *= menuScreen.TransitionAlpha;

            ScreenManager screenManager = menuScreen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.FontHUD;

            string textToDraw = ParseText(Text, font);
            Vector2 origin = new Vector2(0, font.LineSpacing / 20 * linesSoFar);

            spriteBatch.DrawString(font, textToDraw, Position, color, 0.0f, origin, scale, SpriteEffects.None, 0.0f);
        }
 public void Draw(MenuScreen screen, MenuEntryState state, GameTime gameTime)
 {
     SpriteBatch spriteBatch = screen.ScreenManager.SpriteBatch;
     Texture2D drawTexture;
     switch (state)
     {
         case MenuEntryState.OVER:
             drawTexture = this._over;
             break;
         case MenuEntryState.DOWN:
             drawTexture = this._down;
             break;
         default:
             drawTexture = this._up;
             break;
     }
     spriteBatch.Draw(drawTexture, this._pos, Color.White);
 }
        public OptionsScreen(MenuScreen parent)
        {
            //Like the pause screen, we will reset the parent to active
            //when this screen is finished.  Therefore, we must have a reference
            //to the parent
            this.Parent = parent;

            //Load the action titles
            prevEntry = "MenuUp";
            nextEntry = "MenuDown";
            selectedEntry = "MenuAccept";
            cancelMenu = "MenuCancel";

            //Customize the text colors.
            Selected = Color.Yellow;
            Highlighted = Color.Green;
            Normal = Color.White;
        }
Esempio n. 18
0
        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            Color color = isSelected ? Color.Yellow : Color.White;

            double time = gameTime.TotalGameTime.TotalSeconds;
            float pulsate = (float)Math.Sin(time * 6) + 1;
            float scale = 1 + pulsate * 0.05f * selectionFade;

            color *= screen.TransitionAlpha;

            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing + 24 / 4f);

            spriteBatch.DrawString(font, text, new Vector2(position.X, position.Y - 30), color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
Esempio n. 19
0
        public override void Draw(MenuScreen screen, GameTime gameTime)
        {
            if (IsVisible)
            {
                // Draw the selected entry in teal, otherwise white.
                Color color =  Color.White;

                // Draw text, centered on the middle of each line.
                var spriteBatch = Game.Services.GetService<SpriteBatch>();
                spriteBatch.Begin();
                if ((Font != null) && !String.IsNullOrEmpty(Text))
                {
                    spriteBatch.DrawString(Font, Text, Position, color, 0, Vector2.Zero, _currentScale,
                                           SpriteEffects.None,
                                           0);
                }

                spriteBatch.End();
            }
        }
 public void Draw(MenuScreen screen, MenuEntryState state, GameTime gameTime, float sortmode)
 {
     SpriteBatch spriteBatch = screen.ScreenManager.SpriteBatch;
     Texture2D drawTexture;
     switch (state)
     {
         case MenuEntryState.OVER:
             drawTexture = this._over;
             break;
         case MenuEntryState.DOWN:
             drawTexture = this._down;
             break;
         case MenuEntryState.UP:
             drawTexture = this._up;
             break;
         default:
             drawTexture = this._disabled;
             break;
     }
     spriteBatch.Draw(drawTexture, this._pos, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0.48F + sortmode);
 }
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public override void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            TextWidth = screen.ScreenManager.Font.MeasureString ( Text ).X * scalept2;
            // there is no such thing as a selected item on Windows Phone, so we always
            // force isSelected to be false
            #if WINDOWS_PHONE
            isSelected = false;
            #endif

            // Draw the selected entry in yellow, otherwise white.
            Color color = isSelected ? Color.Yellow : Color.White;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = (1 + pulsate * 0.05f * selectionFade) * scalept2;

            // Modify the alpha to fade text out during transitions.
            color *= screen.TransitionAlpha;

            // Draw text, centered on the middle of each line.
            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2 ( 0, font.LineSpacing * scalept2 / 2 );
            Vector2 LineHeight = new Vector2 ( 0, font.LineSpacing * scalept2 );
            List<String> lines = GetLines ( screen, HorizWidth );

            //Iterate to draw each line, centered relative to the block of text.
            for (int i = 0; i < lines.Count; i++)
            {
                Vector2 LinePos = position + LineHeight * i + new Vector2 ( (TextWidth - LineWidth ( screen, lines[i] )) / 2, 0 );
                spriteBatch.DrawString ( font, lines[i], LinePos, color, 0,
                                       origin, scale, SpriteEffects.None, 0 );
            }
        }
		public void GetValues() {
			if (!mem.HookProcess()) {
				if (manager.Visible) { manager.Invoke((Action)delegate () { manager.Hide(); }); }
				return;
			} else if (!manager.Visible) {
				manager.Invoke((Action)delegate () { manager.Show(); });
			}

			MenuScreen screen = mem.GetCurrentMenu();

			if (Model != null) {
				if (Model.CurrentState.CurrentPhase == TimerPhase.NotRunning) {
					mainMenu = screen;
				}
				if (Model.CurrentState.Run.Count < 10) {
					HandleIL(screen);
				} else if (Model.CurrentState.Run.Count == 10) {
					if (mainMenu == MenuScreen.SinglePlayerPathSelect) {
						HandleDarkVoid(screen);
					} else if (mainMenu == MenuScreen.CoopMap) {
						HandleJourneyCoop(screen);
					} else {
						HandleDarkVoidCoop(screen);
					}
					if (currentSplit == 1 && (screen == MenuScreen.CoopMap || screen == MenuScreen.CoopDLCMap)) {
						mainMenu = screen;
					}
				} else if (Model.CurrentState.Run.Count == 24) {
					HandleJourney(screen);
				}

				HandleGameTimes(screen);
			}

			lastMenu = screen;
			LogValues(screen);
		}
        /// <summary>
        /// Updates the menu item text, adding information about the network
        /// quality of service as soon as that becomes available.
        /// </summary>
        public override void Update(MenuScreen screen, bool isSelected,
                                    GameTime gameTime)
        {
            base.Update(screen, isSelected, gameTime);

            // Quality of service data can take some time to query, so it will not
            // be filled in straight away when NetworkSession.Find returns. We want
            // to display the list of available sessions straight away, and then
            // fill in the quality of service data whenever that becomes available,
            // so we keep checking until this data shows up.
            if (screen.IsActive && !gotQualityOfService)
            {
                QualityOfService qualityOfService = availableSession.QualityOfService;

                if (qualityOfService.IsAvailable)
                {
                    TimeSpan pingTime = qualityOfService.AverageRoundtripTime;

                    Text += string.Format(" - {0:0} ms", pingTime.TotalMilliseconds);

                    gotQualityOfService = true;
                }
            }
        }
Esempio n. 24
0
        private static void GenerateHostUI()
        {
            GameObject canvas      = SingletonBehaviour <CanvasSpawner> .Instance.CanvasGO;
            GameObject menuBuilder = CreateMenu(new MenuBuilder("DVMultiplayer Host", "Host", 975, 440f, false, false));

            TextFieldBuilder inputPortField       = new TextFieldBuilder("Port", menuBuilder.transform, new Rect(-32f, -215, 695, 76), TextAlignmentOptions.MidlineLeft, RectTransformAnchoring.TopRight, new Vector2(1f, 0f), true);
            TextFieldBuilder inputUsernameField   = new TextFieldBuilder("Username", menuBuilder.transform, new Rect(-32f, -315, 695, 76), TextAlignmentOptions.MidlineLeft, RectTransformAnchoring.TopRight, new Vector2(1f, 0f));
            ButtonBuilder    connectButtonBuilder = new ButtonBuilder("Host", "Host", menuBuilder.transform, new Rect(0f, -415, 448, 76), RectTransformAnchoring.TopCenter, new Vector2(.5f, 0f), TextAlignmentOptions.Center);

            CreateSection(new Rect(0f, -177, 925, 91.14999f), RectTransformAnchoring.TopCenter, menuBuilder.transform);
            CreateLabel("Port", "Port:", menuBuilder.transform, new Rect(32, -215, 218, 76), FontStyles.UpperCase, TextAlignmentOptions.MidlineLeft, RectTransformAnchoring.TopLeft, new Vector2(0f, 0f));
            CreateTextField(inputPortField);

            CreateSection(new Rect(0f, -277, 925, 91.14999f), RectTransformAnchoring.TopCenter, menuBuilder.transform);
            CreateLabel("Username", "Username:", menuBuilder.transform, new Rect(32, -315, 218, 76), FontStyles.UpperCase, TextAlignmentOptions.MidlineLeft, RectTransformAnchoring.TopLeft, new Vector2(0f, 0f));
            CreateTextField(inputUsernameField);

            CreateButton(connectButtonBuilder);

            GameObject menu = Object.Instantiate(menuBuilder, canvas.transform);

            Object.DestroyImmediate(menuBuilder);
            HostMenuUI = menu.GetComponent <MenuScreen>();
        }
Esempio n. 25
0
        protected override bool DoShow(MenuScreen <PauseMenu> previous)
        {
            GuiContentData guiContentData = new GuiContentData();

            guiContentData.SetValue("showMap", base.Owner._mapWindow.CanShow(base.Owner.currEnt));
            bool flag = !PlayerRespawner.RespawnInhibited() && PlayerRespawner.GetActiveInstance() != null;

            guiContentData.SetValue("canWarp", flag);
            if (flag)
            {
                IDataSaver saver = base.Owner._saver.GetSaver("/local/start", true);
                if (saver != null)
                {
                    guiContentData.SetValue("hasWarpTgt", true);
                    guiContentData.SetValue("warpTgt", saver.LoadData("level"));
                }
                else
                {
                    guiContentData.SetValue("hasWarpTgt", false);
                }
            }
            base.Root.ApplyContent(guiContentData, true);
            return(true);
        }
 public void CloseMenuScreen(MenuScreen menuscreen) // close menu function
 {
     menuscreen.CloseMenuScreen();
 }
Esempio n. 27
0
        protected override void InternalInit()
        {
            ScreenState state = new ScreenState
            {
                Width = Seven.Configuration.WindowWidth,
                Height = Seven.Configuration.WindowHeight
            };

            Screens.Victory.VictoryLabel victoryLabel = new Screens.Victory.VictoryLabel(state);

            List<GameMenu> victoryMenus = new List<GameMenu>();
            victoryMenus.Add(victoryLabel);
            victoryMenus.Add(new Screens.Victory.VictoryEXP(this, state));
            victoryMenus.Add(new Screens.Victory.VictoryAP(this, state));
            victoryMenus.Add(new Screens.Victory.Top(this, state));
            victoryMenus.Add(new Screens.Victory.Middle(this, state));
            victoryMenus.Add(new Screens.Victory.Bottom(this, state));

            Mastered = new Mastered(state);
            Mastered.Visible = false;
            victoryMenus.Add(Mastered);

            for (int i = 0; i < LevelUp.Length; i++)
            {
                LevelUp[i] = new LevelUp(state, i);
                LevelUp[i].Visible = false;
                victoryMenus.Add(LevelUp[i]);
            }

            for (int i = 0; i < MateriaLevelUp.Length; i++)
            {
                MateriaLevelUp[i] = new MateriaLevelUp(state, i);
                MateriaLevelUp[i].Visible = false;
                victoryMenus.Add(MateriaLevelUp[i]);
            }

            VictoryScreen = new MenuScreen(victoryMenus, victoryLabel);

            Screens.Hoard.Label hoardLabel = new Screens.Hoard.Label(state);
            HoardItemLeft = new Screens.Hoard.ItemLeft(this, state, Gil);

            List<GameMenu> hoardMenus = new List<GameMenu>();
            hoardMenus.Add(hoardLabel);
            hoardMenus.Add(new Screens.Hoard.GilLeft(this, state));
            hoardMenus.Add(new Screens.Hoard.HoardGilRight(this, state));
            hoardMenus.Add(HoardItemLeft);
            hoardMenus.Add(new Screens.Hoard.ItemRight(this, state));

            HoardScreen = new MenuScreen(hoardMenus, hoardLabel);

            _screen = VictoryScreen;
        }
 protected AbstractChangerHelper(Keyboard keyboard, MenuScreen parent)
 {
     this.parent   = parent;
     this.callback = new Callback(this);
     this.keyboard = keyboard;
 }
Esempio n. 29
0
        public static void EditUI()
        {
            // Reset settings
            AreaRando.Instance.Settings = new SaveSettings();

            // Fetch data from vanilla screen
            MenuScreen playScreen = Ref.UI.playModeMenuScreen;

            playScreen.title.gameObject.transform.localPosition = new Vector3(0, 520.56f);

            Object.Destroy(playScreen.topFleur.gameObject);

            MenuButton classic = (MenuButton)playScreen.defaultHighlight;
            MenuButton steel   = (MenuButton)classic.FindSelectableOnDown();
            MenuButton back    = (MenuButton)steel.FindSelectableOnDown();

            GameObject parent = steel.transform.parent.gameObject;

            Object.Destroy(parent.GetComponent <VerticalLayoutGroup>());

            // Create new buttons
            MenuButton startRandoBtn = classic.Clone("StartRando", MenuButton.MenuButtonType.Proceed,
                                                     new Vector2(0, 200), "Start Game", "Randomizer v2", AreaRando.GetSprite("UI.logo"));
            MenuButton startNormalBtn = classic.Clone("StartNormal", MenuButton.MenuButtonType.Proceed,
                                                      new Vector2(0, -200), "Start Game", "Non-Randomizer");
            MenuButton startSteelRandoBtn = steel.Clone("StartSteelRando", MenuButton.MenuButtonType.Proceed,
                                                        new Vector2(10000, 10000), "Steel Soul", "Randomizer v2", AreaRando.GetSprite("UI.logo2"));
            MenuButton startSteelNormalBtn = steel.Clone("StartSteelNormal", MenuButton.MenuButtonType.Proceed,
                                                         new Vector2(10000, 10000), "Steel Soul", "Non-Randomizer");

            startNormalBtn.transform.localScale             = startRandoBtn.transform.localScale =
                startSteelNormalBtn.transform.localScale    =
                    startSteelRandoBtn.transform.localScale = new Vector2(0.75f, 0.75f);

            MenuButton backBtn = back.Clone("Back", MenuButton.MenuButtonType.Proceed, new Vector2(0, -100), "Back");


            RandoMenuItem <string> gameTypeBtn = new RandoMenuItem <string>(back, new Vector2(0, 600), "Game Type", "Normal", "Steel Soul");

            RandoMenuItem <string> presetPoolsBtn    = new RandoMenuItem <string>(back, new Vector2(900, 1040), "Preset", "Progressive", "Completionist", "Junk Pit", "Custom");
            RandoMenuItem <string> RandoDreamersBtn  = new RandoMenuItem <string>(back, new Vector2(900, 960), "Dreamers", "Always true");
            RandoMenuItem <string> RandoSkillsBtn    = new RandoMenuItem <string>(back, new Vector2(900, 880), "Skills", "Always true");
            RandoMenuItem <string> RandoCharmsBtn    = new RandoMenuItem <string>(back, new Vector2(900, 800), "Charms", "Always true");
            RandoMenuItem <string> RandoKeysBtn      = new RandoMenuItem <string>(back, new Vector2(900, 720), "Keys", "Always true");
            RandoMenuItem <bool>   RandoGeoChestsBtn = new RandoMenuItem <bool>(back, new Vector2(900, 640), "Geo Chests", false, true);
            RandoMenuItem <bool>   RandoMaskBtn      = new RandoMenuItem <bool>(back, new Vector2(900, 560), "Mask Shards", false, true);
            RandoMenuItem <bool>   RandoVesselBtn    = new RandoMenuItem <bool>(back, new Vector2(900, 480), "Vessel Fragments", false, true);
            RandoMenuItem <bool>   RandoOreBtn       = new RandoMenuItem <bool>(back, new Vector2(900, 400), "Pale Ore", false, true);
            RandoMenuItem <bool>   RandoNotchBtn     = new RandoMenuItem <bool>(back, new Vector2(900, 320), "Charm Notches", false, true);
            RandoMenuItem <bool>   RandoEggBtn       = new RandoMenuItem <bool>(back, new Vector2(900, 240), "Rancid Eggs", false, true);
            RandoMenuItem <bool>   RandoRelicsBtn    = new RandoMenuItem <bool>(back, new Vector2(900, 160), "Relics", false, true);
            RandoMenuItem <string> RandoLongItemsBtn = new RandoMenuItem <string>(back, new Vector2(900, 80), "Longest Check", "Standard", "Longer Items", "Longer Quests", "All Locations", "Fast");

            RandoMenuItem <string> presetSkipsBtn   = new RandoMenuItem <string>(back, new Vector2(-900, 1040), "Preset", "Easy", "Hard", "Custom");
            RandoMenuItem <bool>   shadeSkipsBtn    = new RandoMenuItem <bool>(back, new Vector2(-900, 960), "Shade Skips", false, true);
            RandoMenuItem <bool>   acidSkipsBtn     = new RandoMenuItem <bool>(back, new Vector2(-900, 880), "Acid Skips", false, true);
            RandoMenuItem <bool>   spikeTunnelsBtn  = new RandoMenuItem <bool>(back, new Vector2(-900, 800), "Spike Tunnels", false, true);
            RandoMenuItem <bool>   miscSkipsBtn     = new RandoMenuItem <bool>(back, new Vector2(-900, 720), "Misc Skips", false, true);
            RandoMenuItem <bool>   fireballSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 640), "Fireball Skips", false, true);
            RandoMenuItem <bool>   darkRoomsBtn     = new RandoMenuItem <bool>(back, new Vector2(-900, 560), "Dark Rooms", false, true);

            RandoMenuItem <bool> charmNotchBtn    = new RandoMenuItem <bool>(back, new Vector2(-900, 300), "Salubra Notches", true, false);
            RandoMenuItem <bool> lemmBtn          = new RandoMenuItem <bool>(back, new Vector2(-900, 220), "Lemm Sell All", true, false);
            RandoMenuItem <bool> jijiBtn          = new RandoMenuItem <bool>(back, new Vector2(-900, 140), "Jiji Hints", true, false);
            RandoMenuItem <bool> PleasureHouseBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 60), "Pleasure House Geo", true, false);
            RandoMenuItem <bool> EarlyGeoBtn      = new RandoMenuItem <bool>(back, new Vector2(-900, -20), "Early Geo", true, false);

            RandoMenuItem <string> modeBtn = new RandoMenuItem <string>(back, new Vector2(0, 1040), "Mode", "Standard"); //, "No Claw", "All Bosses", "All Skills", "All Charms"

            // Create seed entry field
            GameObject seedGameObject = back.Clone("Seed", MenuButton.MenuButtonType.Activate, new Vector2(0, 1130),
                                                   "Click to type a custom seed").gameObject;

            Object.DestroyImmediate(seedGameObject.GetComponent <MenuButton>());
            Object.DestroyImmediate(seedGameObject.GetComponent <EventTrigger>());
            Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <AutoLocalizeTextUI>());
            Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <FixVerticalAlign>());
            Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <ContentSizeFitter>());

            RectTransform seedRect = seedGameObject.transform.Find("Text").GetComponent <RectTransform>();

            seedRect.anchorMin = seedRect.anchorMax = new Vector2(0.5f, 0.5f);
            seedRect.sizeDelta = new Vector2(337, 63.2f);

            InputField customSeedInput = seedGameObject.AddComponent <InputField>();

            customSeedInput.transform.localPosition = new Vector3(0, 1240);
            customSeedInput.textComponent           = seedGameObject.transform.Find("Text").GetComponent <Text>();

            AreaRando.Instance.Settings.Seed = new Random().Next(999999999);
            customSeedInput.text             = AreaRando.Instance.Settings.Seed.ToString();

            customSeedInput.caretColor  = Color.white;
            customSeedInput.contentType = InputField.ContentType.IntegerNumber;
            customSeedInput.onEndEdit.AddListener(ParseSeedInput);
            customSeedInput.navigation     = Navigation.defaultNavigation;
            customSeedInput.caretWidth     = 8;
            customSeedInput.characterLimit = 9;

            customSeedInput.colors = new ColorBlock
            {
                highlightedColor = Color.yellow,
                pressedColor     = Color.red,
                disabledColor    = Color.black,
                normalColor      = Color.white,
                colorMultiplier  = 2f
            };

            // Create some labels
            CreateLabel(back, new Vector2(-900, 1130), "Required Skips");
            CreateLabel(back, new Vector2(-900, 400), "Quality of Life");
            CreateLabel(back, new Vector2(900, 1130), "Randomization");
            CreateLabel(back, new Vector2(0, 200), "Area Randomizer expects use of Benchwarp");
            CreateLabel(back, new Vector2(0, 1300), "Seed:");

            // We don't need these old buttons anymore
            Object.Destroy(classic.gameObject);
            Object.Destroy(steel.gameObject);
            Object.Destroy(parent.FindGameObjectInChildren("GGButton"));
            Object.Destroy(back.gameObject);

            // Gotta put something here, we destroyed the old default
            playScreen.defaultHighlight = startRandoBtn;

            // Apply navigation info (up, right, down, left)

            startNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button);
            startRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, gameTypeBtn.Button, presetSkipsBtn.Button);
            startSteelNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button);
            startSteelRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, gameTypeBtn.Button, presetSkipsBtn.Button);
            modeBtn.Button.SetNavigation(backBtn, modeBtn.Button, startRandoBtn, modeBtn.Button);
            gameTypeBtn.Button.SetNavigation(startRandoBtn, presetPoolsBtn.Button, startNormalBtn, presetSkipsBtn.Button);
            backBtn.SetNavigation(startNormalBtn, backBtn, modeBtn.Button, backBtn);


            presetSkipsBtn.Button.SetNavigation(PleasureHouseBtn.Button, startRandoBtn, shadeSkipsBtn.Button, presetSkipsBtn.Button);
            shadeSkipsBtn.Button.SetNavigation(presetSkipsBtn.Button, startRandoBtn, acidSkipsBtn.Button, shadeSkipsBtn.Button);
            acidSkipsBtn.Button.SetNavigation(shadeSkipsBtn.Button, startRandoBtn, spikeTunnelsBtn.Button, acidSkipsBtn.Button);
            spikeTunnelsBtn.Button.SetNavigation(acidSkipsBtn.Button, startRandoBtn, miscSkipsBtn.Button, spikeTunnelsBtn.Button);
            miscSkipsBtn.Button.SetNavigation(spikeTunnelsBtn.Button, startRandoBtn, fireballSkipsBtn.Button, miscSkipsBtn.Button);
            fireballSkipsBtn.Button.SetNavigation(miscSkipsBtn.Button, startRandoBtn, darkRoomsBtn.Button, fireballSkipsBtn.Button);
            darkRoomsBtn.Button.SetNavigation(fireballSkipsBtn.Button, startRandoBtn, charmNotchBtn.Button, darkRoomsBtn.Button);


            charmNotchBtn.Button.SetNavigation(EarlyGeoBtn.Button, startRandoBtn, lemmBtn.Button, charmNotchBtn.Button);
            lemmBtn.Button.SetNavigation(charmNotchBtn.Button, startRandoBtn, jijiBtn.Button, lemmBtn.Button);
            jijiBtn.Button.SetNavigation(lemmBtn.Button, startRandoBtn, PleasureHouseBtn.Button, jijiBtn.Button);
            PleasureHouseBtn.Button.SetNavigation(jijiBtn.Button, startRandoBtn, EarlyGeoBtn.Button, PleasureHouseBtn.Button);
            EarlyGeoBtn.Button.SetNavigation(PleasureHouseBtn.Button, startRandoBtn, charmNotchBtn.Button, EarlyGeoBtn.Button);


            presetPoolsBtn.Button.SetNavigation(RandoLongItemsBtn.Button, presetPoolsBtn.Button, RandoDreamersBtn.Button, startRandoBtn);
            RandoDreamersBtn.Button.SetNavigation(presetPoolsBtn.Button, RandoDreamersBtn.Button, RandoSkillsBtn.Button, startRandoBtn);
            RandoSkillsBtn.Button.SetNavigation(RandoDreamersBtn.Button, RandoSkillsBtn.Button, RandoCharmsBtn.Button, startRandoBtn);
            RandoCharmsBtn.Button.SetNavigation(RandoSkillsBtn.Button, RandoCharmsBtn.Button, RandoKeysBtn.Button, startRandoBtn);
            RandoKeysBtn.Button.SetNavigation(RandoCharmsBtn.Button, RandoKeysBtn.Button, RandoGeoChestsBtn.Button, startRandoBtn);
            RandoGeoChestsBtn.Button.SetNavigation(RandoKeysBtn.Button, RandoGeoChestsBtn.Button, RandoMaskBtn.Button, startRandoBtn);
            RandoMaskBtn.Button.SetNavigation(RandoGeoChestsBtn.Button, RandoMaskBtn.Button, RandoVesselBtn.Button, startRandoBtn);
            RandoVesselBtn.Button.SetNavigation(RandoMaskBtn.Button, RandoVesselBtn.Button, RandoOreBtn.Button, startRandoBtn);
            RandoOreBtn.Button.SetNavigation(RandoVesselBtn.Button, RandoOreBtn.Button, RandoNotchBtn.Button, startRandoBtn);
            RandoNotchBtn.Button.SetNavigation(RandoOreBtn.Button, RandoNotchBtn.Button, RandoEggBtn.Button, startRandoBtn);
            RandoEggBtn.Button.SetNavigation(RandoNotchBtn.Button, RandoEggBtn.Button, RandoRelicsBtn.Button, startRandoBtn);
            RandoRelicsBtn.Button.SetNavigation(RandoEggBtn.Button, RandoRelicsBtn.Button, RandoLongItemsBtn.Button, startRandoBtn);
            RandoLongItemsBtn.Button.SetNavigation(RandoRelicsBtn.Button, RandoLongItemsBtn.Button, presetPoolsBtn.Button, startRandoBtn);


            // Setup event for changing difficulty settings buttons
            void UpdateSkipsButtons(RandoMenuItem <string> item)
            {
                switch (item.CurrentSelection)
                {
                case "Easy":
                    shadeSkipsBtn.SetSelection(false);
                    acidSkipsBtn.SetSelection(false);
                    spikeTunnelsBtn.SetSelection(false);
                    miscSkipsBtn.SetSelection(false);
                    fireballSkipsBtn.SetSelection(false);
                    darkRoomsBtn.SetSelection(false);
                    break;

                case "Hard":
                    shadeSkipsBtn.SetSelection(true);
                    acidSkipsBtn.SetSelection(true);
                    spikeTunnelsBtn.SetSelection(true);
                    miscSkipsBtn.SetSelection(true);
                    fireballSkipsBtn.SetSelection(true);
                    darkRoomsBtn.SetSelection(true);
                    break;

                case "Custom":
                    item.SetSelection("Easy");
                    goto case "Easy";

                default:
                    LogWarn("Unknown value in preset button: " + item.CurrentSelection);
                    break;
                }
            }

            void UpdatePoolPreset(RandoMenuItem <string> item)
            {
                switch (item.CurrentSelection)
                {
                case "Progressive":
                    //RandoDreamersBtn.SetSelection(true);
                    //RandoSkillsBtn.SetSelection(true);
                    //RandoCharmsBtn.SetSelection(true);
                    //RandoKeysBtn.SetSelection(true);
                    RandoGeoChestsBtn.SetSelection(false);
                    RandoMaskBtn.SetSelection(false);
                    RandoVesselBtn.SetSelection(false);
                    RandoOreBtn.SetSelection(false);
                    RandoNotchBtn.SetSelection(false);
                    RandoEggBtn.SetSelection(false);
                    RandoRelicsBtn.SetSelection(false);
                    RandoLongItemsBtn.SetSelection("Standard");
                    break;

                case "Completionist":
                    //RandoDreamersBtn.SetSelection(true);
                    //RandoSkillsBtn.SetSelection(true);
                    //RandoCharmsBtn.SetSelection(true);
                    // RandoKeysBtn.SetSelection(true);
                    RandoGeoChestsBtn.SetSelection(true);
                    RandoMaskBtn.SetSelection(true);
                    RandoVesselBtn.SetSelection(true);
                    RandoOreBtn.SetSelection(true);
                    RandoNotchBtn.SetSelection(true);
                    RandoEggBtn.SetSelection(false);
                    RandoRelicsBtn.SetSelection(false);
                    RandoLongItemsBtn.SetSelection("Standard");
                    break;

                case "Junk Pit":
                    //RandoDreamersBtn.SetSelection(true);
                    //RandoSkillsBtn.SetSelection(true);
                    //RandoCharmsBtn.SetSelection(true);
                    //RandoKeysBtn.SetSelection(true);
                    RandoGeoChestsBtn.SetSelection(true);
                    RandoMaskBtn.SetSelection(true);
                    RandoVesselBtn.SetSelection(true);
                    RandoOreBtn.SetSelection(true);
                    RandoNotchBtn.SetSelection(true);
                    RandoEggBtn.SetSelection(true);
                    RandoRelicsBtn.SetSelection(true);
                    RandoLongItemsBtn.SetSelection("Standard");
                    break;

                case "Custom":
                    item.SetSelection("Progressive");
                    goto case "Progressive";
                }
            }

            // Event for setting stuff to hard mode on no claw selected
            void SetMode(RandoMenuItem <string> item)
            {
                if (item.CurrentSelection == "No Claw")
                {
                    SetShadeSkips(true);
                    acidSkipsBtn.SetSelection(true);
                    spikeTunnelsBtn.SetSelection(true);
                    miscSkipsBtn.SetSelection(true);
                    fireballSkipsBtn.SetSelection(true);
                    darkRoomsBtn.SetSelection(true);
                }
                else if (item.CurrentSelection.StartsWith("All"))
                {
                    presetPoolsBtn.SetSelection("Classic");
                }
            }

            void SetShadeSkips(bool enabled)
            {
                if (enabled)
                {
                    gameTypeBtn.SetSelection("Normal");
                    SwitchGameType(false);
                }
                else
                {
                    modeBtn.SetSelection("Standard");
                }

                shadeSkipsBtn.SetSelection(enabled);
            }

            void SkipsSettingChanged(RandoMenuItem <bool> item)
            {
                presetSkipsBtn.SetSelection("Custom");

                if (!item.CurrentSelection && item.Name != "Mag Skips")
                {
                    modeBtn.SetSelection("Standard");
                }
            }

            void PoolSettingChanged(RandoMenuItem <bool> item)
            {
                presetPoolsBtn.SetSelection("Custom");
            }

            presetSkipsBtn.Changed += UpdateSkipsButtons;
            presetPoolsBtn.Changed += UpdatePoolPreset;
            modeBtn.Changed        += SetMode;

            shadeSkipsBtn.Changed    += SkipsSettingChanged;
            shadeSkipsBtn.Changed    += SaveShadeVal;
            acidSkipsBtn.Changed     += SkipsSettingChanged;
            spikeTunnelsBtn.Changed  += SkipsSettingChanged;
            miscSkipsBtn.Changed     += SkipsSettingChanged;
            fireballSkipsBtn.Changed += SkipsSettingChanged;
            darkRoomsBtn.Changed     += SkipsSettingChanged;

            //RandoDreamersBtn.Changed += PoolSettingChanged;
            //RandoSkillsBtn.Changed += PoolSettingChanged;
            //RandoCharmsBtn.Changed += PoolSettingChanged;
            //RandoKeysBtn.Changed += PoolSettingChanged;
            RandoGeoChestsBtn.Changed += PoolSettingChanged;
            RandoMaskBtn.Changed      += PoolSettingChanged;
            RandoVesselBtn.Changed    += PoolSettingChanged;
            RandoOreBtn.Changed       += PoolSettingChanged;
            RandoNotchBtn.Changed     += PoolSettingChanged;
            RandoEggBtn.Changed       += PoolSettingChanged;
            RandoRelicsBtn.Changed    += PoolSettingChanged;

            // Setup game type button changes
            void SaveShadeVal(RandoMenuItem <bool> item)
            {
                SetShadeSkips(shadeSkipsBtn.CurrentSelection);
            }

            void SwitchGameType(bool steelMode)
            {
                if (!steelMode)
                {
                    // Normal mode
                    startRandoBtn.transform.localPosition       = new Vector2(0, 200);
                    startNormalBtn.transform.localPosition      = new Vector2(0, -200);
                    startSteelRandoBtn.transform.localPosition  = new Vector2(10000, 10000);
                    startSteelNormalBtn.transform.localPosition = new Vector2(10000, 10000);

                    //backBtn.SetNavigation(startNormalBtn, startNormalBtn, modeBtn.Button, startRandoBtn);
                    //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startNormalBtn, lemmBtn.Button);
                    //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startRandoBtn, allSkillsBtn.Button);
                }
                else
                {
                    // Steel Soul mode
                    startRandoBtn.transform.localPosition       = new Vector2(10000, 10000);
                    startNormalBtn.transform.localPosition      = new Vector2(10000, 10000);
                    startSteelRandoBtn.transform.localPosition  = new Vector2(0, 200);
                    startSteelNormalBtn.transform.localPosition = new Vector2(0, -200);

                    SetShadeSkips(false);

                    //backBtn.SetNavigation(startSteelNormalBtn, startSteelNormalBtn, modeBtn.Button, startSteelRandoBtn);
                    //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startSteelNormalBtn, lemmBtn.Button);
                    //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startSteelRandoBtn, allSkillsBtn.Button);
                }
            }

            gameTypeBtn.Button.AddEvent(EventTriggerType.Submit,
                                        garbage => SwitchGameType(gameTypeBtn.CurrentSelection != "Normal"));

            // Setup start game button events
            void StartGame(bool rando)
            {
                AreaRando.Instance.Settings.CharmNotch    = charmNotchBtn.CurrentSelection;
                AreaRando.Instance.Settings.Lemm          = lemmBtn.CurrentSelection;
                AreaRando.Instance.Settings.Jiji          = jijiBtn.CurrentSelection;
                AreaRando.Instance.Settings.PleasureHouse = PleasureHouseBtn.CurrentSelection;
                AreaRando.Instance.Settings.EarlyGeo      = EarlyGeoBtn.CurrentSelection;

                AreaRando.Instance.Settings.RandomizeDreamers        = true;
                AreaRando.Instance.Settings.RandomizeSkills          = true;
                AreaRando.Instance.Settings.RandomizeCharms          = true;
                AreaRando.Instance.Settings.RandomizeKeys            = true;
                AreaRando.Instance.Settings.RandomizeGeoChests       = RandoGeoChestsBtn.CurrentSelection;
                AreaRando.Instance.Settings.RandomizeMaskShards      = RandoMaskBtn.CurrentSelection;
                AreaRando.Instance.Settings.RandomizeVesselFragments = RandoVesselBtn.CurrentSelection;
                AreaRando.Instance.Settings.RandomizePaleOre         = RandoOreBtn.CurrentSelection;
                AreaRando.Instance.Settings.RandomizeCharmNotches    = RandoNotchBtn.CurrentSelection;
                AreaRando.Instance.Settings.RandomizeRancidEggs      = RandoEggBtn.CurrentSelection;
                AreaRando.Instance.Settings.RandomizeRelics          = RandoRelicsBtn.CurrentSelection;

                AreaRando.Instance.Settings.LongItemTier = 1;

                if (RandoLongItemsBtn.CurrentSelection == "Standard")
                {
                    AreaRando.Instance.Settings.LongItemTier = 1;
                }
                if (RandoLongItemsBtn.CurrentSelection == "Longer Items")
                {
                    AreaRando.Instance.Settings.LongItemTier = 2;
                }
                if (RandoLongItemsBtn.CurrentSelection == "Longer Quests")
                {
                    AreaRando.Instance.Settings.LongItemTier = 3;
                }
                if (RandoLongItemsBtn.CurrentSelection == "All Locations")
                {
                    AreaRando.Instance.Settings.LongItemTier = 4;
                }
                if (RandoLongItemsBtn.CurrentSelection == "Fast")
                {
                    AreaRando.Instance.Settings.LongItemTier = 0;
                }


                AreaRando.Instance.Settings.Randomizer = rando;

                if (AreaRando.Instance.Settings.Randomizer)
                {
                    AreaRando.Instance.Settings.NoClaw    = false;
                    AreaRando.Instance.Settings.AllBosses = false;
                    AreaRando.Instance.Settings.AllSkills = false;
                    AreaRando.Instance.Settings.AllCharms = false;

                    AreaRando.Instance.Settings.ShadeSkips    = shadeSkipsBtn.CurrentSelection;
                    AreaRando.Instance.Settings.AcidSkips     = acidSkipsBtn.CurrentSelection;
                    AreaRando.Instance.Settings.SpikeTunnels  = spikeTunnelsBtn.CurrentSelection;
                    AreaRando.Instance.Settings.MiscSkips     = miscSkipsBtn.CurrentSelection;
                    AreaRando.Instance.Settings.FireballSkips = fireballSkipsBtn.CurrentSelection;
                    AreaRando.Instance.Settings.DarkRooms     = darkRoomsBtn.CurrentSelection;
                }

                AreaRando.Instance.StartNewGame();
            }

            startNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false));
            startRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true));
            startSteelNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false));
            startSteelRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true));
        }
 public ControlsChangerHelper(Keyboard keyboard, MenuScreen parent) : base(keyboard, parent)
 {
     onControlsCaptureStarted += ControlsChangerHelper_onControlsCaptureStarted;
     onControlsCaptureEnded   += ControlsChangerHelper_onControlsCaptureEnded;
 }
        public static void Load()
        {
            Texture2D grass = Globals.Content.Load <Texture2D>("grass");
            Texture2D pad   = Globals.Content.Load <Texture2D>("pad");
            Texture2D Water = Globals.Content.Load <Texture2D>("GFX\\Tiles\\Waterp");

            Texture2D PadV = Globals.Content.Load <Texture2D>("GFX\\Tiles\\testp");
            Texture2D PadH = Globals.Content.Load <Texture2D>("GFX\\Tiles\\testp2");

            Texture2D lily1 = Globals.Content.Load <Texture2D>("GFX\\Tiles\\testb");
            Texture2D lily2 = Globals.Content.Load <Texture2D>("GFX\\Tiles\\testb2");

            Texture2D enemyTexture = Globals.Content.Load <Texture2D>("GFX\\Mobs\\bug");

            Texture2D Bar        = Globals.Content.Load <Texture2D>("Bar");
            Texture2D Enter2Play = Globals.Content.Load <Texture2D>("Enter");
            Texture2D Trapmenu   = Globals.Content.Load <Texture2D>("GUI\\TrapMenu\\Menubar");

            Texture2D arrowNormal   = Globals.Content.Load <Texture2D>("GUI\\Toren");
            Texture2D arrowHover    = Globals.Content.Load <Texture2D>("GUI\\arrow_hover");
            Texture2D arrow_pressed = Globals.Content.Load <Texture2D>("GUI\\arrow_pressed");

            Texture2D gasTrap   = Globals.Content.Load <Texture2D>("GFX\\Traps\\Trap_Poinsion_gas");
            Texture2D fenceTrap = Globals.Content.Load <Texture2D>("GFX\\Traps\\fence");

            Texture2D PsnNormal  = Globals.Content.Load <Texture2D>("Traps\\spike tower");
            Texture2D PsnHover   = Globals.Content.Load <Texture2D>("Traps\\spike hover");
            Texture2D PsnPressed = Globals.Content.Load <Texture2D>("Traps\\spike tower");

            SpriteFont font = Globals.Content.Load <SpriteFont>("Fonts\\Arial");

            /*level.AddTexture(pad);//1
             * level.AddTexture(Water);//2
             *
             * level.AddTexture(lily1);//3
             * level.AddTexture(lily2);//4
             *
             * level.AddTexture(PadH);//5
             * level.AddTexture(PadV);//6*/

            Texture2D[] towertextures = new Texture2D[]
            {
                Globals.Content.Load <Texture2D>("GFX\\Traps\\fence"),
                Globals.Content.Load <Texture2D>("GFX\\Traps\\Trap_Poinsion_gas")
            };

            Texture2D[] bullettextures = new Texture2D[]
            {
                Globals.Content.Load <Texture2D>("Bulletsprite")
            };

            TileTextures = new Texture2D[]
            {
                Globals.Content.Load <Texture2D>("watertiles"),
                Globals.Content.Load <Texture2D>("grastiles")
            };



            waveManager   = new WaveManager(level, 5, enemyTexture, Trapmenu);
            player        = new Player(level, towertextures, bullettextures);
            toolbar       = new Toolbar(Bar, font, new Vector2(0, level.Heigth * 84));
            menuScreen    = new MenuScreen(Enter2Play, new Vector2(400, 300));
            arrowButton   = new Button(fenceTrap, fenceTrap, fenceTrap, new Vector2(84, 684), player, "Arrow Tower");
            PsnGasButton  = new Button(gasTrap, gasTrap, gasTrap, new Vector2(0, 684), player, "Poison Gas");
            waterTestTile = new Tile(TileTextures[0], new Vector2(200, 200));
        }
Esempio n. 32
0
 public void DismissShopMenu()
 {
     CurrentlyDisplayedMenu = MenuScreen.None;
 }
Esempio n. 33
0
        public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // There is no such thing as a free sandwhich... neither as a selected item
            // on Windows Phone, so we always force isSelected to false;
            #if WINDOWS_PHONE
            isSelected = false;
            #endif

            // When the menu selection changes, entries gradually fade between
            // their selected and deselected appearance, rather than instantly
            // popping to the new state.
            float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;

            if (isSelected) {
                _selectionFade = Math.Min(_selectionFade + fadeSpeed, 1);
            } else {
                _selectionFade = Math.Max(_selectionFade - fadeSpeed, 0);
            }
        }
        public static void EditUI()
        {
            // Reset settings
            RandomizerMod.Instance.Settings = new SaveSettings();

            // Fetch data from vanilla screen
            MenuScreen playScreen = Ref.UI.playModeMenuScreen;

            playScreen.title.gameObject.transform.localPosition = new Vector3(0, 520.56f);

            Object.Destroy(playScreen.topFleur.gameObject);

            MenuButton classic = (MenuButton)playScreen.defaultHighlight;
            MenuButton steel   = (MenuButton)classic.FindSelectableOnDown();
            MenuButton back    = (MenuButton)steel.FindSelectableOnDown();

            GameObject parent = steel.transform.parent.gameObject;

            Object.Destroy(parent.GetComponent <VerticalLayoutGroup>());

            // Create new buttons
            MenuButton startRandoBtn = classic.Clone("StartRando", MenuButton.MenuButtonType.Proceed,
                                                     new Vector2(0, 0), "Start Game", "Randomizer", RandomizerMod.GetSprite("UI.logo"));

            /*
             * MenuButton startNormalBtn = classic.Clone("StartNormal", MenuButton.MenuButtonType.Proceed,
             *  new Vector2(0, -200), "Start Game", "Non-Randomizer");
             * MenuButton startSteelRandoBtn = steel.Clone("StartSteelRando", MenuButton.MenuButtonType.Proceed,
             *  new Vector2(10000, 10000), "Steel Soul", "Randomizer", RandomizerMod.GetSprite("UI.logo2"));
             * MenuButton startSteelNormalBtn = steel.Clone("StartSteelNormal", MenuButton.MenuButtonType.Proceed,
             *  new Vector2(10000, 10000), "Steel Soul", "Non-Randomizer");
             *
             * startNormalBtn.transform.localScale =
             *  startSteelNormalBtn.transform.localScale =
             *      startSteelRandoBtn.transform.localScale = */
            startRandoBtn.transform.localScale = new Vector2(0.75f, 0.75f);
            startRandoBtn.GetComponent <StartGameEventTrigger>().bossRush = true;
            MenuButton backBtn = back.Clone("Back", MenuButton.MenuButtonType.Proceed, new Vector2(0, -100), "Back");


            //RandoMenuItem<string> gameTypeBtn = new RandoMenuItem<string>(back, new Vector2(0, 600), "Game Type", "Normal", "Steel Soul");

            RandoMenuItem <string> presetPoolsBtn    = new RandoMenuItem <string>(back, new Vector2(900, 1040), "Preset", "Progressive", "Completionist", "Junk Pit", "Custom");
            RandoMenuItem <bool>   RandoDreamersBtn  = new RandoMenuItem <bool>(back, new Vector2(700, 960), "Dreamers", true, false);
            RandoMenuItem <bool>   RandoSkillsBtn    = new RandoMenuItem <bool>(back, new Vector2(1100, 960), "Skills", true, false);
            RandoMenuItem <bool>   RandoCharmsBtn    = new RandoMenuItem <bool>(back, new Vector2(700, 880), "Charms", true, false);
            RandoMenuItem <bool>   RandoKeysBtn      = new RandoMenuItem <bool>(back, new Vector2(1100, 880), "Keys", true, false);
            RandoMenuItem <bool>   RandoGeoChestsBtn = new RandoMenuItem <bool>(back, new Vector2(900, 800), "Geo Chests", false, true);
            RandoMenuItem <bool>   RandoMaskBtn      = new RandoMenuItem <bool>(back, new Vector2(700, 720), "Mask Shards", false, true);
            RandoMenuItem <bool>   RandoVesselBtn    = new RandoMenuItem <bool>(back, new Vector2(1100, 720), "Vessel Fragments", false, true);
            RandoMenuItem <bool>   RandoOreBtn       = new RandoMenuItem <bool>(back, new Vector2(700, 640), "Pale Ore", false, true);
            RandoMenuItem <bool>   RandoNotchBtn     = new RandoMenuItem <bool>(back, new Vector2(1100, 640), "Charm Notches", false, true);
            RandoMenuItem <bool>   RandoEggBtn       = new RandoMenuItem <bool>(back, new Vector2(700, 560), "Rancid Eggs", false, true);
            RandoMenuItem <bool>   RandoRelicsBtn    = new RandoMenuItem <bool>(back, new Vector2(1100, 560), "Relics", false, true);
            RandoMenuItem <bool>   RandoMapBtn       = new RandoMenuItem <bool>(back, new Vector2(700, 480), "Maps", false, true);
            RandoMenuItem <bool>   RandoStagBtn      = new RandoMenuItem <bool>(back, new Vector2(1100, 480), "Stags", false, true);
            RandoMenuItem <bool>   RandoGrubBtn      = new RandoMenuItem <bool>(back, new Vector2(700, 400), "Grubs", false, true);
            RandoMenuItem <bool>   RandoRootsBtn     = new RandoMenuItem <bool>(back, new Vector2(1100, 400), "Whispering Roots", false, true);

            RandoMenuItem <bool>   RandoStartItemsBtn         = new RandoMenuItem <bool>(back, new Vector2(900, 160), "Randomize Start Items", false, true);
            RandoMenuItem <string> RandoStartLocationsModeBtn = new RandoMenuItem <string>(back, new Vector2(900, 80), "Start Location Setting", "Select", "Random");
            RandoMenuItem <string> StartLocationsListBtn      = new RandoMenuItem <string>(back, new Vector2(900, 0), "Start Location", LogicManager.StartLocations);

            RandoMenuItem <string> presetSkipsBtn   = new RandoMenuItem <string>(back, new Vector2(-900, 1040), "Preset", "Easy", "Medium", "Hard", "Custom");
            RandoMenuItem <bool>   mildSkipsBtn     = new RandoMenuItem <bool>(back, new Vector2(-900, 960), "Mild Skips", false, true);
            RandoMenuItem <bool>   shadeSkipsBtn    = new RandoMenuItem <bool>(back, new Vector2(-900, 880), "Shade Skips", false, true);
            RandoMenuItem <bool>   fireballSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 800), "Fireball Skips", false, true);
            RandoMenuItem <bool>   acidSkipsBtn     = new RandoMenuItem <bool>(back, new Vector2(-900, 720), "Acid Skips", false, true);
            RandoMenuItem <bool>   spikeTunnelsBtn  = new RandoMenuItem <bool>(back, new Vector2(-900, 640), "Spike Tunnels", false, true);
            RandoMenuItem <bool>   darkRoomsBtn     = new RandoMenuItem <bool>(back, new Vector2(-900, 560), "Dark Rooms", false, true);
            RandoMenuItem <bool>   spicySkipsBtn    = new RandoMenuItem <bool>(back, new Vector2(-900, 480), "Spicy Skips", false, true);

            RandoMenuItem <bool> charmNotchBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 300), "Salubra Notches", true, false);
            RandoMenuItem <bool> lemmBtn       = new RandoMenuItem <bool>(back, new Vector2(-900, 220), "Lemm Sell All", true, false);
            RandoMenuItem <bool> EarlyGeoBtn   = new RandoMenuItem <bool>(back, new Vector2(-900, 140), "Early Geo", true, false);
            RandoMenuItem <bool> jijiBtn       = new RandoMenuItem <bool>(back, new Vector2(-900, 60), "Jiji Hints", true, false);
            RandoMenuItem <bool> quirrelBtn    = new RandoMenuItem <bool>(back, new Vector2(-900, -20), "Quirrel Hints", true, false);
            RandoMenuItem <bool> leverBtn      = new RandoMenuItem <bool>(back, new Vector2(-900, -100), "1.2.2.1 Levers", true, false);

            RandoMenuItem <string> modeBtn         = new RandoMenuItem <string>(back, new Vector2(0, 1040), "Mode", "Item Randomizer", "Area Randomizer", "Connected-Area Room Randomizer", "Room Randomizer", "Open Mode");
            RandoMenuItem <string> cursedBtn       = new RandoMenuItem <string>(back, new Vector2(0, 960), "Cursed", "no", "noo", "noooo", "noooooooo", "noooooooooooooooo", "Oh yeah");
            RandoMenuItem <bool>   RandoSpoilerBtn = new RandoMenuItem <bool>(back, new Vector2(0, 0), "Create Spoiler Log", true, false);

            // Vanilla charms does not currently work
            RandoCharmsBtn.SetSelection(true);
            RandoCharmsBtn.Lock();

            // Create seed entry field
            GameObject seedGameObject = back.Clone("Seed", MenuButton.MenuButtonType.Activate, new Vector2(0, 1130),
                                                   "Click to type a custom seed").gameObject;

            Object.DestroyImmediate(seedGameObject.GetComponent <MenuButton>());
            Object.DestroyImmediate(seedGameObject.GetComponent <EventTrigger>());
            Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <AutoLocalizeTextUI>());
            Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <FixVerticalAlign>());
            Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <ContentSizeFitter>());

            RectTransform seedRect = seedGameObject.transform.Find("Text").GetComponent <RectTransform>();

            seedRect.anchorMin = seedRect.anchorMax = new Vector2(0.5f, 0.5f);
            seedRect.sizeDelta = new Vector2(337, 63.2f);

            InputField customSeedInput = seedGameObject.AddComponent <InputField>();

            customSeedInput.transform.localPosition = new Vector3(0, 1240);
            customSeedInput.textComponent           = seedGameObject.transform.Find("Text").GetComponent <Text>();

            RandomizerMod.Instance.Settings.Seed = new Random().Next(999999999);
            customSeedInput.text = RandomizerMod.Instance.Settings.Seed.ToString();

            customSeedInput.caretColor  = Color.white;
            customSeedInput.contentType = InputField.ContentType.IntegerNumber;
            customSeedInput.onEndEdit.AddListener(ParseSeedInput);
            customSeedInput.navigation     = Navigation.defaultNavigation;
            customSeedInput.caretWidth     = 8;
            customSeedInput.characterLimit = 9;

            customSeedInput.colors = new ColorBlock
            {
                highlightedColor = Color.yellow,
                pressedColor     = Color.red,
                disabledColor    = Color.black,
                normalColor      = Color.white,
                colorMultiplier  = 2f
            };

            // Create some labels
            CreateLabel(back, new Vector2(-900, 1130), "Required Skips");
            CreateLabel(back, new Vector2(-900, 380), "Quality of Life");
            CreateLabel(back, new Vector2(900, 1130), "Randomization");
            CreateLabel(back, new Vector2(900, 240), "Open Mode");
            CreateLabel(back, new Vector2(0, 200), "Area/Room Randomizer expect use of Benchwarp");
            CreateLabel(back, new Vector2(0, 1300), "Seed:");

            // We don't need these old buttons anymore
            Object.Destroy(classic.gameObject);
            Object.Destroy(steel.gameObject);
            Object.Destroy(parent.FindGameObjectInChildren("GGButton"));
            Object.Destroy(back.gameObject);

            // Gotta put something here, we destroyed the old default
            playScreen.defaultHighlight = startRandoBtn;

            // Apply navigation info (up, right, down, left)
            //startNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button);
            startRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button);
            //startSteelNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button);
            //startSteelRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, gameTypeBtn.Button, presetSkipsBtn.Button);
            modeBtn.Button.SetNavigation(backBtn, modeBtn.Button, startRandoBtn, modeBtn.Button);
            //gameTypeBtn.Button.SetNavigation(startRandoBtn, presetPoolsBtn.Button, startRandoBtn, presetSkipsBtn.Button);
            backBtn.SetNavigation(startRandoBtn, backBtn, modeBtn.Button, backBtn);
            RandoSpoilerBtn.Button.SetNavigation(RandoRelicsBtn.Button, RandoSpoilerBtn.Button, presetPoolsBtn.Button, startRandoBtn);

            presetSkipsBtn.Button.SetNavigation(leverBtn.Button, startRandoBtn, shadeSkipsBtn.Button, presetSkipsBtn.Button);
            mildSkipsBtn.Button.SetNavigation(presetSkipsBtn.Button, startRandoBtn, mildSkipsBtn.Button, mildSkipsBtn.Button);
            shadeSkipsBtn.Button.SetNavigation(mildSkipsBtn.Button, startRandoBtn, fireballSkipsBtn.Button, shadeSkipsBtn.Button);
            fireballSkipsBtn.Button.SetNavigation(shadeSkipsBtn.Button, startRandoBtn, acidSkipsBtn.Button, fireballSkipsBtn.Button);
            acidSkipsBtn.Button.SetNavigation(fireballSkipsBtn.Button, startRandoBtn, spikeTunnelsBtn.Button, acidSkipsBtn.Button);
            spikeTunnelsBtn.Button.SetNavigation(acidSkipsBtn.Button, startRandoBtn, darkRoomsBtn.Button, spikeTunnelsBtn.Button);
            darkRoomsBtn.Button.SetNavigation(spikeTunnelsBtn.Button, startRandoBtn, spicySkipsBtn.Button, darkRoomsBtn.Button);
            spicySkipsBtn.Button.SetNavigation(darkRoomsBtn.Button, startRandoBtn, charmNotchBtn.Button, spicySkipsBtn.Button);

            charmNotchBtn.Button.SetNavigation(spicySkipsBtn.Button, startRandoBtn, lemmBtn.Button, charmNotchBtn.Button);
            lemmBtn.Button.SetNavigation(charmNotchBtn.Button, startRandoBtn, EarlyGeoBtn.Button, lemmBtn.Button);
            EarlyGeoBtn.Button.SetNavigation(lemmBtn.Button, startRandoBtn, jijiBtn.Button, EarlyGeoBtn.Button);
            jijiBtn.Button.SetNavigation(EarlyGeoBtn.Button, startRandoBtn, quirrelBtn.Button, jijiBtn.Button);
            quirrelBtn.Button.SetNavigation(jijiBtn.Button, startRandoBtn, leverBtn.Button, quirrelBtn.Button);
            leverBtn.Button.SetNavigation(quirrelBtn.Button, startRandoBtn, presetSkipsBtn.Button, leverBtn.Button);

            presetPoolsBtn.Button.SetNavigation(RandoSpoilerBtn.Button, presetPoolsBtn.Button, RandoDreamersBtn.Button, startRandoBtn);
            RandoDreamersBtn.Button.SetNavigation(presetPoolsBtn.Button, RandoDreamersBtn.Button, RandoSkillsBtn.Button, startRandoBtn);
            RandoSkillsBtn.Button.SetNavigation(RandoDreamersBtn.Button, RandoSkillsBtn.Button, RandoCharmsBtn.Button, startRandoBtn);
            RandoCharmsBtn.Button.SetNavigation(RandoSkillsBtn.Button, RandoCharmsBtn.Button, RandoKeysBtn.Button, startRandoBtn);
            RandoKeysBtn.Button.SetNavigation(RandoCharmsBtn.Button, RandoKeysBtn.Button, RandoGeoChestsBtn.Button, startRandoBtn);
            RandoGeoChestsBtn.Button.SetNavigation(RandoKeysBtn.Button, RandoGeoChestsBtn.Button, RandoMaskBtn.Button, startRandoBtn);
            RandoMaskBtn.Button.SetNavigation(RandoGeoChestsBtn.Button, RandoMaskBtn.Button, RandoVesselBtn.Button, startRandoBtn);
            RandoVesselBtn.Button.SetNavigation(RandoMaskBtn.Button, RandoVesselBtn.Button, RandoOreBtn.Button, startRandoBtn);
            RandoOreBtn.Button.SetNavigation(RandoVesselBtn.Button, RandoOreBtn.Button, RandoNotchBtn.Button, startRandoBtn);
            RandoNotchBtn.Button.SetNavigation(RandoOreBtn.Button, RandoNotchBtn.Button, RandoEggBtn.Button, startRandoBtn);
            RandoEggBtn.Button.SetNavigation(RandoNotchBtn.Button, RandoEggBtn.Button, RandoRelicsBtn.Button, startRandoBtn);
            RandoRelicsBtn.Button.SetNavigation(RandoEggBtn.Button, RandoRelicsBtn.Button, RandoSpoilerBtn.Button, startRandoBtn);

            RandoStartItemsBtn.Button.SetNavigation(RandoRelicsBtn.Button, RandoStartLocationsModeBtn.Button, RandoStartItemsBtn.Button, startRandoBtn);
            RandoStartLocationsModeBtn.Button.SetNavigation(RandoStartItemsBtn.Button, RandoStartLocationsModeBtn.Button, StartLocationsListBtn.Button, startRandoBtn);
            StartLocationsListBtn.Button.SetNavigation(RandoStartLocationsModeBtn.Button, RandoStartLocationsModeBtn.Button, StartLocationsListBtn.Button, startRandoBtn);

            // Setup event for changing difficulty settings buttons
            void ModeSettingChanged(RandoMenuItem <string> item)
            {
                //"Item Randomizer", "Area Randomizer", "Connected-Area Room Randomizer", "Room Randomizer"
                if (item.CurrentSelection == "Item Randomizer")
                {
                    RandoDreamersBtn.Unlock();
                    RandoSkillsBtn.Unlock();
                    //RandoCharmsBtn.Unlock();
                    RandoKeysBtn.Unlock();
                }
                else
                {
                    RandoDreamersBtn.SetSelection(true);
                    RandoSkillsBtn.SetSelection(true);
                    RandoCharmsBtn.SetSelection(true);
                    RandoKeysBtn.SetSelection(true);
                    RandoDreamersBtn.Lock();
                    RandoSkillsBtn.Lock();
                    RandoCharmsBtn.Lock();
                    RandoKeysBtn.Lock();
                }
                if (item.CurrentSelection == "Open Mode")
                {
                    startRandoBtn.GetComponent <StartGameEventTrigger>().bossRush = true;
                }
                else
                {
                    //   startRandoBtn.GetComponent<StartGameEventTrigger>().bossRush = false;
                }
            }

            void UpdateSkipsButtons(RandoMenuItem <string> item)
            {
                switch (item.CurrentSelection)
                {
                case "Easy":
                    SetShadeSkips(false);
                    mildSkipsBtn.SetSelection(false);
                    acidSkipsBtn.SetSelection(false);
                    spikeTunnelsBtn.SetSelection(false);
                    spicySkipsBtn.SetSelection(false);
                    fireballSkipsBtn.SetSelection(false);
                    darkRoomsBtn.SetSelection(false);
                    break;

                case "Medium":
                    SetShadeSkips(true);
                    mildSkipsBtn.SetSelection(true);
                    acidSkipsBtn.SetSelection(false);
                    spikeTunnelsBtn.SetSelection(false);
                    spicySkipsBtn.SetSelection(false);
                    fireballSkipsBtn.SetSelection(false);
                    darkRoomsBtn.SetSelection(false);
                    break;

                case "Hard":
                    SetShadeSkips(true);
                    mildSkipsBtn.SetSelection(true);
                    acidSkipsBtn.SetSelection(true);
                    spikeTunnelsBtn.SetSelection(true);
                    spicySkipsBtn.SetSelection(true);
                    fireballSkipsBtn.SetSelection(true);
                    darkRoomsBtn.SetSelection(true);
                    break;

                case "Custom":
                    item.SetSelection("Easy");
                    goto case "Easy";

                default:
                    LogWarn("Unknown value in preset button: " + item.CurrentSelection);
                    break;
                }
            }

            void UpdatePoolPreset(RandoMenuItem <string> item)
            {
                switch (item.CurrentSelection)
                {
                case "Progressive":
                    RandoDreamersBtn.SetSelection(true);
                    RandoSkillsBtn.SetSelection(true);
                    RandoCharmsBtn.SetSelection(true);
                    RandoKeysBtn.SetSelection(true);
                    RandoGeoChestsBtn.SetSelection(false);
                    RandoMaskBtn.SetSelection(false);
                    RandoVesselBtn.SetSelection(false);
                    RandoOreBtn.SetSelection(false);
                    RandoNotchBtn.SetSelection(false);
                    RandoEggBtn.SetSelection(false);
                    RandoRelicsBtn.SetSelection(false);
                    break;

                case "Completionist":
                    RandoDreamersBtn.SetSelection(true);
                    RandoSkillsBtn.SetSelection(true);
                    RandoCharmsBtn.SetSelection(true);
                    RandoKeysBtn.SetSelection(true);
                    RandoGeoChestsBtn.SetSelection(true);
                    RandoMaskBtn.SetSelection(true);
                    RandoVesselBtn.SetSelection(true);
                    RandoOreBtn.SetSelection(true);
                    RandoNotchBtn.SetSelection(true);
                    RandoEggBtn.SetSelection(false);
                    RandoRelicsBtn.SetSelection(false);
                    break;

                case "Junk Pit":
                    RandoDreamersBtn.SetSelection(true);
                    RandoSkillsBtn.SetSelection(true);
                    RandoCharmsBtn.SetSelection(true);
                    RandoKeysBtn.SetSelection(true);
                    RandoGeoChestsBtn.SetSelection(true);
                    RandoMaskBtn.SetSelection(true);
                    RandoVesselBtn.SetSelection(true);
                    RandoOreBtn.SetSelection(true);
                    RandoNotchBtn.SetSelection(true);
                    RandoEggBtn.SetSelection(true);
                    RandoRelicsBtn.SetSelection(true);
                    break;

                case "Custom":
                    item.SetSelection("Progressive");
                    goto case "Progressive";
                }
            }

            void UpdateStartLocationColor()
            {
                // cf. TestStartLocation in PreRandomizer. Note that color is checked in StartGame to determine if a selected start was valid
                if (LogicManager.GetStartLocation(StartLocationsListBtn.CurrentSelection) is StartDef startDef)
                {
                    if (RandoStartItemsBtn.CurrentSelection)
                    {
                        StartLocationsListBtn.SetColor(Color.white);
                    }
                    else if (modeBtn.CurrentSelection.EndsWith("Room Randomizer"))
                    {
                        if (startDef.roomSafe)
                        {
                            StartLocationsListBtn.SetColor(Color.white);
                        }
                        else
                        {
                            StartLocationsListBtn.SetColor(Color.red);
                        }
                    }
                    else if (modeBtn.CurrentSelection == "Area Randomizer")
                    {
                        if (startDef.areaSafe)
                        {
                            StartLocationsListBtn.SetColor(Color.white);
                        }
                        else
                        {
                            StartLocationsListBtn.SetColor(Color.red);
                        }
                    }
                    else if (startDef.itemSafe)
                    {
                        StartLocationsListBtn.SetColor(Color.white);
                    }
                    else
                    {
                        StartLocationsListBtn.SetColor(Color.red);
                    }
                }
            }

            void SetShadeSkips(bool enabled)
            {
                if (enabled)
                {
                    //gameTypeBtn.SetSelection("Normal");
                    //SwitchGameType(false);
                }

                shadeSkipsBtn.SetSelection(enabled);
            }

            void SkipsSettingChanged(RandoMenuItem <bool> item)
            {
                presetSkipsBtn.SetSelection("Custom");
            }

            void PoolSettingChanged(RandoMenuItem <bool> item)
            {
                presetPoolsBtn.SetSelection("Custom");
            }

            modeBtn.Changed += ModeSettingChanged;

            presetSkipsBtn.Changed += UpdateSkipsButtons;
            presetPoolsBtn.Changed += UpdatePoolPreset;

            mildSkipsBtn.Changed     += SkipsSettingChanged;
            shadeSkipsBtn.Changed    += SkipsSettingChanged;
            shadeSkipsBtn.Changed    += SaveShadeVal;
            acidSkipsBtn.Changed     += SkipsSettingChanged;
            spikeTunnelsBtn.Changed  += SkipsSettingChanged;
            spicySkipsBtn.Changed    += SkipsSettingChanged;
            fireballSkipsBtn.Changed += SkipsSettingChanged;
            darkRoomsBtn.Changed     += SkipsSettingChanged;

            RandoDreamersBtn.Changed  += PoolSettingChanged;
            RandoSkillsBtn.Changed    += PoolSettingChanged;
            RandoCharmsBtn.Changed    += PoolSettingChanged;
            RandoKeysBtn.Changed      += PoolSettingChanged;
            RandoGeoChestsBtn.Changed += PoolSettingChanged;
            RandoMaskBtn.Changed      += PoolSettingChanged;
            RandoVesselBtn.Changed    += PoolSettingChanged;
            RandoOreBtn.Changed       += PoolSettingChanged;
            RandoNotchBtn.Changed     += PoolSettingChanged;
            RandoEggBtn.Changed       += PoolSettingChanged;
            RandoRelicsBtn.Changed    += PoolSettingChanged;

            RandoStartItemsBtn.Changed         += (RandoMenuItem <bool> Item) => UpdateStartLocationColor();
            RandoStartLocationsModeBtn.Changed += (RandoMenuItem <string> Item) => UpdateStartLocationColor();
            StartLocationsListBtn.Changed      += (RandoMenuItem <string> Item) => UpdateStartLocationColor();
            modeBtn.Changed += (RandoMenuItem <string> Item) => UpdateStartLocationColor();

            // Setup game type button changes
            void SaveShadeVal(RandoMenuItem <bool> item)
            {
                SetShadeSkips(shadeSkipsBtn.CurrentSelection);
            }

            /*void SwitchGameType(bool steelMode)
             * {
             *  if (!steelMode)
             *  {
             *      // Normal mode
             *      startRandoBtn.transform.localPosition = new Vector2(0, 200);
             *      startNormalBtn.transform.localPosition = new Vector2(0, -200);
             *      startSteelRandoBtn.transform.localPosition = new Vector2(10000, 10000);
             *      startSteelNormalBtn.transform.localPosition = new Vector2(10000, 10000);
             *
             *      //backBtn.SetNavigation(startNormalBtn, startNormalBtn, modeBtn.Button, startRandoBtn);
             *     //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startNormalBtn, lemmBtn.Button);
             *      //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startRandoBtn, allSkillsBtn.Button);
             *  }
             *  else
             *  {
             *      // Steel Soul mode
             *      startRandoBtn.transform.localPosition = new Vector2(10000, 10000);
             *      startNormalBtn.transform.localPosition = new Vector2(10000, 10000);
             *      startSteelRandoBtn.transform.localPosition = new Vector2(0, 200);
             *      startSteelNormalBtn.transform.localPosition = new Vector2(0, -200);
             *
             *      SetShadeSkips(false);
             *
             *      //backBtn.SetNavigation(startSteelNormalBtn, startSteelNormalBtn, modeBtn.Button, startSteelRandoBtn);
             *      //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startSteelNormalBtn, lemmBtn.Button);
             *      //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startSteelRandoBtn, allSkillsBtn.Button);
             *  }
             * }
             *
             * gameTypeBtn.Button.AddEvent(EventTriggerType.Submit,
             *  garbage => SwitchGameType(gameTypeBtn.CurrentSelection != "Normal"));
             */

            // Setup start game button events
            void StartGame(bool rando)
            {
                RandomizerMod.Instance.Settings.CharmNotch = charmNotchBtn.CurrentSelection;
                RandomizerMod.Instance.Settings.Lemm       = lemmBtn.CurrentSelection;
                RandomizerMod.Instance.Settings.EarlyGeo   = EarlyGeoBtn.CurrentSelection;


                if (rando)
                {
                    RandomizerMod.Instance.Settings.Jiji       = jijiBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.Quirrel    = quirrelBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.LeverSkips = leverBtn.CurrentSelection;

                    RandomizerMod.Instance.Settings.RandomizeDreamers        = RandoDreamersBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeSkills          = RandoSkillsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeCharms          = RandoCharmsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeKeys            = RandoKeysBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeGeoChests       = RandoGeoChestsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeMaskShards      = RandoMaskBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeVesselFragments = RandoVesselBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizePaleOre         = RandoOreBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeCharmNotches    = RandoNotchBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeRancidEggs      = RandoEggBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeRelics          = RandoRelicsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeMaps            = RandoMapBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeStags           = RandoStagBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeGrubs           = RandoGrubBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeWhisperingRoots = RandoRootsBtn.CurrentSelection;


                    RandomizerMod.Instance.Settings.CreateSpoilerLog = RandoSpoilerBtn.CurrentSelection;

                    RandomizerMod.Instance.Settings.Cursed = cursedBtn.CurrentSelection.StartsWith("O");

                    RandomizerMod.Instance.Settings.Randomizer     = rando;
                    RandomizerMod.Instance.Settings.RandomizeAreas = modeBtn.CurrentSelection == "Area Randomizer";
                    RandomizerMod.Instance.Settings.RandomizeRooms = modeBtn.CurrentSelection.EndsWith("Room Randomizer");
                    RandomizerMod.Instance.Settings.ConnectAreas   = modeBtn.CurrentSelection.StartsWith("Connected-Area");

                    RandomizerMod.Instance.Settings.MildSkips     = mildSkipsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.ShadeSkips    = shadeSkipsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.FireballSkips = fireballSkipsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.AcidSkips     = acidSkipsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.SpikeTunnels  = spikeTunnelsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.DarkRooms     = darkRoomsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.SpicySkips    = spicySkipsBtn.CurrentSelection;

                    RandomizerMod.Instance.Settings.RandomizeStartItems    = RandoStartItemsBtn.CurrentSelection;
                    RandomizerMod.Instance.Settings.RandomizeStartLocation = RandoStartLocationsModeBtn.CurrentSelection == "Random";
                    RandomizerMod.Instance.Settings.StartName = StartLocationsListBtn.GetColor() == Color.red ? "King's Pass" : StartLocationsListBtn.CurrentSelection;
                }

                RandomizerMod.Instance.StartNewGame();
            }

            //startNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false));
            startRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true));
            //startSteelNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false));
            //startSteelRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true));
        }
Esempio n. 35
0
 public void ChangeMenu(MenuScreen screen)
 {
     StartCoroutine(ChangeScreen(screen, false));
 }
 public MainMenuEntry(MenuScreen menu, string title)
     : base(menu, title)
 {
 }
Esempio n. 37
0
 public override void OnJoinedLobby()
 {
     MenuScreen.SetActive(true);
     LoadScreen.SetActive(false);
 }
Esempio n. 38
0
 public void BackToMenu()
 {
     MenuScreen.SetActive(true);
     CreateNewRoomScreen.SetActive(false);
 }
Esempio n. 39
0
 public override void KeyPressHandle(Key k)
 {
     switch (_state)
     {
         case State.BeforeGain:
             GiveExperience();
             _state = State.AfterGain;
             break;
         case State.AfterGain:
             _screen = MenuScreen.HoardScreen;
             MenuScreen.HoardScreen.ChangeControl(HoardItemLeft.Instance);
             _state = State.BeforeGive;
             break;
         case State.BeforeGive:
             GiveGil();
             _state = State.AfterGive;
             break;
         case State.AfterGive:
             _screen.Control.ControlHandle(k);
             break;
     }
 }
        private void SceneLoaded(Scene scene, LoadSceneMode lsm)
        {
            if
            (
                _uim != null ||
                ModLoader.LoadedMods == null ||
                UIManager.instance == null ||
                scene.name != Constants.MENU_SCENE
            )
            {
                return;
            }

            _uim = UIManager.instance;

            var defButton = (MenuButton)_uim.optionsMenuScreen.defaultHighlight;

            var modButton = UObject.Instantiate(defButton.gameObject).GetComponent <MenuButton>();

            modButton.name = "Mods";

            _uim.optionsMenuScreen.GetComponent <Patches.MenuButtonList>().AddSelectable(modButton, 5);

            Selectable sel = FindSelectable(defButton, 4, FindSelectableOnDown);

            modButton.transform.parent        = sel.transform.parent;
            modButton.transform.localPosition = new Vector2(0, -120);
            modButton.transform.localScale    = sel.transform.localScale;

            UObject.Destroy(modButton.gameObject.GetComponent <AutoLocalizeTextUI>());

            modButton.GetComponentInChildren <Text>().text = "Mods";

            GameObject go = UObject.Instantiate(_uim.optionsMenuScreen.gameObject);

            ModMenuScreen          = go.GetComponent <MenuScreen>();
            ModMenuScreen.title    = ModMenuScreen.transform.Find("Title").GetComponent <CanvasGroup>();
            ModMenuScreen.topFleur = ModMenuScreen.transform.Find("TopFleur").GetComponent <Animator>();
            ModMenuScreen.content  = ModMenuScreen.transform.Find("Content").GetComponent <CanvasGroup>();

            Patches.MenuButtonList modButtons = go.GetComponent <Patches.MenuButtonList>();
            modButtons.ClearSelectables();

            ModMenuScreen.title.gameObject.GetComponent <Text>().text = "Mods";

            UObject.Destroy(ModMenuScreen.title.gameObject.GetComponent <AutoLocalizeTextUI>());

            ModMenuScreen.transform.parent        = _uim.optionsMenuScreen.transform.parent;
            ModMenuScreen.transform.localPosition = _uim.optionsMenuScreen.transform.localPosition;
            ModMenuScreen.transform.localScale    = _uim.optionsMenuScreen.transform.localScale;

            List <ITogglableMod> managableMods = ModLoader.LoadedMods.OfType <ITogglableMod>().ToList();

            ModMenuScreen.defaultHighlight = ModMenuScreen.content.gameObject.transform.GetChild(0)
                                             .GetChild(0)
                                             .GetComponent <MenuButton>();

            for (int i = 4; i >= 1; i--)
            {
                DestroyParent
                (
                    FindSelectable(ModMenuScreen.defaultHighlight, i, FindSelectableOnDown)
                );
            }

            _back = ModMenuScreen.defaultHighlight.FindSelectableOnUp();

            GameObject item = _uim.videoMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject;

            UObject.DestroyImmediate(item.GetComponent <MenuOptionHorizontal>());
            UObject.DestroyImmediate(item.GetComponent <MenuSetting>());
            UObject.DestroyImmediate(ModMenuScreen.content.GetComponent <VerticalLayoutGroup>());
            DestroyParent(ModMenuScreen.defaultHighlight);

            try
            {
                SetupMods(managableMods, item);
            }
            catch (Exception ex)
            {
                LogError(ex);
            }

            _back.navigation = new Navigation
            {
                mode = Navigation.Mode.Explicit
            };

            modButtons.AddSelectable(_back);
            modButtons.RecalculateNavigation();

            ((MenuSelectable)_back).cancelAction = CancelAction.QuitModMenu;

            void Quit(BaseEventData data) => _fauxUim.UIquitModMenu();
            void Load(BaseEventData data) => _fauxUim.UIloadModMenu();

            EventTrigger[] ets =
            {
                _back.GetComponent <EventTrigger>(),
                modButton.GetComponent <EventTrigger>()
            };

            for (int i = 0; i < ets.Length; i++)
            {
                EventTrigger et = ets[i];
                et.triggers = new List <EventTrigger.Entry>();

                foreach (EventTriggerType type in new EventTriggerType[] { EventTriggerType.Submit, EventTriggerType.PointerClick })
                {
                    var trigger = new EventTrigger.Entry {
                        eventID = type
                    };
                    trigger.callback.AddListener
                    (
                        i == 0
                            ? (UnityAction <BaseEventData>)Quit
                            : Load
                    );
                    et.triggers.Add(trigger);
                }
            }
        }
Esempio n. 41
0
 protected override void InternalInit()
 {
     _screen = MenuScreen.VictoryScreen;
 }
Esempio n. 42
0
 private void Awake()
 {
     Instance = this;
 }
Esempio n. 43
0
        protected override void UnloadContent()
        {
            base.UnloadContent();

            MenuScreen.UnloadSharedContent();
        }
Esempio n. 44
0
        void sceneLoaded(Scene scene, LoadSceneMode lsm)
        {
            if (uim == null)
            {
                uim = UIManager.instance;

                //ADD MODS TO OPTIONS MENU
                MenuButton defButton = (MenuButton)uim.optionsMenuScreen.defaultHighlight;
                MenuButton modButton = GameObject.Instantiate(defButton.gameObject).GetComponent <MenuButton>();

                Navigation nav = modButton.navigation;
                nav.selectOnUp       = defButton.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown();
                nav.selectOnDown     = defButton.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown();
                modButton.navigation = nav;

                nav = modButton.FindSelectableOnUp().navigation;
                nav.selectOnDown = modButton;
                modButton.FindSelectableOnUp().navigation = nav;

                nav            = modButton.FindSelectableOnDown().navigation;
                nav.selectOnUp = modButton;
                modButton.FindSelectableOnDown().navigation = nav;

                modButton.name = "Mods";

                modButton.transform.SetParent(modButton.FindSelectableOnUp().transform.parent);

                modButton.transform.localPosition = new Vector2(0, -120);
                modButton.transform.localScale    = modButton.FindSelectableOnUp().transform.localScale;

                GameObject.Destroy(modButton.gameObject.GetComponent <AutoLocalizeTextUI>());
                modButton.gameObject.transform.FindChild("Text").GetComponent <Text>().text = "Mods";
                //ADD MODS TO OPTIONS MENU

                //SETUP MOD MENU
                GameObject go = GameObject.Instantiate(uim.optionsMenuScreen.gameObject);
                modMenuScreen          = go.GetComponent <MenuScreen>();
                modMenuScreen.title    = modMenuScreen.gameObject.transform.FindChild("Title").GetComponent <CanvasGroup>();
                modMenuScreen.topFleur = modMenuScreen.gameObject.transform.FindChild("TopFleur").GetComponent <Animator>();
                modMenuScreen.content  = modMenuScreen.gameObject.transform.FindChild("Content").GetComponent <CanvasGroup>();

                modMenuScreen.title.gameObject.GetComponent <Text>().text = "Mods";
                GameObject.Destroy(modMenuScreen.title.gameObject.GetComponent <AutoLocalizeTextUI>());

                modMenuScreen.transform.SetParent(uim.optionsMenuScreen.gameObject.transform.parent);
                modMenuScreen.transform.localPosition = uim.optionsMenuScreen.gameObject.transform.localPosition;
                modMenuScreen.transform.localScale    = uim.optionsMenuScreen.gameObject.transform.localScale;

                List <string> mods = ModHooks.Instance.LoadedMods;
                //modMenuScreen.content = modMenuScreen.gameObject.transform.GetChild()
                modMenuScreen.defaultHighlight = modMenuScreen.content.gameObject.transform.GetChild(0).GetChild(0).GetComponent <MenuButton>();
                GameObject.Destroy(modMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
                GameObject.Destroy(modMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
                GameObject.Destroy(modMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
                GameObject.Destroy(modMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
                GameObject.Destroy(modMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject.transform.parent.gameObject);

                back = modMenuScreen.defaultHighlight.FindSelectableOnUp();
                GameObject item = uim.videoMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject;
                GameObject.DestroyImmediate(item.GetComponent <MenuOptionHorizontal>());
                GameObject.DestroyImmediate(item.GetComponent <MenuSetting>());
                GameObject.DestroyImmediate(modMenuScreen.content.GetComponent <VerticalLayoutGroup>());
                GameObject.Destroy(modMenuScreen.defaultHighlight.gameObject.transform.parent.gameObject);

                modArray = new Selectable[mods.Count];

                for (int i = 0; i < mods.Count; i++)
                {
                    GameObject menuItem = GameObject.Instantiate(item.gameObject);
                    modArray[i]            = menuItem.AddComponent <FauxMenuOptionHorizontal>();
                    modArray[i].navigation = Navigation.defaultNavigation;
                    //dataDump(modArray[i].gameObject, 1);

                    ((FauxMenuOptionHorizontal)modArray[i]).optionList          = new string[] { "On", "Off" };
                    ((FauxMenuOptionHorizontal)modArray[i]).optionText          = modArray[i].gameObject.transform.GetChild(1).GetComponent <Text>();
                    ((FauxMenuOptionHorizontal)modArray[i]).selectedOptionIndex = 0;
                    ((FauxMenuOptionHorizontal)modArray[i]).localizeText        = false;
                    ((FauxMenuOptionHorizontal)modArray[i]).sheetTitle          = mods[i];
                    ((FauxMenuOptionHorizontal)modArray[i]).modName             = mods[i];

                    GameObject.DestroyImmediate(modArray[i].transform.FindChild("Label").GetComponent <AutoLocalizeTextUI>());
                    modArray[i].transform.FindChild("Label").GetComponent <Text>().text = mods[i];

                    ((FauxMenuOptionHorizontal)modArray[i]).leftCursor  = modArray[i].transform.FindChild("CursorLeft").GetComponent <Animator>();
                    ((FauxMenuOptionHorizontal)modArray[i]).rightCursor = modArray[i].transform.FindChild("CursorRight").GetComponent <Animator>();

                    modArray[i].gameObject.name = mods[i];

                    RectTransform rt = menuItem.GetComponent <RectTransform>();

                    rt.SetParent(modMenuScreen.content.transform);
                    rt.localScale = new Vector3(2, 2, 2);

                    rt.sizeDelta        = new Vector2(960, 120);
                    rt.anchoredPosition = new Vector2(0, (766 / 2) - 90 - (150 * i));
                    rt.anchorMin        = new Vector2(0.5f, 1.0f);
                    rt.anchorMax        = new Vector2(0.5f, 1.0f);

                    //Image img = menuItem.AddComponent<Image>();
                    //img.sprite = nullSprite();


                    ((FauxMenuOptionHorizontal)modArray[i]).cancelAction = CancelAction.DoNothing;


                    //AutoLocalizeTextUI localizeUI = modArray[i].GetComponent<AutoLocalizeTextUI>();
                    //modArray[i].transform.GetChild(0).GetComponent<Text>().text = mods[i];
                    //GameObject.Destroy(localizeUI);
                }

                Navigation[] navs = new Navigation[modArray.Length];
                for (int i = 0; i < ModLoader.modArray.Length; i++)
                {
                    navs[i]      = new Navigation();
                    navs[i].mode = Navigation.Mode.Explicit;

                    if (i == 0)
                    {
                        navs[i].selectOnUp = ModLoader.back;
                    }
                    else
                    {
                        navs[i].selectOnUp = ModLoader.modArray[i - 1];
                    }
                    if (i == ModLoader.modArray.Length - 1)
                    {
                        navs[i].selectOnDown = ModLoader.back;
                    }
                    else
                    {
                        navs[i].selectOnDown = ModLoader.modArray[i + 1];
                    }

                    ModLoader.modArray[i].navigation = navs[i];
                }
                ModLoader.modMenuScreen.defaultHighlight = ModLoader.modArray[0];
                Navigation nav2 = ModLoader.back.navigation;
                nav2.selectOnUp           = ModLoader.modArray[ModLoader.modArray.Length - 1];
                nav2.selectOnDown         = ModLoader.modArray[0];
                ModLoader.back.navigation = nav2;

                ((MenuButton)back).cancelAction = CancelAction.DoNothing;
                EventTrigger back_events = back.gameObject.GetComponent <EventTrigger>();

                back_events.triggers = new List <EventTrigger.Entry>();

                EventTrigger.Entry back_submit = new EventTrigger.Entry();
                back_submit.eventID = EventTriggerType.Submit;
                back_submit.callback.AddListener((data) => { fauxUIM.UIquitModMenu(); });
                back_events.triggers.Add(back_submit);

                EventTrigger.Entry back_click = new EventTrigger.Entry();
                back_click.eventID = EventTriggerType.PointerClick;
                back_click.callback.AddListener((data) => { fauxUIM.UIquitModMenu(); });
                back_events.triggers.Add(back_click);


                //SETUP MOD MENU

                //SETUP MOD BUTTON TO RESPOND TO SUBMIT AND CANCEL EVENTS CORRECTLY
                EventTrigger events = modButton.gameObject.GetComponent <EventTrigger>();

                events.triggers = new List <EventTrigger.Entry>();

                EventTrigger.Entry submit = new EventTrigger.Entry();
                submit.eventID = EventTriggerType.Submit;
                submit.callback.AddListener((data) => { fauxUIM.UIloadModMenu(); });
                events.triggers.Add(submit);

                EventTrigger.Entry click = new EventTrigger.Entry();
                click.eventID = EventTriggerType.PointerClick;
                click.callback.AddListener((data) => { fauxUIM.UIloadModMenu(); });
                events.triggers.Add(click);

                //SETUP MOD BUTTON TO RESPOND TO SUBMIT AND CANCEL EVENTS CORRECTLY
            }
        }
        /// <summary>
        /// Create a menu screen in the default style.
        /// </summary>
        /// <param name="title">The title to give the menu screen.</param>
        /// <param name="menuData">The data for the horizontal options.</param>
        /// <param name="returnScreen">The screen to return to when the user hits back.</param>
        /// <returns>A built menu screen in the default style.</returns>
        public static MenuScreen CreateMenuScreen(string title, List <IMenuMod.MenuEntry> menuData, MenuScreen returnScreen)
        {
            MenuBuilder builder = CreateMenuBuilderWithBackButton(title, returnScreen, out MenuButton backButton);

            if (menuData.Count > 5)
            {
                builder.AddContent(new NullContentLayout(), c => c.AddScrollPaneContent(
                                       new ScrollbarConfig
                {
                    CancelAction = _ => ((Patch.UIManager)UIManager.instance).UIGoToDynamicMenu(returnScreen),
                    Navigation   = new Navigation
                    {
                        mode         = Navigation.Mode.Explicit,
                        selectOnUp   = backButton,
                        selectOnDown = backButton
                    },
                    Position = new AnchoredPosition
                    {
                        ChildAnchor  = new Vector2(0f, 1f),
                        ParentAnchor = new Vector2(1f, 1f),
                        Offset       = new Vector2(-310f, 0f)
                    }
                },
                                       new RelLength(menuData.Count * 105f),
                                       RegularGridLayout.CreateVerticalLayout(105f),
                                       c => AddModMenuContent(menuData, c, returnScreen)
                                       ));
            }
            else
            {
                builder.AddContent(
                    RegularGridLayout.CreateVerticalLayout(105f),
                    c => AddModMenuContent(menuData, c, returnScreen)
                    );
            }

            return(builder.Build());
        }
Esempio n. 46
0
        /// <summary>
        /// Updates the menu entry.
        /// </summary>
        public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // When the menu selection changes, entries gradually fade between
            // their selected and deselected appearance, rather than instantly
            // popping to the new state.
            float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;

            if (isSelected)
                selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
            else
                selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
        }
Esempio n. 47
0
 static void Main()
 {
     using (var game = new MenuScreen())
         game.Run();
 }
Esempio n. 48
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentWrapper.Initialize(this);

            _spriteBatch  = new SpriteBatch(GraphicsDevice);
            _lineBatch    = new LineBatch(GraphicsDevice);
            _quadRenderer = new QuadRenderer(GraphicsDevice);

            _input.LoadContent(GraphicsDevice.Viewport);
#if WINDOWS
            _counter.LoadContent();
#endif

            // Create rendertarget for transitions
            PresentationParameters pp = GraphicsDevice.PresentationParameters;
            _transitions.Add(new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents));

            _menuScreen = new MenuScreen();

            List <Type> DemosToLoad      = new List <Type>();
            Assembly    samplesFramework = Assembly.GetExecutingAssembly();
            foreach (Type sampleType in samplesFramework.GetTypes())
            {
                if (sampleType.IsSubclassOf(typeof(PhysicsDemoScreen)))
                {
                    DemosToLoad.Add(sampleType);
                }
            }
            DemosToLoad.Add(DemosToLoad[0]); // HACK: Load the first sample two times, since some delayed creation stuff with the rendertargets always breaks the first preview picture.
            bool firstPreview = true;
            foreach (Type sampleType in DemosToLoad)
            {
                PhysicsDemoScreen demoScreen = samplesFramework.CreateInstance(sampleType.ToString()) as PhysicsDemoScreen;
#if WINDOWS
                if (!firstPreview)
                {
                    Console.WriteLine("Loading demo: " + demoScreen.GetTitle());
                }
#endif
                RenderTarget2D preview = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth / 2, pp.BackBufferHeight / 2, false, SurfaceFormat.Color, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);

                demoScreen.Framework = this;
                demoScreen.IsExiting = false;

                demoScreen.Sprites = _spriteBatch;
                demoScreen.Lines   = _lineBatch;
                demoScreen.Quads   = _quadRenderer;

                demoScreen.LoadContent();

                // "Abuse" transition rendertarget to render screen preview
                GraphicsDevice.SetRenderTarget(_transitions[0]);
                GraphicsDevice.Clear(Color.Transparent);

                _quadRenderer.Begin();
                _quadRenderer.Render(Vector2.Zero, new Vector2(_transitions[0].Width, _transitions[0].Height), null, true, ContentWrapper.Grey, Color.White * 0.3f);
                _quadRenderer.End();

                // Update ensures that the screen is fully visible, we "cover" it so that no physics are run
                demoScreen.Update(new GameTime(demoScreen.TransitionOnTime, demoScreen.TransitionOnTime), true, false);
                demoScreen.Draw(new GameTime());
                demoScreen.Draw(new GameTime());

                GraphicsDevice.SetRenderTarget(preview);
                GraphicsDevice.Clear(Color.Transparent);

                _spriteBatch.Begin();
                _spriteBatch.Draw(_transitions[0], preview.Bounds, Color.White);
                _spriteBatch.End();

                GraphicsDevice.SetRenderTarget(null);

                demoScreen.ExitScreen();
                demoScreen.Update(new GameTime(demoScreen.TransitionOffTime, demoScreen.TransitionOffTime), true, false);
                if (!firstPreview)
                {
                    _menuScreen.AddMenuItem(demoScreen, preview);
                }
                else
                {
                    firstPreview = false;
                }
            }

            AddScreen(new BackgroundScreen());
            AddScreen(_menuScreen);

            //TODO: This can't be called at this point in time in MonoGame
            //ResetElapsedTime();
        }
Esempio n. 49
0
 /// <summary>
 /// Queries how wide the entry is, used for centering on the screen.
 /// </summary>
 public virtual int GetWidth(MenuScreen screen)
 {
     return (int)screen.ScreenManager.Font.MeasureString(Text).X;
 }
 public ThirdPersonInputHandler()
 {
     selectedBlockType     = 7;
     currentMenu           = MenuScreen.getThirdPersonHud(Compositer.getScreenWidth(), Compositer.getScreenHeight());
     currentInterfaceState = InterfaceStates.playing;
 }
Esempio n. 51
0
        //clears everything and starts a new game (reinitialize)
        public void StartGame()
        {
            Components.Clear();

            // game objective
            objDetermine = Random.Next(3);
            switch (objDetermine)
            {
            case 0:
                gameObj = Objective.Scientist;
                break;

            case 1:
                gameObj = Objective.Bomb;
                break;

            default:
                gameObj = Objective.Elimination;
                break;
            }
            objTimer = 0;
            objShow  = true;
            objRoom  = Random.Next(10, 18);
            objRoom2 = Random.Next(18);
            while (objRoom2 == objRoom)
            {
                objRoom2 = Random.Next(18);
            }
            objEliminate = 40;
            heliRoom     = Random.Next(0, 9);

            player = new PlayerSprite(this, "Images//playerWalk", new Vector2(GlobalClass.ScreenWidth / 2,
                                                                              GlobalClass.ScreenHeight / 2), 2, 6, this);

            gridNumbers = new List <int>(Enumerable.Range(0, 9));
            Shuffle(gridNumbers);

            street0 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.White, 0);
            street1 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightBlue, 1);
            street2 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightCoral, 2);
            street3 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGoldenrodYellow, 3);
            street4 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGreen, 4);
            street5 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGray, 5);
            street6 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightPink, 6);
            street7 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSteelBlue, 7);
            street8 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSeaGreen, 8);

            room0 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.White, 9);
            room1 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightBlue, 10);
            room2 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightCoral, 11);
            room3 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGoldenrodYellow, 12);
            room4 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGreen, 13);
            room5 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGray, 14);
            room6 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightPink, 15);
            room7 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSteelBlue, 16);
            room8 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSeaGreen, 17);

            //add rooms to game
            Components.Add(street0);
            Components.Add(player);

            //Add game components
            Components.Add(new Enemy(this, "Images//enemyWalk", new Vector2(200, 200), 2, 5));
            elements = new GameElements(this, player);
            elements.Initialize();
            camera = new Camera(this);

            //Splashscreen component
            splashScreen = new SplashScreen(this);
            menuScreen   = new MenuScreen(this);
            pauseScreen  = new PauseScreen(this);
            endScreen    = new EndScreen(this);
            tutScreen    = new TutScreen(this);
            Components.Add(splashScreen);
            Components.Add(menuScreen);
            Components.Add(pauseScreen);
            Components.Add(endScreen);
            Components.Add(tutScreen);
        }
    private IEnumerator Transit(MenuScreen screen)
    {
        yield return(new WaitUntil(() => SceneManager.Instance.CurrentState != SceneManager.State.Transitioning));

        TransitionToScreen.Invoke(MenuManager.Instance, new object[] { screen, MenuManager.TransitionType.PushAndReplace, null });
    }
Esempio n. 53
0
 // Use this for initialization
 void Start()
 {
     currentScreen = MenuScreen.mainScreen;
     trialNum      = 1;
 }
Esempio n. 54
0
        private void SceneLoaded(Scene scene, LoadSceneMode lsm)
        {
            try
            {
                if (_uim != null || ModLoader.LoadedMods == null || UIManager.instance == null)
                {
                    return;
                }
            }
            catch (NullReferenceException)
            {
                //Do Nothing.  Something inside of UIManager.instance breaks even if you try to check for null on it.
                return;
            }

            _uim = UIManager.instance;

            //ADD MODS TO OPTIONS MENU
            MenuButton defButton = (MenuButton)_uim.optionsMenuScreen.defaultHighlight;
            MenuButton modButton = Object.Instantiate(defButton.gameObject).GetComponent <MenuButton>();

            Navigation nav = modButton.navigation;

            nav.selectOnUp       = defButton.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown();
            nav.selectOnDown     = defButton.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown();
            modButton.navigation = nav;

            nav = modButton.FindSelectableOnUp().navigation;
            nav.selectOnDown = modButton;
            modButton.FindSelectableOnUp().navigation = nav;

            nav            = modButton.FindSelectableOnDown().navigation;
            nav.selectOnUp = modButton;
            modButton.FindSelectableOnDown().navigation = nav;

            modButton.name = "Mods";

            modButton.transform.SetParent(modButton.FindSelectableOnUp().transform.parent);

            modButton.transform.localPosition = new Vector2(0, -120);
            modButton.transform.localScale    = modButton.FindSelectableOnUp().transform.localScale;

            Object.Destroy(modButton.gameObject.GetComponent <AutoLocalizeTextUI>());
            modButton.gameObject.transform.FindChild("Text").GetComponent <Text>().text = "Mods";
            //ADD MODS TO OPTIONS MENU

            //SETUP MOD MENU
            GameObject go = Object.Instantiate(_uim.optionsMenuScreen.gameObject);

            ModMenuScreen          = go.GetComponent <MenuScreen>();
            ModMenuScreen.title    = ModMenuScreen.gameObject.transform.FindChild("Title").GetComponent <CanvasGroup>();
            ModMenuScreen.topFleur = ModMenuScreen.gameObject.transform.FindChild("TopFleur").GetComponent <Animator>();
            ModMenuScreen.content  = ModMenuScreen.gameObject.transform.FindChild("Content").GetComponent <CanvasGroup>();

            ModMenuScreen.title.gameObject.GetComponent <Text>().text = "Mods";
            Object.Destroy(ModMenuScreen.title.gameObject.GetComponent <AutoLocalizeTextUI>());

            ModMenuScreen.transform.SetParent(_uim.optionsMenuScreen.gameObject.transform.parent);
            ModMenuScreen.transform.localPosition = _uim.optionsMenuScreen.gameObject.transform.localPosition;
            ModMenuScreen.transform.localScale    = _uim.optionsMenuScreen.gameObject.transform.localScale;

            // ReSharper disable SuspiciousTypeConversion.Global
            List <ITogglableMod> managableMods = ModLoader.LoadedMods.Where(x => x is ITogglableMod).Select(x => x).Cast <ITogglableMod>().ToList();

            // ReSharper restore SuspiciousTypeConversion.Global

            //modMenuScreen.content = modMenuScreen.gameObject.transform.GetChild()
            ModMenuScreen.defaultHighlight = ModMenuScreen.content.gameObject.transform.GetChild(0).GetChild(0).GetComponent <MenuButton>();
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject.transform.parent.gameObject);

            Back = ModMenuScreen.defaultHighlight.FindSelectableOnUp();
            GameObject item = _uim.videoMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject;

            Object.DestroyImmediate(item.GetComponent <MenuOptionHorizontal>());
            Object.DestroyImmediate(item.GetComponent <MenuSetting>());
            Object.DestroyImmediate(ModMenuScreen.content.GetComponent <VerticalLayoutGroup>());
            Object.Destroy(ModMenuScreen.defaultHighlight.gameObject.transform.parent.gameObject);

            if (managableMods.Count > 0)
            {
                ModArray = new Selectable[managableMods.Count];

                for (int i = 0; i < managableMods.Count; i++)
                {
                    GameObject menuItemParent         = Object.Instantiate(item.gameObject);
                    FauxMenuOptionHorizontal menuItem = menuItemParent.AddComponent <FauxMenuOptionHorizontal>();

                    menuItem.navigation = Navigation.defaultNavigation;
                    int modIndex = i;

                    //Manages what should happen when the menu option changes (the user clicks and the mod is toggled On/Off)
                    menuItem.OnUpdate += optionIndex =>
                    {
                        ITogglableMod mod = managableMods[modIndex];

                        string name = mod.GetName();

                        if (!ModHooks.Instance.GlobalSettings.ModEnabledSettings.ContainsKey(name))
                        {
                            ModHooks.Instance.GlobalSettings.ModEnabledSettings.Add(name, true);
                        }

                        if (optionIndex == 1)
                        {
                            ModLoader.UnloadMod(mod);
                        }
                        else
                        {
                            ModLoader.LoadMod(mod);
                        }
                    };
                    //dataDump(modArray[i].gameObject, 1);

                    menuItem.OptionList          = new[] { "On", "Off" };
                    menuItem.OptionText          = menuItem.gameObject.transform.GetChild(1).GetComponent <Text>();
                    menuItem.SelectedOptionIndex = ModHooks.Instance.GlobalSettings.ModEnabledSettings[managableMods[i].GetName()] ? 0 : 1;
                    menuItem.LocalizeText        = false;
                    menuItem.SheetTitle          = managableMods[i].GetName();

                    Object.DestroyImmediate(menuItem.transform.FindChild("Label")
                                            .GetComponent <AutoLocalizeTextUI>());
                    menuItem.transform.FindChild("Label").GetComponent <Text>().text = managableMods[i].GetName();

                    menuItem.leftCursor  = menuItem.transform.FindChild("CursorLeft").GetComponent <Animator>();
                    menuItem.rightCursor = menuItem.transform.FindChild("CursorRight").GetComponent <Animator>();

                    menuItem.gameObject.name = managableMods[i].GetName();

                    RectTransform rt = menuItemParent.GetComponent <RectTransform>();

                    rt.SetParent(ModMenuScreen.content.transform);
                    rt.localScale = new Vector3(2, 2, 2);

                    rt.sizeDelta        = new Vector2(960, 120);
                    rt.anchoredPosition = new Vector2(0, (766 / 2) - 90 - (150 * i));
                    rt.anchorMin        = new Vector2(0.5f, 1.0f);
                    rt.anchorMax        = new Vector2(0.5f, 1.0f);

                    //Image img = menuItem.AddComponent<Image>();
                    //img.sprite = nullSprite();

                    menuItem.cancelAction = CancelAction.DoNothing;

                    ModArray[i] = menuItem;

                    //AutoLocalizeTextUI localizeUI = modArray[i].GetComponent<AutoLocalizeTextUI>();
                    //modArray[i].transform.GetChild(0).GetComponent<Text>().text = mods[i];
                    //GameObject.Destroy(localizeUI);
                }

                Navigation[] navs = new Navigation[ModArray.Length];
                for (int i = 0; i < ModArray.Length; i++)
                {
                    navs[i] = new Navigation
                    {
                        mode         = Navigation.Mode.Explicit,
                        selectOnUp   = i == 0 ? Back : ModArray[i - 1],
                        selectOnDown = i == ModArray.Length - 1 ? Back : ModArray[i + 1]
                    };

                    ModArray[i].navigation = navs[i];
                }

                ModMenuScreen.defaultHighlight = ModArray[0];
                Navigation nav2 = Back.navigation;
                nav2.selectOnUp   = ModArray[ModArray.Length - 1];
                nav2.selectOnDown = ModArray[0];
                Back.navigation   = nav2;
            }


            ((MenuButton)Back).cancelAction = CancelAction.DoNothing;
            EventTrigger backEvents = Back.gameObject.GetComponent <EventTrigger>();

            backEvents.triggers = new List <EventTrigger.Entry>();

            EventTrigger.Entry backSubmit = new EventTrigger.Entry {
                eventID = EventTriggerType.Submit
            };
            backSubmit.callback.AddListener(data => { _fauxUim.UIquitModMenu(); });
            backEvents.triggers.Add(backSubmit);

            EventTrigger.Entry backClick = new EventTrigger.Entry {
                eventID = EventTriggerType.PointerClick
            };
            backClick.callback.AddListener(data => { _fauxUim.UIquitModMenu(); });
            backEvents.triggers.Add(backClick);


            //SETUP MOD MENU
            LogDebug("About to add the events to the menu option");
            //SETUP MOD BUTTON TO RESPOND TO SUBMIT AND CANCEL EVENTS CORRECTLY
            EventTrigger events = modButton.gameObject.GetComponent <EventTrigger>();

            events.triggers = new List <EventTrigger.Entry>();

            EventTrigger.Entry submit = new EventTrigger.Entry {
                eventID = EventTriggerType.Submit
            };
            submit.callback.AddListener(data => { _fauxUim.UIloadModMenu(); });
            events.triggers.Add(submit);

            EventTrigger.Entry click = new EventTrigger.Entry {
                eventID = EventTriggerType.PointerClick
            };
            click.callback.AddListener(data => { _fauxUim.UIloadModMenu(); });
            events.triggers.Add(click);

            //SETUP MOD BUTTON TO RESPOND TO SUBMIT AND CANCEL EVENTS CORRECTLY
        }
Esempio n. 55
0
 public void ShowCreateSettingRoom()
 {
     CreateNewRoomScreen.SetActive(true);
     MenuScreen.SetActive(false);
 }
Esempio n. 56
0
 public virtual int GetHeight(MenuScreen screen)
 {
     return((int)_font.LineSpacing);
 }
Esempio n. 57
0
 /// <summary>
 /// Queries how much space this menu entry requires.
 /// </summary>
 /// <param name="screen">The parent screen</param>
 /// <returns>The entries height</returns>
 public virtual int GetHeight(MenuScreen screen)
 {
     return screen.ScreenManager.MenuFont.LineSpacing;
 }
Esempio n. 58
0
 public virtual int GetWidth(MenuScreen screen)
 {
     return((int)_font.MeasureString(Text).X);
 }
Esempio n. 59
0
        private void SceneLoaded(Scene scene, LoadSceneMode lsm)
        {
            try
            {
                if (_uim != null || ModLoader.LoadedMods == null || UIManager.instance == null)
                {
                    return;
                }
            }
            catch (NullReferenceException)
            {
                //Do Nothing.  Something inside of UIManager.instance breaks even if you try to check for null on it.
                return;
            }

            _uim = UIManager.instance;

            //ADD MODS TO OPTIONS MENU
            MenuButton defButton = (MenuButton)_uim.optionsMenuScreen.defaultHighlight;
            MenuButton modButton = Object.Instantiate(defButton.gameObject).GetComponent <MenuButton>();

            _uim.optionsMenuScreen.GetComponent <Patches.MenuButtonList>().AddSelectable(modButton, 5);

            modButton.name = "Mods";

            modButton.transform.SetParent(defButton.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown()
                                          .FindSelectableOnDown().transform.parent);

            modButton.transform.localPosition = new Vector2(0, -120);
            modButton.transform.localScale    = defButton.FindSelectableOnDown().FindSelectableOnDown().FindSelectableOnDown()
                                                .FindSelectableOnDown().transform.localScale;

            Object.Destroy(modButton.gameObject.GetComponent <AutoLocalizeTextUI>());
            modButton.gameObject.transform.Find("Text").GetComponent <Text>().text = "Mods";
            //ADD MODS TO OPTIONS MENU

            //SETUP MOD MENU
            GameObject go = Object.Instantiate(_uim.optionsMenuScreen.gameObject);

            ModMenuScreen          = go.GetComponent <MenuScreen>();
            ModMenuScreen.title    = ModMenuScreen.gameObject.transform.Find("Title").GetComponent <CanvasGroup>();
            ModMenuScreen.topFleur = ModMenuScreen.gameObject.transform.Find("TopFleur").GetComponent <Animator>();
            ModMenuScreen.content  = ModMenuScreen.gameObject.transform.Find("Content").GetComponent <CanvasGroup>();

            Patches.MenuButtonList modButtons = go.GetComponent <Patches.MenuButtonList>();
            modButtons.ClearSelectables();

            ModMenuScreen.title.gameObject.GetComponent <Text>().text = "Mods";
            Object.Destroy(ModMenuScreen.title.gameObject.GetComponent <AutoLocalizeTextUI>());

            ModMenuScreen.transform.SetParent(_uim.optionsMenuScreen.gameObject.transform.parent);
            ModMenuScreen.transform.localPosition = _uim.optionsMenuScreen.gameObject.transform.localPosition;
            ModMenuScreen.transform.localScale    = _uim.optionsMenuScreen.gameObject.transform.localScale;

            List <ITogglableMod> managableMods = ModLoader.LoadedMods.Where(x => x is ITogglableMod).Select(x => x)
                                                 .Cast <ITogglableMod>()
                                                 .ToList();

            ModMenuScreen.defaultHighlight = ModMenuScreen.content.gameObject.transform.GetChild(0).GetChild(0)
                                             .GetComponent <MenuButton>();
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown()
                           .FindSelectableOnDown().FindSelectableOnDown().gameObject.transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown()
                           .FindSelectableOnDown().gameObject.transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().FindSelectableOnDown().gameObject
                           .transform.parent.gameObject);
            Object.Destroy(ModMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject.transform.parent
                           .gameObject);

            _back = ModMenuScreen.defaultHighlight.FindSelectableOnUp();
            GameObject item = _uim.videoMenuScreen.defaultHighlight.FindSelectableOnDown().gameObject;

            Object.DestroyImmediate(item.GetComponent <MenuOptionHorizontal>());
            Object.DestroyImmediate(item.GetComponent <MenuSetting>());
            Object.DestroyImmediate(ModMenuScreen.content.GetComponent <VerticalLayoutGroup>());
            Object.Destroy(ModMenuScreen.defaultHighlight.gameObject.transform.parent.gameObject);
            try
            {
                if (managableMods.Count > 0)
                {
                    _modArray = new Selectable[managableMods.Count];

                    for (int i = 0; i < managableMods.Count; i++)
                    {
                        GameObject menuItemParent         = Object.Instantiate(item.gameObject);
                        FauxMenuOptionHorizontal menuItem = menuItemParent.AddComponent <FauxMenuOptionHorizontal>();

                        menuItem.navigation = new Navigation
                        {
                            mode = Navigation.Mode.Explicit
                        };

                        modButtons.AddSelectable(menuItem);

                        int modIndex = i;

                        //Manages what should happen when the menu option changes (the user clicks and the mod is toggled On/Off)
                        menuItem.OnUpdate += optionIndex =>
                        {
                            ITogglableMod mod = managableMods[modIndex];

                            string name = mod.GetName();

                            if (!ModHooks.Instance.GlobalSettings.ModEnabledSettings.ContainsKey(name))
                            {
                                ModHooks.Instance.GlobalSettings.ModEnabledSettings.Add(name, true);
                            }

                            try
                            {
                                if (optionIndex == 1)
                                {
                                    ModLoader.UnloadMod(mod);
                                }
                                else
                                {
                                    ModLoader.LoadMod(mod, true);
                                }
                            }
                            catch (Exception e)
                            {
                                LogError($"Could not load/unload mod \"{name}\":\n{e}");
                            }
                        };

                        menuItem.OptionList          = new[] { "On", "Off" };
                        menuItem.OptionText          = menuItem.gameObject.transform.GetChild(1).GetComponent <Text>();
                        menuItem.SelectedOptionIndex =
                            ModHooks.Instance.GlobalSettings.ModEnabledSettings[managableMods[i].GetName()] ? 0 : 1;
                        menuItem.LocalizeText = false;
                        menuItem.SheetTitle   = managableMods[i].GetName();

                        Object.DestroyImmediate(menuItem.transform.Find("Label")
                                                .GetComponent <AutoLocalizeTextUI>());
                        menuItem.transform.Find("Label").GetComponent <Text>().text = managableMods[i].GetName();

                        menuItem.leftCursor  = menuItem.transform.Find("CursorLeft").GetComponent <Animator>();
                        menuItem.rightCursor = menuItem.transform.Find("CursorRight").GetComponent <Animator>();

                        menuItem.gameObject.name = managableMods[i].GetName();

                        RectTransform rt = menuItemParent.GetComponent <RectTransform>();

                        rt.SetParent(ModMenuScreen.content.transform);
                        rt.localScale = new Vector3(2, 2, 2);

                        rt.sizeDelta        = new Vector2(960, 120);
                        rt.anchoredPosition = new Vector2(0, 766 / 2 - 90 - 150 * i);
                        rt.anchorMin        = new Vector2(0.5f, 1.0f);
                        rt.anchorMax        = new Vector2(0.5f, 1.0f);

                        menuItem.cancelAction = CancelAction.QuitModMenu;

                        _modArray[i] = menuItem;
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }

            _back.navigation = new Navigation
            {
                mode = Navigation.Mode.Explicit
            };

            modButtons.AddSelectable(_back);

            modButtons.RecalculateNavigation();

            ((MenuSelectable)_back).cancelAction = CancelAction.QuitModMenu;
            EventTrigger backEvents = _back.gameObject.GetComponent <EventTrigger>();

            backEvents.triggers = new List <EventTrigger.Entry>();

            EventTrigger.Entry backSubmit = new EventTrigger.Entry {
                eventID = EventTriggerType.Submit
            };
            backSubmit.callback.AddListener(data => { _fauxUim.UIquitModMenu(); });
            backEvents.triggers.Add(backSubmit);

            EventTrigger.Entry backClick = new EventTrigger.Entry {
                eventID = EventTriggerType.PointerClick
            };
            backClick.callback.AddListener(data => { _fauxUim.UIquitModMenu(); });
            backEvents.triggers.Add(backClick);


            //SETUP MOD MENU
            LogDebug("About to add the events to the menu option");
            //SETUP MOD BUTTON TO RESPOND TO SUBMIT AND CANCEL EVENTS CORRECTLY
            EventTrigger events = modButton.gameObject.GetComponent <EventTrigger>();

            events.triggers = new List <EventTrigger.Entry>();

            EventTrigger.Entry submit = new EventTrigger.Entry {
                eventID = EventTriggerType.Submit
            };
            submit.callback.AddListener(data => { _fauxUim.UIloadModMenu(); });
            events.triggers.Add(submit);

            EventTrigger.Entry click = new EventTrigger.Entry {
                eventID = EventTriggerType.PointerClick
            };
            click.callback.AddListener(data => { _fauxUim.UIloadModMenu(); });
            events.triggers.Add(click);

            //SETUP MOD BUTTON TO RESPOND TO SUBMIT AND CANCEL EVENTS CORRECTLY
        }
Esempio n. 60
0
 public void ChangeMenuAndFade(MenuScreen screen)
 {
     StartCoroutine(ChangeScreen(screen, true));
 }