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(); } }
private void resetCharacterFNC() { Mom.setCurrentFNC(0); Dad.setCurrentFNC(0); Alexis.setCurrentFNC(0); }
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(); }
private void spaceCode() { if (State.GetState() == "menu") { State.SetState("tutorial"); } else if (State.GetState() == "game") { if (endGame) { if (endGame2) { if (State.dialogueBox.checkNext()) { State.playerDialogueBox.loadNewDialogue("player", "Thanks for playing Say Again <Credits:> <Jill Yeung - Designer, John Chau - Developer> <Leo Gomez - Producer, Raman Nakarmi - Tester> <Michael Simpson - Test Coordinator, Koosha Seyvani - Social Media Coordinator> <Yuna Choe - Artist Coordinator, Vernon Wong - Writer> <Allayne Low - Artist, Lyn Kline - Artist, Courtney Chavez - Artist> <END> "); State.playerDialogueBox.active = true; State.playerDialogueBox.init = true; State.dialogueBox.active = false; State.dialogueBox.init = false; State.playerDialogueBox.awaitInput = false; fadeFlag = true; fadeFloat = fadeLimit; endGame2 = false; } } else { State.playerDialogueBox.checkNext(); return; } } else { if (State.dialogueIndex == "player") { State.advanceConversation(speaker, responseList, responseListNPC); } else if (State.dialogueIndex == "root") { revertEmotion(Mom); revertEmotion(Dad); revertEmotion(Alexis); if (State.dialogueBox.getAwaitInput() == false && State.dialogueBox.printTime != 0) { State.dialogueBox.printTime = 0; } if (State.getGameTimer("game").getCountDown() != 0.0) { State.getGameTimer("game").setCountDown(0); //TimerAction(); State.dialogueBox.active = false; State.playerDialogueBox.active = false; } // Activate dialogueBox to display and be responsive, or switch to Root dialogue } else if (State.dialogueIndex == "AI") { State.advanceConversation(speaker, responseList, responseListNPC); if (responseListNPC[0].finished == "finGame") { endGame = true; } } else if (State.dialogueIndex == "interject") { if (State.dialogueBox.getAwaitInput() == true) { if (State.dialogueBox.checkNext()) { if (responseListNPC[0].inext != "") { speaker = responseListNPC[0].inext; } if (sman.getDialogueType() == "plotpoint") { responseListNPC = s.ChooseDialogPlot(Load.allp, sman.getCurrentNode(), npcPlotId, pTone); npcPlotId = incr(npcPlotId); playerPlotId = linkId(npcPlotId); } else { responseListNPC = s.ChooseDialogTransition(Load.allt, bucket, npcTransitionId, currentTone.ToString()); npcTransitionId = incr(npcTransitionId); playerTransitionId = linkId(npcTransitionId); } RES(responseListNPC); State.advanceConversation(speaker, responseList, responseListNPC); affect(responseListNPC[0].target, responseListNPC[0].FNC); checkFades(); checkPlotChange(); resetCharacterFNC(); reRootPlayer(); } } else if (State.dialogueBox.getAwaitInput() == false && State.dialogueBox.printTime != 0) { State.dialogueBox.printTime = 0; } } } } else if (State.GetState() == "tutorial") { if (Int32.Parse(jankId) >= 27) { playerPlotId = "2"; resetTransitionId(); ui_man.tutorialButtonIndex = 4; ui_man.reset(responseList); fadeFlag = true; fadeFloat = -fadeLimit; ui_man.TooltipToggle(false, State.tooltip); Mom.setHide(false); Dad.setHide(false); Arm.setHide(false); } if (State.dialogueIndex == "AI") { if (State.dialogueBox.checkNext()) { jankList = s.chooseJank(Load.Jankson, jankId, currentTone.ToString()); State.setResponseList(jankList); State.advanceConversation("", null, null); jankIncr(); limitTones(); } } else if (State.dialogueIndex == "root") { if (State.getGameTimer("game").getCountDown() != 0.0) { TimerAction(); //State.getGameTimer("game").setCountDown(0); } } else if (State.dialogueIndex == "player") { if (State.playerDialogueBox.checkNext()) { jankList = s.chooseJank(Load.Jankson, jankId, currentTone.ToString()); State.setResponseList(jankList); State.advanceConversation("", null, null); jankIncr(); limitTones(); } } if (Int32.Parse(jankId) == 4 && !fadeFlag) { fadeFlag = true; fadeFloat = -fadeLimit; } else if (Int32.Parse(jankId) == 12 && !fadeFlag) { fadeFlag = true; fadeFloat = fadeLimit; } else if (Int32.Parse(jankId) == 13 && !fadeFlag) { Dad.setHide(false); Arm.setHide(false); fadeFlag = true; fadeFloat = -fadeLimit; } else if (Int32.Parse(jankId) == 18 && !fadeFlag) { fadeFlag = true; fadeFloat = fadeLimit; } else if (Int32.Parse(jankId) == 19 && !fadeFlag) { Mom.setHide(false); fadeFlag = true; fadeFloat = -fadeLimit; } } }