コード例 #1
0
        //增加好友
        public void OnAddFriend(ulong friendID, string friendName, int friendLevel, bool onLine)
        {
            FriendInfo info = new FriendInfo(friendID, friendName, friendLevel, onLine);

            friendList.Add(info);
            //刷新好友列表UI
        }
コード例 #2
0
        public int Compare(Object object1, Object object2)
        {
            FriendInfo info1 = (FriendInfo)object1;
            FriendInfo info2 = (FriendInfo)object2;

            return(info2.level.CompareTo(info1.level));
        }
コード例 #3
0
        //增加仇人
        public void OnAddEnemy(ulong roleID, string roleName, int roleLevel, bool onLine)
        {
            FriendInfo info = new FriendInfo(roleID, roleName, roleLevel, onLine);

            enemyList.Add(info);
            //刷新仇人列表UI
        }
コード例 #4
0
        //同步好友
        public void OnSyncFriends(RemoteTable dataTab)
        {
            //to be continue
            RemoteObject remoteObj = null;
            FriendInfo   info      = null;
            RemoteTable  friendTab = (RemoteTable)dataTab["friend"];
            RemoteTable  enemyTab  = (RemoteTable)dataTab["enemy"];

            if (friendTab != null)
            {
                foreach (KeyValuePair <object, object> value in friendTab.dictKV)
                {
                    remoteObj = value.Value as RemoteObject;
                    if (remoteObj == null)
                    {
                        continue;
                    }
                    info = new FriendInfo((ulong)(remoteObj["uID"].GetInt()), remoteObj["nickName"].GetString(), remoteObj["level"].GetInt(), remoteObj["onLine"].GetBool());
                    friendList.Add(info);
                }
            }

            if (enemyTab != null)
            {
                foreach (KeyValuePair <object, object> value in enemyTab.dictKV)
                {
                    remoteObj = value.Value as RemoteObject;
                    if (remoteObj == null)
                    {
                        continue;
                    }
                    info = new FriendInfo((ulong)(remoteObj["uID"].GetInt()), remoteObj["nickName"].GetString(), remoteObj["level"].GetInt(), remoteObj["onLine"].GetBool());
                    enemyList.Add(info);
                }
            }
        }