read All character data from masterDB, Use Game Font

This commit is contained in:
CroakFang
2022-11-07 18:22:42 +08:00
parent 5a5ab9bfc8
commit 832a7ec2f4
90 changed files with 404 additions and 937 deletions
+62 -3
View File
@@ -1,12 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UmaUIContainer : MonoBehaviour
{
public TMPro.TextMeshProUGUI Name;
enum TextType
{
Text,
TextMesh,
}
[SerializeField]TextType TextComponentType = TextType.Text;
public string Name
{
get
{
switch (TextComponentType)
{
case TextType.Text: return Text.text;
case TextType.TextMesh: return TextMesh.text;
default: return TextMesh.text;
}
}
set
{
switch (TextComponentType)
{
case TextType.Text:
Text.text = value;
break;
case TextType.TextMesh:
TextMesh.text = value;
break;
}
}
}
public float FontSize
{
get
{
switch (TextComponentType)
{
case TextType.Text: return Text.fontSize;
case TextType.TextMesh: return TextMesh.fontSize;
default: return TextMesh.fontSize;
}
}
set
{
switch (TextComponentType)
{
case TextType.Text:
Text.fontSize = (int)value;
break;
case TextType.TextMesh:
TextMesh.fontSize = value;
break;
}
}
}
public TMPro.TextMeshProUGUI TextMesh;
public Text Text;
public Button Button;
public Slider Slider;
public Image Image;
}
-3
View File
@@ -1,7 +1,4 @@
using Gallop;
using Newtonsoft.Json.Linq;
using RootMotion.Dynamics;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using UnityEngine;
@@ -38,7 +38,7 @@ public class UmaDatabaseController
public static string CharaPath = "3d/chara/";
public IEnumerable<UmaDatabaseEntry> MetaEntries;
public IEnumerable<UmaCharaData> CharaData;
public IEnumerable<DataRow> CharaData;
public IEnumerable<FaceTypeData> FaceTypeData;
public IEnumerable<DataRow> LiveData;
@@ -101,19 +101,33 @@ public class UmaDatabaseController
return entries;
}
static IEnumerable<UmaCharaData> ReadMaster(SqliteConnection conn)
//static IEnumerable<UmaharaData> ReadMaster(SqliteConnection conn)
//{
// SqliteCommand sqlite_cmd = conn.CreateCommand();
// sqlite_cmd.CommandText = "SELECT id,tail_model_id FROM chara_data";
// SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
// while (sqlite_datareader.Read())
// {
// UmaCharaData entry = new UmaCharaData()
// {
// id = sqlite_datareader.GetInt32(0),
// tail_model_id = sqlite_datareader.GetInt32(1).ToString(),
// };
// yield return entry;
// }
//}
static IEnumerable<DataRow> ReadMaster(SqliteConnection conn)
{
SqliteCommand sqlite_cmd = conn.CreateCommand();
sqlite_cmd.CommandText = "SELECT id,tail_model_id FROM chara_data";
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";
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
while (sqlite_datareader.Read())
var result = new DataTable();
result.Load(sqlite_datareader);
var temp = result.Rows.GetEnumerator();
while (temp.MoveNext())
{
UmaCharaData entry = new UmaCharaData()
{
id = sqlite_datareader.GetInt32(0),
tail_model_id = sqlite_datareader.GetInt32(1).ToString(),
};
yield return entry;
yield return (DataRow)temp.Current;
}
}
-2
View File
@@ -2,7 +2,6 @@
using CriWareFormats;
using Gallop;
using NAudio.Wave;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -11,7 +10,6 @@ using System.IO;
using System.Linq;
using UmaMusumeAudio;
using UnityEngine;
using static UmaViewerMain;
public class UmaViewerBuilder : MonoBehaviour
{
+15 -24
View File
@@ -1,5 +1,3 @@
using Newtonsoft.Json.Linq;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -12,9 +10,6 @@ public class UmaViewerMain : MonoBehaviour
private UmaViewerUI UI => UmaViewerUI.Instance;
private UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
public JArray UmaCharaData;
public JArray UmaLiveData;
public List<CharaEntry> Characters = new List<CharaEntry>();
public List<LiveEntry> Lives = new List<LiveEntry>();
public List<UmaDatabaseEntry> AbList = new List<UmaDatabaseEntry>();
@@ -36,31 +31,27 @@ public class UmaViewerMain : MonoBehaviour
AbSounds = AbList.Where(ab => ab.Name.EndsWith(".awb") || ab.Name.EndsWith(".acb")).ToList();
}
IEnumerator Start()
private void Start()
{
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicCharaDataInfo", txt =>
var UmaCharaData = UmaDatabaseController.Instance.CharaData;
foreach (var item in UmaCharaData)
{
UmaCharaData = JArray.Parse(txt);
foreach (var item in UmaCharaData)
var id = Convert.ToInt32(item["id"]);
if (!Characters.Where(c => c.Id == id).Any())
{
//Debug.Log(item);
if (!Characters.Where(c => c.Id == (int)item["charaId"]).Any())
Characters.Add(new CharaEntry()
{
Characters.Add(new CharaEntry()
{
Name = (string)item["charaNameEnglish"],
Icon = UmaViewerBuilder.Instance.LoadCharaIcon((string)item["charaId"]),
Id = (int)item["charaId"]
});
}
Name = item["charaname"].ToString(),
Icon = UmaViewerBuilder.Instance.LoadCharaIcon(id.ToString()),
Id = id
});
}
}
UI.LoadModelPanels();
UI.LoadMiniModelPanels();
UI.LoadPropPanel();
UI.LoadMapPanel();
});
UI.LoadModelPanels();
UI.LoadMiniModelPanels();
UI.LoadPropPanel();
UI.LoadMapPanel();
var asset = AbList.FirstOrDefault(a => a.Name.Equals("livesettings"));
+28 -30
View File
@@ -75,7 +75,6 @@ public class UmaViewerUI : MonoBehaviour
public GameObject UmaContainerPrefab;
public GameObject UmaContainerSliderPrefab;
public GameObject UmaContainerAssetsPrefab;
public GameObject UmaContainerNoTMPPrefab;
private int LoadedAssetCount = 0;
[SerializeField] private RectTransform LoadedAssetsPanel;
@@ -146,7 +145,7 @@ public class UmaViewerUI : MonoBehaviour
LoadedAssetCount++;
string filePath = UmaDatabaseController.GetABPath(entry);
var container = Instantiate(UmaContainerAssetsPrefab, LoadedAssetsPanel).GetComponent<UmaUIContainer>();
container.Name.text = Path.GetFileName(entry.Name) + "\n" + entry.Url;
container.Name = Path.GetFileName(entry.Name) + "\n" + entry.Url;
container.Button.onClick.AddListener(() => {Process.Start("explorer.exe", "/select," + filePath);});
LoadedAssetsPanel.sizeDelta = new Vector2(0, LoadedAssetCount * 35);
}
@@ -164,7 +163,7 @@ public class UmaViewerUI : MonoBehaviour
public void LoadModelPanels()
{
var container = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = "Generic";
container.Name = container.name = "Generic";
var imageInstance = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(AnimationSetList.content, imageInstance);
@@ -172,7 +171,7 @@ public class UmaViewerUI : MonoBehaviour
});
container = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = "Tail";
container.Name = container.name = "Tail";
imageInstance = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(AnimationSetList.content, imageInstance);
@@ -184,7 +183,7 @@ public class UmaViewerUI : MonoBehaviour
var charaInstance = chara;
container = Instantiate(UmaContainerPrefab, CharactersList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = chara.Id + " " + chara.Name;
container.Name = container.name = chara.Id + " " + chara.Name;
var imageInstance1 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(CharactersList.content, imageInstance1);
@@ -198,7 +197,7 @@ public class UmaViewerUI : MonoBehaviour
}
container = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = chara.Id + " " + chara.Name;
container.Name = container.name = chara.Id + " " + chara.Name;
var imageInstance2 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(AnimationSetList.content, imageInstance2);
@@ -218,7 +217,7 @@ public class UmaViewerUI : MonoBehaviour
foreach (FacialMorph morph in targetMorph)
{
var container = Instantiate(UmaContainerSliderPrefab, TargetList.content).GetComponent<UmaUIContainer>();
container.Name.text = morph.name + " (" + morph.tag + ")";
container.Name = morph.name + " (" + morph.tag + ")";
container.Slider.value = morph.weight;
container.Slider.maxValue = 1;
container.Slider.minValue = 0;
@@ -265,7 +264,7 @@ public class UmaViewerUI : MonoBehaviour
continue;
}
var container = Instantiate(UmaContainerSliderPrefab, EmotionList.content).GetComponent<UmaUIContainer>();
container.Name.text = emotion.label;
container.Name = emotion.label;
container.Slider.value = emotion.Weight;
container.Slider.maxValue = 1;
container.Slider.minValue = 0;
@@ -278,16 +277,16 @@ public class UmaViewerUI : MonoBehaviour
foreach (var live in Main.Lives.OrderBy(c => c.MusicId))
{
var liveInstance = live;
var container = Instantiate(UmaContainerNoTMPPrefab, LiveList.content).GetComponent<UmaUIContainer>();
container.GetComponentInChildren<Text>().text = " "+ live.MusicId + " " + live.SongName;
var container = Instantiate(UmaContainerPrefab, LiveList.content).GetComponent<UmaUIContainer>();
container.Name = " "+ live.MusicId + " " + live.SongName;
var imageInstance1 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(LiveList.content, imageInstance1);
Builder.LoadLive(live);
});
var CharaContainer = Instantiate(UmaContainerNoTMPPrefab, LiveSoundList.content).GetComponent<UmaUIContainer>();
CharaContainer.GetComponentInChildren<Text>().text = " " + live.MusicId + " " + live.SongName;
var CharaContainer = Instantiate(UmaContainerPrefab, LiveSoundList.content).GetComponent<UmaUIContainer>();
CharaContainer.Name = " " + live.MusicId + " " + live.SongName;
var CharaimageInstance1 = CharaContainer.GetComponent<Image>();
CharaContainer.Button.onClick.AddListener(() => {
HighlightChildImage(LiveSoundList.content, CharaimageInstance1);
@@ -299,7 +298,7 @@ public class UmaViewerUI : MonoBehaviour
public void LoadMiniModelPanels()
{
var container = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = "General";
container.Name = container.name = "General";
var imageInstance = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(MiniAnimationSetList.content, imageInstance);
@@ -310,7 +309,7 @@ public class UmaViewerUI : MonoBehaviour
{
var charaInstance = chara;
container = Instantiate(UmaContainerPrefab, MiniCharactersList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = chara.Id + " " + chara.Name;
container.Name = container.name = chara.Id + " " + chara.Name;
var imageInstance1 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(MiniCharactersList.content, imageInstance1);
@@ -324,7 +323,7 @@ public class UmaViewerUI : MonoBehaviour
}
container = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = chara.Id + " " + chara.Name;
container.Name = container.name = chara.Id + " " + chara.Name;
var imageInstance2 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(MiniAnimationSetList.content, imageInstance2);
@@ -345,7 +344,7 @@ public class UmaViewerUI : MonoBehaviour
{
var propInstance = prop;
var container = Instantiate(UmaContainerPrefab, PropList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = Path.GetFileName(prop.Name);
container.Name = container.name = Path.GetFileName(prop.Name);
var imageInstance1 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(PropList.content, imageInstance1);
@@ -360,7 +359,8 @@ public class UmaViewerUI : MonoBehaviour
{
var sceneInstance = scene;
var container = Instantiate(UmaContainerPrefab, SceneList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = Path.GetFileName(scene.Name);
container.Name = container.name = Path.GetFileName(scene.Name);
container.FontSize = 19;
var imageInstance1 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(SceneList.content, imageInstance1);
@@ -382,7 +382,7 @@ public class UmaViewerUI : MonoBehaviour
var container = Instantiate(UmaContainerPrefab, costumeList.content).GetComponent<UmaUIContainer>();
string[] split = entry.Name.Split('_');
string costumeId = split[split.Length - 1];
container.Name.text = container.name = GetCostumeName(costumeId);
container.Name = container.name = GetCostumeName(costumeId);
container.Button.onClick.AddListener(() => {
HighlightChildImage(costumeList.content, container.GetComponent<Image>());
StartCoroutine(Builder.LoadUma(umaId, costumeId, mini));
@@ -400,7 +400,7 @@ public class UmaViewerUI : MonoBehaviour
costumes.Add(id);
string costumeId = id;
var container = Instantiate(UmaContainerPrefab, costumeList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = GetCostumeName(id);
container.Name = container.name = GetCostumeName(id);
container.Button.onClick.AddListener(() => {
HighlightChildImage(costumeList.content, container.GetComponent<Image>());
StartCoroutine(Builder.LoadUma(umaId, costumeId, mini));
@@ -436,7 +436,7 @@ public class UmaViewerUI : MonoBehaviour
var container = Instantiate(UmaContainerPrefab, LiveCharaSoundList.content).GetComponent<UmaUIContainer>();
string[] split = Path.GetFileNameWithoutExtension(entry.Name).Split('_');
string name = split[split.Length - 2] + getCharaName(split[split.Length - 2]) + " " + split[split.Length - 1];
container.Name.text = name;
container.Name = name;
container.Button.onClick.AddListener(() => {
HighlightChildImage(LiveCharaSoundList.content, container.GetComponent<Image>());
if (isCriware)
@@ -518,7 +518,8 @@ public class UmaViewerUI : MonoBehaviour
{
var entryInstance = entry;
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = Path.GetFileName(entry.Name);
container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 19;
container.Button.onClick.AddListener(() => {
HighlightChildImage(animationList.content, container.GetComponent<Image>());
Builder.LoadAsset(entryInstance);
@@ -532,7 +533,8 @@ public class UmaViewerUI : MonoBehaviour
{
var entryInstance = entry;
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = Path.GetFileName(entry.Name);
container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 19;
container.Button.onClick.AddListener(() => {
HighlightChildImage(animationList.content, container.GetComponent<Image>());
Builder.LoadAsset(entryInstance);
@@ -547,7 +549,8 @@ public class UmaViewerUI : MonoBehaviour
{
var entryInstance = entry;
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = Path.GetFileName(entry.Name);
container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 19;
container.Button.onClick.AddListener(() => {
HighlightChildImage(animationList.content, container.GetComponent<Image>());
Builder.LoadAsset(entryInstance);
@@ -560,7 +563,8 @@ public class UmaViewerUI : MonoBehaviour
{
var entryInstance = entry;
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
container.Name.text = container.name = Path.GetFileName(entry.Name);
container.Name = container.name = Path.GetFileName(entry.Name);
container.FontSize = 19;
container.Button.onClick.AddListener(() => {
HighlightChildImage(animationList.content, container.GetComponent<Image>());
Builder.LoadAsset(entryInstance);
@@ -643,12 +647,6 @@ public class UmaViewerUI : MonoBehaviour
}
}
public void ClearCache()
{
PlayerPrefs.DeleteAll();
Application.Quit();
}
public void AudioPause()
{
if (Builder.CurrentAudioSources.Count>0)
@@ -1,15 +1,9 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Gallop.Live.Cutt
{
public enum LiveTimelineKeyAttribute
public enum LiveTimelineKeyAttribute
{
Disable = 1,
CameraDelayEnable = 2,