示例#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;
        }
    }
示例#2
0
    public ImmutableDataMiniPet(string id, IXMLNode xmlNode, string error)
    {
        Hashtable hashElements = XMLUtils.GetChildren(xmlNode);

        this.id = id;

        name = XMLUtils.GetString(hashElements["Name"] as IXMLNode, null, error);

        type = (MiniPetTypes)System.Enum.Parse(typeof(MiniPetTypes),
                                               XMLUtils.GetString(hashElements["Type"] as IXMLNode, null, error));

        prefabName = XMLUtils.GetString(hashElements["PrefabName"] as IXMLNode, null, error);

        string rawLocation = XMLUtils.GetString(hashElements["SpawnLocation"] as IXMLNode, null, error);

        spawnLocation = Constants.ParseVector3(rawLocation);

        levelUpConditionID = XMLUtils.GetString(hashElements["LevelUpConditionID"] as IXMLNode, null, error);

        foodPreferenceID = XMLUtils.GetString(hashElements["FoodPreferenceID"] as IXMLNode, null, error);

        cutsceneHatchPrefabName = XMLUtils.GetString(hashElements["CutsceneHatchPrefabName"] as IXMLNode, null, error);
    }
示例#3
0
    protected override void _CloseUI()
    {
        this.GetComponent <TweenToggleDemux>().Hide();
        minipetType = MiniPetTypes.None;

        storeTweenParent.Hide();
        CheckStoreButtonPulse();
        SelectedMiniPetGameObject.GetComponent <MiniPetSpeechAI>().BeQuiet();
        SelectedMiniPetGameObject.GetComponent <MiniPetSpeechAI>().PetSpeechZoomToggle(false);

        //Show other UI Objects
        NavigationUIManager.Instance.ShowPanel();
        HUDUIManager.Instance.ShowPanel();
        InventoryUIManager.Instance.ShowPanel();
        RoomArrowsUIManager.Instance.ShowPanel();
        PetAnimationManager.Instance.EnableVisibility();
        PetAudioManager.Instance.EnableSound = true;
        DecoInventoryUIManager.Instance.HidePanel();
        if (content != null)
        {
            Destroy(content.gameObject);
        }
        CameraManager.Instance.ZoomOutMove();
    }
示例#4
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;
        }
    }