Beispiel #1
0
    private IEnumerator FadeElementOut(RectOpacityContainer element, float delay, float duration)
    {
        yield return(new WaitForSecondsRealtime(delay));

        for (float t = 0f; t < duration; t += Time.unscaledDeltaTime)
        {
            if (element.images != null && element.images.Length != 0)
            {
                Image[] images = element.images;
                for (int i = 0; i < images.Length; i++)
                {
                    images[i].color = new Color(1f, 1f, 1f, Mathf.Lerp(1f, 0f, t / duration));
                }
            }
            if (element.text != null)
            {
                element.text.color = new Color(1f, 1f, 1f, Mathf.Lerp(1f, 0f, t / duration));
            }
            yield return(null);
        }
        if (element.images != null && element.images.Length != 0)
        {
            Image[] images = element.images;
            for (int i = 0; i < images.Length; i++)
            {
                images[i].color = new Color(1f, 1f, 1f, 0f);
            }
        }
        if (element.text != null)
        {
            element.text.color = new Color(1f, 1f, 1f, 0f);
        }
    }
Beispiel #2
0
 public void UpdatePlayMenu(bool updateChests = true)
 {
     //play1V1Button.scoreText.text = PlayerDataManager.GetRating().ToString();
     //play2V2Button.scoreText.text = PlayerDataManager.GetRating(GameMode.Arena2v2).ToString();
     playAdventureButton.scoreText.text = PlayerDataManager.GetLeaderboardScore(LeaderboardID.Adventure).ToString();
     if (!HaveStarsToAdd())
     {
         for (int i = 0; i < adventureThemeLogos.Length; i++)
         {
             adventureThemeLogos[i].SetActive(i == PlayerDataManager.GetSelectedLevel(GameMode.Adventure));
             adventureThemeLogos[i].GetComponent <RectTransform>().localScale = Vector3.one;
             adventureThemeLogos[i].GetComponent <TextMeshProUGUI>().color    = Color.white;
         }
         RectOpacityContainer[] adventureButtonElements = GetAdventureButtonElements();
         for (int j = 1; j != adventureButtonElements.Length; j++)
         {
             RectOpacityContainer rectOpacityContainer = adventureButtonElements[j];
             rectOpacityContainer.rect.localScale = Vector3.one;
             if (rectOpacityContainer.text != null)
             {
                 rectOpacityContainer.text.color = Color.white;
             }
             if (rectOpacityContainer.images != null && rectOpacityContainer.images.Length != 0)
             {
                 Image[] images = rectOpacityContainer.images;
                 for (int k = 0; k < images.Length; k++)
                 {
                     images[k].color = Color.white;
                 }
             }
         }
     }
     if (updateChests)
     {
         pvpChest.button.image.sprite = PlayerDataManager.GetNextChest(ChestProgressionType.Pvp).sprite;
         int chestProgress     = PlayerDataManager.GetChestProgress(ChestProgressionType.Pvp);
         int chestPointsNeeded = Variables.instance.GetChestPointsNeeded(ChestProgressionType.Pvp);
         pvpChest.progressText.Init(chestProgress, chestPointsNeeded);
         pvpChest.SetProgress((float)chestProgress / (float)chestPointsNeeded);
         adventureChest.button.image.sprite = PlayerDataManager.GetNextChest(ChestProgressionType.Adventure).sprite;
         chestProgress     = PlayerDataManager.GetChestProgress(ChestProgressionType.Adventure);
         chestPointsNeeded = Variables.instance.GetChestPointsNeeded(ChestProgressionType.Adventure);
         adventureChest.progressText.Init(chestProgress, chestPointsNeeded);
         adventureChest.SetProgress((float)chestProgress / (float)chestPointsNeeded);
     }
 }
Beispiel #3
0
    private IEnumerator AnimateFadeMapChange()
    {
        RectOpacityContainer[] elements = GetAdventureButtonElements();
        float[] audioDelays             = new float[3]
        {
            0.16f,
            0.2f,
            0.15f
        };
        float scale = 2f;

        for (int j = 0; j != elements.Length; j++)
        {
            RectOpacityContainer rectOpacityContainer = elements[j];
            rectOpacityContainer.rect.localScale = Vector3.one * scale;
            if (rectOpacityContainer.text != null)
            {
                rectOpacityContainer.text.color = new Color(1f, 1f, 1f, 0f);
                rectOpacityContainer.text.gameObject.SetActive(value: true);
            }
            if (rectOpacityContainer.images != null && rectOpacityContainer.images.Length != 0)
            {
                Image[] images = rectOpacityContainer.images;
                foreach (Image obj in images)
                {
                    obj.color = new Color(1f, 1f, 1f, 0f);
                    obj.gameObject.SetActive(value: true);
                }
            }
            rectOpacityContainer.rect.gameObject.SetActive(value: true);
        }
        int k;

        for (int i = 0; i != elements.Length; i = k)
        {
            RectOpacityContainer ele = elements[i];
            float time = 0f;
            AudioMap.PlayClipAt(AudioMap.instance.logoHit[i], Vector3.zero, AudioMap.instance.uiMixerGroup, audioDelays[i]);
            for (; time < 0.35f; time += Time.deltaTime)
            {
                float num = time / 0.35f;
                ele.rect.localScale = Vector3.Lerp(Vector3.one * scale, Vector3.one, LeanTween.easeInCubic(0f, 1f, num));
                if (ele.text != null)
                {
                    ele.text.color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 1f, num));
                }
                if (ele.images != null && ele.images.Length != 0)
                {
                    Image[] images = ele.images;
                    for (k = 0; k < images.Length; k++)
                    {
                        images[k].color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 1f, num));
                    }
                }
                yield return(null);
            }
            ele.rect.localScale = Vector3.one;
            cameraShake        += new Vector2(UnityEngine.Random.value - 0.5f, UnityEngine.Random.value - 0.5f) * 10f;
            yield return(new WaitForSeconds(0.1f));

            k = i + 1;
        }
    }