コード例 #1
0
ファイル: FriendListView.cs プロジェクト: huokele/shadow-gun
        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());
        }
コード例 #2
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);
    }
コード例 #3
0
 void CheckFriendOnlineStatus(string primaryKey, List <FriendList.FriendInfo> friends, ref bool isOnline, ref bool isPlaying)
 {
     FriendList.FriendInfo friend = friends.Find(obj => obj.PrimaryKey == primaryKey);
     if (friend != null)
     {
         isOnline  = friend.OnlineStatus == FriendList.E_OnlineStatus.InLobby ? true : false;
         isPlaying = friend.OnlineStatus == FriendList.E_OnlineStatus.InGame ? true : false;
     }
     else
     {
         isOnline  = false;
         isPlaying = false;
     }
 }
コード例 #4
0
    bool OnIsMessageSelectable(Chat.Message message)
    {
        // filter out friends
        FriendList.FriendInfo friend = GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == message.PrimaryKey);
        if (friend != null)
        {
            return(false);
        }

        // filter out pending friends
        FriendList.PendingFriendInfo pending = GameCloudManager.friendList.pendingFriends.Find(obj => obj.PrimaryKey == message.PrimaryKey);
        if (pending != null)
        {
            return(false);
        }

        // done
        return(true);
    }
コード例 #5
0
ファイル: FriendListView.cs プロジェクト: huokele/shadow-gun
        string GetLastOnlineInfo(FriendInfo inFriend)
        {
            switch (inFriend.OnlineStatus)
            {
            case FriendList.E_OnlineStatus.InLobby:
                return(TextDatabase.instance[LOI_NOW]);

            case FriendList.E_OnlineStatus.InGame:
                return(TextDatabase.instance[LOI_PLAYING]);

            default:
                break;
            }

            double lastOnlineDate = inFriend.PPIData.Stats.GetLastPlayedDate();

            if (inFriend.LastOnlineDate > lastOnlineDate)
            {
                lastOnlineDate = inFriend.LastOnlineDate;
            }

            return(lastOnlineDate <= 0 ? TextDatabase.instance[LOI_UNKNOWN] : GuiBaseUtils.EpochToString(lastOnlineDate));
        }
コード例 #6
0
    bool JoinChat(string master, string slave, bool activate)
    {
        string primaryKey = m_PrimaryKey == master ? slave : master;

        FriendList.FriendInfo friend = GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == primaryKey);
        if (friend == null)
        {
            return(false);
        }

        int idx = m_Friends.FindIndex(obj => obj.PrimaryKey == primaryKey);

        if (idx < 0)
        {
            idx = m_Friends.Count;

            m_Friends.Add(new FriendInfo()
            {
                PrimaryKey = friend.PrimaryKey,
                Nickname   = friend.Nickname,
                Rank       = friend.Rank
            });

            m_FriendList.MaxItems = m_Friends.Count;
        }

        FriendInfo info = m_Friends[idx];

        bool sendJoined = false;

        if (info.Master != master)
        {
            Chat.Unregister(info.Channel, this);
            sendJoined = true;
        }

        info.Master  = master;
        info.Slave   = slave;
        info.Channel = ChannelCache.GetChannelFor(m_PrimaryKey + primaryKey, master, slave);

        Chat.Register(info.Channel, this);

        if (activate == true || m_ActiveFriend < 0)
        {
            ActivateChat(idx);
        }

        m_FriendList.Widget.SetModify();

        if (sendJoined == true)
        {
            var result = new
            {
                master = info.Master,
                slave  = info.Slave
            };
            LobbyClient.SendMessageToPlayer(info.Master == m_PrimaryKey ? info.Slave : info.Master, CMD_JOINED, JsonMapper.ToJson(result));
        }

        return(true);
    }