public void SetText(ConfirmationPopupState.PopupText popupText)
 {
     m_title.text        = popupText.m_title;
     m_description.text  = popupText.m_description;
     m_confirmation.text = popupText.m_accept;
     m_decline.text      = popupText.m_decline;
 }
Exemplo n.º 2
0
    protected override void HandleMessage(object message)
    {
        switch (message)
        {
        case k_backMenuMsg:
            ControllingStateStack.PopState(this);
            break;

        case k_clearDataMsg:
            var popupText = new ConfirmationPopupState.PopupText
            {
                m_title       = m_locService.GetLocalised("CONFIRMATION_TITLE"),
                m_description = m_locService.GetLocalised("DELETE_CONFIRM_DESC"),
                m_accept      = m_locService.GetLocalised("CONTINUE"),
                m_decline     = m_locService.GetLocalised("CANCEL")
            };
            ControllingStateStack.PushState(new ConfirmationPopupState(popupText, ClearSavedData));
            break;

        case string langMsg when langMsg.StartsWith(k_languageDropMsg):
            langMsg = langMsg.Remove(0, k_languageDropMsg.Length);

            int index = ToInt32(langMsg);

            m_locService.LoadLocalisation((LocalisationService.LocalisableCultures)index, k_languageResourceFormat);
            PlayerPrefs.SetInt(k_localisationIndexKey, index);
            PlayerPrefs.Save();

            LocalisationUIRefresher[] uiRefreshers = GameObject.FindObjectsOfType <LocalisationUIRefresher>();
            foreach (LocalisationUIRefresher uiText in uiRefreshers)
            {
                uiText.RefreshText();
            }
            break;
        }
    }
Exemplo n.º 3
0
    protected override void HandleMessage(object message)
    {
        switch (message)
        {
        case k_addMsg:
            ControllingStateStack.PushState(new AddOrEditElementState(OnNewElementAdded));
            break;

        case k_editMsg:
            ControllingStateStack.PushState(new AddOrEditElementState(OnElementEdited, m_gridElements.m_elements[m_selectedElementIndex]));
            break;

        case k_backMenuMsg:
            ControllingStateStack.PopState(this);
            break;

        case k_removeMsg:
            var popupText = new ConfirmationPopupState.PopupText
            {
                m_title       = m_locService.GetLocalised("CONFIRMATION_TITLE"),
                m_description = m_locService.GetLocalised("DELETE_ENTRY_DESC"),
                m_accept      = m_locService.GetLocalised("CONTINUE"),
                m_decline     = m_locService.GetLocalised("CANCEL")
            };
            ControllingStateStack.PushState(new ConfirmationPopupState(popupText, RemoveSelectedElement));
            break;

        case k_breakdownMsg:
            ControllingStateStack.PushState(new MonthlyOverviewState());
            break;

        case k_nextPageMsg:
            m_pageNumber++;
            BuildGridElements();
            break;

        case k_previousPageMsg:
            m_pageNumber = Mathf.Max(m_pageNumber - 1, 0);
            BuildGridElements();
            break;

        case string msg when msg.StartsWith(k_selectElementMsg):
            msg = msg.Replace(k_selectElementMsg, string.Empty);

            if (int.TryParse(msg, out int index))
            {
                if (index == m_selectedElementIndex)
                {
                    break;
                }

                if (m_selectedElementIndex > -1)
                {
                    bool selectionWasExpense = m_gridElements.m_elements[m_selectedElementIndex].IsExpense;
                    m_uiIncomeExpenses.SetButtonSelected(index, m_selectedElementIndex, selectionWasExpense);
                }
                else
                {
                    m_uiIncomeExpenses.SetButtonSelected(index);
                }

                m_selectedElementIndex = index;
                m_uiIncomeExpenses.SetEditRemoveInteractablity(true);
            }
            break;
        }
    }