예제 #1
0
    // PRIVATE METHODS

    void SelectAccount(int newAcctType, bool force)
    {
        // always store requested account type as pending
        m_PendingAcct = newAcctType;

        if (newAcctType == m_SelectedAcct && force == false)
        {
            return;
        }
        m_SelectedAcct = newAcctType;

        for (int idx = 0; idx < MAX_TYPES; ++idx)
        {
            int            acctType = idx + 1;
            GUIBase_Button button   = GuiBaseUtils.GetControl <GUIBase_Button>(Layout, TYPE_BUTTON + acctType);
            button.ForceHighlight(m_SelectedAcct == acctType ? true : false);
        }

        //GuiBaseUtils.GetControl<GUIBase_Button>(Layout, BUY_BUTTON).SetDisabled(m_SelectedAcct < 0 ? true : false);

        /*if (m_SelectedAcct < 0)
         * {
         *      InvokeRepeating("BlinkGoldButtons", 1.0f, 1.0f);
         * }
         * else
         * {
         *      CancelInvoke("BlinkGoldButtons");
         * }*/

        //StopCoroutine("BlinkBuyButton_Coroutine");
        //StartCoroutine("BlinkBuyButton_Coroutine");
    }
예제 #2
0
    // PRIVATE METHODS

    void ShowItems()
    {
        if (m_State != E_State.Idle)
        {
            return;
        }

        m_State = E_State.Visible;

        if (m_Menu != null)
        {
            m_Menu.ForceHighlight(true);
        }

        for (int idx = 0; idx < (int)E_CommandID.Max; ++idx)
        {
            m_Items[idx].Show(true, true);
        }
    }
예제 #3
0
    public void UpdateFocus(GUIBase_Button focusedTextField)
    {
#if MADFINGER_KEYBOARD_MOUSE
        m_FocusChanged = true;
        m_TextChanged  = true;
        m_LastCaretPos = -1;

        if (m_FocusedTextField != null)
        {
            m_FocusedTextField.ForceHighlight(false);
        }

        m_FocusedTextField = focusedTextField;
        if (m_FocusedTextField == null)
        {
            HideCaret();
            return;
        }

        m_FocusedTextField.ForceHighlight(true);
#endif
    }
예제 #4
0
    void UpdatePremiumButton()
    {
        bool hasPremium = CloudUser.instance.isPremiumAccountActive;

        string text = "";

        if (hasPremium == true)
        {
            System.TimeSpan time = CloudUser.instance.GetPremiumAccountEndDateTime() - CloudDateTime.UtcNow;
            //System.TimeSpan time = (CloudDateTime.UtcNow + new System.TimeSpan(0, 0, 119, 0, 0)) - CloudDateTime.UtcNow;

            int seconds = Mathf.CeilToInt((float)time.TotalSeconds);
            int minutes = Mathf.CeilToInt((float)time.TotalMinutes);
            int hours   = Mathf.RoundToInt((float)time.TotalHours);
            int days    = Mathf.RoundToInt((float)time.TotalDays);
            //int weeks   = Mathf.RoundToInt(days / 7.0f);
            //int months  = Mathf.RoundToInt(weeks / 4.0f);

            text = TextDatabase.instance[0105008];

            int value, unit;
            if (seconds <= 60)
            {
                value = seconds;
                unit  = 0105019;
            }
            else if (minutes < 60)
            {
                value = minutes;
                unit  = 0105009;
            }
            else if (hours < 48)
            {
                value = hours;
                unit  = value > 1 ? 0105012 : 0105011;
            }
            else
            /*if (days < 14)*/
            {
                value = days;
                unit  = value > 1 ? 0105014 : 0105013;
            }

            /*else
             * if (weeks < 4)     { value = weeks;   unit = value > 1 ? 0105016 : 0105015; }
             * else               { value = months;  unit = value > 1 ? 0105018 : 0105017; }*/

            text = string.Format(text, value, TextDatabase.instance[unit]);

            /*if (minutes < 30)
             * {
             *      if (m_CurrentHint != E_Hint.PremiumRenew && m_PreviousHint != E_Hint.PremiumRenew)
             *      {
             *              ForceShowHint(E_Hint.PremiumRenew);
             *      }
             * }*/

            if (minutes < 5)
            {
                GUIBase_Button premium = GuiBaseUtils.GetButton(Layout, "Premium");
                premium.ForceHighlight(time.TotalSeconds > 5 ? !premium.isHighlighted : false);
            }
        }
        else if (GuiFrontendMain.IsVisible == true)
        {
            text = TextDatabase.instance[0105007];
        }
        else
        {
            text = TextDatabase.instance[0105020];
        }

        GUIBase_Button button = hasPremium == true && m_PremiumActiveButton != null ? m_PremiumActiveButton : m_PremiumButton;

        button.SetNewText(text);
    }