// Update is called once per frame void Update() { // Check your inventory if (Input.GetKeyDown(KeyCode.I)) { inventoryString = ""; if (inventory.Count == 0) { modalPanel.Choice("I don't have anything on me.", 2f, 1f); } else { inventoryString = "I have "; for (int i = 0; i < inventory.Count; i++) { // Next to last item if (i == (inventory.Count - 2)) { inventoryString += "a " + inventory[i] + " and "; } // Last item else if (i == (inventory.Count - 1)) { inventoryString += "a " + inventory[i] + "."; } // All other items else { inventoryString += "a " + inventory[i] + ", "; } } modalPanel.Choice(inventoryString, 2f, 1f); } } }
public void OnEditClick() { if (string.IsNullOrEmpty(questionIndexText.text)) { displayManager.DisplayMessage("Please click 'Next' button to start!"); return; } modalPanel.Choice("Would you like to edit this question?", onEditYes, onEditNo); }
// Send to the Modal Panel to set up the Buttons and Functions to call public void birdSelect(int birdNum, Texture2D portrait) { modalPanel.iconImage.texture = portrait; theConversation = new MasterConversation(birdNum, 1); theScore = 0; modalPanel.Choice(theConversation.Conversation1, YesAction, NoAction, false); }
private void OnRandomPlayerClick() { GameControl.instance.soundManager.PlayLowToneButton(); if (_isKeyboardUp) { SlideKeyboard(); return; } _modalPanel.Choice("Challenging a", "RANDOM USER", _mRandomChallengeYesAction, _mNoAction); }
void Update() { CalculateScores(); LogScores(); CheckRecommendation(); if (Input.GetKeyDown("escape") && active != SceneManager.GetSceneByName("test")) { modalPanel.Choice("Do you want to stop?", backAction, cancelAction); } }
/*This function handles when the entity is killed*/ public void Die() { currentHealth = 0; //damage may have taken health negative, set it to 0 if (gameObject.tag == "Player") //if this entity is the player, call the modal panel with a message { modalPanel.Choice("You have died!", myOkayAction); //call modal panel to display a message dead = true; //set dead to true } else if (gameObject.tag == "Enemy") //if the entity is tagged as an enemy, call the modal with a different message { modalPanel.Choice("The enemy has been destroyed!", myOkayAction); dead = true; } }
public override void ExitState() { GameManager.instance.gameUI.GetComponent <WorkerSelector>().enabled = false; //Give player the choice to build before moving through a dialog window modalPanel.Choice("Build before Moving?\n(If yes, cannot move up this turn.)", "Yes", "No", button1Action, button2Action); }
void PauseGame() { Time.timeScale = 0; modalPanel.enabled = true; modalPanel.Choice("Do you want to exit current game?", new UnityAction(GameOver), new UnityAction(UnPause), new UnityAction(UnPause)); }
IEnumerator waitOpen() { triggerHappened = true; GameObject.Find("Flashlight").GetComponent <Flashlight>().flicker(); yield return(new WaitForSeconds(2.0f)); // Death scene if (!GameObject.Find("Inventory").GetComponent <Inventory>().hasFlashlight()) { audioSource.PlayOneShot(breathing, 0.8f); GameObject.Find("Wardrobe").GetComponent <AudioSource>().Play(); modalPanel.Choice("Was that... the door to the wardrobe?", 2f, 1f); yield return(new WaitForSeconds(12.0f)); GameObject.Find("Camera").GetComponent <jumpScare>().scareStart(); GameObject.Find("Plane").GetComponent <Fade>().fadeOut(3f, false); endPanel.ShowEndCard("I couldn't flee, I couldn't fight her... Now I'm stuck here with her... forever", 2f, 8f, 0f); } // You have a flashlight else { yield return(new WaitForSeconds(10.0f)); GameObject.Find("BedroomDoor").GetComponent <OpenDoor>().unlockDoor(); GameObject.Find("BedroomDoor").GetComponent <OpenDoor>().openDoor(); RenderSettings.ambientIntensity = originalAmbientIntensity; } }
public void DeleteProfiles() { //Confirm that profiles are going to be deleted. ModalPanel modalPanel = ModalPanel.Instance(); modalPanel.Choice("Delete profiles?", ConfirmProfileDeletion, AbortAction); }
private void TryBuyUpgrade() { if (Player.Coins >= cost) { DBController.buyUpgrade(upgradeName); Player.Coins -= cost; } else { string message = "Not enough coins\nYou are missing " + (cost - Player.Coins) + ". Play some more games and come back!"; modalPanel.Choice(message, new UnityAction(EquipUpgrade), new UnityAction(DoNothing), new UnityAction(DoNothing)); } Utils.ReloadScene(); }
//Choose whether to build a level or dome public override void BuildBlock() { if (GameManager.instance.gameUI.GetComponent <TileSelector>().GetSelectedSpace().GetSpaceFloorLevel() < FloorLevel.third) { modalPanel.Choice("Build a block or a dome?\n", "Block", "Dome", button1Action, button2Action); } else { BuildLevel(); } }
public override void ExitBuildState() { if (GameManager.instance.gameUI.GetComponent <TileSelector>().GetSelectedSpace().GetSpaceFloorLevel() < FloorLevel.third) { modalPanel.Choice("Build a second block on top of the first build?\n", "Yes", "No", button1Action, button2Action); } else { base.ExitBuildState(); } }
// Send to the Modal Panel to set up the Buttons and Functions to call public void TestOption() { GeraGrids.blocks.gameObject.SetActive(false); vezDoJogador = " Vez do Jogador 2"; if (GeraGrids.player) { vezDoJogador = " Vez do Jogador 1"; } modalPanel.Choice("\n Qual o nome do elemento encontrado?", elemento - 1); }
public override void ExitBuildState() { if (firstBuild) { modalPanel.Choice("Build a second time?\n(If yes, cannot build on the same space.)", "Yes", "No", button1Action, button2Action); } else { firstBuild = true; firstBuildSpace = null; base.ExitBuildState(); } }
void prepareQuestion(DialogNode n) { List <string> dkeyStrings = new List <string>(); List <string> textStrings = new List <string>(); foreach (Link l in n.Neighbors) { dkeyStrings.Add(l.Neighbor.DKey); textStrings.Add(l.Neighbor.GetText()); } modalPanel.Choice(n.GetText(), dkeyStrings, textStrings, () => { TestResponse(dialogkey); }); }
/*displaying the modal panel will be initiated by the collision of game objects*/ public void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") //only show the panel if it is the player that collided with teh NPC { if (GameController.controller.questActive) //if player is already on quest, don't offer it again { if (!GameController.controller.hasQuestItem) //see if player does not have quest item { modalPanel.Choice("We can't waste any more time - go get that salsa recipe!", myOkayAction); } //if not, always show this message else { switch (GameController.controller.npcMessageCount) //if player does have quest option, rotate through these 3 messages based on the message count { case 0: modalPanel.Choice("You got the recipe! You should hold onto it for a while. It could come in handy later.", myOkayAction); GameController.controller.npcMessageCount++; break; case 1: modalPanel.Choice("Yeah that's really all the content we have right now. Try again later.", myOkayAction); GameController.controller.npcMessageCount++; break; case 2: modalPanel.Choice("Seriously, that's all there is to do right now.", myOkayAction); GameController.controller.npcMessageCount = 0; break; } } } else { { modalPanel.Choice("These are dark times for Fribrary - kitchen bots are going wild. Will you get me the salsa recipe?", //player does not have the quest - offer it myYesAction, myNoAction); } } } }
void OnPlayChallengeComplete(bool success, ChallengeData info) { HideBlackLoaderPanel(); GameControl.instance.OnPlayChallengeComplete -= OnPlayChallengeComplete; GameControl.instance.selectedResource = info.resourceid; if (success) // first time accepting challenge check { _modalPanel.Choice("Play with " + info.frienduser.Split(' ')[0], "Challenge Now?", _mChallengeYesAction, _mChallengeNoAction); } else // it will fail if we already accepted previously { if (info.usercompleted == 1) // check if we already played { //Debug.Log("Challenge Completed"); } else // If we are here, this means user already completed the challenge { // _modalPanel.Choice ("Challenge Already Played", "Play Now?", _mChallengeYesAction, _mChallengeNoAction); } } }
public void validateUserName() { MatchCollection result = alphaRegex.Matches(usernameInput.text); if (result.Count == usernameInput.text.Length) { GameController.controller.playerName = usernameInput.text; //store the player name entered SceneManager.LoadScene(1); //load the Main Level scene } else { modalPanel.Choice("Player name can only contain letters!", myOkayAction); } }
// Send to the Modal Panel to set up the Buttons and Functions to call public void DBConnectionError(string host, string username, string password, string database) { ModalPanelDetails modalPanelDetails = new ModalPanelDetails(); modalPanelDetails.displayText = "Error al conectar con la Base de Datos."; modalPanelDetails.inputPanel = true; modalPanelDetails.input1Details = new InputLineDetails(true, "Host", host); modalPanelDetails.input2Details = new InputLineDetails(true, "Username", username); modalPanelDetails.input3Details = new InputLineDetails(true, "Password", password); modalPanelDetails.input4Details = new InputLineDetails(true, "Database", database); modalPanelDetails.button1Details = new EventButtonDetails("Reintentar", RetryDBConnectionFunction); modalPanelDetails.button2Details = new EventButtonDetails("Salir", Quit); modalPanel.Choice(modalPanelDetails); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.transform.name == "Water") { moveCamPos(2, 1, -13); modalPanel.Choice("Flavor text", waterYesAction, waterNoAction, waterCancelAction, waterLastAction); } if (hit.transform.name == "Wood") { moveCamPos(14, 1, -4); modalPanel.Choice("Flavor text", woodYesAction, woodNoAction, woodCancelAction, woodLastAction); } if (hit.transform.name == "Iron") { moveCamPos(-1, 1, 6); modalPanel.Choice("Flavor text", ironYesAction, ironNoAction, ironCancelAction, ironLastAction); } if (hit.transform.name == "Earth") { moveCamPos(-7, 1, -4); modalPanel.Choice("Flavor text", earthYesAction, earthNoAction, earthCancelAction, earthLastAction); } if (hit.transform.name == "Fire") { moveCamPos(7, 1, 6); modalPanel.Choice("Flavor text", fireYesAction, fireNoAction, fireCancelAction, fireLastAction); } } } }
// accept button for New Challenges void OnNewChallengeItemAcceptClick(ChallengeData challengeData) { // print ("OnNewChallengeItemAcceptClick() " + challengeData.username + " a: " + challengeData.auth); GameControl.instance.soundManager.PlayLowToneButton(); GameControl.instance.challengeAuth = challengeData.auth; _modalPanel.Choice("Accept challenge against", challengeData.username.Split(' ')[0] + "?", _mAcceptChallengeYesAction, _mChallengeNoAction); }
public void SaveArmorProfile() { //Check for blank strings before continuing for (int x = 0; x < CharacterArmor.ARMOR_LOCATIONS; x++) { if (armorInputFields[x].text == "") { ModalPanel modalPanel = ModalPanel.Instance(); modalPanel.Choice("One of the armor fields is blank! This will be marked as 0 armor! Continue?", FinishSaveProfile, AbortAction); return; } } FinishSaveProfile(); }
//send to the modal panel to set up the buttons and functions to call // public void TestButtons() { //modalPanel.Choice ("Please make a choice\nTest them all", myResponse1Action, myResponse2Action, myResponse3Action); // modalPanel.Choice ("Please make a choice\nTest them all", TestResponse1, TestResponse2,TestResponse3); // } // public void TestButtonsImage() { // modalPanel.Choice ("This is the guard\nPlease test the buttons below", icon, TestResponse1, TestResponse2,TestResponse3); // } public void OnTriggerEnter(Collider col) { // If the colliding gameobject is the player... if (col.CompareTag("Player")) { Debug.Log("guard trigger"); if (isBellRung) { currentTalk = timesBellRung; isBellRung = false; } talk = database.talkList [currentTalk]; modalPanel.Choice(talk.talkSpeech, icon, talk.talkResponse, TestResponse1, talk.talkResponse1, TestResponse2, talk.talkResponse2, TestResponse3); } }
public void popupSaveConfirm() { ModalPanelDetails details = new ModalPanelDetails() { question = "Do you want to save the progress?" }; details.buttondetails = new EventButtonDetails[2]; details.buttondetails[0] = new EventButtonDetails() { title = "OK", action = OKCallback }; details.buttondetails[1] = new EventButtonDetails() { title = "Cancel", action = CancelCallback }; modalPanel.Choice(details); }
public void showConfirmDialog(string title, string message, int tag, bool multi) { modalPanel = ModalPanel.Instance(); if (multi) { modalPanel.Choice(title, message, () => { PostYesFunction(tag); }, () => { PostNoFunction(tag); }); } else { modalPanel.Choice2(title, message, () => { PostYesFunction(tag); }, () => { PostNoFunction(tag); }); } }
public void Exec() { string msg = ""; int fate = 0; fate = Random.Range(0, 2); if (fate == 0) { msg = "As you carve your way through rust and filth of the Old World, " + "a pack of wild dogs crosses your path! They look quite delighted " + "to have finally found such a rare treat..."; } else if (fate == 1) { msg = "You make a stop to take some rest from driving and check the state of your trusty vehicle's parts. " + "As you fiddle with the insides of your only friend and hope for survival, " + "a swarm of radroaches crawls out of a nearby pile of trash. " + "It seems that they are quite interested in what you are doing. Or specifically in you.\nRadroaches are hard to read..."; } //Time.timeScale = 0.0f; modalPanel.Choice(msg, leftAction, rightAction); }
public void OnSubmitClick() { string questionText = questionInput.text; if (string.IsNullOrEmpty(questionText)) { displayManager.DisplayMessage("Please input the equation!"); return; } // Add a new question if (Constant.EditingQuestionIndex < 0) { Question question = new Question(); question.info = questionText; question.answer = GetCurrentAnwser(); dataManager.questionData.questions.Add(question); dataManager.SaveQuestionData(); // Show Message box ModalPanel modalPanel = ModalPanel.Instance(); modalPanel.Choice("The question is successfully added!"); // Clear the equation input questionInput.text = ""; ResetAnwser(); } // Update the question else { Question question = dataManager.questionData.questions[Constant.EditingQuestionIndex]; question.info = questionText; question.answer = GetCurrentAnwser(); dataManager.SaveQuestionData(); SceneManager.LoadScene(Constant.SCENE_TEACHER_MODIFY_QUESTION); } }
public void CheckAnswer() { if (CompareAnswer(GetCurrentAnwser(), currentQuestion.answer)) { // Display correct answer displayManager.DisplayMessage("Correct"); // Increase score score += 10; scoreText.text = $"Score : {score}"; // Check win condition if (score >= 30) { modalPanel.Choice("You Won!", onWonOk); } else { PickRandomQuestion(); } } }
public void ReloadCourseViewScene() { modalPanel.Choice("Are you sure you want to reset all?\nThis Course Step will reload.", yesReloadCourseViewScene, noReloadCourseViewScene); }