public PRejectOrder() : base("reject", null, (string[] args) => { if (PUIManager.IsCurrentUI <PJoinUI>()) { PUIManager.AddNewUIAction("Reject-显示拒绝信息", () => { PUIManager.GetUI <PJoinUI>().ErrorText.text = "房间已满"; }); } }) { }
public PRoomDataOrder() : base("room", null, (string[] args) => { try { int Capacity = int.Parse(args[1]); PSystem.CurrentRoom = new PRoom(Capacity); #region 分析房间的属性 int Index = 2; for (int i = 0; i < Capacity; ++i) { PPlayerType playerType = FindInstance <PPlayerType>(args[Index++]); if (playerType != null) { PSystem.CurrentRoom.PlayerList[i].PlayerType = playerType; PSystem.CurrentRoom.PlayerList[i].Nickname = args[Index++]; if (PSystem.CurrentRoom.PlayerList[i].Nickname.Equals("&")) { PSystem.CurrentRoom.PlayerList[i].Nickname = string.Empty; } } } #endregion #region 更新RUI的数据(未打开则先打开)及开始游戏按钮可交互性 PUIManager.AddNewUIAction("RoomData-更新RUI数据", () => { if (!PUIManager.IsCurrentUI <PRoomUI>()) { PUIManager.ChangeUI <PRoomUI>(); //如果游戏已经开始,把游戏关闭 } PUIManager.GetUI <PRoomUI>().SeatList.ForEach((PRoomUI.PSeat Seat) => { Seat.Update(); }); PUIManager.GetUI <PRoomUI>().StartGameButton.interactable = PSystem.CurrentRoom.IsFull(); }); #endregion } catch (Exception e) { PLogger.Log("房间数据错误"); PLogger.Log(e.ToString()); } }) { }
public PHighlightBlockOrder() : base("hightlight_block", null, (string[] args) => { int BlockIndex = Convert.ToInt32(args[1]); int Frame = 0; if (PUIManager.IsCurrentUI <PMapUI>() && 0 <= BlockIndex && BlockIndex < PNetworkManager.NetworkClient.GameStatus.Map.BlockList.Count) { PAnimation.AddAnimation("高亮格子", () => { PBlockScene Scene = PUIManager.GetUI <PMapUI>().Scene.BlockGroup.GroupUIList[BlockIndex]; if (Frame == 0) { Frame = 1; Scene.BlockImage.gameObject.GetComponent <MeshRenderer>().material.color = PBlockScene.Config.HighlightedBlockColor; } else { Scene.BlockImage.gameObject.GetComponent <MeshRenderer>().material.color = PBlockScene.Config.DefaultBlockColor; } }, 2, 0.5f); } }) { }
void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (PUIManager.IsCurrentUI <PMapUI>()) { PUIManager.GetUI <PMapUI>().Space(); } } if (Input.GetMouseButtonDown(1)) { MouseRightButtonDown = true; if (PUIManager.CurrentUI.Equals(PUIManager.GetUI <PMapUI>())) { PUIManager.AddNewUIAction("启动右键拖拽", () => { PUIManager.GetUI <PMapUI>().CameraController.StopTracking(); LastMousePosition = Input.mousePosition; }); } } if (Input.GetMouseButtonUp(1)) { MouseRightButtonDown = false; } if (MouseRightButtonDown) { if (PUIManager.CurrentUI.Equals(PUIManager.GetUI <PMapUI>())) { PUIManager.AddNewUIAction(string.Empty, () => { Vector3 MouseDirection = Input.mousePosition - LastMousePosition; LastMousePosition = Input.mousePosition; Vector3 MoveDirection = new Vector3(MouseDirection.y, 0, -MouseDirection.x) * Config.MouseSensitivity; PUIManager.GetUI <PMapUI>().CameraController.ChangePerspective(PUIManager.GetUI <PMapUI>().CameraController.Camera.position + MoveDirection); }); } } #region 标滚动 if (Input.GetAxis("Mouse ScrollWheel") < 0) { if (PUIManager.CurrentUI.Equals(PUIManager.GetUI <PMapUI>()) && PUIManager.GetUI <PMapUI>().CameraController != null) { if (PMath.InRect(Input.mousePosition, PUIManager.GetUI <PMapUI>().InformationText.rectTransform)) { PUIManager.AddNewUIAction("查看下一条信息", () => { PUIManager.GetUI <PMapUI>().NextInformation(); }); } else { PUIManager.AddNewUIAction("缩放[zoom+]", () => { if (PCameraController.Config.CameraLockedDistance.magnitude < 80.0f) { PCameraController.Config.CameraLockedDistance += PCameraController.Config.CameraZoomDistance; PUIManager.GetUI <PMapUI>().CameraController.ChangePerspective(PUIManager.GetUI <PMapUI>().CameraController.Camera.position + PCameraController.Config.CameraZoomDistance); } }); } } } else if (Input.GetAxis("Mouse ScrollWheel") > 0) { if (PUIManager.CurrentUI.Equals(PUIManager.GetUI <PMapUI>()) && PUIManager.GetUI <PMapUI>().CameraController != null) { if (PMath.InRect(Input.mousePosition, PUIManager.GetUI <PMapUI>().InformationText.rectTransform)) { PUIManager.AddNewUIAction("查看上一条信息", () => { PUIManager.GetUI <PMapUI>().LastInformation(); }); } else { PUIManager.AddNewUIAction("缩放[zoom-]", () => { if (PCameraController.Config.CameraLockedDistance.magnitude > 20.0f) { PCameraController.Config.CameraLockedDistance -= PCameraController.Config.CameraZoomDistance; PUIManager.GetUI <PMapUI>().CameraController.ChangePerspective(PUIManager.GetUI <PMapUI>().CameraController.Camera.position - PCameraController.Config.CameraZoomDistance); } }); } } } #endregion #region 择格子 if (Input.GetMouseButtonUp(0)) { if (PUIManager.CurrentUI.Equals(PUIManager.GetUI <PMapUI>()) && !PUIManager.GetUI <PMapUI>().MessageBox.IsActive) { Vector3 WorldPosition1 = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 20.0f)); Vector3 WorldPosition2 = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 30.0f)); Vector3 WorldPosition = new Vector3((WorldPosition1.x - WorldPosition2.x) / (WorldPosition1.y - WorldPosition2.y) * (-WorldPosition1.y) + WorldPosition1.x, 0, (WorldPosition1.z - WorldPosition2.z) / (WorldPosition1.y - WorldPosition2.y) * (-WorldPosition1.y) + WorldPosition1.z); PBlock FindBlockResult = PNetworkManager.NetworkClient.GameStatus.Map.FindBlock(PUIManager.GetUI <PMapUI>().Scene.BlockGroup.FindBlockSceneIndex(WorldPosition)); if (FindBlockResult != null) { PNetworkManager.NetworkClient.Send(new PClickOnBlockOrder(FindBlockResult.Index.ToString())); } } } #endregion }