예제 #1
0
    void RefreshListItem(int rowIdx, int friendIdx)
    {
        ListRow row = GetRow(rowIdx);

        LobbyGang.FriendInfo friend = GetFriend(friendIdx);

        if (friend != null)
        {
            row.FriendIndex = friendIdx;

            int statusTextId;
            if (friend.IsReady)
            {
                statusTextId = 0109047;
            }
            else if (friend.IsWaiting)
            {
                statusTextId = 0109046;
            }
            else if (friend.IsOnline)
            {
                statusTextId = 0109044;
            }
            else if (friend.IsPlaying)
            {
                statusTextId = 0109063;
            }
            else
            {
                statusTextId = 0109045;
            }

            if (row.Root.Visible == false)
            {
                row.Root.Show(true, true);
            }

            row.Name.SetNewText(GuiBaseUtils.FixNameForGui(friend.Nickname));
            row.Status.SetNewText(string.Format("({0})", TextDatabase.instance[statusTextId]));
            row.RankValue.SetNewText(friend.Rank.ToString());
            row.RankIcon.State = string.Format("Rank_{0}", Mathf.Min(friend.Rank, row.RankIcon.Count - 1).ToString("D2"));

            bool available = LobbyGang.FriendsInvited < MAX_INVITES ? friend.IsOnline : false;
            bool canInvite = available ? friend.CanInvite : false;

            row.AddButton.IsDisabled    = friend.IsInvited ? true : !canInvite;
            row.RemoveButton.IsDisabled = friend.IsInvited ? false : !available;

            row.WaitingBg.Widget.Show(friend.IsWaiting, true);
            row.ReadyBg.Widget.Show(friend.IsReady, true);
            row.AddButton.Widget.Show(!friend.IsInvited && available, true);
            row.RemoveButton.Widget.Show(friend.IsInvited && available, true);
        }
        else
        {
            row.FriendIndex = -1;

            row.Root.Show(false, true);
        }
    }
예제 #2
0
    bool RefreshListItem(int rowIdx, int friendIdx)
    {
        ListRow    row    = GetRow(rowIdx);
        FriendInfo friend = GetFriend(friendIdx);

        if (friend != null)
        {
            row.FriendIndex = friendIdx;

            int statusTextId = friend.IsReady ? 0109047 : 0109046;

            if (row.Root.Visible == false)
            {
                row.Root.Show(true, true);
            }

            row.Name.SetNewText(GuiBaseUtils.FixNameForGui(friend.Nickname));
            row.Status.SetNewText(string.Format("({0})", TextDatabase.instance[statusTextId]));
            row.RankValue.SetNewText(friend.Rank.ToString());
            row.RankIcon.State = string.Format("Rank_{0}", Mathf.Min(friend.Rank, row.RankIcon.Count - 1).ToString("D2"));

            row.WaitingBg.Widget.Show(!friend.IsReady, true);
            row.ReadyBg.Widget.Show(friend.IsReady, true);

            return(friend.IsReady);
        }
        else
        {
            row.FriendIndex = -1;

            row.Root.Show(false, true);

            return(false);
        }
    }
예제 #3
0
        public void Update(FriendInfo inFriend)
        {
            m_FriendName = inFriend.PrimaryKey;

            {
                m_FacebookIcon.Show(false, false);
                m_FacebookName.Widget.Show(false, false);
                m_Nickname.Widget.Show(true, false);

                m_Username.SetNewText(GuiBaseUtils.FixNameForGui(inFriend.Username));
                m_Nickname.SetNewText(GuiBaseUtils.FixNameForGui(inFriend.Nickname));
            }

            m_RankText.SetNewText(inFriend.Rank <= 0 ? "" : inFriend.Rank.ToString());
            m_Missions.SetNewText(inFriend.Missions.ToString());

            string rankState = string.Format("Rank_{0}", Mathf.Min(inFriend.Rank, m_RankIcon.Count - 1).ToString("D2"));

            m_RankIcon.State = inFriend.Rank <= 0 ? GUIBase_MultiSprite.DefaultState : rankState;

            string onlineStatus = GetLastOnlineInfo(inFriend);

            m_Online.SetNewText(onlineStatus);

            bool isOnline = inFriend.OnlineStatus == FriendList.E_OnlineStatus.InLobby && LobbyClient.IsConnected == true &&
                            GuiFrontendMain.IsVisible == true;

            m_Chat.IsDisabled = GuiFrontendIngame.IsVisible ? true : !isOnline;

            //Debug.Log("show PPI " + inPPI.Name + " " + inPPI.Score.Score.ToString());
        }
예제 #4
0
    void OnChatStart(string primaryKey, string messageId, string messageText)
    {
        JsonData data   = JsonMapper.ToObject(messageText);
        string   master = data["master"].ToString();
        string   slave  = data["slave"].ToString();

        var  friend   = GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == master);
        bool isFriend = friend != null ? true : false;

        primaryKey = m_PrimaryKey == master ? slave : master;
        FriendInfo info = m_Friends.Find(obj => obj.PrimaryKey == primaryKey);

        if (GuiFrontendMain.IsVisible == false || isFriend == false || JoinChat(master, slave, false) == false)
        {
            var result = new
            {
                master = master,
                slave  = slave
            };
            LobbyClient.SendMessageToPlayer(master == m_PrimaryKey ? slave : master, CMD_FAILED, JsonMapper.ToJson(result));
        }
        else
        {
            if (info == null)
            {
                info = m_Friends.Find(obj => obj.PrimaryKey == primaryKey);
                AddSystemMessage(info, string.Format(TextDatabase.instance[0506011], GuiBaseUtils.FixNameForGui(info.Nickname)));
            }
        }
    }
예제 #5
0
    protected override void OnViewShow()
    {
        base.OnViewShow();

        m_OKButton.RegisterReleaseDelegate2(Delegate_OK);
        m_CancelButton.RegisterReleaseDelegate2(Delegate_Cancel);
        m_NameButton.RegisterReleaseDelegate2(Delegate_UserName);

        if (m_IsForPassword)
        {
            m_CaptionLabel.SetNewText(TextDatabase.instance[0107016]);
            m_NameButton.TextFieldText = "";
            m_NameButton.SetNewText("");
        }
        else
        {
            m_CaptionLabel.SetNewText(TextDatabase.instance[0103013]);

            if (CloudUser.instance.authenticationDataPresent == true)
            {
                m_UserName = CloudUser.instance.userName_TODO;                 //TODO: PRIMARY KEY - nepotrebujeme nahodou i primary key?
            }
            else
            {
                m_UserName = string.Empty;
            }

            m_NameButton.TextFieldText = GuiBaseUtils.FixNameForGui(m_UserName);
            m_NameButton.SetNewText(m_NameButton.TextFieldText);
        }
        UpdateOKButton();
    }
예제 #6
0
        public void Update(Chat.Message message)
        {
            Id = message.Id;

            if (m_Name != null)
            {
                m_Name.SetNewText(GuiBaseUtils.FixNameForGui(message.Nickname));
            }

            if (m_Text != null)
            {
                m_Text.SetNewText(m_Name == null ? string.Format("{0}: {1}", GuiBaseUtils.FixNameForGui(message.Nickname), message.Text) : message.Text);

                Transform trans = m_Text.transform;
                Vector3   scale = trans.localScale;
                m_Rect.width  = Mathf.RoundToInt(m_Text.textSize.x * scale.x);
                m_Rect.height = Mathf.RoundToInt(m_Text.textSize.y * scale.y);
            }

            if (m_RankIcon != null)
            {
                m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(message.Rank, m_RankIcon.Count - 1).ToString("D2"));
            }

            if (m_RankText != null)
            {
                m_RankText.SetNewText(message.Rank.ToString());
            }

            if (m_HighlightBkg != null)
            {
                Vector2   pos    = m_HighlightBkg.GetOrigPos();
                Transform trans  = m_HighlightBkg.transform;
                Vector3   scale  = trans.lossyScale;
                int       offset = Mathf.RoundToInt(pos.y - m_Root.GetOrigPos().y);
                int       width  = Mathf.RoundToInt(m_HighlightBkg.GetWidth());
                int       height = (int)m_Rect.height + 4;

                offset -= offset - Mathf.RoundToInt(m_HighlightBkg.GetHeight() * 0.5f * scale.y);
                pos.y   = pos.y - offset + height * 0.5f * scale.y;

                m_HighlightBkg.UpdateSpritePosAndSize(0, pos.x, pos.y, width, height);

                m_Rect.width = Mathf.RoundToInt(width * scale.x);
                //m_Rect.height = Mathf.RoundToInt(height * scale.y);
            }

            foreach (var button in m_Buttons)
            {
                Transform trans = button.transform;
                Vector3   pos   = trans.localPosition;

                pos.y = m_Rect.height * 0.5f;
                trans.localPosition = pos;
            }

            m_HoverButton = null;
        }
예제 #7
0
    // GUIPOPUP INTERFACE

    public override void SetCaption(string inPrimaryKey)
    {
        m_PrimaryKey = inPrimaryKey;

        FriendInfo friend   = GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == m_PrimaryKey);
        string     nickname = friend != null ? friend.Nickname : m_PrimaryKey;
        string     caption  = string.Format(TextDatabase.instance[0104114], GuiBaseUtils.FixNameForGui(nickname));

        m_CaptionLabel.SetNewText(caption);
    }
예제 #8
0
        public void Update(FriendInfo inFriend)
        {
            m_FriendInfo = inFriend;

            m_Nickname.SetNewText(GuiBaseUtils.FixNameForGui(m_FriendInfo.Nickname));
            m_RankText.SetNewText(m_FriendInfo.Rank <= 0 ? "" : m_FriendInfo.Rank.ToString());

            string rankState = string.Format("Rank_{0}", Mathf.Min(m_FriendInfo.Rank, m_RankIcon.Count - 1).ToString("D2"));

            m_RankIcon.State = m_FriendInfo.Rank <= 0 ? GUIBase_MultiSprite.DefaultState : rankState;
        }
예제 #9
0
        public void Update(FriendInfo friend, bool selected)
        {
            m_FriendName = friend.PrimaryKey;

            m_Highlight.Show(m_Line.Visible && selected, true);
            m_Nickname.SetNewText(GuiBaseUtils.FixNameForGui(friend.Nickname));
            m_RankText.SetNewText(friend.Rank <= 0 ? "" : friend.Rank.ToString());
            m_UnreadMsgs.SetNewText(string.Format(TextDatabase.instance[0506013], friend.UnreadMessages));

            string rankState = string.Format("Rank_{0}", Mathf.Min(friend.Rank, m_RankIcon.Count - 1).ToString("D2"));

            m_RankIcon.State = friend.Rank <= 0 ? GUIBase_MultiSprite.DefaultState : rankState;
        }
예제 #10
0
    protected override void OnViewShow()
    {
        m_PasswordLength = -1;

        CloudUser cloudUser = CloudUser.instance;

        if (cloudUser.GetLoginData(ref m_LoadedNickName,
                                   ref m_LoadedUserName,
                                   ref m_LoadedPassword,
                                   ref m_LoadedPasswordLength,
                                   ref m_LoadedRememberMe,
                                   ref m_LoadedAutoLogin) == false)
        {
            m_LoadedUserName       = m_UserName = s_DefaultUserNameText;
            m_LoadedPassword       = m_PasswordHash = s_DefaultPasswordText;
            m_LoadedPasswordLength = m_PasswordLength = 0;
            m_LoadedRememberMe     = m_RememberMe = true;
            m_LoadedAutoLogin      = m_AutoLogin = false;
        }
        else
        {
            m_UserName       = m_LoadedUserName.ToLower();
            m_PasswordHash   = m_LoadedPassword;
            m_RememberMe     = m_LoadedRememberMe;
            m_PasswordLength = m_LoadedPasswordLength;
            m_AutoLogin      = m_LoadedAutoLogin;
        }

        string userName = GuiBaseUtils.FixNameForGui(m_UserName);

        m_UserNameButton.SetNewText(userName);
        if (m_UserName != s_DefaultUserNameText)
        {
            m_UserNameButton.TextFieldText = userName;
        }

        m_PasswordButton.TextFieldText = "";
        m_PasswordButton.SetNewText(passwordGUIText);
        ;
        m_RememberMeButton.SetValue(m_RememberMe);
        m_AutoLoginButton.SetValue(m_AutoLogin);

        UpdateLoginButton();

#if UNITY_STANDALONE //there is no back on PC/MAC
        GetWidget("Back_Button").Show(false, true);
#endif
        base.OnViewShow();
    }
예제 #11
0
        public void Update(Message message, int index, bool selected)
        {
            m_MessageIndex = index;

            m_Highlight.Show(m_Line.Visible && selected, true);
            m_Sender.SetNewText(GuiBaseUtils.FixNameForGui(message.GetSender()));
            m_Subject.SetNewText(GuiBaseUtils.TrimLongText(message.GetSubject(), MAX_SUBJECT_LENGTH));

            m_SenderIcon.State = message.GetMultiSpriteState();

            if (message.m_IsRead != m_IsReadIcon.Widget.Visible)
            {
                m_IsReadIcon.Widget.Show(message.m_IsRead, true);
            }
        }
예제 #12
0
    void OnChatJoined(string primaryKey, string messageId, string messageText)
    {
        JsonData data   = JsonMapper.ToObject(messageText);
        string   master = data["master"].ToString();
        string   slave  = data["slave"].ToString();

        primaryKey = m_PrimaryKey == master ? slave : master;
        FriendInfo info = m_Friends.Find(obj => obj.PrimaryKey == primaryKey);

        if (info == null)
        {
            return;
        }

        AddSystemMessage(info, string.Format(TextDatabase.instance[0506011], GuiBaseUtils.FixNameForGui(info.Nickname)));
    }
예제 #13
0
    IEnumerator JoinGang_Coroutine(string master)
    {
        m_IsJoining = true;

        bool canJoin = GuiFrontendMain.IsVisible;

        if (canJoin == true)
        {
            if (m_Master == null && IsVisible == false)
            {
                var      friend   = GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == master);
                string   nickname = GuiBaseUtils.FixNameForGui(friend.Nickname);
                string   caption  = TextDatabase.instance[0109064];              //string.Format(TextDatabase.instance[0109064], nickname);
                string   text     = string.Format(TextDatabase.instance[0109065], nickname);
                GuiPopup popup    = GuiFrontendMain.ShowPopup("ConfirmDialog",
                                                              caption,
                                                              text,
                                                              (inPopup, inResult) =>
                {
                    if (inResult != E_PopupResultCode.Ok)
                    {
                        canJoin = false;
                    }
                });

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

                    if (m_IsJoining == false)
                    {
                        popup.ForceClose();
                    }
                }
            }

            if (canJoin == true)
            {
                canJoin = JoinGang(master);
            }
        }

        UpdateStatus(master, canJoin);

        m_IsJoining = false;
    }
예제 #14
0
    void Delegate_OnKeyboardClose(GUIBase_Button inInput, string inKeyboardText, bool inInputCanceled)
    {
        MFDebugUtils.Assert(m_NameButton == inInput);

        m_UserName = inKeyboardText.ToLower();

        if (m_IsForPassword)
        {
            m_NameButton.SetNewText(new string('*', GuiBaseUtils.FixNameForGui(m_UserName).Length));
        }
        else
        {
            m_NameButton.SetNewText(GuiBaseUtils.FixNameForGui(m_UserName));
        }

        UpdateOKButton();
    }
예제 #15
0
        public void Update(RoundFinalResult.PlayerResult player, RoundFinalResult.PreyNightmare data)
        {
            if (player == null)
            {
                return;
            }

            m_Root.Show(true, true);

            int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(player.Experience);

            bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == player.PrimaryKey) != -1;

            m_FriendIcon.Show(isFriend, true);

            AnimateWidget(m_NicknameLabel, GuiBaseUtils.FixNameForGui(player.NickName));
            AnimateWidget(m_KilledByMeLabel, 0, data.KilledByMe);
            AnimateWidget(m_KilledMeLabel, 0, data.KilledMe);
            m_RankLabel.SetNewText(rank.ToString());
            m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2"));
        }
예제 #16
0
        public void Update(PendingFriendInfo inFriend)
        {
            m_FriendInfo = inFriend;

            // update GUI...

            {
                m_FacebookIcon.Show(false, false);
                m_FacebookName.Widget.Show(false, false);
                m_Username.Widget.Show(true, false);

                string username = string.IsNullOrEmpty(m_FriendInfo.Username_New) ? m_FriendInfo.PrimaryKey : m_FriendInfo.Username_New;
                string nickname = string.IsNullOrEmpty(m_FriendInfo.Nickname) ? username : m_FriendInfo.Nickname;

                m_Username.SetNewText(GuiBaseUtils.FixNameForGui(nickname));
            }

            string added = GetLastOnlineInfo(m_FriendInfo);

            m_Added.SetNewText(added);

            bool beMyFriendRequest = m_FriendInfo.IsItRequest;

            string message = string.IsNullOrEmpty(m_FriendInfo.Message) ? TextDatabase.instance[FS_REQUEST] : m_FriendInfo.Message;
            string status  = beMyFriendRequest ? message : TextDatabase.instance[FS_PENDING];

            if (status.Length > MESSAGE_MAX_LENGTH)
            {
                status = status.Substring(0, MESSAGE_MAX_LENGTH - 3) + "...";
            }

            m_Status.SetNewText(status);
            m_Accept.Widget.Show((beMyFriendRequest ? true : false), true);
            m_Reject.Widget.Show((beMyFriendRequest ? true : false), true);
            m_Remove.Widget.Show((beMyFriendRequest ? false : true), true);

            //Debug.Log("show PPI " + inPPI.Name + " " + inPPI.Score.Score.ToString());
        }
예제 #17
0
    void RefreshControls()
    {
        for (int idx = 0; idx < m_Rows.Length; ++idx)
        {
            RefreshListItem(idx, m_Rows[idx].FriendIndex);
        }
        m_FriendList.MaxItems = m_Friends.Length;

        var friend = string.IsNullOrEmpty(m_Master) == false?GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == m_Master) : null;

        string nickname = friend != null?GuiBaseUtils.FixNameForGui(friend.Nickname) : null;

        string caption = string.IsNullOrEmpty(nickname) == false
                                                                                 ? string.Format(TextDatabase.instance[109052], nickname)
                                                                                 : TextDatabase.instance[109053];

        m_CaptionLabel.SetNewText(caption);

        m_ReadyButton.IsDisabled    = m_Master == null ? true : false;
        m_ReadyButton.isHighlighted = string.IsNullOrEmpty(m_Master) == false ? m_IsReady : false;

        m_GametypeRoller.Selection = (int)m_Gametype;
    }
예제 #18
0
    protected override void OnViewUpdate()
    {
        base.OnViewUpdate();

        if (m_Score.IsVisible == true)
        {
            m_Score.UpdateView();
        }

        if (WaitingForSpawn == false)
        {
            int    minutes = Client.TimeToRespawn / 60;
            int    seconds = Client.TimeToRespawn % 60;
            string time    = string.Format("{0:00}:{1:00}", minutes, seconds);

            // Get time to next spawn...
            m_NextSpawn_Label.SetNewText(time);

            if (m_NextSpawn_Label.Widget.Visible == false)
            {
                UpdateControlsVisibility();
            }
        }

        // update following player name
        if (FollowingPlayer == true)
        {
            m_PlayerName_Label.SetNewText(GuiBaseUtils.FixNameForGui(SpectatorCamera.GetSpectatedPlayerName()));
        }

        // update state of 'follow player' and 'free' spectator buttons
        UpdateButtonsState();
        UpdateZoneControlState();
        UpdateDeathMatchState();

        SetAnticheatButtonVisibility(SecurityTools.UserHasAnticheatManagementPermissions());
    }
예제 #19
0
    //------------------------------------------------------------------------------------------------------------------
    void Delegate_OnKeyboardClose(GUIBase_Button inInput, string inKeyboardText, bool inInputCanceled)
    {
        if (inInput == m_UserNameButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_NickName     = string.Empty;
                m_UserName     = string.Empty;
                m_FreeUserName = null;

                m_UserNameButton.SetNewText("");

                VerifyAccountData();
                UpdateCreateAccountButton();
            }
            else
            {
                string text = GuiBaseUtils.FixNickname(inKeyboardText, m_UserName, false);
                if (string.IsNullOrEmpty(text) == false && m_UserName != text.ToLower())
                {
                    // filter out swear words
                    m_NickName = text.FilterSwearWords(true);
                    // we allow lowercase username only
                    m_UserName = text.ToLower();
                    m_UserNameButton.SetNewText(GuiBaseUtils.FixNameForGui(m_UserName));
                    m_FreeUserName = null;

                    VerifyAccountData();
                    UpdateCreateAccountButton();
                }
            }
        }
        else if (inInput == m_PasswordButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_PasswordHash   = null;
                m_PasswordLength = 0;
            }
            else
            {
                m_PasswordHash   = CloudServices.CalcPasswordHash(inKeyboardText);
                m_PasswordLength = inKeyboardText.Length;
            }

            m_PasswordButton.SetNewText(passwordGUIText);
            VerifyAccountData();
            UpdateCreateAccountButton();
        }
        else if (inInput == m_ConfirmPasswordButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_ConfirmPasswordHash   = null;
                m_ConfirmPasswordLength = 0;
            }
            else
            {
                m_ConfirmPasswordHash   = CloudServices.CalcPasswordHash(inKeyboardText);
                m_ConfirmPasswordLength = inKeyboardText.Length;
            }

            m_ConfirmPasswordButton.SetNewText(confirmGUIText);
            VerifyAccountData();
            UpdateCreateAccountButton();
        }
        else
        {
            Debug.LogError("Unknown input widget !!!");
        }
    }
예제 #20
0
        public void Update()
        {
            if (m_Player == null)
            {
                return;
            }

            m_Root.Show(true, true);

            var animation = MFGuiManager.AnimateWidget(m_Root);

            animation.Duration = 0.15f;
            animation.Scale    = 1.1f;
            animation.Alpha    = 0.0f;

            bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == m_Player.PrimaryKey) != -1;

            m_FriendIcon.Show(isFriend, true);

            int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(m_Player.Experience);

            Color color = m_TeamColors[(int)m_Player.Team];

            color.a      = m_LocalPlayer == true ? 1.0f : 0.5f;
            m_Root.Color = color;

            m_NicknameLabel.SetNewText(GuiBaseUtils.FixNameForGui(m_Player.NickName));
            m_StandLabel.SetNewText(m_Index.ToString());
            m_ScoreLabel.SetNewText(m_Player.Score.ToString());
            m_KillsLabel.SetNewText(m_Player.Kills.ToString());
            m_DeadsLabel.SetNewText(m_Player.Deaths.ToString());
            m_RankLabel.SetNewText(rank.ToString());
            m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2"));

            string platform;

            switch (m_Player.Platform)
            {
            case RuntimePlatform.Android:
                platform = "Plat_Andro";
                break;

            case RuntimePlatform.IPhonePlayer:
                platform = "Plat_Apple";
                break;

            case RuntimePlatform.WindowsPlayer:
                platform = "Plat_Pc";
                break;

            case RuntimePlatform.OSXPlayer:
                platform = "Plat_Mac";
                break;

            case RuntimePlatform.WindowsWebPlayer:
                platform = "Plat_Fb";
                break;

            case RuntimePlatform.OSXWebPlayer:
                platform = "Plat_Fb";
                break;

            default:
                platform = "Plat_Skull";
                break;
            }
            m_PlatformIcon.State = platform;
        }
예제 #21
0
        public void Update(LeaderBoard.Row row, float normalizedScore, bool isFriend, bool inHighlightPlayer, string facebookName = null)
        {
            int xp   = row.Experience > 0 ? row.Experience : row.Score;
            int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(xp);

            string displayname = string.IsNullOrEmpty(row.DisplayName) ? row.PrimaryKey : GuiBaseUtils.FixNameForGui(row.DisplayName);

            if (facebookName != null)
            {
                displayname = GuiBaseUtils.FixNickname(facebookName + " (" + displayname + ")", displayname, false);
            }

            m_Order.SetNewText(row.Order < 0 ? "" : row.Order.ToString());
            m_RankText.SetNewText(rank <= 0 ? "" : rank.ToString());
            m_DisplayName.SetNewText(displayname);
            m_Score.SetNewText(row.Score < 0 ? "" : row.Score.ToString("N0"));

            string rankState = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2"));

            m_RankIcon.State = rank <= 0 ? GUIBase_MultiSprite.DefaultState : rankState;

            SetProgress(normalizedScore);

            m_Order.Widget.Color       = inHighlightPlayer ? HIGHLIGHT_COLOR : DEFAULT_COLOR;
            m_DisplayName.Widget.Color = inHighlightPlayer ? HIGHLIGHT_COLOR : DEFAULT_COLOR;
            m_Score.Widget.Color       = inHighlightPlayer ? HIGHLIGHT_COLOR : DEFAULT_COLOR;

            m_FriendIcon.FadeAlpha         = isFriend && (facebookName == null) ? 1.0f : 0.0f;
            m_FacebookFriendIcon.FadeAlpha = facebookName != null ? 1.0f : 0.0f;
        }
예제 #22
0
    void UpdatePlayerName(PlayerPersistantInfo ppi, bool reset)
    {
        string playerName = ppi != null ? ppi.Name : "";

        m_PlayerButton.SetNewText(GuiBaseUtils.FixNameForGui(playerName));
    }
예제 #23
0
    // =========================================================================================================================
    // === internal gui delegates ==============================================================================================
    void Delegate_OnFriendAction(string inFriendName, E_FriendAction inAction)
    {
        switch (inAction)
        {
        case E_FriendAction.Select:
            break;

        case E_FriendAction.ShowStats:
        {
            PlayerPersistantInfo        ppi  = null;
            List <PlayerPersistantInfo> ppis = new List <PlayerPersistantInfo>();
            foreach (var friend in m_Friends)
            {
                PlayerPersistantInfo temp = new PlayerPersistantInfo();
                temp.Name       = friend.Nickname;
                temp.PrimaryKey = friend.PrimaryKey;
                temp.InitPlayerDataFromStr(JsonMapper.ToJson(friend.PPIData));

                ppis.Add(temp);

                if (friend.PrimaryKey == inFriendName)
                {
                    ppi = temp;
                }
            }

            if (ppi != null)
            {
                GuiScreenPlayerStats.UserPPIs = ppis.ToArray();
                GuiScreenPlayerStats.UserPPI  = ppi;
                m_Owner.Owner.ShowScreen("PlayerStats");
            }
        }
        break;

        case E_FriendAction.SendMail:
            m_Owner.Owner.ShowPopup("SendMail", inFriendName, null);
            break;

        case E_FriendAction.Chat:
            if (GuiScreenChatFriends.StartChat(inFriendName) == true)
            {
                m_Owner.Owner.ShowScreen("Chat:1", true);
            }
            break;

        case E_FriendAction.Remove:
        {
            string text = string.Format(TextDatabase.instance[02040235], GuiBaseUtils.FixNameForGui(inFriendName));
            m_Owner.Owner.ShowPopup("ConfirmDialog",
                                    TextDatabase.instance[02040234],
                                    text,
                                    (inPopup, inResult) =>
                {
                    if (inResult == E_PopupResultCode.Ok)
                    {
                        GameCloudManager.friendList.RemoveFriend(inFriendName);
                    }
                });
        }
        break;

        default:
            break;
        }
    }