Exemple #1
0
 static void OnResult(GuiPopup popup, E_PopupResultCode result)
 {
     if (m_Popup == popup)
     {
         m_Popup.SetButtonVisible(true);
     }
 }
Exemple #2
0
    protected override void OnViewShow()
    {
        //Debug.Log("Equip menu Show");
        //ShopDataBridge.Instance.Debug_LogEquipedItems();
        //ShopDataBridge.Instance.Debug_LogEquipedWeapons();

        base.OnViewShow();
        MFGuiManager.Instance.ShowPivot(m_ScreenPivot, true);

        if (m_HACK_DelayedShowRemaining > 0)
        {
            m_MessageBox = Owner.ShowPopup("MessageBox", TextDatabase.instance[0100001], TextDatabase.instance[02050041]) as GuiPopupMessageBox;
            m_MessageBox.SetButtonVisible(false);

            LockSlots();
        }

        m_WeaponSlots.Show();
        m_ItemSlots.Show();
        m_HatSlots.Show();
        m_SkinSlots.Show();
        m_PerkSlots.Show();

        if (m_HACK_DelayedShowRemaining <= 0)
        {
            DelayedShow();
        }

        m_ItemDescription.Show(false);
    }
        //-------------------------------------------------------------------------------------------------------------
        static void OnResult(GuiPopup popup, E_PopupResultCode result)
        {
            m_Popup.SetButtonVisible(true);

            if (m_Handler != null)
            {
                m_Handler(popup, result);
            }
        }
Exemple #4
0
        public static bool Show(string caption, string message, bool showButton)
        {
            m_Popup = GuiBaseUtils.ShowMessageBox(caption, message, OnResult) as GuiPopupMessageBox;

            if (m_Popup != null)
            {
                m_Popup.SetButtonVisible(showButton);
                return(true);
            }

            return(false);
        }
        //-------------------------------------------------------------------------------------------------------------
        public static void Show(string caption, string message, string button, PopupHandler handler)
        {
            m_Popup   = GuiBaseUtils.ShowMessageBox(caption, message, OnResult) as GuiPopupMessageBox;
            m_Handler = null;

            if (m_Popup == null)
            {
                return;
            }

            if ((button != null) && (button.Length > 0))
            {
                m_Popup.SetButtonVisible(true);
                m_Popup.SetButtonText(button);
            }
            else
            {
                m_Popup.SetButtonVisible(false);
            }

            m_Handler = handler;
        }
    IEnumerator PasswordRecoveryRequest_Coroutine()
    {
        if (string.IsNullOrEmpty(m_UserName) == true)
        {
            yield break;
        }

        string     username = m_UserName;
        IViewOwner owner    = Owner;

        owner.Back();

        GuiPopupMessageBox popup =
            (GuiPopupMessageBox)owner.ShowPopup("MessageBox", TextDatabase.instance[0103044], TextDatabase.instance[0103043]);

        popup.SetButtonVisible(false);

        yield return(new WaitForSeconds(0.2f));

        string primaryKey;
        {
            UserGetPrimaryKey action = new UserGetPrimaryKey(username);
            GameCloudManager.AddAction(action);

            while (action.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            primaryKey = action.primaryKey;
        }

        E_PopupResultCode result;

        {
            ForgotPassword action = new ForgotPassword(primaryKey);
            GameCloudManager.AddAction(action);

            while (action.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            result = action.isSucceeded == true ? E_PopupResultCode.Ok : E_PopupResultCode.Failed;
        }

        popup.ForceClose();

        SendResult(result);
    }
    void ShowMessage(int textId, bool canClose)
    {
        if (m_MessageBox == null || m_MessageBox.IsVisible == false)
        {
            m_MessageBox = Owner.ShowPopup("MessageBox", "", "") as GuiPopupMessageBox;
        }

        if (m_MessageBox != null)
        {
            m_MessageBox.SetCaption(TextDatabase.instance[MESSAGE_CAPTION]);
            m_MessageBox.SetText(TextDatabase.instance[textId]);
            m_MessageBox.SetButtonVisible(canClose);
        }
    }
Exemple #8
0
    IEnumerator AddNewFriend_Coroutine()
    {
        string     username   = Username;
        string     primaryKey = PrimaryKey;
        string     nickname   = Nickname;
        string     message    = Message;
        IViewOwner owner      = Owner;

        owner.Back();

        GuiPopupMessageBox popup =
            (GuiPopupMessageBox)owner.ShowPopup("MessageBox", TextDatabase.instance[02040204], TextDatabase.instance[00103043]);

        popup.SetButtonVisible(false);

        yield return(new WaitForSeconds(0.2f));

        if (string.IsNullOrEmpty(primaryKey) == true)
        {
            UserGetPrimaryKey action = new UserGetPrimaryKey(username);
            GameCloudManager.AddAction(action);

            while (action.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            primaryKey = action.primaryKey;
        }

        GameCloudManager.friendList.AddNewFriend(primaryKey, username, nickname, message);

        popup.ForceClose();

        SendResult(E_PopupResultCode.Ok);
    }
    IEnumerator BuyPremiumAccount_Coroutine(int acctType)
    {
        int idx   = acctType - 1;
        int gold  = ShopDataBridge.Instance.PlayerGold;
        int price = m_Accounts[idx].RealPrice;

        string acctTypeID = m_Accounts[idx].Id;

        CloudUser user = CloudUser.instance;

        // not enough golds
        if (price > gold)
        {
            ShopItemId itemId = ShopDataBridge.Instance.GetPremiumAcct(acctTypeID);
            if (itemId == ShopItemId.EmptyId)
            {
                // ...
                yield break;
            }

            int  fundsNeeded = price - gold;
            bool buySucceed  = true;

            ShopItemId reqIAP = ShopDataBridge.Instance.FindFundsItem(fundsNeeded, true);

            if (reqIAP.IsEmpty())
            {
                yield break;
            }

            GuiShopNotFundsPopup.Instance.AddFundsID = reqIAP;
            GuiPopup popup = Owner.ShowPopup("NotFundsPopup",
                                             "",
                                             "",
                                             (inPopup, inResult) =>
            {
                switch (inResult)
                {
                case E_PopupResultCode.Cancel:
                    buySucceed = false;
                    break;

                case E_PopupResultCode.Failed:
                    buySucceed = false;
                    break;
                }
            });

            //Debug.Log("Popup Visible:" + popup.IsVisible);
            while (popup.IsVisible == true)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (buySucceed == false)
            {
                yield break;
            }

            //Debug.Log("IAP success:" + buySucceed);
        }

        // store current status of premium account
        bool hadPremiumAccount = user.isPremiumAccountActive;

        // create cloud action
        BaseCloudAction action = new BuyPremiumAccountAndFetchPPI(user.authenticatedUserID, acctTypeID);

        GameCloudManager.AddAction(action);

        // show message box
        GuiPopupMessageBox msgBox =
            (GuiPopupMessageBox)Owner.ShowPopup("MessageBox",
                                                TextDatabase.instance[01140017],
                                                TextDatabase.instance[01140018],
                                                (popup, result) =>
        {
            if (action.isSucceeded == true)
            {
                Owner.Back();
                SendResult(E_PopupResultCode.Ok);
            }
        });

        msgBox.SetButtonVisible(false);
        msgBox.SetButtonEnabled(false);

        // wait for async action...
        while (action.isDone == false)
        {
            yield return(new WaitForEndOfFrame());
        }

        // update message box
        int textId = 01140021;

        if (action.isSucceeded == true)
        {
            textId = hadPremiumAccount == true ? 01140020 : 01140019;
        }

        msgBox.SetText(TextDatabase.instance[textId]);
        msgBox.SetButtonVisible(true);
        msgBox.SetButtonEnabled(true);
    }
    IEnumerator UpdateProfile_Coroutine()
    {
        // show message box with some info
        GuiPopupMessageBox msgbox =
            Owner.ShowPopup("MessageBox", TextDatabase.instance[0107000], TextDatabase.instance[0107022]) as GuiPopupMessageBox;

        msgbox.SetButtonVisible(false);

        // update profile
        UpdateMFAccountAndFetchPPI action = CloudUser.instance.UpdateUser(m_Password1Hash,
                                                                          GuiBaseUtils.FixNickname(m_Nickname, CloudUser.instance.userName_TODO),
                                                                          null,
                                                                          m_ReceiveNews,
                                                                          m_Region);

        while (action.isDone == false)
        {
            yield return(new WaitForSeconds(0.2f));
        }

        if (action.isSucceeded == true)
        {
            // update cloud user with actual informations
            string username   = "";
            string nickname   = "";
            string password   = "";
            int    pwdLength  = 0;
            bool   rememberMe = true;
            bool   autoLogin  = true;
            CloudUser.instance.GetLoginData(ref nickname, ref username, ref password, ref pwdLength, ref rememberMe, ref autoLogin);
            CloudUser.instance.SetLoginData(CloudUser.instance.primaryKey,
                                            m_Nickname,
                                            username,
                                            m_Password1Hash,
                                            m_PasswordLength,
                                            rememberMe,
                                            autoLogin);
            CloudUser.instance.receiveNews = m_ReceiveNews;
            CloudUser.instance.region      = m_Region;

            PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();
            if (ppi != null)
            {
                ppi.Name = m_Nickname;
                PPIManager.Instance.NotifyLocalPPIChanged();
            }

            // connect to correct lobby
            LobbyClient.ConnectToLobby(m_Region);

            // inform user that we are done
            msgbox.SetText(TextDatabase.instance[0107020]);
            msgbox.SetHandler((popup, result) => { Owner.Back(); });
        }
        else
        {
            // inform user that there were a problem with updating
            msgbox.SetText(TextDatabase.instance[0107021]);
        }

        // let user press 'OK'
        msgbox.SetButtonText(TextDatabase.instance[0107024]);
        msgbox.SetButtonVisible(true);
    }