示例#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);
 }
示例#2
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;
                }
            }
        }
示例#3
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;
                }
            }
        }