コード例 #1
0
    private void CloseShop(object sender, EventArgs args)
    {
        StoreUIManager.OnShortcutModeEnd -= CloseShop;
        HUDUIManager.Instance.ToggleLabels(false);
        ClickManager.Instance.ReleaseLock();

        UIModeTypes currentMode = ClickManager.Instance.CurrentMode;

        if (currentMode == UIModeTypes.MiniPet)
        {
            this.GetComponent <TweenToggleDemux>().Show();
            if (content != null && minipetType == MiniPetTypes.Merchant)                // Keep the hud and open deco inventory
            {
                content.GetComponent <TweenToggle>().Show();
                MiniPetMerchantUIController merchantUI = (MiniPetMerchantUIController)SelectedMiniPetContentUIScript;
                merchantUI.ShowDecoInventoryHelper();
            }
            else if (content != null)
            {
                content.GetComponent <TweenToggle>().Show();
                HUDUIManager.Instance.HidePanel();
            }
            else
            {
                HUDUIManager.Instance.HidePanel();
            }
            storeTweenParent.Show();
        }
        CheckStoreButtonPulse();
    }
コード例 #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;
        }
    }