Exemple #1
0
    void DelayedShow()
    {
        SyncSlots();

        UpdateAllViews();

        UpdateOutfitView(true);
        GuiEquipSelection.Instance.UpdateScroller();

        //TODO_DT: integrovat do GuiEquipMenu!
        //GuiEquipSelection uz by nemel byt singleton a nejspis by nemusel byt ani samostatna trida. Touch na Equip slotech by mel primarne take chodit do Equip menu a ne do EquipSlots, kod by se tak mohl vyrazne zjednodusit.
        ShopItemId lastItem = GuiEquipSelection.Instance.LastSelectedItem;

        if (IsSlotLocked(SelectedSlotType, SelectedSlotIndex))
        {
            SelectedSlotType  = GuiShop.E_ItemType.Weapon;
            SelectedSlotIndex = 0;
        }

        SelectSlot(SelectedSlotType, SelectedSlotIndex);
        if (lastItem != ShopItemId.EmptyId)
        {
            GuiEquipSelection.Instance.SelectItem(lastItem);
        }

        //Flurry.logEvent(AnalyticsTag.Equip, true);

        if (m_MessageBox != null)
        {
            m_MessageBox.ForceClose();
            m_MessageBox = null;
        }
        FixEquipList();
    }
Exemple #2
0
    static bool CheckTriggerImmediateCommand()
    {
        string[] arguments = System.Environment.GetCommandLineArgs();
        //string[] arguments = new string[1] { "-join=127.0.0.1:8101" };

        if (arguments == null)
        {
            return(false);
        }

        foreach (string str in arguments)
        {
            if (str.StartsWith("-join="))
            {
                string[] param = str.Split('=');
                System.Net.IPEndPoint endPoint = null;

                try
                {
                    endPoint = ParseIPandPort(param[1]);
                }
                catch (System.Exception exc)
                {
                    Debug.Log("The -connect commandline parameter problem: " + exc.ToString());
                    return(false);
                }

                JoiningMessageBox = ShowMessageBox("Joining to a server", "Joining to " + param[1]);
                Game.Instance.StartNewMultiplayerGame(endPoint, 0, OnConnectToServerFailed);
                return(true);
            }
        }

        return(false);
    }
Exemple #3
0
    void OnSearchingInvitedGame(int clientJoinRequestId, string invitingPrimaryKey)
    {
        //Popup.Show( TextDatabase.instance[0109061], "Searching for a suitable game...", "Cancel", OnMessageBoxEvent );
        m_MessageBox =
            (GuiPopupMessageBox)
            Owner.ShowPopup("MessageBox",
                            TextDatabase.instance[0109061],
                            TextDatabase.instance[0109058],
                            (inPopup, inResult) =>
        {
            //inPopup.ForceClose();
            m_MessageBox = null;

            if (inResult == E_PopupResultCode.Ok)
            {
                //FIXME We do not have the id now on the client side. Reimplement later.
                // The problem here is that this client does not pass any information to the lobby.
                // All the communication happens between the master (inviter) and the lobby. The childs (friends) receives just the OnSearchingInvitedGame a notification.
                LobbyClient.CancelFindServer(-1);

                UpdateStatus(m_Master, false);
                LeaveGang(m_Master);
            }
        });
        m_MessageBox.SetButtonText(TextDatabase.instance[02040009]);
    }
Exemple #4
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);
    }
 void HideMessage()
 {
     if (m_MessageBox != null)
     {
         m_MessageBox.ForceClose();
         m_MessageBox = null;
     }
 }
Exemple #6
0
    static void OnConnectToServerFailed(uLink.NetworkConnectionError reason)
    {
        if (JoiningMessageBox != null)
        {
            JoiningMessageBox.ForceClose();
            JoiningMessageBox = null;
        }

        ShowMessageBox("Network error", "Unable to join server (" + reason + ")", GoToMainMenu);
    }
Exemple #7
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);
        }
Exemple #8
0
    void OnNoServerAvailable(int clientJoinRequestId)
    {
        if (m_MessageBox == null || m_MessageBox.IsVisible == false)
        {
            return;
        }

        m_MessageBox.SetText(TextDatabase.instance[0109055]);
        m_MessageBox.SetButtonText(TextDatabase.instance[02040007]);
        m_MessageBox = null;

        LeaveGang(m_Master);
    }
    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 #11
0
    void OnServerFound(int clientJoinRequestId, int serverJoinRequestId, string ipAddress, int port)
    {
        if (m_MessageBox == null || m_MessageBox.IsVisible == false)
        {
            return;
        }

        m_MessageBox.SetText(TextDatabase.instance[0109054]);
        m_MessageBox = null;

        System.Net.IPAddress serverAddress = null;
        System.Net.IPAddress.TryParse(ipAddress, out serverAddress);

        System.Net.IPEndPoint serverEndpoint = new System.Net.IPEndPoint(serverAddress, port);

        Game.Instance.StartNewMultiplayerGame(serverEndpoint, serverJoinRequestId);
    }
        //-------------------------------------------------------------------------------------------------------------
        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;
        }
Exemple #13
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);
    }
Exemple #14
0
    IEnumerator Login_Coroutine()
    {
        GuiPopupMessageBox msgBox =
            Owner.ShowPopup("MessageBox", TextDatabase.instance[02040016], TextDatabase.instance[02040017]) as GuiPopupMessageBox;

        // get primary key
        string primaryKey;

        {
            UserGetPrimaryKey action = new UserGetPrimaryKey(m_UserName);
            GameCloudManager.AddAction(action);

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

            primaryKey = action.primaryKey;
        }

#if UNITY_IPHONE || TEST_IOS_VENDOR_ID
        if (string.IsNullOrEmpty(m_UserName) == false && m_UserName.StartsWith("guest") == true)
        {
            string userid   = SysUtils.GetUniqueDeviceID();
            string vendorID = null;

            while (string.IsNullOrEmpty(vendorID) == true)
            {
                vendorID = MFNativeUtils.IOS.VendorId;

                yield return(new WaitForEndOfFrame());
            }

            string id     = string.IsNullOrEmpty(userid) ? vendorID : userid;
            string idtype = string.IsNullOrEmpty(userid) ? CloudServices.LINK_ID_TYPE_IOSVENDOR : CloudServices.LINK_ID_TYPE_DEVICE;

            //Debug.Log(">>>> ID="+id+", IDType="+idtype);

            GetPrimaryKeyLinkedWithID action = new GetPrimaryKeyLinkedWithID(E_UserAcctKind.Guest, id, idtype);
            GameCloudManager.AddAction(action);

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

            msgBox.ForceClose();

            //Debug.Log(">>>> action.isSucceeded="+action.isSucceeded+", action.primaryKey="+action.primaryKey+", primaryKey="+primaryKey);

            bool force   = action.isFailed == true || action.isPrimaryKeyForSHDZ == false || action.primaryKey != primaryKey;
            bool migrate = false;
            GuiPopupMigrateGuest migratePopup = (GuiPopupMigrateGuest)Owner.ShowPopup("MigrateGuest", null, null, (inPopup, inResult) => {
                migrate = inResult == E_PopupResultCode.Ok;
            });
            migratePopup.Usage      = force ? GuiPopupMigrateGuest.E_Usage.QuickPlay : GuiPopupMigrateGuest.E_Usage.LoginScreen;
            migratePopup.PrimaryKey = primaryKey;
            migratePopup.Password   = m_PasswordHash;

            while (migratePopup.IsVisible == true)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (migrate == true)
            {
                yield break;
            }
        }
#endif

        if (msgBox.IsVisible == true)
        {
            msgBox.ForceClose();
        }

        CloudUser cloudUser = CloudUser.instance;
        cloudUser.SetLoginData(primaryKey, m_UserName, m_UserName, m_PasswordHash, m_PasswordLength, m_RememberMe, m_AutoLogin);

        CloudUser.instance.AuthenticateLocalUser();
        Owner.ShowPopup("Authentication", TextDatabase.instance[02040016], "", AuthenticationResultHandler);

        // Invoke("AuthenticationDeadLoopFixer", 20);
        // TODO disable Login screen.
    }
    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);
    }
Exemple #16
0
 public static void HideMessageBox(GuiPopupMessageBox popup)
 {
     HidePopup(popup);
 }
    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);
    }