/
UIManagerScript.cs
765 lines (645 loc) · 27.6 KB
/
UIManagerScript.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using SA.iOS.Social;
namespace Spaces {
public class UIManagerScript : MonoBehaviour {
public GameObject panel, closePanelButton;
public GameObject editWorld,goBackHome, openPanelButton;
public GameObject OpenTabsToggle;
public GameObject SpeakingPanel;
public GameObject EditOrGoHomePanel;
string currentRoomID;
private bool mapActivated;
private bool inMyRoom;
private bool tabsSpread;
private bool mapIsToggled;
public GameObject confirmItemB, nextItemB, prevItemB, placeItemB, clearItemB, quitSelectorB, rotateB, ItemNameB;
private bool isEditing = false;
public GameObject joystick;
public GameObject NextSkinB, PreviousSkinB, CancelSkinB, ConfirmSkinB, WardrobeB;
private bool changingCharacter = false;
public GameObject TopPanel, FriendsPanel, RequestsPanel;
private bool friendsPanelOpen = true;
public GameObject AddFriendB, AddFriendForm, LoadingFriendReqB, SuccessFriendReqB, ErrorFriendReqB;
public GameObject InviteFriendB, InviteFriendForm, SuccessFriendInviteB, ErrorFriendInviteB, LoadingFriendInvite;
public GameObject JoinGroupB, JoinGroupForm, SuccessJoinGroup, ErrorJoinGroup, LoadingJoinGroup;
public GameObject GroupFriendsPanel;
public GameObject InGroupsTopTab, InRequestsTopTab, BackToGroupsTopTab;
public GameObject MovePanel, PlacePanel, ShadowMove, ShadowPlace;
public GameObject MainMenuCharacterSelect, MainMenuCharacterBack, BackToMainMenuCharacterSelect, ArmPanel, TorsoPanel, FacePanel;
public Dictionary<string, GameObject> CharacterPanels;
public GameObject CharacterChange;
public GameObject AccessoryName, AccessoryNameShadow;
public Dictionary<string, GameObject> menuSelectors;
public GameObject ArmS, ShoulderS, HandsS, BackpackS, HolsterS, ExtraS, HariS, CapS;
public GameObject NoAccesoriesButton;
string specificType;
public GameObject RotateCharacterB;
public GameObject CameraButton, CameraFlashButton, CancelScreenShotButton;
public GameObject ScreenshotName, ScreenshotLogo, ScreenshotNameText, ScreenshotSuccessButton, ModalPanel, ShareScreenShotButton;
public GameObject ModalPanelTitle, ModalPanelSubtitle, ModalPanelButtonText;
public GameObject ItemSelectPanel, ItemSelectPanelBackdrop;
private string username;
public GameObject LoadingNewMembersB;
public GameObject DeleteTopPanel, DeleteTopPanelBack, DeleteBottomPanel, DeleteBottomPanelBack;
public GameObject ParentPanel;
public GameObject SitDownButton, StandUpButton, SitDownCameraChange;
private bool isSitting = false;
public GameObject JoinGameB, JoinGameBText;
public GameObject GamingManager, GamePanel, FullGamePanel;
private bool isGamePanelOpen = false;
public GameObject PublicWorldsB, PublicWorldsPanel;
public GameObject PublicWorldsAns, CoinsAns, GroupsAns, GamesAns;
private GameObject CurrentOpenAns;
public GameObject SummonGroupB, SummonGroupForm, SummonGroupSendButton, SuccessSummonGroup;
public GameObject Coins;
private string currentEvent = "";
public GameObject CharacterEditingPanel;
public MaleCustomizerScript customizer;
void Start() {
inMyRoom = PlayerPrefs.GetString("currentRoomID") == PlayerPrefs.GetString("myRoomID");
SetInitialState();
CharacterPanels = new Dictionary<string, GameObject>() {
{"Arm", ArmPanel},
{"Torso", TorsoPanel},
{"Face", FacePanel},
};
menuSelectors = new Dictionary<string, GameObject>() {
{"Arm", ArmS},
{"Shoulder", ShoulderS},
{"Hands", HandsS},
{"Backpack", BackpackS},
{"Holster", HolsterS},
{"Extra", ExtraS},
{"Hair", HariS},
{"Cap", CapS},
{"Skin", ArmS}
};
username = PlayerPrefs.GetString("username");
ScreenshotNameText.GetComponent<TMPro.TextMeshProUGUI>().text = "@" + username.ToLower();
}
public void SetInitialState() {
panel.SetActive(false);
TopPanel.SetActive(false);
FriendsPanel.SetActive(true);
ParentPanel.GetComponent<ScrollRect>().content = FriendsPanel.GetComponent<RectTransform>();
RequestsPanel.SetActive(false);
tabsSpread = false;
mapIsToggled = false;
openPanelButton.SetActive(false);
StandUpButton.SetActive(false);
SitDownCameraChange.SetActive(false);
SitDownButton.SetActive(false);
closePanelButton.SetActive(false);
FullGamePanel.SetActive(false);
SpeakingPanel.SetActive(true);
Coins.SetActive(true);
OpenTabsToggle.SetActive(true);
EditOrGoHomePanel.SetActive(false);
GamePanel.SetActive(false);
CameraButton.SetActive(true);
JoinGameB.SetActive(false);
SitDownCameraChange.SetActive(false);
if (inMyRoom) {
goBackHome.SetActive(false);
} else {
editWorld.SetActive(false);
goBackHome.SetActive(true);
}
}
public void ActivateEditing() {
editWorld.SetActive(true);
}
public void TogglePanel(bool open) {
if (open) {
panel.SetActive(true);
TopPanel.SetActive(true);
closePanelButton.SetActive(true);
OpenTabsToggle.SetActive(false);
Coins.SetActive(false);
EditOrGoHomePanel.SetActive(false);
GamePanel.SetActive(false);
SitDownButton.SetActive(false);
JoinGameB.SetActive(false);
CameraButton.SetActive(false);
SpeakingPanel.SetActive(false);
openPanelButton.SetActive(false);
} else {
panel.SetActive(false);
TopPanel.SetActive(false);
CameraButton.SetActive(true);
SpeakingPanel.SetActive(true);
Coins.SetActive(true);
closePanelButton.SetActive(false);
OpenTabsToggle.SetActive(true);
}
if (isGamePanelOpen && !open) {
CloseGamePanel();
} else if (isGamePanelOpen && open) {
TopPanel.SetActive(false);
}
}
public void CloseGamePanel() {
FriendsPanel.SetActive(true);
FullGamePanel.SetActive(false);
isGamePanelOpen = false;
GoToGroups();
BackToGroups();
}
public void OpenGamesPanel() {
isGamePanelOpen = true;
FriendsPanel.SetActive(false);
RequestsPanel.SetActive(false);
GroupFriendsPanel.SetActive(false);
FullGamePanel.SetActive(true);
TogglePanel(true);
}
public void GoToFriendsRoom() {
inMyRoom = false;
SetInitialState();
BackToGroups();
}
public void GoHomeCallback() {
inMyRoom = true;
SetInitialState();
editWorld.SetActive(true);
}
public void SpreadTabs() {
if (tabsSpread) {
EditOrGoHomePanel.SetActive(false);
GamePanel.SetActive(false);
openPanelButton.SetActive(false);
tabsSpread = false;
} else {
EditOrGoHomePanel.SetActive(true);
openPanelButton.SetActive(true);
GamePanel.SetActive(true);
tabsSpread = true;
}
}
public void ToggleEditing() {
if (isEditing) {
OpenTabsToggle.SetActive(true);
Coins.SetActive(true);
confirmItemB.SetActive(false);
ItemNameB.SetActive(false);
ItemSelectPanel.SetActive(false);
ItemSelectPanelBackdrop.SetActive(false);
rotateB.SetActive(false);
nextItemB.SetActive(false);
prevItemB.SetActive(false);
quitSelectorB.SetActive(false);
joystick.SetActive(true);
SpeakingPanel.SetActive(true);
CameraButton.SetActive(true);
} else {
OpenTabsToggle.SetActive(false);
Coins.SetActive(false);
CameraButton.SetActive(false);
SitDownButton.SetActive(false);
JoinGameB.SetActive(false);
SpeakingPanel.SetActive(false);
if (tabsSpread) {
SpreadTabs();
}
confirmItemB.SetActive(true);
ItemNameB.SetActive(true);
nextItemB.SetActive(true);
ItemSelectPanel.SetActive(true);
ItemSelectPanelBackdrop.SetActive(true);
prevItemB.SetActive(true);
quitSelectorB.SetActive(true);
joystick.SetActive(false);
}
isEditing = !isEditing;
}
public void IsPlacingItem() {
joystick.SetActive(false);
MovePanel.SetActive(true);
ShadowMove.SetActive(true);
PlacePanel.SetActive(true);
ShadowPlace.SetActive(true);
PlacePanel.SetActive(true);
confirmItemB.SetActive(false);
ItemNameB.SetActive(false);
ItemSelectPanel.SetActive(false);
ItemSelectPanelBackdrop.SetActive(false);
nextItemB.SetActive(false);
prevItemB.SetActive(false);
quitSelectorB.SetActive(false);
}
public void PlacedItem() {
MovePanel.SetActive(false);
PlacePanel.SetActive(false);
ShadowMove.SetActive(false);
ShadowPlace.SetActive(false);
placeItemB.SetActive(false);
clearItemB.SetActive(false);
rotateB.SetActive(false);
ToggleEditing();
}
public void FinishedEditing() {
//
}
public void ToggleWardrobe(bool open) {
WardrobeB.SetActive(open);
}
public void ToggleCharacterChange() {
joystick.SetActive(changingCharacter);
OpenTabsToggle.SetActive(changingCharacter);
Coins.SetActive(changingCharacter);
CameraButton.SetActive(changingCharacter);
SpeakingPanel.SetActive(changingCharacter);
WardrobeB.SetActive(changingCharacter);
if (tabsSpread && !changingCharacter) {
SpreadTabs();
}
ConfirmSkinB.SetActive(!changingCharacter);
CancelSkinB.SetActive(!changingCharacter);
MainMenuCharacterSelect.SetActive(!changingCharacter);
RotateCharacterB.SetActive(!changingCharacter);
MainMenuCharacterBack.SetActive(!changingCharacter);
PreviousSkinB.SetActive(false);
NextSkinB.SetActive(false);
if (changingCharacter) {
SetInitialState();
}
changingCharacter = !changingCharacter;
}
public void ToggleRequestAndFriendsPanel() {
RequestsPanel.SetActive(friendsPanelOpen);
FriendsPanel.SetActive(!friendsPanelOpen);
friendsPanelOpen = !friendsPanelOpen;
}
public void AddGroupUsername() {
AddFriendB.SetActive(false);
AddFriendForm.SetActive(true);
}
public void JoinGroup() {
JoinGroupB.SetActive(false);
JoinGroupForm.SetActive(true);
}
public void HideJoinGroupForm() {
JoinGroupB.SetActive(true);
JoinGroupForm.SetActive(false);
}
public void HideInviteFriendForm() {
InviteFriendB.SetActive(true);
InviteFriendForm.SetActive(false);
}
public void LoadingInviteFriend() {
InviteFriendB.SetActive(false);
LoadingFriendInvite.SetActive(true);
}
public void ResultFriendInvite(bool success, string message) {
InviteFriendB.SetActive(false);
LoadingFriendInvite.SetActive(false);
if (success) {
SuccessFriendInviteB.SetActive(true);
} else {
ErrorFriendInviteB.transform.GetChild(1).GetChild(1).GetComponent<TMPro.TextMeshProUGUI>().text = message;
ErrorFriendInviteB.SetActive(true);
}
StartCoroutine(RevertInvite(success));
}
public void LoadingGroupCreation() {
AddFriendForm.SetActive(false);
LoadingFriendReqB.SetActive(true);
}
public void ResultGroupCreation(bool success) {
LoadingFriendReqB.SetActive(false);
if (success) {
SuccessFriendReqB.SetActive(true);
} else {
ErrorFriendReqB.SetActive(true);
}
StartCoroutine(RevertGroupCreation(success));
}
public void LoadingJoin() {
JoinGroupForm.SetActive(false);
LoadingJoinGroup.SetActive(true);
}
// refactor and make more abstract all this code
public void ResultGroupJoin(bool success) {
LoadingJoinGroup.SetActive(false);
if (success) {
SuccessJoinGroup.SetActive(true);
} else {
ErrorJoinGroup.SetActive(true);
}
StartCoroutine(RevertGroupJoin(success));
}
IEnumerator RevertGroupCreation(bool success) {
yield return new WaitForSeconds(3);
SuccessFriendReqB.SetActive(false);
ErrorFriendReqB.SetActive(false);
AddFriendB.SetActive(true);
if (success) {
GoToGroups();
}
}
IEnumerator RevertGroupJoin(bool success) {
yield return new WaitForSeconds(3);
SuccessJoinGroup.SetActive(false);
ErrorJoinGroup.SetActive(false);
JoinGroupB.SetActive(true);
if (success) {
GoToGroups();
}
}
IEnumerator RevertInvite(bool success) {
yield return new WaitForSeconds(3);
SuccessFriendInviteB.SetActive(false);
ErrorFriendInviteB.SetActive(false);
InviteFriendB.SetActive(true);
}
public void OpenGroup() {
GroupFriendsPanel.SetActive(true);
ParentPanel.GetComponent<ScrollRect>().content = GroupFriendsPanel.GetComponent<RectTransform>();
FriendsPanel.SetActive(false);
RequestsPanel.SetActive(false); // only for precaution
BackToGroupsTopTab.SetActive(true);
InGroupsTopTab.SetActive(false);
}
public void GoToRequests() {
InGroupsTopTab.SetActive(false);
InRequestsTopTab.SetActive(true);
RequestsPanel.SetActive(true);
ParentPanel.GetComponent<ScrollRect>().content = RequestsPanel.GetComponent<RectTransform>();
FriendsPanel.SetActive(false);
}
public void GoToGroups() {
FriendsPanel.SetActive(true);
ParentPanel.GetComponent<ScrollRect>().content = FriendsPanel.GetComponent<RectTransform>();
RequestsPanel.SetActive(false);
InRequestsTopTab.SetActive(false);
InGroupsTopTab.SetActive(true);
}
public void BackToGroups() {
BackToGroupsTopTab.SetActive(false);
InGroupsTopTab.SetActive(true);
GroupFriendsPanel.SetActive(false);
FriendsPanel.SetActive(true);
PublicWorldsPanel.SetActive(false);
ParentPanel.GetComponent<ScrollRect>().content = FriendsPanel.GetComponent<RectTransform>();
LoadingNewMemberToggle(false);
}
public void BackToCharacterselect() {
NextSkinB.SetActive(false);
PreviousSkinB.SetActive(false);
ArmPanel.SetActive(false);
TorsoPanel.SetActive(false);
FacePanel.SetActive(false);
MainMenuCharacterSelect.SetActive(true);
MainMenuCharacterBack.SetActive(true);
RotateCharacterB.SetActive(true);
BackToMainMenuCharacterSelect.SetActive(false);
CancelSkinB.SetActive(true);
ConfirmSkinB.SetActive(true);
AccessoryName.SetActive(false);
AccessoryNameShadow.SetActive(false);
NoAccesoriesButton.SetActive(false);
menuSelectors[specificType].SetActive(false);
}
public void BrowseTypeOfAccessory(string type) {
AccessoryName.SetActive(true);
AccessoryNameShadow.SetActive(true);
string mainType = type.Split('-')[0];
specificType = type.Split('-')[1];
BackToMainMenuCharacterSelect.SetActive(true);
MainMenuCharacterSelect.SetActive(false);
CancelSkinB.SetActive(false);
ConfirmSkinB.SetActive(false);
if (mainType != "Skin") {
CharacterPanels[mainType].SetActive(true);
} else {
AccessoryName.SetActive(false);
AccessoryNameShadow.SetActive(false);
MainMenuCharacterBack.SetActive(false);
}
BrowseSpecificAccessory(specificType);
}
public void BrowseSpecificAccessory(string type) {
menuSelectors[specificType].SetActive(false);
menuSelectors[type].SetActive(true);
NoAccesoriesButton.SetActive(false);
specificType = type;
NextSkinB.SetActive(true);
PreviousSkinB.SetActive(true);
CharacterChange.GetComponent<CharacterChange>().SetBrowsingType(type);
}
public void TakeScreenshot(bool open) {
if (tabsSpread && open) {
SpreadTabs();
}
joystick.SetActive(!open);
OpenTabsToggle.SetActive(!open);
Coins.SetActive(!open);
CameraButton.SetActive(!open);
SitDownButton.SetActive(false);
JoinGameB.SetActive(false);
StandUpButton.SetActive(!open && isSitting);
SitDownCameraChange.SetActive(!open && isSitting);
CameraFlashButton.SetActive(open);
CancelScreenShotButton.SetActive(open);
}
public void ToggleCaputreScreenshot(bool isTakingShot) {
CameraFlashButton.SetActive(!isTakingShot);
CancelScreenShotButton.SetActive(!isTakingShot);
SpeakingPanel.SetActive(!isTakingShot);
ScreenshotLogo.SetActive(isTakingShot);
ScreenshotName.SetActive(isTakingShot);
}
public void CaputreScreenshotResult(bool success) {
if (success) {
ScreenshotName.SetActive(false);
ScreenshotLogo.SetActive(false);
ScreenshotSuccessButton.SetActive(true);
ShareScreenShotButton.SetActive(true);
//
} else {
ToggleCaputreScreenshot(false);
SetUpPanel("There was an error taking your screenshot", "In settings, make sure you have permissions enabled for spaces to take screenshots", "try again");
}
}
public void CloseShareScreenShot() {
ScreenshotSuccessButton.SetActive(false);
ShareScreenShotButton.SetActive(false);
ToggleCaputreScreenshot(false);
}
public void CloseModalPanel() {
ModalPanel.SetActive(false);
}
public void SetUpPanel(string title, string text, string buttonText) {
ModalPanelTitle.GetComponent<TMPro.TextMeshProUGUI>().text = title;
ModalPanelSubtitle.GetComponent<TMPro.TextMeshProUGUI>().text = text;
ModalPanelButtonText.GetComponent<TMPro.TextMeshProUGUI>().text = buttonText;
ModalPanel.SetActive(true);
}
public void LoadingNewMemberToggle(bool active) {
LoadingNewMembersB.SetActive(active);
}
public void StartDeleting() {
if (tabsSpread) {
SpreadTabs();
}
OpenTabsToggle.SetActive(false);
Coins.SetActive(false);
joystick.SetActive(false);
CameraButton.SetActive(false);
SpeakingPanel.SetActive(false);
DeleteBottomPanel.SetActive(true);
DeleteTopPanel.SetActive(true);
DeleteBottomPanelBack.SetActive(true);
DeleteTopPanelBack.SetActive(true);
}
public void CancelDeleting() {
DeleteBottomPanel.SetActive(false);
DeleteTopPanel.SetActive(false);
DeleteBottomPanelBack.SetActive(false);
DeleteTopPanelBack.SetActive(false);
joystick.SetActive(true);
SetInitialState();
}
public void ToggleSittingButton(bool open) {
SitDownButton.SetActive(open);
}
public void Sit() {
isSitting = true;
SitDownButton.SetActive(false);
StandUpButton.SetActive(true);
SitDownCameraChange.SetActive(true);
joystick.SetActive(false);
}
public void StandUp() {
StandUpButton.SetActive(false);
joystick.SetActive(true);
SitDownCameraChange.SetActive(false);
isSitting = false;
}
public void SetSitDownListeners(System.Action SitDown, System.Action StandUp) {
Button sitDown = SitDownButton.GetComponent<Button>();
Button standUp = StandUpButton.GetComponent<Button>();
standUp.onClick.RemoveAllListeners();
sitDown.onClick.RemoveAllListeners();
sitDown.onClick.AddListener(()=> {SitDown();});
standUp.onClick.AddListener(()=> {StandUp();});
}
public void ToggleZoomSitDown(bool zoomed) {
joystick.SetActive(zoomed);
StandUpButton.SetActive(!zoomed);
CameraButton.SetActive(!zoomed);
}
public void ShowJoinGame(string gameName, string username, string gameCode) {
JoinGameBText.GetComponent<TMPro.TextMeshProUGUI>().text = "Join @" + username + " in " + gameName;
GamingManager.GetComponent<GamingManager>().SetPotentialGame(gameCode);
JoinGameB.SetActive(true);
}
// far from optimal but I don't want to Find() more stuff in character script and I already have uimanager
public void SetGamingManagerCharacter(CharacterScript cs) {
GamingManager.GetComponent<GamingManager>().SetCharacterScript(cs);
customizer.SetCharacterScript(cs);
}
public void HideJoinGame() {
JoinGameB.SetActive(false);
}
public void OpenPublicWorldsPanel() {
FriendsPanel.SetActive(false);
PublicWorldsPanel.SetActive(true);
BackToGroupsTopTab.SetActive(true);
}
public void ToggleAnswer(string question) {
GameObject newOpenAnswer = null;
currentEvent = question;
if (question == "meetup") {
PublicWorldsAns.SetActive(!PublicWorldsAns.activeSelf);
newOpenAnswer = PublicWorldsAns;
} else if (question == "hunt") {
CoinsAns.SetActive(!CoinsAns.activeSelf);
newOpenAnswer = CoinsAns;
} else if (question == "happyhour") {
GroupsAns.SetActive(!GroupsAns.activeSelf);
newOpenAnswer = GroupsAns;
} else if (question == "gameday") {
GamesAns.SetActive(!GamesAns.activeSelf);
newOpenAnswer = GamesAns;
}
if (CurrentOpenAns != newOpenAnswer && CurrentOpenAns != null) {
CurrentOpenAns.SetActive(false);
CurrentOpenAns = newOpenAnswer;
} else {
CurrentOpenAns = newOpenAnswer;
}
}
public void ShareEvent() {
string eventName = "";
string eventDescription = "";
if (currentEvent == "meetup") {
eventName = "~spaces universe meetup~";
eventDescription = "chat with other people in ~spaces~ about how to improve the universe!";
} else if (currentEvent == "hunt") {
eventName = "The Hunt";
eventDescription = "search with other people in ~spacees~ for the treasure chest and get $200 coins!";
} else if (currentEvent == "happyhour") {
eventName = "~spaces~ Happy Hour";
eventDescription = "meet other people around ~spaces~ in the town bar as you wind down the week!";
} else if (currentEvent == "gameday") {
eventName = "~spaces~ Game Day";
eventDescription = "meet other people around ~spaces~ and play against them in board game tournaments!";
}
ISN_UIActivityViewController controller = new ISN_UIActivityViewController();
controller.SetText("@" + username + " has invited you to the '" + eventName + "' in Spaces! Come and " + eventDescription + ".\n\n Download and join here -> http://bit.ly/spaces-app");
controller.Present((result) => {
if(result.IsSucceeded) {
Debug.Log("Completed: " + result.Completed);
Debug.Log("ActivityType: " + result.ActivityType);
} else {
Debug.Log("ISN_UIActivityViewController error: " + result.Error.FullMessage);
}
});
}
public void OpenSummonGroupForm(){
SummonGroupB.SetActive(false);
SummonGroupForm.SetActive(true);
}
public void HideSummonGroupForm() {
SummonGroupForm.SetActive(false);
SummonGroupB.SetActive(true);
}
public void ToggleSummonGroupSendButton(string message) {
SummonGroupSendButton.GetComponent<Text>().text = (message.Length > 0) ? "send" : "cancel";
}
public IEnumerator SuccessSummon() {
SuccessSummonGroup.SetActive(true);
SummonGroupForm.SetActive(false);
yield return new WaitForSeconds(2.5f);
SuccessSummonGroup.SetActive(false);
SummonGroupB.SetActive(true);
}
public void AddCameraToCustomizer(PlayerFollow cam) {
customizer.SetCam(cam);
}
public void StartEditing() {
ToggleEditCharacter(true);
customizer.StartEditing();
}
public void ToggleEditCharacter(bool editing) {
joystick.SetActive(!editing);
OpenTabsToggle.SetActive(!editing);
Coins.SetActive(!editing);
CameraButton.SetActive(!editing);
SpeakingPanel.SetActive(!editing);
WardrobeB.SetActive(!editing);
if (tabsSpread && editing) {
SpreadTabs();
}
CharacterEditingPanel.SetActive(editing);
if (!editing) {
SetInitialState();
}
changingCharacter = !changingCharacter;
}
}
}