Skip to content

Commit 187c488

Browse files
committed
-Updated version
-Removed an unused reference -Did some general code cleanup
1 parent b2ebc17 commit 187c488

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

BaseModuleType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ public override GameObject loadPrefab(int sizeIndex)
2929
//Add collider to object for raycasting
3030
foreach (Transform transform in ModuleObjects[adjustedSizeIndex].transform)
3131
{
32-
//Make the collider for the gameobject the same size/shape as the mesh
32+
//Make the collider for the GameObject the same size/shape as the mesh
3333
if (transform.gameObject.GetComponent<MeshFilter>() != null)
3434
{
3535
transform.gameObject.AddComponent<MeshCollider>().sharedMesh = transform.gameObject.GetComponent<MeshFilter>().sharedMesh;
3636
}
3737

38-
//This is copied directly from PB code. Not really sure that it's needed, but I'll leave it in place incase sombody else is comparing this to
38+
//This is copied directly from PB code. Not really sure that it's needed, but I'll leave it in place in case somebody else is comparing this to
3939
//PB code
4040
if (transform.gameObject.name.IsValidTag())
4141
{

FrameworkMod.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using System;
2-
using System.Reflection;
32
using Planetbase;
4-
using UnityEngine;
53

64
namespace PlanetbaseFramework
75
{
86
public class FrameworkMod : ModBase
97
{
10-
public new static Version ModVersion => Assembly.GetExecutingAssembly().GetName().Version;
8+
public const string AssemblyVersion = "2.2.0.0";
9+
public new static readonly Version ModVersion = new Version(AssemblyVersion);
1110

1211
public FrameworkMod()
1312
{
@@ -23,11 +22,6 @@ public override void Init()
2322
InjectPatches();
2423
}
2524

26-
public static void Callback(string condition, string stackTrace, LogType type)
27-
{
28-
29-
}
30-
3125
private class ModTitleButton : TitleButton
3226
{
3327
public ModTitleButton() : base("mod_titlemenu") { }

ModBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private string[] GetAssetsMatchingFileType(string fileType, string subfolder = n
188188
return Directory.Exists(searchPath) ? Directory.GetFiles(searchPath, "*." + fileType) : new string[0];
189189
}
190190

191-
public HarmonyInstance GetHarmonyInstance() => Harmony ?? HarmonyInstance.Create(ModName);
191+
public HarmonyInstance GetHarmonyInstance() => Harmony ?? (Harmony = HarmonyInstance.Create(ModName));
192192

193193
public void InjectPatches()
194194
{
@@ -202,6 +202,7 @@ public void RegisterTitleButton(TitleButton button)
202202

203203
/// <summary>
204204
/// Do any pre-load actions before embedded resources are loaded, such as removing existing folders/items.
205+
/// Warning: this call will be made in the constructor before child initialization.
205206
/// </summary>
206207
/// <param name="resourceNames">The name of all the resources to be loaded</param>
207208
protected virtual void PreProcessEmbeddedResources(string[] resourceNames)
@@ -211,6 +212,7 @@ protected virtual void PreProcessEmbeddedResources(string[] resourceNames)
211212

212213
/// <summary>
213214
/// Do any pre-load actions before an embedded resource is loaded, such as removing existing folders/items.
215+
/// Warning: this call will be made in the constructor before child initialization.
214216
/// </summary>
215217
/// <param name="resourceName">The name of the resources being loaded</param>
216218
/// <returns>True if the resource should be loaded, false otherwise</returns>

ModListGameState.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ namespace PlanetbaseFramework
66
//This class was thrown together fairly quickly, but should be a decent example on making new gamestates.
77
public class ModListGameState : GameState
88
{
9-
public GuiRenderer mGuiRenderer = new GuiRenderer();
9+
private GuiRenderer Renderer { get; } = new GuiRenderer();
10+
1011
public override bool isTitleState()
1112
{
1213
return true;
@@ -20,20 +21,26 @@ public override void onGui()
2021
}
2122

2223
PrintLine("Loaded Mods:", 0);
23-
for(int i = 0; i < ModLoader.ModList.Count; i++)
24+
for(var i = 0; i < ModLoader.ModList.Count; i++)
2425
{
2526
PrintLine(ModLoader.ModList[i].ModName, i + 1);
2627
}
2728

28-
if(this.mGuiRenderer.renderBackButton(new Vector2(Screen.width - GuiRenderer.getMenuButtonSize(FontSize.Huge).x, Screen.height - GuiRenderer.getMenuButtonSize(FontSize.Huge).y))){
29+
if (Renderer.renderBackButton(
30+
new Vector2(
31+
Screen.width - GuiRenderer.getMenuButtonSize(FontSize.Huge).x,
32+
Screen.height - GuiRenderer.getMenuButtonSize(FontSize.Huge).y
33+
)
34+
))
35+
{
2936
GameManager.getInstance().setGameStateTitle();
3037
}
3138
}
3239

3340
private void PrintLine(string text, int lineNumber)
3441
{
3542
Vector2 textLocation = new Vector2(50, 80);
36-
GUIStyle labelStyle = mGuiRenderer.getLabelStyle(FontSize.Huge, FontStyle.Bold, TextAnchor.LowerLeft, FontType.Title);
43+
GUIStyle labelStyle = Renderer.getLabelStyle(FontSize.Huge, FontStyle.Bold, TextAnchor.LowerLeft, FontType.Title);
3744
labelStyle.normal.textColor = Color.blue;
3845

3946
GUI.Label(new Rect(textLocation.x, textLocation.y + (GuiRenderer.getMenuButtonSize(FontSize.Huge).y )* lineNumber, Screen.width, GuiRenderer.getMenuButtonSize(FontSize.Huge).y - 30), text, labelStyle);

PlanetbaseFramework.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
</Reference>
6363
<Reference Include="System" />
6464
<Reference Include="System.Core" />
65-
<Reference Include="System.Drawing" />
6665
<Reference Include="System.Xml" />
6766
<Reference Include="UnityEngine">
6867
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Planetbase\Planetbase_Data\Managed\UnityEngine.dll</HintPath>

Properties/AssemblyInfo.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3+
using PlanetbaseFramework;
34

45
// General Information about an assembly is controlled through the following
56
// set of attributes. Change these attribute values to modify the information
@@ -9,7 +10,7 @@
910
[assembly: AssemblyConfiguration("")]
1011
[assembly: AssemblyCompany("solidDoWant")]
1112
[assembly: AssemblyProduct("PlanetbaseFramework")]
12-
[assembly: AssemblyCopyright("Copyright © 2018")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
1314
[assembly: AssemblyTrademark("")]
1415
[assembly: AssemblyCulture("")]
1516

@@ -31,5 +32,5 @@
3132
// You can specify all the values or you can default the Build and Revision Numbers
3233
// by using the '*' as shown below:
3334
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("2.1.2.0")]
35-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion(FrameworkMod.AssemblyVersion)]
36+
[assembly: AssemblyFileVersion(FrameworkMod.AssemblyVersion)]

Utils.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,7 @@ public static bool IsValidTag(this string toCheck)
182182
}
183183
}
184184

185-
public static bool Compare (this Type t1, Type t2)
186-
{
187-
return t1.FullName.Equals(t2.FullName);
188-
}
185+
public static bool Compare(this Type t1, Type t2) => t1.FullName != null && t1.FullName.Equals(t2.FullName);
189186

190187
public static string[] ListEmbeddedFiles()
191188
{

0 commit comments

Comments
 (0)