Skip to content

Commit 53bdc4a

Browse files
committed
Fix Tabbing
• Incorrectly used 4 spaces per tab instead of 3.
1 parent 92d3b29 commit 53bdc4a

File tree

7 files changed

+249
-247
lines changed

7 files changed

+249
-247
lines changed

OneSignalExample/Assets/OneSignal/Example/GameControllerExample.cs

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class GameControllerExample : MonoBehaviour {
3535

3636
private static string extraMessage;
37-
public string email = "Email Address";
37+
public string email = "Email Address";
3838

3939
void Start () {
4040
extraMessage = null;
@@ -55,7 +55,7 @@ void Start () {
5555
OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;
5656
OneSignal.permissionObserver += OneSignal_permissionObserver;
5757
OneSignal.subscriptionObserver += OneSignal_subscriptionObserver;
58-
OneSignal.emailSubscriptionObserver += OneSignal_emailSubscriptionObserver;
58+
OneSignal.emailSubscriptionObserver += OneSignal_emailSubscriptionObserver;
5959

6060
var pushState = OneSignal.GetPermissionSubscriptionState();
6161
Debug.Log("pushState.subscriptionStatus.subscribed : " + pushState.subscriptionStatus.subscribed);
@@ -114,10 +114,10 @@ public static void HandleNotificationOpened(OSNotificationOpenedResult result) {
114114
Debug.Log("[HandleNotificationOpened] message "+ message +", additionalData: "+ Json.Serialize(additionalData) as string);
115115

116116
if (actionID != null) {
117-
// actionSelected equals the id on the button the user pressed.
118-
// actionSelected will equal "__DEFAULT__" when the notification itself was tapped when buttons were present.
119-
extraMessage = "Pressed ButtonId: " + actionID;
120-
}
117+
// actionSelected equals the id on the button the user pressed.
118+
// actionSelected will equal "__DEFAULT__" when the notification itself was tapped when buttons were present.
119+
extraMessage = "Pressed ButtonId: " + actionID;
120+
}
121121
}
122122

123123
// Test Menu
@@ -129,20 +129,24 @@ void OnGUI () {
129129
GUIStyle guiBoxStyle = new GUIStyle("box");
130130
guiBoxStyle.fontSize = 30;
131131

132-
float itemOriginX = 50.0f;
133-
float itemWidth = Screen.width - 120.0f;
134-
float boxWidth = Screen.width - 20.0f;
135-
float boxOriginY = 120.0f;
136-
float boxHeight = 630.0f;
137-
float itemStartY = 200.0f;
138-
float itemHeightOffset = 90.0f;
139-
float itemHeight = 60.0f;
132+
GUIStyle textFieldStyle = new GUIStyle ("textField");
133+
textFieldStyle.fontSize = 30;
134+
140135

141-
GUI.Box(new Rect(10, boxOriginY, boxWidth, boxHeight), "Test Menu", guiBoxStyle);
136+
float itemOriginX = 50.0f;
137+
float itemWidth = Screen.width - 120.0f;
138+
float boxWidth = Screen.width - 20.0f;
139+
float boxOriginY = 120.0f;
140+
float boxHeight = 630.0f;
141+
float itemStartY = 200.0f;
142+
float itemHeightOffset = 90.0f;
143+
float itemHeight = 60.0f;
142144

143-
float count = 0.0f;
145+
GUI.Box(new Rect(10, boxOriginY, boxWidth, boxHeight), "Test Menu", guiBoxStyle);
144146

145-
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "SendTags", customTextSize)) {
147+
float count = 0.0f;
148+
149+
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "SendTags", customTextSize)) {
146150
// You can tags users with key value pairs like this:
147151
OneSignal.SendTag("UnityTestKey", "TestValue");
148152
// Or use an IDictionary if you need to set more than one tag.
@@ -154,18 +158,18 @@ void OnGUI () {
154158
// OneSignal.DeleteTags(new List<string>() {"UnityTestKey2", "UnityTestKey3" });
155159
}
156160

157-
count++;
161+
count++;
158162

159-
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "GetIds", customTextSize)) {
160-
OneSignal.IdsAvailable((userId, pushToken) => {
163+
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "GetIds", customTextSize)) {
164+
OneSignal.IdsAvailable((userId, pushToken) => {
161165
extraMessage = "UserID:\n" + userId + "\n\nPushToken:\n" + pushToken;
162166
});
163167
}
164168

165169

166-
count++;
170+
count++;
167171

168-
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "TestNotification", customTextSize)) {
172+
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "TestNotification", customTextSize)) {
169173
extraMessage = "Waiting to get a OneSignal userId. Uncomment OneSignal.SetLogLevel in the Start method if it hangs here to debug the issue.";
170174
OneSignal.IdsAvailable((userId, pushToken) => {
171175
if (pushToken != null) {
@@ -181,52 +185,50 @@ void OnGUI () {
181185
notification["send_after"] = System.DateTime.Now.ToUniversalTime().AddSeconds(30).ToString("U");
182186

183187
extraMessage = "Posting test notification now.";
188+
184189
OneSignal.PostNotification(notification, (responseSuccess) => {
185190
extraMessage = "Notification posted successful! Delayed by about 30 secounds to give you time to press the home button to see a notification vs an in-app alert.\n" + Json.Serialize(responseSuccess);
186191
}, (responseFailure) => {
187192
extraMessage = "Notification failed to post:\n" + Json.Serialize(responseFailure);
188193
});
189-
}
190-
else
194+
} else {
191195
extraMessage = "ERROR: Device is not registered.";
196+
}
192197
});
193198
}
194199

200+
count++;
195201

196-
count++;
197-
198-
email = GUI.TextField (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), email, customTextSize);
202+
email = GUI.TextField (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), email, customTextSize);
199203

204+
count++;
200205

201-
count++;
206+
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "SetEmail", customTextSize)) {
207+
extraMessage = "Setting email to " + email;
202208

203-
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "SetEmail", customTextSize)) {
204-
extraMessage = "Setting email to " + email;
205-
206-
OneSignal.SetEmail (email, () => {
207-
Debug.Log("Successfully set email");
208-
}, (error) => {
209-
Debug.Log("Encountered error setting email: " + Json.Serialize(error));
210-
});
211-
}
212-
213-
214-
count++;
209+
OneSignal.SetEmail (email, () => {
210+
Debug.Log("Successfully set email");
211+
}, (error) => {
212+
Debug.Log("Encountered error setting email: " + Json.Serialize(error));
213+
});
214+
}
215215

216-
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "LogoutEmail", customTextSize)) {
217-
extraMessage = "Logging Out of [email protected]";
216+
count++;
218217

219-
OneSignal.LogoutEmail (() => {
220-
Debug.Log("Successfully logged out of email");
221-
}, (error) => {
222-
Debug.Log("Encountered error logging out of email: " + Json.Serialize(error));
223-
});
224-
}
218+
if (GUI.Button (new Rect (itemOriginX, itemStartY + (count * itemHeightOffset), itemWidth, itemHeight), "LogoutEmail", customTextSize)) {
219+
extraMessage = "Logging Out of [email protected]";
220+
221+
OneSignal.LogoutEmail (() => {
222+
Debug.Log("Successfully logged out of email");
223+
}, (error) => {
224+
Debug.Log("Encountered error logging out of email: " + Json.Serialize(error));
225+
});
226+
}
225227

226228
if (extraMessage != null) {
227229
guiBoxStyle.alignment = TextAnchor.UpperLeft;
228230
guiBoxStyle.wordWrap = true;
229-
GUI.Box (new Rect (10, boxOriginY + boxHeight + 20, Screen.width - 20, Screen.height - (boxOriginY + boxHeight + 40)), extraMessage, guiBoxStyle);
231+
GUI.Box (new Rect (10, boxOriginY + boxHeight + 20, Screen.width - 20, Screen.height - (boxOriginY + boxHeight + 40)), extraMessage, guiBoxStyle);
230232
}
231233
}
232234
}
Binary file not shown.

0 commit comments

Comments
 (0)