This commit is contained in:
CroakFang
2023-02-15 00:50:19 +08:00
parent a7f4f8b326
commit 6f416ecbce
4 changed files with 145 additions and 115 deletions
@@ -124,6 +124,7 @@ public class CostumeEntry
{ {
public string Id; public string Id;
public int CharaId; public int CharaId;
public string DressName;
public int BodyType; public int BodyType;
public int BodyTypeSub; public int BodyTypeSub;
public Sprite Icon; public Sprite Icon;
@@ -44,6 +44,7 @@ public class UmaDatabaseController
public IEnumerable<UmaDatabaseEntry> MetaEntries; public IEnumerable<UmaDatabaseEntry> MetaEntries;
public IEnumerable<DataRow> CharaData; public IEnumerable<DataRow> CharaData;
public IEnumerable<DataRow> MobCharaData;
public IEnumerable<FaceTypeData> FaceTypeData; public IEnumerable<FaceTypeData> FaceTypeData;
public IEnumerable<DataRow> LiveData; public IEnumerable<DataRow> LiveData;
public IEnumerable<DataRow> DressData; public IEnumerable<DataRow> DressData;
@@ -73,7 +74,8 @@ public class UmaDatabaseController
MetaEntries = ReadMeta(metaDb); MetaEntries = ReadMeta(metaDb);
masterDb.Open(); masterDb.Open();
CharaData = ReadMaster(masterDb); CharaData = ReadCharaMaster(masterDb);
MobCharaData = ReadMobCharaMaster(masterDb);
FaceTypeData = ReadFaceTypeData(masterDb); FaceTypeData = ReadFaceTypeData(masterDb);
LiveData = ReadAllLiveData(masterDb); LiveData = ReadAllLiveData(masterDb);
DressData = ReadAllDressData(masterDb); DressData = ReadAllDressData(masterDb);
@@ -119,10 +121,20 @@ public class UmaDatabaseController
return entries; return entries;
} }
static IEnumerable<DataRow> ReadMaster(SqliteConnection conn) static IEnumerable<DataRow> ReadCharaMaster(SqliteConnection conn)
{
return ReadMaster(conn, "SELECT * FROM chara_data C,(SELECT D.'index' charaid,D.'text' charaname FROM text_data D WHERE id like 6) T WHERE C.id like T.charaid");
}
static IEnumerable<DataRow> ReadMobCharaMaster(SqliteConnection conn)
{
return ReadMaster(conn, "SELECT * FROM chara_data C,(SELECT D.'index' charaid,D.'text' charaname FROM text_data D WHERE id like 6) T WHERE C.id like T.charaid");
}
static IEnumerable<DataRow> ReadMaster(SqliteConnection conn,string sql)
{ {
SqliteCommand sqlite_cmd = conn.CreateCommand(); SqliteCommand sqlite_cmd = conn.CreateCommand();
sqlite_cmd.CommandText = "SELECT * FROM chara_data C,(SELECT D.'index' charaid,D.'text' charaname FROM text_data D WHERE id like 6) T WHERE C.id like T.charaid"; sqlite_cmd.CommandText = sql;
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader(); SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
var result = new DataTable(); var result = new DataTable();
result.Load(sqlite_datareader); result.Load(sqlite_datareader);
@@ -158,43 +170,24 @@ public class UmaDatabaseController
static IEnumerable<DataRow> ReadAllLiveData(SqliteConnection conn) static IEnumerable<DataRow> ReadAllLiveData(SqliteConnection conn)
{ {
SqliteCommand sqlite_cmd = conn.CreateCommand(); return ReadMaster(conn, $"SELECT * FROM live_data L,(SELECT D.'index' songid,D.'text' songname FROM text_data D WHERE id like 16) T WHERE L.music_id like T.songid");
sqlite_cmd.CommandText =
$"SELECT * FROM live_data L,(SELECT D.'index' songid,D.'text' songname FROM text_data D WHERE id like 16) T WHERE L.music_id like T.songid";
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
var result = new DataTable();
result.Load(sqlite_datareader);
var temp = result.Rows.GetEnumerator();
while (temp.MoveNext())
{
yield return (DataRow)temp.Current;
}
} }
static IEnumerable<DataRow> ReadAllDressData(SqliteConnection conn) static IEnumerable<DataRow> ReadAllDressData(SqliteConnection conn)
{ {
SqliteCommand sqlite_cmd = conn.CreateCommand(); return ReadMaster(conn, $"SELECT * FROM dress_data C,(SELECT D.'index' dressid,D.'text' dressname FROM text_data D WHERE id like 14) T WHERE C.id like T.dressid");
sqlite_cmd.CommandText =
$"SELECT * FROM dress_data";
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
var result = new DataTable();
result.Load(sqlite_datareader);
var temp = result.Rows.GetEnumerator();
while (temp.MoveNext())
{
yield return (DataRow)temp.Current;
}
} }
public static DataRow ReadCharaData(int id) public static DataRow ReadCharaData(int id)
{ {
SqliteCommand sqlite_cmd = instance.masterDb.CreateCommand(); foreach (var chara in instance.CharaData)
sqlite_cmd.CommandText = $"SELECT * FROM chara_data WHERE id LIKE {id}"; {
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader(); if (Convert.ToInt32(chara["id"]) == id)
var result = new DataTable(); {
result.Load(sqlite_datareader); return chara;
DataRow row = result.Rows[0]; }
return row; }
return null;
} }
public void CloseAllConnection() public void CloseAllConnection()
+1
View File
@@ -94,6 +94,7 @@ public class UmaViewerMain : MonoBehaviour
if (costume != null) if (costume != null)
{ {
costume.CharaId = Convert.ToInt32(data["chara_id"]); costume.CharaId = Convert.ToInt32(data["chara_id"]);
costume.DressName = data["dressname"].ToString();
costume.BodyType = Convert.ToInt32(data["body_type"]); costume.BodyType = Convert.ToInt32(data["body_type"]);
costume.BodyTypeSub = Convert.ToInt32(data["body_type_sub"]); costume.BodyTypeSub = Convert.ToInt32(data["body_type_sub"]);
} }
+110 -75
View File
@@ -194,9 +194,9 @@ public class UmaViewerUI : MonoBehaviour
LoadedAssetCount++; LoadedAssetCount++;
string filePath = entry.FilePath; string filePath = entry.FilePath;
var container = Instantiate(UmaContainerAssetsPrefab, LoadedAssetsPanel).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerAssetsPrefab, LoadedAssetsPanel).GetComponent<UmaUIContainer>();
container.Name = Path.GetFileName(entry.Name); container.Name = Path.GetFileName(entry.Name);
container.Button.onClick.AddListener(() => {Process.Start("explorer.exe", "/select," + filePath);}); container.Button.onClick.AddListener(() => { Process.Start("explorer.exe", "/select," + filePath); });
LoadedAssetsPanel.sizeDelta = new Vector2(0, LoadedAssetCount * 35); LoadedAssetsPanel.sizeDelta = new Vector2(0, LoadedAssetCount * 35);
} }
@@ -214,14 +214,16 @@ public class UmaViewerUI : MonoBehaviour
{ {
var container1 = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>(); var container1 = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
container1.Name = container1.name = "Generic"; container1.Name = container1.name = "Generic";
container1.Button.onClick.AddListener(() => { container1.Button.onClick.AddListener(() =>
{
HighlightChildImage(AnimationSetList.content, container1); HighlightChildImage(AnimationSetList.content, container1);
ListAnimations(-1, false); ListAnimations(-1, false);
}); });
var container2 = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>(); var container2 = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
container2.Name = container2.name = "Tail"; container2.Name = container2.name = "Tail";
container2.Button.onClick.AddListener(() => { container2.Button.onClick.AddListener(() =>
{
HighlightChildImage(AnimationSetList.content, container2); HighlightChildImage(AnimationSetList.content, container2);
ListAnimations(-2, false); ListAnimations(-2, false);
}); });
@@ -232,7 +234,8 @@ public class UmaViewerUI : MonoBehaviour
var container3 = Instantiate(UmaContainerPrefab, CharactersList.content).GetComponent<UmaUIContainer>(); var container3 = Instantiate(UmaContainerPrefab, CharactersList.content).GetComponent<UmaUIContainer>();
container3.Name = container3.name = chara.Id + " " + chara.Name; container3.Name = container3.name = chara.Id + " " + chara.Name;
container3.Button.onClick.AddListener(() => { container3.Button.onClick.AddListener(() =>
{
HighlightChildImage(CharactersList.content, container3); HighlightChildImage(CharactersList.content, container3);
ListCostumes(charaInstance, false); ListCostumes(charaInstance, false);
}); });
@@ -245,7 +248,8 @@ public class UmaViewerUI : MonoBehaviour
var container4 = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>(); var container4 = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
container4.Name = container4.name = chara.Id + " " + chara.Name; container4.Name = container4.name = chara.Id + " " + chara.Name;
container4.Button.onClick.AddListener(() => { container4.Button.onClick.AddListener(() =>
{
HighlightChildImage(AnimationSetList.content, container4); HighlightChildImage(AnimationSetList.content, container4);
ListAnimations(charaInstance.Id, false); ListAnimations(charaInstance.Id, false);
}); });
@@ -262,7 +266,8 @@ public class UmaViewerUI : MonoBehaviour
{ {
var container1 = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>(); var container1 = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
container1.Name = container1.name = "General"; container1.Name = container1.name = "General";
container1.Button.onClick.AddListener(() => { container1.Button.onClick.AddListener(() =>
{
HighlightChildImage(MiniAnimationSetList.content, container1); HighlightChildImage(MiniAnimationSetList.content, container1);
ListAnimations(-1, true); ListAnimations(-1, true);
}); });
@@ -272,7 +277,8 @@ public class UmaViewerUI : MonoBehaviour
var charaInstance = chara; var charaInstance = chara;
var container2 = Instantiate(UmaContainerPrefab, MiniCharactersList.content).GetComponent<UmaUIContainer>(); var container2 = Instantiate(UmaContainerPrefab, MiniCharactersList.content).GetComponent<UmaUIContainer>();
container2.Name = container2.name = chara.Id + " " + chara.Name; container2.Name = container2.name = chara.Id + " " + chara.Name;
container2.Button.onClick.AddListener(() => { container2.Button.onClick.AddListener(() =>
{
HighlightChildImage(MiniCharactersList.content, container2); HighlightChildImage(MiniCharactersList.content, container2);
ListCostumes(charaInstance, true); ListCostumes(charaInstance, true);
}); });
@@ -285,7 +291,8 @@ public class UmaViewerUI : MonoBehaviour
var container3 = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>(); var container3 = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
container3.Name = container3.name = chara.Id + " " + chara.Name; container3.Name = container3.name = chara.Id + " " + chara.Name;
container3.Button.onClick.AddListener(() => { container3.Button.onClick.AddListener(() =>
{
HighlightChildImage(MiniAnimationSetList.content, container3); HighlightChildImage(MiniAnimationSetList.content, container3);
ListAnimations(charaInstance.Id, true); ListAnimations(charaInstance.Id, true);
}); });
@@ -302,9 +309,9 @@ public class UmaViewerUI : MonoBehaviour
{ {
foreach (FacialMorph morph in targetMorph) foreach (FacialMorph morph in targetMorph)
{ {
if(morph is FacialOtherMorph extraMorph) if (morph is FacialOtherMorph extraMorph)
{ {
foreach(var prop in extraMorph.BindProperties) foreach (var prop in extraMorph.BindProperties)
{ {
var container = Instantiate(UmaContainerSliderPrefab, TargetList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerSliderPrefab, TargetList.content).GetComponent<UmaUIContainer>();
container.Name = $"{morph.locator.name}({prop.Type})"; container.Name = $"{morph.locator.name}({prop.Type})";
@@ -323,7 +330,7 @@ public class UmaViewerUI : MonoBehaviour
break; break;
case BindProperty.BindType.EyeSelect: case BindProperty.BindType.EyeSelect:
container.Slider.wholeNumbers = true; container.Slider.wholeNumbers = true;
container.Slider.maxValue = prop.BindPrefab.Count/2 - 1; container.Slider.maxValue = prop.BindPrefab.Count / 2 - 1;
container.Slider.minValue = 0; container.Slider.minValue = 0;
break; break;
case BindProperty.BindType.Enable: case BindProperty.BindType.Enable:
@@ -342,9 +349,10 @@ public class UmaViewerUI : MonoBehaviour
container.Slider.minValue = 0; container.Slider.minValue = 0;
break; break;
} }
container.Slider.onValueChanged.AddListener((a) => { container.Slider.onValueChanged.AddListener((a) =>
{
target.ChangeMorphWeight(prop, a); target.ChangeMorphWeight(prop, a);
if(prop.Type == BindProperty.BindType.Enable&& morph.name.Contains("Manga")) if (prop.Type == BindProperty.BindType.Enable && morph.name.Contains("Manga"))
{ {
target.ChangeMorphWeight(target.EyeMorphs[42], container.Slider.value > 0 ? 1 : 0); target.ChangeMorphWeight(target.EyeMorphs[42], container.Slider.value > 0 ? 1 : 0);
target.ChangeMorphWeight(target.EyeMorphs[43], container.Slider.value > 0 ? 1 : 0); target.ChangeMorphWeight(target.EyeMorphs[43], container.Slider.value > 0 ? 1 : 0);
@@ -408,12 +416,12 @@ public class UmaViewerUI : MonoBehaviour
{ {
mat.mainTextureOffset = new Vector2(0.25f * (val % 4), -0.25f * (val / 4)); mat.mainTextureOffset = new Vector2(0.25f * (val % 4), -0.25f * (val / 4));
} }
else if(type == 1) else if (type == 1)
{ {
var vector = mat.GetVector("_UVOffset"); var vector = mat.GetVector("_UVOffset");
mat.SetVector("_UVOffset", new Vector4(0.25f * (val % 4), -0.25f * (val / 4), vector.z, vector.w)); mat.SetVector("_UVOffset", new Vector4(0.25f * (val % 4), -0.25f * (val / 4), vector.z, vector.w));
} }
else if(type == 2) else if (type == 2)
{ {
var vector = mat.GetVector("_UVOffset"); var vector = mat.GetVector("_UVOffset");
mat.SetVector("_UVOffset", new Vector4(vector.x, vector.y, 0.25f * (val % 4), -0.25f * (val / 4))); mat.SetVector("_UVOffset", new Vector4(vector.x, vector.y, 0.25f * (val % 4), -0.25f * (val / 4)));
@@ -430,8 +438,8 @@ public class UmaViewerUI : MonoBehaviour
public void UpdateFacialPanels() public void UpdateFacialPanels()
{ {
if(currentFaceDrivenKeyTarget) if (currentFaceDrivenKeyTarget)
LoadFacialPanels(currentFaceDrivenKeyTarget); LoadFacialPanels(currentFaceDrivenKeyTarget);
} }
public void LoadEmotionPanels(FaceEmotionKeyTarget target) public void LoadEmotionPanels(FaceEmotionKeyTarget target)
@@ -443,7 +451,7 @@ public class UmaViewerUI : MonoBehaviour
if (target == null) return; if (target == null) return;
foreach(var emotion in target.FaceEmotionKey) foreach (var emotion in target.FaceEmotionKey)
{ {
if (emotion.label == "Base") if (emotion.label == "Base")
{ {
@@ -464,10 +472,11 @@ public class UmaViewerUI : MonoBehaviour
{ {
var liveInstance = live; var liveInstance = live;
var container = Instantiate(UmaContainerLivePrefab, LiveList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerLivePrefab, LiveList.content).GetComponent<UmaUIContainer>();
container.Name = " "+ live.MusicId + " " + live.SongName; container.Name = " " + live.MusicId + " " + live.SongName;
container.Image.sprite = live.Icon; container.Image.sprite = live.Icon;
container.Image.enabled = container.Image.sprite; container.Image.enabled = container.Image.sprite;
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
HighlightChildImage(LiveList.content, container); HighlightChildImage(LiveList.content, container);
ShowLiveSelectPannel(live); ShowLiveSelectPannel(live);
}); });
@@ -476,7 +485,8 @@ public class UmaViewerUI : MonoBehaviour
CharaContainer.Name = " " + live.MusicId + " " + live.SongName; CharaContainer.Name = " " + live.MusicId + " " + live.SongName;
CharaContainer.Image.sprite = live.Icon; CharaContainer.Image.sprite = live.Icon;
CharaContainer.Image.enabled = CharaContainer.Image.sprite; CharaContainer.Image.enabled = CharaContainer.Image.sprite;
CharaContainer.Button.onClick.AddListener(() => { CharaContainer.Button.onClick.AddListener(() =>
{
HighlightChildImage(LiveSoundList.content, container); HighlightChildImage(LiveSoundList.content, container);
ListLiveSounds(live.MusicId); ListLiveSounds(live.MusicId);
}); });
@@ -504,7 +514,7 @@ public class UmaViewerUI : MonoBehaviour
public void LoadPropPanel() public void LoadPropPanel()
{ {
var pageentrys = new List<PageManager.Entry>(); var pageentrys = new List<PageManager.Entry>();
foreach (var prop in Main.AbList.Where(a=>a.Name.Contains("pfb_chr_prop") && !a.Name.Contains("clothes"))) foreach (var prop in Main.AbList.Where(a => a.Name.Contains("pfb_chr_prop") && !a.Name.Contains("clothes")))
{ {
var pageentry = new PageManager.Entry(); var pageentry = new PageManager.Entry();
pageentry.Name = Path.GetFileName(prop.Name); pageentry.Name = Path.GetFileName(prop.Name);
@@ -515,7 +525,7 @@ public class UmaViewerUI : MonoBehaviour
}; };
pageentrys.Add(pageentry); pageentrys.Add(pageentry);
} }
PropPageCtrl.Initialize(pageentrys,PropList); PropPageCtrl.Initialize(pageentrys, PropList);
} }
public void LoadMapPanel() public void LoadMapPanel()
@@ -540,7 +550,7 @@ public class UmaViewerUI : MonoBehaviour
{ {
if (currentLive == null) return; if (currentLive == null) return;
var selectlist = LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>(); var selectlist = LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>();
if(selectlist != null) if (selectlist != null)
{ {
Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist)); Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist));
LiveSelectPannel.SetActive(false); LiveSelectPannel.SetActive(false);
@@ -562,7 +572,8 @@ public class UmaViewerUI : MonoBehaviour
{ {
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>(); var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
chara.IndexText.text = (i + 1).ToString(); chara.IndexText.text = (i + 1).ToString();
chara.GetComponent<Button>().onClick.AddListener(() => { chara.GetComponent<Button>().onClick.AddListener(() =>
{
chara.SelectChara(this); chara.SelectChara(this);
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>()) foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
{ {
@@ -579,33 +590,49 @@ public class UmaViewerUI : MonoBehaviour
{ {
Destroy(costumeList.content.GetChild(i).gameObject); Destroy(costumeList.content.GetChild(i).gameObject);
} }
string nameVar = mini ? $"pfb_mbdy{chara.Id}" : $"pfb_bdy{chara.Id}";
foreach (var entry in Main.AbList.Where(a => !a.Name.Contains("clothes") && a.Name.Contains(nameVar))) Action<CharaEntry> action = delegate (CharaEntry achara)
{ {
var container = Instantiate(UmaContainerCostumePrefab, costumeList.content).GetComponent<UmaUIContainer>(); string nameVar = mini ? $"pfb_mbdy{achara.Id}" : $"pfb_bdy{achara.Id}";
string[] split = entry.Name.Split('_'); foreach (var entry in Main.AbList.Where(a => !a.Name.Contains("clothes") && a.Name.Contains(nameVar)))
string costumeId = split[split.Length - 1]; {
container.Name = container.name = GetCostumeName(costumeId); var container = Instantiate(UmaContainerCostumePrefab, costumeList.content).GetComponent<UmaUIContainer>();
var icon = Main.Costumes.FirstOrDefault(a => (a.CharaId == chara.Id && a.BodyTypeSub == int.Parse(costumeId))); string[] split = entry.Name.Split('_');
container.Image.sprite = (icon == null ? CostumeIconDefault : icon.Icon); string costumeId = split[split.Length - 1];
container.Image.enabled = true; var dressdata = Main.Costumes.FirstOrDefault(a => (a.CharaId == achara.Id && a.BodyTypeSub == int.Parse(costumeId)));
container.Button.onClick.AddListener(() => { container.Name = container.name = GetCostumeName(costumeId, (dressdata == null ? costumeId : dressdata.DressName));
if (LiveSelectPannel.activeInHierarchy && CurrentSeletChara) container.Image.sprite = (dressdata == null ? CostumeIconDefault : dressdata.Icon);
{ container.Image.enabled = true;
CurrentSeletChara.SetValue(chara.Id, costumeId, chara.Icon, container.Image.sprite); container.Button.onClick.AddListener(() =>
} {
else if (LiveSelectPannel.activeInHierarchy && CurrentSeletChara)
{ {
HighlightChildImage(costumeList.content, container); CurrentSeletChara.SetValue(achara.Id, costumeId, achara.Icon, container.Image.sprite);
StartCoroutine(Builder.LoadUma(chara.Id, costumeId, mini)); }
} else
}); {
HighlightChildImage(costumeList.content, container);
StartCoroutine(Builder.LoadUma(achara.Id, costumeId, mini));
}
});
}
};
if(chara == null)
{
foreach(var cha in Main.Characters)
{
action.Invoke(cha);
}
} }
else
{
action.Invoke(chara);
}
//Common costumes //Common costumes
List<string> costumes = new List<string>(); List<string> costumes = new List<string>();
nameVar = mini ? "pfb_mbdy0" : $"pfb_bdy0"; var nameVar = mini ? "pfb_mbdy0" : $"pfb_bdy0";
foreach (var entry in Main.AbChara.Where(a => a.Name.Contains("/body/") && !a.Name.Contains("/clothes/") && a.Name.Contains(nameVar))) foreach (var entry in Main.AbChara.Where(a => a.Name.Contains("/body/") && !a.Name.Contains("/clothes/") && a.Name.Contains(nameVar)))
{ {
string id = Path.GetFileName(entry.Name); string id = Path.GetFileName(entry.Name);
@@ -615,15 +642,16 @@ public class UmaViewerUI : MonoBehaviour
costumes.Add(id); costumes.Add(id);
string costumeId = id; string costumeId = id;
var container = Instantiate(UmaContainerCostumePrefab, costumeList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerCostumePrefab, costumeList.content).GetComponent<UmaUIContainer>();
container.Name = container.name = GetCostumeName(id);
var data = costumeId.Split('_'); var data = costumeId.Split('_');
var bodytype = int.Parse(data[0]); var bodytype = int.Parse(data[0]);
var bodysub = int.Parse(data[1]); var bodysub = int.Parse(data[1]);
var icon = Main.Costumes.FirstOrDefault(a => a.BodyType == bodytype && a.BodyTypeSub == bodysub); var dressdata = Main.Costumes.FirstOrDefault(a => a.BodyType == bodytype && a.BodyTypeSub == bodysub);
container.Image.sprite = (icon == null ? CostumeIconDefault : icon.Icon); container.Name = container.name = GetCostumeName(id, (dressdata == null ? id : dressdata.DressName));
container.Image.sprite = (dressdata == null ? CostumeIconDefault : dressdata.Icon);
container.Image.enabled = true; container.Image.enabled = true;
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
if (LiveSelectPannel.activeInHierarchy && CurrentSeletChara) if (LiveSelectPannel.activeInHierarchy && CurrentSeletChara)
{ {
CurrentSeletChara.SetValue(chara.Id, costumeId, chara.Icon, container.Image.sprite); CurrentSeletChara.SetValue(chara.Id, costumeId, chara.Icon, container.Image.sprite);
@@ -659,7 +687,8 @@ public class UmaViewerUI : MonoBehaviour
container.Image.enabled = true; container.Image.enabled = true;
} }
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
HighlightChildImage(LiveCharaSoundList.content, container); HighlightChildImage(LiveCharaSoundList.content, container);
if (isCriware) if (isCriware)
{ {
@@ -683,11 +712,12 @@ public class UmaViewerUI : MonoBehaviour
var subSounds = Builder.LoadAudio(awb); var subSounds = Builder.LoadAudio(awb);
foreach(var sound in subSounds) foreach (var sound in subSounds)
{ {
var container = Instantiate(UmaContainerPrefab, NormalSubSoundList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerPrefab, NormalSubSoundList.content).GetComponent<UmaUIContainer>();
container.Name = $"Clip_{subSounds.IndexOf(sound)}"; container.Name = $"Clip_{subSounds.IndexOf(sound)}";
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
HighlightChildImage(NormalSubSoundList.content, container); HighlightChildImage(NormalSubSoundList.content, container);
Builder.PlaySound(awb, subSounds.IndexOf(sound)); Builder.PlaySound(awb, subSounds.IndexOf(sound));
}); });
@@ -719,7 +749,8 @@ public class UmaViewerUI : MonoBehaviour
var pageentry = new PageManager.Entry(); var pageentry = new PageManager.Entry();
pageentry.Name = Path.GetFileName(entry.Name); pageentry.Name = Path.GetFileName(entry.Name);
pageentry.FontSize = 20; pageentry.FontSize = 20;
pageentry.OnClick = (container) => { pageentry.OnClick = (container) =>
{
HighlightChildImage(animationList.content, container); HighlightChildImage(animationList.content, container);
Builder.LoadAsset(entry); Builder.LoadAsset(entry);
LoadedAnimation(); LoadedAnimation();
@@ -736,7 +767,8 @@ public class UmaViewerUI : MonoBehaviour
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name = container.name = Path.GetFileName(entry.Name); container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 20; container.FontSize = 20;
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
HighlightChildImage(animationList.content, container); HighlightChildImage(animationList.content, container);
Builder.LoadAsset(entryInstance); Builder.LoadAsset(entryInstance);
LoadedAnimation(); LoadedAnimation();
@@ -753,7 +785,8 @@ public class UmaViewerUI : MonoBehaviour
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name = container.name = Path.GetFileName(entry.Name); container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 20; container.FontSize = 20;
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
HighlightChildImage(animationList.content, container); HighlightChildImage(animationList.content, container);
Builder.LoadAsset(entryInstance); Builder.LoadAsset(entryInstance);
LoadedAnimation(); LoadedAnimation();
@@ -767,7 +800,8 @@ public class UmaViewerUI : MonoBehaviour
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>(); var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name = container.name = Path.GetFileName(entry.Name); container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 20; container.FontSize = 20;
container.Button.onClick.AddListener(() => { container.Button.onClick.AddListener(() =>
{
HighlightChildImage(animationList.content, container); HighlightChildImage(animationList.content, container);
Builder.LoadAsset(entryInstance); Builder.LoadAsset(entryInstance);
LoadedAnimation(); LoadedAnimation();
@@ -787,13 +821,14 @@ public class UmaViewerUI : MonoBehaviour
pageentry.Name = Path.GetFileName(entry.Name); pageentry.Name = Path.GetFileName(entry.Name);
pageentry.Sprite = Builder.LoadSprite(entry); pageentry.Sprite = Builder.LoadSprite(entry);
if (pageentry.Sprite == null) continue; if (pageentry.Sprite == null) continue;
pageentry.OnClick = (container) => { pageentry.OnClick = (container) =>
{
HighlightChildImage(BackGroundList.content, container); HighlightChildImage(BackGroundList.content, container);
BG_Image.sprite = pageentry.Sprite; BG_Image.sprite = pageentry.Sprite;
BG_Image.SetVerticesDirty(); BG_Image.SetVerticesDirty();
}; };
if(BG_Image.sprite == null) if (BG_Image.sprite == null)
{ {
BG_Image.sprite = pageentry.Sprite; BG_Image.sprite = pageentry.Sprite;
BG_Image.SetVerticesDirty(); BG_Image.SetVerticesDirty();
@@ -824,12 +859,11 @@ public class UmaViewerUI : MonoBehaviour
return (entry == null) ? id.ToString() : entry.Name; return (entry == null) ? id.ToString() : entry.Name;
} }
public static string GetCostumeName(string costumeId) public static string GetCostumeName(string costumeId, string defaultname)
{ {
switch (costumeId) switch (costumeId)
{ {
case "00": // case "00":return "Default";
return "Default";
case "90": case "90":
return "Upgraded"; return "Upgraded";
case "0001_00_01": case "0001_00_01":
@@ -857,7 +891,7 @@ public class UmaViewerUI : MonoBehaviour
case "0004_01_00": case "0004_01_00":
return "Towel"; return "Towel";
default: default:
return costumeId; return defaultname;
} }
} }
@@ -950,7 +984,7 @@ public class UmaViewerUI : MonoBehaviour
public void AudioPause() public void AudioPause()
{ {
if (Builder.CurrentAudioSources.Count>0) if (Builder.CurrentAudioSources.Count > 0)
{ {
AudioSource MainSource = Builder.CurrentAudioSources[0]; AudioSource MainSource = Builder.CurrentAudioSources[0];
var state = MainSource.isPlaying; var state = MainSource.isPlaying;
@@ -974,7 +1008,7 @@ public class UmaViewerUI : MonoBehaviour
public void AudioProgressChange(float val) public void AudioProgressChange(float val)
{ {
if (Builder.CurrentAudioSources.Count>0) if (Builder.CurrentAudioSources.Count > 0)
{ {
foreach (AudioSource source in Builder.CurrentAudioSources) foreach (AudioSource source in Builder.CurrentAudioSources)
{ {
@@ -1099,9 +1133,9 @@ public class UmaViewerUI : MonoBehaviour
public string GetCurrentLyrics(float time) public string GetCurrentLyrics(float time)
{ {
for(int i = Builder.CurrentLyrics.Count-1; i >=0; i--) for (int i = Builder.CurrentLyrics.Count - 1; i >= 0; i--)
{ {
if(Builder.CurrentLyrics[i].time< time) if (Builder.CurrentLyrics[i].time < time)
{ {
return Builder.CurrentLyrics[i].text; return Builder.CurrentLyrics[i].text;
} }
@@ -1112,7 +1146,7 @@ public class UmaViewerUI : MonoBehaviour
public void RecordVMD() public void RecordVMD()
{ {
var buttonText = VMDButton.GetComponentInChildren<TextMeshProUGUI>(); var buttonText = VMDButton.GetComponentInChildren<TextMeshProUGUI>();
if (!UmaViewerBuilder.Instance.CurrentUMAContainer|| UmaViewerBuilder.Instance.CurrentUMAContainer.IsMini) if (!UmaViewerBuilder.Instance.CurrentUMAContainer || UmaViewerBuilder.Instance.CurrentUMAContainer.IsMini)
{ {
buttonText.text = string.Format("<color=#FF0000>{0}</color>", "Need Normal UMA"); buttonText.text = string.Format("<color=#FF0000>{0}</color>", "Need Normal UMA");
return; return;
@@ -1122,7 +1156,7 @@ public class UmaViewerUI : MonoBehaviour
var camera = UmaViewerBuilder.Instance.AnimationCamera; var camera = UmaViewerBuilder.Instance.AnimationCamera;
var rootbone = container.transform.Find("Position"); var rootbone = container.transform.Find("Position");
if(rootbone.gameObject.TryGetComponent(out UnityHumanoidVMDRecorder recorder)) if (rootbone.gameObject.TryGetComponent(out UnityHumanoidVMDRecorder recorder))
{ {
if (recorder.IsRecording) if (recorder.IsRecording)
{ {
@@ -1156,8 +1190,9 @@ public class UmaViewerUI : MonoBehaviour
} }
} }
public void UpdateGameDB() { public void UpdateGameDB()
if (UpdateResVerCoroutine != null&&Config.Instance.WorkMode != WorkMode.Standalone) return; {
if (UpdateResVerCoroutine != null && Config.Instance.WorkMode != WorkMode.Standalone) return;
UmaDatabaseController.Instance.CloseAllConnection(); UmaDatabaseController.Instance.CloseAllConnection();
ManifestDB dB = new ManifestDB(); ManifestDB dB = new ManifestDB();
UpdateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg) { ShowMessage(msg); }); UpdateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg) { ShowMessage(msg); });
@@ -1166,7 +1201,7 @@ public class UmaViewerUI : MonoBehaviour
public void ChangeWorkMode(int mode) public void ChangeWorkMode(int mode)
{ {
if((int)Config.Instance.WorkMode != mode) if ((int)Config.Instance.WorkMode != mode)
{ {
Config.Instance.WorkMode = (WorkMode)mode; Config.Instance.WorkMode = (WorkMode)mode;
Config.Instance.UpdateConfig(); Config.Instance.UpdateConfig();
@@ -1178,7 +1213,7 @@ public class UmaViewerUI : MonoBehaviour
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false); var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0])) if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
{ {
if(path[0] != Config.Instance.MainPath) if (path[0] != Config.Instance.MainPath)
{ {
Config.Instance.MainPath = path[0]; Config.Instance.MainPath = path[0];
Config.Instance.UpdateConfig(); Config.Instance.UpdateConfig();