예제 #1
0
    public void ExitGame()
    {
        SetInterfaces();

        popupSettings = new Popup("Do you want to leave the game?", "Exit", "Cancel", "Exit Game");
        popup.ShowPopup(PopupManager.Popup.TwoButtons, popupSettings, () => { Debug.Log("[ExampleSingelton] : exit game"); Application.Quit(); });
    }
예제 #2
0
    public void Buy()
    {
        SetInterfaces();

        popupSettings = new Popup("Do you want to buy 15 swords?", "Buy", "Cancel", "Shop");
        popup.ShowPopup(PopupManager.Popup.TwoButtons, popupSettings, BuyItem, null);
    }
예제 #3
0
    public void TimeClose()
    {
        SetInterfaces();

        popupSettings = new Popup("Popup will close in...", null, null, null, 4);
        popup.ShowPopup(PopupManager.Popup.TimeInformation, popupSettings);
    }
예제 #4
0
    private void OneButton(IPopupSettings popupSettings)
    {
        btnRight.gameObject.SetActive(true);
        btnLeft.gameObject.SetActive(false);

        title.text       = popupSettings.Title;
        information.text = popupSettings.Information;
        txtRight.text    = popupSettings.ButtonRight;
    }
예제 #5
0
    //########################################################
    // popup settings
    //########################################################
    private void TimeInformation(IPopupSettings popupSettings)
    {
        btnRight.gameObject.SetActive(false);
        btnLeft.gameObject.SetActive(false);

        title.text = popupSettings.Title;

        StartCoroutine(TimerInformationPopup(popupSettings));
    }
예제 #6
0
    //########################################################
    // examples of using popups
    //########################################################
    public void LevelUp()
    {
        SetInterfaces();

        level++;

        popupSettings = new Popup("You have reached level " + level.ToString(), "OK", null, "Congratulations!");
        popup.ShowPopup(PopupManager.Popup.OneButton, popupSettings, null, null);
        Debug.Log(popupSettings.Information + " " + popupSettings.ButtonLeft.ToString());
    }
예제 #7
0
    IEnumerator TimerInformationPopup(IPopupSettings popupSettings)
    {
        for (int i = popupSettings.Timer - 1; 0 <= i; i--)
        {
            information.text = popupSettings.Information + " " + i;
            yield return(new WaitForSeconds(1f));
        }

        HidePopup();
    }
예제 #8
0
    //########################################################
    //  interface implementation
    //  IPopup
    //########################################################
    public void ShowPopup(Popup popupType, IPopupSettings popupSettings, Action right = null, Action left = null)
    {
        buttonLeft  = left;
        buttonRight = right;

        popup.SetActive(true);
        background.SetActive(true);

        switch (popupType)
        {
        case Popup.TimeInformation:
            TimeInformation(popupSettings);
            break;

        case Popup.OneButton:
            OneButton(popupSettings);
            break;

        case Popup.TwoButtons:
            TwoButtons(popupSettings);
            break;
        }
    }
예제 #9
0
 //########################################################
 // popup delegates
 //########################################################
 private void BuyItem()
 {
     popupSettings = new Popup("You bought 15 swords.", "OK");
     popup.ShowPopup(PopupManager.Popup.OneButton, popupSettings, null, null);
 }