Sync fork (#73)
* Improved UI layout and live vocals * New Live Compatibility * Android build support * Update build.yml * Fix issues with the new version of the game * add config button * Improve performance * bug fix, new uma compatibility --------- Co-authored-by: CroakFang <1605296300@qq.com>
This commit is contained in:
@@ -12,6 +12,9 @@ public class Config
|
||||
public string LanguageTip = "Affects Uma names on the list. Language options: 0 - En, 1 - Jp";
|
||||
public Language Language = Language.En;
|
||||
|
||||
public string DownloadMissingResourcesTip = "true/false. automatically download missing files, which may require a VPN.";
|
||||
public bool DownloadMissingResources = true;
|
||||
|
||||
public string MainPathTip = "Path to game folder, eg. D:/Backup/Cygames/umamusume";
|
||||
public string MainPath = "";
|
||||
|
||||
@@ -86,10 +89,18 @@ public class Config
|
||||
|
||||
public Config()
|
||||
{
|
||||
//TODO: Updating config file
|
||||
Version = Application.version;
|
||||
|
||||
MainPath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume";
|
||||
if (Application.isMobilePlatform)
|
||||
{
|
||||
WorkMode = WorkMode.Standalone;
|
||||
DownloadMissingResources = true;
|
||||
MainPath = Application.persistentDataPath;
|
||||
Instance = this;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
File.WriteAllText(configPath, JsonUtility.ToJson(this, true));
|
||||
@@ -99,6 +110,7 @@ public class Config
|
||||
try
|
||||
{
|
||||
JsonUtility.FromJsonOverwrite(File.ReadAllText(configPath), this);
|
||||
File.WriteAllText(configPath, JsonUtility.ToJson(this, true));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -379,7 +379,7 @@ public class UnityCameraVMDRecorder : MonoBehaviour
|
||||
binaryWriter.Write(boneNameBytes, 0, boneNameBytes.Length);
|
||||
binaryWriter.Write(new byte[boneNameLength - boneNameBytes.Length], 0, boneNameLength - boneNameBytes.Length);
|
||||
|
||||
byte[] frameNumberByte = BitConverter.GetBytes((ulong)(frame.frameIndex/2));
|
||||
byte[] frameNumberByte = BitConverter.GetBytes((ulong)(frame.frameIndex / 2)); //Set 30 FPS
|
||||
binaryWriter.Write(frameNumberByte, 0, intByteLength);
|
||||
|
||||
Vector3 position = frame.Position * WorldScaleFix;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ManifestDB
|
||||
private bool isError;
|
||||
public ManifestDB()
|
||||
{
|
||||
string DBPath = $"{Config.Instance.MainPath}\\meta_umaviewer";
|
||||
string DBPath = $"{Config.Instance.MainPath}/meta_umaviewer";
|
||||
ManifestDB.DBPath = DBPath;
|
||||
if (!File.Exists(DBPath))
|
||||
{
|
||||
@@ -186,7 +186,7 @@ public class ManifestDB
|
||||
yield break;
|
||||
}
|
||||
|
||||
var masterPath = $"{Path.GetDirectoryName(DBPath)}\\master\\master_umaviewer.mdb";
|
||||
var masterPath = $"{Path.GetDirectoryName(DBPath)}/master/master_umaviewer.mdb";
|
||||
var masterDir = Path.GetDirectoryName(masterPath);
|
||||
|
||||
callback?.Invoke($"Checking master.mdb", UIMessageType.Default);
|
||||
@@ -347,10 +347,6 @@ public class ManifestDB
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return platformEntrys[0];
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
|
||||
|
||||
|
||||
public class UmaAssetManager : MonoBehaviour
|
||||
@@ -55,14 +54,25 @@ public class UmaAssetManager : MonoBehaviour
|
||||
SearchAB(Main, entry, ref result);
|
||||
}
|
||||
|
||||
var percent_num = result.Count / 100;
|
||||
for (int i = 0; i < result.Count; i++)
|
||||
{
|
||||
var exist = LoadAB(result[i]);
|
||||
if (!exist)
|
||||
{
|
||||
var entry = result[i];
|
||||
if (!entry.IsAssetBundle)
|
||||
{
|
||||
var file = entry.FilePath; // trigger download
|
||||
OnLoadProgressChange?.Invoke(i, result.Count, null);
|
||||
yield return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var exist = LoadAB(result[i]);
|
||||
if (!exist && i % percent_num == 0)
|
||||
{
|
||||
OnLoadProgressChange?.Invoke(i, result.Count, null);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OnLoadProgressChange?.Invoke(-1, result.Count, null);
|
||||
|
||||
@@ -803,8 +803,11 @@ public class UmaContainerCharacter : UmaContainer
|
||||
var tex = ab.LoadAsset<Texture>("tex_chr_tear00");
|
||||
StaticTear_L = table["tearmesh_l"] as GameObject;
|
||||
StaticTear_R = table["tearmesh_r"] as GameObject;
|
||||
StaticTear_L.GetComponent<Renderer>().material.mainTexture = tex;
|
||||
StaticTear_R.GetComponent<Renderer>().material.mainTexture = tex;
|
||||
if (StaticTear_L && StaticTear_R)
|
||||
{
|
||||
StaticTear_L.GetComponent<Renderer>().material.mainTexture = tex;
|
||||
StaticTear_R.GetComponent<Renderer>().material.mainTexture = tex;
|
||||
}
|
||||
}
|
||||
|
||||
switch (m.shader.name)
|
||||
|
||||
@@ -54,15 +54,15 @@ public class UmaDatabaseController
|
||||
{
|
||||
if(Config.Instance.WorkMode == WorkMode.Standalone)
|
||||
{
|
||||
if(!File.Exists($@"{Config.Instance.MainPath}\meta_umaviewer")) throw new Exception();
|
||||
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta_umaviewer;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master_umaviewer.mdb;");
|
||||
if(!File.Exists($@"{Config.Instance.MainPath}/meta_umaviewer")) throw new Exception();
|
||||
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}/meta_umaviewer;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}/master/master_umaviewer.mdb;");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!File.Exists($@"{Config.Instance.MainPath}\meta")) throw new Exception();
|
||||
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
|
||||
if (!File.Exists($@"{Config.Instance.MainPath}/meta")) throw new Exception();
|
||||
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}/meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}/master/master.mdb;");
|
||||
}
|
||||
|
||||
metaDb.Open();
|
||||
@@ -133,7 +133,7 @@ public class UmaDatabaseController
|
||||
Debug.LogError($"Error caught while reading Entry : \n {e}");
|
||||
}
|
||||
|
||||
if (entry != null) {
|
||||
if (entry != null && !meta.ContainsKey(entry.Name)) {
|
||||
|
||||
meta.Add(entry.Name, entry);
|
||||
}
|
||||
@@ -160,9 +160,17 @@ public class UmaDatabaseController
|
||||
sqlite_cmd.CommandText = sql;
|
||||
using var sqlite_datareader = sqlite_cmd.ExecuteReader();
|
||||
var result = new DataTable();
|
||||
result.Load(sqlite_datareader);
|
||||
foreach (DataRow row in result.Rows)
|
||||
for (int i = 0; i < sqlite_datareader.FieldCount; i++)
|
||||
{
|
||||
result.Columns.Add(sqlite_datareader.GetName(i), sqlite_datareader.GetFieldType(i));
|
||||
}
|
||||
while (sqlite_datareader.Read())
|
||||
{
|
||||
DataRow row = result.NewRow();
|
||||
for (int i = 0; i < sqlite_datareader.FieldCount; i++)
|
||||
{
|
||||
row[i] = sqlite_datareader[i];
|
||||
}
|
||||
dr.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
|
||||
using System;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
public class UmaDatabaseEntry
|
||||
{
|
||||
@@ -16,12 +17,27 @@ public class UmaDatabaseEntry
|
||||
{
|
||||
get
|
||||
{
|
||||
var path = $"{Config.Instance.MainPath}\\dat\\{Url.Substring(0, 2)}\\{Url}";
|
||||
if (Config.Instance.WorkMode == WorkMode.Standalone && !File.Exists(path))
|
||||
if (Config.Instance.DownloadMissingResources && !File.Exists(Path))
|
||||
{
|
||||
DownloadAsset(this);
|
||||
}
|
||||
return path;
|
||||
return Path;
|
||||
}
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{Config.Instance.MainPath}/dat/{Url.Substring(0, 2)}/{Url}";
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAssetBundle
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(System.IO.Path.GetExtension(Name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +58,7 @@ public class UmaDatabaseEntry
|
||||
//TODO Make it async
|
||||
public static void DownloadAsset(UmaDatabaseEntry entry)
|
||||
{
|
||||
var path = $"{Config.Instance.MainPath}\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
||||
UmaViewerDownload.DownloadAssetSync(entry, path, delegate (string msg, UIMessageType type)
|
||||
UmaViewerDownload.DownloadAssetSync(entry, delegate (string msg, UIMessageType type)
|
||||
{
|
||||
UmaViewerUI.Instance.ShowMessage(msg, type);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CriWareFormats;
|
||||
using Gallop;
|
||||
using Gallop.Live;
|
||||
using NAudio.Wave;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -658,36 +659,39 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
public void LoadLive(LiveEntry live, List<LiveCharacterSelect> characters)
|
||||
{
|
||||
UmaSceneController.LoadScene("LiveScene",
|
||||
delegate ()
|
||||
characters.ForEach(a =>
|
||||
{
|
||||
if (a.CharaEntry == null || a.CostumeId == "")
|
||||
{
|
||||
a.CharaEntry = Main.Characters[Random.Range(0, Main.Characters.Count / 2)];
|
||||
a.CostumeId = "0002_00_00";
|
||||
}
|
||||
});//fill empty
|
||||
|
||||
UmaAssetManager.PreLoadAndRun(Director.GetLiveAllVoiceEntry(live.MusicId, characters),
|
||||
delegate
|
||||
{
|
||||
UmaSceneController.LoadScene("LiveScene",
|
||||
delegate
|
||||
{
|
||||
GameObject MainLive = Instantiate(LiveControllerPrefab);
|
||||
Gallop.Live.Director mController = MainLive.GetComponentInChildren<Gallop.Live.Director>();
|
||||
Director mController = MainLive.GetComponentInChildren<Director>();
|
||||
mController.live = live;
|
||||
mController.IsRecordVMD = UI.isRecordVMD;
|
||||
mController.RequireStage = UI.isRequireStage;
|
||||
|
||||
List<GameObject> transferObjs = new List<GameObject>() {
|
||||
MainLive,
|
||||
GameObject.Find("ViewerMain"),
|
||||
GameObject.Find("Directional Light"),
|
||||
GameObject.Find("GlobalShaderController"),
|
||||
GameObject.Find("AudioManager")
|
||||
MainLive,
|
||||
GameObject.Find("ViewerMain"),
|
||||
GameObject.Find("Directional Light"),
|
||||
GameObject.Find("GlobalShaderController"),
|
||||
GameObject.Find("AudioManager")
|
||||
};
|
||||
|
||||
// Move the GameObject (you attach this in the Inspector) to the newly loaded Scene
|
||||
transferObjs.ForEach(o => SceneManager.MoveGameObjectToScene(o, SceneManager.GetSceneByName("LiveScene")));
|
||||
mController.Initialize();
|
||||
|
||||
characters.ForEach(a =>
|
||||
{
|
||||
if (a.CharaEntry == null || a.CostumeId == "")
|
||||
{
|
||||
a.CharaEntry = Main.Characters[Random.Range(0, Main.Characters.Count/2)];
|
||||
a.CostumeId = "0002_00_00";
|
||||
}
|
||||
});//fill empty
|
||||
|
||||
var actual_member_count = mController._liveTimelineControl.data.worksheetList[0].charaMotSeqList.Count;
|
||||
if (actual_member_count > characters.Count)
|
||||
{
|
||||
@@ -707,15 +711,15 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
LiveViewerUI.Instance.CurrentLyrics = Lyrics;
|
||||
}
|
||||
},
|
||||
delegate ()
|
||||
delegate
|
||||
{
|
||||
Gallop.Live.Director.instance.InitializeUI();
|
||||
Gallop.Live.Director.instance.InitializeTimeline(characters, UI.LiveMode);
|
||||
Gallop.Live.Director.instance.InitializeMusic(live.MusicId, characters);
|
||||
Gallop.Live.Director.instance.Play();
|
||||
Director.instance.InitializeUI();
|
||||
Director.instance.InitializeTimeline(characters, UI.LiveMode);
|
||||
Director.instance.InitializeMusic(live.MusicId, characters);
|
||||
Director.instance.Play();
|
||||
LiveViewerUI.Instance.RecordingUI.SetActive(Gallop.Live.Director.instance.IsRecordVMD);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//Use decrypt function
|
||||
|
||||
@@ -1,14 +1,29 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using static UmaViewerUI;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
public class UmaViewerDownload : MonoBehaviour
|
||||
{
|
||||
public static string MANIFEST_ROOT_URL = "https://prd-storage-app-umamusume.akamaized.net/dl/resources/Manifest";
|
||||
public static string GENERIC_BASE_URL = "https://prd-storage-game-umamusume.akamaized.net/dl/resources/Generic";
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
public static string ASSET_BASE_URL = "https://prd-storage-game-umamusume.akamaized.net/dl/resources/Android/assetbundles/";
|
||||
#else
|
||||
public static string ASSET_BASE_URL = "https://prd-storage-game-umamusume.akamaized.net/dl/resources/Windows/assetbundles/";
|
||||
#endif
|
||||
|
||||
private const int maxConcurrentDownloads = 30;
|
||||
private static SemaphoreSlim semaphore = new SemaphoreSlim(maxConcurrentDownloads);
|
||||
private static List<Coroutine> downloadCoroutines = new List<Coroutine>();
|
||||
private static int CurrentCoroutinesCount = 0;
|
||||
private static WaitUntil downloadWaitUntil = new WaitUntil(() => CurrentCoroutinesCount < maxConcurrentDownloads);
|
||||
private static List<Task> downloadTasks = new List<Task>();
|
||||
|
||||
public static IEnumerator DownloadText(string url, System.Action<string> callback)
|
||||
{
|
||||
@@ -27,9 +42,9 @@ public class UmaViewerDownload : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static void DownloadAssetSync(UmaDatabaseEntry entry,string path, Action<string , UIMessageType> callback = null)
|
||||
public static void DownloadAssetSync(UmaDatabaseEntry entry, Action<string , UIMessageType> callback = null)
|
||||
{
|
||||
string baseurl = (string.IsNullOrEmpty(Path.GetExtension(entry.Name)) ? GetAssetRequestUrl(entry.Url) : GetGenericRequestUrl(entry.Url));
|
||||
string baseurl = entry.IsAssetBundle ? GetAssetRequestUrl(entry.Url) : GetGenericRequestUrl(entry.Url);
|
||||
|
||||
using UnityWebRequest www = UnityWebRequest.Get(baseurl);
|
||||
www.SendWebRequest();
|
||||
@@ -42,10 +57,91 @@ public class UmaViewerDownload : MonoBehaviour
|
||||
else
|
||||
{
|
||||
Debug.Log("saving " + entry.Url);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
File.WriteAllBytes(path, www.downloadHandler.data);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(entry.Path));
|
||||
File.WriteAllBytes(entry.Path, www.downloadHandler.data);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerator DownloadAssets(List<UmaDatabaseEntry> entrys, Action<int, int, string> callback = null)
|
||||
{
|
||||
callback?.Invoke(0, entrys.Count, "DownLoading");
|
||||
var percent_num = entrys.Count / 100;
|
||||
for(int i = 0; i < entrys.Count; i++)
|
||||
{
|
||||
var entry = entrys[i];
|
||||
yield return downloadWaitUntil;
|
||||
if(i % percent_num == 0)
|
||||
{
|
||||
callback?.Invoke(i, entrys.Count, "DownLoading");
|
||||
}
|
||||
CurrentCoroutinesCount++;
|
||||
semaphore.WaitAsync();
|
||||
downloadCoroutines.Add(Instance.StartCoroutine(DownloadTask(entry)));
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerator DownloadTask(UmaDatabaseEntry entry)
|
||||
{
|
||||
if (!File.Exists(entry.Path))
|
||||
{
|
||||
string baseurl = (string.IsNullOrEmpty(Path.GetExtension(entry.Name)) ? GetAssetRequestUrl(entry.Url) : GetGenericRequestUrl(entry.Url));
|
||||
using (UnityWebRequest www = UnityWebRequest.Get(baseurl))
|
||||
{
|
||||
yield return www.SendWebRequest();
|
||||
if (www.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
if (Instance)
|
||||
{
|
||||
Instance.ShowMessage($"Failed to download resources : {www.error}", UIMessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(entry.Path));
|
||||
File.WriteAllBytes(entry.Path, www.downloadHandler.data);
|
||||
CurrentCoroutinesCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentCoroutinesCount--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static async void DownloadAssets(IEnumerable<UmaDatabaseEntry> entrys)
|
||||
{
|
||||
downloadTasks.Clear();
|
||||
foreach (var entry in entrys)
|
||||
{
|
||||
await semaphore.WaitAsync();
|
||||
downloadTasks.Add(DownloadTask(entry, semaphore));
|
||||
}
|
||||
await Task.WhenAll(downloadTasks);
|
||||
}
|
||||
|
||||
public static async Task DownloadTask(UmaDatabaseEntry entry, SemaphoreSlim semaphore)
|
||||
{
|
||||
if (!File.Exists(entry.Path))
|
||||
{
|
||||
string baseurl = (string.IsNullOrEmpty(Path.GetExtension(entry.Name)) ? GetAssetRequestUrl(entry.Url) : GetGenericRequestUrl(entry.Url));
|
||||
using UnityWebRequest www = UnityWebRequest.Get(baseurl);
|
||||
www.SendWebRequest();
|
||||
await Task.Run(() => { while (!www.isDone) { } });
|
||||
if (www.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
Debug.LogError(www.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("saving " + entry.Url);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(entry.Path));
|
||||
File.WriteAllBytes(entry.Path, www.downloadHandler.data);
|
||||
}
|
||||
}
|
||||
semaphore.Release();
|
||||
}
|
||||
|
||||
public static string GetManifestRequestUrl(string hash)
|
||||
{
|
||||
|
||||
@@ -121,6 +121,10 @@ public class UmaViewerGlobalShader : MonoBehaviour
|
||||
Shader.SetGlobalFloatArray("_DirtRate", _DirtRate);
|
||||
|
||||
Shader.SetGlobalColor("_AmbientColor", _AmbientColor);
|
||||
#if UNITY_ANDROID
|
||||
Shader.SetGlobalFloat("_GlobalFarClipLog", 1f);
|
||||
Shader.SetGlobalFloat("_GlobalVertexDepthLinear", 1f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public class UmaViewerMain : MonoBehaviour
|
||||
Application.targetFrameRate = 120;
|
||||
|
||||
AbList = UmaDatabaseController.Instance.MetaEntries;
|
||||
if (AbList == null) return;
|
||||
var chara_3d = AbList.Where(ab => ab.Value.Type == UmaFileType._3d_cutt).Select(ab => ab.Value).ToList();
|
||||
AbChara = chara_3d.FindAll(ab => ab.Name.StartsWith(UmaDatabaseController.CharaPath));
|
||||
AbMotions = chara_3d.FindAll(ab => ab.Name.StartsWith(UmaDatabaseController.MotionPath));
|
||||
@@ -44,10 +45,17 @@ public class UmaViewerMain : MonoBehaviour
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
if (AbList == null) yield break;
|
||||
Dictionary<int, string> enNames = new Dictionary<int, string>();
|
||||
Dictionary<int, string> mobNames = new Dictionary<int, string>();
|
||||
var loadingUI = UmaSceneController.instance;
|
||||
|
||||
if(Config.Instance.WorkMode == WorkMode.Standalone && AbList != null)
|
||||
{
|
||||
var ablist = new List<UmaDatabaseEntry>(AbList.Values);
|
||||
yield return UmaViewerDownload.DownloadAssets(ablist, UmaSceneController.instance.LoadingProgressChange);
|
||||
}
|
||||
|
||||
//Main chara names (En only)
|
||||
if (Config.Instance.Language == Language.En)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Gallop;
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
using SFB;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -171,6 +173,9 @@ public class UmaViewerUI : MonoBehaviour
|
||||
UmaAssetManager.OnLoadedBundleClear += LoadedAssetsClear;
|
||||
|
||||
PoseManager.LoadLocalPoseFiles();
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
canvasScaler.referenceResolution = new Vector2(1280, 720);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -1396,6 +1401,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public void ChangeDataPath()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
|
||||
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
|
||||
{
|
||||
@@ -1405,6 +1411,21 @@ public class UmaViewerUI : MonoBehaviour
|
||||
Config.Instance.UpdateConfig();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OpenConfig()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
if (File.Exists(Config.configPath))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = Config.configPath,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ChangeOutlineWidth(float val)
|
||||
@@ -1418,6 +1439,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public void ShowMessage(string msg, UIMessageType type)
|
||||
{
|
||||
if (!MessageText) return;
|
||||
MessageText.text += type switch
|
||||
{
|
||||
UIMessageType.Error => string.Format("<color=red>{0}</color>\n", msg),
|
||||
@@ -1432,6 +1454,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public void ExportModel()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
var container = Builder.CurrentUMAContainer;
|
||||
if (container)
|
||||
{
|
||||
@@ -1442,6 +1465,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
ModelExporter.ExportModel(container, path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ToggleVisible(GameObject go)
|
||||
|
||||
@@ -954,37 +954,49 @@ namespace Gallop
|
||||
if (updateInfo_.effect != null)
|
||||
{
|
||||
var info = updateInfo_.effect;
|
||||
var cheektype = info.cheekType;
|
||||
for (int i = 0; i < CheekMorph.BindProperties.Count; i++)
|
||||
if (CheekMorph != null)
|
||||
{
|
||||
CheekMorph.BindProperties[i].Value = (cheektype - 1 == i ? 1 : 0);
|
||||
var cheektype = info.cheekType;
|
||||
for (int i = 0; i < CheekMorph.BindProperties.Count; i++)
|
||||
{
|
||||
CheekMorph.BindProperties[i].Value = (cheektype - 1 == i ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
var mangatype = info.mangameIndex;
|
||||
if (mangatype == 0)
|
||||
if (MangaMorph != null)
|
||||
{
|
||||
HasManga = false;
|
||||
MangaMorph.BindProperties[1].Value = mangatype;
|
||||
}
|
||||
else
|
||||
{
|
||||
HasManga = true;
|
||||
MangaMorph.BindProperties[0].Value = mangatype - 1;
|
||||
MangaMorph.BindProperties[1].Value = 1;
|
||||
var mangatype = info.mangameIndex;
|
||||
if (mangatype == 0)
|
||||
{
|
||||
HasManga = false;
|
||||
MangaMorph.BindProperties[1].Value = mangatype;
|
||||
}
|
||||
else
|
||||
{
|
||||
HasManga = true;
|
||||
MangaMorph.BindProperties[0].Value = mangatype - 1;
|
||||
MangaMorph.BindProperties[1].Value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var tearfulEnable = ((int)info.attribute & LiveTimelineKeyFacialEffectData.kAttrTearful) > 0;
|
||||
var tearfultype = tearfulEnable ? info.tearyType : 0;
|
||||
StaticTearMorph.BindProperties.ForEach(p => p.Value = tearfultype);
|
||||
|
||||
var shaderEnable = ((int)info.attribute & LiveTimelineKeyFacialEffectData.kAttrFaceShadowVisible) > 0;
|
||||
if (shaderEnable)
|
||||
if (StaticTearMorph != null)
|
||||
{
|
||||
ShadeMorph.BindProperties[0].Value = Mathf.MoveTowards(ShadeMorph.BindProperties[0].Value, 1, Time.deltaTime * 2);
|
||||
var tearfulEnable = ((int)info.attribute & LiveTimelineKeyFacialEffectData.kAttrTearful) > 0;
|
||||
var tearfultype = tearfulEnable ? info.tearyType : 0;
|
||||
StaticTearMorph.BindProperties.ForEach(p => p.Value = tearfultype);
|
||||
}
|
||||
else
|
||||
|
||||
if (ShadeMorph != null)
|
||||
{
|
||||
ShadeMorph.BindProperties[0].Value = 0;
|
||||
var shaderEnable = ((int)info.attribute & LiveTimelineKeyFacialEffectData.kAttrFaceShadowVisible) > 0;
|
||||
if (shaderEnable)
|
||||
{
|
||||
ShadeMorph.BindProperties[0].Value = Mathf.MoveTowards(ShadeMorph.BindProperties[0].Value, 1, Time.deltaTime * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShadeMorph.BindProperties[0].Value = 0;
|
||||
}
|
||||
}
|
||||
ChangeMorphEffect();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using UnityEngine;
|
||||
using static RootMotion.FinalIK.IKSolverVR;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
|
||||
using static Gallop.Live.Cutt.LiveTimelineDefine;
|
||||
|
||||
namespace Gallop.Live.Cutt
|
||||
@@ -355,7 +354,7 @@ namespace Gallop.Live.Cutt
|
||||
MulFrame.Add(mulframe);
|
||||
}
|
||||
|
||||
if (currentFrame % 2 == 0) RecordUma?.Invoke();
|
||||
if (currentFrame % 2 == 0) RecordUma?.Invoke(); //Set 30 FPS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,10 @@ namespace Gallop.Live.Cutt
|
||||
{
|
||||
foreach (var key in _currentKey.thisList)
|
||||
{
|
||||
_tempAnim.AddClip(key.clip, key.clip.name);
|
||||
if(key.clip != null)
|
||||
{
|
||||
_tempAnim.AddClip(key.clip, key.clip.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
_tempAnim.wrapMode = WrapMode.Clamp;
|
||||
@@ -122,13 +125,15 @@ namespace Gallop.Live.Cutt
|
||||
double interval = (currentTime - arg.FrameSecond) * arg.playSpeed;
|
||||
float currentAnimationTime = (float)(start + interval);
|
||||
|
||||
var state = _tempAnim[anim.name];
|
||||
state.enabled = true;
|
||||
state.weight = 1;
|
||||
state.time = arg.loop ? Mathf.Repeat(currentAnimationTime, state.length) : currentAnimationTime;
|
||||
_tempAnim.Sample();
|
||||
state.enabled = false;
|
||||
|
||||
if (anim)
|
||||
{
|
||||
var state = _tempAnim[anim.name];
|
||||
state.enabled = true;
|
||||
state.weight = 1;
|
||||
state.time = arg.loop ? Mathf.Repeat(currentAnimationTime, state.length) : currentAnimationTime;
|
||||
_tempAnim.Sample();
|
||||
state.enabled = false;
|
||||
}
|
||||
_prevIndex = _curIndex;
|
||||
}
|
||||
_prevFrameAnimationTime = currentTime;
|
||||
|
||||
@@ -376,7 +376,11 @@ namespace Gallop.Live
|
||||
|
||||
if (_syncTime == false)
|
||||
{
|
||||
if (liveMusic.sourceList[0].time > 0.01)
|
||||
if(liveMusic.sourceList.Count == 0)
|
||||
{
|
||||
_syncTime = true;
|
||||
}
|
||||
else if (liveMusic.sourceList[0].time > 0.01)
|
||||
{
|
||||
_liveCurrentTime = liveMusic.sourceList[0].time;
|
||||
_syncTime = true;
|
||||
@@ -545,6 +549,44 @@ namespace Gallop.Live
|
||||
|
||||
UnityCameraVMDRecorder.SaveLiveCameraVMD(live, ExitTime, frames);
|
||||
}
|
||||
|
||||
public static List<UmaDatabaseEntry> GetLiveAllVoiceEntry(int songid, List<LiveCharacterSelect> characters)
|
||||
{
|
||||
List<UmaDatabaseEntry> entryList = new List <UmaDatabaseEntry>();
|
||||
for (int i = 0; i < characters.Count; i++)
|
||||
{
|
||||
if (characters[i].CharaEntry.Name != "")
|
||||
{
|
||||
var charaid = characters[i].CharaEntry.Id;
|
||||
|
||||
var entry = UmaViewerMain.Instance.AbSounds.FirstOrDefault(a => a.Name.Contains(string.Format(VOCAL_PATH, songid, charaid)) && a.Name.EndsWith("awb"));
|
||||
if (entry == null)
|
||||
{
|
||||
List<UmaDatabaseEntry> entries = new List<UmaDatabaseEntry>();
|
||||
foreach (var random in UmaViewerMain.Instance.AbSounds.Where(a => (a.Name.Contains(string.Format(RANDOM_VOCAL_PATH, songid)) && a.Name.EndsWith("awb"))))
|
||||
{
|
||||
entries.Add(random);
|
||||
}
|
||||
if (entries.Count > 0)
|
||||
{
|
||||
entry = entries[UnityEngine.Random.Range(0, entries.Count - 1)];
|
||||
}
|
||||
}
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
entryList.Add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var bgEntry = UmaViewerMain.Instance.AbSounds.FirstOrDefault(a => a.Name.Contains(string.Format(SONG_PATH, songid)) && a.Name.EndsWith("awb"));
|
||||
if (bgEntry != null)
|
||||
{
|
||||
entryList.Add(bgEntry);
|
||||
}
|
||||
return entryList;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user