add LiveSheet Support

This commit is contained in:
1605296300@qq.com
2022-09-03 13:55:00 +08:00
parent aebef9b584
commit 8eafe19956
17 changed files with 2056 additions and 1608 deletions
@@ -65,11 +65,9 @@ public class UmaDatabaseController
metaDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\meta;");
metaDb.Open();
MetaEntries = ReadMeta(metaDb);
Debug.Log("1");
masterDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\master\master.mdb;");
masterDb.Open();
CharaData = ReadMaster(masterDb);
Debug.Log("2");
}
static IEnumerable<UmaDatabaseEntry> ReadMeta(SqliteConnection conn)
+23 -1
View File
@@ -1,4 +1,5 @@
using Gallop;
using Gallop.Live.Cutt;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
@@ -19,6 +20,7 @@ public class UmaViewerBuilder : MonoBehaviour
public Material TransMaterialCharas;
public Material TransMaterialProps;
public UmaContainer CurrentContainer;
public LiveTimelineWorkSheet CurrentLiveSheet;
public AnimatorOverrideController OverrideController;
@@ -233,7 +235,6 @@ public class UmaViewerBuilder : MonoBehaviour
CurrentContainer.FaceDrivenKeyTargets = newFaceDriven;
}
LoadAsset(UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{id}_00_idle01_loop")));
}
@@ -347,6 +348,12 @@ public class UmaViewerBuilder : MonoBehaviour
RecursiveLoadAsset(entry);
}
public void LoadLive(int id)
{
var asset = UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name.EndsWith("son"+id+"_camera"));
LoadAsset(asset);
}
private void RecursiveLoadAsset(UmaDatabaseEntry entry)
{
if (!string.IsNullOrEmpty(entry.Prerequisites))
@@ -445,6 +452,10 @@ public class UmaViewerBuilder : MonoBehaviour
LoadProp(asset as GameObject);
}
}
else if (aType == typeof(LiveTimelineWorkSheet))
{
LoadLiveSheet(asset as LiveTimelineWorkSheet);
}
else if (aType == typeof(FaceDrivenKeyTarget))
{
//CurrentContainer.FaceDrivenKeyTargets.Add(Instantiate(asset as FaceDrivenKeyTarget));
@@ -537,6 +548,12 @@ public class UmaViewerBuilder : MonoBehaviour
tripleMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_base";
optionMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_ctrl";
break;
case "0009":
mainTex = $"tex_bdy{costumeIdLong}_{skin}_{bust}_{"00"}_diff";
toonMap = $"tex_bdy{costumeIdLong}_{skin}_{bust}_{"00"}_shad_c";
tripleMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_base";
optionMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_ctrl";
break;
default:
mainTex = $"tex_bdy{costumeIdLong}_{skin}_{bust}_diff";
toonMap = $"tex_bdy{costumeIdLong}_{skin}_{bust}_shad_c";
@@ -681,6 +698,11 @@ public class UmaViewerBuilder : MonoBehaviour
}
}
private void LoadLiveSheet(LiveTimelineWorkSheet sheet)
{
CurrentLiveSheet = sheet;
GameObject gameObject = new GameObject("LiveSheet");
}
private void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
{
var entry = Main.LoadedBundles.FirstOrDefault(b => b.Value == bundle);
+32
View File
@@ -12,16 +12,24 @@ 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>();
[Header("Asset Memory")]
public bool ShadersLoaded = false;
public Dictionary<string, AssetBundle> LoadedBundles = new Dictionary<string, AssetBundle>();
enum Test
{
a,b,c,d
}
private void Awake()
{
Application.targetFrameRate = -1;
Instance = this;
AbList = UmaDatabaseController.Instance.MetaEntries.ToList();
@@ -50,6 +58,23 @@ public class UmaViewerMain : MonoBehaviour
UI.LoadPropPanel();
UI.LoadMapPanel();
});
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicLiveDataInfo", txt =>
{
UmaLiveData = JArray.Parse(txt);
foreach (var item in UmaLiveData)
{
if (!Lives.Where(c => c.MusicId == (int)item["musicId"]).Any())
{
Lives.Add(new LiveEntry()
{
MusicId = (int)item["musicId"],
songName = (string)item["songName"]
});
}
}
UI.LoadLivePanels();
});
}
public void OpenUrl(string url)
@@ -63,4 +88,11 @@ public class UmaViewerMain : MonoBehaviour
public string Name;
public int Id;
}
[System.Serializable]
public class LiveEntry
{
public int MusicId;
public string songName;
}
}
+24
View File
@@ -29,6 +29,7 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
public ScrollRect SceneList;
public ScrollRect FacialList;
public ScrollRect LiveList;
//settings
public TMPro.TMP_InputField SSWidth, SSHeight;
@@ -38,6 +39,7 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
public GameObject UmaContainerPrefab;
public GameObject UmaContainerSliderPrefab;
public GameObject UmaContainerAssetsPrefab;
public GameObject UmaContainerNoTMPPrefab;
private int LoadedAssetCount = 0;
[SerializeField] private RectTransform LoadedAssetsPanel;
@@ -144,6 +146,22 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
}
}
public void LoadLivePanels()
{
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 imageInstance1 = container.GetComponent<Image>();
container.Button.onClick.AddListener(() => {
HighlightChildImage(LiveList.content, imageInstance1);
Builder.LoadLive(live.MusicId);
});
}
}
public void LoadMiniModelPanels()
{
var container = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
@@ -369,4 +387,10 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
}
}
public void ClearCache()
{
PlayerPrefs.DeleteAll();
Application.Quit();
}
}
@@ -33,7 +33,7 @@ namespace Gallop
FacialMorph morph = new FacialMorph();
morph.target = this;
morph.direction = j > 0;
morph.name = "EyeBrow_" + i + "_" + (morph.direction ? "R" : "L");
morph.name = "EyeBrow_" + i + "_" + (morph.direction ? "L" : "R");
morph.trsArray = _eyebrowTarget[i]._faceGroupInfo[j]._trsArray;
foreach (TrsArray trs in morph.trsArray)
{
@@ -58,7 +58,7 @@ namespace Gallop
FacialMorph morph = new FacialMorph();
morph.target = this;
morph.direction = j > 0;
morph.name = "Eye_" + i + "_" + (morph.direction ? "R" : "L");
morph.name = "Eye_" + i + "_" + (morph.direction ? "L" : "R");
morph.trsArray = _eyeTarget[i]._faceGroupInfo[j]._trsArray;
foreach (TrsArray trs in morph.trsArray)
{
@@ -129,9 +129,9 @@ namespace Gallop
{
if (trs.transform)
{
trs.transform.localPosition += trs._position * morph.Weight;
trs.transform.localScale += trs._scale * morph.Weight;
trs.transform.localRotation = Quaternion.Euler(trs.transform.localRotation.eulerAngles + (trs._rotation * morph.Weight));
trs.transform.localPosition += trs._position * morph.Weight;
trs.transform.localEulerAngles += trs._rotation * morph.Weight;
};
}
}
@@ -145,7 +145,7 @@ namespace Gallop
trs.transform.localPosition = trs._position;
trs.transform.localScale = trs._scale;
trs.transform.localRotation = Quaternion.Euler(trs._rotation);
trs.transform.localEulerAngles = trs._rotation;
};
}
@@ -156,7 +156,7 @@ namespace Gallop
trs.transform.localPosition = trs._position;
trs.transform.localScale = trs._scale;
trs.transform.localRotation = Quaternion.Euler(trs._rotation);
trs.transform.localEulerAngles = trs._rotation;
};
}
@@ -167,7 +167,7 @@ namespace Gallop
trs.transform.localPosition = trs._position;
trs.transform.localScale = trs._scale;
trs.transform.localRotation = Quaternion.Euler(trs._rotation);
trs.transform.localEulerAngles = trs._rotation;
};
}
@@ -178,7 +178,7 @@ namespace Gallop
trs.transform.localPosition = trs._position;
trs.transform.localScale = trs._scale;
trs.transform.localRotation = Quaternion.Euler(trs._rotation);
trs.transform.localEulerAngles = trs._rotation;
};
}
@@ -189,7 +189,7 @@ namespace Gallop
trs.transform.localPosition = trs._position;
trs.transform.localScale = trs._scale;
trs.transform.localRotation = Quaternion.Euler(trs._rotation);
trs.transform.localEulerAngles = trs._rotation;
};
}
}
+2 -2
View File
@@ -25,7 +25,7 @@ namespace Gallop
_weight = value;
target.ChangeMorph();
}
}
[HideInInspector] public List<TrsArray> trsArray;
}
public List<TrsArray> trsArray;
}
}
+1 -1
View File
@@ -144,4 +144,4 @@ public class ConnectedBoneData
public string Bone2;
public float Intensity;
public bool IsFold;
}
}
@@ -0,0 +1,9 @@
using UnityEngine;
namespace Gallop.Live.Cutt
{
public class LiveTimelineWorkSheet:MonoBehaviour
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 943ab4ac9c3e4a340993be3e75bf6172
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: