Example #1
0
        static void AddDancer(uint roleID, RoomPlayer player)
        {
            RoomPlayerData apd = GetDancerPlayerByID(roleID);

            if (apd == null)
            {
                apd = new RoomPlayerData(roleID);
                mDancerList.Add(apd);
            }
            apd.mRoomPlayer = player;
        }
Example #2
0
        public static RoomPlayerData GetDancerPlayerByID(uint roleId)
        {
            int listCount = mDancerList.Count;

            for (int i = 0; i < listCount; ++i)
            {
                RoomPlayerData v = mDancerList[i];
                if (v != null)
                {
                    if (v.mRoomPlayer != null && v.mRoomPlayer.RoleID == roleId)
                    {
                        return(v);
                    }
                }
                else
                {
                    Debug.LogError("RoomData GetDancerPlayerByPos failed.RoomPlayerData can not be null.");
                }
            }
            return(null);
        }
Example #3
0
        public static IEnumerator CreateAllRoomPlayer()
        {
            List <IEnumerator> createlist = new List <IEnumerator>();

            int listCount = mDancerList.Count;

            for (int i = 0; i < listCount; ++i)
            {
                RoomPlayerData dancerData = mDancerList[i];
                if (dancerData != null && dancerData.mRoomPlayer != null)
                {
                    int dancerPos = dancerData.mRoomPlayer.RolePos;
                    if (dancerData.mRoomPlayer != mMeInfo)
                    {
                        PlayerBase dancerPlayer = mRoomPlayer[dancerPos];
                        if (dancerPlayer != null)
                        {
                            PhysicsType pType = PhysicsType.Player;

                            IEnumerator itor = dancerPlayer.CreatePhysics(true, pType);
                            createlist.Add(itor);
                        }
                    }
                }
            }

            while (createlist.Count != 0)
            {
                yield return(null);

                for (int i = 0; i < createlist.Count; ++i)
                {
                    if (!createlist[i].MoveNext())
                    {
                        createlist.RemoveAt(i);
                    }
                }
            }
        }