Beispiel #1
0
        /*** UXUser 객체를 넘겨받아 유저를 추가함 ***/
        public void AddUser(UXUser user)
        {
            // TODO : ConnectController 의 ProcessReceivedMessage -> cmd == 'user_add' 참조
            user.SetConnected(true);
            user.GetProfileFromServer();             //user name, image url저장

            UXUserController userController = UXUserController.Instance;
            List <UXObject>  userList       = userController.GetList();

            userController.Add((UXObject)user);             //사람 넣기
        }
Beispiel #2
0
        public bool IsConnectedUser(int index)
        {
            if (index < 0 || index >= objectList.Count)
            {
                return(false);
            }

            UXUser user = (UXUser)GetAt(index);

            return(user.IsConnected());
        }
Beispiel #3
0
        private bool IsPremiumRoom()
        {
            UXUserController userController = UXUserController.Instance;
            List <UXObject>  userList       = userController.GetList();

            for (int i = 0; i < userList.Count; i++)
            {
                UXUser user = (UXUser)userList[i];
                if (user.IsPremium)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #4
0
        public bool IsEqual(List <UXUser> list)
        {
            if (objectList.Count != list.Count)
            {
                return(false);
            }

            for (int i = 0; i < objectList.Count; i++)
            {
                UXUser user1 = (UXUser)objectList[i];
                UXUser user2 = list[i];

                if (user1.GetCode() != user2.GetCode() || user1.GetName() != user2.GetName())
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #5
0
        /*** UXUser 객체를 넘겨받아 유저를 삭제 ***/
        public void RemoveUser(UXUser user)
        {
            UXUserController userController = UXUserController.Instance;
            List <UXObject>  userList       = userController.GetList();

            for (int i = 0; i < userList.Count; i++)
            {
                if (user.GetCode().Equals(userList[i]))       ///
                {
                    if (!isGameStarted)                       // In lobby
                    {
                        userController.RemoveByName(user.GetName());
                    }
                    else
                    {
                        user.SetConnected(false);
                    }
                    break;
                }
            }
        }
Beispiel #6
0
        public void CopyList(List <UXUser> list)
        {
            // isPremium 정보 일시 저장
            List <UXObject> preObjList = new List <UXObject> (objectList);

            objectList.Clear();

            foreach (UXUser user in list)
            {
                user.IsPremium = false;
                foreach (UXObject preObj in preObjList)
                {
                    UXUser preUser = (UXUser)preObj;
                    if (user.GetCode() == preUser.GetCode())
                    {
                        user.IsPremium = preUser.IsPremium;
                    }
                }
                objectList.Add(user);
            }
        }
Beispiel #7
0
        /*** index을 넘겨받아 유저를 삭제 ***/
        public void RemoveUser(int index)
        {
            UXUserController userController = UXUserController.Instance;
            List <UXObject>  userList       = userController.GetList();

            for (int i = 0; i < userList.Count; i++)
            {
                UXUser user = (UXUser)userList[i];                 //누군지 찾는거
                if (i == index)
                {
                    if (!isGameStarted)                       // In lobby
                    {
                        userController.RemoveAt(index);
                    }
                    else
                    {
                        user.SetConnected(false);
                    }
                    break;
                }
            }
        }