Skip to content

Commit

Permalink
Fixed the text setter and other bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nickc01 committed Jul 12, 2020
1 parent 7d91af6 commit de123ef
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 18 deletions.
45 changes: 38 additions & 7 deletions Assets/Scripts/Grimm/InfernoKingGrimm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,21 @@ private void Awake()

var allObjects = Resources.FindObjectsOfTypeAll<GameObject>();


foreach (var obj in allObjects)
{
if (obj.name.Contains("Title"))
if (obj.GetComponent<TMP_Text>() != null && obj.scene != null && obj.scene.name != null)
{
ChangeTitles(obj);
}
}
/*foreach (var obj in allObjects)
{
if (obj.name.Contains("Title"))
{
ChangeTitles(obj);
}
}*/

//ChangeTitles(allObjects.FirstOrDefault(g => g.name == "Title Main"));
//ChangeTitles(allObjects.FirstOrDefault(g => g.name == "Title Sub"));
Expand All @@ -196,26 +204,49 @@ private void ChangeTitles(GameObject titleObject)
//Debugger.Log("Change Title = " + titleObject);
if (titleObject != null && CoreInfo.LoadState == RunningState.Game)
{
WeaverLog.Log("Title Object = " + titleObject);
var text = titleObject.GetComponent<TMP_Text>();
if (text != null)
{
var setter = titleObject.AddComponent<TMProTextSetter>();
if (titleObject.name == "Title Sub")

WeaverLog.Log("Text = " + text.text);
if (titleObject.GetComponent<TMProTextSetter>() == null)
{
titleObject.AddComponent<TMProTextSetter>();
}
//var setter =

/*if (text.text.Contains("Nightmare"))
{
setter.textToSet = text.text.Replace("Nightmare","Inferno");
WeaverLog.Log("Change 1");
}
if (text.text.Contains("Infinite"))
{
setter.textToSet = text.text.Replace("Infinite", "Inferno King");
WeaverLog.Log("Change 2");
}*/

//var textContents = text.text.ToLower();



/*if (titleObject.name == "Title Sub")
{
setter.textToSet = "";
}
else if (text.text == "Infinite" || text.text == "Nightmare King")
else if (textContents == "infinite" || textContents == "nightmare king")
{
setter.textToSet = titleSmall;
}
else if (text.text == "Grimm")
else if (textContents == "grimm")
{
setter.textToSet = titleLarge;
}
else if (text.text.Contains("Nightmare King Grimm") || text.text.Contains("Infinite King Grimm") || text.text.Contains("Infinite Grimm"))
else if (textContents.Contains("nightmare king grimm") || text.text.Contains("infinite king grimm") || text.text.Contains("Infinite Grimm"))
{
setter.textToSet = titleSmall + " " + titleLarge;
}
}*/
}

/*if (titleObject.GetComponent(TMProTextSetterOLD.TMProT) != null)
Expand Down
18 changes: 16 additions & 2 deletions Assets/Scripts/TMProTextSetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Text;
using TMPro;
using UnityEngine;
using WeaverCore;

namespace Assets.Scripts
{
Expand All @@ -27,10 +28,23 @@ void Update()

void SetText()
{
if (text != null && textToSet != null)

if (text.text.Contains("Nightmare"))
{
text.text = textToSet;
WeaverLog.Log("Replacing Text = " + text.text + " with " + text.text.Replace("Nightmare", "Inferno"));
text.text = text.text.Replace("Nightmare", "Inferno");
WeaverLog.Log("Change 1");
}
if (text.text.Contains("Infinite"))
{
WeaverLog.Log("Replacing Text = " + text.text + " with " + text.text.Replace("Infinite", "Inferno King"));
text.text = text.text.Replace("Infinite", "Inferno King");
WeaverLog.Log("Change 2");
}
/*if (text != null && textToSet != null)
{
text.text = textToSet;
}*/
}
}
}
2 changes: 1 addition & 1 deletion Assets/WeaverCore/Hidden~/CopyHashes.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using System.Text;
using UnityEngine;
using WeaverCore.Enums;
using WeaverCore.Interfaces;

namespace WeaverCore.Internal
Expand Down Expand Up @@ -34,7 +35,7 @@ private static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventA

static void RunInitFunctions(Assembly assembly)
{
if (assembly.GetName().Name == "Assembly-CSharp")
if (CoreInfo.LoadState == RunningState.Game && assembly.GetName().Name == "Assembly-CSharp")
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Reflection;
using System.Text;
using WeaverCore.Enums;
using WeaverCore.Interfaces;
using WeaverCore.Utilities;

Expand Down Expand Up @@ -31,7 +32,7 @@ private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs arg

void PatchAssembly(Assembly assembly)
{
if (assembly.GetName().Name == "Assembly-CSharp")
if (CoreInfo.LoadState == RunningState.Game && assembly.GetName().Name == "Assembly-CSharp")
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using WeaverCore.Implementations;
using System.Reflection;
using WeaverCore.Interfaces;
using WeaverCore.Enums;

namespace WeaverCore.Internal
{
Expand Down Expand Up @@ -43,7 +44,7 @@ private static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventA

static void DoRuntimeInit(Assembly assembly)
{
if (assembly.GetName().Name == "Assembly-CSharp")
if (CoreInfo.LoadState == RunningState.Game && assembly.GetName().Name == "Assembly-CSharp")
{
return;
}
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public override void Shake(Vector3 amount, float duration, int priority = 100)

public override void Shake(ShakeType type)
{
shakerFSM.SendEvent("CANCEL SHAKE");
//shakerFSM.SendEvent("CANCEL SHAKE");
CustomShake = false;
switch (type)
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public override void SetRumble(Vector3 amount)

public override void SetRumble(RumbleType type)
{
StopRumbling();
//StopRumbling();
CustomRumble = false;
switch (type)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using WeaverCore.Components;
using WeaverCore.Interfaces;

namespace WeaverCore.Game.Patches
{
class EnemyDreamNailReaction : IInit
{
public void OnInit()
{
On.EnemyDreamnailReaction.ShowConvo += EnemyDreamnailReaction_ShowConvo;
}

private static void EnemyDreamnailReaction_ShowConvo(On.EnemyDreamnailReaction.orig_ShowConvo orig, EnemyDreamnailReaction self)
{
var flasher = self.GetComponent<SpriteFlasher>();
if (flasher != null)
{
flasher.DoFlash(0.01f, 0.75f, 0.9f, Color.white, 0.25f);
}
}
}
}
3 changes: 2 additions & 1 deletion Assets/WeaverCore/WeaverCore/Internal/InitRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using System.Text;
using UnityEngine;
using WeaverCore.Enums;
using WeaverCore.Interfaces;

namespace WeaverCore.Internal
Expand Down Expand Up @@ -34,7 +35,7 @@ private static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventA

static void RunInitFunctions(Assembly assembly)
{
if (assembly.GetName().Name == "Assembly-CSharp")
if (CoreInfo.LoadState == RunningState.Game && assembly.GetName().Name == "Assembly-CSharp")
{
return;
}
Expand Down
3 changes: 2 additions & 1 deletion Assets/WeaverCore/WeaverCore/Internal/PatchRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Reflection;
using System.Text;
using WeaverCore.Enums;
using WeaverCore.Interfaces;
using WeaverCore.Utilities;

Expand Down Expand Up @@ -31,7 +32,7 @@ private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs arg

void PatchAssembly(Assembly assembly)
{
if (assembly.GetName().Name == "Assembly-CSharp")
if (CoreInfo.LoadState == RunningState.Game && assembly.GetName().Name == "Assembly-CSharp")
{
return;
}
Expand Down
3 changes: 2 additions & 1 deletion Assets/WeaverCore/WeaverCore/Internal/RuntimeInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using WeaverCore.Implementations;
using System.Reflection;
using WeaverCore.Interfaces;
using WeaverCore.Enums;

namespace WeaverCore.Internal
{
Expand Down Expand Up @@ -43,7 +44,7 @@ private static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventA

static void DoRuntimeInit(Assembly assembly)
{
if (assembly.GetName().Name == "Assembly-CSharp")
if (CoreInfo.LoadState == RunningState.Game && assembly.GetName().Name == "Assembly-CSharp")
{
return;
}
Expand Down

0 comments on commit de123ef

Please sign in to comment.