Abstract
๊ฒ์ ๋ฐ์ดํฐ๋ ์ฑ๊ฒฉ์ ๋ฐ๋ผ ๋ค ๊ตฐ๋ฐ๋ก ๋๋ฉ๋๋ค. ๋ฌด์์ ์ด๋์ ๋ฃ์์ง๋ง ์ ํ๋ฉด ๋๋จธ์ง๋ ํ๋ ์์ํฌ๊ฐ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์ฒ๋ฆฌํฉ๋๋ค โ ํ
์คํธ ์์
์ ์ฝ์ด ํ์ฑํ๊ณ , ํ์
์ด ์๋ API ๋ก ๊บผ๋ด ์ค๋๋ค.
์ด๋ค ๋ฐ์ดํฐ๋ฅผ ์ด๋์ ๋ฃ๋
๋ชจ๋ | ๋ฃ๋ ๊ฒ | ์ | ์ฐ๊ธฐ |
DataTable | ๊ฐ์ ๋ชจ์์ ํ์ด ์ฌ๋ฌ ๊ฐ์ธ ํ | ์ 5์ข
์ ์ฒด๋ ฅยท๊ณต๊ฒฉ๋ ฅยท์ ์, ์์ดํ
๋ชฉ๋ก | ์ฝ๊ธฐ ์ ์ฉ |
Config | ์ด๋ฆ ํ๋์ ๊ฐ ํ๋์ธ ์ ์ญ ์์ | ์๋ฒ ์ฃผ์, ์ต๋ ๋์ ์คํฐ ์, ํํ ๋ฆฌ์ผ on/off | ์ฝ๊ธฐ ์ ์ฉ |
Localization | ์ธ์ด๋ณ ๋ฌธ์์ด | "Game Over!", "์ ์: {0}" | ์ฝ๊ธฐ ์ ์ฉ |
Setting | ํ๋ ์ด์ด ๊ธฐ๊ธฐ์ ์ ์ฅ๋๋ ๊ฐ | ๋ณผ๋ฅจ, ์ต๊ณ ์ ์, ๋ง์ง๋ง ์ ํ ์บ๋ฆญํฐ | ์ฝ๊ธฐ + ์ฐ๊ธฐ |
์์ ์
์ ๊ฐ๋ฐ์๊ฐ ๋ง๋ค์ด ๋ฐฐํฌํ๋ ๋ฐ์ดํฐ์ด๊ณ , Setting ๋ง ํ๋ ์ด์ด ๊ธฐ๊ธฐ์์ ๋ฐ๋๋ ๋ฐ์ดํฐ์
๋๋ค.
ToyboxNightmare ์์๋ โ ์์ง ์ฐ์ง ์์ต๋๋ค
์์ ๋ ๊ท๋ชจ๊ฐ ์์ ์์น๋ฅผ C# ์์๋ก ๋ค๊ณ ์์ต๋๋ค. ๋์ ๋์ค์ ์ฎ๊ธฐ๊ธฐ ์ฌ์ด ๋ชจ์์ผ๋ก ํ๊ณณ์ ๋ชจ์ ๋์์ต๋๋ค.
// EnemyTable.cs โ ์ง๊ธ์ ์ฝ๋ ์์
// ์ฃผ์ HP ๊ณต๊ฒฉ ๊ฐ๊ฒฉ ์ ์ ์๋ ์ ์ง ๊ณต๊ฒฉ๊ตฌ
new EnemyStats("Zombunny", 100, 10, 0.5f, 10, 3.5f, 1.1f, 0.8f),
new EnemyStats("Hellephant", 200, 35, 2.0f, 50, 3.5f, 1.9f, 1.63f),
C#
๋ณต์ฌ
์ด ํ๊ฐ ๊ทธ๋๋ก DataTable ์ ํ๋ณด์
๋๋ค. ์ฎ๊ธฐ๊ณ ๋๋ฉด ๊ธฐํ์๊ฐ ์ฝ๋๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ํ
์คํธ ํ์ผ๋ง ๊ณ ์ณ ๋ฐธ๋ฐ์ค๋ฅผ ์กฐ์ ํ ์ ์์ต๋๋ค.
ํ์ฅํ๋ค๋ฉด โ ๊ฐ์ฅ ํจ๊ณผ๊ฐ ํฐ ์์
โข
Setting ์ผ๋ก ๋ณผ๋ฅจ ์ ์ฅ: ์์ ์ ์ผ์์ ์ง ๋ฉ๋ด๋ ๋ณผ๋ฅจ ์ฌ๋ผ์ด๋๊ฐ ์์ง๋ง ๊ฒ์์ ๊ป๋ค ์ผ๋ฉด ์ด๊ธฐํ๋ฉ๋๋ค. SetFloat("Volume.Music", v) + Save() ๋ ์ค์ด๋ฉด ์ ์ง๋ฉ๋๋ค. ์ต๊ณ ์ ์๋ ๊ฐ์ ๋ฐฉ์์
๋๋ค.
โข
DataTable ๋ก EnemyTable / WeaponTable ์ด์ : ์ ์ข
๋ฅ๋ ๋ฌด๊ธฐ๊ฐ ์ด ๊ฐ๋ฅผ ๋์ด๊ฐ๋ฉด ์ฝ๋ ์์๋ ๊ด๋ฆฌ๊ฐ ์ ๋ฉ๋๋ค.
โข
Localization: HUD ์ ๊ณ ์ ๋ฌธ๊ตฌ("Game Over!")๋ฅผ ํค๋ก ๋ฐ๊ฟ๋๋ค.
์ด ์๋์
์์ ๋ค๋ฅธ ์
โข
๋ฐ์ดํฐ ํ์ผ์ TextAsset ์ผ๋ก Addressables ์ ๋ฑ๋กํ๊ณ , ReadData ์๋ ๊ทธ ์ฃผ์๋ฅผ ๋๊น๋๋ค.
โข
๋ก๋๋ ๋น๋๊ธฐ์
๋๋ค. ReadData ๋ฅผ ๋ถ๋ฅธ ๋ค์ ์ค์์ ๋ฐ๋ก GetDataRow ๋ฅผ ํ๋ฉด ๋น์ด ์์ต๋๋ค. LoadDataTableSuccessEventArgs / LoadConfigSuccessEventArgs / LoadDictionarySuccessEventArgs ๋ฅผ ๊ธฐ๋ค๋ ค์ผ ํฉ๋๋ค.
โข
Config ์ Localization ์ ๊ธฐ๋ณธ ํฌ๋งท์ ํญ์ผ๋ก ๊ตฌ๋ถ๋ 4์ด์ด๋ฉฐ 2๋ฒ์งธ ์ด์ด ํค, 4๋ฒ์งธ ์ด์ด ๊ฐ์
๋๋ค. 1ยท3๋ฒ์งธ ์ด์ ์ฝ์ง ์์ต๋๋ค(์ฃผ์ ์ฉ๋). ์๋ ๋ณธ๋ฌธ ์์์ bool / float / string ์ ํ์
์ง์ ์ด ์๋๋ผ 3๋ฒ์งธ ์ด์ ์ ์ ๋ฉ๋ชจ์ผ ๋ฟ์ด๊ณ , ๊ฐ์ ํ์
์ ๊บผ๋ผ ๋(GetBool, GetFloat โฆ) ์ ํด์ง๋๋ค.
โข
๋ณธ๋ฌธ "์ถ์ฒ"์ ๊ฒฝ๋ก์ ์ค ๋ฒํธ๋ ์์ ์ ์ฅ์ ๊ธฐ์ค์
๋๋ค. ์ด ์๋์
์์๋ Packages/com.yamyamcoding.gameframework/Runtime/UnityGameFramework/ ์๋์ ์์ต๋๋ค.
Data Management
๊ด๋ จ ์์ค ํ์ผ
โข
Scripts/Runtime/Config/ConfigComponent.cs
โข
Scripts/Runtime/Config/ConfigHelperBase.cs
โข
Scripts/Runtime/Config/DefaultConfigHelper.cs
โข
Scripts/Runtime/DataTable/DataRowBase.cs
โข
Scripts/Runtime/DataTable/DataTableComponent.cs
โข
Scripts/Runtime/DataTable/DataTableHelperBase.cs
โข
Scripts/Runtime/DataTable/DefaultDataTableHelper.cs
โข
Scripts/Runtime/Localization/DefaultLocalizationHelper.cs
โข
Scripts/Runtime/Localization/LocalizationComponent.cs
โข
Scripts/Runtime/Localization/LocalizationHelperBase.cs
โข
Scripts/Runtime/Setting/DefaultSetting.cs
โข
Scripts/Runtime/Setting/DefaultSettingHelper.cs
โข
Scripts/Runtime/Setting/PlayerPrefsSettingHelper.cs
โข
Scripts/Runtime/Setting/PlayerPrefsSettingHelper.cs.meta
โข
Scripts/Runtime/Setting/SettingComponent.cs
โข
Scripts/Runtime/Setting/SettingHelperBase.cs
๋ฐ์ดํฐ ๊ด๋ฆฌ ์์คํ
์ Unity Game Framework์์ ๊ตฌ์กฐํ๋ ๋ฐ์ดํฐ ํ
์ด๋ธ, ์ ์ญ ์ค์ , ๋ก์ปฌ๋ผ์ด์ ์ด์
์์ฐ, ๊ทธ๋ฆฌ๊ณ ์ง์์ ์ธ ํ๋ ์ด์ด ์ค์ ์ ํฌํจํ ๋ค์ํ ์ ํ์ ๊ฒ์ ๋ฐ์ดํฐ๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ ๋ฉ์ปค๋์ฆ์ ์ ๊ณตํฉ๋๋ค. ์ด ์๋ธ์์คํ
๋ค์ ๊ฐ๋ฐ์๊ฐ ๊ฒ์์ ๋ผ์ดํ์ฌ์ดํด ์ ๋ฐ์ ๊ฑธ์ณ ๋ค์ํ ๋ฐ์ดํฐ๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ณ ์ ๊ทผํ ์ ์๋๋ก ํฉ๋๋ค.
Overview
๋ฐ์ดํฐ ๊ด๋ฆฌ ํ๋ ์์ํฌ๋ ๋ค ๊ฐ์ง ์ฃผ์ ์๋ธ์์คํ
์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค:
โข
Data Tables: ํ๊ณผ ์ด๋ก ๊ตฌ์ฑ๋ ๊ตฌ์กฐํ๋ ๊ฒ์ ๋ฐ์ดํฐ (โ Data Tables ์ฐธ์กฐ)
โข
Configuration: ๋ฐํ์์ ๋ก๋๋๋ ์ ์ญ ๊ฒ์ ์ค์ (โ Configuration System ์ฐธ์กฐ)
โข
Localization: ๋ค๊ตญ์ด ํ
์คํธ์ ๋ฆฌ์์ค (โ Localization System ์ฐธ์กฐ)
โข
Settings: ๊ฒ์ ์ธ์
๊ฐ์ ์ ์ฅ๋๋ ์ง์์ ์ธ ํ๋ ์ด์ด ์ค์
๊ฐ ์๋ธ์์คํ
์ ์ ์ฌํ ์ํคํ
์ฒ ํจํด์ ๋ฐ๋ฅด๋ฉฐ, ํฌํผ ํจํด์ ํตํ ์ปค์คํฐ๋ง์ด์ง์ ์ง์ํฉ๋๋ค.
์ถ์ฒ:
Scripts/Runtime/DataTable/DataTableComponent.cs
Scripts/Runtime/Config/ConfigComponent.cs
Scripts/Runtime/Localization/LocalizationComponent.cs
Scripts/Runtime/Setting/SettingComponent.cs
Common Architecture Pattern
๋ค ๊ฐ์ง ๋ฐ์ดํฐ ๊ด๋ฆฌ ์๋ธ์์คํ
๋ชจ๋ ์ผ๊ด์ฑ๊ณผ ์ ์ฐ์ฑ์ ์ ๊ณตํ๊ธฐ ์ํด ๋์ผํ ์ํคํ
์ฒ ํจํด์ ๋ฐ๋ฆ
๋๋ค.
๊ฐ ์๋ธ์์คํ
์ ๋ค์์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค:
โข
Component: ํผ๋ธ๋ฆญ API๋ฅผ ์ ๊ณตํ๋ Unity MonoBehaviour
โข
Manager: Game Framework๊ฐ ์ฒ๋ฆฌํ๋ ํต์ฌ ๊ตฌํ
โข
Helper Base: ๋ฐ์ดํฐ ๋ก๋ ๋ฐ ํ์ฑ ๋ฐฉ์์ ์ ์ํ๋ ์ถ์ ํด๋์ค
โข
Default Helper: ํฌํผ ์ธํฐํ์ด์ค์ ํ์ค ๊ตฌํ
์ถ์ฒ:
Scripts/Runtime/DataTable/DataTableHelperBase.cs
Scripts/Runtime/Config/ConfigHelperBase.cs
Scripts/Runtime/Localization/LocalizationHelperBase.cs
Scripts/Runtime/Setting/SettingHelperBase.cs
Data Table System
๋ฐ์ดํฐ ํ
์ด๋ธ ์์คํ
์ ํ๊ณผ ์ด๋ก ๊ตฌ์ฑ๋ ๊ตฌ์กฐํ๋ ๊ฒ์ ๋ฐ์ดํฐ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค. ํ์
์์ ์ฑ์ด ๋ณด์ฅ๋ ๋ฐฉ์์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ๋ก๋, ํ์ฑ, ์ ๊ทผํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
์ฃผ์ ์์
:
โข
Create Data Tables: CreateDataTable<T>() (T๋ IDataRow๋ฅผ ๊ตฌํํ๋ ํด๋์ค)
โข
Load Data: DataTableBase.ReadData(์ฃผ์) ๋ก ๋ฐ์ดํฐ ํ
์ด๋ธ ํ์ผ ๋ก๋
โข
Access Data: GetDataRow(id) ๋๋ ์ฟผ๋ฆฌ ๋ฉ์๋๋ฅผ ํตํด ๋ฐ์ดํฐ ํ ์ ๊ทผ
โข
Destroy Tables: ๋ ์ด์ ํ์ํ์ง ์์ ๋ ๋ฆฌ์์ค ํด์
์์:
// ์ปค์คํ
๋ฐ์ดํฐ ํ์
์ฉ ๋ฐ์ดํฐ ํ
์ด๋ธ ์์ฑ
IDataTable<ItemData> itemTable = GameEntry.GetComponent<DataTableComponent>().CreateDataTable<ItemData>();
// ๋ฆฌ์์ค์์ ๋ฐ์ดํฐ ๋ก๋ (๋น๋๊ธฐ). ReadData ๋ IDataTable<T> ๊ฐ ์๋๋ผ DataTableBase ์ ์๋ค
((DataTableBase)itemTable).ReadData("Items"); // "Items" = Addressables ์ฃผ์
// LoadDataTableSuccess ์ด๋ฒคํธ๋ฅผ ๋ฐ์ ๋ค์ ID๋ก ๋ฐ์ดํฐ ์ ๊ทผ
ItemData item = itemTable.GetDataRow(10001);
C#
๋ณต์ฌ
์ถ์ฒ:
Scripts/Runtime/DataTable/DataTableComponent.cs 144-264
Scripts/Runtime/DataTable/DefaultDataTableHelper.cs 22-169
Scripts/Runtime/DataTable/DataRowBase.cs 15-51
Configuration System
์ค์ ์์คํ
์ ์ ์ญ ๊ฒ์ ์ค์ ์ ์ ์ฅํ๊ณ ๊ฒ์ํ ์ ์๋ ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค. ์ด๋ฌํ ์ค์ ์ ์ผ๋ฐ์ ์ผ๋ก ๋ฐํ์์ ๊ตฌ์ฑ ํ์ผ์์ ๋ก๋๋๋ฉฐ ๊ฒ์ ์ธ์
๋์ ์ผ์ ํ๊ฒ ์ ์ง๋ฉ๋๋ค.
์ฃผ์ ํน์ง
โข
๊ฐ๋จํ Key-Value ํ์: ํญ์ผ๋ก ๊ตฌ๋ถ๋ ํค-๊ฐ ํฌ๋งท
โข
์ฌ๋ฌ ๋ฐ์ดํฐ ํ์
์ง์: bool, int, float, string ๊ฐ ์ง์
โข
๊ธฐ๋ณธ๊ฐ ์ ๊ณต: ์ค์ ํค๊ฐ ์์ ๊ฒฝ์ฐ ๊ธฐ๋ณธ๊ฐ ์ ๊ณต ๊ฐ๋ฅ
โข
๋ฐํ์ ์ ๊ทผ: ๊ฒ์ ์ด๋์๋ ์์ฝ๊ฒ ์ ๊ทผ ๊ฐ๋ฅ
์์:
// ๊ตฌ์ฑ ํ์ผ ๋ก๋
GameEntry.GetComponent<ConfigComponent>().ReadData("DefaultConfig");
// ์ค์ ๊ฐ ๊ฐ์ ธ์ค๊ธฐ
bool enableTutorial = GameEntry.GetComponent<ConfigComponent>().GetBool("EnableTutorial", true);
float musicVolume = GameEntry.GetComponent<ConfigComponent>().GetFloat("MusicVolume", 0.8f);
string serverAddress = GameEntry.GetComponent<ConfigComponent>().GetString("ServerAddress", "localhost");
C#
๋ณต์ฌ
์ํ ๊ตฌ์ฑ ํ์ผ ํ์:
# Comment line
1 EnableTutorial bool true
2 MusicVolume float 0.8
3 ServerAddress string localhost
Plain Text
๋ณต์ฌ
์ถ์ฒ:
Scripts/Runtime/Config/ConfigComponent.cs 20-407
Scripts/Runtime/Config/DefaultConfigHelper.cs 20-180
Scripts/Runtime/Config/ConfigHelperBase.cs 17-68
Localization System
๋ก์ปฌ๋ผ์ด์ ์ด์
์์คํ
์ ๋ค๊ตญ์ด ํ
์คํธ์ ๋ฆฌ์์ค๋ฅผ ๊ด๋ฆฌํฉ๋๋ค. ์ ํ๋ ์ธ์ด์ ๋ฐ๋ผ ๋ค๋ฅธ ๋ฌธ์์ด ์ฌ์ ์ ๋ก๋ํ์ฌ ์ฌ๋ฌ ์ธ์ด ์ง์์ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค.
์ฃผ์ ํน์ง
โข
๋ค๊ตญ์ด ์ง์
โข
์์คํ
์ธ์ด ์๋ ๊ฐ์ง
โข
๋งค๊ฐ๋ณ์๋ฅผ ํฌํจํ ๋ฌธ์์ด ํฌ๋งท ์ง์
โข
Key-Value ์์ ๋์
๋๋ฆฌ ํ์ผ ๊ตฌ์กฐ
โข
๋ฐํ์ ์ธ์ด ์ ํ ๊ฐ๋ฅ
์์:
// ํ์ฌ ์ธ์ด ์ค์
GameEntry.GetComponent<LocalizationComponent>().Language = Language.English;
// ํ์ฌ ์ธ์ด์ ๋ง๋ ๋์
๋๋ฆฌ ๋ก๋
GameEntry.GetComponent<LocalizationComponent>().ReadData("UI");
// ์ง์ญํ๋ ๋ฌธ์์ด ๊ฐ์ ธ์ค๊ธฐ
string welcomeMessage = GameEntry.GetComponent<LocalizationComponent>().GetString("Welcome");
string greetingMessage = GameEntry.GetComponent<LocalizationComponent>().GetString("Greeting", playerName);
C#
๋ณต์ฌ
์ํ ๋์
๋๋ฆฌ ํ์ผ ํ์:
# Comment line
1 Welcome string Welcome to our game!
2 Greeting string Hello, {0}!
3 Score string Your score: {0}
Plain Text
๋ณต์ฌ
์ถ์ฒ:
Scripts/Runtime/Localization/LocalizationComponent.cs 20-1113
Scripts/Runtime/Localization/DefaultLocalizationHelper.cs 20-238
Scripts/Runtime/Localization/LocalizationHelperBase.cs 17-76
Setting System
์ค์ ์์คํ
์ ๊ฒ์ ์ธ์
๊ฐ์ ์ ์ฅ๋์ด์ผ ํ๋ ์ง์์ ์ธ ํ๋ ์ด์ด ์ค์ ์ ๊ด๋ฆฌํฉ๋๋ค. ์ค์ ์์คํ
์ ์ฝ๊ธฐ๋ฟ ์๋๋ผ ์ฐ๊ธฐ๋ ์ง์ํ๋ค๋ ์ ์์ ๊ตฌ์ฑ ์์คํ
๊ณผ ๋ค๋ฆ
๋๋ค.
์ฃผ์ ํน์ง
โข
๋ค์ํ ๋ฐ์ดํฐ ํ์
์ง์: bool, int, float, string, ์ง๋ ฌํ๋ ๊ฐ์ฒด
โข
์๋ ์ ์ฅ ๋ฐ ๋ก๋ฉ
โข
๊ธฐ๋ณธ๊ฐ ์ ๊ณต
โข
์ฌ๋ฌ ์ ์ฅ ์ต์
: ๊ธฐ๋ณธ ํ์ผ ๊ธฐ๋ฐ ์ ์ฅ ๋๋ PlayerPrefs ๊ธฐ๋ฐ ์ ์ฅ
โข
๊ฐ์ฒด ์ง๋ ฌํ: JSON ์ง๋ ฌํ๋ฅผ ํตํ ๋ณต์กํ ๊ฐ์ฒด ์ ์ฅ ์ง์
์์:
// ์ค์ ๊ฐ ์ฝ๊ธฐ
bool musicEnabled = GameEntry.GetComponent<SettingComponent>().GetBool("MusicEnabled", true);
float volume = GameEntry.GetComponent<SettingComponent>().GetFloat("MusicVolume", 0.8f);
// ์ค์ ๊ฐ ๋ณ๊ฒฝ
GameEntry.GetComponent<SettingComponent>().SetBool("MusicEnabled", false);
GameEntry.GetComponent<SettingComponent>().SetFloat("MusicVolume", 0.5f);
// ๋ณต์กํ ๊ฐ์ฒด ์ ์ฅ
PlayerProfile profile = new PlayerProfile();
GameEntry.GetComponent<SettingComponent>().SetObject("PlayerProfile", profile);
// ๋ณ๊ฒฝ ์ฌํญ ์ ์ฅ
GameEntry.GetComponent<SettingComponent>().Save();
C#
๋ณต์ฌ
โข
๊ธฐ๋ณธ ์ค์ ์์คํ
์ Application.persistentDataPath/GameFrameworkSetting.dat ๊ฒฝ๋ก์ ์๋ ๋ฐ์ด๋๋ฆฌ ํ์ผ์ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํฉ๋๋ค.
โข
PlayerPrefs ํฌํผ๋ Unity์ PlayerPrefs ์์คํ
์ ์ฌ์ฉํฉ๋๋ค.
์ถ์ฒ:
Scripts/Runtime/Setting/SettingComponent.cs 21-322
Scripts/Runtime/Setting/DefaultSettingHelper.cs 19-386
Scripts/Runtime/Setting/DefaultSetting.cs 19-313
Scripts/Runtime/Setting/PlayerPrefsSettingHelper.cs 18-312
Scripts/Runtime/Setting/SettingHelperBase.cs 18-208
Data Management Initialization Process
์๋ ์ํ์ค ๋ค์ด์ด๊ทธ๋จ์ ๋ฐ์ดํฐ ๊ด๋ฆฌ ์ปดํฌ๋ํธ์ ์ด๊ธฐํ ๊ณผ์ ์ ๋ณด์ฌ์ค๋๋ค. ์ด ์ด๊ธฐํ ํ๋ก์ฐ๋ ๋ค ๊ฐ์ง ๋ฐ์ดํฐ ๊ด๋ฆฌ ์ปดํฌ๋ํธ (DataTableComponent, ConfigComponent, LocalizationComponent, SettingComponent)์ ๋ชจ๋ ์ ์ฉ๋ฉ๋๋ค.
์ถ์ฒ:
Scripts/Runtime/DataTable/DataTableComponent.cs 69-124
Scripts/Runtime/Config/ConfigComponent.cs 67-135
Scripts/Runtime/Localization/LocalizationComponent.cs 93-162
Scripts/Runtime/Setting/SettingComponent.cs 45-77
Helper Pattern Implementation
๋ค์ ํ๋ ๋ค์ํ ํฌํผ ์ธํฐํ์ด์ค์ ๊ฑธ์น ๊ณตํต ๋ฉ์๋๋ฅผ ๋น๊ตํ ๊ฒ์
๋๋ค:
Method | DataTableHelper | ConfigHelper | LocalizationHelper | SettingHelper |
ReadData from asset | โ | โ | โ | - |
ReadData from bytes | โ | โ | โ | - |
ParseData from string | โ | โ | โ | - |
ParseData from bytes | โ | โ | โ | - |
ReleaseDataAsset | โ | โ | โ | - |
Load | - | - | - | โ |
Save | - | - | - | โ |
Get/Set values | - | - | - | โ |
ํฌํผ ํจํด์ ํ๋ ์์ํฌ ์ฝ๋๋ฅผ ์์ ํ์ง ์๊ณ ๋ฐ์ดํฐ์ ๋ก๋, ํ์ฑ, ์ ์ฅ ๋ฐฉ์์ ์ปค์คํฐ๋ง์ด์งํ ์ ์๋ ์ผ๊ด๋ ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค.
์ถ์ฒ:
Scripts/Runtime/DataTable/DataTableHelperBase.cs 17-68
Scripts/Runtime/Config/ConfigHelperBase.cs 17-68
Scripts/Runtime/Localization/LocalizationHelperBase.cs 17-76
Scripts/Runtime/Setting/SettingHelperBase.cs 18-208
Customizing Data Management
๊ฐ ๋ฐ์ดํฐ ๊ด๋ฆฌ ์๋ธ์์คํ
์ ํฌํผ ํด๋์ค๋ฅผ ๊ตฌํํจ์ผ๋ก์จ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค.
1.
์ ์ ํ ํฌํผ ๋ฒ ์ด์ค ํด๋์ค๋ฅผ ์์ํ๋ ํด๋์ค ์์ฑ:
โข
DataTableHelperBase
โข
ConfigHelperBase
โข
LocalizationHelperBase
โข
SettingHelperBase
2.
๋ฐ์ดํฐ์ ๋ก๋, ํ์ฑ, ์ ์ฅ ๋ฐฉ์์ ๋ณ๊ฒฝํ๊ธฐ ์ํด ํ์ํ ๋ฉ์๋๋ฅผ ๊ตฌํ
3.
Unity ์ธ์คํํฐ ๋๋ ์ฝ๋์์ ์ปดํฌ๋ํธ์ ์ปค์คํ
ํฌํผ ํ ๋น
โ ์ด๋ฅผ ํตํด ์ปค์คํ
๋ฐ์ดํฐ ํฌ๋งท ์ง์, ๋ค์ํ ์ ์ฅ ์๋ฃจ์
, ์ธ๋ถ ์๋น์ค์์ ํตํฉ ๋ฑ์ ํ๋ ์์ํฌ ์ฝ๋๋ฅผ ์์ ํ์ง ์๊ณ ๋ ๊ตฌํํ ์ ์์ต๋๋ค.
Best Practices
โข
๋ฐ์ดํฐ ํ
์ด๋ธ ๊ตฌ์ฑ: ๋ฐ์ดํฐ ํ
์ด๋ธ์ ์ฌ๋ฐ๋ฅธ ์คํค๋ง๋ฅผ ๋ง๋ค๊ณ ์ผ๊ด์ฑ์ ์ ์งํ์ธ์.
โข
ํ์
์์ ์ ๊ทผ ์ฌ์ฉ: ๊ฐ๋ฅํ ๊ฒฝ์ฐ ํญ์ ํ์
์์ ํ ๋ฐ์ดํฐ ์ ๊ทผ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ธ์.
โข
๋ก๋ฉ ์คํจ ์ฒ๋ฆฌ: ๋ฐ์ดํฐ ๋ก๋ฉ ์ฑ๊ณต ์ฌ๋ถ๋ฅผ ํญ์ ํ์ธํ๊ณ , ๋์ฒด ๋ฉ์ปค๋์ฆ์ ์ ๊ณตํ์ธ์.
โข
๋ก์ปฌ๋ผ์ด์ ์ด์
์ํฌํ๋ก์ฐ: ์ธ์ด ๋๊ธฐํ๋ฅผ ์ ์งํ๊ธฐ ์ํด ๋ก์ปฌ๋ผ์ด์ ์ด์
ํค ์ถ๊ฐ/์
๋ฐ์ดํธ์ ๋ํ ์ํฌํ๋ก์ฐ๋ฅผ ๊ตฌ์ถํ์ธ์.
โข
๋ฐ์ดํฐ ๊ฒ์ฆ: ๋ฐ์ดํฐ ํ
์ด๋ธ๊ณผ ์ค์ ํ์ผ์ ๋ํ ๊ฒ์ฆ์ ๊ตฌํํ์ฌ ์ค๋ฅ๋ฅผ ์กฐ๊ธฐ์ ๋ฐ๊ฒฌํ์ธ์.
โข
์ค์ ๋ฐฑ์
: ํ๋ ์ด์ด ์ค์ ๋ฐ์ดํฐ ์์ค์ ๋ฐฉ์งํ๊ธฐ ์ํด ๋ฐฑ์
๋ฉ์ปค๋์ฆ์ ๊ณ ๋ คํ์ธ์.
โข
๋ฐํ์ ๋ก๋ฉ ์ต์ํ: ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๊ณผ ๋ก๋ฉ ์๊ฐ์ ์ค์ด๊ธฐ ์ํด ๋ฐํ์์๋ ํ์ํ ๋ฐ์ดํฐ๋ง ๋ก๋ํ์ธ์.







