캐릭터 데이터 불러오기 및 캐릭터 선택 / 생성 화면 간의 이동 로직 적용

This commit is contained in:
aube.lee
2025-02-01 18:42:16 +09:00
parent 2b5c4d2125
commit 953894c056
16 changed files with 2326 additions and 8 deletions

View File

@@ -99,7 +99,7 @@ Animator:
m_GameObject: {fileID: 3656570700648378249}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: bf82660a78e45fa4393fd75bbd7940a6, type: 2}
m_Controller: {fileID: 9100000, guid: 1ee48e99e83e04b4192124e69f87fde8, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0

View File

@@ -0,0 +1,272 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6123405526985097706
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8810115301267459994}
- component: {fileID: 9077630461807892787}
- component: {fileID: 2061677498746279789}
m_Layer: 0
m_Name: Name
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8810115301267459994
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6123405526985097706}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7583156814540936988}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: 30}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &9077630461807892787
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6123405526985097706}
m_CullTransparentMesh: 1
--- !u!114 &2061677498746279789
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6123405526985097706}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 30
m_fontSizeBase: 30
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &6381712861469355420
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7583156814540936988}
- component: {fileID: 702490663243956496}
- component: {fileID: 3830091928539515416}
m_Layer: 0
m_Name: Charater Slot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7583156814540936988
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6381712861469355420}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2690524853025012853}
- {fileID: 8810115301267459994}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 150, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &702490663243956496
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6381712861469355420}
m_CullTransparentMesh: 1
--- !u!114 &3830091928539515416
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6381712861469355420}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 349f3b01eba66bc4c9c86ef4754ab095, type: 3}
m_Name:
m_EditorClassIdentifier:
character_image: {fileID: 3237735562706147477}
charater_name: {fileID: 2061677498746279789}
--- !u!1 &7614705130711533582
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2690524853025012853}
- component: {fileID: 1656860276637884225}
- component: {fileID: 3237735562706147477}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2690524853025012853
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7614705130711533582}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7583156814540936988}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: 150}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &1656860276637884225
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7614705130711533582}
m_CullTransparentMesh: 1
--- !u!114 &3237735562706147477
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7614705130711533582}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1f860600238397744a71b475377fcabf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 60a165f7709a3934093a4d7df75bad04
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -383,7 +383,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3675204183f70fb48a77841d2b9055f4, type: 3}
m_Name:
m_EditorClassIdentifier:
eventSystem: {fileID: 0}
joystick: {fileID: 7288066023221573359}
--- !u!1 &1765274414205500545
GameObject:
@@ -955,7 +954,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -83.99993, y: 331.00006}
m_AnchoredPosition: {x: -386, y: 331.00006}
m_SizeDelta: {x: 256, y: 256}
m_Pivot: {x: 1, y: 1}
--- !u!222 &2511609967701569318
@@ -1222,7 +1221,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -398, y: 331}
m_AnchoredPosition: {x: -88, y: 331}
m_SizeDelta: {x: 256, y: 256}
m_Pivot: {x: 1, y: 1}
--- !u!222 &4938549978599767961

View File

@@ -268,7 +268,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fc0dce4fb90a31a43927108fa0c15b2b, type: 3}
m_Name:
m_EditorClassIdentifier:
eventSystem: {fileID: 0}
charaterSelectUI: {fileID: 4108690129144757636, guid: 60a165f7709a3934093a4d7df75bad04, type: 3}
--- !u!1 &3755966474430767593
GameObject:
m_ObjectHideFlags: 0

View File

@@ -10,6 +10,7 @@ namespace TON
TitleUI,
CharaterCreateUI,
CharaterSelectUI,
IngameUI,
ControllerUI,
LogUI,

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b62fad9e2d4e5147bdfbb406b726872
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
[System.Serializable]
public class PlayerData
{
public int id;
public string type;
public string name;
public float health;
public float score;
public int chance;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3d83c2b2016d524b940e93a53611843
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace TON
{
public class CharaterSelectUI : UIBase
{
[SerializeField] private Button createButton; // Create 버튼 참조
[SerializeField] private Button playButton; // Play 버튼 참조
[SerializeField] private List<PlayerData> playerDatas;
public List<CharaterSelectUI_SlotItem> CharacterSlots = new List<CharaterSelectUI_SlotItem>();
public SerializableDictionary<string, Sprite> CharacterSpriteDict = new SerializableDictionary<string, Sprite>();
private void Start()
{
// 캐릭터를 선택한 이후에 버튼 활성화 할 수 있도록 초기 비활성화 적용
playButton.interactable = false;
if (playerDatas.Count >= 5)
{
// 캐릭터 슬롯을 모두 사용하고 있다면 버튼 비활성화 적용
createButton.interactable = false;
}
for (int i = 0; i < playerDatas.Count; i++)
{
CharacterSpriteDict.TryGetValue(playerDatas[i].type, out Sprite sprite);
string name = playerDatas[0].name != null ? playerDatas[0].name : "";
if (sprite)
{
CharacterSlots[i].SetCharaterData(sprite, name);
}
}
}
public void SetPlayerDatas(List<PlayerData> datas)
{
playerDatas = datas;
}
public void OnClickPlayButton()
{
}
public void OnClickCreateButton()
{
UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
UIManager.Hide<CharaterSelectUI>(UIList.CharaterSelectUI);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d8fff7f63166be4b89de078e1595642
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace TON
{
public class CharaterSelectUI_SlotItem : MonoBehaviour
{
[SerializeField] private Image character_image;
[SerializeField] private TextMeshProUGUI charater_name;
public void SetCharaterData(Sprite image, string name)
{
character_image.sprite = image;
charater_name.text = name;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 349f3b01eba66bc4c9c86ef4754ab095
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -6,16 +6,29 @@ namespace TON
{
public class TitleUI : UIBase
{
public CharaterSelectUI charaterSelectUI;
public void OnClickStartButton()
{
// Main.Singleton?.ChangeScene(SceneType.Ingame);
UIManager.Hide<TitleUI>(UIList.TitleUI);
// TODO: 현재 가지고 있는 캐릭터가 없다면 CharaterCreateUI 를 보여주고
UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
// TODO: 캐릭터가 있다면 내 캐릭터 목록에서 선택할 수 있도록 함
List<PlayerData> players = JSONLoader.LoadFromResources<List<PlayerData>>("Player");
if (players == null)
{
// 현재 가지고 있는 캐릭터가 없다면 CharaterCreateUI 를 보여주고
UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
}
else
{
// 캐릭터가 있다면 내 캐릭터 목록에서 선택할 수 있도록 함
charaterSelectUI.SetPlayerDatas(players);
UIManager.Show<CharaterSelectUI>(UIList.CharaterSelectUI);
}
}
public void OnClickExitButton()
{
Main.Singleton?.SystemQuit();