Пример #1
0
    /*
     * 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");
        }
    }
Пример #2
0
    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);
                }
            }
        }
    }
Пример #3
0
        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();
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
    //  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);
    }
Пример #6
0
 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();
 }
Пример #7
0
    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);
        }
    }
Пример #8
0
	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);
    }
Пример #10
0
    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);
    }
Пример #11
0
    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);
		}
    }
Пример #12
0
    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);
        }
    }
Пример #13
0
    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);
    }
Пример #14
0
    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);
    }
Пример #15
0
    //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);
    }
Пример #16
0
    //  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);
    }
Пример #17
0
    //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);
    }
Пример #18
0
    public void TestC()
    {
        // modalPanel.Choice("Hello.", myCancelAction);
        ModalPanelDetails modalPanelDetails = new ModalPanelDetails {
            npc = "Hello."
        };

        modalPanelDetails.button1Details = new EventButtonDetails {
            buttonTitle = "Hey.", action = myCancelAction
        };
        modalPanel.NewChoice(modalPanelDetails);
    }
Пример #19
0
    public void WinWindow()
    {
        ModalPanelDetails modalPanelDetails = new ModalPanelDetails {
            text = "Player " + (theStateManager.currentPlayer + 1) + " Won!"
        };

        modalPanelDetails.button1Details = new EventButtonDetails {
            buttonTitle = "Close",
            action      = DoNothing
        };

        modalPanel.TextWindow(modalPanelDetails);
    }
Пример #20
0
    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);
    }
Пример #21
0
    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);
    }
Пример #22
0
    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);
    }
Пример #23
0
    //  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);
    }
Пример #25
0
    //  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);
    }
Пример #26
0
    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);
    }
Пример #27
0
    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);
    }
Пример #28
0
    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);
    }
Пример #30
0
    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);
    }
Пример #31
0
    //  //  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);
        }
    }
Пример #34
0
    // 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);
        }
    }
Пример #35
0
    // 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);
        }
    }
Пример #36
0
    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);
        }
    }
Пример #37
0
        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);
        }
Пример #38
0
        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);
        }
Пример #39
0
    /*
     *  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);
        }
    }
Пример #40
0
    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);
        }
    }
Пример #41
0
    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);
        }
    }