void Start() { // Remove old data foreach (Transform petSelectionTransform in PetSelectionParent.transform) { Destroy(petSelectionTransform.gameObject); } // Choose whether you see egg or pet. Only eggs for now (loading screen skips to bedroom) if (!PetMenuInfo.IsHatched) { GameObject menuSceneEggPrefab = Resources.Load("MenuSceneEgg") as GameObject; GameObject menuSceneEggGO = GameObjectUtils.AddChildWithPositionAndScale(PetSelectionParent, menuSceneEggPrefab); menuSceneEggGO.name = "MenuSceneEgg"; menuSceneEggGO.GetComponent <EggController>().Init(); } else { GameObject menuScenePetPrefab = Resources.Load("MenuScenePet") as GameObject; GameObject menuScenePetGO = GameObjectUtils.AddChildWithPositionAndScale(PetSelectionParent, menuScenePetPrefab); menuScenePetGO.name = "MenuScenePet"; TextMesh petNameLabel = menuScenePetGO.transform.Find("Label_PetName").GetComponent <TextMesh>(); petNameLabel.text = PetMenuInfo.PetName; menuScenePetGO.GetComponent <LgWorldButtonMessage>().target = this.gameObject; menuScenePetGO.GetComponent <LgWorldButtonMessage>().functionName = "PetSelected"; } }
//--------------------------------------------------- // SetScreen() // Called when the wellapad is opening. The wellapad // is an electronic device with numerous screens -- // this function (for now) will set the proper screen. //--------------------------------------------------- public void SetScreen() { // for now, just check to see if the player has any outstanding missions. bool hasActiveTasks = WellapadMissionController.Instance.HasActiveTasks(); foreach (Transform child in goWellapadScreen.transform) { child.gameObject.SetActive(false); Destroy(child.gameObject); missionListGO = null; missionDoneGO = null; } if (hasActiveTasks) { // user has active tasks/missions, so show the task list if (missionListGO == null) { GameObject missionListPrefab = (GameObject)Resources.Load("MissionList"); missionListGO = GameObjectUtils.AddChildWithPositionAndScale(goWellapadScreen, missionListPrefab); } missionListGO.GetComponent <WellapadMissionUIController>().DisplayMissions(); } else { // otherwise, show the "come back later" screen if (missionDoneGO == null) { GameObject missionDonePrefab = (GameObject)Resources.Load("MissionDone"); missionDoneGO = GameObjectUtils.AddChildWithPositionAndScale(goWellapadScreen, missionDonePrefab); } } }
private IEnumerator ShowIntroMovie(string petColor) { yield return(new WaitForSeconds(.3f)); if (DataManager.Instance.GameData.Cutscenes.ListViewed.Contains("Comic_Intro")) { LoadToBedroom(); } GameObject comicPlayerPrefab = Resources.Load("IntroComicPlayer") as GameObject; GameObject goComicPlayer = GameObjectUtils.AddChildWithPositionAndScale(null, comicPlayerPrefab) as GameObject; goComicPlayer.GetComponent <ComicPlayer>().Init(petColor); ComicPlayer.OnComicPlayerDone += IntroComicDone; // Play the comic music AudioManager.Instance.FadeOutPlayNewBackground("bgComic", isLoop: false); }
//---------------------------------------------- // RefreshUnlockPredictions() // Update the items/badge/flame that will be unlocked for next level //---------------------------------------------- private void RefreshUnlockPredictions(object sender, EventArgs args) { foreach (Transform child in gridUnlockPredictions.transform) { child.gameObject.SetActive(false); Destroy(child.gameObject); } ImmutableDataBadge badge = BadgeManager.Instance.GetBadgeUnlockAtNextLevel(); if (badge != null) { GameObject go = GameObjectUtils.AddChildWithPositionAndScale(gridUnlockPredictions, unlockPredictionEntryPrefab); Image sprite = go.GetComponent <Image>(); sprite.sprite = SpriteCacheManager.GetBadgeSprite(badge.TextureName); } ImmutableDataSkill skill = FlameLevelLogic.Instance.GetSkillUnlockAtNextLevel(); if (skill != null) { GameObject go = GameObjectUtils.AddChildWithPositionAndScale(gridUnlockPredictions, unlockPredictionEntryPrefab); Image sprite = go.GetComponent <Image>(); //Place Holder sprite.sprite = SpriteCacheManager.GetSprite(skill.TextureName); } List <Item> items = ItemManager.Instance.GetItemsUnlockAtNextLevel(); foreach (Item item in items) { GameObject go = GameObjectUtils.AddChildWithPositionAndScale(gridUnlockPredictions, unlockPredictionEntryPrefab); Image sprite = go.GetComponent <Image>(); sprite.sprite = SpriteCacheManager.GetSprite(item.TextureName); } }
// Called from minipet script children themselves public void OpenUIMinipetType(MiniPetTypes type, Hashtable hash, MonoBehaviour baseScript) { GameObject contentPrefab; switch (type) { case MiniPetTypes.Retention: minipetType = MiniPetTypes.Retention; //Debug.Log(DataManager.Instance.GameData.Wellapad.CurrentTasks.ContainsKey(hash[0].ToString())); if (DataManager.Instance.GameData.Wellapad.CurrentTasks.ContainsKey(hash[0].ToString())) { // Debug.Log(DataManager.Instance.GameData.Wellapad.CurrentTasks[hash[0].ToString()].RewardStatus); if (DataManager.Instance.GameData.Wellapad.CurrentTasks[hash[0].ToString()].isReward == RewardStatuses.Unclaimed || DataManager.Instance.GameData.Wellapad.CurrentTasks[hash[0].ToString()].isReward == RewardStatuses.Unearned) { contentPrefab = Resources.Load("ContentParentRetention") as GameObject; content = GameObjectUtils.AddChildWithPositionAndScale(contentParent, contentPrefab); content.GetComponentInChildren <Button>().onClick.AddListener(() => MiniPetManager.Instance.MiniPetTable["MiniPet0"].GetComponent <MiniPetRetentionPet>().OnTurnInButton()); MiniPetRetentionUIController minipetRetentionUIController = content.GetComponent <MiniPetRetentionUIController>(); minipetRetentionUIController.InitializeContent(hash[0].ToString(), (MiniPetRetentionPet)baseScript); SelectedMiniPetContentUIScript = minipetRetentionUIController; if (TutorialManager.Instance == null || !TutorialManager.Instance.IsTutorialActive()) { contentTweenParent = content.GetComponent <TweenToggle>(); //if(IsOpen() && (contentTweenParent != null)){ // Pet just finished eating, show asap HACK if (contentTweenParent != null) { StartCoroutine(ShowContentHelper()); } } } } break; case MiniPetTypes.GameMaster: minipetType = MiniPetTypes.GameMaster; if (DataManager.Instance.GameData.Wellapad.CurrentTasks[hash[0].ToString()].isReward == RewardStatuses.Unclaimed || DataManager.Instance.GameData.Wellapad.CurrentTasks[hash[0].ToString()].isReward == RewardStatuses.Unearned) { contentPrefab = Resources.Load("ContentParentGameMaster") as GameObject; content = GameObjectUtils.AddChildWithPositionAndScale(contentParent, contentPrefab); MinigameTypes minigameType = (MinigameTypes)Enum.Parse(typeof(MinigameTypes), hash[1].ToString()); content.GetComponentInChildren <Button>().onClick.AddListener(() => MiniPetManager.Instance.MiniPetTable["MiniPet1"].GetComponent <MiniPetGameMaster>().OnTurnInButton()); MiniPetGameMasterUIController minipetGameMasterUIController = content.GetComponent <MiniPetGameMasterUIController>(); minipetGameMasterUIController.InitializeContent(hash[0].ToString(), minigameType, (MiniPetGameMaster)baseScript); SelectedMiniPetContentUIScript = minipetGameMasterUIController; if (TutorialManager.Instance == null || !TutorialManager.Instance.IsTutorialActive()) { contentTweenParent = content.GetComponent <TweenToggle>(); //if(IsOpen() && (contentTweenParent != null)){ // Pet just finished eating, show asap HACK if (contentTweenParent != null) { StartCoroutine(ShowContentHelper()); } } } break; case MiniPetTypes.Merchant: minipetType = MiniPetTypes.Merchant; contentPrefab = Resources.Load("ContentParentMerchant") as GameObject; content = GameObjectUtils.AddChildWithPositionAndScale(contentParent, contentPrefab); ItemType itemType = (ItemType)Enum.Parse(typeof(ItemType), hash[1].ToString()); MiniPetMerchantUIController minipetMerchantUIController = content.GetComponent <MiniPetMerchantUIController>(); minipetMerchantUIController.InitializeContent(hash[0].ToString(), false, itemType, (MiniPetMerchant)baseScript); SelectedMiniPetContentUIScript = minipetMerchantUIController; if (TutorialManager.Instance == null || !TutorialManager.Instance.IsTutorialActive()) { contentTweenParent = content.GetComponent <TweenToggle>(); //if(IsOpen() && (contentTweenParent != null)){ // Pet just finished eating, show asap HACK if (contentTweenParent != null) { StartCoroutine(ShowContentHelper()); } } break; default: minipetType = MiniPetTypes.None; Debug.LogError("No minipet type found: " + type.ToString()); return; } }