Ejemplo n.º 1
0
 public string getSpectatorViewPcId()
 {
     if (isSpPcInRoom && PlayerUserIdList.Count > 0)
     {
         foreach (string uid in PlayerUserIdList)
         {
             if (UserIdUtil.GetClientTypeByUid(uid) == ClientType.SpectatorViewPc)
             {
                 return(uid);
             }
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
        public void Connect(string rid, string uid)
        {
            if (state != VirtualManState.Init)
            {
                Debug.Log("VM#Connect#Wrong State. Current State:" + state.ToString());
                return;
            }
            SetStates(VirtualManState.JoiningRoom);

            this.roomId  = rid;
            this.mineUid = UserIdUtil.GetCombineUid(uid, clientType);

            NetHelper.Instance.JoinRoom(this.mineUid, rid, clientType, RoomType.VirtualMan);
        }
Ejemplo n.º 3
0
        public void Connect(string rid, string uid)
        {
            if (state != SpectatorViewState.Init)
            {
                Debug.Log("SV#Connect#Wrong State. Current State:" + state.ToString());
                return;
            }
            if (rid != null && !rid.Equals(""))
            {
                this.roomId = rid;
            }
            SetStates(SpectatorViewState.JoiningRoom);

            this.mineUid = UserIdUtil.GetCombineUid(uid, clientType);

            NetHelper.Instance.JoinRoom(this.mineUid, roomId, clientType, RoomType.SpeactorView);
        }
Ejemplo n.º 4
0
        private void RemoveSpectatorViewPlayer(string uid)
        {
            if (PlayerUserList.ContainsKey(uid))
            {
                SpectatorViewPlayer player = null;
                PlayerUserList.TryGetValue(uid, out player);
                if (player != null)
                {
                    DestroyImmediate(player.gameObject);

                    PlayerUserList.Remove(uid);
                }

                if (UserIdUtil.GetClientTypeByUid(uid) == ClientType.SpectatorViewPc)
                {
                    isSpPcInRoom = false;
                }
            }
        }
Ejemplo n.º 5
0
 public void OnUserLeaveRoom(string rid, string uid)
 {
     onUserLeaveRoom?.Invoke(rid, UserIdUtil.GetUidByCombinedUid(uid));
 }
Ejemplo n.º 6
0
 public void OnUserEnterRoom(string rid, string uid, GameObject go, Transform eyeTransform, bool isLocalPlayer)
 {
     onUserEnterRoom?.Invoke(rid, UserIdUtil.GetUidByCombinedUid(uid), go, eyeTransform, isLocalPlayer);
 }
Ejemplo n.º 7
0
        void Update()
        {
            if (Input.GetKey(KeyCode.B))
            {
                if (ShowLog._instance != null)
                {
                    ShowLog._instance.ShowHide();
                }
            }

            while (operationQueue.Count() > 0)
            {
                OperationBean op = operationQueue.Dequeue();
                switch (op.op)
                {
                case OperationBean.OpId.UserEnter:
                    PlayerUserIdList.Add((string)op.param);
                    ClientType clientType = UserIdUtil.GetClientTypeByUid((string)op.param);
                    #region  发送Creator的语言版本,每个客户端应自主选择
                    //if (GameLanguageController._instance.GameLanguageType == LanguageType.Chinese)
                    //{
                    //    SyncInterface.Instance.SyncOtherCmd("CmdSetLanguageCn", new string[0]);
                    //}
                    //else
                    //{
                    //    SyncInterface.Instance.SyncOtherCmd("CmdSetLanguageEn", new string[0]);
                    //}
                    //SyncInterface.Instance.SyncOtherCmd("CmdCloseLanguagePanel", new string[0]);
                    #endregion
                    if (clientType == ClientType.IOS)
                    {
                        //TODO-->>  IOS端登陆成功
                        //TODO-->>  隐藏hololens提示UI
                    }
                    if (clientType == ClientType.Hololens)
                    {
                        AddVirtualManPlayer((string)op.param, false, false);
                    }
                    break;

                case OperationBean.OpId.UserLeave:
                    if (PlayerUserIdList.Contains((string)op.param))
                    {
                        PlayerUserIdList.Remove((string)op.param);
                    }
                    RemoveVirtualManPlayer((string)op.param);
                    if (PlayerUserIdList.Count == 0)
                    {
                        Disconnect();
                    }
                    break;

                case OperationBean.OpId.SelfJoinRoom:
                    if (this.clientType != ClientType.SpectatorViewPc && this.clientType != ClientType.IOS)
                    {
                        AddVirtualManPlayer(this.mineUid, true, this.isControler);

                        SyncInterface.Instance.OnSelfJoinnedRoom(roomId, this.isCreator,
                                                                 (Dictionary <string, string[]>)op.param);
                    }

                    //OpenSyncWorldRootCanvas();
                    break;

                case OperationBean.OpId.NetDisconn:
                    if (MrShareData._instance.needLocated)
                    {
                        MrShareData._instance.needLocated = false;
                        MrShareData._instance.FloorTarget.SetActive(false);
                    }

                    ClearUserList();
                    PlayerUserIdList.Clear();
                    SetStates(VirtualManState.Init);
                    SyncInterface.Instance.OnSelfLeftRoom(roomId);

                    break;

                case OperationBean.OpId.FloorLocated:
                    if (state == VirtualManState.FloorLocating)
                    {
                        SetStates(VirtualManState.FloorLoacted);
                    }
                    else
                    {
                        Debug.Log("VM#OperationBean.OpId.FloorLocated#Wrong State. Current State:" +
                                  state.ToString());
                    }
                    break;

                case OperationBean.OpId.OtherCmd:
                    OtherCmd cmd = (OtherCmd)op.param;
                    SyncInterface.Instance.OnSyncOtherCmd(cmd.id, cmd.cmd);
                    break;

                case OperationBean.OpId.OnRoomCache:
                    SyncInterface.Instance.OnRoomCache(roomId, (Dictionary <string, string[]>)op.param);
                    break;
                }
            }
        }