예제 #1
0
        void Awake()
        {
            SelectedIndex = -1;
            UIButtons     = GetComponentsInChildren <UIButton>();
            foreach (UIButton uiButton in UIButtons)
            {
                UIButton bt = uiButton;
                bt.Bt.onClick.AddListener(() => OnClick(bt));
            }

            switch (CategoryType)
            {
            case PlayerCreationUI.CategoryType.Color:
                // Set colors
                for (int i = 0; i < UIButtons.Length; ++i)
                {
                    UIButton bt    = UIButtons[i];
                    Color    color = PlayerTintConverter.ToColor((PlayerTint)(i + 1));
                    bt.ChangeDefaultColors(color, color);
                }
                break;

            case PlayerCreationUI.CategoryType.Age:
                _ageAppearanceTween = DOTween.Sequence().SetAutoKill(false).Pause();
                for (int i = 0; i < UIButtons.Length; ++i)
                {
                    _ageAppearanceTween.Insert(i * 0.1f, UIButtons[i].CGroup.DOFade(0, 0.4f).From());
                }
                break;
            }
        }
예제 #2
0
        void SetAppearance(PlayerIconData playerIconData, EndgameState endgameState)
        {
            if (playerIconData.Gender == PlayerGender.None)
            {
                Debug.LogWarning("Player gender set to NONE");
            }
            Color color = playerIconData.IsDemoUser ? new Color(0.4117647f, 0.9254903f, 1f, 1f) : PlayerTintConverter.ToColor(playerIconData.Tint);

            UIButton.Ico = IconImage;   // forced icon
            UIButton.ChangeDefaultColors(color, color.SetAlpha(0.5f));
            UIButton.Ico.sprite = playerIconData.IsDemoUser
                ? Resources.Load <Sprite>(AppConfig.RESOURCES_DIR_AVATARS + "god")
                : Resources.Load <Sprite>(AppConfig.RESOURCES_DIR_AVATARS + (playerIconData.Gender == PlayerGender.None ? "M" : playerIconData.Gender.ToString()) +
                                          playerIconData.AvatarId);
            bool hasHat = endgameState != EndgameState.Unfinished;

            HatImage.gameObject.SetActive(hasHat);
            levelLabelRT.anchoredPosition = hasHat ? orLevelLabelPosition + new Vector2(0, LevelLabelHatShift) : orLevelLabelPosition;

            switch (endgameState)
            {
            case EndgameState.Finished:
                HatImage.sprite = EndgameHat;
                break;

            case EndgameState.FinishedWAllStars:
                HatImage.sprite = EndgameHatWStars;
                break;
            }
            if (HideLevel || hasHat)
            {
                LevelLabel.text = "";
            }
            else
            {
                LevelLabel.text = playerIconData.MaxJourneyPosition.Stage.ToString() + "-" + playerIconData.MaxJourneyPosition.LearningBlock.ToString();
            }

            // Debug.Log("hasMaxStarsInCurrentPlaySessions: " + hasMaxStarsInCurrentPlaySessions);
            HighlightImage.SetActive(playerIconData.HasMaxStarsInCurrentPlaySessions);
        }
예제 #3
0
        void SetAppearance(PlayerIconData playerIconData, EndgameState endgameState)
        {
//            if (playerIconData.Gender == PlayerGender.None) {
//                Debug.LogWarning("Player gender set to NONE");
//            }
            isDemoUser = playerIconData.IsDemoUser;
            Color color = isDemoUser ? new Color(0.4117647f, 0.9254903f, 1f, 1f) : playerIconData.BgColor;

//            UIButton.Ico = FaceImg;   // forced icon
//            UIButton.ChangeDefaultColors(color, color.SetAlpha(0.5f));

            if (isDemoUser)
            {
                FaceImg.sprite = Resources.Load <Sprite>($"{AppConfig.RESOURCES_DIR_AVATARS}god");
                HairImg.sprite = null;
            }
            else
            {
                if (playerIconData.IsOldAvatar)
                {
                    color          = PlayerTintConverter.ToColor(playerIconData.Tint);
                    FaceImg.sprite = Resources.Load <Sprite>(AppConfig.RESOURCES_DIR_AVATARS + (playerIconData.Gender == PlayerGender.None ? "M" : playerIconData.Gender.ToString()) + playerIconData.AvatarId);
                }
                else
                {
                    FaceImg.sprite = Resources.Load <Sprite>($"{AppConfig.RESOURCES_DIR_AVATARS}AvatarV2_{(playerIconData.NewAvatarId + 1)}_face");
                    HairImg.sprite = Resources.Load <Sprite>($"{AppConfig.RESOURCES_DIR_AVATARS}AvatarV2_{(playerIconData.NewAvatarId + 1)}_hair");
                }
            }

            UIButton.ChangeDefaultColors(color, color.ChangeSaturation(0.35f));

            defFaceColor = FaceImg.color = (isDemoUser || playerIconData.IsOldAvatar) ? Color.white : playerIconData.SkinColor;
            if (HairImg.sprite != null)
            {
                defHairColor = HairImg.color = playerIconData.HairColor;
            }
            HairImg.gameObject.SetActive(!isDemoUser && !playerIconData.IsOldAvatar);
            bool hasHat = endgameState != EndgameState.Unfinished;

            HatImage.gameObject.SetActive(hasHat);
            HatImage.color = HatImage.color.SetAlpha(1);
            levelLabelRT.anchoredPosition = hasHat ? orLevelLabelPosition + new Vector2(0, LevelLabelHatShift) : orLevelLabelPosition;

            switch (endgameState)
            {
            case EndgameState.Finished:
                HatImage.sprite = EndgameHat;
                break;

            case EndgameState.FinishedWAllStars:
                HatImage.sprite = EndgameHatWStars;
                break;
            }
            if (HideLevel || hasHat)
            {
                LevelLabel.text = "";
            }
            else
            {
                LevelLabel.text = $"{playerIconData.MaxJourneyPosition.Stage}-{playerIconData.MaxJourneyPosition.LearningBlock}";
            }

            // Debug.Log("hasMaxStarsInCurrentPlaySessions: " + hasMaxStarsInCurrentPlaySessions);
            HighlightImage.SetActive(playerIconData.HasMaxStarsInCurrentPlaySessions);

            //            if (playerIconData.Gender == PlayerGender.None) {
            //                Debug.LogWarning("Player gender set to NONE");
            //            }
            //            Color color = isDemoUser ? new Color(0.4117647f, 0.9254903f, 1f, 1f) : PlayerTintConverter.ToColor(playerIconData.Tint);
            //            UIButton.Ico = IconImage;   // forced icon
            //            UIButton.ChangeDefaultColors(color, color.SetAlpha(0.5f));
            //            UIButton.Ico.sprite = isDemoUser
            //                ? Resources.Load<Sprite>(AppConfig.RESOURCES_DIR_AVATARS + "god")
            //                : Resources.Load<Sprite>(AppConfig.RESOURCES_DIR_AVATARS + (playerIconData.Gender == PlayerGender.None ? "M" : playerIconData.Gender.ToString()) +
            //                                         playerIconData.AvatarId);
            //            bool hasHat = endgameState != EndgameState.Unfinished;
            //            HatImage.gameObject.SetActive(hasHat);
            //            levelLabelRT.anchoredPosition = hasHat ? orLevelLabelPosition + new Vector2(0, LevelLabelHatShift) : orLevelLabelPosition;
            //
            //            switch (endgameState) {
            //                case EndgameState.Finished:
            //                    HatImage.sprite = EndgameHat;
            //                    break;
            //                case EndgameState.FinishedWAllStars:
            //                    HatImage.sprite = EndgameHatWStars;
            //                    break;
            //            }
            //            if (HideLevel || hasHat) {
            //                LevelLabel.text = "";
            //            } else {
            //                LevelLabel.text = playerIconData.MaxJourneyPosition.Stage.ToString() + "-" + playerIconData.MaxJourneyPosition.LearningBlock.ToString();
            //            }
            //
            //            // Debug.Log("hasMaxStarsInCurrentPlaySessions: " + hasMaxStarsInCurrentPlaySessions);
            //            HighlightImage.SetActive(playerIconData.HasMaxStarsInCurrentPlaySessions);
        }