diff --git a/Centrifuge.Mods.Distance.sln b/Centrifuge.Mods.Distance.sln
index 94dcfff..2794c6a 100644
--- a/Centrifuge.Mods.Distance.sln
+++ b/Centrifuge.Mods.Distance.sln
@@ -10,7 +10,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Distance.Assemblies", "Distance.Assemblies", "{83201AB6-55D6-472B-98F8-BA11061CC2EA}"
ProjectSection(SolutionItems) = preProject
Distance.Assemblies\Assembly-CSharp-firstpass.dll = Distance.Assemblies\Assembly-CSharp-firstpass.dll
- Distance.Assemblies\Assembly-CSharp.dev.dll = Distance.Assemblies\Assembly-CSharp.dev.dll
EndProjectSection
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Distance.Shared", "Distance.Shared\Distance.Shared.shproj", "{15B08B61-BEB4-40A6-8789-02B655A4B307}"
diff --git a/Distance.Assemblies/Assembly-CSharp.dev.dll b/Distance.Assemblies/Assembly-CSharp.dev.dll
deleted file mode 100644
index 8f716e9..0000000
Binary files a/Distance.Assemblies/Assembly-CSharp.dev.dll and /dev/null differ
diff --git a/Distance.ExternalModdingTools/Distance.ExternalModdingTools.csproj b/Distance.ExternalModdingTools/Distance.ExternalModdingTools.csproj
index 5b38ca2..fc49222 100644
--- a/Distance.ExternalModdingTools/Distance.ExternalModdingTools.csproj
+++ b/Distance.ExternalModdingTools/Distance.ExternalModdingTools.csproj
@@ -15,6 +15,13 @@
true
true
true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
AnyCPU
diff --git a/Distance.TextureModifier/Distance.TextureModifier.csproj b/Distance.TextureModifier/Distance.TextureModifier.csproj
index 87a635f..256c8eb 100644
--- a/Distance.TextureModifier/Distance.TextureModifier.csproj
+++ b/Distance.TextureModifier/Distance.TextureModifier.csproj
@@ -14,6 +14,7 @@
true
true
true
+ true
true
@@ -38,21 +39,20 @@
..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll
+
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\Assembly-CSharp.dll
+
..\Distance.Assemblies\Assembly-CSharp-firstpass.dll
-
- False
- ..\Distance.Assemblies\Assembly-CSharp.dev.dll
-
-
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\Centrifuge.Distance.dll
+
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\Centrifuge.Distance.dll
..\packages\LitJson.0.15.0\lib\net35\LitJSON.dll
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\NAudio.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\NAudio.dll
..\packages\Centrifuge.Mod.SDK.2.2.0\lib\net35\Reactor.API.dll
@@ -64,18 +64,18 @@
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\UnityEngine.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\UnityEngine.dll
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\UnityEngine.Networking.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\UnityEngine.Networking.dll
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\UnityEngine.UI.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\UnityEngine.UI.dll
-
+
@@ -84,7 +84,6 @@
-
diff --git a/Distance.TextureModifier/Mod.cs b/Distance.TextureModifier/Entry.cs
similarity index 98%
rename from Distance.TextureModifier/Mod.cs
rename to Distance.TextureModifier/Entry.cs
index 805093a..6759d0f 100644
--- a/Distance.TextureModifier/Mod.cs
+++ b/Distance.TextureModifier/Entry.cs
@@ -103,7 +103,7 @@ internal IEnumerator ReskinResourcePrefabs()
yield break;
}
-
+
internal IEnumerator ReskinLevelObjects(Level level)
{
List objects = new List();
@@ -161,7 +161,7 @@ internal IEnumerator Reskin(List list, bool pause = false)
//if (!pause)
//{
- yield return StartCoroutine(Reskin(list, true));
+ yield return StartCoroutine(Reskin(list, true));
//}
yield break;
diff --git a/Distance.TextureModifier/mod.json b/Distance.TextureModifier/mod.json
deleted file mode 100644
index 5edf635..0000000
--- a/Distance.TextureModifier/mod.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "FriendlyName": "",
- "Author": "",
- "Contact": "",
- "ModuleFileName": "MySuperMod.dll",
- "Priority": 10,
- "SkipLoad": false,
- "Dependencies": [],
- "RequiredGSLs": [
- "com.github.reherc/Centrifuge.Distance"
- ]
-}
\ No newline at end of file
diff --git a/Distance.TextureModifier/packages.config b/Distance.TextureModifier/packages.config
index 152e5dc..86a9d2c 100644
--- a/Distance.TextureModifier/packages.config
+++ b/Distance.TextureModifier/packages.config
@@ -1,6 +1,6 @@
-
+
diff --git a/Distance.TrackMusic/Distance.TrackMusic.csproj b/Distance.TrackMusic/Distance.TrackMusic.csproj
index abc1915..0640c53 100644
--- a/Distance.TrackMusic/Distance.TrackMusic.csproj
+++ b/Distance.TrackMusic/Distance.TrackMusic.csproj
@@ -36,20 +36,20 @@
..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll
+
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\Assembly-CSharp.dll
+
..\Distance.Assemblies\Assembly-CSharp-firstpass.dll
-
- ..\Distance.Assemblies\Assembly-CSharp.dev.dll
-
-
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\Centrifuge.Distance.dll
+
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\Centrifuge.Distance.dll
..\packages\LitJson.0.15.0\lib\net35\LitJSON.dll
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\NAudio.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\NAudio.dll
..\packages\Centrifuge.Mod.SDK.2.2.0\lib\net35\Reactor.API.dll
@@ -62,17 +62,26 @@
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\UnityEngine.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\UnityEngine.dll
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\UnityEngine.Networking.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\UnityEngine.Networking.dll
- ..\packages\Centrifuge.GameSupport.Distance.1.0.12\lib\net35\UnityEngine.UI.dll
+ ..\packages\Centrifuge.GameSupport.Distance.1.0.18\lib\net35\UnityEngine.UI.dll
+
+
+
+
+
+
+
+
+
@@ -94,7 +103,7 @@
-
+
diff --git a/Distance.TrackMusic/Editor/Tools/AddMusicChoiceAction.cs b/Distance.TrackMusic/Editor/Tools/AddMusicChoiceAction.cs
new file mode 100644
index 0000000..fce3804
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/AddMusicChoiceAction.cs
@@ -0,0 +1,11 @@
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ public class AddMusicChoiceAction : AddOrRemoveMusicChoiceAction
+ {
+ public AddMusicChoiceAction(GameObject obj) : base(obj, null) { }
+
+ public override string Description_ => "Added Music Choice to object";
+ }
+}
\ No newline at end of file
diff --git a/Distance.TrackMusic/Editor/Tools/AddMusicChoiceTool.cs b/Distance.TrackMusic/Editor/Tools/AddMusicChoiceTool.cs
new file mode 100644
index 0000000..580e7a0
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/AddMusicChoiceTool.cs
@@ -0,0 +1,48 @@
+using Centrifuge.Distance.EditorTools.Attributes;
+using LevelEditorActions;
+using LevelEditorTools;
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ [EditorTool]
+ public class AddMusicChoiceTool : InstantTool
+ {
+ public static ToolInfo info_ = new ToolInfo("Add Music Choice", "", ToolCategory.Others, ToolButtonState.Invisible, false);
+ public override ToolInfo Info_ => info_;
+
+ public static GameObject[] Target = new GameObject[0];
+
+ public static void Register()
+ {
+ G.Sys.LevelEditor_.RegisterTool(info_);
+ }
+
+ public override bool Run()
+ {
+ GameObject[] selected = Target;
+
+ if (selected.Length == 0)
+ {
+ return false;
+ }
+
+ foreach (var obj in selected)
+ {
+ if (obj.HasComponent() || obj.HasComponent() || obj.HasComponent())
+ {
+ var listener = obj.GetComponent();
+
+ if (listener == null)
+ {
+ var action = new AddMusicChoiceAction(obj);
+ action.Redo();
+ action.FinishAndAddToLevelEditorActions();
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/Distance.TrackMusic/Editor/Tools/AddMusicTrackAction.cs b/Distance.TrackMusic/Editor/Tools/AddMusicTrackAction.cs
new file mode 100644
index 0000000..44b7518
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/AddMusicTrackAction.cs
@@ -0,0 +1,66 @@
+using Distance.TrackMusic.Models;
+using LevelEditorActions;
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ public class AddMusicTrackAction : SimplerAction
+ {
+ public override string Description_ => "Add Music Track";
+
+ public ReferenceMap.Handle objectHandle;
+
+ public GameObject CreateTrack()
+ {
+ GameObject gameObject = Resource.LoadPrefabInstance("Group", true);
+
+ gameObject.GetComponent().customName_ = "Music Track";
+
+ var component = gameObject.AddComponent();
+
+ var track = new MusicTrack() { Name = "Unknown" };
+
+ track.NewVersion();
+
+ track.WriteObject(component);
+
+ gameObject.ForEachILevelEditorListener(delegate (ILevelEditorListener listener)
+ {
+ listener.LevelEditorStart(true);
+ });
+
+ MonoBehaviour[] components = gameObject.GetComponents();
+
+ foreach (MonoBehaviour monoBehaviour in components)
+ {
+ monoBehaviour.enabled = false;
+ }
+
+ LevelEditor editor = G.Sys.LevelEditor_;
+
+ editor.AddGameObjectSilent(ref objectHandle, gameObject, null);
+
+ return gameObject;
+ }
+
+ public void DestroyTrack()
+ {
+ GameObject gameObject = objectHandle.Get();
+ if (gameObject == null)
+ {
+ return;
+ }
+ G.Sys.LevelEditor_.RemoveGameObjectSilent(gameObject);
+ }
+
+ public override void Undo()
+ {
+ DestroyTrack();
+ }
+
+ public override void Redo()
+ {
+ CreateTrack();
+ }
+ }
+}
diff --git a/Distance.TrackMusic/Editor/Tools/AddMusicTrackTool.cs b/Distance.TrackMusic/Editor/Tools/AddMusicTrackTool.cs
new file mode 100644
index 0000000..37ac2aa
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/AddMusicTrackTool.cs
@@ -0,0 +1,37 @@
+using Centrifuge.Distance.EditorTools.Attributes;
+using LevelEditorActions;
+using LevelEditorTools;
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ [EditorTool]
+ public class AddMusicTrackTool : InstantTool
+ {
+ public static ToolInfo info_ = new ToolInfo("Add Music Track", "", ToolCategory.Edit, ToolButtonState.Button, false);
+
+ public override ToolInfo Info_ => info_;
+
+ public static void Register()
+ {
+ G.Sys.LevelEditor_.RegisterTool(info_);
+ }
+
+ public override bool Run()
+ {
+ LevelEditor editor = G.Sys.LevelEditor_;
+
+ var action = new AddMusicTrackAction();
+
+ GameObject gameObject = action.CreateTrack();
+
+ editor.ClearSelectedList(true);
+
+ editor.SelectObject(gameObject);
+
+ action.FinishAndAddToLevelEditorActions();
+
+ return true;
+ }
+ }
+}
diff --git a/Distance.TrackMusic/Editor/Tools/AddOrRemoveMusicChoiceAction.cs b/Distance.TrackMusic/Editor/Tools/AddOrRemoveMusicChoiceAction.cs
new file mode 100644
index 0000000..3ccadd1
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/AddOrRemoveMusicChoiceAction.cs
@@ -0,0 +1,113 @@
+using Distance.TrackMusic.Models;
+using Events.LevelEditor;
+using LevelEditorActions;
+using System;
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ public class AddOrRemoveMusicChoiceAction : SimplerAction
+ {
+ public override string Description_ => throw new NotImplementedException();
+
+ private ReferenceMap.Handle originalHandle;
+ private ReferenceMap.Handle newHandle;
+ private ReferenceMap.Handle addedComponentHandle;
+
+ private readonly bool isAdd;
+ private readonly byte[] componentBytes;
+
+ public AddOrRemoveMusicChoiceAction(GameObject gameObject, ZEventListener comp)
+ {
+ ReferenceMap referenceMap_ = G.Sys.LevelEditor_.ReferenceMap_;
+ originalHandle = referenceMap_.GetHandleOrNull(gameObject);
+ newHandle = referenceMap_.GetHandleOrNull(null);
+ addedComponentHandle = referenceMap_.GetHandleOrNull(comp);
+ isAdd = (comp == null);
+ if (!isAdd)
+ {
+ componentBytes = Serializers.BinarySerializer.SaveComponentToBytes(comp, null);
+ }
+ }
+
+ private void AddOrRemove(ReferenceMap.Handle beforeHandle, ref ReferenceMap.Handle afterHandle, bool add)
+ {
+ LevelEditor editor = G.Sys.LevelEditor_;
+ GameObject gameObject = beforeHandle.Get();
+
+ ZEventListener comp = (!add) ? addedComponentHandle.Get() : ((ZEventListener)((object)null));
+
+ if (!gameObject.HasComponent())
+ {
+ editor.RemoveGameObjectSilent(gameObject);
+ }
+
+ if (add)
+ {
+ comp = gameObject.AddComponent();
+
+ var choice = new MusicChoice();
+
+ if (gameObject.HasComponent())
+ {
+ choice.Choices.Add("Level", new MusicChoiceEntry(""));
+ }
+
+ if (gameObject.HasComponent())
+ {
+ choice.Choices.Add("Trigger", new MusicChoiceEntry(""));
+ }
+
+ if (gameObject.HasComponent())
+ {
+ choice.Choices.Add("Zone", new MusicChoiceEntry(""));
+ }
+
+ choice.WriteObject(comp);
+
+ if (componentBytes != null)
+ {
+ Serializers.BinaryDeserializer.LoadComponentContentsFromBytes(comp, null, componentBytes);
+ }
+
+ comp.enabled = false;
+ }
+ else if (comp)
+ {
+ comp.Destroy();
+ }
+
+ if (gameObject.HasComponent())
+ {
+ Mod.Instance.levelEditor_.NeedsRefresh = true;
+ }
+
+ if (!gameObject.HasComponent())
+ {
+ editor.AddGameObjectSilent(ref afterHandle, gameObject, editor.WorkingLevel_.GetLayerOfObject(gameObject));
+ }
+
+ addedComponentHandle = (!add) ? default : editor.ReferenceMap_.GetHandleOrNull(comp);
+ gameObject.ForEachILevelEditorListenerInChildren(listener => listener.OnLevelEditorToolFinish());
+
+ ObjectHadComponentAddedOrRemoved.Broadcast(new ObjectHadComponentAddedOrRemoved.Data(gameObject));
+
+
+ if (!gameObject.HasComponent())
+ {
+ editor.SelectObject(gameObject);
+ }
+ }
+
+ public sealed override void Undo()
+ {
+ AddOrRemove(newHandle, ref originalHandle, !isAdd);
+ }
+
+ public sealed override void Redo()
+ {
+ AddOrRemove(originalHandle, ref newHandle, isAdd);
+ }
+ }
+
+}
diff --git a/Distance.TrackMusic/Editor/Tools/RemoveMusicChoiceAction.cs b/Distance.TrackMusic/Editor/Tools/RemoveMusicChoiceAction.cs
new file mode 100644
index 0000000..07291a9
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/RemoveMusicChoiceAction.cs
@@ -0,0 +1,11 @@
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ public class RemoveMusicChoiceAction : AddOrRemoveMusicChoiceAction
+ {
+ public RemoveMusicChoiceAction(GameObject obj, ZEventListener c) : base(obj, c) { }
+
+ public override string Description_ => "Removed Music Choice from object";
+ }
+}
diff --git a/Distance.TrackMusic/Editor/Tools/RemoveMusicChoiceTool.cs b/Distance.TrackMusic/Editor/Tools/RemoveMusicChoiceTool.cs
new file mode 100644
index 0000000..d19f24e
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/RemoveMusicChoiceTool.cs
@@ -0,0 +1,52 @@
+using Centrifuge.Distance.EditorTools.Attributes;
+using LevelEditorActions;
+using LevelEditorTools;
+using System.Linq;
+using UnityEngine;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ [EditorTool]
+ public class RemoveMusicChoiceTool : InstantTool
+ {
+ public static ToolInfo info_ = new ToolInfo("Remove CustomMusic", "", ToolCategory.Others, ToolButtonState.Invisible, false);
+
+ public override ToolInfo Info_ => info_;
+
+ public static void Register()
+ {
+ G.Sys.LevelEditor_.RegisterTool(info_);
+ }
+
+ public ZEventListener[] components;
+
+ public void SetComponents(Component[] componentsP)
+ {
+ components = componentsP.Cast().ToArray();
+ }
+
+ public override bool Run()
+ {
+ if (components == null)
+ {
+ return false;
+ }
+
+ ZEventListener[] selected = components;
+
+ if (selected.Length == 0)
+ {
+ return false;
+ }
+
+ foreach (var obj in selected)
+ {
+ var action = new RemoveMusicChoiceAction(obj.gameObject, obj);
+ action.Redo();
+ action.FinishAndAddToLevelEditorActions();
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/Distance.TrackMusic/Editor/Tools/ToggleMusicAction.cs b/Distance.TrackMusic/Editor/Tools/ToggleMusicAction.cs
new file mode 100644
index 0000000..7841be1
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/ToggleMusicAction.cs
@@ -0,0 +1,25 @@
+using LevelEditorActions;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ public class ToggleMusicAction : SimplerAction
+ {
+ public override string Description_ => "Toggle Custom Music";
+
+ public void Toggle()
+ {
+ Mod.Instance.Enabled = !Mod.Instance.Enabled;
+ Mod.Instance.soundPlayer_.PlayTrack(Mod.Instance.soundPlayer_.GetMusicChoiceValue(G.Sys.LevelEditor_.WorkingSettings_.gameObject, "Level"), 0f);
+ }
+
+ public override void Undo()
+ {
+ Toggle();
+ }
+
+ public override void Redo()
+ {
+ Toggle();
+ }
+ }
+}
diff --git a/Distance.TrackMusic/Editor/Tools/ToggleMusicTool.cs b/Distance.TrackMusic/Editor/Tools/ToggleMusicTool.cs
new file mode 100644
index 0000000..f6d1dda
--- /dev/null
+++ b/Distance.TrackMusic/Editor/Tools/ToggleMusicTool.cs
@@ -0,0 +1,26 @@
+using Centrifuge.Distance.EditorTools.Attributes;
+using LevelEditorActions;
+using LevelEditorTools;
+
+namespace Distance.TrackMusic.Editor.Tools
+{
+ [EditorTool]
+ public class ToggleMusicTool : InstantTool
+ {
+ public static ToolInfo info_ = new ToolInfo("Toggle Custom Music", "", ToolCategory.File, ToolButtonState.Button, false);
+ public override ToolInfo Info_ => info_;
+
+ public static void Register()
+ {
+ G.Sys.LevelEditor_.RegisterTool(info_);
+ }
+
+ public override bool Run()
+ {
+ var action = new ToggleMusicAction();
+ action.Redo();
+ action.FinishAndAddToLevelEditorActions();
+ return true;
+ }
+ }
+}
diff --git a/Distance.TrackMusic/Mod.cs b/Distance.TrackMusic/Entry.cs
similarity index 98%
rename from Distance.TrackMusic/Mod.cs
rename to Distance.TrackMusic/Entry.cs
index 76ece53..01057ed 100644
--- a/Distance.TrackMusic/Mod.cs
+++ b/Distance.TrackMusic/Entry.cs
@@ -23,7 +23,7 @@ public class Mod : MonoBehaviour
public LevelEditorLogic levelEditor_;
- public bool enabled_ = true;
+ public bool Enabled { get; set; } = true;
public void Initialize(IManager manager)
{
@@ -54,7 +54,7 @@ public void PatchPostLoad(bool subscribe)
RemoveParticularSubscriber(audioManager);
var list = (SubscriberList)typeof(AudioManager).GetField("subscriberList_", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(audioManager);
-
+
var item = new StaticEvent.Subscriber(new StaticEvent.Delegate(data =>
{
Debug.Log("Running PostLoad");
diff --git a/Distance.TrackMusic/Harmony/Assembly-CSharp/LevelDataTab/Update.cs b/Distance.TrackMusic/Harmony/Assembly-CSharp/LevelDataTab/Update.cs
index b51ddae..881cb8f 100644
--- a/Distance.TrackMusic/Harmony/Assembly-CSharp/LevelDataTab/Update.cs
+++ b/Distance.TrackMusic/Harmony/Assembly-CSharp/LevelDataTab/Update.cs
@@ -11,11 +11,13 @@ internal static class LevelDataTab__Update
internal static void Postfix(LevelDataTab __instance, ref bool ___propertiesAreBeingDisplayed_)
{
Mod mod = Mod.Instance;
+
if (___propertiesAreBeingDisplayed_ || __instance.IsSelectionValid_)
{
if (mod.levelEditor_.NeedsRefresh)
{
mod.levelEditor_.NeedsRefresh = false;
+
try
{
__instance.GetComponent()?.ClearComponentInspectors();
diff --git a/Distance.TrackMusic/Harmony/Assembly-CSharp/NGUIComponentInspector/OnRemoveComponentClicked.cs b/Distance.TrackMusic/Harmony/Assembly-CSharp/NGUIComponentInspector/OnRemoveComponentClicked.cs
index 0bde2da..6f6749d 100644
--- a/Distance.TrackMusic/Harmony/Assembly-CSharp/NGUIComponentInspector/OnRemoveComponentClicked.cs
+++ b/Distance.TrackMusic/Harmony/Assembly-CSharp/NGUIComponentInspector/OnRemoveComponentClicked.cs
@@ -1,4 +1,5 @@
-using Distance.TrackMusic.Models;
+using Distance.TrackMusic.Editor.Tools;
+using Distance.TrackMusic.Models;
using Harmony;
using System.Linq;
using UnityEngine;
@@ -11,17 +12,17 @@ internal static class NGUIComponentInspector__OnRemoveComponentClicked
[HarmonyPrefix]
internal static bool Prefix(NGUIComponentInspector __instance)
{
- if (__instance.ISerializable_ is ZEventListener && ((ZEventListener)__instance.ISerializable_).eventName_.StartsWith(CustomDataInfo.GetPrefix()))
+ if (__instance.ISerializable_ is ZEventListener listener && listener.eventName_.StartsWith(CustomDataInfo.GetPrefix()))
{
- EditorTools.RemoveMusicChoiceTool removeTool = G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(EditorTools.RemoveMusicChoiceTool), false) as EditorTools.RemoveMusicChoiceTool;
-
- if (removeTool != null)
+ if (G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(RemoveMusicChoiceTool), false) is RemoveMusicChoiceTool removeTool)
{
var ser = __instance.iSerializables_;
removeTool.SetComponents(ser.Cast().ToArray());
}
+
return false;
}
+
return true;
}
}
diff --git a/Distance.TrackMusic/LevelEditorLogic.cs b/Distance.TrackMusic/LevelEditorLogic.cs
index 6d8a091..75da562 100644
--- a/Distance.TrackMusic/LevelEditorLogic.cs
+++ b/Distance.TrackMusic/LevelEditorLogic.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+using Distance.TrackMusic.Editor.Tools;
+using UnityEngine;
namespace Distance.TrackMusic
{
@@ -15,27 +16,26 @@ public void Awake()
mod_ = GetComponent();
}
-
public void AddMusicChoiceSelection()
{
- EditorTools.AddMusicChoiceTool.Target = G.Sys.LevelEditor_.SelectedObjects_.ToArray();
- G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(EditorTools.AddMusicChoiceTool), false);
+ AddMusicChoiceTool.Target = G.Sys.LevelEditor_.SelectedObjects_.ToArray();
+ G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(AddMusicChoiceTool), false);
}
public void AddMusicChoiceLevelSettings()
{
- EditorTools.AddMusicChoiceTool.Target = new GameObject[] { G.Sys.LevelEditor_.WorkingSettings_.gameObject };
- G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(EditorTools.AddMusicChoiceTool), false);
+ AddMusicChoiceTool.Target = new GameObject[] { G.Sys.LevelEditor_.WorkingSettings_.gameObject };
+ G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(AddMusicChoiceTool), false);
}
public void AddMusicTrack()
{
- G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(EditorTools.AddMusicTrackTool), false);
+ G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(AddMusicTrackTool), false);
}
public void ToggleCustomMusic()
{
- G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(EditorTools.ToggleMusicTool), false);
+ G.Sys.LevelEditor_.StartNewToolJobOfType(typeof(ToggleMusicTool), false);
}
public void ResetLevelSettings(LevelSettings __instance)
@@ -51,7 +51,9 @@ public void ResetLevelSettings(LevelSettings __instance)
}
__instance.gameObject.RemoveComponents();
+
mod_.soundPlayer_.Update();
+
NeedsRefresh = true;
}
}
diff --git a/Distance.TrackMusic/SoundPlayerLogic.cs b/Distance.TrackMusic/SoundPlayerLogic.cs
index f982e29..45da21f 100644
--- a/Distance.TrackMusic/SoundPlayerLogic.cs
+++ b/Distance.TrackMusic/SoundPlayerLogic.cs
@@ -30,7 +30,7 @@ public bool PlayTrack(string trackName, float fadeTimeMs = 2000f, bool force = f
return false;
}
- if (!mod_.enabled_)
+ if (!mod_.Enabled)
{
StopCustomMusic();
return false;
diff --git a/Distance.TrackMusic/packages.config b/Distance.TrackMusic/packages.config
index 152e5dc..86a9d2c 100644
--- a/Distance.TrackMusic/packages.config
+++ b/Distance.TrackMusic/packages.config
@@ -1,6 +1,6 @@
-
+