Skip to content

Commit 11a77ab

Browse files
authored
Merge pull request #62 from TaloDev/identify-warning
Update IdentityCheck error message to reference correct API
2 parents 297ea64 + 23be778 commit 11a77ab

File tree

1 file changed

+53
-53
lines changed
  • Packages/com.trytalo.talo/Runtime

1 file changed

+53
-53
lines changed

Packages/com.trytalo.talo/Runtime/Talo.cs

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Linq;
3-
using NUnit.Framework;
2+
using System.Linq;
3+
using NUnit.Framework;
44
using UnityEngine;
55

66
namespace TaloGameServices
@@ -38,16 +38,16 @@ public static Player CurrentPlayer
3838

3939
private static LiveConfig _liveConfig;
4040

41-
public static LiveConfig LiveConfig
42-
{
43-
get {
44-
if (_liveConfig == null)
45-
{
46-
throw new Exception("Live config needs to be inited first - use Talo.GameConfig.Get() to fetch it");
47-
}
48-
return _liveConfig;
49-
}
50-
set => _liveConfig = value;
41+
public static LiveConfig LiveConfig
42+
{
43+
get {
44+
if (_liveConfig == null)
45+
{
46+
throw new Exception("Live config needs to be inited first - use Talo.GameConfig.Get() to fetch it");
47+
}
48+
return _liveConfig;
49+
}
50+
set => _liveConfig = value;
5151
}
5252

5353
public static EventsAPI Events
@@ -75,29 +75,29 @@ public static StatsAPI Stats
7575
get => _stats;
7676
}
7777

78-
public static GameConfigAPI GameConfig
79-
{
80-
get => _gameConfig;
78+
public static GameConfigAPI GameConfig
79+
{
80+
get => _gameConfig;
8181
}
8282

8383
static Talo()
8484
{
8585
TaloManager tm;
8686

87-
if (!CheckTestMode())
88-
{
89-
var settings = Resources.Load<TaloSettings>("Talo Settings");
90-
if (!settings)
91-
{
92-
Debug.LogError("A 'Talo Settings' asset was not found in the Resources folder. Create one using the Create menu > Talo > Settings Asset");
93-
return;
94-
}
95-
96-
tm = new GameObject("Talo Manager").AddComponent<TaloManager>();
97-
tm.settings = settings;
98-
} else
99-
{
100-
tm = UnityEngine.Object.FindObjectOfType<TaloManager>();
87+
if (!CheckTestMode())
88+
{
89+
var settings = Resources.Load<TaloSettings>("Talo Settings");
90+
if (!settings)
91+
{
92+
Debug.LogError("A 'Talo Settings' asset was not found in the Resources folder. Create one using the Create menu > Talo > Settings Asset");
93+
return;
94+
}
95+
96+
tm = new GameObject("Talo Manager").AddComponent<TaloManager>();
97+
tm.settings = settings;
98+
} else
99+
{
100+
tm = UnityEngine.Object.FindObjectOfType<TaloManager>();
101101
}
102102

103103
_events = new EventsAPI(tm);
@@ -117,35 +117,35 @@ public static void IdentityCheck()
117117
{
118118
if (!HasIdentity())
119119
{
120-
throw new Exception("You need to identify a player using Talo.Identify() before doing this.");
120+
throw new Exception("You need to identify a player using Talo.Players.Identify() before doing this.");
121121
}
122122
}
123123

124-
public static bool IsOffline()
125-
{
126-
if (TestMode) return RequestMock.Offline;
127-
return Application.internetReachability == NetworkReachability.NotReachable;
124+
public static bool IsOffline()
125+
{
126+
if (TestMode) return RequestMock.Offline;
127+
return Application.internetReachability == NetworkReachability.NotReachable;
128128
}
129129

130-
internal static bool CheckTestMode()
131-
{
132-
var assembly = AppDomain.CurrentDomain.GetAssemblies()
133-
.FirstOrDefault((assembly) => assembly.FullName.ToLowerInvariant().StartsWith("nunit.framework"));
134-
135-
if (assembly != null)
136-
{
137-
try
138-
{
139-
_testMode = TestContext.CurrentContext.Test.ID != null;
140-
return _testMode;
141-
}
142-
catch
143-
{
144-
return false;
145-
}
146-
}
147-
148-
return _testMode;
130+
internal static bool CheckTestMode()
131+
{
132+
var assembly = AppDomain.CurrentDomain.GetAssemblies()
133+
.FirstOrDefault((assembly) => assembly.FullName.ToLowerInvariant().StartsWith("nunit.framework"));
134+
135+
if (assembly != null)
136+
{
137+
try
138+
{
139+
_testMode = TestContext.CurrentContext.Test.ID != null;
140+
return _testMode;
141+
}
142+
catch
143+
{
144+
return false;
145+
}
146+
}
147+
148+
return _testMode;
149149
}
150150
}
151151
}

0 commit comments

Comments
 (0)