示例#1
0
    public void Gacha()
    {
        if (GameData.Instance.m_Coin < GACHA_COST)
        {
            return;
        }

        GameData.Instance.m_Coin -= GACHA_COST;
        int itemReceived = Random.Range((int)GemLibrary.GemSet.GEM, (int)GemLibrary.GemSet.TOTAL);

        GemLibrary.GemSet gemType = (GemLibrary.GemSet)itemReceived;
        GameData.Instance.UnlockGem(gemType);
        //SaveLoad.Save();
        SaveDataLoader.SaveGame();

        m_ReceiveText.GetComponent <Text>().text = "Received " + GemLibrary.Instance.GemsSetList[itemReceived].m_sGemContainerSetName + "!";

        m_GachaAnimator.OnAfterAnimation = AfterGacha;
        m_GachaAnimator.StartGachaAnimation(gemType);
        m_GachaButton.SetActive(false);
        m_BackButton.SetActive(false);

        m_ReceivePosition = m_ReceiveText.transform.localPosition;
        m_ReceiveText.transform.parent = null;

        m_BackPosition = m_BackButton.transform.localPosition;
        m_BackButton.transform.parent = null;
    }
示例#2
0
    public void ProcessPurchase(string productIdentifier)
    {
        if (m_ProductParamMap.ContainsKey(productIdentifier))
        {
            ProductParam productParam = m_ProductParamMap[productIdentifier];

            switch (productParam.m_ProductType)
            {
            case InAppProductList.ProductType.COIN:
                GameData.Instance.m_Coin += productParam.m_nProductParam;
                Debug.Log(string.Format("InAppProcessor::ProcessPurchase: PASS. Product: '{0}'", productIdentifier));

                // @todo Some feedback
                break;

            case InAppProductList.ProductType.AVATAR:
                GemLibrary.GemSet gemType = (GemLibrary.GemSet)productParam.m_nProductParam;

                /*
                 * if ( !GameData.Instance.m_Sets.Contains( gemType ) )
                 * {
                 *      GameData.Instance.m_Sets.Add( gemType );
                 *      GameData.Instance.m_GemList.Add( gemType );
                 * }
                 */
                GameData.Instance.UnlockGem(gemType);

                Debug.Log(string.Format("InAppProcessor::ProcessPurchase: PASS. Product: '{0}'", productIdentifier));

                // Enable item screen controls
                GameObject  shopManager = GameObject.FindGameObjectWithTag("Shop Manager");
                ShopManager sm          = shopManager.GetComponent <ShopManager>();
                sm.EnableItemScreenControl(true);

                // Some feedback
                //GemLibrary gemLibrary = GameObject.Find( "Gem Library" ).GetComponent<GemLibrary>();
                GemLibrary      gemLibrary = GemLibrary.Instance;
                GemContainerSet gemSet     = gemLibrary.GemsSetList[productParam.m_nProductParam];

                GameObject explosion = ( GameObject )Instantiate(gemSet.m_Explosion, sm.GetCurrentItemIcon().transform.position, Quaternion.identity);
                explosion.layer = LayerMask.NameToLayer("UI Particles");
                ParticleSystem ps = explosion.GetComponent <ParticleSystem>();
                ps.GetComponent <Renderer>().sortingLayerName = "UI Particles";
                ps.GetComponent <Renderer>().sortingOrder     = LayerMask.NameToLayer("UI Particles");
                Destroy(explosion, ps.duration + ps.startLifetime + Time.deltaTime);

                break;

            default:
                Debug.Log(string.Format("InAppProcessor::ProcessPurchase: FAIL. Invalid product type: '{0}'", productParam.m_ProductType.ToString()));
                return;
            }

            SaveLoad.Save();
        }
        else
        {
            Debug.Log(string.Format("InAppProcessor::ProcessPurchase: FAIL. Unrecognized product: '{0}'", productIdentifier));
        }
    }
示例#3
0
    public GameData()
    {
        m_HighScore               = 0;
        m_HighestCombo            = 0;
        m_MultiplayerHighScore    = 0;
        m_MultiplayerHighestCombo = 0;
        m_Coin           = 0;
        m_EquippedGemSet = GemLibrary.GemSet.GEM;
        m_GemList        = new List <GemLibrary.GemSet>();
        m_Sets           = new HashSet <GemLibrary.GemSet>();
        m_SeenTutorial   = false;

        m_Boost_ScoreMultOnce  = false;
        m_Boost_GoldMultOnce   = false;
        m_Boost_MoreHealthOnce = false;

        m_Boost_ScoreMult  = 0;
        m_Boost_GoldMult   = 0;
        m_Boost_Shield     = 0;
        m_Boost_SlowerGems = 0;
        m_Boost_BiggerGems = 0;

        m_vol_BGM    = 50;
        m_vol_SFX    = 40;
        m_CanVibrate = true;

        m_curr_TotalGamesPlayed = 0;
        m_next_TotalGamesPlayed = 0;
        m_curr_TotalCoinsEarned = 0;
        m_next_TotalCoinsEarned = 0;
        m_curr_TotalScoreEarned = 0;
        m_next_TotalScoreEarned = 0;

        m_curr_TotalLinkedGems_R = 0;
        m_next_TotalLinkedGems_R = 0;
        m_curr_TotalLinkedGems_B = 0;
        m_next_TotalLinkedGems_B = 0;
        m_curr_TotalLinkedGems_G = 0;
        m_next_TotalLinkedGems_G = 0;
        m_curr_TotalLinkedGems_Y = 0;
        m_next_TotalLinkedGems_Y = 0;

        m_next_MaxCombo           = 0;
        m_next_PerGameCoinsEarned = 0;
        m_next_PerGameScoreEarned = 0;

        m_RecoverToPerfectFromRed = 0;
        m_next_LinkGemsInOneChain = 0;

        m_bUnlock_Games      = true;
        m_bUnlock_Share_FB   = true;
        m_bUnlock_EarnPoints = true;

        m_uUnlock_GamesCount      = 5;
        m_uUnlock_Share_FBCount   = 1;
        m_uUnlock_EarnPointsCount = 20000;

        m_bIsAdsRemoved = false;
    }
示例#4
0
 public void UnlockGem(GemLibrary.GemSet gemType)
 {
     if (!m_Sets.Contains(gemType))
     {
         m_Sets.Add(gemType);
         m_GemList.Add(gemType);
     }
 }
示例#5
0
 public GameData()
 {
     m_HighScore               = 0;
     m_HighestCombo            = 0;
     m_MultiplayerHighScore    = 0;
     m_MultiplayerHighestCombo = 0;
     m_Coin           = 0;
     m_EquippedGemSet = GemLibrary.GemSet.GEM;
     m_GemList        = new List <GemLibrary.GemSet>();
     m_Sets           = new HashSet <GemLibrary.GemSet>();
 }
示例#6
0
    // Equip (Set gem set)
    public bool EquipGemSet(GemLibrary.GemSet gemSet)
    {
        m_GemSet = m_GemLibrary.GemsSetList[(int)gemSet];
        if (GameData.Instance.m_Sets.Contains(gemSet))
        {
            GameData.Instance.m_EquippedGemSet = gemSet;
            SaveLoad.Save();
            return(true);
        }

        return(false);
    }
示例#7
0
 public void SetEntry(GemLibrary.GemSet type_)
 {
     m_Type = type_;
     m_Image.GetComponent <Image>().sprite = m_Icons[(int)m_Type];
     m_Title.GetComponent <Text>().text    = GemLibrary.Instance.GemsSetList[(int)m_Type].m_sGemContainerSetName;
     m_Desc.GetComponent <Text>().text     = GemLibrary.Instance.GemsSetList[(int)m_Type].m_Desc;
     m_Cost.GetComponent <Text>().text     = (COST != 0) ? COST.ToString() : "";
     SetButtonText();
     m_Overlay.SetActive(false);
     m_OverlayText.SetActive(false);
     m_OverlayLock.SetActive(false);
     m_bCost = COST;
 }
示例#8
0
    public void StartGachaAnimation(GemLibrary.GemSet gemType)
    {
        m_GemType        = gemType;
        m_AnimationPhase = (int)GachaAnimationPhase.THROW_COIN;

        m_Coin.transform.localPosition = m_CoinStartPos;
        m_Coin.SetActive(true);
        m_AnimationTimer = 0.0f;

        if (m_CurrentItemLight != null)
        {
            Destroy(m_CurrentItemLight);
            m_CurrentItemLight = null;
        }

        if (m_CurrentItem != null)
        {
            Destroy(m_CurrentItem);
            m_CurrentItem = null;
        }
    }
示例#9
0
    public void ChangeEquippedSprite(GemLibrary.GemSet gemType)
    {
        SpriteRenderer sr = m_Equipped.GetComponent <SpriteRenderer>();

        sr.sprite = m_GemLibrary.GemsSetList[(int)gemType].GetGemContainer(GemContainerSet.BLUE_GEM_CONTAINER_INDEX)[0];
    }
示例#10
0
    void InitialiseShopList()
    {
        // @debug variables
        for (int i = 0; i < 20; ++i)
        {
            // @debug
            int nIndex = i % 2;
            GemLibrary.GemSet gemType = (GemLibrary.GemSet)nIndex;

            GameObject itemIcon = (GameObject)Instantiate(m_ItemPrefab, m_ItemIconStartPos, Quaternion.identity);
            Button     button   = itemIcon.GetComponent <Button>();
            button.image.sprite = m_GemLibrary.GemsSetList[nIndex].GetGemContainer(GemContainerSet.BLUE_GEM_CONTAINER_INDEX)[0];

            Text label = itemIcon.GetComponentInChildren <Text>();
            label.text = m_GemLibrary.GemsSetList[nIndex].m_sGemContainerSetName;

            ItemIcon ic = itemIcon.GetComponent <ItemIcon>();
            ic.m_ItemType = gemType;

            itemIcon.transform.GetChild(2).gameObject.SetActive(false);

            // Hide lock if unlocked
            if (GameData.Instance.m_Sets.Contains(gemType))
            {
                itemIcon.transform.GetChild(1).gameObject.SetActive(false);
                ic.m_bLocked = false;
            }
            else
            {
                Color c = label.color;
                c.a         = 0.5f;
                label.color = c;

                ic.m_bLocked = true;

                string productIdentifier = InAppProductList.GetProductIdentifier(InAppProductList.ProductType.AVATAR, nIndex);
                if (InAppProductList.Instance.NonConsumableList.ContainsKey(productIdentifier))
                {
                    InAppProductList.ProductInfo product = InAppProductList.Instance.NonConsumableList[productIdentifier];

                    GameObject priceTag  = itemIcon.transform.GetChild(2).gameObject;
                    Text       priceText = priceTag.GetComponent <Text>();
                    priceText.text = product.m_sPrice;
                }
            }

            m_ItemIcons.Add(itemIcon);
        }

        // @todo Resize Item Prefab for new art assets
        // Resize base on item count
        Vector2 dimension = m_ItemContentTransform.sizeDelta;

        dimension.x += (m_fItemIconWidth + ITEM_PAD) * (m_ItemIcons.Count - 1);
        m_ItemContentTransform.sizeDelta = dimension;

        // Add item icons to content

        for (int i = 0; i < m_ItemIcons.Count; ++i)
        {
            GameObject    itemIcon          = m_ItemIcons[i];
            RectTransform itemIconTransform = itemIcon.GetComponent <RectTransform>();
            itemIconTransform.SetParent(m_ItemContentTransform);

            Vector3 pos = itemIconTransform.localPosition;
            pos.x = m_ItemIconStartPos.x + i * (ITEM_PAD + m_fItemIconWidth);
            pos.y = m_ItemIconStartPos.y;
            pos.z = m_ItemIconStartPos.z;
            itemIconTransform.localPosition = pos;
            itemIconTransform.localScale    = Vector3.one;

            SetItemIconEnable(itemIcon, i == 0);
        }

        m_ItemPrefab.SetActive(false);

        // @todo set scroll to equipped
        // @todo back button in item screen will scroll to equipped as well
    }
示例#11
0
 public void UpdateEntryBarGem(GemLibrary.GemSet type_)
 {
     m_lViewer[(int)type_ + 1].GetComponent <SkinEntry>().SetEntry(type_);
 }