示例#1
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();
 }
示例#2
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);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageDialogDetails"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="button1Details">The button 1 details.</param>
 /// <param name="button2Details">The button 2 details.</param>
 /// <param name="button3Details">The button 3 details.</param>
 public MessageDialogDetails(
     string message,
     EventButtonDetails button1Details,
     EventButtonDetails button2Details = null,
     EventButtonDetails button3Details = null)
     : this(null, message, button1Details, button2Details, button3Details)
 {
 }
示例#4
0
    public void ShowPanel(string title = null, string desc = null)
    {
        EventButtonDetails button1Detail = new EventButtonDetails {
            buttonTitle = "Back to Title", action = ClosePanel
        };

        SpawnPanel(title, desc, button1Detail);
    }
示例#5
0
    void SpawnInEditorWarning()
    {
        DisableLoadingIndicator();
        EventButtonDetails button1Detail = new EventButtonDetails {
            buttonTitle = "OK I understand", action = ContinueSuccess
        };

        SpawnPanel("You run in Editor", "in case of null refrence exception in trivia, please test on a mobile device", button1Detail, null, networkErrorSprite);
    }
示例#6
0
    void ShowFirebaseError()
    {
        DisableLoadingIndicator();
        EventButtonDetails button1Detail = new EventButtonDetails {
            buttonTitle = "Reload", action = ReloadScene
        };

        SpawnPanel("Firebase Error", "please Reload the game", button1Detail);
    }
示例#7
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);
    }
示例#8
0
    void SpawnUpToDatePanel()
    {
        string buttonContinueText = (LocalizationManager.Instance != null) ? LocalizationManager.Instance.GetLocalizedValue("continue_button") : "Continue";
        string triviaUpToDate     = (LocalizationManager.Instance != null) ? LocalizationManager.Instance.GetLocalizedValue("trivia_up_to_date") : "Trivia up to date";

        DisableLoadingIndicator();
        EventButtonDetails button1Detail = new EventButtonDetails {
            buttonTitle = buttonContinueText, action = ContinueSuccess
        };

        SpawnPanel(triviaUpToDate, "", button1Detail);
    }
示例#9
0
    //example use case 2. use from method.
    // two buttons and image
    // SpawnPanel("Test","This is an test of modal panel functionality", button1Detail,button2Detail,icon);
    // one button and image
    // SpawnPanel("Test","This is an test of modal panel functionality", button1Detail,null,icon);
    // one button and no image
    // SpawnPanel("Test","This is an test of modal panel functionality", button1Detail);

    public void TestExample2()
    {
        EventButtonDetails button1Detail = new EventButtonDetails {
            buttonTitle = "Gotcha!", action = TestCancelFunction
        };
        EventButtonDetails button2Detail = new EventButtonDetails {
            buttonTitle = "Gotcha!", action = TestCancelFunctionforExample2ofButton1
        };

        //two buttons and image
        SpawnPanel("Test", "This is an test of modal panel functionality", button1Detail, button2Detail, icon);
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageDialogDetails"/> class.
 /// </summary>
 /// <param name="title">The title.</param>
 /// <param name="message">The message.</param>
 /// <param name="button1Details">The button 1 details.</param>
 /// <param name="button2Details">The button 2 details.</param>
 /// <param name="button3Details">The button 3 details.</param>
 public MessageDialogDetails(
     string title,
     string message,
     EventButtonDetails button1Details,
     EventButtonDetails button2Details,
     EventButtonDetails button3Details)
 {
     this.title = title;
     this.message = message;
     this.button1Details = button1Details;
     this.button2Details = button2Details;
     this.button3Details = button3Details;
 }
示例#11
0
    //ErrorDisplays
    void ShowNetworkError()
    {
        string buttonRetryText    = (LocalizationManager.Instance != null) ? LocalizationManager.Instance.GetLocalizedValue("try_again_button") : " Try Again";
        string buttonContinueText = (LocalizationManager.Instance != null) ? LocalizationManager.Instance.GetLocalizedValue("continue_button") : " Continue";
        string networkTextShort   = (LocalizationManager.Instance != null) ? LocalizationManager.Instance.GetLocalizedValue("Network_error_short") : " Network error";
        string networkTextLong    = (LocalizationManager.Instance != null) ? LocalizationManager.Instance.GetLocalizedValue("Network_error_long") : " please enable network";

        DisableLoadingIndicator();
        EventButtonDetails button1Detail = new EventButtonDetails {
            buttonTitle = buttonRetryText, action = RetryConnection
        };
        EventButtonDetails button2Detail = new EventButtonDetails {
            buttonTitle = buttonContinueText, action = ContinueSuccess
        };

        SpawnPanel(networkTextShort, networkTextLong, button1Detail, button2Detail, networkErrorSprite);
    }
示例#12
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);
        }
示例#13
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);
        }
示例#14
0
        public void TryToAddCharacterToHospital(Character character)
        {
            ModalPanelDetails details;

            if (character.Stats.Health <= 90)
            {
                EventButtonDetails yesButton = new EventButtonDetails {
                    buttonText = "Да",
                    action     = () => { character.AddToHospital(); }
                };
                EventButtonDetails noButton = new EventButtonDetails {
                    buttonText = "Нет",
                    action     = UIManager.modalPanel.ClosePanel
                };
                details = new ModalPanelDetails {
                    button0Details = yesButton,
                    button1Details = noButton,
                    imageSprite    = character.Sprite,
                    text           = "Отправить персонажа на принудительное лечение?",
                    titletext      = character.Name
                };
            }
            else
            {
                EventButtonDetails noButton = new EventButtonDetails {
                    buttonText = "Ну ладно...",
                    action     = UIManager.modalPanel.ClosePanel
                };
                details = new ModalPanelDetails {
                    button1Details = noButton,
                    imageSprite    = character.Sprite,
                    text           = "Босс, я не пойду в больницу из-за этой царапины!",
                    titletext      = character.Name
                };
            }
            UIManager.modalPanel.CallModalPanel(details);
        }
示例#15
0
 public ModalPanelDetails(string ti, string co, Sprite ic, Sprite bkgd = null)
 {
     title = ti;
     context = co;
     iconImage = ic;
     panelBkgdImage = bkgd;
     button1 = null;
     button2 = null;
     button3 = null;
 }
示例#16
0
 public ModalPanelDetails()
 {
     title = "<TITLE>";
     context = "<CONTEXT>";
     iconImage = null;
     panelBkgdImage = null;
     button1 = null;
     button2 = null;
     button3 = null;
 }
示例#17
0
 void SetButtonDetails(int index, ref EventButtonDetails button)
 {
     if (button != null) {
         buttons[index].onClick.RemoveAllListeners();
         buttons[index].onClick.AddListener(button.action);
         buttons[index].onClick.AddListener(ClosePanel);
         buttons[index].gameObject.SetActive(true);
         Text gtext = buttons[index].GetComponentInChildren<Text>();
         gtext.text = button.buttonTitle;
     }
     else {
         buttons[index].gameObject.SetActive(false);
     }
 }
示例#18
0
    /// <summary>
    /// Initialises Main menu details and passes configuration data to SetMainMenu which then fires it up. Use this method instead of SetMainMenu to display menu (enables easy set up of buttons)
    /// </summary>
    /// <param name="detailsMain"></param>
    private void InitialiseMainMenu(ModalMainMenuDetails detailsMain)
    {
        //game state -> save current state first
        gameState = GameManager.i.inputScript.GameState;
        //menu
        ModalGenericMenuDetails details = new ModalGenericMenuDetails();

        details.itemName    = detailsMain.header;
        details.itemDetails = "2033";
        float horizontalPos = 0f;
        float verticalPos   = Screen.height / 2;

        //horizontal position can vary but vertical is always centred
        switch (detailsMain.alignHorizontal)
        {
        case AlignHorizontal.Left:
            horizontalPos = Screen.width / 3;
            break;

        case AlignHorizontal.Centre:
            horizontalPos = Screen.width / 2;
            break;

        case AlignHorizontal.Right:
            horizontalPos = Screen.width * 0.6666f;
            break;

        default:
            Debug.LogErrorFormat("Unrecognised alignHorizontal \"{0}\"", detailsMain.alignHorizontal);
            break;
        }
        //position
        details.menuPos = new Vector3(horizontalPos, verticalPos);
        //
        // - - - Configure buttons (not buttons need to be in top to bottom menu display order)
        //
        //Resume button
        if (detailsMain.isResume == true)
        {
            EventButtonDetails button0 = new EventButtonDetails()
            {
                buttonTitle         = "Resume",
                buttonTooltipHeader = string.Format("{0}Resume{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Return to Game{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}HQ are wondering where you've gone{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.ResumeGame, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button0);
        }
        //Tutorial button
        if (detailsMain.isTutorial == true)
        {
            EventButtonDetails button1 = new EventButtonDetails()
            {
                buttonTitle         = "Tutorial",
                buttonTooltipHeader = string.Format("{0}Tutorial{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Do the Tutorial{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}You weren't expecting to figure this out on your own, were you?{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.TutorialOptions, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button1);
        }
        //New Game button
        if (detailsMain.isNewGame == true)
        {
            EventButtonDetails button2 = new EventButtonDetails()
            {
                buttonTitle         = "New Game",
                buttonTooltipHeader = string.Format("{0}New Game{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Start a new game{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}HQ are keen to get moving{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.CreateNewGame, this, null, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button2);
        }
        //Load Game button
        if (detailsMain.isLoadGame == true)
        {
            EventButtonDetails button3 = new EventButtonDetails()
            {
                buttonTitle         = "Load Game",
                buttonTooltipHeader = string.Format("{0}Load Game{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Load a saved game{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}HQ would like now how you manage that trick?{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.LoadGame, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button3);
        }
        //Save Game button
        if (detailsMain.isSaveGame == true)
        {
            EventButtonDetails button4 = new EventButtonDetails()
            {
                buttonTitle         = "Save Game",
                buttonTooltipHeader = string.Format("{0}Save Game{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Save your current game{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}HQ are working on uploading memories{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.SaveGame, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button4);
        }
        //Options button
        if (detailsMain.isOptions == true)
        {
            EventButtonDetails button5 = new EventButtonDetails()
            {
                buttonTitle         = "Options",
                buttonTooltipHeader = string.Format("{0}Options{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Game Options{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}It's good to have options{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.CreateOptions, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button5);
        }
        //Feedback button
        if (detailsMain.isFeedback == true)
        {
            EventButtonDetails button6 = new EventButtonDetails()
            {
                buttonTitle         = "Feedback",
                buttonTooltipHeader = string.Format("{0}Feedback{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Send Feedback on bugs or design{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}All feedback, good or bad, is much appreciated{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button6);
        }
        //Customise button
        if (detailsMain.isCustomise == true)
        {
            EventButtonDetails button7 = new EventButtonDetails()
            {
                buttonTitle         = "Customise",
                buttonTooltipHeader = string.Format("{0}Customise{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Personalise the game environment in an easy to use manner{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}Who doesn't like to do things there way?{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button7);
        }
        //Credits button
        if (detailsMain.isCredits == true)
        {
            EventButtonDetails button8 = new EventButtonDetails()
            {
                buttonTitle         = "Credits",
                buttonTooltipHeader = string.Format("{0}Credits{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}The cast of thousands who made this mighty game{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}Make yourself a cuppa and then sit back and roll the Credits{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button8);
        }
        //Information button
        if (detailsMain.isInformation == true)
        {
            EventButtonDetails button9 = new EventButtonDetails()
            {
                buttonTitle         = "Information",
                buttonTooltipHeader = string.Format("{0}Information{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Find info on Game Mechanics and Game Design{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}Information is Power{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.CloseMainMenu, this, -1, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button9);
        }
        //Return to Main Menu button
        if (detailsMain.isMainMenu == true)
        {
            EventButtonDetails button10 = new EventButtonDetails()
            {
                buttonTitle         = "Main Menu",
                buttonTooltipHeader = string.Format("{0}Main Menu{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Return to the Main Menu{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}Take a moment to recalibrate{1}", colourAlert, colourEnd)
            };
            //depends on where you are returning from
            switch (GameManager.i.inputScript.GameState)
            {
            case GameState.NewInitialisation:           //playGame when exiting to main menu
            case GameState.PlayGame:
                button10.action = () => { EventManager.i.PostNotification(EventType.GameReturn, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); };
                break;

            case GameState.Tutorial:
                button10.action = () => { EventManager.i.PostNotification(EventType.TutorialReturn, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); };
                break;

            default: Debug.LogWarningFormat("Unrecognised GameState \"{0}\"", GameManager.i.inputScript.GameState); break;
            }
            details.listOfButtonDetails.Add(button10);
        }
        //Exit to Desktop button
        if (detailsMain.isExit == true)
        {
            EventButtonDetails button11 = new EventButtonDetails()
            {
                buttonTitle         = "EXIT to Desktop",
                buttonTooltipHeader = string.Format("{0}EXIT{1}", colourSide, colourEnd),
                buttonTooltipMain   = string.Format("{0}Leave the game and exit to the desktop{1}", colourNormal, colourEnd),
                buttonTooltipDetail = string.Format("{0}HQ will hold the fort until you return{1}", colourAlert, colourEnd),
                action = () => { EventManager.i.PostNotification(EventType.ExitGame, this, gameState, "ModalMainMenu.cs -> InitialiseMainMenu"); }
            };
            details.listOfButtonDetails.Add(button11);
        }
        //display background (default is none)
        GameManager.i.modalGUIScript.SetBackground(detailsMain.background);
        //activate menu
        SetMainMenu(details);
    }