Publish verified live restoration source snapshot and known limits
This commit is contained in:
@@ -10,6 +10,8 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
public TextMeshProUGUI ProgressText;
|
||||
public Slider ProgressSlider;
|
||||
public Button PlayButton;
|
||||
public Sprite PlayIcon;
|
||||
public Sprite PauseIcon;
|
||||
public TextMeshProUGUI SpeedText;
|
||||
public Slider SpeedSlider;
|
||||
public Button VMDButton;
|
||||
@@ -21,12 +23,13 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
bool isLoop = umaContainer.OverrideController["clip_2"].name.Contains("_loop");
|
||||
var AnimeState = umaContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0);
|
||||
var AnimeClip = umaContainer.OverrideController["clip_2"];
|
||||
if (AnimeClip && umaContainer.UmaAnimator.speed != 0)
|
||||
if (AnimeClip)
|
||||
{
|
||||
var normalizedTime = (isLoop) ? Mathf.Repeat(AnimeState.normalizedTime, 1) : Mathf.Min(AnimeState.normalizedTime, 1);
|
||||
TitleText.text = AnimeClip.name;
|
||||
ProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
ProgressSlider.SetValueWithoutNotify(normalizedTime);
|
||||
UpdatePlayButtonIcon(umaContainer.UmaAnimator.speed > 0f && (isLoop || AnimeState.normalizedTime < 1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +51,7 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
if (animator_face)
|
||||
animator_face.speed = 0;
|
||||
animator_cam.speed = 0;
|
||||
UpdatePlayButtonIcon(false);
|
||||
}
|
||||
else if (AnimeState.normalizedTime < 1f)
|
||||
{
|
||||
@@ -55,6 +59,7 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
animator_cam.speed = SpeedSlider.value;
|
||||
if (animator_face)
|
||||
animator_face.speed = SpeedSlider.value;
|
||||
UpdatePlayButtonIcon(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -69,6 +74,7 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
animator_face.Play(0, 0, 0);
|
||||
animator_face.Play(0, 1, 0);
|
||||
}
|
||||
UpdatePlayButtonIcon(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +105,8 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
animator_face.Play(0, 1, val);
|
||||
}
|
||||
|
||||
UpdatePlayButtonIcon(false);
|
||||
|
||||
ProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
}
|
||||
}
|
||||
@@ -116,6 +124,16 @@ public class UISettingsAnimation : MonoBehaviour
|
||||
{
|
||||
container.UmaFaceAnimator.speed = val;
|
||||
}
|
||||
|
||||
UpdatePlayButtonIcon(val > 0f);
|
||||
}
|
||||
|
||||
private void UpdatePlayButtonIcon(bool isPlaying)
|
||||
{
|
||||
if (PlayButton)
|
||||
{
|
||||
PlayButton.image.sprite = isPlaying ? PauseIcon : PlayIcon;
|
||||
}
|
||||
}
|
||||
|
||||
public void EnableRootMotion(bool enable)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
using SFB;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
@@ -19,14 +19,18 @@ public class UISettingsAssets : MonoBehaviour
|
||||
if (!LoadedAssetPageCtrl) return;
|
||||
if (LoadedAssetEntries.ContainsKey(entry.Name)) return;
|
||||
var file_name = Path.GetFileName(entry.Name);
|
||||
string filePath = entry.FilePath.Replace("/", "\\");
|
||||
var assetentry = new Entry()
|
||||
{
|
||||
Name = file_name,
|
||||
FontSize = 18,
|
||||
OnClick = (container) =>
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||
string filePath = entry.FilePath.Replace("/", "\\");
|
||||
System.Diagnostics.Process.Start("explorer.exe", "/select," + filePath);
|
||||
#else
|
||||
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
LoadedAssetEntries.Add(entry.Name, assetentry);
|
||||
@@ -54,7 +58,7 @@ public class UISettingsAssets : MonoBehaviour
|
||||
|
||||
public void CopyAllLoadedAssets()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
|
||||
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
|
||||
{
|
||||
@@ -88,7 +92,7 @@ public class UISettingsAssets : MonoBehaviour
|
||||
|
||||
public void CopyCurrentUmaAssets()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
if(UmaViewerBuilder.Instance.CurrentUMAContainer == null)
|
||||
{
|
||||
UmaViewerUI.Instance.ShowMessage("No Umamusume loaded", UIMessageType.Warning);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
using SFB;
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,7 @@ public class UISettingsModel : MonoBehaviour
|
||||
|
||||
public void ExportModel()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
var container = Builder.CurrentUMAContainer;
|
||||
if (container)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
using SFB;
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UISettingsOther : MonoBehaviour
|
||||
@@ -15,22 +21,151 @@ public class UISettingsOther : MonoBehaviour
|
||||
public TMP_Dropdown RegionDropdown;
|
||||
public TMP_Dropdown WorkModeDropdown;
|
||||
public TMP_Dropdown LanguageDropdown;
|
||||
public TMP_Dropdown FrameRateDropdown;
|
||||
private GameObject _runtimeFrameRateRow;
|
||||
private IEnumerator _updateResVerCoroutine;
|
||||
|
||||
public void ApplySettings()
|
||||
{
|
||||
EnsureLanguageOptions();
|
||||
EnsureFrameRateDropdown();
|
||||
WorkModeDropdown.SetValueWithoutNotify((int)Config.Instance.WorkMode);
|
||||
RegionDropdown.SetValueWithoutNotify((int)Config.Instance.Region);
|
||||
LanguageDropdown.SetValueWithoutNotify((int)Config.Instance.Language);
|
||||
LanguageDropdown.SetValueWithoutNotify(LanguageToDropdownValue(Config.Instance.Language));
|
||||
FrameRateDropdown?.SetValueWithoutNotify(FrameRateToDropdownValue(Config.Instance.GetTargetFrameRate()));
|
||||
FrameRateDropdown?.RefreshShownValue();
|
||||
UmaViewerMain.ApplyFrameRateLimit();
|
||||
UpdateDBButton.interactable = (Config.Instance.WorkMode == WorkMode.Standalone);
|
||||
}
|
||||
|
||||
private void EnsureLanguageOptions()
|
||||
{
|
||||
if (LanguageDropdown == null)
|
||||
return;
|
||||
|
||||
var options = new List<string>
|
||||
{
|
||||
"简体中文",
|
||||
"English",
|
||||
"日本語"
|
||||
};
|
||||
|
||||
bool optionsMatch = LanguageDropdown.options.Count == options.Count;
|
||||
if (optionsMatch)
|
||||
{
|
||||
for (int i = 0; i < options.Count; i++)
|
||||
{
|
||||
if (LanguageDropdown.options[i].text != options[i])
|
||||
{
|
||||
optionsMatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!optionsMatch)
|
||||
{
|
||||
LanguageDropdown.ClearOptions();
|
||||
LanguageDropdown.AddOptions(options);
|
||||
}
|
||||
}
|
||||
|
||||
private int LanguageToDropdownValue(Language language)
|
||||
{
|
||||
switch (language)
|
||||
{
|
||||
case Language.Cn:
|
||||
return 0;
|
||||
case Language.En:
|
||||
return 1;
|
||||
case Language.Jp:
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
private Language DropdownValueToLanguage(int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
return Language.Cn;
|
||||
case 1:
|
||||
return Language.En;
|
||||
case 2:
|
||||
default:
|
||||
return Language.Jp;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureFrameRateDropdown()
|
||||
{
|
||||
if (FrameRateDropdown != null || LanguageDropdown == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sourceRow = LanguageDropdown.transform.parent;
|
||||
var parent = sourceRow.parent;
|
||||
_runtimeFrameRateRow = Instantiate(sourceRow.gameObject, parent);
|
||||
_runtimeFrameRateRow.name = "FrameRate";
|
||||
_runtimeFrameRateRow.transform.SetSiblingIndex(sourceRow.GetSiblingIndex() + 1);
|
||||
|
||||
var label = _runtimeFrameRateRow.transform.GetChild(0).GetComponentInChildren<TextMeshProUGUI>(true);
|
||||
if (label != null)
|
||||
{
|
||||
label.text = "Frame Rate";
|
||||
}
|
||||
|
||||
FrameRateDropdown = _runtimeFrameRateRow.GetComponentInChildren<TMP_Dropdown>(true);
|
||||
FrameRateDropdown.name = "FrameRateDropdown";
|
||||
FrameRateDropdown.ClearOptions();
|
||||
FrameRateDropdown.AddOptions(new List<string> { "60 FPS", "30 FPS" });
|
||||
FrameRateDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent();
|
||||
FrameRateDropdown.onValueChanged.AddListener(ChangeFrameRate);
|
||||
|
||||
var parentRect = parent as RectTransform;
|
||||
var sourceRect = sourceRow as RectTransform;
|
||||
if (parentRect != null && sourceRect != null)
|
||||
{
|
||||
parentRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, parentRect.rect.height + sourceRect.rect.height);
|
||||
LayoutRebuilder.MarkLayoutForRebuild(parentRect);
|
||||
}
|
||||
}
|
||||
|
||||
private int FrameRateToDropdownValue(int frameRate)
|
||||
{
|
||||
return frameRate == 30 ? 1 : 0;
|
||||
}
|
||||
|
||||
private int DropdownValueToFrameRate(int value)
|
||||
{
|
||||
return value == 1 ? 30 : 60;
|
||||
}
|
||||
|
||||
public void ChangeFrameRate(int value)
|
||||
{
|
||||
var frameRate = DropdownValueToFrameRate(value);
|
||||
if (Config.Instance.TargetFrameRate != frameRate)
|
||||
{
|
||||
Config.Instance.TargetFrameRate = frameRate;
|
||||
Config.Instance.UpdateConfig(false);
|
||||
}
|
||||
UmaViewerMain.ApplyFrameRateLimit();
|
||||
}
|
||||
|
||||
public void ChangeLanguage(int lang)
|
||||
{
|
||||
if ((int)Config.Instance.Language != lang)
|
||||
Language language = DropdownValueToLanguage(lang);
|
||||
if (Config.Instance.Language != language)
|
||||
{
|
||||
Config.Instance.Language = (Language)lang;
|
||||
Config.Instance.UpdateConfig(true);
|
||||
Config.Instance.Language = language;
|
||||
Config.Instance.UpdateConfig(false);
|
||||
|
||||
// Rebuild all localized lists and reload English translations when
|
||||
// necessary without requiring the application process to restart.
|
||||
Scene activeScene = SceneManager.GetActiveScene();
|
||||
SceneManager.LoadScene(activeScene.buildIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,15 +197,22 @@ public class UISettingsOther : 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]))
|
||||
#if UNITY_EDITOR
|
||||
// Editor 里用 Unity 自带的选文件夹(不会走 SFB 的原生 .bundle,因此不会 DllNotFoundException)
|
||||
var p = EditorUtility.OpenFolderPanel("Select Folder", Config.Instance.MainPath, "");
|
||||
if (!string.IsNullOrEmpty(p) && p != Config.Instance.MainPath)
|
||||
{
|
||||
if (path[0] != Config.Instance.MainPath)
|
||||
{
|
||||
Config.Instance.MainPath = path[0];
|
||||
Config.Instance.UpdateConfig(true);
|
||||
}
|
||||
Config.Instance.MainPath = p;
|
||||
Config.Instance.UpdateConfig(true);
|
||||
}
|
||||
|
||||
#elif UNITY_STANDALONE
|
||||
// Standalone 运行时仍走 SFB(如果以后要打包到 mac App,这里建议再换成更现代的方案)
|
||||
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
|
||||
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]) && path[0] != Config.Instance.MainPath)
|
||||
{
|
||||
Config.Instance.MainPath = path[0];
|
||||
Config.Instance.UpdateConfig(true);
|
||||
}
|
||||
#else
|
||||
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
|
||||
@@ -79,7 +221,7 @@ public class UISettingsOther : MonoBehaviour
|
||||
|
||||
public void OpenConfig()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
if (File.Exists(Config.configPath))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
using SFB;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
@@ -16,6 +16,8 @@ public class UISettingsSound : MonoBehaviour
|
||||
public TextMeshProUGUI ProgressText;
|
||||
public Slider ProgressSlider;
|
||||
public Button PlayButton;
|
||||
public Sprite PlayIcon;
|
||||
public Sprite PauseIcon;
|
||||
public Text LyricsText;
|
||||
|
||||
internal void UpdateTrack(AudioSource mianSource)
|
||||
@@ -25,6 +27,7 @@ public class UISettingsSound : MonoBehaviour
|
||||
ProgressSlider.SetValueWithoutNotify(mianSource.time / mianSource.clip.length);
|
||||
LyricsText.text = UmaUtility.GetCurrentLyrics(mianSource.time, UmaViewerBuilder.Instance.CurrentLyrics);
|
||||
LyricsText.text = LyricsText.text;
|
||||
UpdatePlayButtonIcon(mianSource.isPlaying);
|
||||
}
|
||||
|
||||
public void PauseAudio()
|
||||
@@ -49,6 +52,8 @@ public class UISettingsSound : MonoBehaviour
|
||||
source.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
UpdatePlayButtonIcon(!state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +64,8 @@ public class UISettingsSound : MonoBehaviour
|
||||
{
|
||||
source.Stop();
|
||||
}
|
||||
|
||||
UpdatePlayButtonIcon(false);
|
||||
}
|
||||
|
||||
public void ResetPlayer()
|
||||
@@ -67,11 +74,20 @@ public class UISettingsSound : MonoBehaviour
|
||||
ProgressText.text = "00:00:00 / 00:00:00";
|
||||
ProgressSlider.SetValueWithoutNotify(0);
|
||||
LyricsText.text = "";
|
||||
UpdatePlayButtonIcon(false);
|
||||
}
|
||||
|
||||
private void UpdatePlayButtonIcon(bool isPlaying)
|
||||
{
|
||||
if (PlayButton)
|
||||
{
|
||||
PlayButton.image.sprite = isPlaying ? PauseIcon : PlayIcon;
|
||||
}
|
||||
}
|
||||
|
||||
public void ExportAudio()
|
||||
{
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
var LiveSources = Builder.CurrentLiveSoundAWB;
|
||||
if (LiveSources.Count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user