Skip to content

Commit

Permalink
Fixed crest action icon being visible in H scenes inside clubroom; re…
Browse files Browse the repository at this point in the history
…moved some debug logging
  • Loading branch information
ManlyMarco committed Feb 28, 2021
1 parent bc2ffb8 commit 11b06c4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions KK_LewdCrestX/Hooks/ActionIconHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ private static void SpawnCrestActionPoint()
// position above the small table
iconRootTransform.position = new Vector3(-3.1f, -0.4f, 1.85f);

if (iconRootObject.GetComponent<ObservableUpdateTrigger>())
Console.WriteLine("was spawned -=--------------");

var evt = iconRootObject.AddComponent<TriggerEnterExitEvent>();
var animator = iconRootObject.GetComponentInChildren<Animator>();
var rendererIcon = iconRootObject.GetComponentInChildren<SpriteRenderer>();
Expand All @@ -90,8 +87,17 @@ private static void SpawnCrestActionPoint()

var player = Singleton<Game>.Instance.actScene.Player;
evt.UpdateAsObservable()
.Where(_ => playerInRange && ActionInput.isAction && !player.isActionNow)
.Subscribe(_ => ClubInterface.ShowWindow = true)
.Subscribe(_ =>
{
// Hide in H scenes and other places
var isVisible = Singleton<Game>.IsInstance() && !Singleton<Game>.Instance.IsRegulate(true);
if (rendererIcon.enabled != isVisible)
rendererIcon.enabled = isVisible;

// Check if player clicked this point
if (isVisible && playerInRange && ActionInput.isAction && !player.isActionNow)
ClubInterface.ShowWindow = true;
})
.AddTo(evt);
evt.OnGUIAsObservable()
.Subscribe(ClubInterface.OnGui)
Expand Down

0 comments on commit 11b06c4

Please sign in to comment.