コード例 #1
0
 private void TurnInMission()
 {
     if (isFinishEating)
     {
         List <MutableDataWellapadTask> mission;
         if (DataManager.Instance.GameData.Wellapad.CurrentTasks.ContainsKey("TutorialPart1"))
         {
             mission = WellapadMissionController.Instance.GetTaskGroup("TutorialPart1");
         }
         else
         {
             mission = WellapadMissionController.Instance.GetTaskGroup("Critical");
         }
         if (mission != null && WellapadMissionController.Instance.CheckGroupReward() == RewardStatuses.Unclaimed)
         {
             // Claim the reward
             MiniPetManager.Instance.IncreaseXp(minipetId);
             MiniPetRetentionUIController retentionUI = (MiniPetRetentionUIController)MiniPetHUDUIManager.Instance.SelectedMiniPetContentUIScript;
             WellapadMissionController.Instance.ClaimReward(missionID, rewardObject: retentionUI.GetRewardButton());
             WellapadMissionController.Instance.RefreshCheck();
             retentionUI.HideRewardButton();
         }
     }
 }
コード例 #2
0
    // 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;
        }
    }