Пример #1
0
    //=============================================================================

    public void ShowPanel(bool bActive, int FairyLevel = 1, eFairy Fairy = eFairy.BLOOM)
    {
        if (bActive)
        {
            m_bButtonPressed = false;
            m_MainPanel.SetActive(true);

            FairyItemData CurFairyInfo = FairyItemsManager.GetFairyItem(Fairy);
            m_RequirementsPanel.Setup(CurFairyInfo, FairyLevel);

            m_txtFairyLevel.text = FairyLevel.ToString();

            string txtHeader = TextManager.GetText("BOUTIQUE_UPGRADEFAIRY_TITLE");
            txtHeader        = txtHeader.Replace("(FairyName)", Fairy.ToString().ToUpper());
            m_txtHeader.text = txtHeader;

            string txtLevelUp = TextManager.GetText("BOUTIQUE_UPGRADEFAIRY_LEVELUP");
            txtLevelUp        = txtLevelUp.Replace("(Cost)", String.Format("{0:n0}", CurFairyInfo.GemsRequired[FairyLevel]));
            m_txtLevelUp.text = txtLevelUp;
        }
        else
        {
            m_MainPanel.SetActive(false);
        }
    }
Пример #2
0
    //=====================================================

    public bool OnChangeFairy(eFairy fairy, bool forceChange = false, bool useCurrentPosition = true)
    {
        // Check were not trying to change to the same fairy
        if (GameDataManager.Instance.PlayerCurrentFairy == (int)fairy && forceChange == false)
        {
            return(false);
        }

        // Get fairy prefab
        var pfb = GameDataManager.Instance.ChangeFairy(fairy, true);

        if (pfb == null)
        {
            return(false);
        }

        // Get world data for current fairy
        var position = PlayerManager.Position;
        var rotation = PlayerManager.Rotation;

        _isChangingFairy = true;

        // Destroy current fairy and instantiate the new one
        Destroy(PlayerManager.GameObject);
        Instantiate(pfb, position, rotation);

        // Spawn fairy - reset camera
        PlayerManager.SpawnPlayer(null, useCurrentPosition);

        return(true);
    }
Пример #3
0
    //=====================================================

    private void ShowInteractionPopup(eDoorType doorType, int numKeysRequired, eFairy fairyRequired)
    {
        if (_guiDoorInteraction != null)
        {
            _guiDoorInteraction.ShowBubble(doorType, numKeysRequired, fairyRequired);
        }
    }
Пример #4
0
    //=====================================================

    //public static AudioClip GetAudioClip( string audioClipName )
    //{
    //	if( _audioClips == null )
    //		_audioClips = new List<AudioClip>();

    //	foreach( var fairy in _audioClips )
    //	{
    //		if( fairy.FairyName == eFairy.NULL && fairy.AudioClip.name == audioClipName )
    //			return fairy.AudioClip;
    //	}

    //	var audioClip = Resources.Load<AudioClip>( "Audio/Fairies/" + audioClipName );

    //	if( audioClip != null )
    //	{
    //		_audioClips.Add( audioClip );
    //		return audioClip;
    //	}

    //	Debug.Log( "AudioClip not found in resources" );
    //	return null;
    //}

    //=====================================================

    public static AudioClip GetAudioClip(eFairy fairy, string audioClipName)
    {
        if (_audioClips == null)
        {
            _audioClips = new List <FairyAudioClip>();
        }

        foreach (var clip in _audioClips)
        {
            if (clip.FairyName == fairy && clip.AudioClip.name == audioClipName)
            {
                return(clip.AudioClip);
            }
        }

        var path = "Audio/Fairies/";

        switch (fairy)
        {
        case eFairy.AISHA:
            path += "Aisha/";
            break;

        case eFairy.BLOOM:
            path += "Bloom/";
            break;

        case eFairy.FLORA:
            path += "Flora/";
            break;

        case eFairy.MUSA:
            path += "Musa/";
            break;

        case eFairy.STELLA:
            path += "Stella/";
            break;

        case eFairy.TECNA:
            path += "Tecna/";
            break;
        }

        var audioClip = Resources.Load <AudioClip>(path + audioClipName);

        if (audioClip != null)
        {
            var clip = new FairyAudioClip {
                FairyName = fairy, AudioClip = audioClip
            };

            _audioClips.Add(clip);
            return(audioClip);
        }

        Debug.Log("AudioClip not found in resources");
        return(null);
    }
Пример #5
0
    //=====================================================

    public void SetCurrentFairy(eFairy Fairy)
    {
        if (m_CurrentFairy != Fairy)
        {
            m_CurrentFairy         = Fairy;
            m_DestinationItemIndex = m_CurrentItemIndex = -2.0f;
        }
    }
Пример #6
0
    //=====================================================

    private void OnSelectFairy(eFairy fairy)
    {
        // Block these events for short period
        if (Time.time - _lastTimeFairySelected < 2.5f)
        {
            return;
        }

        _lastTimeFairySelected = Time.time;

        _imgCurrentFairyGem.sprite = _fairyGemsSelected[(int)fairy];

        if (GameManager.Instance.OnChangeFairy(fairy) == false)
        {
            return;
        }

        // Play sfx
        if (_audioSource == null)
        {
            return;
        }

        _audioSource.PlayOneShot(_clipBtnClick);

        switch (fairy)
        {
        case eFairy.AISHA:
            _audioSource.PlayOneShot(_clipAishaIntro);
            break;

        case eFairy.BLOOM:
            _audioSource.PlayOneShot(_clipBloomIntro);
            break;

        case eFairy.FLORA:
            _audioSource.PlayOneShot(_clipFloraIntro);
            break;

        case eFairy.MUSA:
            _audioSource.PlayOneShot(_clipMusaIntro);
            break;

        case eFairy.STELLA:
            _audioSource.PlayOneShot(_clipStellaIntro);
            break;

        case eFairy.TECNA:
            _audioSource.PlayOneShot(_clipTecnaIntro);
            break;
        }
    }
Пример #7
0
    public ClothingItemData()
    {
        id             = string.Empty;
        fairy          = eFairy.BLOOM;
        isDefault      = false;
        cost           = 0;
        guiTexture2D   = string.Empty;
        prefabName     = string.Empty;
        gamePrefabName = string.Empty;
        state          = eClothingState.AVAILABLE;

        currentRotation = UnityEngine.Random.Range(0.0f, 100.0f);
    }
Пример #8
0
    //=====================================================

    public static Object GetPrefabFx(eFairy fairy)
    {
        Init();

        var fx = "pfbChangeFairyFx" + fairy;

        var prefab = Resources.Load("Prefabs/Particles/" + fx);

        if (prefab != null)
        {
            return(prefab);
        }

        Debug.Log("Particle FX prefab not found in resources");
        return(null);
    }
Пример #9
0
    //==================================================================

    public static FairyItemData GetFairyItem(eFairy fairy)
    {
        if (!isItemListLoaded)
        {
            LoadItemsList();
        }

        foreach (FairyItemData item in itemList)
        {
            if (fairy == item.fairy)
            {
                return(item);
            }
        }

        return(null);
    }
Пример #10
0
    //=====================================================

    public static Object GetPrefabSpell(eFairy fairy, int level)
    {
        Init();

        // Set resources path for spell prefabs
        var path = "Prefabs/Spells/";

        switch (fairy)
        {
        case eFairy.AISHA:
            path += "Aisha/";
            break;

        case eFairy.BLOOM:
            path += "Bloom/";
            break;

        case eFairy.FLORA:
            path += "Flora/";
            break;

        case eFairy.MUSA:
            path += "Musa/";
            break;

        case eFairy.STELLA:
            path += "Stella/";
            break;

        case eFairy.TECNA:
            path += "Tecna/";
            break;
        }

        var projectile = "pfbSpell" + fairy + level.ToString("00");

        var prefab = Resources.Load(path + projectile);

        if (prefab != null)
        {
            return(prefab);
        }

        Debug.Log("Spell prefab not found in resources");
        return(null);
    }
Пример #11
0
    //==================================================================

    public static string GetClothingDefaultItem(eFairy fairy)
    {
        if (!isItemListLoaded)
        {
            LoadItemsList();
        }

        foreach (ClothingItemData item in itemList)
        {
            if (fairy == item.fairy)
            {
                if (item.isDefault)
                {
                    return(item.id);
                }
            }
        }

        return(null);
    }
Пример #12
0
    //=============================================================================

    public void ShowPanel(bool bActive, bool bIsOutfit = false, eFairy Fairy = eFairy.BLOOM, int Cost = 0)
    {
        if (bActive)
        {
            m_bButtonPressed = false;
            m_MainPanel.SetActive(true);

            if (bIsOutfit)
            {
                m_txtHeader.text = TextManager.GetText("BOUTIQUE_PURCHASE_TITLE_OUTFIT");
                m_txtDesc.text   = TextManager.GetText("BOUTIQUE_PURCHASE_DESC_OUTFIT");

                m_sprPurchaseOverlayGems.SetActive(false);
                m_sprPurchaseOverlayDiamonds.SetActive(true);
            }
            else
            {
                string txtHeader = TextManager.GetText("BOUTIQUE_PURCHASE_TITLE_FAIRY");
                txtHeader        = txtHeader.Replace("(FairyName)", Fairy.ToString().ToUpper());
                m_txtHeader.text = txtHeader;

                string txtDesc = TextManager.GetText("BOUTIQUE_PURCHASE_DESC_FAIRY");
                txtDesc        = txtDesc.Replace("(FairyName)", Fairy.ToString());
                m_txtDesc.text = txtDesc;

                m_sprPurchaseOverlayGems.SetActive(true);
                m_sprPurchaseOverlayDiamonds.SetActive(false);
            }

            string txtCost = TextManager.GetText("BOUTIQUE_PURCHASE");
            txtCost                = txtCost.Replace("(Cost)", String.Format("{0:n0}", Cost));
            m_txtCostGems.text     = txtCost;
            m_txtCostDiamonds.text = txtCost;
        }
        else
        {
            m_MainPanel.SetActive(false);
        }
    }
Пример #13
0
    //==================================================================

    public static List <ClothingItemData> GetClothingItems(eFairy fairy)
    {
        List <ClothingItemData> CurClothingList = new List <ClothingItemData>();

        if (!isItemListLoaded)
        {
            LoadItemsList();
        }

        foreach (ClothingItemData item in itemList)
        {
            if (fairy == item.fairy)
            {
                if (item.state != eClothingState.HIDDEN)
                {
                    CurClothingList.Add(item);
                }
            }
        }

        return(CurClothingList);
    }
Пример #14
0
    //private	int					m_LastItemOffsetRendered;

    //=====================================================

    void Awake()
    {
        instance       = this;
        m_CurrentFairy = eFairy.BLOOM;
    }
Пример #15
0
    //=====================================================

    void UpdateSelectedFairy(string PreviewOutfitID = null)
    {
        if (m_CurrentFairyObj != null)
        {
            GameObject.Destroy(m_CurrentFairyObj);
            m_CurrentFairyObj = null;
        }

        string path = "Fairies/";

        switch ((eFairy)m_CurrentFairyIndex)
        {
        case eFairy.BLOOM:
            path += "Bloom/Prefabs/";
            break;

        case eFairy.STELLA:
            path += "Stella/Prefabs/";
            break;

        case eFairy.FLORA:
            path += "Flora/Prefabs/";
            break;

        case eFairy.MUSA:
            path += "Musa/Prefabs/";
            break;

        case eFairy.TECNA:
            path += "Tecna/Prefabs/";
            break;

        case eFairy.AISHA:
            path += "Aisha/Prefabs/";
            break;
        }

        // Fairy owned?
        eFairy CurFairyType = (eFairy)m_CurrentFairyIndex;

        RackScroller.instance.SetCurrentFairy(CurFairyType);
        RackRenderer.instance.SetCurrentFairy(CurFairyType);
        RackRenderer.instance.MarkDirty();

        FairyData CurFairy = GameDataManager.Instance.GetFairyData(CurFairyType);

        if (CurFairy == null)
        {
            // Not owned, show default outfit (unless we have an override)
            string DefaultItem = ClothingItemsManager.GetClothingDefaultItem((eFairy)m_CurrentFairyIndex);

            if (PreviewOutfitID != null)
            {
                DefaultItem = PreviewOutfitID;
            }

            if (!String.IsNullOrEmpty(DefaultItem))
            {
                path += ClothingItemsManager.GetClothingItem(DefaultItem).prefabName;
            }
        }
        else
        {
            // Owned, show current outfit
            string CurrentOutfit = CurFairy.Outfit;
            if (PreviewOutfitID != null)
            {
                CurrentOutfit = PreviewOutfitID;
            }

            if (!String.IsNullOrEmpty(CurrentOutfit))
            {
                ClothingItemData itemData = ClothingItemsManager.GetClothingItem(CurrentOutfit);
                if (itemData == null)
                {
                    // Not owned, show default outfit (unless we have an override)
                    string DefaultItem = ClothingItemsManager.GetClothingDefaultItem((eFairy)m_CurrentFairyIndex);

                    if (PreviewOutfitID != null)
                    {
                        DefaultItem = PreviewOutfitID;
                    }

                    if (!String.IsNullOrEmpty(DefaultItem))
                    {
                        path += ClothingItemsManager.GetClothingItem(DefaultItem).prefabName;
                    }
                }
                else
                {
                    path += itemData.prefabName;
                }
            }
        }

        // Load prefab
        GameObject prefab = Resources.Load(path.ToString()) as GameObject;

        if (prefab == null)
        {
        }

        if (prefab != null)
        {
            m_CurrentFairyObj = Instantiate(prefab) as GameObject;
            m_CurrentFairyObj.transform.parent           = m_FairyPosition.transform;
            m_CurrentFairyObj.transform.localPosition    = new Vector3(0.0f, 0.0f, 0.0f);
            m_CurrentFairyObj.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
        }
    }
Пример #16
0
 public FairyItemData()
 {
     fairy = eFairy.BLOOM;
 }
Пример #17
0
    //=====================================================

    public void SetCurrentFairy(eFairy Fairy)
    {
        m_CurrentFairy = Fairy;
    }
    //=====================================================

    public void ShowBubble(eDoorType doorType, int numKeysRequired, eFairy fairyRequired)
    {
        if (_isEnabled == true)
        {
            return;
        }

        var showBubble = false;

        if (_icon != null && _text != null)
        {
            if (numKeysRequired > 0)
            {
                // Num keys
                _icon.sprite = _spriteIcons[_spriteIcons.Length - 3];
                _text.text   = TextManager.GetText("DOOR_INTERACT_KEY") + " " + numKeysRequired + " :";
                showBubble   = true;
            }
            else if (fairyRequired != eFairy.NULL)
            {
                // Fairy
                _icon.sprite = _spriteIcons[(int)fairyRequired];
                _text.text   = TextManager.GetText("DOOR_INTERACT_FAIRY") + " :";
                showBubble   = true;
            }
            else
            {
                switch (doorType)
                {
                case eDoorType.BOSS:
                    _icon.sprite = _spriteIcons[_spriteIcons.Length - 1];
                    _text.text   = TextManager.GetText("DOOR_INTERACT_BOSS") + " " + (int)eFairy.NUM_FAIRIES + " :";
                    showBubble   = true;
                    break;

                default:
                    // Lever / switch / pushable block
                    _icon.sprite = _spriteIcons[_spriteIcons.Length - 2];
                    _text.text   = TextManager.GetText("DOOR_INTERACT_SWITCH") + " :";
                    showBubble   = true;
                    break;
                }
            }
        }

        if (showBubble == false)
        {
            return;
        }

        _isEnabled = true;

        if (_animator != null && _animator.GetBool(HashIDs.IsEnabled) == false)
        {
            _animator.SetBool(HashIDs.IsEnabled, true);
        }

        StartCoroutine(AutoHideBubble());

        // Face bubble towards player-camera
        if (_billboardController != null)
        {
            _billboardController.enabled = true;
        }
    }