Example #1
0
    public void ShowIdleMessage(MiniPetTypes minipetType)
    {
        int       rand      = Random.Range(0, 7);
        Hashtable msgOption = new Hashtable();

        switch (minipetType)
        {
        case MiniPetTypes.Retention:
            msgOption.Add(SpeechController.SpeechKeys.MessageText, Localization.Localize("MINIPET_RETENTION_IDLE_" + rand.ToString()));
            speechController.TalkMiniPet(msgOption);
            break;

        case MiniPetTypes.GameMaster:
            msgOption.Add(SpeechController.SpeechKeys.MessageText, Localization.Localize("MINIPET_GAMEMASTER_IDLE_" + rand.ToString()));
            speechController.TalkMiniPet(msgOption);
            break;

        case MiniPetTypes.Merchant:
            msgOption.Add(SpeechController.SpeechKeys.MessageText, Localization.Localize("MINIPET_MERCHANT_IDLE_" + rand.ToString()));
            speechController.TalkMiniPet(msgOption);
            break;

        default:
            Debug.LogWarning("Bad minipet type " + minipetType.ToString());
            break;
        }
    }
Example #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;
        }
    }