Skip to content

Commit 61f9070

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Reset Extension
1 parent 71f8ebb commit 61f9070

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

Runtime/Client/LootLockerServerApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void Instantiate()
3232
}
3333
}
3434

35-
public static void Reset()
35+
public static void ResetInstance()
3636
{
3737
if (_instance == null) return;
3838
#if UNITY_EDITOR
@@ -47,7 +47,7 @@ public static void Reset()
4747
[InitializeOnEnterPlayMode]
4848
static void OnEnterPlaymodeInEditor(EnterPlayModeOptions options)
4949
{
50-
Reset();
50+
ResetInstance();
5151
}
5252
#endif
5353

Runtime/Editor/Editor UI/LootLockerAdminExtension.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,21 @@ public void GameButtonTemplate(LootLocker.Extension.DataTypes.Game game, string
590590
gameSelectorList.Add(button);
591591
}
592592

593+
bool AtTarget(EventBase eventBase)
594+
{
595+
#if UNITY_2023_1_OR_NEWER
596+
if(eventBase.propagationPhase == PropagationPhase.BubbleUp)
597+
return true;
598+
#else
599+
if(eventBase.propagationPhase == PropagationPhase.AtTarget)
600+
return true;
601+
#endif
602+
return false;
603+
}
604+
593605
void OnGameSelected(EventBase e)
594606
{
595-
if (e.propagationPhase != PropagationPhase.AtTarget)
607+
if (!AtTarget(e))
596608
return;
597609

598610
var target = e.target as Button;
@@ -707,7 +719,6 @@ void APIKeyTemplate(KeyResponse key)
707719
if (button.name == LootLockerConfig.current.apiKey)
708720
{
709721
button.style.borderRightColor = button.style.borderLeftColor = button.style.borderTopColor = button.style.borderBottomColor = stage;
710-
keyName.style.color = stage;
711722
}
712723

713724
button.AddToClassList("apikey");
@@ -725,7 +736,7 @@ void APIKeyTemplate(KeyResponse key)
725736

726737
void OnAPIKeySelected(EventBase e)
727738
{
728-
if (e.propagationPhase != PropagationPhase.AtTarget)
739+
if (!AtTarget(e))
729740
return;
730741

731742
var target = e.target as Button;
@@ -744,16 +755,14 @@ void SwapNewSelectedKey()
744755

745756
if (key.name == LootLockerConfig.current.apiKey)
746757
{
747-
key.style.backgroundColor = stage;
748-
758+
key.style.borderRightColor = key.style.borderLeftColor = key.style.borderTopColor = key.style.borderBottomColor = stage;
749759
}
750760
else
751761
{
752762
key.style.backgroundColor = defaultButton;
753763
}
754764
}
755765
}
756-
757766
void Logout()
758767
{
759768
loadingPage.style.display = DisplayStyle.Flex;
@@ -765,6 +774,10 @@ void Logout()
765774
loadingPage.style.display = DisplayStyle.None;
766775
SwapFlows(activeFlow, loginFlow);
767776
}
777+
private void OnDestroy()
778+
{
779+
LootLockerServerApi.ResetInstance();
780+
}
768781

769782
}
770783
}

0 commit comments

Comments
 (0)