Skip to content

Commit 68b11df

Browse files
committed
applied ReSharper suggestions
1 parent 7e6a208 commit 68b11df

16 files changed

+55
-51
lines changed

Assets/Plugins/Editor/GameJolt/SettingsEditor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using UnityEngine;
55
using Random = System.Random;
66

7+
// ReSharper disable once CheckNamespace
78
namespace GameJolt.Editor {
89
[CustomEditor(typeof(Settings))]
910
public class SettingsEditor : UnityEditor.Editor {

Assets/Plugins/Editor/GameJolt/Tools.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using UnityEditor;
44
using GameJolt.API;
55

6+
// ReSharper disable once CheckNamespace
67
namespace GameJolt.Editor {
78
public class Tools : MonoBehaviour {
89
private const string DefaultSettingsPath = "Assets/Plugins/GameJolt/GJAPISettings.asset";
@@ -38,6 +39,7 @@ public static void Manager() {
3839
Selection.activeObject = clone;
3940

4041
if(FindObjectOfType<EventSystem>() == null) {
42+
// ReSharper disable once ObjectCreationAsStatement
4143
new GameObject(
4244
"EventSystem",
4345
typeof(EventSystem),

Assets/Plugins/GameJolt/Scripts/API/Misc.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ namespace GameJolt.API {
77
/// Misc API methods.
88
/// </summary>
99
public static class Misc {
10-
private static readonly Dictionary<string, Sprite> spriteCache = new Dictionary<string, Sprite>();
11-
private static readonly Dictionary<string, Action<Sprite>> openRequests = new Dictionary<string, Action<Sprite>>();
10+
private static readonly Dictionary<string, Sprite> SpriteCache = new Dictionary<string, Sprite>();
11+
private static readonly Dictionary<string, Action<Sprite>> OpenRequests = new Dictionary<string, Action<Sprite>>();
1212

1313
/// <summary>
1414
/// Destroys all sprites in the spritecache.
1515
/// </summary>
1616
public static void ClearSpriteCache() {
17-
foreach(var sprite in spriteCache.Values) {
17+
foreach(var sprite in SpriteCache.Values) {
1818
UnityEngine.Object.Destroy(sprite);
1919
}
20-
spriteCache.Clear();
20+
SpriteCache.Clear();
2121
}
2222

2323
/// <summary>
@@ -28,24 +28,24 @@ public static void ClearSpriteCache() {
2828
public static void DownloadImage(string url, Action<Sprite> callback) {
2929
// check if the sprite is already cached
3030
Sprite cachedSprite;
31-
if(spriteCache.TryGetValue(url, out cachedSprite)) {
31+
if(SpriteCache.TryGetValue(url, out cachedSprite)) {
3232
if(cachedSprite) {
3333
// check if sprite is not destroyed
3434
if(callback != null) callback(cachedSprite);
3535
return;
3636
}
3737
// sprite was cached, but it is already destroyed
38-
spriteCache.Remove(url);
38+
SpriteCache.Remove(url);
3939
}
4040

4141
// check if there is already an open request
4242
Action<Sprite> cachedMulticast;
43-
if(callback != null && openRequests.TryGetValue(url, out cachedMulticast)) {
43+
if(callback != null && OpenRequests.TryGetValue(url, out cachedMulticast)) {
4444
// there is already a request for that image
45-
openRequests[url] = cachedMulticast + callback; // add callback to multicast
45+
OpenRequests[url] = cachedMulticast + callback; // add callback to multicast
4646
} else {
4747
// no open request -> initiate one
48-
openRequests[url] = callback;
48+
OpenRequests[url] = callback;
4949
GameJoltAPI.Instance.StartCoroutine(GameJoltAPI.Instance.GetRequest(url, Core.ResponseFormat.Texture, response => {
5050
Sprite sprite = null;
5151
if(response.Success) {
@@ -54,12 +54,12 @@ public static void DownloadImage(string url, Action<Sprite> callback) {
5454
new Rect(0, 0, response.Texture.width, response.Texture.height),
5555
new Vector2(.5f, .5f),
5656
response.Texture.width);
57-
spriteCache[url] = sprite;
57+
SpriteCache[url] = sprite;
5858
}
5959

6060
Action<Sprite> multicast;
61-
if(openRequests.TryGetValue(url, out multicast)) {
62-
openRequests.Remove(url);
61+
if(OpenRequests.TryGetValue(url, out multicast)) {
62+
OpenRequests.Remove(url);
6363
multicast(sprite);
6464
}
6565
}));

Assets/Plugins/GameJolt/Scripts/External/SimpleJSON.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Collections;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
// ReSharper disable All
1112

1213
namespace GameJolt.External.SimpleJSON
1314
{

Assets/Plugins/GameJolt/Scripts/UI/Controllers/BaseWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
namespace GameJolt.UI.Controllers {
55
public abstract class BaseWindow : MonoBehaviour {
6-
protected Animator animator;
6+
protected Animator Animator;
77

88
public void Init(Animator animator) {
9-
this.animator = animator;
9+
Animator = animator;
1010
}
1111

1212
public abstract void Show(Action<bool> callback);

Assets/Plugins/GameJolt/Scripts/UI/Controllers/LeaderboardsWindow.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public override void Show(Action<bool> callback) {
2323
}
2424

2525
public void Show(Action<bool> callback, int? activeTable, int[] visibleTables) {
26-
animator.SetTrigger("Leaderboards");
27-
animator.SetTrigger("ShowLoadingIndicator");
26+
Animator.SetTrigger("Leaderboards");
27+
Animator.SetTrigger("ShowLoadingIndicator");
2828
this.callback = callback;
2929

3030
Scores.GetTables(tables => {
@@ -52,7 +52,7 @@ public void Show(Action<bool> callback, int? activeTable, int[] visibleTables) {
5252
SetScores(activeId);
5353
} else {
5454
// TODO: Show error notification
55-
animator.SetTrigger("HideLoadingIndicator");
55+
Animator.SetTrigger("HideLoadingIndicator");
5656
Dismiss(false);
5757
}
5858
});
@@ -69,7 +69,7 @@ private int GetActiveTableId(Table[] tables, int? activeTable) {
6969
}
7070

7171
public override void Dismiss(bool success) {
72-
animator.SetTrigger("Dismiss");
72+
Animator.SetTrigger("Dismiss");
7373
if(callback != null) {
7474
callback(success);
7575
callback = null;
@@ -81,8 +81,8 @@ public void ShowTab(int index) {
8181
TabsContainer.GetChild(currentTab).GetComponent<TableButton>().SetActive(false);
8282
currentTab = index;
8383

84-
animator.SetTrigger("Lock");
85-
animator.SetTrigger("ShowLoadingIndicator");
84+
Animator.SetTrigger("Lock");
85+
Animator.SetTrigger("ShowLoadingIndicator");
8686

8787
// Request new scores.
8888
SetScores(tableIDs[currentTab]);
@@ -101,11 +101,11 @@ private void SetScores(int tableId) {
101101
ScoresScrollRect.content.GetChild(i).GetComponent<ScoreItem>().Init(scores[i]);
102102
}
103103

104-
animator.SetTrigger("HideLoadingIndicator");
105-
animator.SetTrigger("Unlock");
104+
Animator.SetTrigger("HideLoadingIndicator");
105+
Animator.SetTrigger("Unlock");
106106
} else {
107107
// TODO: Show error notification
108-
animator.SetTrigger("HideLoadingIndicator");
108+
Animator.SetTrigger("HideLoadingIndicator");
109109
Dismiss(false);
110110
}
111111
}, tableId, 50);

Assets/Plugins/GameJolt/Scripts/UI/Controllers/SignInWindow.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override void Show(Action<bool> callback) {
1919

2020
public void Show(Action<bool> signedInCallback, Action<bool> userFetchedCallback) {
2121
ErrorMessage.enabled = false;
22-
animator.SetTrigger("SignIn");
22+
Animator.SetTrigger("SignIn");
2323
this.signedInCallback = signedInCallback;
2424
this.userFetchedCallback = userFetchedCallback;
2525
string username, token;
@@ -30,7 +30,7 @@ public void Show(Action<bool> signedInCallback, Action<bool> userFetchedCallback
3030
}
3131

3232
public override void Dismiss(bool success) {
33-
animator.SetTrigger("Dismiss");
33+
Animator.SetTrigger("Dismiss");
3434
if(signedInCallback != null) {
3535
signedInCallback(success);
3636
signedInCallback = null;
@@ -44,8 +44,8 @@ public void Submit() {
4444
ErrorMessage.text = "Empty username and/or token.";
4545
ErrorMessage.enabled = true;
4646
} else {
47-
animator.SetTrigger("Lock");
48-
animator.SetTrigger("ShowLoadingIndicator");
47+
Animator.SetTrigger("Lock");
48+
Animator.SetTrigger("ShowLoadingIndicator");
4949

5050
var user = new API.Objects.User(UsernameField.text.Trim(), TokenField.text.Trim());
5151
user.SignIn(signInSuccess => {
@@ -57,8 +57,8 @@ public void Submit() {
5757
ErrorMessage.enabled = true;
5858
}
5959

60-
animator.SetTrigger("HideLoadingIndicator");
61-
animator.SetTrigger("Unlock");
60+
Animator.SetTrigger("HideLoadingIndicator");
61+
Animator.SetTrigger("Unlock");
6262
}, userFetchedSuccess => {
6363
if(userFetchedCallback != null) {
6464
// This will potentially be called after a user dismissed the window..

Assets/Plugins/GameJolt/Scripts/UI/Controllers/TrophiesWindow.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class TrophiesWindow : BaseWindow {
1111
private Action<bool> callback;
1212

1313
public override void Show(Action<bool> callback) {
14-
animator.SetTrigger("Trophies");
15-
animator.SetTrigger("ShowLoadingIndicator");
14+
Animator.SetTrigger("Trophies");
15+
Animator.SetTrigger("ShowLoadingIndicator");
1616
this.callback = callback;
1717

1818
Trophies.Get(trophies => {
@@ -30,18 +30,18 @@ public override void Show(Action<bool> callback) {
3030
Container.GetChild(i).GetComponent<TrophyItem>().Init(trophies[i]);
3131
}
3232

33-
animator.SetTrigger("HideLoadingIndicator");
34-
animator.SetTrigger("Unlock");
33+
Animator.SetTrigger("HideLoadingIndicator");
34+
Animator.SetTrigger("Unlock");
3535
} else {
3636
// TODO: Show error notification
37-
animator.SetTrigger("HideLoadingIndicator");
37+
Animator.SetTrigger("HideLoadingIndicator");
3838
Dismiss(false);
3939
}
4040
});
4141
}
4242

4343
public override void Dismiss(bool success) {
44-
animator.SetTrigger("Dismiss");
44+
Animator.SetTrigger("Dismiss");
4545
if(callback != null) {
4646
callback(success);
4747
callback = null;

Documentation/Output/html/class_game_jolt_1_1_u_i_1_1_controllers_1_1_base_window-members.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation/Output/html/class_game_jolt_1_1_u_i_1_1_controllers_1_1_base_window.html

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)