diff --git a/Qwilight/Assets/System 16/Audio/1221.mp3 b/Qwilight/Assets/System 16/Audio/1221.mp3 new file mode 100644 index 0000000..e463e63 --- /dev/null +++ b/Qwilight/Assets/System 16/Audio/1221.mp3 Binary files differ diff --git a/Qwilight/Assets/System 16/Audio/1221.wav b/Qwilight/Assets/System 16/Audio/1221.wav deleted file mode 100644 index cde4f9f..0000000 --- a/Qwilight/Assets/System 16/Audio/1221.wav +++ /dev/null Binary files differ diff --git a/Qwilight/Assets/System 16/Audio/1225.mp3 b/Qwilight/Assets/System 16/Audio/1225.mp3 new file mode 100644 index 0000000..c393ac2 --- /dev/null +++ b/Qwilight/Assets/System 16/Audio/1225.mp3 Binary files differ diff --git a/Qwilight/Assets/System 16/Audio/1225.wav b/Qwilight/Assets/System 16/Audio/1225.wav deleted file mode 100644 index bcec05c..0000000 --- a/Qwilight/Assets/System 16/Audio/1225.wav +++ /dev/null Binary files differ diff --git a/Qwilight/Assets/UI/@Default/@Default.zip b/Qwilight/Assets/UI/@Default/@Default.zip index e0f80aa..b42caa5 100644 --- a/Qwilight/Assets/UI/@Default/@Default.zip +++ b/Qwilight/Assets/UI/@Default/@Default.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7258699ef025a493ce4c50985a62b6811289a9f781b63e9eba0182719bebb7b6 -size 81036037 +oid sha256:3d651016dd419c9469842577db006ea6cdd0e0b9f7ca05ee480837be82977a85 +size 55913216 diff --git a/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Compute/DefaultCompute.cs index 4e03747..e6363b2 100644 --- a/Qwilight/Compute/DefaultCompute.cs +++ b/Qwilight/Compute/DefaultCompute.cs @@ -97,7 +97,7 @@ }; readonly Action _lazyInit; - readonly double[] _paintPropertyMillis = new double[UI.HighestPaintPropertyID]; + readonly double[] _paintPropertyMillis = new double[UI.MaxPaintPropertyID]; readonly double[] _hitLongNotePaintMillis = new double[53]; readonly double[] _lastEnlargedBandPaintMillis = new double[53]; readonly int[] _targetMainFrames = new int[53]; @@ -227,7 +227,7 @@ public int[] MainJudgmentMeterFrames { get; } = new int[53]; - public int[] PaintPropertyFrames { get; } = new int[UI.HighestPaintPropertyID]; + public int[] PaintPropertyFrames { get; } = new int[UI.MaxPaintPropertyID]; public int AutoMainFrame { get; set; } @@ -4676,9 +4676,9 @@ { if (!IsInEvents) { - if (!UI.Instance.HandleAudio(audioFileName, null, null, 0.0)) + if (!UI.Instance.HandleAudio(audioFileName)) { - BaseUI.Instance.HandleAudio(audioFileName, null, null, 0.0); + BaseUI.Instance.HandleAudio(audioFileName); } } } diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj index a89b66a..e2c97d7 100644 --- a/Qwilight/Qwilight.csproj +++ b/Qwilight/Qwilight.csproj @@ -201,6 +201,12 @@ Always + + Always + + + Always + Always @@ -222,12 +228,6 @@ Always - - Always - - - Always - Always diff --git a/Qwilight/System/BaseUI/BaseUI.cs b/Qwilight/System/BaseUI/BaseUI.cs index 0bdd9c9..f6a563a 100644 --- a/Qwilight/System/BaseUI/BaseUI.cs +++ b/Qwilight/System/BaseUI/BaseUI.cs @@ -6,6 +6,7 @@ using MoonSharp.Interpreter; using Qwilight.Compute; using Qwilight.NoteFile; +using Qwilight.System16; using Qwilight.UIComponent; using Qwilight.Utilities; using Qwilight.ViewModel; @@ -26,8 +27,8 @@ { public sealed partial class BaseUI : Model, IAudioContainer, IDrawingContainer, IMediaContainer, IMediaHandler { - public const int HighestBaseUIConfigure = 16; - public const int HighestPaintPropertyID = 256; + public const int MaxBaseUIConfigure = 16; + public const int MaxPaintPropertyID = 256; [GeneratedRegex(@"^\[.*\]$")] private static partial Regex GetMultipleMediaFilePathsComputer(); @@ -70,7 +71,7 @@ public string GetDefaultAudioFileName(int randomMillis) => _defaultAudioItemMap.IsEmpty ? null : _defaultAudioItemMap.Keys.ElementAt(randomMillis % _defaultAudioItemMap.Count); - public bool HandleAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0) + public bool HandleAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0, int audioVariety = AudioSystem.SEAudio) { lock (UI.Instance.LoadedCSX) { @@ -79,9 +80,9 @@ { wasHandled = true; } - else if (defaultFileName != null) + else if (defaultFileName != null && _audioItemMap.TryGetValue(defaultFileName, out audioItem)) { - wasHandled = _audioItemMap.TryGetValue(defaultFileName, out audioItem); + wasHandled = true; } if (wasHandled) { @@ -93,7 +94,7 @@ { AudioLevyingPosition = pausableAudioHandler?.GetAudioPosition() ?? 0U, AudioItem = audioItem - }, AudioSystem.SEAudio, 1.0, false, pausableAudioHandler, fadeInLength); + }, audioVariety, 1.0, false, pausableAudioHandler, fadeInLength); } return wasHandled; } @@ -101,7 +102,7 @@ public XamlBaseUIConfigure[] XamlBaseUIConfigures { get; set; } - public string[] LoadedConfigures { get; } = new string[HighestBaseUIConfigure]; + public string[] LoadedConfigures { get; } = new string[MaxBaseUIConfigure]; public string FaultText { get; set; } @@ -639,7 +640,7 @@ public CanvasTextFormat CommentPlace1Font { get; } = DrawingSystem.Instance.GetFont(); - public BasePaintProperty[] PaintProperties { get; } = new BasePaintProperty[HighestPaintPropertyID]; + public BasePaintProperty[] PaintProperties { get; } = new BasePaintProperty[MaxPaintPropertyID]; public ConcurrentDictionary> EventItems { get; } = new(); @@ -712,11 +713,40 @@ #endregion Init(); + string zipName; var lsCaller = new Script(); var parallelItems = new ConcurrentBag(); + if (System16Components.Is1221) + { + parallelItems.Add(() => + { + try + { + var audioFilePath = Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Audio", "1221.mp3"); + _audioItemMap[audioFilePath] = AudioSystem.Instance.Load(audioFilePath, this, 1F, null, true); + } + catch + { + } + }); + } + if (System16Components.Is1225) + { + parallelItems.Add(() => + { + try + { + var audioFilePath = Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Audio", "1225.mp3"); + _audioItemMap[audioFilePath] = AudioSystem.Instance.Load(audioFilePath, this, 1F, null, true); + } + catch + { + } + }); + } var ys = new YamlStream(); using (var sr = File.OpenText(target.GetYamlFilePath())) @@ -732,7 +762,7 @@ zipName = $"@{Utility.GetText(formatNode, "zip")}"; - XamlBaseUIConfigures = Enumerable.Range(0, HighestBaseUIConfigure).Select(i => + XamlBaseUIConfigures = Enumerable.Range(0, MaxBaseUIConfigure).Select(i => { var configures = (Utility.GetText(lambdaNode, $"configure-{i}-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(lambdaNode, $"configure-{i}"))?.Split(',')?.Select(configure => configure.Trim())?.ToArray(); if (configures != null) @@ -1075,12 +1105,11 @@ if (!string.IsNullOrEmpty(text)) { var data = text.Split(",").Select(value => GetCalledText(value.Trim())).ToArray(); - var frame = Utility.ToInt32(data[4]); var drawingVariety = Utility.ToInt32(data[7]); var paintProperty = new BasePaintProperty { PaintBound = new(Utility.ToFloat64(data[0]), Utility.ToFloat64(data[1]), Utility.ToFloat64(data[2]), Utility.ToFloat64(data[3])), - Frame = frame, + Frame = Utility.ToInt32(data[4]), Framerate = Utility.ToFloat64(data[5]), Layer = Utility.ToInt32(data[6]), DrawingVariety = drawingVariety, @@ -1392,16 +1421,21 @@ break; case "Drawing": var fileNameContents = justFileName.Split(' '); - Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var value1); - Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var value2); - Utility.ToInt32(fileNameContents.ElementAtOrDefault(3), out var value3); - if (fileNameContents[0] == getPaintProperty([value1, value2, value3])) + Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var paintPropertyID); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var frame); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(3), out var random); + if (fileNameContents[0] == getPaintProperty([paintPropertyID, frame, random])) { NewHandledDrawing(rms); } - else if (fileNameContents[0] == getTransition([value1, value2, value3])) + else { - NewHandledDrawing(rms); + var mode = paintPropertyID; + var fadingViewLayer = random; + if (fileNameContents[0] == getTransition([mode, fadingViewLayer, frame])) + { + NewHandledDrawing(rms); + } } break; case "Input": @@ -1568,9 +1602,9 @@ if (paintProperty?.DrawingVariety == 11) { var etc = paintProperty.Etc; - paintProperty.HandledMediaItems = (GetMultipleMediaFilePathsComputer().IsMatch(etc) ? etc.Substring(etc.IndexOf('[') + 1, etc.LastIndexOf(']') - 1).Split(',').Select(text => text.Trim()) : [etc]).Select(mediaFilePath => + paintProperty.HandledMediaItems = (GetMultipleMediaFilePathsComputer().IsMatch(etc) ? etc.Substring(etc.IndexOf('[') + 1, etc.LastIndexOf(']') - 1).Split(',').Select(text => text.Trim()) : [etc]).Select(mediaFileName => { - if (handledMediaValues.TryGetValue(mediaFilePath, out var handledMediaItem)) + if (handledMediaValues.TryGetValue(mediaFileName, out var handledMediaItem)) { return handledMediaItem; } @@ -1578,7 +1612,7 @@ { try { - return MediaSystem.Instance.Load(Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, paintProperty.Etc), this, true); + return MediaSystem.Instance.Load(Path.Combine(QwilightComponent.UIEntryPath, target.UIEntry, mediaFileName), this, true); } catch { @@ -1862,12 +1896,12 @@ { case "Drawing": var fileNameContents = justFileName.Split(' '); - Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var value1); - Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var value2); - Utility.ToInt32(fileNameContents.ElementAtOrDefault(3), out var value3); - if (fileNameContents[0] == getPaintProperty([value1, value2, value3])) + Utility.ToInt32(fileNameContents.ElementAtOrDefault(1), out var paintPropertyID); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(2), out var random); + Utility.ToInt32(fileNameContents.ElementAtOrDefault(3), out var frame); + if (fileNameContents[0] == getPaintProperty([paintPropertyID, random, frame])) { - var paintProperty = PaintProperties[value1]; + var paintProperty = PaintProperties[paintPropertyID]; switch (fileNameContents.Length) { case 2: @@ -1881,24 +1915,29 @@ case 3: if (!paintProperty.HandledDrawingItemMap.TryGetValue(0, out handledDrawingItems)) { - handledDrawingItems = (new HandledDrawingItem?[paintProperty.Frame]); + handledDrawingItems = new HandledDrawingItem?[paintProperty.Frame]; paintProperty.HandledDrawingItemMap[0] = handledDrawingItems; } - handledDrawingItems[value2] = handledDrawingItem; + handledDrawingItems[frame] = handledDrawingItem; break; case 4: - if (!paintProperty.HandledDrawingItemMap.TryGetValue(value2, out handledDrawingItems)) + if (!paintProperty.HandledDrawingItemMap.TryGetValue(random, out handledDrawingItems)) { - handledDrawingItems = (new HandledDrawingItem?[paintProperty.Frame]); - paintProperty.HandledDrawingItemMap[value2] = handledDrawingItems; + handledDrawingItems = new HandledDrawingItem?[paintProperty.Frame]; + paintProperty.HandledDrawingItemMap[random] = handledDrawingItems; } - handledDrawingItems[value3] = handledDrawingItem; + handledDrawingItems[frame] = handledDrawingItem; break; } } - else if (fileNameContents[0] == getTransition([value1, value2])) + else { - FadingProperties[value1][value2].HandledDrawingItems.SetValue(Utility.ToInt32(fileNameContents[3]), handledDrawingItem); + var mode = paintPropertyID; + var fadingViewLayer = random; + if (fileNameContents[0] == getTransition([mode, fadingViewLayer, frame])) + { + FadingProperties[mode][fadingViewLayer].HandledDrawingItems.SetValue(frame, handledDrawingItem); + } } break; case "Input": @@ -1998,11 +2037,11 @@ for (var i = PaintProperties.Length - 1; i >= 0; --i) { var paintProperty = PaintProperties[i]; - var frame = paintProperty?.Frame ?? 0; - if (frame > 0) + if (paintProperty != null) { foreach (var handledDrawingItems in paintProperty.HandledDrawingItemMap.Values) { + var frame = handledDrawingItems.Length; for (var j = 1; j < frame; ++j) { handledDrawingItems[j] ??= handledDrawingItems[j - 1]; @@ -2013,27 +2052,28 @@ for (var i = FadingProperties.Length - 1; i >= 0; --i) { - for (var j = FadingProperties[i].Length - 1; j >= 0; --j) + var fadingProperty = FadingProperties[i]; + for (var j = fadingProperty.Length - 1; j >= 0; --j) { - var frame = FadingProperties[i][j]?.Frame ?? 0; + var frame = fadingProperty[j]?.Frame ?? 0; for (var m = 1; m < frame; ++m) { - FadingProperties[i][j].HandledDrawingItems[m] ??= FadingProperties[i][j].HandledDrawingItems[m - 1]; + fadingProperty[j].HandledDrawingItems[m] ??= fadingProperty[j].HandledDrawingItems[m - 1]; } } - for (var j = FadingProperties[i].Length - 1; j >= 2; --j) + for (var j = fadingProperty.Length - 1; j >= 2; --j) { - FadingProperties[i][j] ??= FadingProperties[i][1]; + fadingProperty[j] ??= fadingProperty[1]; } - for (var m = (FadingProperties[i][1]?.Frame ?? 0) - 1; m >= 0; --m) + for (var m = (fadingProperty[1]?.Frame ?? 0) - 1; m >= 0; --m) { - FadingProperties[i][1].HandledDrawingItems[m] ??= FadingProperties[i][0].HandledDrawingItems.ElementAtOrDefault(m); + fadingProperty[1].HandledDrawingItems[m] ??= fadingProperty[0].HandledDrawingItems.ElementAtOrDefault(m); } - for (var j = FadingProperties[i].Length - 1; j >= 2; --j) + for (var j = fadingProperty.Length - 1; j >= 2; --j) { - for (var m = (FadingProperties[i][j]?.Frame ?? 0) - 1; m >= 1; --m) + for (var m = (fadingProperty[j]?.Frame ?? 0) - 1; m >= 1; --m) { - FadingProperties[i][j].HandledDrawingItems[m] ??= FadingProperties[i][1].HandledDrawingItems.ElementAtOrDefault(m); + fadingProperty[j].HandledDrawingItems[m] ??= fadingProperty[1].HandledDrawingItems.ElementAtOrDefault(m); } } } @@ -2043,7 +2083,7 @@ void SetConfigures(Script lsCaller) { - lsCaller.Globals["configures"] = Enumerable.Range(0, HighestBaseUIConfigure).Select(i => + lsCaller.Globals["configures"] = Enumerable.Range(0, MaxBaseUIConfigure).Select(i => { return Math.Max(0, Array.IndexOf(XamlBaseUIConfigures.SingleOrDefault(value => value.Position == i)?.Configures ?? Array.Empty(), Configure.Instance.BaseUIConfigureValue.UIConfigures[i])); }).ToArray(); @@ -2199,7 +2239,7 @@ void OnLoaded() { - HandlePaintProperty(); + HandlePaintProperties(); DrawingSystem.Instance.LoadDefaultDrawing(); ViewModels.Instance.NotifyWindowViewModels(); mainViewModel.NotifyModel(); @@ -2207,18 +2247,18 @@ } } - public void HandlePaintProperty() + public void HandlePaintProperties() { - foreach (var paintProperty in PaintProperties) + foreach (var paintProperty in PaintProperties.Where(paintProperty => paintProperty != null)) { - var handledMediaItems = paintProperty?.HandledMediaItems; + var handledMediaItems = paintProperty.HandledMediaItems; if (handledMediaItems?.Length > 0) { var mode = paintProperty.Mode; paintProperty.MediaHandlerItem = MediaSystem.Instance.Handle(Random.Shared.GetItems(handledMediaItems, 1).Single(), this, mode == 1, mode == 0); } - var handledDrawingItems = paintProperty?.HandledDrawingItemMap?.Values?.ToArray(); - if (handledDrawingItems?.Length > 0) + var handledDrawingItems = paintProperty.HandledDrawingItemMap.Values.ToArray(); + if (handledDrawingItems.Length > 0) { paintProperty.HandledDrawingItems = Random.Shared.GetItems(handledDrawingItems, 1).Single(); } diff --git a/Qwilight/System/Configure/BaseUIConfigure.cs b/Qwilight/System/Configure/BaseUIConfigure.cs index 25c6283..1c756e1 100644 --- a/Qwilight/System/Configure/BaseUIConfigure.cs +++ b/Qwilight/System/Configure/BaseUIConfigure.cs @@ -5,7 +5,7 @@ double _defaultMediaFaint = 0.25; double _defaultAudioVisualizerFaint = 0.1; - public string[] UIConfigures { get; set; } = new string[BaseUI.HighestBaseUIConfigure]; + public string[] UIConfigures { get; set; } = new string[BaseUI.MaxBaseUIConfigure]; public double DefaultMediaFaint { diff --git a/Qwilight/System/Configure/UIConfigure.cs b/Qwilight/System/Configure/UIConfigure.cs index 22ec845..f697af6 100644 --- a/Qwilight/System/Configure/UIConfigure.cs +++ b/Qwilight/System/Configure/UIConfigure.cs @@ -14,7 +14,7 @@ double _bandPosition; double _judgmentPaintPosition; - public string[] UIConfiguresV2 { get; set; } = new string[UI.HighestUIConfigure]; + public string[] UIConfiguresV2 { get; set; } = new string[UI.MaxUIConfigure]; public double MainFaintV2 { diff --git a/Qwilight/System/UI/DrawingComponent.cs b/Qwilight/System/UI/DrawingComponent.cs index d8086f6..0bb1afc 100644 --- a/Qwilight/System/UI/DrawingComponent.cs +++ b/Qwilight/System/UI/DrawingComponent.cs @@ -422,8 +422,8 @@ public readonly object PaintPropertyCSX = new(); public readonly List PaintPropertyIDs = new(); - public readonly Dictionary[] PaintPropertyIntMap = new Dictionary[UI.HighestPaintPropertyID]; - public readonly Dictionary[] PaintPropertyMap = new Dictionary[UI.HighestPaintPropertyID]; + public readonly Dictionary[] PaintPropertyIntMap = new Dictionary[UI.MaxPaintPropertyID]; + public readonly Dictionary[] PaintPropertyMap = new Dictionary[UI.MaxPaintPropertyID]; /// /// 라인 길이 /// 플로팅 노트는 라인 길이가 0 이다. @@ -516,7 +516,7 @@ // 이 항목들은 Wall, Contents 함수등 기반이 되므로 먼저 처리 SaveValueMap("mainPosition"); - for (var i = UI.HighestNoteID; i > 0; --i) + for (var i = UI.MaxNoteID; i > 0; --i) { SaveValueMap($"noteLength{i}"); SaveValueMap($"floatingNotePosition0{i}"); diff --git a/Qwilight/System/UI/UI.cs b/Qwilight/System/UI/UI.cs index d4427de..4d9b718 100644 --- a/Qwilight/System/UI/UI.cs +++ b/Qwilight/System/UI/UI.cs @@ -21,9 +21,9 @@ { public sealed class UI : Model, IDrawingContainer, IAudioContainer { - public const int HighestUIConfigure = 16; - public const int HighestNoteID = 64; - public const int HighestPaintPropertyID = 256; + public const int MaxUIConfigure = 16; + public const int MaxNoteID = 64; + public const int MaxPaintPropertyID = 256; public static readonly UI Instance = QwilightComponent.GetBuiltInData(nameof(UI)); @@ -182,7 +182,7 @@ public DrawingItem?[] JudgmentInputDrawings { get; } = new DrawingItem?[6]; - public PaintProperty[] PaintProperties { get; } = new PaintProperty[HighestPaintPropertyID]; + public PaintProperty[] PaintProperties { get; } = new PaintProperty[MaxPaintPropertyID]; public DrawingItem?[][] JudgmentDrawings { get; } = new DrawingItem?[11][]; @@ -278,7 +278,7 @@ public DrawingItem?[] PausedConfigureDrawings { get; } = new DrawingItem?[2]; - public bool HandleAudio(string audioFileName, string defaultFileName, PausableAudioHandler pausableAudioHandler, double fadeInLength) + public bool HandleAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0, int audioVariety = AudioSystem.SEAudio) { lock (LoadedCSX) { @@ -297,7 +297,7 @@ { AudioLevyingPosition = pausableAudioHandler?.GetAudioPosition() ?? 0U, AudioItem = audioItem - }, AudioSystem.SEAudio, 1.0, false, pausableAudioHandler, fadeInLength); + }, audioVariety, 1.0, false, pausableAudioHandler, fadeInLength); } return wasHandled; } @@ -315,16 +315,19 @@ Init(); - var drawingMap = new int[HighestNoteID + 1][]; - drawingMap[0] = new[] { 0 }; - var noteHitDrawings = new DrawingItem?[HighestNoteID + 1][]; - var longNoteHitDrawings = new DrawingItem?[HighestNoteID + 1][]; - var inputDrawings = new DrawingItem?[HighestNoteID + 1][]; - var noteDrawings = new DrawingItem?[HighestNoteID + 1][][][]; - var mainDrawings = new DrawingItem?[HighestNoteID + 1][]; - var autoInputDrawings = new DrawingItem?[HighestNoteID + 1]; - var judgmentMainDrawings = new DrawingItem?[HighestNoteID + 1][]; - var mainJudgmentMeterDrawings = new Dictionary[HighestNoteID + 1]; + var drawingMap = new int[MaxNoteID + 1][]; + for (var i = drawingMap.Length - 1; i >= 0; --i) + { + drawingMap[i] = [i]; + } + var noteHitDrawings = new DrawingItem?[MaxNoteID + 1][]; + var longNoteHitDrawings = new DrawingItem?[MaxNoteID + 1][]; + var inputDrawings = new DrawingItem?[MaxNoteID + 1][]; + var noteDrawings = new DrawingItem?[MaxNoteID + 1][][][]; + var mainDrawings = new DrawingItem?[MaxNoteID + 1][]; + var autoInputDrawings = new DrawingItem?[MaxNoteID + 1]; + var judgmentMainDrawings = new DrawingItem?[MaxNoteID + 1][]; + var mainJudgmentMeterDrawings = new Dictionary[MaxNoteID + 1]; string zipName; var lsCaller = new Script(); @@ -346,7 +349,7 @@ zipName = Utility.GetText(formatNode, "zip", target.YamlName); - XamlUIConfigures = Enumerable.Range(0, HighestUIConfigure).Select(i => + XamlUIConfigures = Enumerable.Range(0, MaxUIConfigure).Select(i => { var configures = (Utility.GetText(lambdaNode, $"configure-{i}-{Utility.GetLCID(Configure.Instance.Language)}") ?? Utility.GetText(lambdaNode, $"configure-{i}"))?.Split(',')?.Select(configure => configure.Trim())?.ToArray(); if (configures != null) @@ -373,6 +376,11 @@ DefaultLength = GetCalledValue(formatNode, "defaultLength", Component.StandardLength.ToString()); DefaultHeight = GetCalledValue(formatNode, "defaultHeight", Component.StandardHeight.ToString()); + for (var i = drawingMap.Length - 1; i > 0; --i) + { + drawingMap[i] = GetCalledText(Utility.GetText(lambdaNode, $"drawing{i}", i.ToString())).Split(',').Select(value => Utility.ToInt32(value, out var main) ? main : 0).Where(main => 0 < main && main < MaxNoteID).ToArray(); + } + var setPaintPipelines = Utility.ToBool(Utility.GetText(lambdaNode, "set-paint-pinelines", bool.FalseString)); foreach (var pipeline in GetCalledText(Utility.GetText(lambdaNode, "pipeline")).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var pipeline) ? pipeline : 0)) { @@ -862,11 +870,6 @@ SaveValueMap(pointNode, "assistTextPosition1", 360.0); SaveValueMap(pointNode, "inputAssistTextPosition1", 480.0); - for (var i = HighestNoteID; i > 0; --i) - { - drawingMap[i] = GetCalledText(Utility.GetText(lambdaNode, $"drawing{i}", i.ToString())).Split(',').Select(value => Utility.ToInt32(value, out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => 0 < drawingPipeline && drawingPipeline < HighestNoteID).ToArray(); - } - DrawingInputModeMap[(int)Component.InputMode._4] = GetDrawingInputMode((int)Component.InputMode._4, "2, 3, 3, 2"); DrawingInputModeMap[(int)Component.InputMode._5] = GetDrawingInputMode((int)Component.InputMode._5, "2, 3, 4, 3, 2"); DrawingInputModeMap[(int)Component.InputMode._6] = GetDrawingInputMode((int)Component.InputMode._6, "2, 3, 2, 2, 3, 2"); @@ -885,11 +888,11 @@ DrawingInputModeMap[(int)Component.InputMode._48_4] = new[] { 0 }.Append(DrawingInputModeMap[(int)Component.InputMode._48_4][1]).Concat(DrawingInputModeMap[(int)Component.InputMode._48_4].Skip(1)).Append(DrawingInputModeMap[(int)Component.InputMode._48_4][50]).ToArray(); } - DrawingPipeline.AddRange(GetCalledText(Utility.GetText(lambdaNode, "drawingPipeline", string.Join(", ", Enumerable.Range(0, HighestNoteID)))).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => drawingPipeline < HighestNoteID)); + DrawingPipeline.AddRange(GetCalledText(Utility.GetText(lambdaNode, "drawingPipeline", string.Join(", ", Enumerable.Range(0, MaxNoteID)))).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => drawingPipeline < MaxNoteID)); int[] GetDrawingInputMode(int mode, string defaultValue) { - return new[] { 0 }.Concat(GetCalledText(Utility.GetText(lambdaNode, $"drawingInputMode{mode}", defaultValue)).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => 0 < drawingPipeline && drawingPipeline < HighestNoteID)).ToArray(); + return new[] { 0 }.Concat(GetCalledText(Utility.GetText(lambdaNode, $"drawingInputMode{mode}", defaultValue)).Split(',').Select(value => Utility.ToInt32(value.Trim(), out var drawingPipeline) ? drawingPipeline : 0).Where(drawingPipeline => 0 < drawingPipeline && drawingPipeline < MaxNoteID)).ToArray(); } int[] GetDrawingInputMode2P(int mode, string defaultValue) @@ -975,7 +978,7 @@ if (data != null) { string lastData = null; - for (var i = 0; i < HighestNoteID; ++i) + for (var i = 0; i < MaxNoteID; ++i) { var t = data.ElementAtOrDefault(i) ?? "~"; var s = t != "~" ? t : lastData; @@ -985,7 +988,7 @@ } else { - for (var i = HighestNoteID - 1; i >= 0; --i) + for (var i = MaxNoteID - 1; i >= 0; --i) { ValueMap[$"{target}{i + 1}"] = defaultValue; } @@ -997,7 +1000,7 @@ if (data != null) { string lastData = null; - for (var i = 0; i < HighestNoteID; ++i) + for (var i = 0; i < MaxNoteID; ++i) { var t = data.ElementAtOrDefault(i) ?? "~"; var s = t != "~" ? t : lastData; @@ -1007,7 +1010,7 @@ } else { - for (var i = HighestNoteID - 1; i >= 0; --i) + for (var i = MaxNoteID - 1; i >= 0; --i) { if (ValueMap.TryGetValue(defaultValueID, out var defaultValue)) { @@ -1522,15 +1525,15 @@ switch (fileNameContents.Length) { case 2: - for (var i = HighestNoteID; i > 0; --i) + for (var i = MaxNoteID; i > 0; --i) { noteHitDrawings.SetValue(i, main, drawingItem); } break; case 3: - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - noteHitDrawings.SetValue(drawingMapValue, frame, drawingItem); + noteHitDrawings.SetValue(drawing, frame, drawingItem); } break; } @@ -1540,15 +1543,15 @@ switch (fileNameContents.Length) { case 2: - for (var i = HighestNoteID; i > 0; --i) + for (var i = MaxNoteID; i > 0; --i) { longNoteHitDrawings.SetValue(i, main, drawingItem); } break; case 3: - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - longNoteHitDrawings.SetValue(drawingMapValue, frame, drawingItem); + longNoteHitDrawings.SetValue(drawing, frame, drawingItem); } break; } @@ -1617,9 +1620,9 @@ if (fileNameContents[0] == getNote([main, frame, text, longNoteContents])) { var status = fileNameContents.Length > 4 ? longNoteContents : LongNote.LongNoteBefore; - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - noteDrawings.SetValue(drawingMapValue, frame, text, status, drawingItem); + noteDrawings.SetValue(drawing, frame, text, status, drawingItem); } } break; @@ -1629,9 +1632,9 @@ frame = Utility.ToInt32(fileNameContents.ElementAtOrDefault(2)); if (fileNameContents[0] == getMain([main, frame])) { - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - mainDrawings.SetValue(drawingMapValue, frame, drawingItem); + mainDrawings.SetValue(drawing, frame, drawingItem); } } else if (fileNameContents[0] == getWall([main, frame])) @@ -1640,25 +1643,25 @@ } else if (fileNameContents[0] == getAutoInput([main, frame])) { - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - autoInputDrawings.SetValue(drawingMapValue, drawingItem); + autoInputDrawings.SetValue(drawing, drawingItem); } } else if (fileNameContents[0] == getJudgmentMain([main, frame])) { - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - judgmentMainDrawings.SetValue(drawingMapValue, frame, drawingItem); + judgmentMainDrawings.SetValue(drawing, frame, drawingItem); } } else if (fileNameContents[0] == getMainJudgmentMeter([main, frame])) { if (main > 0) { - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - mainJudgmentMeterDrawings[drawingMapValue][frame] = drawingItem; + mainJudgmentMeterDrawings[drawing][frame] = drawingItem; } } else @@ -1676,11 +1679,11 @@ frame = Utility.ToInt32(fileNameContents[2]); if (fileNameContents[0] == getInput([main, frame])) { - foreach (var drawingMapValue in drawingMap[main]) + foreach (var drawing in drawingMap[main]) { - if (drawingMapValue > 0) + if (drawing > 0) { - inputDrawings.SetValue(drawingMapValue, frame, drawingItem); + inputDrawings.SetValue(drawing, frame, drawingItem); } } } @@ -2205,7 +2208,7 @@ public void SetConfigures(Script lsCaller) { - lsCaller.Globals["configures"] = Enumerable.Range(0, HighestUIConfigure).Select(i => + lsCaller.Globals["configures"] = Enumerable.Range(0, MaxUIConfigure).Select(i => { return Math.Max(0, Array.IndexOf(XamlUIConfigures.SingleOrDefault(value => value.Position == i)?.Configures ?? Array.Empty(), Configure.Instance.UIConfigureValue.UIConfiguresV2[i])); }).ToArray(); diff --git a/Qwilight/System16/MSG/WipeSystem16View.cs b/Qwilight/System16/MSG/WipeSystem16View.cs index 34894f3..21e6d38 100644 --- a/Qwilight/System16/MSG/WipeSystem16View.cs +++ b/Qwilight/System16/MSG/WipeSystem16View.cs @@ -1,8 +1,6 @@ -using CommunityToolkit.Mvvm.Messaging.Messages; - -namespace Qwilight.System16.MSG +namespace Qwilight.System16.MSG { - public sealed class WipeSystem16View : RequestMessage + public sealed class WipeSystem16View { } } \ No newline at end of file diff --git a/Qwilight/System16/System16Components.cs b/Qwilight/System16/System16Components.cs index 558ec7d..3a7cac7 100644 --- a/Qwilight/System16/System16Components.cs +++ b/Qwilight/System16/System16Components.cs @@ -2,7 +2,8 @@ { public static class System16Components { - public static readonly bool Is1221 = DateTime.Now.Month == 12 && DateTime.Now.Day == 21; - public static readonly bool Is1225 = DateTime.Now.Month == 12 && (DateTime.Now.Day == 24 | DateTime.Now.Day == 25); + public static bool Is1221 { get; set; } = DateTime.Now.Month == 12 && DateTime.Now.Day == 21; + + public static bool Is1225 { get; set; } = DateTime.Now.Month == 12 && (DateTime.Now.Day == 24 | DateTime.Now.Day == 25); } } diff --git a/Qwilight/System16/View/System16View.xaml b/Qwilight/System16/View/System16View.xaml index fc5cf6d..b6c3f0f 100644 --- a/Qwilight/System16/View/System16View.xaml +++ b/Qwilight/System16/View/System16View.xaml @@ -4,5 +4,4 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" IsHitTestVisible="False" IsVisibleChanged="OnVisibilityModified" - DataContext="{Binding RelativeSource={RelativeSource Self}}" - Visibility="{Binding IsViewVisible, Converter={StaticResource VisibilityModifier}}"/> \ No newline at end of file + DataContext="{Binding RelativeSource={RelativeSource Self}}" /> \ No newline at end of file diff --git a/Qwilight/System16/View/System16View.xaml.cs b/Qwilight/System16/View/System16View.xaml.cs index 26164ce..89af7ce 100644 --- a/Qwilight/System16/View/System16View.xaml.cs +++ b/Qwilight/System16/View/System16View.xaml.cs @@ -4,6 +4,7 @@ using Qwilight.ViewModel; using System.IO; using System.Windows; +using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; @@ -48,17 +49,9 @@ readonly DrawingGroup _target = new(); readonly List _fallingItems = new(64); - bool _isViewVisible = true; public ImageSource Falling { get; set; } - public bool IsViewVisible - { - get => _isViewVisible; - - set => SetProperty(ref _isViewVisible, value, nameof(IsViewVisible)); - } - public System16View() { InitializeComponent(); @@ -67,13 +60,11 @@ { Falling = new BitmapImage(new Uri(Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Drawing", "1221.png"), UriKind.Relative)); Falling.Freeze(); - AudioSystem.Instance.HandleImmediately(Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Audio", "1221.wav"), this, this, false); } else if (System16Components.Is1225) { Falling = new BitmapImage(new Uri(Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Drawing", "1225.png"), UriKind.Relative)); Falling.Freeze(); - AudioSystem.Instance.HandleImmediately(Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Audio", "1225.wav"), this, this, false); } for (var i = _fallingItems.Capacity - 1; i >= 0; --i) { @@ -82,14 +73,11 @@ StrongReferenceMessenger.Default.Register(this, (recipient, message) => { - if ((recipient as System16View).IsViewVisible) + if (System16Components.Is1221 || System16Components.Is1225) { - (recipient as System16View).IsViewVisible = false; - message.Reply(true); - } - else - { - message.Reply(false); + System16Components.Is1221 = false; + System16Components.Is1225 = false; + UIHandler.Instance.HandleParallel(() => ((recipient as FrameworkElement).Parent as Panel).Children.Remove(this)); } }); } diff --git a/Qwilight/Utilities/Utility.cs b/Qwilight/Utilities/Utility.cs index f1b4d76..f4798fb 100644 --- a/Qwilight/Utilities/Utility.cs +++ b/Qwilight/Utilities/Utility.cs @@ -38,11 +38,11 @@ return (titlePosition >= 0 ? title.Substring(0, titlePosition) : title).Trim(); } - public static void HandleUIAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0) + public static void HandleUIAudio(string audioFileName, string defaultFileName = null, PausableAudioHandler pausableAudioHandler = null, double fadeInLength = 0.0, int audioVariety = AudioSystem.SEAudio) { - if (!BaseUI.Instance.HandleAudio(audioFileName, defaultFileName, pausableAudioHandler, fadeInLength)) + if (!BaseUI.Instance.HandleAudio(audioFileName, defaultFileName, pausableAudioHandler, fadeInLength, audioVariety)) { - UI.Instance.HandleAudio(audioFileName, defaultFileName, pausableAudioHandler, fadeInLength); + UI.Instance.HandleAudio(audioFileName, defaultFileName, pausableAudioHandler, fadeInLength, audioVariety); } } diff --git a/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/ViewModel/MainViewModel.cs index 21c8fb7..5ffed45 100644 --- a/Qwilight/ViewModel/MainViewModel.cs +++ b/Qwilight/ViewModel/MainViewModel.cs @@ -4,6 +4,7 @@ using Qwilight.Compute; using Qwilight.MSG; using Qwilight.NoteFile; +using Qwilight.System16; using Qwilight.System16.MSG; using Qwilight.UIComponent; using Qwilight.Utilities; @@ -520,7 +521,7 @@ OnPropertyChanged(nameof(DefaultHeight)); SetWPFViewVisibility(); MediaSystem.Instance.Stop(BaseUI.Instance); - BaseUI.Instance.HandlePaintProperty(); + BaseUI.Instance.HandlePaintProperties(); MediaSystem.Instance.HandleDefaultIfAvailable(BaseUI.Instance); MediaSystem.Instance.HandleIfAvailable(BaseUI.Instance); var handlingComputer = GetHandlingComputer(); @@ -2841,9 +2842,10 @@ _setCancelDefaultEntryLoading.Cancel(); return; } - var wasWipedSystem16View = StrongReferenceMessenger.Default.Send(new WipeSystem16View()); - if (wasWipedSystem16View.HasReceivedResponse && wasWipedSystem16View.Response) + if (System16Components.Is1221 || System16Components.Is1225) { + StrongReferenceMessenger.Default.Send(new WipeSystem16View()); + HandleAutoComputer(); return; } StrongReferenceMessenger.Default.Send(new Quit @@ -3750,17 +3752,28 @@ } if (audioFileName == "Default") { - switch (defaultAudioVarietyValue) + if (System16Components.Is1221) { - case Configure.DefaultAudioVariety.Not: - audioFileName = null; - break; - case Configure.DefaultAudioVariety.Favor: - audioFileName = AudioSystem.Instance.GetDefaultAudioFileName(_randomMillis); - break; - case Configure.DefaultAudioVariety.UI: - audioFileName = BaseUI.Instance.GetDefaultAudioFileName(_randomMillis); - break; + audioFileName = Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Audio", "1221.mp3"); + } + else if (System16Components.Is1225) + { + audioFileName = Path.Combine(QwilightComponent.AssetsEntryPath, "System 16", "Audio", "1225.mp3"); + } + else + { + switch (defaultAudioVarietyValue) + { + case Configure.DefaultAudioVariety.Not: + audioFileName = null; + break; + case Configure.DefaultAudioVariety.Favor: + audioFileName = AudioSystem.Instance.GetDefaultAudioFileName(_randomMillis); + break; + case Configure.DefaultAudioVariety.UI: + audioFileName = BaseUI.Instance.GetDefaultAudioFileName(_randomMillis); + break; + } } } if (_pausableAudioHandler.AudioFileName != audioFileName) @@ -3779,11 +3792,11 @@ { AudioLevyingPosition = _pausableAudioHandler.GetAudioPosition(), AudioItem = audioItem - }, AudioSystem.SEAudio, 1.0, false, _pausableAudioHandler, QwilightComponent.StandardWaitMillis); + }, AudioSystem.MainAudio, 1.0, false, _pausableAudioHandler, QwilightComponent.StandardWaitMillis); } else { - Utility.HandleUIAudio(audioFileName, null, _pausableAudioHandler, QwilightComponent.StandardWaitMillis); + Utility.HandleUIAudio(audioFileName, null, _pausableAudioHandler, QwilightComponent.StandardWaitMillis, AudioSystem.MainAudio); } } }