protected override void Update() { screenHelper(); State.sound_man.update_music(); if (State.dialogueBox.active == true) { if (State.dialogueBox.currSpeaker == "alex") { Alexis.setTalking(true); Dad.setTalking(false); Mom.setTalking(false); } else if (State.dialogueBox.currSpeaker == "dad") { Alexis.setTalking(false); Dad.setTalking(true); Mom.setTalking(false); } else if (State.dialogueBox.currSpeaker == "mom") { Alexis.setTalking(false); Dad.setTalking(false); Mom.setTalking(true); } } else { Alexis.setTalking(false); Dad.setTalking(false); Mom.setTalking(false); } if (State.GetState() == "game" || State.GetState() == "tutorial") { if (fadeFlag) { if (alphaBlack + fadeFloat <= 255 && alphaBlack + fadeFloat >= 0) { alphaBlack += fadeFloat; } else { fadeFlag = false; } } blackness.FillColor = new Color(0, 0, 0, (byte)alphaBlack); // Update the game timerz State.updateTimerz(); // Get the current UI Textboxes from the UI Manager var playerDialogues = ui_man.getPlayerDialogues(); // Get the mouse coordinates from Input Manager var MouseCoord = ManagerOfInput.GetMousePos(); // If the mouse is currently dragging if (ManagerOfInput.GetMouseDown()) { // Loop through buttons for (var i = 0; i < buttons.Count; i++) { // Find button currently being interacted with if (buttons[i].GetSelected() && !buttons[i].getDisabled()) { // Move the button around the screen buttons[i].translate(MouseCoord[0], MouseCoord[1], window.Size.X, window.Size.Y); // Check collision with UI Textboxes // Loop through UI Textboxes if (ui_man.wasMouseIn) { // If the mouse just came from inside a UI Textbox if (!ui_man.contains(buttons[i])) { // Mouse has now left the UI Textbox so set it to false ui_man.wasMouseIn = false; // Reset the color to match its previous color playerDialogues[0].setBoxColor(playerDialogues[0].getBoxColor("prev")); ui_man.rootBackgroundBorder.OutlineColor = ui_man.rootBackground.FillColor; // Update the rest of the buttons in the cluster ui_man.updateClusterColors(playerDialogues[0], playerDialogues, playerDialogues[0].getBoxColor("prev"), false); } } else { // If mouse just came from outside the UI Textbox if (ui_man.contains(buttons[i])) { ui_man.wasMouseIn = true; // Update previous color to current color of the UI Textbox playerDialogues[0].setPrevColor(playerDialogues[0].getBoxColor("curr")); // Update current color to selected tonal button color playerDialogues[0].setBoxColor(buttons[i].getTonalColor()); ui_man.rootBackgroundBorder.OutlineColor = buttons[i].getTonalColor(); // Update the rest of the buttons in the cluster ui_man.updateClusterColors(playerDialogues[0], playerDialogues, buttons[i].getTonalColor(), true); } } } } } } else if (State.GetState() == "pause") { //State.getGameTimer("game").PauseTimer(); } }
protected override void Initialize() { screenHelper(); splash = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/wut.png")); playerfood = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/playerfood.png")); backwall = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/backwall.png")); flower = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/flowershadow.png")); lamp = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/lamp.png")); pictures = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/pictures.png")); table = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/newletable.png")); cups = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/cups.png")); plates = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/platesfinal.png")); wallWindow = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/window.png")); splash.Scale = new Vector2f(1.755f, 1.755f); playerfood.Scale = new Vector2f((float)((SCREEN_WIDTH / playerfood.GetGlobalBounds().Width) * 0.23), (float)((SCREEN_HEIGHT / playerfood.GetGlobalBounds().Height) * 0.23)); backwall.Scale = new Vector2f(SCREEN_WIDTH / backwall.GetGlobalBounds().Width, SCREEN_HEIGHT / backwall.GetGlobalBounds().Height); flower.Scale = new Vector2f((float)((SCREEN_WIDTH / flower.GetGlobalBounds().Width) * 0.8), (float)((SCREEN_HEIGHT / flower.GetGlobalBounds().Height) * 0.8)); lamp.Scale = new Vector2f(SCREEN_WIDTH / lamp.GetGlobalBounds().Width, SCREEN_HEIGHT / lamp.GetGlobalBounds().Height); cups.Scale = new Vector2f(SCREEN_WIDTH / cups.GetGlobalBounds().Width, SCREEN_HEIGHT / cups.GetGlobalBounds().Height); plates.Scale = new Vector2f(SCREEN_WIDTH / plates.GetGlobalBounds().Width, SCREEN_HEIGHT / plates.GetGlobalBounds().Height); pictures.Scale = new Vector2f(SCREEN_WIDTH / pictures.GetGlobalBounds().Width, SCREEN_HEIGHT / pictures.GetGlobalBounds().Height); table.Scale = new Vector2f(SCREEN_WIDTH / table.GetGlobalBounds().Width, SCREEN_HEIGHT / table.GetGlobalBounds().Height); wallWindow.Scale = new Vector2f(SCREEN_WIDTH / wallWindow.GetGlobalBounds().Width, SCREEN_HEIGHT / wallWindow.GetGlobalBounds().Height); // splash.Position = new Vector2f(0, 0); table.Position = new Vector2f(0, (float)((SCREEN_HEIGHT * -0.02) + 20)); cups.Position = new Vector2f(0, (float)(SCREEN_HEIGHT * -0.12)); plates.Position = new Vector2f(0, (float)(SCREEN_HEIGHT * -0.12)); playerfood.Position = new Vector2f((SCREEN_WIDTH / 2) - (playerfood.GetGlobalBounds().Width / 2), 820); flower.Position = new Vector2f((SCREEN_WIDTH / 2) - (flower.GetGlobalBounds().Width / 2), (float)(SCREEN_HEIGHT / 17)); toneBar = new Sprite(new Texture("../../Art/UI_Art/buttons n boxes/tonebar.png")); toneBar.Position = new Vector2f(6, (float)(SCREEN_HEIGHT * 0.735)); toneBar.Scale = new Vector2f(SCREEN_WIDTH / 1920, SCREEN_HEIGHT / 1080); textBackground = new RectangleShape(new Vector2f(SCREEN_WIDTH, SCREEN_HEIGHT / 5)); textBackground.Position = new Vector2f(0, SCREEN_HEIGHT - (float)(SCREEN_HEIGHT * 0.19)); textBackground.FillColor = new Color(67, 65, 69); textBackground.OutlineColor = Color.White; textBackground.OutlineThickness = 2; // Create Character states jankList = s.chooseJank(Load.Jankson, jankId, currentTone.ToString()); State.setResponseList(jankList); jankIncr(); jankList = s.chooseJank(Load.Jankson, jankId, currentTone.ToString()); //jumpflag1 responseListNPC = s.ChooseDialogPlot(Load.allp, sman.getCurrentNode(), npcPlotId, "Default"); responseList = s.ChooseDialogPlot(Load.newplayerp, sman.getCurrentNode(), playerPlotId, "Root"); //ui_man.produceTextBoxes(responseList[0].content); //timeflag State.addTimer("game", 10, new Action(() => { TimerAction(); })); ///////////////////////////////////////////////////////////////////////////////////////////////////////// buttons = ui_man.getButtons(); menus.Add(startMenu); menus.Add(settingsMenu); menus.Add(pauseMenu); State.resetGameStuff = new Task(() => { return; }); Mom = new Mom(); Mom.setSpriteEmotion(Character.spriteEmotion.happy); Mom.active(true); Mom.setTalking(false); Alexis = new Alex(); Alexis.setSpriteEmotion(Character.spriteEmotion.angry); Alexis.active(true); Alexis.setTalking(false); Dad = new Dad(); Dad.setSpriteEmotion(Character.spriteEmotion.happy); Dad.active(true); Dad.setTalking(false); Arm = new Arm(); Arm.setSpriteEmotion(Character.spriteEmotion.neutral); Arm.setArmPosition(Dad.getArmPosition()); Arm.active(true); blackness.FillColor = Color.Black; blackness.Position = new Vector2f(0, 0); State.sound_man.init_music(); }