public void Close() { DialogInstance dialogInstance = gameObject.GetComponent <DialogInstance> (); dialogInstance.Done(); GameManager.LoadSceneWithTransitions("Lobby"); }
public void AvatarChangeButton() { DialogInstance _avatarDialogInstance = DialogManager.Instance.Show("ProfileChangeAvatarDialog"); Button galleryButton = GameObjectHelper.GetChildComponentOnNamedGameObject <Button> (_avatarDialogInstance.Content, "GalleryButton"); Button cameraButton = GameObjectHelper.GetChildComponentOnNamedGameObject <Button> (_avatarDialogInstance.Content, "CameraButton"); galleryButton.onClick.AddListener(() => { #if UNITY_EDITOR PickImageEditor(); #endif #if UNITY_IOS IOSCamera.Instance.PickImage(ISN_ImageSource.Library); #endif #if UNITY_ANDROID AndroidCamera.Instance.GetImageFromGallery(); #endif _avatarDialogInstance.Done(); }); cameraButton.onClick.AddListener(() => { #if UNITY_EDITOR PickImageEditor(); #endif #if UNITY_IOS IOSCamera.Instance.PickImage(ISN_ImageSource.Camera); #endif #if UNITY_ANDROID AndroidCamera.Instance.GetImageFromCamera(); #endif _avatarDialogInstance.Done(); }); }
public void HideObject() { GameObject dialog = GameObjectUtils.GetParentWithComponentNamedGameObject <DialogInstance> (gameObject); DialogInstance dialogInstance = null; if (dialog != null) { dialogInstance = dialog.GetComponent <DialogInstance> (); } StartCoroutine(CoRoutines.DelayedCallback(0.3f, () => { if (dialogInstance != null) { dialogInstance.Done(); } else { gameObject.SetActive(false); } })); }
public void ClaimAwards() { // if ( _awards.ContainsKey ("unlockedLevels") ) { // bool unlocked = LevelController.Instance.UnlockNextPack (); // // if ( unlocked ) { // MyDebug.Log ("Award: Unlocked levels: Unlock next pack"); // } // // if ( !unlocked ) { // LevelController.GenerateMoreLevels (); // // int levels = LevelController.TotalLevels (); // LevelController.UnlockLevel ((levels - LevelController.levelsPerPage) + 1); // // MyDebug.Log ("Award: Unlocked levels: Unlock additional levels: " + levels); // } // } if (_awards.ContainsKey("noAds")) { PreferencesFactory.SetInt(Constants.KeyNoAds, 1); MyDebug.Log("Award: No Ads: " + PreferencesFactory.GetInt(Constants.KeyNoAds)); } if (_awards.ContainsKey("coins")) { GameManager.Instance.Player.AddCoins((int)_awards.GetNumber("coins")); MyDebug.Log("Award: Coins: " + (int)_awards.GetNumber("coins")); } if (_awards.ContainsKey("unlockLevel")) { Level level = GameManager.Instance.Levels.GetItem((int)_awards.GetNumber("unlockLevel")); if (level != null) { level.IsUnlocked = true; level.UpdatePlayerPrefs(); Pack pack = LevelController.Instance.PackForLevel(level); if (pack != null) { LevelController.Instance.UnlockPack(pack); } GameManager.Instance.Levels.Selected = level; } } if (_awards.ContainsKey("unlockPack")) { Pack pack = ((CustomGameManager)CustomGameManager.Instance).Packs.GetItem((int)_awards.GetNumber("unlockPack")); if (pack != null) { LevelController.Instance.UnlockPack(pack); } } if (_awards.ContainsKey("unlockAll")) { LevelController.Instance.UnlockAll(); } GameManager.Instance.Player.UpdatePlayerPrefs(); PreferencesFactory.Save(); _awards = null; DialogInstance dialogInstance = gameObject.GetComponent <DialogInstance> (); dialogInstance.Done(); }