Project_WL/Assets/Editor/GetServerTables.cs

61 lines
4.1 KiB
C#

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class GetServerTables
{
[MenuItem("Tools/Get ServerTables")]
public static void Get_ServerTables()
{
Get_ServerTable("MissionList", new List<string> { "b_RepeatMission" });
Get_ServerTable("ItemList", new List<string> { "n_ItemName", "n_ItemDesc", "s_ItemIcon", "n_ItemOrder", "b_isSaveModeShow", "n_LinkPointID1", "n_LinkPointID2", "n_LinkPointID3", "n_LinkPointID4", "n_LinkPointID5" });
Get_ServerTable("RandomBag", new List<string> { "e_ItemType", "exception" });
Get_ServerTable("EquipItemList", new List<string> { "s_ItemPrefab_LH", "s_ItemPrefab_RH", "e_EquipAttribute", "e_AbilityType1", "e_AbilityType2", "e_AbilityType3", "n_AbilityValue1", "n_AbilityValue2", "n_AbilityValue3" });
Get_ServerTable("EquipSmelting", new List<string> { "n_IncreaseValueRate" });
Get_ServerTable("SkillList", new List<string> { "exception", "n_MP", "f_CoolTime", "f_SkillRange", "s_Animation", "s_NextAnimation", "f_CastingTime", "e_SkillTarget", "n_DefaultValue", "f_LevelPerValue", "f_BalanceConstant", "e_SkillExtraType", "f_ExtraValue1", "f_ExtraValue1_비고", "f_ExtraValue2", "f_ExtraValue2_비고", "f_ExtraValue3", "f_ExtraValue3_비고", "f_ExtraValue4", "f_ExtraValue4_비고" });
Get_ServerTable("GlobalValue", new List<string> { "exception" });
Get_ServerTable("PetList", new List<string> { "e_AttackType", "n_DefaultATK", "n_DefaultDEF", "n_DefaultM_DEF", "n_DefaultHP", "f_PetStatRate", "f_AttackRange", "s_PetAttackPrefab", "f_PetMoveSPD", "f_PetAttackSPD", "n_PetActiveSkill", "n_PetPassiveSkill", "s_PetPrefab", "f_Scale", "f_UIScale", "f_UIOffSet_y" });
Get_ServerTable("OptionConfig", new List<string> { "e_OptionType", "f_ExtraValue1", "f_ExtraValue2", "f_ExtraValue3", "f_ExtraValue4" });
Get_ServerTable("CollectionList", new List<string> { "e_FirstRewardType", "n_FirstRewardValue", "n_FirstRewardCount", "e_RepeatRewardType", "n_RepeatRewardValue", "n_RepeatRewardCount" });
Get_ServerTable("GachaConfig", new List<string> { "n_Title", "s_Banner" });
Get_ServerTable("BattleMapConfig", new List<string> { "s_Scene", "s_BGM", "n_MapName", "n_MapDesc", "s_MapIcon", "n_Portals" });
Get_ServerTable("CostumeList", new List<string> { "n_CostumeDesc", "s_Image", "s_Prefab", "exception" });
Get_ServerTable("WorkerList", new List<string> { "s_Prefab", "f_Scale", "f_UIScale", "f_MoveSpeed", "f_SeekTimeDelay" });
Get_ServerTable("ClassConfig", new List<string> { "s_AnimationController", "s_JobIcon", "s_WeaponLHPrefab", "n_WeaponLHIndex", "s_WeaponRHPrefab", "n_WeaponRHIndex", "e_BattleType", "f_Scale", "f_AttackRange", "f_AttackSPD", "f_MoveSPD", "e_MainStatType", "n_DefaultHP", "n_DefaultMP", "n_ExtraSkill", "n_AcquiredSkill1", "n_AcquiredSkill2", "n_AcquiredSkill3" });
Get_ServerTable("BreakingLimit", new List<string> { "f_Monster_DMG_Multiplier", "f_Boss_DMG_Multiplier", "f_ALL_STAT_Multiplier" });
Get_ServerTable("ShopItemList", new List<string> { "n_ShopTab", "n_TabName", "exception", "n_ShopSubTab", "n_SubTabName", "s_Banner" });
}
static void Get_ServerTable(string path, List<string> except)
{
// JSON 파일 불러오기
var table = AssetDatabase.LoadAssetAtPath<TextAsset>($"Assets/ResWork/Table/Export/{path}.json");
if (table == null)
{
Debug.LogError($"파일을 찾을 수 없습니다: {path}.json");
return;
}
// JSON 파싱
var jArray = JArray.Parse(table.text);
// 제외할 필드 삭제
foreach (var item in jArray)
foreach (var field in except)
item[field]?.Parent?.Remove();
// 경로 설정 및 디렉토리 보장
string savePath = $"Assets/ResWork/Table/Server/server_{path}.txt";
Directory.CreateDirectory(Path.GetDirectoryName(savePath));
// 저장
File.WriteAllText(savePath, jArray.ToString(Formatting.Indented));
// 저장된 파일 Unity에 적용
AssetDatabase.Refresh();
}
}