Exemplo n.º 1
0
    protected override void OnViewShow()
    {
        base.OnViewShow();

        m_Email = null;
        m_EmailButton.TextFieldText = string.Empty;
        m_EmailButton.SetNewText(107030);
        UpdateMigrateButton();

        m_MigrateButton.RegisterReleaseDelegate2(Delegate_Migrate);
        m_CancelButton.RegisterReleaseDelegate2(Delegate_Cancel);
        m_EmailButton.RegisterReleaseDelegate2(Delegate_Email);
    }
Exemplo n.º 2
0
        public void Update(FtueAction.Base action, int actionsFinished, int actionsTotal)
        {
            if (m_Root.Visible == true)
            {
                string hint  = Ftue.NextActionHint;
                string label = action.IsIdle == true?string.Format(TextDatabase.instance[9900003], action.Label) : action.Label;

                m_Caption.SetNewText(hint != null
                                                                                                         ? label
                                                                                                         : string.Format("{0}: {1}",
                                                                                                                         TextDatabase.instance[9900000],
                                                                                                                         label
                                                                                                                         ));
                m_Text.Widget.ShowImmediate(true, true);
                m_Text.SetNewText(hint ?? action.Description);
                m_Text.textScale = string.IsNullOrEmpty(hint)
                                                                                                   ? new Vector2(m_DefaultTextScale.x * action.DescriptionScale.x, m_DefaultTextScale.y * action.DescriptionScale.y)
                                                                                                   : m_DefaultTextScale;

                bool isNext    = action is FtueAction.Welcome || action is FtueAction.Hud || action is FtueAction.FinalText ? true : false;
                bool highlight = Alpha < 1.0f ? false : action.IsActive;
                m_SkipThis.animate       = true;
                m_SkipThis.isHighlighted = isNext ? highlight : false;
                m_SkipThis.SetNewText(isNext ? 9900004 : 9900001);
            }

            m_Close.IsDisabled    = Alpha < 0.8f ? true : false;
            m_SkipThis.IsDisabled = Alpha < 0.8f ? true : action.IsIdle;
            m_SkipAll.IsDisabled  = Alpha < 0.8f ? true : false;
        }
Exemplo n.º 3
0
    // =================================================================================================================
    // ===  Delegates  =================================================================================================

    void OnMinimize(GUIBase_Widget inWidget)
    {
        m_Minimized = !m_Minimized;

        m_Minimize_Button.SetNewText(m_Minimized ? 0502031 : 0502030);

        UpdateControlsVisibility();
    }
Exemplo n.º 4
0
 void Password2KeyboardClose(GUIBase_Button input, string text, bool cancelled)
 {
     if (cancelled == false)
     {
         m_Password2Hash = CloudServices.CalcPasswordHash(text);
         m_Password2Btn.SetNewText(new string('*', text.Length));
         RefreshPage();
     }
 }
Exemplo n.º 5
0
 protected override void SetText(string text)
 {
     if (m_Button != null)
     {
         m_Button.SetNewText(text);
     }
     else
     {
         base.SetText(text);
     }
 }
Exemplo n.º 6
0
    protected override void OnViewShow()
    {
        base.OnViewShow();

        string username   = "";
        bool   rememberMe = true;
        bool   autoLogin  = true;

        CloudUser.instance.GetLoginData(ref m_Nickname, ref username, ref m_Password1Hash, ref m_PasswordLength, ref rememberMe, ref autoLogin);

        m_ReceiveNews = CloudUser.instance.receiveNews;
        m_Region      = CloudUser.instance.region;

        PrepareLabel(USERNAME_LABEL).SetNewText(CloudUser.instance.userName_TODO.MFNormalize());         // display unmodified username here!

        PrepareButton(CLOSE_BUTTON, null, OnClosePressed);
        PrepareButton(CONFIRM_BUTTON, null, OnConfirmPressed);
        m_NicknameBtn  = PrepareButton(NICKNAME_BUTTON, null, OnNicknamePressed);
        m_Password1Btn = PrepareButton(PASSWORD1_BUTTON, null, OnPassword1Pressed);
        m_Password2Btn = PrepareButton(PASSWORD2_BUTTON, null, OnPassword2Pressed);

        if (CloudUser.instance.userAccountKind == E_UserAcctKind.Guest)
        {
            GUIBase_Button button = PrepareButton(MIGRATE_BUTTON, null, OnMigrateGuestPressed);
            button.Widget.m_VisibleOnLayoutShow = true;
            if (button.Widget.Visible == false)
            {
                button.Widget.ShowImmediate(true, true);
            }
        }
        else
        {
            GUIBase_Button button = PrepareButton(Layout, MIGRATE_BUTTON, null, null);
            button.Widget.m_VisibleOnLayoutShow = false;
            if (button.Widget.Visible == true)
            {
                button.Widget.ShowImmediate(false, true);
            }
        }

        GuiBaseUtils.RegisterSwitchDelegate(Layout, NEWS_SWITCH, OnNewsChanged);

        RegisterRollerDelegate(REGION_ROLLER, OnRegionChanged);

        m_NicknameBtn.TextFieldText = m_Nickname;
        m_Password1Btn.SetNewText("");
        m_Password1Btn.TextFieldText = "";

        m_Password2Btn.SetNewText("");
        m_Password2Btn.TextFieldText = "";

        RefreshPage();
    }
Exemplo n.º 7
0
    protected override void OnShow()
    {
        base.OnShow();

        if (m_SendButton != null)
        {
            m_SendButton.RegisterTouchDelegate(() =>
            {
                if (!string.IsNullOrEmpty(m_MessageToSend))
                {
                    SendMessage(
                        CloudUser.instance.primaryKey,
                        CloudUser.instance.nickName,
                        PPIManager.Instance.GetLocalPPI().Rank,
                        m_MessageToSend);
                }
                m_MessageToSend = "";
                m_MessageButton.SetNewText("");
                m_MessageButton.TextFieldText = "";
            });
        }

        if (m_ClearButton != null)
        {
            m_ClearButton.RegisterTouchDelegate(() => { Clear(); });
        }

        if (m_MessageButton != null)
        {
            m_MessageButton.RegisterTouchDelegate(() => { WriteMessage(); });
        }

        if (m_ScrollingTable != null)
        {
            m_ScrollingTable.OnUpdateRow    += OnUpdateTableRow;
            m_ScrollingTable.OnProcessInput += OnProcessInput;
        }

        RefreshRows();
    }
Exemplo n.º 8
0
    void OnReadyPressed()
    {
        if (string.IsNullOrEmpty(m_Master) == false)
        {
            m_IsReady = !m_IsReady;

            m_ReadyButton.SetNewText(m_IsReady ? 109048 : 109071);             //READY! : READY?

            var data = new
            {
                master     = m_Master,
                primaryKey = m_PrimaryKey,
                status     = m_IsReady
            };
            LobbyClient.SendMessageToPlayer(m_Master, LobbyGangMessage.READY, JsonMapper.ToJson(data));

            SetDirty();
        }
    }
Exemplo n.º 9
0
    void SetButtonValue(GUIBase_Button button, int oldValue, int newValue, bool animate)
    {
        if (oldValue == newValue)
        {
            return;
        }

        if (animate == false)
        {
            button.SetNewText(newValue.ToString());
        }
        else
        {
            var animation = MFGuiManager.AnimateWidget(button, oldValue, newValue);
            if (animation != null)
            {
                animation.AudioClip = m_CountDownSound;
            }
        }
    }
Exemplo n.º 10
0
    protected override void OnViewUpdate()
    {
        base.OnViewUpdate();

        m_NextUpdateTime -= Time.deltaTime;
        if (m_NextUpdateTime > 0.0f)
        {
            return;
        }
        m_NextUpdateTime = 0.5f;

        for (int idx = 0; idx < m_Buttons.Length; ++idx)
        {
            IGuiPageChat page = GetPage(idx) as IGuiPageChat;
            if (page != null)
            {
                GUIBase_Button button = m_Buttons[idx];
                button.SetNewText(page.CaptionText);
                button.isHighlighted = idx != CurrentPageIndex ? page.NotifyUser : false;
            }
        }
    }
Exemplo n.º 11
0
    // =================================================================================================================
    // ===  internal  ==================================================================================================

    // update state of 'follow player' and 'free' spectator buttons
    void UpdateButtonsState()
    {
        bool canFollowPlayer = SpectatorCamera.Spectator_CanFollowPlayer();

        m_FollowPlayer_Button.SetNewText(FollowingPlayer ? 0502019 : 0502018);
        m_FollowPlayer_Button.SetDisabled(!canFollowPlayer);

        Client client = Client.Instance;

        if (client != null)
        {
            bool disable  = client.GameState.State == Client.ClientGameState.Running || WaitingForSpawn;
            bool canSpawn = true;

            switch (client.GameState.GameType)
            {
            case E_MPGameType.DeathMatch:
                canSpawn = Client.TimeToRespawn <= client.GameState.DMInfo.RestTimeSeconds ? true : false;
                break;

            case E_MPGameType.ZoneControl:
                PlayerPersistantInfo localPPI = PPIManager.Instance.GetLocalPPI();
                canSpawn = localPPI.Team != E_Team.None && localPPI.ZoneIndex >= 0 ? true : false;
                break;

            default:
                Debug.LogError("Unknown Game Type ");
                break;
            }

            m_Cancel_Button.SetDisabled(disable);
            m_Spawn_Button.SetDisabled(disable || !client.IsReadyForSpawn() || GameCloudManager.isBusy || !canSpawn);

            if (canSpawn == false)
            {
                UpdateControlsVisibility();
            }
        }
    }
Exemplo n.º 12
0
    void UpdateMoney(PlayerPersistantInfo ppi, bool reset)
    {
        if (GuiFrontendMain.IsVisible == false)
        {
            return;
        }
        if (m_MoneyButton == null)
        {
            return;
        }

        int money = ppi != null ? ppi.Money : 0;

        if (reset == false)
        {
            SetButtonValue(m_MoneyButton, m_Money, money, AnimateMoney);
            m_Money = money;
        }
        else
        {
            m_MoneyButton.SetNewText(money.ToString());
        }
    }
Exemplo n.º 13
0
    void UpdateGold(PlayerPersistantInfo ppi, bool reset)
    {
        if (GuiFrontendMain.IsVisible == false)
        {
            return;
        }
        if (m_GoldButton == null)
        {
            return;
        }

        int gold = ppi != null ? ppi.Gold : 0;

        if (reset == false)
        {
            SetButtonValue(m_GoldButton, m_Gold, gold, AnimateGold);
            m_Gold = gold;
        }
        else
        {
            m_GoldButton.SetNewText(gold.ToString());
        }
    }
Exemplo n.º 14
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);
    }
Exemplo n.º 15
0
    void UpdatePlayerName(PlayerPersistantInfo ppi, bool reset)
    {
        string playerName = ppi != null ? ppi.Name : "";

        m_PlayerButton.SetNewText(GuiBaseUtils.FixNameForGui(playerName));
    }
Exemplo n.º 16
0
 public void SetButtonText(string text)
 {
     m_Button.SetNewText(text);
 }