/* * public void TestYNC() * { * npcPanelObject.SetActive(true); * // modalPanel.Choice("Would you like to answer?\n Maybe?", myYesAction, myNoAction, myCancelAction); * } * public void TestC() * { * npcPanelObject.SetActive(true); * // modalPanel.Choice("Hello.", myCancelAction); * ModalPanelDetails modalPanelDetails = new ModalPanelDetails { npc = "Hello." }; * modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Hey.", action = myCancelAction }; * modalPanel.NewChoice(modalPanelDetails); * } */ /// <summary> /// Something the npc says and what you can answer. /// Then sets the panel inactive. /// </summary> public void NPC2() { npcPanelObject.SetActive(true); // modalPanel.Choice("Lol hey let's party!", myYesAction, myNoAction, myCancelAction); ModalPanelDetails modalPanelDetails = new ModalPanelDetails { npc = "Hey you." }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Hey.", action = myYesAction }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "Bye.", action = myNoAction }; modalPanelDetails.button3Details = new EventButtonDetails { buttonTitle = "Sup?", action = myCancelAction }; Debug.Log("Button pressed / NPC3"); if (movement.IsMoving() == false) { Debug.Log("Moving false"); modalPanel.NewChoice(modalPanelDetails); // npcPanelObject.SetActive(false); } else { Debug.Log("moving not false"); } }
void Update() { if (interactable) { if (Input.GetKeyUp("e")) { if (modalPanel.modalPanelObject.activeInHierarchy) { modalPanel.ClosePanel(); GameInformation.PlayerControllable = true; interactions++; GameInformation.AddInteraction(this.gameObject.name, interactions); SendMessage("ResetFacing"); } else { GameInformation.PlayerControllable = false; SendMessage("FaceThePlayer"); ModalPanelDetails modalPanelDetails = new ModalPanelDetails(); string temp = DialogueData.LoadFromXML(dialogID); modalPanelDetails.text = temp.Replace("PlayerName", GameInformation.PlayerName); modalPanelDetails.title = this.gameObject.name; modalPanelDetails.iconImage = spriteRenderer.sprite; modalPanel.NewChoice(modalPanelDetails); } } } }
public override void OnEnter() { if (ModalPanelHandle.handleMain != null) { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { message = messageText.Value }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Yes", action = OnClickYes }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "No", action = OnClickNo }; modalPanelDetails.button3Details = new EventButtonDetails { buttonTitle = "Cancel", action = OnClickCancel }; ModalPanelHandle.handleMain.OpenPanel(modalPanelDetails); } Finish(); }
public void TryToAddCharacterToRobbery(Character character, RobberyType robType, int locNum) { if (character.Stats.Health <= 10) { EventButtonDetails yesButton = new EventButtonDetails { buttonText = "Да мне плевать", action = () => { DataScript.EData.RobberiesData[robType][locNum].AddCharacter(character); } }; EventButtonDetails noButton = new EventButtonDetails { buttonText = "Ладно, отдыхай", action = UIManager.modalPanel.ClosePanel }; ModalPanelDetails details = new ModalPanelDetails { button0Details = yesButton, button1Details = noButton, imageSprite = character.Sprite, text = "Босс, может мне лучше в больницу?", titletext = character.Name }; UIManager.modalPanel.CallModalPanel(details); } else if (character.Status == CharacterStatus.Normal) { DataScript.EData.RobberiesData[robType][locNum].AddCharacter(character); } }
// Send to the Modal Panel to set up the Buttons and functions to call public void TestC(string useTitle) { ModalPanelDetails modalPanelDetails = new ModalPanelDetails(); modalPanelDetails.panelLocation = Input.mousePosition; modalPanelDetails.question = "This is an announcement!\nIf you don't like it, shove off!"; modalPanelDetails.button1Details = new EventButtonDetails(); modalPanelDetails.button1Details.buttonTitle = useTitle; if (!objectClicked) { modalPanelDetails.button1Details.action = TestWalkFunction; } else { modalPanelDetails.button1Details.action = TestUseFunction; } modalPanelDetails.button2Details = new EventButtonDetails(); modalPanelDetails.button2Details.buttonTitle = "Examine"; modalPanelDetails.button2Details.action = TestExamineFunction; modalPanelDetails.button3Details = new EventButtonDetails(); modalPanelDetails.button3Details.buttonTitle = "Cancel"; modalPanelDetails.button3Details.action = TestCancelFunction; modalPanel.NewChoice(modalPanelDetails); }
public void TryToStartNight() { foreach (Character character in DataScript.ChData.PanelCharacters) { if (character.Status == CharacterStatus.Arrested) { if (character.DaysLeft < 2) { EventButtonDetails yesButton = new EventButtonDetails { buttonText = "Да", action = StartNight }; EventButtonDetails noButton = new EventButtonDetails { buttonText = "Нет", action = UIManager.modalPanel.ClosePanel }; ModalPanelDetails details = new ModalPanelDetails { button0Details = yesButton, button1Details = noButton, imageSprite = character.Sprite, text = "Этот персонаж скоро нас сдаст. Босс, ты уверен, что стоит оставить его в грязных руках копов?", titletext = character.Name }; UIManager.modalPanel.CallModalPanel(details); return; } } } StartNight(); }
public void TextWindow(ModalPanelDetails details) { modalPanelObject.SetActive(true); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); dropdown.gameObject.SetActive(false); this.text.text = details.text; if (details.dropdown) { dropdown.gameObject.SetActive(true); } button1.onClick.RemoveAllListeners(); button1.onClick.AddListener(details.button1Details.action); if (details.dropdown) { button1.onClick.AddListener(ResetDropdownValue); } button1.onClick.AddListener(ClosePanel); button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive(true); if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } }
void Update() { if (interactable) { if(Input.GetKeyUp("e")) { if (modalPanel.modalPanelObject.activeInHierarchy) { modalPanel.ClosePanel (); GameInformation.PlayerControllable = true; interactions++; GameInformation.AddInteraction (this.gameObject.name, interactions); SendMessage ("ResetFacing"); } else { GameInformation.PlayerControllable = false; SendMessage ("FaceThePlayer"); ModalPanelDetails modalPanelDetails = new ModalPanelDetails (); string temp = DialogueData.LoadFromXML (dialogID); modalPanelDetails.text = temp.Replace ("PlayerName", GameInformation.PlayerName); modalPanelDetails.title = this.gameObject.name; modalPanelDetails.iconImage = spriteRenderer.sprite; modalPanel.NewChoice (modalPanelDetails); } } } }
//using PlayerGenChoice public void TestGenChoice() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails {question = "This is an announcement!\nIf you don't like it, shove off!" }; modalPanelDetails.button1Details = new EventButtonDetails{buttonTitle = "Gotcha!", action = TestOpt3}; modalPanel.PlayerGenChoice(modalPanelDetails); }
public void TestModalPanelDetails() { ModalPanelDetails details = new ModalPanelDetails("", "Do you want to change background image?", icon); details.button1 = new EventButtonDetails(yes, null, TestYesFunction); details.button2 = new EventButtonDetails(no, null, TestNoFunction); modalPanel.EnableModal(details); }
public void NewChoice(ModalPanelDetails details) { modalPanelObject.SetActive(true); this.iconImage.gameObject.SetActive(false); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); button4.gameObject.SetActive (false); title.text = ""; text.text = ""; title.text = details.title; StartCoroutine(TypeText(details.text)); if (details.iconImage) { this.iconImage.sprite = details.iconImage; this.iconImage.gameObject.SetActive(true); } if (details.button1Details != null) { button1.onClick.RemoveAllListeners (); button1.onClick.AddListener (details.button1Details.action); button1.onClick.AddListener (ClosePanel); button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive (true); } if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } if (details.button3Details != null) { button3.onClick.RemoveAllListeners(); button3.onClick.AddListener(details.button3Details.action); button3.onClick.AddListener(ClosePanel); button3Text.text = details.button3Details.buttonTitle; button3.gameObject.SetActive(true); } if (details.button4Details != null) { button4.onClick.RemoveAllListeners(); button4.onClick.AddListener(details.button4Details.action); button4.onClick.AddListener(ClosePanel); button4Text.text = details.button4Details.buttonTitle; button4.gameObject.SetActive(true); } }
public void NewChoice(ModalPanelDetails details) { modalPanelObject.SetActive(true); this.iconImage.gameObject.SetActive(false); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); button4.gameObject.SetActive(false); title.text = ""; text.text = ""; title.text = details.title; StartCoroutine(TypeText(details.text)); if (details.iconImage) { this.iconImage.sprite = details.iconImage; this.iconImage.gameObject.SetActive(true); } if (details.button1Details != null) { button1.onClick.RemoveAllListeners(); button1.onClick.AddListener(details.button1Details.action); button1.onClick.AddListener(ClosePanel); button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive(true); } if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } if (details.button3Details != null) { button3.onClick.RemoveAllListeners(); button3.onClick.AddListener(details.button3Details.action); button3.onClick.AddListener(ClosePanel); button3Text.text = details.button3Details.buttonTitle; button3.gameObject.SetActive(true); } if (details.button4Details != null) { button4.onClick.RemoveAllListeners(); button4.onClick.AddListener(details.button4Details.action); button4.onClick.AddListener(ClosePanel); button4Text.text = details.button4Details.buttonTitle; button4.gameObject.SetActive(true); } }
void SpawnPanel(string mainTitle, string titleDescription, EventButtonDetails button1, EventButtonDetails button2 = null, Sprite icon = null) { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { shortText = mainTitle, description = titleDescription, iconImage = icon }; modalPanelDetails.button1Details = button1; modalPanelDetails.button2Details = button2; modalPanel.SpawnWithDetails(modalPanelDetails); }
private UnityAction myYesAction; // #endregion Fields #region Methods //testing initialisers public void TestIC() { //this initialiser deals with the elements that will appear on the panel ModalPanelDetails modalPanelDetails = new ModalPanelDetails {iconImage = icon, question = "This is an announcement about my lovely new icon"}; //this initialiser deals with the elemtsn that will appear on the button modalPanelDetails.button1Details = new EventButtonDetails {buttonTitle = "Attention!", action = TestCancelFunc}; modalPanel.NewChoice(modalPanelDetails); // modalPanel.Choice ("This is an announcement", myCancelAction, icon); }
//example use case 1. Assing directly public void TestExample1() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails(); modalPanelDetails.shortText = "This is an announcement!\nIf you don't like it, shove off!"; modalPanelDetails.button1Details = new EventButtonDetails(); modalPanelDetails.button1Details.buttonTitle = "Gotcha!"; modalPanelDetails.button1Details.action = TestCancelFunction; modalPanel.SpawnWithDetails(modalPanelDetails); }
// Send to the Modal Panel to set up the Buttons and functions to call public void TestC() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails(); modalPanelDetails.question = "This is an announcement!\nIf you don't like it, shove off!"; modalPanelDetails.button1Details = new EventButtonDetails(); modalPanelDetails.button1Details.buttonTitle = "Gotcha!"; modalPanelDetails.button1Details.action = TestCancelFunction; modalPanel.NewChoice(modalPanelDetails); }
//using PlayerGenChoice public void TestGenChoice() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { question = "This is an announcement!\nIf you don't like it, shove off!" }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Gotcha!", action = TestOpt3 }; modalPanel.PlayerGenChoice(modalPanelDetails); }
public void TestC() { // modalPanel.Choice("Hello.", myCancelAction); ModalPanelDetails modalPanelDetails = new ModalPanelDetails { npc = "Hello." }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Hey.", action = myCancelAction }; modalPanel.NewChoice(modalPanelDetails); }
public void WinWindow() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { text = "Player " + (theStateManager.currentPlayer + 1) + " Won!" }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Close", action = DoNothing }; modalPanel.TextWindow(modalPanelDetails); }
public void TestIconYNC() { //this uses the constructor defined in the ModalPanel script, see there for more details - this just takes the actions declared in the functions below and executes them // modalPanel.Choice("Do you like the iocn?", icon, myYesAction, myNoAction, myCancelAction); ModalPanelDetails modalPanelDetails = new ModalPanelDetails {title = "Important!", question = "Do you like this icon?", iconImage = icon}; modalPanelDetails.button1Details = new EventButtonDetails {buttonTitle = "Hell yeah!", action = TestYesFunc}; modalPanelDetails.button2Details = new EventButtonDetails {buttonTitle = "Hell no!", action = TestNoFunc}; modalPanelDetails.button3Details = new EventButtonDetails {buttonTitle = "Cancel, go away!", action = TestCancelFunc}; modalPanel.NewChoice (modalPanelDetails); }
public void PlayerNumberWindow() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { text = "Please choose the number of players:" }; modalPanelDetails.dropdown = true; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Play", action = instantiatePlayers }; modalPanel.TextWindow(modalPanelDetails); }
public void MoveWindow() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { text = "Please throw the dice and choose the total of the upper face of the dice:" }; modalPanelDetails.dropdown = true; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Move", action = MoveForward }; modalPanel.TextWindow(modalPanelDetails); }
// 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); }
public void TestLambda() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { question = "Do you want to create three things?" }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Yes Please!", action = () => { InstantiateObject(thingToSpawn); InstantiateObject(thingToSpawn, thingToSpawn); } }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "No thanks!", action = TestOpt2 }; modalPanel.PlayerGenChoice(modalPanelDetails); }
// public void TestYN () { // modalPanel.Choice ("Cheese on your burger?", TestYesFunction, TestNoFunction); // } // // public void TestYNC () { // modalPanel.Choice ("Would you like a poke in the eye?\nHow about with a sharp stick?", TestYesFunction, TestNoFunction, TestCancelFunction); // } // // public void TestYNI () { // modalPanel.Choice ("Do you like this icon?", icon, TestYesFunction, TestNoFunction, TestCancelFunction); // } // // public void TestYNCI () { // modalPanel.Choice ("Do you want to use this icon?", icon, TestYesFunction, TestNoFunction, TestCancelFunction); // } // // public void TestLambda () { // modalPanel.Choice ("Do you want to create this sphere?", () => { InstantiateObject(thingToSpawn); }, TestNoFunction); // } // // public void TestLambda2 () { // modalPanel.Choice ("Do you want to create two spheres?", () => { InstantiateObject(thingToSpawn, thingToSpawn); }, TestNoFunction); // } public void TestLambda3() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { question = "Do you want to create three spheres?" }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Yes Please!", action = () => { InstantiateObject(thingToSpawn); InstantiateObject(thingToSpawn, thingToSpawn); } }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "No thanks!", action = TestNoFunction }; modalPanel.NewChoice(modalPanelDetails); }
public void ChallengeWindow() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { text = "This is the challenge ..." }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Success", action = challengeSuccess }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "Failed", action = challengeFailed }; modalPanel.TextWindow(modalPanelDetails); }
public void MissionWindow() { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { text = "This is the mission ..." }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Success", action = missionSuccess }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "Failed", action = missionFailed }; modalPanel.TextWindow(modalPanelDetails); }
public void NPC2() { // modalPanel.Choice("Lol hey let's party!", myYesAction, myNoAction, myCancelAction); ModalPanelDetails modalPanelDetails = new ModalPanelDetails { npc = "Sup." }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "Bye.", action = myYesAction }; modalPanelDetails.button2Details = new EventButtonDetails { buttonTitle = "Eww.", action = myNoAction }; modalPanelDetails.button3Details = new EventButtonDetails { buttonTitle = "Yo.", action = myCancelAction }; modalPanel.NewChoice(modalPanelDetails); }
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 CallModalPanel(ModalPanelDetails details) { button0.gameObject.SetActive(false); button1.gameObject.SetActive(false); iconImage.gameObject.SetActive(false); image.gameObject.SetActive(false); titleText.text = details.titletext; text.text = details.text; if (details.imageSprite) { image.sprite = details.imageSprite; image.gameObject.SetActive(true); } if (details.iconSprite) { iconImage.sprite = details.iconSprite; iconImage.gameObject.SetActive(true); } if (details.button0Details != null) { button0.onClick.RemoveAllListeners(); button0.onClick.AddListener(details.button0Details.action); button0.onClick.AddListener(ClosePanel); button0Text.text = details.button0Details.buttonText; button0.gameObject.SetActive(true); } if (details.button1Details != null) { button1.onClick.RemoveAllListeners(); button1.onClick.AddListener(details.button1Details.action); button1.onClick.AddListener(ClosePanel); button1Text.text = details.button1Details.buttonText; button1.gameObject.SetActive(true); } modalPanelObject.transform.SetAsLastSibling(); modalPanelObject.SetActive(true); }
// // Announcement with Image: A string, a Sprite and Cancel event; // public void Choice (string question, UnityAction cancelEvent, Sprite iconImage = null) { // modalPanelObject.SetActive (true); // // button3.onClick.RemoveAllListeners(); // button3.onClick.AddListener (cancelEvent); // button3.onClick.AddListener (ClosePanel); // // this.question.text = question; // if (iconImage) // this.iconImage.sprite = iconImage; // // if (iconImage) // this.iconImage.gameObject.SetActive(true); // else // this.iconImage.gameObject.SetActive(false); // button1.gameObject.SetActive(false); // button2.gameObject.SetActive(false); // button3.gameObject.SetActive(true); // } public void NewChoice(ModalPanelDetails details) { modalPanelObject.SetActive(true); modalPanelObject.transform.position = details.panelLocation; this.iconImage.gameObject.SetActive(false); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); this.question.text = details.question; if (details.iconImage) { this.iconImage.sprite = details.iconImage; this.iconImage.gameObject.SetActive(true); } button1.onClick.RemoveAllListeners(); button1.onClick.AddListener(details.button1Details.action); button1.onClick.AddListener(ClosePanel); button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive(true); if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } if (details.button3Details != null) { button3.onClick.RemoveAllListeners(); button3.onClick.AddListener(details.button3Details.action); button3.onClick.AddListener(ClosePanel); button3Text.text = details.button3Details.buttonTitle; button3.gameObject.SetActive(true); } }
public override void OnEnter() { if (ModalPanelHandle.handleMain != null) { ModalPanelDetails modalPanelDetails = new ModalPanelDetails { message = messageText.Value }; modalPanelDetails.button1Details = new EventButtonDetails { buttonTitle = "OK", action = OnClickOk }; ModalPanelHandle.handleMain.OpenPanel(modalPanelDetails); } Finish(); }
public void NewChoice(ModalPanelDetails details) { modalPanelObject.SetActive(true); this.iconImage.gameObject.SetActive(false); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); this.question.text = details.question; if (details.iconImage) { this.iconImage.sprite = details.iconImage; this.iconImage.gameObject.SetActive(true); } button1.onClick.RemoveAllListeners(); button1.onClick.AddListener(details.button1Details.action); button1.onClick.AddListener(ClosePanel); button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive(true); if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } if (details.button3Details != null) { button3.onClick.RemoveAllListeners(); button3.onClick.AddListener(details.button3Details.action); button3.onClick.AddListener(ClosePanel); button3Text.text = details.button3Details.buttonTitle; button3.gameObject.SetActive(true); } }
// how to choose an option on the dialogue box // UnityAction - pointer to a function public void PlayerGenChoice(ModalPanelDetails details) { modalPanelObject.SetActive(true); this.iconImage.gameObject.SetActive(false); opt1Button.gameObject.SetActive(false); opt2Button.gameObject.SetActive(false); opt3Button.gameObject.SetActive(false); this.question.text = details.question; if (details.iconImage) { this.iconImage.sprite = details.iconImage; this.iconImage.gameObject.SetActive(true); } opt1Button.onClick.RemoveAllListeners(); opt1Button.onClick.AddListener(details.button1Details.action); opt1Button.onClick.AddListener(ClosePanel); opt1Text.text = details.button1Details.buttonTitle; opt1Button.gameObject.SetActive(true); if (details.button2Details != null) { opt2Button.onClick.RemoveAllListeners(); opt2Button.onClick.AddListener(details.button2Details.action); opt2Button.onClick.AddListener(ClosePanel); opt2Text.text = details.button2Details.buttonTitle; opt2Button.gameObject.SetActive(true); } if (details.button3Details != null) { opt3Button.onClick.RemoveAllListeners(); opt3Button.onClick.AddListener(details.button3Details.action); opt3Button.onClick.AddListener(ClosePanel); opt3Text.text = details.button3Details.buttonTitle; opt3Button.gameObject.SetActive(true); } }
public void Choice(ModalPanelDetails details) { modalPanelObj.SetActive(true); GameManager.Pause(); foreach (Button b in buttons) { b.gameObject.SetActive(false); } question.text = details.question; for (int i = 0; i < details.buttondetails.Length; ++i) { buttons[i].onClick.RemoveAllListeners(); buttons[i].onClick.AddListener(details.buttondetails[i].action); buttons[i].onClick.AddListener(ClosePanel); buttonTexts[i].text = details.buttondetails[i].title; buttons[i].gameObject.SetActive(true); } }
public void NewGame() { EventButtonDetails yesButton = new EventButtonDetails { buttonText = "Да", action = () => { SceneManager.LoadScene("Map"); } }; EventButtonDetails noButton = new EventButtonDetails { buttonText = "Нет", action = WM0.modalPanel.ClosePanel }; ModalPanelDetails details = new ModalPanelDetails { button0Details = yesButton, button1Details = noButton, iconSprite = WM0.modalPanel.questionIcon, text = "Вы уверены, что хотите начать новую игру?", titletext = "Новая игра" }; WM0.modalPanel.CallModalPanel(details); }
public void OnKickButtonClick() { EventButtonDetails yesButton = new EventButtonDetails { buttonText = "Да", action = () => DataScript.ChData.RemoveCharacter(m_character) }; EventButtonDetails noButton = new EventButtonDetails { buttonText = "Нет", action = UIManager.modalPanel.ClosePanel }; ModalPanelDetails details = new ModalPanelDetails { button0Details = yesButton, button1Details = noButton, imageSprite = portrait.sprite, text = m_character.Status == CharacterStatus.Arrested ? "Вы уверены что хотите оставить данного персонажа в грязных руках копов? Это скажется на осведомлённости полиции о вашей банде" : "Вы уверены, что хотите выгнать данного персонажа?", titletext = characterName.text }; UIManager.modalPanel.CallModalPanel(details); }
/* * public void Choice(string npc, UnityAction yesEvent, UnityAction noEvent, UnityAction cancelEvent) * { * modalPanelObject.SetActive(true); * button1.onClick.RemoveAllListeners(); * button1.onClick.AddListener(yesEvent); * button1.onClick.AddListener(ClosePanel); * modalPanelObject.SetActive(true); * button2.onClick.RemoveAllListeners(); * button2.onClick.AddListener(noEvent); * button2.onClick.AddListener(ClosePanel); * * modalPanelObject.SetActive(true); * button3.onClick.RemoveAllListeners(); * button3.onClick.AddListener(cancelEvent); * button3.onClick.AddListener(ClosePanel); * * this.npc.text = npc; * button1.gameObject.SetActive(true); * button2.gameObject.SetActive(true); * button3.gameObject.SetActive(true); * } */ public void NewChoice(ModalPanelDetails details) { // movement.StopMoving(); modalPanelObject.SetActive(true); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); button3.gameObject.SetActive(false); this.npc.text = details.npc; // StopTime(); button1.onClick.RemoveAllListeners(); button1.onClick.AddListener(details.button1Details.action); button1.onClick.AddListener(ClosePanel); // button1.onClick.AddListener(StartTime); button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive(true); if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); // button2.onClick.AddListener(StartTime); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } if (details.button3Details != null) { button3.onClick.RemoveAllListeners(); button3.onClick.AddListener(details.button3Details.action); button3.onClick.AddListener(ClosePanel); // button3.onClick.AddListener(StartTime); button3Text.text = details.button3Details.buttonTitle; button3.gameObject.SetActive(true); } }
public void EnableModal(ModalPanelDetails details) { modalPanel.SetActive(true); Debug.Assert(buttons.Length >= 3, "Modal panel requires 3+ buttons."); if (buttons.Length >= 3) { SetButtonDetails(0, ref details.button1); SetButtonDetails(1, ref details.button2); SetButtonDetails(2, ref details.button3); } this.questions.text = details.context; if (details.iconImage != null) { this.icon.sprite = details.iconImage; this.icon.gameObject.SetActive(true); } else { this.icon.gameObject.SetActive(false); } }
public void NewChoice(ModalPanelDetails details) { modalPanelObj.SetActive(true); //turns on the panel if (details.iconImage) { this.iconImage.sprite = details.iconImage; } if (details.iconImage) { this.iconImage.gameObject.SetActive(true); //a reference to the icon image for the window } else { this.iconImage.gameObject.SetActive(false); //a reference to the icon image for the window } this.questionText.text = details.question; //sets the questionText in the UI to be equal to the question defined in the paramter, this will always be on in every instance, so don't change it's active button1.gameObject.SetActive(false); //sets the yesButton's gameobject to be active button2.gameObject.SetActive(false); //ditto above, except for the noButton button3.gameObject.SetActive(false); //ditto above, except for the cancelButton button1.onClick.RemoveAllListeners(); //this removes any possibility that the yesButton is 'listening' for a particular event, creates a safety net in case this function is re-used or another is used button1.onClick.AddListener(details.button1Details.action); //this adds a listener to activate the 'yesEvent' and activates it when used button1.onClick.AddListener(ClosePanel); //closes the panel button1Text.text = details.button1Details.buttonTitle; button1.gameObject.SetActive(true); if (details.button2Details != null) { button2.onClick.RemoveAllListeners(); button2.onClick.AddListener(details.button2Details.action); button2.onClick.AddListener(ClosePanel); button2Text.text = details.button2Details.buttonTitle; button2.gameObject.SetActive(true); } if (details.button3Details != null) { button3.onClick.RemoveAllListeners(); button3.onClick.AddListener(details.button3Details.action); button3.onClick.AddListener(ClosePanel); button3Text.text = details.button3Details.buttonTitle; button3.gameObject.SetActive(true); } }