public override void OnMouseDown(MouseButton button, int x, int y) { if (directConnectIPEnter == false) { int serverIndex = (y - drawRect.Y - 75) / 25; if (serverIndex >= 0 && serverIndex < serverList.Count) { int distanceFromCenter = Math.Abs(_SM.GraphicsDevice.Viewport.Width / 2 - x); if (distanceFromCenter < descWidths[serverIndex] / 2) { (_SM as InfiniminerGame).JoinGame(serverList[serverIndex].ipEndPoint); nextState = "Infiniminer.States.LoadingState"; _P.PlaySound(InfiniminerSound.ClickHigh); } } x -= drawRect.X; y -= drawRect.Y; switch (ClickRegion.HitTest(clkMenuServer, new Point(x, y))) { case "refresh": _P.PlaySound(InfiniminerSound.ClickHigh); serverList = (_SM as InfiniminerGame).EnumerateServers(0.5f); break; case "direct": directConnectIPEnter = true; _P.PlaySound(InfiniminerSound.ClickHigh); break; } } }
public override void OnMouseDown(MouseButton button, int x, int y) { base.OnMouseDown(button, x, y); foreach (InterfaceElement element in elements) { element.OnMouseDown(button, x, y); } switch (ClickRegion.HitTest(clkMenuSettings, new Point(x, y))) { case "cancel": nextState = "Infiniminer.States.ServerBrowserState"; break; case "accept": if (saveData() >= 1) { _SM.Exit(); } break; /*case "keylayout": * saveData(); * nextState = "Infiniminer.States.KeySettingsState"; * break;*/ } }
public override void OnMouseDown(MouseButton button, int x, int y) { x -= drawRect.X; y -= drawRect.Y; switch (ClickRegion.HitTest(clkTeamMenu, new Point(x, y))) { case "red": if (_P.playerTeam == PlayerTeam.Red && canCancel) { nextState = "Infiniminer.States.MainGameState"; } else { _P.SetPlayerTeam(PlayerTeam.Red); nextState = "Infiniminer.States.ClassSelectionState"; } _P.PlaySound(InfiniminerSound.ClickHigh); break; case "blue": if (_P.playerTeam == PlayerTeam.Blue && canCancel) { nextState = "Infiniminer.States.MainGameState"; } else { _P.SetPlayerTeam(PlayerTeam.Blue); nextState = "Infiniminer.States.ClassSelectionState"; } _P.PlaySound(InfiniminerSound.ClickHigh); break; } }
public override void OnMouseDown(MouseButton button, int x, int y) { foreach (InterfaceElement element in elements) { element.OnMouseDown(button, x, y); } x -= drawRect.X; y -= drawRect.Y; switch (ClickRegion.HitTest(clkMenuSettings, new Point(x, y))) { case "cancel": nextState = "Infiniminer.States.ServerBrowserState"; _P.PlaySound(InfiniminerSound.ClickHigh); break; case "accept": if (saveData() >= 1) { _P.PlaySound(InfiniminerSound.ClickHigh); _SM.Exit(); if (!Debugger.IsAttached) { Process.Start("Infiniminer.exe"); } } break; /*case "keylayout": * saveData(); * nextState = "Infiniminer.States.KeySettingsState"; * break;*/ } }
public override void OnMouseDown(MouseButton button, int x, int y) { x -= drawRect.X; y -= drawRect.Y; switch (ClickRegion.HitTest(clkClassMenu, new Point(x, y))) { case "miner": _P.SetPlayerClass(PlayerClass.Miner); nextState = "Infiniminer.States.MainGameState"; _P.PlaySound(InfiniminerSound.ClickHigh); break; case "engineer": _P.SetPlayerClass(PlayerClass.Engineer); nextState = "Infiniminer.States.MainGameState"; _P.PlaySound(InfiniminerSound.ClickHigh); break; case "prospector": _P.SetPlayerClass(PlayerClass.Prospector); nextState = "Infiniminer.States.MainGameState"; _P.PlaySound(InfiniminerSound.ClickHigh); break; case "sapper": _P.SetPlayerClass(PlayerClass.Sapper); nextState = "Infiniminer.States.MainGameState"; _P.PlaySound(InfiniminerSound.ClickHigh); break; } }