Removed unnecessary API call for mob names
Added tails to mini umas
This commit is contained in:
@@ -134,6 +134,18 @@ public class UmaContainerCharacter : UmaContainer
|
||||
Head.SetActive(false); //for debugging
|
||||
}
|
||||
|
||||
//MergeHair
|
||||
if (IsMini && Hair)
|
||||
{
|
||||
var hairskin = Hair.GetComponentInChildren<SkinnedMeshRenderer>();
|
||||
MergeBone(hairskin, bodyBones, ref emptyBones);
|
||||
while (Hair.transform.childCount > 0)
|
||||
{
|
||||
var child = Hair.transform.GetChild(0);
|
||||
child.SetParent(transform);
|
||||
}
|
||||
Hair.SetActive(false); //for debugging
|
||||
}
|
||||
|
||||
//MergeTail
|
||||
if (Tail)
|
||||
@@ -717,11 +729,12 @@ public class UmaContainerCharacter : UmaContainer
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
{
|
||||
//only for mini umas
|
||||
if (head.name.Contains("mchr"))
|
||||
{
|
||||
if (r.name.Contains("Hair"))
|
||||
{
|
||||
Tail = head;
|
||||
Hair = head;
|
||||
}
|
||||
if (r.name == "M_Face")
|
||||
{
|
||||
|
||||
@@ -182,3 +182,10 @@ public enum UmaFileType
|
||||
collectevent,
|
||||
ratingrace
|
||||
}
|
||||
|
||||
public enum TranslationTables
|
||||
{
|
||||
Costumes = 5,
|
||||
UmaNames = 6,
|
||||
MobNames = 59,
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class UmaDatabaseController
|
||||
|
||||
static List<DataRow> ReadMobCharaMaster(SqliteConnection conn)
|
||||
{
|
||||
return ReadMaster(conn, "SELECT * FROM mob_data");
|
||||
return ReadMaster(conn, "SELECT * FROM mob_data M,(SELECT D.'index' charaid,D.'text' charaname FROM text_data D WHERE id like 59) T WHERE M.mob_id like T.charaid");
|
||||
}
|
||||
|
||||
static List<DataRow> ReadMaster(SqliteConnection conn, string sql)
|
||||
|
||||
@@ -542,6 +542,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
DataRow charaData = umaContainer.CharaData;
|
||||
umaContainer.IsMini = true;
|
||||
bool isGeneric = umaContainer.IsGeneric = costumeId.Length >= 4;
|
||||
int tailId = Convert.ToInt32(charaData["tail_model_id"]);
|
||||
string skin = charaData["skin"].ToString(),
|
||||
height = charaData["height"].ToString(),
|
||||
socks = charaData["socks"].ToString(),
|
||||
@@ -612,7 +613,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//Load Hair
|
||||
//Load Hair (don't know why loadhead is used)
|
||||
umaContainer.LoadHead(asset);
|
||||
}
|
||||
|
||||
@@ -629,6 +630,32 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
umaContainer.LoadHead(asset);
|
||||
}
|
||||
|
||||
if (tailId != 0)
|
||||
{
|
||||
string tailName = $"mtail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||
string tailPath = $"3d/chara/mini/tail/{tailName}/";
|
||||
string tailPfb = tailPath + $"pfb_{tailName}";
|
||||
asset = null;
|
||||
Main.AbList.TryGetValue(tailPfb, out asset);
|
||||
if (asset != null)
|
||||
{
|
||||
foreach (var asset2 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_{id.ToString().PadLeft(4,'0')}")))
|
||||
{
|
||||
umaContainer.LoadTextures(asset2);
|
||||
}
|
||||
|
||||
umaContainer.LoadTail(asset);
|
||||
|
||||
//Load Physics
|
||||
var asset1 = Main.AbList[$"{tailPath}clothes/pfb_{tailName}_cloth00"];
|
||||
umaContainer.LoadPhysics(asset1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("no tail");
|
||||
}
|
||||
}
|
||||
|
||||
umaContainer.MergeModel();
|
||||
var matList = new List<MeshRenderer>(umaContainer.GetComponentsInChildren<MeshRenderer>());
|
||||
var eyemat = matList.FirstOrDefault(a => a.gameObject.name.Equals("M_Eye"));
|
||||
|
||||
@@ -23,6 +23,13 @@ public class UmaViewerMain : MonoBehaviour
|
||||
public List<UmaDatabaseEntry> AbEffect = new List<UmaDatabaseEntry>();
|
||||
public List<UmaDatabaseEntry> CostumeList = new List<UmaDatabaseEntry>();
|
||||
|
||||
public Dictionary<TranslationTables, Dictionary<int, string>> Translations = new Dictionary<TranslationTables, Dictionary<int, string>>()
|
||||
{
|
||||
{TranslationTables.UmaNames, new Dictionary<int,string>() },
|
||||
//{TranslationTables.Costumes, new Dictionary<int,string>() }, //unused (can't correlate costume model IDs with names without more info from the database)
|
||||
{TranslationTables.MobNames, new Dictionary<int,string>() },
|
||||
};
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
@@ -45,15 +52,12 @@ public class UmaViewerMain : MonoBehaviour
|
||||
{
|
||||
if (AbList == null) yield break;
|
||||
int loadingStep = 0;
|
||||
int loadingStepsTotal = 11;
|
||||
int loadingStepsTotal = 10;
|
||||
var UmaCharaData = UmaDatabaseController.Instance.CharaData;
|
||||
var MobCharaData = UmaDatabaseController.Instance.MobCharaData;
|
||||
var loadingUI = UmaSceneController.instance;
|
||||
|
||||
Dictionary<int, string> enUmaNames = new Dictionary<int, string>();
|
||||
Dictionary<int, string> mobNames = new Dictionary<int, string>();
|
||||
|
||||
//Main chara names (En only)
|
||||
//EN Translations
|
||||
loadingUI.LoadingProgressChange(loadingStep++, loadingStepsTotal, "Downloading Translations");
|
||||
if (Config.Instance.Language == Language.En)
|
||||
{
|
||||
@@ -64,8 +68,9 @@ public class UmaViewerMain : MonoBehaviour
|
||||
try
|
||||
{
|
||||
var translations = JObject.Parse(txt);
|
||||
enUmaNames = translations["6"].ToObject<Dictionary<int, string>>();
|
||||
mobNames = translations["59"].ToObject<Dictionary<int, string>>();
|
||||
//Translations[TranslationTables.Costumes] = translations[((int)TranslationTables.Costumes).ToString()].ToObject<Dictionary<int, string>>();
|
||||
Translations[TranslationTables.UmaNames] = translations[((int)TranslationTables.UmaNames).ToString()].ToObject<Dictionary<int, string>>();
|
||||
Translations[TranslationTables.MobNames] = translations[((int)TranslationTables.MobNames).ToString()].ToObject<Dictionary<int, string>>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -74,22 +79,6 @@ public class UmaViewerMain : MonoBehaviour
|
||||
});
|
||||
}
|
||||
|
||||
//Mob names (EN & JP)
|
||||
loadingUI.LoadingProgressChange(loadingStep++, loadingStepsTotal, "Downloading Mob Data");
|
||||
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicMobDataInfo", txt =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(txt)) return;
|
||||
foreach (var item in JArray.Parse(txt))
|
||||
{
|
||||
//names missing from translation are added
|
||||
int mobId = (int)item["mobId"];
|
||||
if (!mobNames.ContainsKey(mobId))
|
||||
{
|
||||
mobNames.Add(mobId, item["mobName"].ToString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.Instance.WorkMode == WorkMode.Standalone)
|
||||
{
|
||||
var umaIcons = UmaCharaData.Select(item => AbList.TryGetValue($"chara/chr{item["id"]}/chr_icon_{item["id"]}", out UmaDatabaseEntry entry) ? entry : null).Where(entry => entry != null);
|
||||
@@ -110,7 +99,7 @@ public class UmaViewerMain : MonoBehaviour
|
||||
Characters.Add(new CharaEntry()
|
||||
{
|
||||
Name = item["charaname"].ToString(),
|
||||
EnName = enUmaNames.ContainsKey(id) ? enUmaNames[id] : "",
|
||||
EnName = Translations[TranslationTables.UmaNames].ContainsKey(id) ? Translations[TranslationTables.UmaNames][id] : "",
|
||||
Icon = UmaViewerBuilder.Instance.LoadCharaIcon(id.ToString()),
|
||||
Id = id,
|
||||
ThemeColor = "#" + item["ui_nameplate_color_1"].ToString()
|
||||
@@ -128,10 +117,10 @@ public class UmaViewerMain : MonoBehaviour
|
||||
}
|
||||
|
||||
var id = Convert.ToInt32(item["mob_id"]);
|
||||
var name = mobNames.ContainsKey(id) ? mobNames[id] : "";
|
||||
MobCharacters.Add(new CharaEntry()
|
||||
{
|
||||
Name = string.IsNullOrEmpty(name)? $"Mob_{id}" : name,
|
||||
Name = item["charaname"].ToString(),
|
||||
EnName = Translations[TranslationTables.MobNames].ContainsKey(id) ? Translations[TranslationTables.MobNames][id] : "",
|
||||
Icon = UmaViewerBuilder.Instance.LoadMobCharaIcon(id.ToString()),
|
||||
Id = id,
|
||||
IsMob = true
|
||||
|
||||
@@ -134,7 +134,7 @@ PlayerSettings:
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 2.1.21
|
||||
bundleVersion: 2.1.22
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
|
||||
Reference in New Issue
Block a user