diff --git a/Qwilight/Qwilight/System/BaseUI/BaseUI.cs b/Qwilight/Qwilight/System/BaseUI/BaseUI.cs index d124275..a59a53c 100644 --- a/Qwilight/Qwilight/System/BaseUI/BaseUI.cs +++ b/Qwilight/Qwilight/System/BaseUI/BaseUI.cs @@ -753,8 +753,8 @@ lsCaller.DoString(File.ReadAllText(luaFilePath, Encoding.UTF8)); } - DefaultLength = GetCalledValue(formatNode, "defaultLength", "1280"); - DefaultHeight = GetCalledValue(formatNode, "defaultHeight", "720"); + DefaultLength = GetCalledValue(formatNode, "defaultLength", "1280.0"); + DefaultHeight = GetCalledValue(formatNode, "defaultHeight", "720.0"); SiteDateColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteDate", nameof(Colors.White))).GetColor()); SiteEnterColor = Utility.ModifyColor(GetCalledText(Utility.GetText(paintNode, "siteEnter", nameof(Colors.White))).GetColor()); diff --git a/Qwilight/Qwilight/System/UI/DrawingComponent.cs b/Qwilight/Qwilight/System/UI/DrawingComponent.cs index 91521af..934e5e3 100644 --- a/Qwilight/Qwilight/System/UI/DrawingComponent.cs +++ b/Qwilight/Qwilight/System/UI/DrawingComponent.cs @@ -11,9 +11,6 @@ public int hitNotePaintComposition; public int hitInputPaintComposition; - public float defaultLength; - public float defaultHeight; - public float audioVisualizerPosition0; public float audioVisualizerPosition1; public float audioVisualizerLength; diff --git a/Qwilight/Qwilight/System/UI/UI.cs b/Qwilight/Qwilight/System/UI/UI.cs index 2cc4d86..ad049e6 100644 --- a/Qwilight/Qwilight/System/UI/UI.cs +++ b/Qwilight/Qwilight/System/UI/UI.cs @@ -365,6 +365,9 @@ Script.RunString(UILS); lsCaller.DoString(UILS); + DefaultLength = GetCalledValue(formatNode, "defaultLength", "1280.0"); + DefaultHeight = GetCalledValue(formatNode, "defaultHeight", "720.0"); + var setPaintPipelines = Utility.ToBool(Utility.GetText(funcNode, "set-paint-pinelines", bool.FalseString)); foreach (var pipeline in GetCalledText(Utility.GetText(funcNode, "pipeline")).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var pipeline) ? pipeline : 0)) { @@ -413,9 +416,6 @@ parallelItems.Add(() => DrawingSystem.Instance.SetFaintPaints(this, NetTextPaints, Utility.GetText(paintNode, "netText", nameof(Colors.White)).GetColor())); parallelItems.Add(() => DrawingSystem.Instance.SetFaintPaints(this, NetWallPaints, Utility.GetText(paintNode, "netWall", nameof(Colors.Black)).GetColor())); - SaveValueMap(formatNode, "defaultLength", 1280.0); - SaveValueMap(formatNode, "defaultHeight", 720.0); - SaveValueMap(pointNode, "mainPosition"); SaveValueMap(pointNode, "p2Position"); @@ -884,6 +884,7 @@ { return new int[] { default }.Concat(GetCalledText(Utility.GetText(funcNode, $"drawingInputMode{mode}", defaultValue)).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => 0 < drawingPipeline && drawingPipeline < HighestNoteID)).ToArray(); } + int[] GetDrawingInputMode2P(int mode, string defaultValue) { var drawingInputModeMap = GetDrawingInputMode(mode, defaultValue).Skip(1).ToArray(); @@ -895,6 +896,25 @@ _ => throw new ArgumentException("drawingInputModeSystem") }; } + + double GetCalledValue(YamlNode yamlNode, string target, string defaultValue = null) + { + var text = Utility.GetText(yamlNode, target, defaultValue); + if (Utility.ToFloat64(text, out var r)) + { + return r; + } + else if (QwilightComponent.GetCallComputer().IsMatch(text)) + { + var values = text.Split("(").Select(value => value.Trim()).ToArray(); + return lsCaller.Call(lsCaller.Globals[values[0]], values[1][0..^1].Split(',').Where(value => !string.IsNullOrEmpty(value)).Select(value => Utility.ToFloat64(value) as object).ToArray()).Number; + } + else + { + throw new ArgumentException(target.ToString()); + } + } + string GetCalledText(string text) { if (QwilightComponent.GetCallComputer().IsMatch(text)) @@ -2164,6 +2184,8 @@ Array.Clear(data, 0, data.Length); } } + DefaultLength = 1280.0; + DefaultHeight = 720.0; _audioItemMap.Clear(); ValueCallMap.Clear(); ValueMap.Clear(); diff --git a/Qwilight/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/Qwilight/ViewModel/MainViewModel.cs index 6c63cdf..0d15569 100644 --- a/Qwilight/Qwilight/ViewModel/MainViewModel.cs +++ b/Qwilight/Qwilight/ViewModel/MainViewModel.cs @@ -398,9 +398,9 @@ OnPropertyChanged(nameof(CanHigherTwilightCommentFavor)); } - public double DefaultLength => IsComputingMode ? Computer.DrawingComponentValue.defaultLength : BaseUI.Instance.DefaultLength; + public double DefaultLength => IsComputingMode ? UI.Instance.DefaultLength : BaseUI.Instance.DefaultLength; - public double DefaultHeight => IsComputingMode ? Computer.DrawingComponentValue.defaultHeight : BaseUI.Instance.DefaultHeight; + public double DefaultHeight => IsComputingMode ? UI.Instance.DefaultHeight : BaseUI.Instance.DefaultHeight; public bool IsNoteFileMode => ModeValue == Mode.NoteFile;