public StatsScreen() { calcTotalGameTime(); window = new Rectangle(screenWidth * 7 / 25 , screenHeight / 3, 8 * screenWidth / 15, 7 * screenHeight / 10); hTopRow = screenHeight / 5; hOtherRows = screenHeight / 15 * 2; buttonHeight = screenHeight / 8; buttonWidth = screenWidth / 7; int x1 = screenWidth / 6 - buttonWidth / 2; int x2 = 5 * screenWidth / 6 - buttonWidth / 2; int x3 = screenWidth / 2 - buttonWidth / 2 ; int x4 = screenWidth / 2 - 5 * buttonWidth / 2 + 50; int x5 = screenWidth / 2 + 3 * buttonWidth / 2 - 50; int y1 = screenHeight / 9 - buttonHeight / 2; int y2 = screenHeight / 2 - 5 * buttonHeight / 2 + 20; upper1 = new Button(new Point(x3, y2), buttonWidth, hOtherRows, "Total", "Buttons/statistics"); upper2 = new Button(new Point(x4, y2), buttonWidth, hOtherRows, "Simple", "Buttons/easy"); upper3 = new Button(new Point(x5, y2), buttonWidth, hOtherRows, "Hard", "Buttons/hard"); lower1 = new Button(new Point(x2, y1), buttonWidth, hOtherRows, "Reset", "Buttons/reset"); lower2 = new Button(new Point(x1, y1), buttonWidth, hOtherRows, "Main", "Buttons/mainMenuButton"); int levelX = window.Right - window.Width / 3 - buttonWidth / 2; statsState = StatsState.TOTAL; }
private void Start() { isUsingVR = false; //Dont let this object be destroyed DontDestroyOnLoad(gameObject); //Create machine state fsm = gameObject.AddComponent <FSM>(); //Define states initState = gameObject.AddComponent <InitState>(); mainScreenState = gameObject.AddComponent <MainScreenState>(); menuState = gameObject.AddComponent <MenuState>(); vrMenuState = gameObject.AddComponent <VRMenuState>(); selectTrackState = gameObject.AddComponent <SelectTrackState>(); selectTrackVRState = gameObject.AddComponent <SelectTrackVRState>(); mooMooFarmState = gameObject.AddComponent <MooMooFarmRaceState>(); underWaterState = gameObject.AddComponent <UnderwaterRaceState>(); rainbowRoadState = gameObject.AddComponent <RainbowRoadRaceState>(); statsState = gameObject.AddComponent <StatsState>(); creditsState = gameObject.AddComponent <CreditsState>(); //Initialize fsm putting in the first state fsm.Initialize(initState); }
public void update() { if (lower2.isSelected()) Program.game.startMainMenu(); if (lower1.isSelected()) { //System.Windows.Forms.MessageBox.Show("Resetting your stats", "Warning"); Program.game.gameStats.resetData(); Program.game.gameStats.saveStats(); calcTotalGameTime(); } if (upper1.isSelected()) statsState = StatsState.TOTAL; else if (upper2.isSelected()) statsState = StatsState.SIMPLE; else if (upper3.isSelected()) statsState = StatsState.HARD; }
public StatsScreen() { conformation = false; custPage = 0; calcTotalGameTime(); window = new Rectangle(screenWidth * 7 / 25 , screenHeight / 3 + 50, 8 * screenWidth / 15, 7 * screenHeight / 10); confWindow = new Rectangle(3 * screenWidth / 8, 3 * screenHeight / 8, screenWidth / 4, screenHeight / 4); hTopRow = screenHeight / 5; hOtherRows = screenHeight / 15 * 2; smallButtonHeight = 72; smallButtonWidth = 136; largeButtonWidth = 170; largeButtonHeight = 92; int row1 = screenHeight / 9 - largeButtonHeight / 2; int row2 = screenHeight / 2 - 3 * smallButtonHeight; int row3 = screenHeight / 2 - 3 * smallButtonHeight / 2 - 10; resetButton = new Button(new Point(5 * screenWidth / 6 - smallButtonWidth / 2, row1), largeButtonWidth, largeButtonHeight, "Reset", "Buttons/reset"); mainMenuButton = new Button(new Point(screenWidth / 6 - smallButtonWidth / 2, row1), largeButtonWidth, largeButtonHeight, "Main", "Buttons/mainMenuButton"); totalButton = new Button(new Point(screenWidth / 2 - smallButtonWidth * 3, row2), smallButtonWidth, smallButtonHeight, "Total", "Buttons/totalButton"); singlePlayerButton = new Button(new Point(screenWidth / 2 - (int)(smallButtonWidth * 3/2) + 20, row2), smallButtonWidth, smallButtonHeight, "Total", "Buttons/singlePlayer"); coopModeButton = new Button(new Point(screenWidth / 2 + (int)(smallButtonWidth / 2) - 20, row2), smallButtonWidth, smallButtonHeight, "Total", "Buttons/coopMode"); createdMazesButton = new Button(new Point(screenWidth / 2 + smallButtonWidth * 2, row2), smallButtonWidth, smallButtonHeight, "Total", "Buttons/createdMazes"); easyButton = new Button(new Point(screenWidth / 2 - 2 * smallButtonWidth, row3), smallButtonWidth, smallButtonHeight, "Easy", "Buttons/easy"); hardButton = new Button(new Point(screenWidth / 2 + smallButtonWidth, row3), smallButtonWidth, smallButtonHeight, "Hard", "Buttons/hard"); nextButton = new Button(new Point(10 * screenWidth / 11 - smallButtonWidth / 2, 10 * screenHeight / 11 - smallButtonHeight / 2), smallButtonWidth, smallButtonHeight, "Next", "Buttons/next"); prevButton = new Button(new Point(screenWidth / 11 - smallButtonWidth / 2, 10 * screenHeight / 11 - smallButtonHeight / 2), smallButtonWidth, smallButtonHeight, "Previous", "Buttons/previous"); yesButton = new Button(new Point(confWindow.Left + confWindow.Width / 4 - 40, confWindow.Bottom - confWindow.Height / 3 - 25), 80, 50, "Yes", "Buttons/yes"); noButton = new Button(new Point(confWindow.Right - confWindow.Width / 4 - 40, confWindow.Bottom - confWindow.Height / 3 - 25), 80, 50, "No", "Buttons/no"); int levelX = window.Right - window.Width / 3 - smallButtonWidth / 2; statsState = StatsState.TOTAL; stars = new List<List<Sprite>>(); stars.Add(new List<Sprite>()); stars.Add(new List<Sprite>()); stars.Add(new List<Sprite>()); stars.Add(new List<Sprite>()); for (int i = 0; i < 6; i++) { for (int j = 0; j < Program.game.gameStats.data.levelData[i + 12].numStars; j++) stars[0].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i))); for (int j = 0; j < Program.game.gameStats.data.levelData[i + 18].numStars; j++) stars[1].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i))); for (int j = 0; j < Program.game.gameStats.data.levelData[i].numStars; j++) stars[2].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i))); for (int j = 0; j < Program.game.gameStats.data.levelData[i + 6].numStars; j++) stars[3].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i))); } for (int i = 0; i < Program.game.customStats.data.customLevelIDs.Count; i++) { if (i % 6 == 0) stars.Add(new List<Sprite>()); int nameId = Program.game.customStats.data.customLevelIDs[i]; for (int j = 0; j < Program.game.customStats.data.customData[nameId].numStars; j++) stars[stars.Count - 1].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 113 + 50 * (i % 6)))); } buttons = new List<Button>(); buttons.Add(totalButton); buttons.Add(easyButton); buttons.Add(hardButton); buttons.Add(resetButton); buttons.Add(mainMenuButton); buttons.Add(singlePlayerButton); buttons.Add(coopModeButton); buttons.Add(createdMazesButton); buttons.Add(nextButton); buttons.Add(prevButton); }
public void update() { if (!conformation) { if (mainMenuButton.isSelected()) Program.game.startMainMenu(); else if (resetButton.isSelected()) { conformation = true; foreach (Button button in buttons) button.selectable = false; } else if (totalButton.isSelected()) statsState = StatsState.TOTAL; else if (singlePlayerButton.isSelected()) statsState = StatsState.SINGLEEASY; else if (coopModeButton.isSelected()) statsState = StatsState.COOPEASY; else if (createdMazesButton.isSelected()) { custPage = 0; statsState = StatsState.CREATED; } else if (singlePlayerButton.selected && easyButton.isSelected()) statsState = StatsState.SINGLEEASY; else if (singlePlayerButton.selected && hardButton.isSelected()) statsState = StatsState.SINGLEHARD; else if (coopModeButton.selected && easyButton.isSelected()) statsState = StatsState.COOPEASY; else if (coopModeButton.selected && hardButton.isSelected()) statsState = StatsState.COOPHARD; else if (createdMazesButton.selected && Program.game.customStats.data.customLevelIDs.Count > (custPage + 1) * 6 && nextButton.isSelected()) custPage++; else if (createdMazesButton.selected && custPage > 0 && prevButton.isSelected()) custPage--; } else { if (yesButton.isSelected()) { Program.game.gameStats.resetData(); Program.game.gameStats.saveStats(); Program.game.customStats.resetData(); Program.game.customStats.saveStats(); calcTotalGameTime(); conformation = false; } if (noButton.isSelected()) conformation = false; if (!conformation) { foreach (Button button in buttons) button.selectable = true; } } }