private void Update() { //Debug creating labels if (Input.GetKey(KeyCode.Space)) { RoomUI next = Instantiate(roomObjectUI); byte tempMax = (byte)Random.Range(0, 30); next.SetLabels(Random.Range(-1000, 1000).ToString(), tempMax); next.gameObject.transform.parent = availableLobbies.content; } }
public IEnumerator UpdateRoomList(List <RoomInfo> newList) { foreach (RoomInfo ri in newList) { RoomUI newUI = Instantiate(roomObjectUI); newUI.SetLabels(ri.Name, ri.MaxPlayers, ri.PlayerCount); newUI.transform.parent = availableLobbies.content; yield return(null); } }
public void InitRooms(Patient[] patients, RoomUI roomUI) { this.roomUI = roomUI; for (byte i = 0; i < patients.Length; ++i) { rooms[i].InitRoom(patients[i]); } OnRoomClick(0); for (byte i = (byte)patients.Length; i < rooms.Length; ++i) { rooms[i].InitRoom(null); } }
public void SetTarget(Transform target) { CamFunction(roamCam, target); roamCam.transform.position = planCam.transform.position; roamCam.transform.rotation = planCam.transform.rotation; roamCam.gameObject.SetActive(true); planCam.gameObject.SetActive(false); moveToPlanet = true; var x = target.GetComponent <RoomInfo>().ui; rUI = x.GetComponent <RoomUI>(); }
//public bool isPreparing = false; public void PrepareLocalModel() { //if (isPreparing) // return; //isPreparing = true; RoomUI.Close(); ClearModels(); //GameRunUI.Show(); //GameLoadingUI.Show(); SendLoadProgress(20); UpdateRoomActor(); SendLoadProgress(50); BoxManager.instance.Init(); SendLoadProgress(100); //isPreparing = false; }
private void EndGaming(MessageXieYi xieyi) { Debug.Log("结束游戏"); CurrentPlayType = FramePlayType.游戏未开始; frameIndex = 0; reConnectIndex = 0;//游戏结束的时候未完成复现,则清除重连记录帧 CameraManager.instance.SetCameraEnable(false); CameraManager.instance.SetCameraFollow(transform); foreach (var item in memberGroup) { item.Value.Init(item.Key); } GameRunUI.Close(); TeamType winTeam = (TeamType)int.Parse(SerializeHelper.ConvertToString(xieyi.MessageContent)); RoomUI.Show(); GameOverUI.Show(winTeam); }
public void Init() { _gameState = CurrentGameState.StartNewGame(); _padLocation = 900; _clock = _gameState.Clock; _clickUi.Add(_branch); _overlay = new Overlay(); _branch.Add(_overlay.Branch); _pad = new Pad(_branch); _gameState.Pad = _pad; _room = new RoomUI(); _thoughts = new ThoughtUI(); _branch.Add(_thoughts.Branch); _dev = new DevView(); _branch.Add(_dev.Branch); _branch.Add(_room.Branch); InitAutomatons(); InitSubscriptions(); }
public void Update() { if (serverEvent.Count > 0) { MessageXieYi xieyi = serverEvent.Dequeue(); if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.createRoom || (MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.joinRoom) { JoinRoom joinInfo = new JoinRoom(); joinInfo = SerializeHelper.Deserialize <JoinRoom>(xieyi.MessageContent); ErrorType error = joinInfo.error; if (error != ErrorType.none) { UIManager.instance.ShowAlertTip("加入房间失败" + error); } else { //GameManager.GetRoomInfo(); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.getRoomInfo) { RoomUI.Show(); CreateRoomUI.Close(); } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.updateRoom) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { UIManager.instance.ShowAlertTip("更新房间失败:" + error); } else { UIManager.instance.ShowAlertTip("更新房间成功"); } Close(); } } }
void OnJoinedRoom() { RoomUI.SetActive(true); if (PhotonNetwork.room.PlayerCount == 1) { PhotonHashtable Player = new PhotonHashtable() { { "player", "P1" } }; PhotonNetwork.player.SetCustomProperties(Player); PhotonNetwork.player.NickName = "Player 1"; } else if (PhotonNetwork.room.PlayerCount == 2) { PhotonHashtable Player = new PhotonHashtable() { { "player", "P2" } }; PhotonNetwork.player.SetCustomProperties(Player); PhotonNetwork.player.NickName = "Player 2"; } else if (PhotonNetwork.room.PlayerCount == 3) { PhotonHashtable Player = new PhotonHashtable() { { "player", "P3" } }; PhotonNetwork.player.SetCustomProperties(Player); PhotonNetwork.player.NickName = "Player 3"; } if (PhotonNetwork.isMasterClient) { print("you are master client, waiting for full amount of players to start the game"); checkGameStart = true; } }
/// <summary> /// 방 리스트가 변경됨 /// </summary> void ChangeRooms() { if (_listPanel == null) { return; } foreach (GameObject item in _listItems) { DestroyImmediate(item); } _listItems.Clear(); foreach (RoomInfo room in m_Rooms) { GameObject obj = GameObject.Instantiate(_ItemPrefab, _listPanel.transform); RoomUI roomUI = obj.GetComponent <RoomUI>(); roomUI._info = room; roomUI.onGameRoomClicked += _manager.JoinGame; obj.GetComponentInChildren <Text>().text = room.Ttitle; _listItems.Add(obj); } }
private void Awake() { singleton = this; }
void Awake() { instance = this; }
public void Update() { if (serverEventTCP.Count > 0) { MessageXieYi xieyi = serverEventTCP.Dequeue(); if (xieyi == null) { Debug.LogError("有事件操作的协议为空?"); return; } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.login) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { ErrorShow(error); } else { SocketManager.instance.GetBeatTime(); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.getHeartBeatTime) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { SocketManager.instance.OpenHeartbeat(); // UILogin.Close(); HomeUI.Show(); // Debug.Log("自身检查是否需要重连。"); SocketManager.instance.SendSave((byte)MessageConvention.reConnectCheck, new byte[] { }, false); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.reConnectCheck) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { ReconnctInfo rcInfo = SerializeHelper.Deserialize <ReconnctInfo>(xieyi.MessageContent); if (rcInfo.isReconnect) { CurrentPlayType = FramePlayType.断线重连; ReConnectUI.Show(); } else { CurrentPlayType = FramePlayType.游戏未开始; } } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.quitRoom)//自己退出房间 { QuitInfo qInfo = SerializeHelper.Deserialize <QuitInfo>(xieyi.MessageContent); if (qInfo.isQuit) { UpdateMemberHide(); RoomUI.Close(); HomeUI.Show(); if (qInfo.userIndex != DataController.instance.MyLocateIndex) { UIManager.instance.ShowAlertTip("您被踢出房间。"); } } else { if (qInfo.userIndex == qInfo.quitUnique) { UIManager.instance.ShowAlertTip("退出房间失败。"); } } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.updateActorState) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { CheckState(xieyi); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.updateModelInfo) { GameModelData modelDate = SerializeHelper.Deserialize <GameModelData>(xieyi.MessageContent); SetPrepareData(modelDate); } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.getPreGameData) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { Debug.Log("验证本客户端收到游戏前准备数据。客户端响应已收到:" + xieyi.MessageContentLength); SendState(RoomActorState.WaitForStart); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.startGaming) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { StartGaming(); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.endGaming) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { EndGaming(xieyi); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.frameData) { Debug.LogError("TCP收到整串操作数据"); UDPManager.instance.DealFrameData(xieyi); if (CurrentPlayType == FramePlayType.断线重连) { CurrentPlayType = FramePlayType.游戏中; } if (CurrentPlayType == FramePlayType.主动请求数据) { CurrentPlayType = FramePlayType.游戏中; } } } //UDP if (serverEventUDP.Count > 0) { MessageXieYi xieyi = serverEventUDP.Dequeue(); if (xieyi == null) { Debug.LogError("有UDP事件操作的协议为空?"); return; } if (xieyi.XieYiFirstFlag == (byte)MessageConvention.setUDP) { UDPManager.instance.IsConnect = true; Debug.LogError("用tcp 设置房间 udp"); //SocketManager.instance.SendSave((byte)MessageConvention.setUDP, xieyi.MessageContent, false); } } }
static void Postfix(RoomUI __instance) { WardManager.SetupUI(); }
private void Awake() { base.BaseAwake(); room = GetComponent <RoomUI>(); }
private void Awake() { instance = this; // SocketManager.ListenDelegate(true, messageHandle, OperationListenInfo); }