protected override bool OnMouseUp(EMouseButtons button) { //If atop openly any window to not process if (Controls.Count != 1) return base.OnMouseUp(button); switch (button) { case EMouseButtons.Left: if (tryingToMovePiece != null) { UpdateShouldSendMovingPiecePositionToServer(true); if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle()) tryingToMovePiece.ServerOrSingle_MoveFinish(); else tryingToMovePiece.Client_MoveTryToFinish(); tryingToMovePiece = null; return true; } break; } return base.OnMouseUp(button); }
private void RenderPieceSelectionBorder(JigsawPuzzlePiece piece, bool selected) { Camera camera = RendererWorld.Instance.DefaultCamera; if (selected) camera.DebugGeometry.Color = new ColorValue(0, 1, 0); else camera.DebugGeometry.Color = new ColorValue(1, 1, 0); camera.DebugGeometry.AddBounds(piece.MapBounds); }
protected override bool OnMouseDown(EMouseButtons button) { //If atop openly any window to not process if (Controls.Count != 1) return base.OnMouseDown(button); switch (button) { case EMouseButtons.Left: { tryingToMovePiece = GetPieceByCursor(); if (tryingToMovePiece != null) { if (EntitySystemWorld.Instance.IsServer()) { //server GameNetworkServer server = GameNetworkServer.Instance; tryingToMovePiece.Server_MoveBegin(server.UserManagementService.ServerUser); } else if (EntitySystemWorld.Instance.IsClientOnly()) { //client tryingToMovePiece.Client_MoveTryToBegin(); } else { //single mode tryingToMovePiece.Single_MoveBegin(); } Vec2 cursorPosition; GetGameAreaCursorPosition(out cursorPosition); tryingToMovePieceOffset = tryingToMovePiece.Position.ToVec2() - cursorPosition; return true; } } break; } return base.OnMouseDown(button); }