-
Notifications
You must be signed in to change notification settings - Fork 2
develop SelectionUI
Seong Hyeok OH edited this page Feb 12, 2023
·
13 revisions
- MainCollection을 복사 붙여 놓기 하여 CharacterSelectionUI에 필요한 부분 빼고 삭제한다.
using UnityEngine.UI; using UnityEngine.EventSystems; using TMPro; public class CharacterInfo : MonoBehaviour, IPointerEnterHandler { [SerializeField] int mCharacter; [SerializeField] Image mInfoImage; [SerializeField] Image mButtonIamge; [SerializeField] TMP_Text mCharacterName; [SerializeField] TMP_Text mCharacterName1; [SerializeField] TMP_Text mCharacterExplain; [SerializeField] TMP_Text mCharacterMaxStamina; [SerializeField] TMP_Text mCharacterRecovery; [SerializeField] TMP_Text mCharacterDefense; [SerializeField] TMP_Text mCharacterSpeed; [SerializeField] TMP_Text mCharacterDamage; [SerializeField] TMP_Text mCharacterProjectileSpeed; [SerializeField] TMP_Text mCharacterDuration; [SerializeField] TMP_Text mCharacterAttackRange; [SerializeField] TMP_Text mCharacterCooldown; [SerializeField] TMP_Text mCharacterNumberOfProjectiles; [SerializeField] TMP_Text mCharacterMagnet; [SerializeField] TMP_Text mCharacterLuck; [SerializeField] TMP_Text mCharacterGrowth; string mName; string mExplain; float mMaxStamina; float mRecovery; float mDefense; float mSpeed; float mDamage; float mProjectileSpeed; float mDuration; float mAttackRange; float mCooldown; int mNumberOfProjectiles; float mMagnet; float mLuck; float mGrowth; void Start() { switch (mCharacter) { case 1: this.mName = "캐릭터 이름1"; this.mExplain = "캐릭터 설명1"; this.mMaxStamina = 101; this.mRecovery = (float)0.1; this.mDefense = 1; this.mSpeed = 11; this.mDamage = 11; this.mProjectileSpeed = 11; this.mDuration = 11; this.mAttackRange = 11; this.mCooldown = -1; this.mNumberOfProjectiles = 1; this.mMagnet = 1; this.mLuck = 11; this.mGrowth = 11; break; ... } } public void OnPointerEnter(PointerEventData eventData) { //지정한 텍스트 대입 mCharacterName.text = this.mName; mCharacterName1.text = this.mName; mCharacterExplain.text = this.mExplain; mCharacterMaxStamina.text = "Max stamina" + this.mMaxStamina.ToString(); mCharacterRecovery.text = "Recovery" + this.mRecovery.ToString(); mCharacterDefense.text = "Defense" + this.mDefense.ToString(); mCharacterSpeed.text = "Speed" + this.mSpeed.ToString() + "%"; mCharacterDamage.text = "Damage" + this.mDamage.ToString() + "%"; mCharacterProjectileSpeed.text = "Projectile Speed" + this.mProjectileSpeed.ToString() + "%"; mCharacterDuration.text = "Duration" + this.mDuration.ToString() + "%"; mCharacterAttackRange.text = "AttackRange" + this.mAttackRange.ToString() + "%"; mCharacterCooldown.text = "Cooldown" + this.mCooldown.ToString() + "%"; mCharacterNumberOfProjectiles.text = "Number of projectiles" + this.mNumberOfProjectiles.ToString(); mCharacterMagnet.text = "Magnet" + this.mMagnet.ToString() + "%"; mCharacterLuck.text = "Luck" + this.mLuck.ToString() + "%"; mCharacterGrowth.text = "Growth" + this.mGrowth.ToString() + "%"; mInfoImage.GetComponent().sprite = mButtonIamge.GetComponent().sprite; //이미지 대입 } }
using UnityEngine.UI; using UnityEngine.EventSystems; using TMPro; public class StageInfo : MonoBehaviour, IPointerEnterHandler { [SerializeField] int mStage; [SerializeField] TMP_Text mStageName; [SerializeField] TMP_Text mStageName1; [SerializeField] TMP_Text mStageExplain; [SerializeField] TMP_Text mStagePlayTime; [SerializeField] TMP_Text mStageDoubleSpeed; [SerializeField] TMP_Text mStageGoldCoinBonus; [SerializeField] TMP_Text mStageLuckBonus; [SerializeField] TMP_Text mStageExperienceBonus; string mSName; string mExplain; string mPlayTime; float mDoubleSpeed; float mGoldCoinBonus; float mLuckBonus; float mExperienceBonus; void Start() { switch (mStage) { case 1: this.mSName = "스테이지 1"; this.mExplain = "스테이지 설명 1"; this.mPlayTime = "30:01"; this.mDoubleSpeed = 1; this.mGoldCoinBonus = 1; this.mLuckBonus = 1; this.mExperienceBonus = 1; break; ... } } public void OnPointerEnter(PointerEventData eventData) { mStageName.text = this.mSName; mStageName1.text = this.mSName; mStageExplain.text = this.mExplain; mStagePlayTime.text = "Play Time " + this.mPlayTime; mStageDoubleSpeed.text = "Double Speed " + this.mDoubleSpeed.ToString() + "%"; mStageGoldCoinBonus.text = "Gold Coin Bonus " + this.mGoldCoinBonus.ToString() + "%"; mStageLuckBonus.text = "Luck Bonus " + this.mLuckBonus.ToString() + "%"; mStageExperienceBonus.text = "Experience Bonus " + this.mExperienceBonus.ToString() + "%"; } }