add config map
This commit is contained in:
@@ -22,8 +22,13 @@ namespace ModelRenderer.Scripts.GameData
|
||||
}
|
||||
|
||||
public Dictionary<uint, DATA_TYPE> essence_id_data_type_map = new Dictionary<uint, DATA_TYPE>();
|
||||
public Dictionary<int, uint> essence_index_id_map = new Dictionary<int, uint>();
|
||||
public Dictionary<uint, object> essence_id_data_map = new Dictionary<uint, object>();
|
||||
|
||||
public Dictionary<uint, DATA_TYPE> config_id_data_type_map = new Dictionary<uint, DATA_TYPE>();
|
||||
public Dictionary<int, uint> config_index_id_map = new Dictionary<int, uint>();
|
||||
public Dictionary<uint, object> config_id_data_map = new Dictionary<uint, object>();
|
||||
|
||||
public EQUIPMENT_ADDON[] equipment_addon_array = new EQUIPMENT_ADDON[0];
|
||||
public WEAPON_MAJOR_TYPE[] weapon_major_type_array = new WEAPON_MAJOR_TYPE[0];
|
||||
public WEAPON_SUB_TYPE[] weapon_sub_type_array = new WEAPON_SUB_TYPE[0];
|
||||
@@ -673,17 +678,47 @@ namespace ModelRenderer.Scripts.GameData
|
||||
essence_id_data_type_map[id] = type;
|
||||
break;
|
||||
|
||||
case ID_SPACE.ID_SPACE_CONFIG:
|
||||
config_id_data_type_map[id] = type;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public uint get_data_id(ID_SPACE idSpace, int index, ref DATA_TYPE dataType)
|
||||
{
|
||||
uint id = 0;
|
||||
switch (idSpace)
|
||||
{
|
||||
case ID_SPACE.ID_SPACE_ESSENCE:
|
||||
id = essence_index_id_map[index];
|
||||
dataType = essence_id_data_type_map[id];
|
||||
break;
|
||||
case ID_SPACE.ID_SPACE_CONFIG:
|
||||
id = config_index_id_map[index];
|
||||
dataType = config_id_data_type_map[id];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
void add_id_data(ID_SPACE idSpace, uint id, object data)
|
||||
{
|
||||
switch (idSpace)
|
||||
{
|
||||
case ID_SPACE.ID_SPACE_ESSENCE:
|
||||
essence_id_data_map[id] = data;
|
||||
essence_index_id_map[essence_index_id_map.Count] = id;
|
||||
break;
|
||||
|
||||
case ID_SPACE.ID_SPACE_CONFIG:
|
||||
config_id_data_map[id] = data;
|
||||
config_index_id_map[config_index_id_map.Count] = id;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -691,17 +726,51 @@ namespace ModelRenderer.Scripts.GameData
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Get the number of data in a given ID space. (For example: Number of essence data, number of config data, etc.)</summary>
|
||||
public int get_data_num(ID_SPACE idSpace)
|
||||
{
|
||||
switch(idSpace)
|
||||
{
|
||||
case ID_SPACE.ID_SPACE_ESSENCE:
|
||||
return essence_id_data_type_map.Count;
|
||||
|
||||
// case ID_SPACE.ID_SPACE_ADDON:
|
||||
// return addon_id_data_type_map.Count;
|
||||
|
||||
// case ID_SPACE.ID_SPACE_TALK:
|
||||
// return talk_id_index_map.Count;
|
||||
|
||||
// case ID_SPACE.ID_SPACE_FACE:
|
||||
// return face_id_index_map.Count;
|
||||
|
||||
// case ID_SPACE.ID_SPACE_RECIPE:
|
||||
// return recipe_id_index_map.Count;
|
||||
|
||||
case ID_SPACE.ID_SPACE_CONFIG:
|
||||
return config_id_data_type_map.Count;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public DATA_TYPE get_data_type(uint id, ID_SPACE idspace)
|
||||
{
|
||||
switch (idspace)
|
||||
{
|
||||
case ID_SPACE.ID_SPACE_ESSENCE:
|
||||
if (essence_id_data_type_map.TryGetValue(id, out DATA_TYPE type))
|
||||
if (essence_id_data_type_map.TryGetValue(id, out DATA_TYPE essenceType))
|
||||
{
|
||||
return type;
|
||||
return essenceType;
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_SPACE.ID_SPACE_CONFIG:
|
||||
if (config_id_data_type_map.TryGetValue(id, out DATA_TYPE configType))
|
||||
{
|
||||
return configType;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -710,14 +779,23 @@ namespace ModelRenderer.Scripts.GameData
|
||||
|
||||
public object get_data_ptr(uint id, ID_SPACE idspace)
|
||||
{
|
||||
object data = null;
|
||||
switch (idspace)
|
||||
{
|
||||
case ID_SPACE.ID_SPACE_ESSENCE:
|
||||
if (essence_id_data_map.TryGetValue(id, out object data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
break;
|
||||
if (essence_id_data_map.TryGetValue(id, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ID_SPACE.ID_SPACE_CONFIG:
|
||||
if (config_id_data_map.TryGetValue(id, out data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user