Skip to content

Commit 0e98bff

Browse files
committed
Game: Revert accidental deletion of references to the game
1 parent 9f75976 commit 0e98bff

File tree

1 file changed

+69
-30
lines changed

1 file changed

+69
-30
lines changed

Source/Statics/Game.cs

Lines changed: 69 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
using System;
22
using System.Collections.Generic;
33
using UnityEngine;
4+
using static KeepCoding.ComponentPool;
5+
using static Localization;
6+
using Connection = IRCConnection;
7+
using KTInput = KTInputManager;
8+
using KTMod = ModManager;
9+
using KTPlayer = Assets.Scripts.Settings.PlayerSettingsManager;
10+
using KTScene = SceneManager;
11+
using KTModSourceEnum = Assets.Scripts.Mods.ModInfo.ModSourceEnum;
412

513
namespace KeepCoding
614
{
@@ -80,19 +88,19 @@ public static class IRCConnection
8088
/// Sends a message to the chat.
8189
/// </value>
8290
/// <remarks>Arguments: <c>message</c>.</remarks>
83-
public static Action<string> SendMessage => message => Debug.Log($"Sending message to chat: {message}");
91+
public static Action<string> SendMessage => Connection.SendMessage;
8492

8593
/// <value>
8694
/// Sends a message to the chat.
8795
/// </value>
8896
/// <remarks>Arguments: <c>message</c> and <c>args</c>.</remarks>
89-
public static Action<string, object[]> SendMessageFormat => (message, args) => Debug.Log($"Sending message to chat: {message.Form(args)}");
90-
97+
public static Action<string, object[]> SendMessageFormat => Connection.SendMessageFormat;
98+
9199
/// <value>
92100
/// Whispers a message to a person.
93101
/// </value>
94102
/// <remarks>Arguments: <c>userNickName</c>, <c>message</c>, and <c>args</c>.</remarks>
95-
public static Action<string, string, object[]> SendWhisper => (userNickName, message, args) => Debug.Log($"Whispering message to user {userNickName}: {message.Form(args)}");
103+
public static Action<string, string, object[]> SendWhisper => Connection.SendWhisper;
96104
}
97105

98106
/// <summary>
@@ -108,7 +116,7 @@ public static class KTInputManager
108116
/// <value>
109117
/// The current way the game is being controlled.
110118
/// </value>
111-
public static ControlType CurrentControlType => ControlType.Mouse;
119+
public static ControlType CurrentControlType => (ControlType)KTInput.Instance.CurrentControlType;
112120
}
113121

114122
/// <summary>
@@ -119,27 +127,58 @@ public static class Mission
119127
/// <value>
120128
/// Determines whether or not all pacing events are enabled.
121129
/// </value>
122-
public static bool IsPacingEvents => false;
130+
public static bool IsPacingEvents => KTScene.Instance.GameplayState.Mission.PacingEventsEnabled;
123131

124132
/// <value>
125133
/// The description as it appears in the bomb binder.
126134
/// </value>
127-
public static string Description => "Everybody has to start somewhere. Let's just hope it doesn't end here too.\n\nMake sure your experts have the manual and are ready to help.";
135+
public static string Description => GetLocalizedString(KTScene.Instance.GameplayState.Mission.DescriptionTerm);
128136

129137
/// <value>
130138
/// The mission name as it appears in the bomb binder.
131139
/// </value>
132-
public static string DisplayName => "The First Bomb";
140+
public static string DisplayName => GetLocalizedString(KTScene.Instance.GameplayState.Mission.DisplayNameTerm);
133141

134142
/// <value>
135143
/// The ID of the mission.
136144
/// </value>
137-
public static string ID => "firsttime";
145+
public static string ID => KTScene.Instance.GameplayState.Mission.ID;
138146

139147
/// <value>
140148
/// Gets the generator setting of the mission.
141149
/// </value>
142-
public static GeneratorSetting GeneratorSetting => new GeneratorSetting();
150+
public static GeneratorSetting GeneratorSetting
151+
{
152+
get
153+
{
154+
var setting = KTScene.Instance.GameplayState.Mission.GeneratorSetting;
155+
156+
var list = new List<ComponentPool>();
157+
158+
foreach (var pool in setting.ComponentPools)
159+
{
160+
var types = new List<ComponentTypeEnum>();
161+
162+
foreach (var type in pool.ComponentTypes)
163+
types.Add((ComponentTypeEnum)type);
164+
165+
list.Add(new ComponentPool(
166+
pool.Count,
167+
(ComponentSource)pool.AllowedSources,
168+
(SpecialComponentTypeEnum)pool.SpecialComponentType,
169+
pool.ModTypes,
170+
types));
171+
}
172+
173+
return new GeneratorSetting(
174+
setting.FrontFaceOnly,
175+
setting.OptionalWidgetCount,
176+
setting.NumStrikes,
177+
setting.TimeBeforeNeedyActivation,
178+
setting.TimeLimit,
179+
list);
180+
}
181+
}
143182
}
144183

145184
/// <summary>
@@ -150,17 +189,17 @@ public static class ModManager
150189
/// <value>
151190
/// Gets all of the disabled mod paths.
152191
/// </value>
153-
public static Func<List<string>> GetDisabledModPaths => () => new List<string>();
192+
public static Func<List<string>> GetDisabledModPaths => KTMod.Instance.GetDisabledModPaths;
154193

155194
/// <value>
156195
/// Gets all of the mod paths within the <see cref="ModSourceEnum"/> constraint.
157196
/// </value>
158-
public static Func<ModSourceEnum, List<string>> GetAllModPathsFromSource => source => new List<string>();
197+
public static Func<ModSourceEnum, List<string>> GetAllModPathsFromSource => source => KTMod.Instance.GetAllModPathsFromSource((KTModSourceEnum)source);
159198

160199
/// <value>
161200
/// Gets all of the enabled mod paths within the <see cref="ModSourceEnum"/> constraint.
162201
/// </value>
163-
public static Func<ModSourceEnum, List<string>> GetEnabledModPaths => source => new List<string>();
202+
public static Func<ModSourceEnum, List<string>> GetEnabledModPaths => source => KTMod.Instance.GetEnabledModPaths((KTModSourceEnum)source);
164203
}
165204

166205
/// <summary>
@@ -171,82 +210,82 @@ public static class PlayerSettings
171210
/// <value>
172211
/// Determines if vertical tilting is flipped or not.
173212
/// </value>
174-
public static bool InvertTiltControls => false;
213+
public static bool InvertTiltControls => KTPlayer.Instance.PlayerSettings.InvertTiltControls;
175214

176215
/// <value>
177216
/// Determines if the option to lock the mouse to the window is enabled.
178217
/// </value>
179-
public static bool LockMouseToWindow => false;
218+
public static bool LockMouseToWindow => KTPlayer.Instance.PlayerSettings.LockMouseToWindow;
180219

181220
/// <value>
182221
/// Determines if the option to show the leaderboards from the pamphlet.
183222
/// </value>
184-
public static bool ShowLeaderBoards => true;
223+
public static bool ShowLeaderBoards => KTPlayer.Instance.PlayerSettings.ShowLeaderBoards;
185224

186225
/// <value>
187226
/// Determines if the option to show the rotation of the User Interface is enabled.
188227
/// </value>
189-
public static bool ShowRotationUI => true;
228+
public static bool ShowRotationUI => KTPlayer.Instance.PlayerSettings.ShowRotationUI;
190229

191230
/// <value>
192231
/// Determines if the option to show scanlines is enabled.
193232
/// </value>
194-
public static bool ShowScanline => true;
233+
public static bool ShowScanline => KTPlayer.Instance.PlayerSettings.ShowScanline;
195234

196235
/// <value>
197236
/// Determines if the option to skip the title screen is enabled.
198237
/// </value>
199-
public static bool SkipTitleScreen => false;
238+
public static bool SkipTitleScreen => KTPlayer.Instance.PlayerSettings.SkipTitleScreen;
200239

201240
/// <value>
202241
/// Determines if the VR or regular controllers vibrate.
203242
/// </value>
204-
public static bool RumbleEnabled => false;
243+
public static bool RumbleEnabled => KTPlayer.Instance.PlayerSettings.RumbleEnabled;
205244

206245
/// <value>
207246
/// Determines if the touchpad controls are inverted.
208247
/// </value>
209-
public static bool TouchpadInvert => false;
248+
public static bool TouchpadInvert => KTPlayer.Instance.PlayerSettings.TouchpadInvert;
210249

211250
/// <value>
212251
/// Determines if the option to always use mods is enabled.
213252
/// </value>
214-
public static bool UseModsAlways => false;
253+
public static bool UseModsAlways => KTPlayer.Instance.PlayerSettings.UseModsAlways;
215254

216255
/// <value>
217256
/// Determines if the option to use parallel/simultaneous mod loading is enabled.
218257
/// </value>
219-
public static bool UseParallelModLoading => false;
258+
public static bool UseParallelModLoading => KTPlayer.Instance.PlayerSettings.UseParallelModLoading;
220259

221260
/// <value>
222261
/// Determines if VR mode is requested.
223262
/// </value>
224-
public static bool VRModeRequested => true;
263+
public static bool VRModeRequested => KTPlayer.Instance.PlayerSettings.VRModeRequested;
225264

226265
/// <value>
227266
/// The intensity of anti-aliasing currently on the game. Ranges 0 to 8.
228267
/// </value>
229-
public static int AntiAliasing => 8;
268+
public static int AntiAliasing => KTPlayer.Instance.PlayerSettings.AntiAliasing;
230269

231270
/// <value>
232271
/// The current music volume from the dossier menu. Ranges 0 to 100.
233272
/// </value>
234-
public static int MusicVolume => 100;
273+
public static int MusicVolume => KTPlayer.Instance.PlayerSettings.MusicVolume;
235274

236275
/// <value>
237276
/// The current sound effects volume from the dosssier menu. Ranges 0 to 100.
238277
/// </value>
239-
public static int SFXVolume => 100;
278+
public static int SFXVolume => KTPlayer.Instance.PlayerSettings.SFXVolume;
240279

241280
/// <value>
242281
/// Determines if VSync is on or off.
243282
/// </value>
244-
public static int VSync => 1;
283+
public static int VSync => KTPlayer.Instance.PlayerSettings.VSync;
245284

246285
/// <value>
247286
/// The current language code.
248287
/// </value>
249-
public static string LanguageCode => "en";
288+
public static string LanguageCode => KTPlayer.Instance.PlayerSettings.LanguageCode;
250289
}
251290

252291
/// <value>
@@ -255,6 +294,6 @@ public static class PlayerSettings
255294
/// <remarks>
256295
/// To prevent a reference to the game, the type is boxed in <see cref="object"/>. You can cast it to Bomb or <see cref="MonoBehaviour"/> type to restore its functionality.
257296
/// </remarks>
258-
public static Func<GameObject, object> Bomb => gameObject => null;
297+
public static Func<GameObject, object> Bomb => gameObject => gameObject.GetComponentInParent(typeof(Bomb));
259298
}
260299
}

0 commit comments

Comments
 (0)