Пример #1
0
    public void CollectItems(XmlSettings.IapConfig iap)
    {
        ShopButton    shopButton    = null;
        CommonCoinPod commonCoinPod = null;
        MonoBehaviour monoBehaviour = null;
        Transform     transform     = null;

        if (ELSingleton <MenuWindow> .Instance.isActiveAndEnabled)
        {
            shopButton    = ELSingleton <MenuWindow> .Instance.shopButton;
            commonCoinPod = ELSingleton <MenuWindow> .Instance.coinPod;
            monoBehaviour = ELSingleton <MenuWindow> .Instance;
            transform     = ELSingleton <MenuWindow> .Instance.coinTarget.transform;
        }
        if (ELSingleton <GameWindow> .Instance.isActiveAndEnabled)
        {
            shopButton    = ELSingleton <GameWindow> .Instance.shopButton;
            commonCoinPod = ELSingleton <GameWindow> .Instance.coinPod;
            monoBehaviour = ELSingleton <GameWindow> .Instance;
            transform     = ELSingleton <GameWindow> .Instance.hintBar.transform;
        }
        if (ELSingleton <PackWindow> .Instance.isActiveAndEnabled)
        {
            shopButton    = ELSingleton <PackWindow> .Instance.shopButton;
            commonCoinPod = ELSingleton <PackWindow> .Instance.coinPod;
            monoBehaviour = ELSingleton <PackWindow> .Instance;
            transform     = ELSingleton <PackWindow> .Instance.coinTarget.transform;
        }
        if (shopButton != null && commonCoinPod != null)
        {
            if (iap.coins > 0)
            {
                shopButton.UpdateCoins(-iap.coins);
                commonCoinPod.ReleaseCoinsRadial(50, ELSingleton <MenuWindow> .Instance.transform.position, ELSingleton <MenuWindow> .Instance.coinTarget.transform.position, 1f, 2.2f, 2.2f, 0.5f, aIsFullUpdate: true, aIsWithParticles: false);
            }
            int num = Math.Sign(iap.expose) + Math.Sign(iap.goodStart) + Math.Sign(iap.startFinish) + Math.Sign(iap.tip);
            num = 30 / (num + 1);
            commonCoinPod.ReleaseCoinsRadialCustomImage(imageExpose, Math.Min(num, iap.expose), monoBehaviour.transform.position, transform.position, 1f, 0.9f, 0.9f, 0f);
            commonCoinPod.ReleaseCoinsRadialCustomImage(imageGoodStart, Math.Min(num, iap.goodStart), monoBehaviour.transform.position, transform.position, 1f, 0.9f, 0.9f, 0f);
            commonCoinPod.ReleaseCoinsRadialCustomImage(imageTip, Math.Min(num, iap.tip), monoBehaviour.transform.position, transform.position, 1f, 0.9f, 0.9f, 0f);
            commonCoinPod.ReleaseCoinsRadialCustomImage(imageStartFinish, Math.Min(num, iap.startFinish), monoBehaviour.transform.position, transform.position, 1f, 0.9f, 0.9f, 0f);
        }
    }
Пример #2
0
    public void ShowWindow(LevelInfo aLevelInfo, AnimationState state = AnimationState.ANIMATION_STATE_NONE)
    {
        CancelInvoke();
        ShowWindow();
        UpdateAnimation(state);
        shopButton.Reset();
        foreach (Transform item in content.transform)
        {
            item.gameObject.SetActive(value: false);
            UnityEngine.Object.Destroy(item.gameObject);
        }
        packItemList = new List <PackItem>();
        int   num  = 0;
        float num2 = 0f;

        for (int i = 0; i < ELSingleton <LevelsSettings> .Instance.levelSet.worlds.Count; i++)
        {
            for (int j = 0; j < ELSingleton <LevelsSettings> .Instance.levelSet.worlds[i].packs.Count; j++)
            {
                aLevelInfo.currentWorld = i;
                aLevelInfo.currentPack  = j;
                PackItem packItem = Object.Instantiate(packItemPrefab, content.transform);
                num2 = Mathf.Max(packItem.Prepare(aLevelInfo, num, state), num2);
                if (packItem.IsUnlocked || ELSingleton <ApplicationSettings> .Instance.DeploymentSettings.isCheatsEnabled)
                {
                    packItem.OnFocus.AddListener(delegate
                    {
                        Focus(aLevelInfo);
                    });
                }
                packItemList.Add(packItem);
                num++;
            }
        }
        float         y         = UpdateLayout() + 850f;
        RectTransform component = content.GetComponent <RectTransform>();

        component.sizeDelta = new Vector2(component.sizeDelta.x, y);
        scrollRect.verticalNormalizedPosition = 0f;
        lastPackCompleted = true;
        for (int k = 0; k < packItemList.Count; k++)
        {
            PackItem packItem2 = packItemList[k];
            if (packItem2.IsCurrent)
            {
                if (k > 0)
                {
                    packToComplete = packItemList[k - 1];
                }
                packToUnlock = packItem2;
                scrollRect.verticalNormalizedPosition = packItem2.normalizedScrollLocation;
                if (state == AnimationState.ANIMATION_STATE_PACK_WAIT)
                {
                    scrollRect.verticalNormalizedPosition = packToComplete.normalizedScrollLocation;
                }
                lastPackCompleted = false;
            }
        }
        if (state == AnimationState.ANIMATION_STATE_PACK_WAIT)
        {
            shopButton.UpdateCoins(-ELSingleton <XmlSettings> .Instance.coinsConfig.pack);
            Invoke("AnimationWellDoneInvoke", num2 + 0.5f);
            Invoke("AnimationWellDoneInvokeSfx", num2 + 0.4f);
        }
        if (state == AnimationState.ANIMATION_STATE_NONE && lastPackCompleted)
        {
            packItemList[packItemList.Count - 1].OpenAfterComplete();
        }
        float num3 = 0f;

        Component[] componentsInChildren = base.gameObject.GetComponentsInChildren <CommonButton>();
        componentsInChildren = componentsInChildren;
        for (int l = 0; l < componentsInChildren.Length; l++)
        {
            ((CommonButton)componentsInChildren[l]).Show(num3);
            num3 += 0.1f;
        }
        Screen.sleepTimeout = -2;
    }