Esempio n. 1
0
        public void TryUnlock()
        {
            if (CocoMainController.AdsControl.IsRVRequesting)
            {
                return;
            }

            Debug.LogError("TryUnlock m_LabelState is : " + m_LabelState);
            switch (m_LabelState)
            {
            case LabelState.GetFree:
#if !NO_FLURRY
                var param = string.IsNullOrEmpty(m_StateData.flurryKey) ? m_StateData.itemId : m_StateData.flurryKey;
                CocoFlurry.LogEvent("Video_Available_Clicked", "Clicks", param);
#endif
//				CocoMainController.AdsControl.RequesetRV (this);
                break;

            case LabelState.Level:
            case LabelState.Lock:
                #if ABTEST
                switch (globalRecordModel.CurGPType)
                {
                case GPType.Test_B:
                    storeControl.Buy(CocoStoreID.FullVersion_B);
                    break;

                default:
                    CocoMainController.Instance.ShowMiniStorePopup(m_StateData.storeProductId);
                    break;
                }
                #else
//				if (GlobalData.IAPButtonShowMainStore(m_StateData.storeProductId))
//				{
//					CocoMainController.Instance.ShowMainStorePopup(transform.position, CocoStoreID.None);
//				}
//				else
//				{
//					CocoMainController.Instance.ShowMiniStorePopup(m_StateData.storeProductId);
//				}
                #endif
                break;
            }
        }
Esempio n. 2
0
        protected virtual LabelState GetLabelState()
        {
            // check purchase state
            if (m_StateModel != null)
            {
                bool purchased = m_StateModel.IsItemPurchased(m_StateData.itemId);
                if (purchased)
                {
                    return(LabelState.None);
                }
            }

            // check in unlock state
            if (m_StateData.lockType == CocoLockType.Non ||             // non-lock
                storeControl.IsPurchased(m_StateData.storeProductId))   // product purchased in store
            {
                return(m_StateData.price <= 0 ? LabelState.None : LabelState.Price);
            }

            if (m_StateModel != null && m_StateModel.IsTempUnlocked(m_StateData.itemId))                // temp unlock
            {
                return((m_StateData.price <= 0 || m_StateData.tempUnlockAsPurchased) ? LabelState.None : LabelState.Price);
            }

            if (m_StateData.lockType == CocoLockType.Level)
            {
                return(GetGameLevel() >= m_StateData.level ? LabelState.None : LabelState.Level);
            }

            // set in lock state
            if (m_StateData.lockType == CocoLockType.RV)
            {
                bool NoAds;
                                #if ABTEST
                switch (globalRecordModel.CurGPType)
                {
                case GPType.Test_A:
                    NoAds = storeControl.IsPurchased(CocoStoreID.NoAds_A);
                    break;

                case GPType.Test_B:
                    NoAds = storeControl.IsPurchased(CocoStoreID.NoAds_B);
                    break;

                default:
                    NoAds = storeControl.IsPurchased(CocoStoreID.NoAds);
                    break;
                }
                                #else
                NoAds = storeControl.IsPurchased(CocoStoreID.NoAds);
                                #endif
                if (NoAds)
                {
                    // no ads purchased
                    return(LabelState.Lock);
                }
                else if (CocoMainController.AdsControl.RVReady)
                {
                    // rv ready
#if !NO_FLURRY
                    CocoFlurry.LogEvent("Video_Available_Impression", "Impression", FlurryKey);
#endif
                    return(LabelState.GetFree);
                }
                else
                {
#if !NO_FLURRY
                    CocoFlurry.LogEvent("Video_NOT_Available_Impression", "Impression", FlurryKey);
#endif
                }
            }

            return(LabelState.Lock);
        }