Beispiel #1
0
 void DispatchOnDeselectAll(PlayerCreationUICategory category)
 {
     if (OnDeselectAll != null)
     {
         OnDeselectAll(category);
     }
 }
Beispiel #2
0
 void DispatchOnSelect(PlayerCreationUICategory category, UIButton uiButton)
 {
     if (OnSelect != null)
     {
         OnSelect(category, uiButton);
     }
 }
Beispiel #3
0
        void SwitchState(UIState toState)
        {
            if (State == toState)
            {
                return;
            }

            State = toState;
            PlayerCreationUICategory avatarCat = Categories[CategoryIndex.Avatar];

            switch (toState)
            {
            case UIState.AgeSelection:
                for (var i = 0; i < avatarCat.UIButtons.Length; i++)
                {
                    avatarCat.UIButtons[i].gameObject.SetActive(i == avatarCat.SelectedIndex);
                    if (i == avatarCat.SelectedIndex)
                    {
                        avatarCat.UIButtons[i].transform.localScale = Vector3.one * 1.65f;
                    }
                }
                foreach (var cat in Categories)
                {
                    if (cat != avatarCat)
                    {
                        cat.gameObject.SetActive(false);
                    }
                }
                AgeCategory.gameObject.SetActive(true);
                BtContinue.StopPulsing();
                BtContinue.gameObject.SetActive(false);
                AudioManager.I.PlayDialogue(Database.LocalizationDataId.Profile_Age);
                break;

            case UIState.AvatarCreation:
                AgeCategory.gameObject.SetActive(false);
                foreach (UIButton catBt in avatarCat.UIButtons)
                {
                    catBt.gameObject.SetActive(true);
                }
                foreach (PlayerCreationUICategory cat in Categories)
                {
                    if (cat != avatarCat)
                    {
                        cat.gameObject.SetActive(true);
                    }
                }
                OnSelectCategory(avatarCat, avatarCat.UIButtons[avatarCat.SelectedIndex]);
                break;
            }
        }
Beispiel #4
0
        void OnSelectCategory(PlayerCreationUICategory category, UIButton uiButton)
        {
            AppManager.I.PlayerProfileManager.TemporaryPlayerGender = Categories[CategoryIndex.Gender].SelectedIndex == 0 ? PlayerGender.M : PlayerGender.F;
            //Debug.Log("set temp Gender to " + AppManager.I.PlayerProfileManager.TemporaryPlayerGender);

            switch (State)
            {
            case UIState.AvatarCreation:
                int catIndex = Array.IndexOf(Categories, category);
                if (selectionStep < Categories.Length - 1 && catIndex == selectionStep)
                {
                    AvatarCreation_NextStep();
                }

                switch (catIndex)
                {
                case CategoryIndex.Gender:
                    AvatarCreation_SetGender();
                    break;

                case CategoryIndex.Color:
                    Categories[CategoryIndex.Avatar].SetColor(uiButton.DefaultColor);
                    break;
                }

                if (allAvatarCategoriesSelected)
                {
                    BtContinue.gameObject.SetActive(true);
                    BtContinue.Pulse();
                    AudioManager.I.PlayDialogue(Database.LocalizationDataId.Action_PressPlay);
                }
                break;

            case UIState.AgeSelection:
                switch (category.CategoryType)
                {
                case CategoryType.Age:
                    BtContinue.gameObject.SetActive(true);
                    BtContinue.Pulse();
                    var age_selected = AgeCategory.SelectedIndex + 4;
                    AudioManager.I.PlayDialogue("Profile_Years_" + age_selected.ToString());
                    break;

                case CategoryType.Avatar:
                    SwitchState(UIState.AvatarCreation);
                    break;
                }
                break;
            }
        }
Beispiel #5
0
 private void OnDeselectAllInCategory(PlayerCreationUICategory category)
 {
     BtContinue.StopPulsing();
     BtContinue.gameObject.SetActive(false);
     switch (State)
     {
     case UIState.AvatarCreation:
         var catIndex = Array.IndexOf(Categories, category);
         if (catIndex < selectionStep)
         {
             AvatarCreation_StepBackwards(catIndex);
         }
         //                    else if (catIndex == CategoryIndex.Color) {
         //                        Categories[CategoryIndex.Avatar].ResetColor();
         //                    }
         break;
     }
 }
Beispiel #6
0
 private void AvatarCreation_StepBackwards(int toStep)
 {
     if (stepTween != null)
     {
         stepTween.Complete();
     }
     for (var i = toStep + 1; i < selectionStep + 1; ++i)
     {
         PlayerCreationUICategory cat = Categories[i];
         //                if (i == CategoryIndex.Color) {
         //                    // Reset avatars colors
         //                    Categories[CategoryIndex.Avatar].ResetColor();
         //                }
         cat.Select(-1);
         cat.gameObject.SetActive(false);
     }
     selectionStep = toStep;
     stepTween     = CategoriesContainer.DOAnchorPosY(StartupOffsetY - selectionStepOffsetY * selectionStep, 0.4f);
     playAudioDescription(State, selectionStep);
 }
Beispiel #7
0
        private void OnSelectCategory(PlayerCreationUICategory category, UIButton uiButton)
        {
            switch (State)
            {
            case UIState.GenderSelection:
                BtContinue.gameObject.SetActive(true);
                BtContinue.Pulse();
                confirmationPanel.Hide();
                SelectGender(Array.IndexOf(GenderCategory.UIButtons, uiButton) == 0
                        ? PlayerGender.M
                        : PlayerGender.F);
                KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Action_PressPlay);
                break;

            case UIState.AvatarCreation:
                int catIndex = Array.IndexOf(Categories, category);
                if (selectionStep < Categories.Length - 1 && catIndex == selectionStep)
                {
                    AvatarCreation_NextStep();
                }

                switch (catIndex)
                {
                case CategoryIndex.SkinColor:
                    currSkinColor = uiButton.Bt.image.color;
                    foreach (PlayerCreationAvatar avatar in _avatars)
                    {
                        avatar.SetFaceColor(currSkinColor);
                    }
                    FillHairAvatars();
                    break;

                case CategoryIndex.Avatar:
                    currAvatarId = Array.IndexOf(_avatarBts, uiButton);
                    FillHairAvatars();
                    break;

                case CategoryIndex.HairColor:
                    currHairColor = uiButton.GetComponent <PlayerCreationAvatar>().hairImg.color;
                    break;
                }

                if (allAvatarCategoriesSelected)
                {
                    BtContinue.gameObject.SetActive(true);
                    BtContinue.Pulse();
                    KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Action_PressPlay);
                }
                break;

            case UIState.BgColorSelection:
                switch (category.CategoryType)
                {
                case CategoryType.BgColor:
                    BtContinue.gameObject.SetActive(true);
                    BtContinue.Pulse();
                    currBgColor = uiButton.Bt.image.color;
                    _avatars[currAvatarId].GetComponent <UIButton>().Bt.image.color = currBgColor;
                    KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Action_PressPlay);
                    break;

                case CategoryType.Avatar:
                    BgColorCategory.Select(-1);
                    _avatars[currAvatarId].GetComponent <UIButton>().Bt.image.color = Color.white;
                    SwitchState(UIState.AvatarCreation);
                    break;
                }
                break;

            case UIState.AgeSelection:
                switch (category.CategoryType)
                {
                case CategoryType.Age:
                    BtContinue.gameObject.SetActive(true);
                    BtContinue.Pulse();
                    KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Action_PressPlay);
                    currAge = 4 + Array.IndexOf(AgeCategory.UIButtons, uiButton);
                    break;

                case CategoryType.Avatar:
                    AgeCategory.Select(-1);
                    _avatars[currAvatarId].GetComponent <UIButton>().Bt.image.color = Color.white;
                    SwitchState(UIState.AvatarCreation);
                    break;
                }
                break;
            }
        }
Beispiel #8
0
        private void SwitchState(UIState toState, bool init = false)
        {
            if (State == toState && !init)
            {
                return;
            }

            State = toState;
            PlayerCreationUICategory avatarCat = Categories[CategoryIndex.Avatar];

            switch (toState)
            {
            case UIState.GenderSelection:
                confirmationPanel.onSkip = () =>
                {
                    SelectGender(PlayerGender.M);
                    OnContinue();
                };
                confirmationPanel.Show(LocalizationDataId.Help_GenderSelection);

                foreach (var cat in Categories)
                {
                    cat.gameObject.SetActive(false);
                }
                BgColorCategory.gameObject.SetActive(false);
                GenderCategory.gameObject.SetActive(true);
                AgeCategory.gameObject.SetActive(false);
                BtContinue.StopPulsing();
                BtContinue.gameObject.SetActive(false);
                if (!init)
                {
                    KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Profile_Gender);
                }
                break;

            case UIState.AvatarCreation:

                BtContinue.StopPulsing();
                BtContinue.gameObject.SetActive(false);

                KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Profile_SkinColor);

                BgColorCategory.gameObject.SetActive(false);
                GenderCategory.gameObject.SetActive(false);
                AgeCategory.gameObject.SetActive(false);
                foreach (UIButton catBt in avatarCat.UIButtons)
                {
                    catBt.gameObject.SetActive(true);
                }

                if (!init && currAvatarId != -1)
                {
                    foreach (PlayerCreationUICategory cat in Categories)
                    {
                        if (cat != avatarCat)
                        {
                            cat.gameObject.SetActive(true);
                        }
                    }

                    _avatars[currAvatarId].SetHairColor(Color.white);
                    OnSelectCategory(avatarCat, avatarCat.UIButtons[avatarCat.SelectedIndex]);
                }
                else
                {
                    foreach (PlayerCreationUICategory cat in Categories)
                    {
                        cat.gameObject.SetActive(false);
                    }
                    Categories[0].gameObject.SetActive(true);
                }

                break;

            case UIState.BgColorSelection:
                for (var i = 0; i < avatarCat.UIButtons.Length; i++)
                {
                    avatarCat.UIButtons[i].gameObject.SetActive(i == avatarCat.SelectedIndex);
                    if (i == avatarCat.SelectedIndex)
                    {
                        avatarCat.UIButtons[i].transform.localScale = Vector3.one * 1.65f;
                        _avatars[currAvatarId].SetHairColor(currHairColor);
                    }
                }
                foreach (var cat in Categories)
                {
                    if (cat != avatarCat)
                    {
                        cat.gameObject.SetActive(false);
                    }
                }
                BgColorCategory.gameObject.SetActive(true);
                GenderCategory.gameObject.SetActive(false);
                AgeCategory.gameObject.SetActive(false);
                BtContinue.StopPulsing();
                BtContinue.gameObject.SetActive(false);
                KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Profile_Color);
                break;

            case UIState.AgeSelection:
                foreach (var cat in Categories)
                {
                    if (cat != avatarCat)
                    {
                        cat.gameObject.SetActive(false);
                    }
                }
                BgColorCategory.gameObject.SetActive(false);
                GenderCategory.gameObject.SetActive(false);
                AgeCategory.gameObject.SetActive(true);
                BtContinue.StopPulsing();
                BtContinue.gameObject.SetActive(false);
                KeeperManager.I.PlayDialogue(Database.LocalizationDataId.Profile_Age);
                break;
            }
        }