コード例 #1
0
ファイル: UserManager.cs プロジェクト: ideadreamDefy/Defy
 private void OnUserEnterEvent(System.Object Target)
 {
     tagUserInfo UserInfo = (tagUserInfo)Target;
     //判断进入房间的是不是本人
     bool bSelf = UserInfo.dwUserID == UserCenter.Instance.UserID;
     if (!mPlayerDictionary.ContainsKey(UserInfo.dwUserID))
     {
         mPlayerDictionary[UserInfo.dwUserID] = new Player(UserInfo);
         tagUserStatus statusBefore = new tagUserStatus();
         statusBefore.cbUserStatus = (byte)ENUM_USER_STATUS.US_NULL;
         tagUserStatus statusAfrer = new tagUserStatus();
         statusAfrer.cbUserStatus = UserInfo.cbUserStatus;
         if (OnUserEvent != null)
         {
             UserEvent Event = new UserEvent();
             Event.dwUserID = UserInfo.dwUserID;
             Event.bScoreChange = false;
             Event.statusBefore = statusBefore;
             Event.statusAfter = statusAfrer;
             OnUserEvent(Event);
         }
     }
 }
コード例 #2
0
ファイル: UserManager.cs プロジェクト: ideadreamDefy/Defy
        private void OnUserStatusEvent(System.Object Target)
        {
            CMD_GR_UserStatus UserStatus = (CMD_GR_UserStatus)Target;
            if (!mPlayerDictionary.ContainsKey(UserStatus.dwUserID))
                return;
            tagUserStatus statusBefore = new tagUserStatus();
            statusBefore.cbUserStatus = mPlayerDictionary[UserStatus.dwUserID].UserStatus;
            statusBefore.wChairID = mPlayerDictionary[UserStatus.dwUserID].ChairID;
            statusBefore.wTableID = mPlayerDictionary[UserStatus.dwUserID].TableID;

            mPlayerDictionary[UserStatus.dwUserID].UserStatus = UserStatus.UserStatus.cbUserStatus;
            mPlayerDictionary[UserStatus.dwUserID].TableID = UserStatus.UserStatus.wTableID;
            mPlayerDictionary[UserStatus.dwUserID].ChairID = UserStatus.UserStatus.wChairID;

            if (OnUserEvent != null) {
                UserEvent Event = new UserEvent();
                Event.dwUserID = UserStatus.dwUserID;
                Event.bScoreChange = false;
                Event.statusBefore = statusBefore;
                Event.statusAfter = UserStatus.UserStatus;
                OnUserEvent(Event);
            }
            //用户已经离开,删除用户列表中的对象
            if ((ENUM_USER_STATUS)UserStatus.UserStatus.cbUserStatus == ENUM_USER_STATUS.US_NULL)
            {
                OnUserLeaveEvent(UserStatus.dwUserID);
            }
        }