renamed settings to roomsettings

main
Benjamin Kraft 1 year ago
parent 39c715b2e3
commit f709498c83
  1. 10
      Assets/Scripts/Game/GameManager.cs
  2. 2
      Assets/Scripts/Game/RoomSettings.cs
  3. 0
      Assets/Scripts/Game/RoomSettings.cs.meta
  4. 8
      Assets/Scripts/MenuUI.cs
  5. 4
      Assets/UI/Menu.uxml
  6. 2
      Assets/UI/Styles/menu.uss

@ -53,7 +53,7 @@ namespace Game {
}
private IEnumerator SpawnLoop(Spawnable spawnable) {
SpawnRate required = Settings.SpawnRates[spawnable];
SpawnRate required = RoomSettings.SpawnRates[spawnable];
if (required == SpawnRate.Never)
yield break;
float baseSeconds = spawnRates.First(s => s.spawnable == spawnable).values.First(v => v.spawnRate == required).baseSeconds;
@ -89,12 +89,12 @@ namespace Game {
var p2Obj = Instantiate(playerPrefab);
Player p1, p2;
switch (Settings.Type) {
switch (RoomSettings.Type) {
case Type.AI:
p1 = p1Obj.AddComponent<AIPlayer>();
p2 = p2Obj.AddComponent<AIPlayer>();
((AIPlayer) p1).Difficulty = Settings.AIDifficulty;
((AIPlayer) p2).Difficulty = Settings.AIDifficulty;
((AIPlayer) p1).Difficulty = RoomSettings.AIDifficulty;
((AIPlayer) p2).Difficulty = RoomSettings.AIDifficulty;
break;
case Type.RealOnline:
p1 = p1Obj.AddComponent<RealPlayer>();
@ -111,7 +111,7 @@ namespace Game {
p1 = p1Obj.AddComponent<RealPlayer>();
p2 = p2Obj.AddComponent<AIPlayer>();
((RealPlayer) p1).isThisClient = true;
((AIPlayer) p2).Difficulty = Settings.AIDifficulty;
((AIPlayer) p2).Difficulty = RoomSettings.AIDifficulty;
break;
default:
throw new ArgumentOutOfRangeException();

@ -10,7 +10,7 @@ namespace Game {
public enum Spawnable {NewBallTemporary, NewBallPermanent, Modification, Wormhole}
public enum WinScore {Default, Custom}
public struct Settings {
public struct RoomSettings {
public static Type Type;
public static Difficulty AIDifficulty;
public static Dictionary<Spawnable, SpawnRate> SpawnRates;

@ -46,15 +46,15 @@ public class MenuUI : MonoBehaviour {
private void JoinPressed(ClickEvent evt) { }
private void BotPressed(ClickEvent evt) {
Settings.Type = Type.Hybrid;
Settings.AIDifficulty = Difficulty.VeryHard;
RoomSettings.Type = Type.Hybrid;
RoomSettings.AIDifficulty = Difficulty.VeryHard;
SceneManager.LoadScene("Game");
}
private void BotsPressed(ClickEvent evt) {
Settings.Type = Type.AI;
Settings.AIDifficulty = Difficulty.VeryHard;
RoomSettings.Type = Type.AI;
RoomSettings.AIDifficulty = Difficulty.VeryHard;
SceneManager.LoadScene("Game");
}

@ -2,11 +2,11 @@
<Style src="project://database/Assets/UI/Styles/menu.uss?fileID=7433441132597879392&amp;guid=a6abab2f6d20ba823bad41d2081810e9&amp;type=3#menu" />
<Style src="project://database/Assets/UI/Styles/global.uss?fileID=7433441132597879392&amp;guid=f6d2ff1ab9bcd826f88710e642615fa6&amp;type=3#global" />
<ui:Label text="Pong Reloaded" display-tooltip-when-elided="true" name="top_header" class="header" />
<ui:VisualElement name="main_menu" class="menu" style="display: none;">
<ui:VisualElement name="main_menu" class="menu" style="display: flex;">
<ui:Button text="Play" display-tooltip-when-elided="true" name="btn_play" />
<ui:Button text="Settings" display-tooltip-when-elided="true" name="btn_settings" />
</ui:VisualElement>
<ui:VisualElement name="play_menu" class="menu" style="display: flex;">
<ui:VisualElement name="play_menu" class="menu" style="display: none;">
<ui:Button text="Find opponent" display-tooltip-when-elided="true" name="btn_find" />
<ui:Button text="Host game" display-tooltip-when-elided="true" name="btn_host" />
<ui:Button text="Join game" display-tooltip-when-elided="true" name="btn_join" />

@ -25,8 +25,6 @@ Button {
border-top-width: 3px;
border-bottom-width: 3px;
font-size: 30px;
flex-grow: 1;
flex-shrink: 0;
}
Button:hover {

Loading…
Cancel
Save