void OnSelectProfile(PlayerIcon playerIcon) { int index = Array.IndexOf(playerIcons, playerIcon); PlayerIconData playerIconData = playerIconDatas[index]; SelectProfile(playerIconData); }
/// <summary> /// Selects the profile. /// </summary> internal void SelectProfile(PlayerIconData playerIconData) { ProfileManager.SetPlayerAsCurrentByUUID(playerIconData.Uuid); AudioManager.I.PlaySound(SfxSelectProfile); LLInStage.Init(AppManager.I.Teacher.GetRandomTestLetterLL(useMaxJourneyData: true)); Setup(); }
// Layout with current profiles void Setup() { ActivatePlayerIcons(true); if (playerIconDatas == null) { playerIconDatas = ProfileManager.GetPlayersIconData(); } int totProfiles = playerIconDatas == null ? 0 : playerIconDatas.Count; int len = playerIcons.Length; for (int i = 0; i < len; ++i) { PlayerIcon playerIcon = playerIcons[i]; if (i >= totProfiles) { playerIcon.gameObject.SetActive(false); } else { PlayerIconData iconData = playerIconDatas[i]; playerIcon.gameObject.SetActive(true); playerIcon.Init(iconData); // Use the first available, if the player is null if (AppManager.I.Player == null) { AppManager.I.PlayerProfileManager.SetPlayerAsCurrentByUUID(playerIcon.Uuid); } playerIcon.Select(AppManager.I.Player.Uuid); playerIcon.transform.localScale = Vector3.one * (AppManager.I.Player.Uuid == playerIcon.Uuid ? 1.14f : 1); } } if (totProfiles == 0) { BtAdd.Pulse(); BtPlay.StopPulsing(); btPlayTween.PlayBackwards(); } else { // Set play button position this.StartCoroutine(CO_SetupPlayButton()); } if (totProfiles >= maxProfiles) { btAddTween.Rewind(); BtAdd.gameObject.SetActive(false); } }
public void SetIcon(PlayerIconData data) { _iconType = data.Type; Icon.SetImage(data.Icon); }