Exemple #1
0
    public bool BuyTheme(string name, Param.CostType cType, int cost) // 테마 구매 프로세스
    {
        bool buy = false;

        if (GetUserSingleTone().m_ownTheme.Contains(name) == false)// 보유하지 않은 테마라면
        {
            if (cType == Param.CostType.crystal)
            {
                if (GetUserSingleTone().m_crystalCount >= cost)
                {
                    GetUserSingleTone().m_crystalCount -= cost;
                    GetThemeMenu().UpdateLeftCrystal(GetUserSingleTone().m_crystalCount); // UI Update
                    buy = true;
                }
                else
                {
                    //잔고 부족 충전제안.
                    Debug.Log("크리스탈 부족");
                }
            }
            else if (cType == Param.CostType.heart)
            {
                if (GetUserSingleTone().m_heartCount >= cost)
                {
                    GetUserSingleTone().m_heartCount -= cost;
                    GetThemeMenu().UpdateLeftHeart(GetUserSingleTone().m_heartCount); // UI Update
                    buy = true;
                }
                else
                {
                    //잔고 부족 충전제안.
                    Debug.Log("재화 부족");
                }
            }
        }

        if (buy)
        {
            GetUserSingleTone().m_ownTheme.Add(name); // 테마 추가
            GetThemeMenu().UpdateFocusedMenuItem();
            PrefSave();
        }
        return(buy);
    }
Exemple #2
0
    public bool BuyStage(string name, Param.CostType cType, int cost) // 스테이지 구매 프로세스
    {
        bool buy = false;

        if (GetUserSingleTone().m_edtStage.ContainsKey(name) == false)
        {
            if (cType == Param.CostType.crystal)
            {
                if (GetUserSingleTone().m_crystalCount >= cost)
                {
                    GetUserSingleTone().m_crystalCount -= cost;
                    GetStageMenu().UpdateLeftCrystal(GetUserSingleTone().m_crystalCount); // UI Update
                    buy = true;
                }
            }
            else if (cType == Param.CostType.heart)
            {
                if (GetUserSingleTone().m_heartCount >= cost)
                {
                    GetUserSingleTone().m_heartCount -= cost;
                    GetStageMenu().UpdateLeftHeart(GetUserSingleTone().m_heartCount); // UI Update
                    buy = true;
                }
                else
                {
                    //잔고 부족 충전제안.
                    Debug.Log("하트 부족");
                }
            }
        }
        // 위 로직 공통으로 묶기
        if (buy)
        {
            GetUserSingleTone().m_edtStage.Add(name, new Stage(name, false, 0, 0)); // 스테이  추가
            GetStageMenu().UpdateFocusedMenuItem();
            PrefSave();
        }
        return(buy);
    }