diff --git a/Compatible/Compatible.csproj b/Compatible/Compatible.csproj index fc38c1a..68a70f6 100644 --- a/Compatible/Compatible.csproj +++ b/Compatible/Compatible.csproj @@ -9,6 +9,6 @@ - + diff --git a/Qwilight/AvatarWww.cs b/Qwilight/AvatarWww.cs index d5c7dab..bd99062 100644 --- a/Qwilight/AvatarWww.cs +++ b/Qwilight/AvatarWww.cs @@ -106,6 +106,10 @@ public override int GetHashCode() => AvatarID.GetHashCode(); + public static bool operator ==(AvatarWww left, AvatarWww right) => left.Equals(right); + + public static bool operator !=(AvatarWww left, AvatarWww right) => !(left == right); + public AvatarWww(string avatarID, AvatarTitle? avatarTitle = null, ImageSource avatarEdge = null, bool allowNotAvatarTitle = false) { _allowNotAvatarTitle = allowNotAvatarTitle; diff --git a/Qwilight/Compiler/BaseCompiler.cs b/Qwilight/Compiler/BaseCompiler.cs index 10fa76c..2ccca05 100644 --- a/Qwilight/Compiler/BaseCompiler.cs +++ b/Qwilight/Compiler/BaseCompiler.cs @@ -226,8 +226,10 @@ { CompileImpl(defaultComputer, noteFileContents, loadParallelItems); - for (var i = Notes.Count - 1; i >= 0; --i) + var notesCount = Notes.Count; + for (var i = notesCount - 1; i >= 0; --i) { + SetCancelCompiler?.Token.ThrowIfCancellationRequested(); var inputNote = Notes[i]; if (inputNote.HasStand && inputNote.LongWait == 0.0) { @@ -236,6 +238,7 @@ Notes.RemoveAt(i); } } + defaultComputer.SetCompilingStatus((double)i / notesCount); } if (defaultComputer.IsLongNoteStand1) @@ -430,14 +433,15 @@ var inputFavorMap = Component.InputFavorMap[(int)InputMode, (int)inputMode]; if (ModeComponent.InputFavorMode._4 <= inputFavorMode && inputFavorMode <= ModeComponent.InputFavorMode._48_4) { - foreach (var note in Notes.ToArray()) + for (var i = Notes.Count - 1; i >= 0; --i) { - if (note.HasInput) + var inputeNote = Notes[i]; + if (inputeNote.HasInput) { - note.LevyingInput = inputFavorMap[note.LevyingInput]; - if (note.LevyingInput == 0) + inputeNote.LevyingInput = inputFavorMap[inputeNote.LevyingInput]; + if (inputeNote.LevyingInput == 0) { - WipeNote(note); + WipeNote(inputeNote); } } } @@ -587,11 +591,11 @@ } Notes.Sort(); - var hasInputNotes = Notes.Where(note => note.HasInput).ToArray(); - if (hasInputNotes.Length > 0) + var inputNotes = Notes.Where(note => note.HasInput).ToArray(); + if (inputNotes.Length > 0) { var saltComputer = new Random(defaultComputer.ModeComponentValue.Salt); - foreach (var inputNote in hasInputNotes) + foreach (var inputNote in inputNotes) { inputNote.Salt = saltComputer.Next(); } @@ -601,7 +605,7 @@ { inputSalts[i] = inputSaltComputer.Next(); } - foreach (var toSaltNote in hasInputNotes) + foreach (var toSaltNote in inputNotes) { toSaltNote.InputSalt = inputSalts[toSaltNote.LevyingInput]; } @@ -613,7 +617,7 @@ { case ModeComponent.NoteSaltMode.InputSalt: case ModeComponent.NoteSaltMode.HalfInputSalt: - SaltInput(hasInputNotes); + SaltInput(inputNotes); break; case ModeComponent.NoteSaltMode.MeterSalt: var meterWaitCount = defaultComputer.MeterWaitMap.Count; @@ -624,7 +628,7 @@ for (var i = 1; i < meterWaitCount; ++i) { var endMeterWait = defaultComputer.MeterWaitMap[i]; - var inputNotesInMeter = hasInputNotes.Where(note => + var inputNotesInMeter = inputNotes.Where(note => { var wait = note.Wait; return levyingMeterWait <= wait && wait < endMeterWait; @@ -634,7 +638,7 @@ SaltInput(Array.Empty()); continue; } - SaltInput(hasInputNotes.Where(note => + SaltInput(inputNotes.Where(note => { var wait = note.Wait; return levyingMeterWait <= wait && wait < endMeterWait; @@ -646,7 +650,7 @@ for (var i = 1; i <= meterWaitCount; ++i) { var endMeterWait = i < meterWaitCount ? defaultComputer.MeterWaitMap[i] : double.PositiveInfinity; - var inputNotesInMeter = hasInputNotes.Where(note => + var inputNotesInMeter = inputNotes.Where(note => { var wait = note.Wait; return levyingMeterWait <= wait && wait < endMeterWait; @@ -661,7 +665,7 @@ } break; case ModeComponent.NoteSaltMode.Symmetric: - foreach (var inputNote in hasInputNotes) + foreach (var inputNote in inputNotes) { var input = inputNote.LevyingInput; if (!autoableInputs.Contains(input)) @@ -675,7 +679,7 @@ switch (defaultComputer.NoteSaltModeDate) { case Component.NoteSaltModeDate._1_14_27: - foreach (var inputNote in hasInputNotes) + foreach (var inputNote in inputNotes) { var input = inputNote.LevyingInput; if (!autoableInputs.Contains(input)) @@ -709,7 +713,7 @@ } break; case Component.NoteSaltModeDate._1_6_11: - foreach (var inputNote in hasInputNotes) + foreach (var inputNote in inputNotes) { var input = inputNote.LevyingInput; if (!autoableInputs.Contains(input)) @@ -997,7 +1001,7 @@ var distanceLongNoteModify = highestLongNoteModify - lowestLongNoteModify; for (var i = inputCount; i > 0; --i) { - var inputNotes = Notes.Where(note => note.HasStand && note.LevyingInput == i).ToArray(); + inputNotes = Notes.Where(note => note.HasStand && note.LevyingInput == i).ToArray(); var inputNotesLength = inputNotes.Length; for (var j = 0; j < inputNotesLength; ++j) { @@ -1093,11 +1097,11 @@ // 건너뛰기와 하이라이트 계산 Notes.Sort(); - hasInputNotes = Notes.Where(note => note.HasInput).Where(note => note.HasStand).ToArray(); - if (hasInputNotes.Length > 0) + inputNotes = Notes.Where(note => note.HasInput).Where(note => note.HasStand).ToArray(); + if (inputNotes.Length > 0) { - defaultComputer.PassableWait = Math.Round(hasInputNotes.First().Wait - Component.PassableWait); - var lastNoteWait = hasInputNotes.Max(note => note.Wait + note.LongWait); + defaultComputer.PassableWait = Math.Round(inputNotes.First().Wait - Component.PassableWait); + var lastNoteWait = inputNotes.Max(note => note.Wait + note.LongWait); if (double.IsNaN(defaultComputer.AudioLevyingPosition)) { var targetValue = double.NegativeInfinity; diff --git a/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Compute/DefaultCompute.cs index 65b6c2f..61f8520 100644 --- a/Qwilight/Compute/DefaultCompute.cs +++ b/Qwilight/Compute/DefaultCompute.cs @@ -3424,7 +3424,7 @@ GetNetItems(); GetNetComments(); - HandleNetItems(); + HandleNetItems(millisLoopUnit); } if (!wasLastStatus && LastStatusValue != LastStatus.Not) @@ -4455,7 +4455,7 @@ } } - public virtual void HandleNetItems() + public virtual void HandleNetItems(double millisLoopUnit) { foreach (var netItem in NetItems) { @@ -4464,6 +4464,11 @@ netItem.SetValue(Stand.TargetValue, Band.TargetValue, Point.TargetValue, HitPoints.TargetValue, NoteFiles.Length); netItem.HitPointsModeValue = ModeComponentValue.HandlingHitPointsModeValue; } + else if (netItem.IsFavorNetItem) + { + var netItemStatus = (double)_validJudgedNotes / ValidatedTotalNotes; + netItem.SetValue((int)(Configure.Instance.FavorHunterStand * (LevyingComputingPosition + netItemStatus)), (int)(TotalNotes * netItemStatus), 1.0, 1.0, NoteFiles.Length); + } else { var paintEvents = netItem.Comment?.Paints; @@ -4505,16 +4510,7 @@ } } } - } - - foreach (var netItem in NetItems) - { - if (netItem.IsFavorNetItem) - { - var status = (double)_validJudgedNotes / ValidatedTotalNotes; - netItem.SetValue((int)(Configure.Instance.FavorHunterStand * (LevyingComputingPosition + status)), (int)(TotalNotes * status), 1.0, 1.0, NoteFiles.Length); - break; - } + netItem.TargetPositionStatus = Utility.GetMove(0.0, netItem.TargetPositionStatus, 1000.0 / millisLoopUnit); } var targetPosition = SetValidNetItems(); diff --git a/Qwilight/Compute/IOCompute.cs b/Qwilight/Compute/IOCompute.cs index 83d72ed..b156b05 100644 --- a/Qwilight/Compute/IOCompute.cs +++ b/Qwilight/Compute/IOCompute.cs @@ -86,11 +86,11 @@ } } - public override void HandleNetItems() + public override void HandleNetItems(double millisLoopUnit) { if (!IsTwilightNetItems) { - base.HandleNetItems(); + base.HandleNetItems(millisLoopUnit); } } diff --git a/Qwilight/Compute/NetCompute.cs b/Qwilight/Compute/NetCompute.cs index 8b645de..7e63ba0 100644 --- a/Qwilight/Compute/NetCompute.cs +++ b/Qwilight/Compute/NetCompute.cs @@ -82,7 +82,7 @@ _hasPendingFailed = true; } - public override void HandleNetItems() + public override void HandleNetItems(double millisLoopUnit) { if (!IsF) { diff --git a/Qwilight/NoteFile/EZ2DJMAXNoteFile.cs b/Qwilight/NoteFile/EZ2DJMAXNoteFile.cs index 2362aff..9a26a2e 100644 --- a/Qwilight/NoteFile/EZ2DJMAXNoteFile.cs +++ b/Qwilight/NoteFile/EZ2DJMAXNoteFile.cs @@ -47,36 +47,40 @@ }, new[] { - new EZ2DJMAXNoteFile("https://store.steampowered.com/app/1386612") + new EZ2DJMAXNoteFile("https://store.steampowered.com/app/2681820") { - Title = "ALiCE NORMAL", - Artist = "seibin", + Title = "Shining Light (feat. Shabel Tonya) NORMAL", + Artist = "INFX / MIIM", LevelValue = BaseNoteFile.Level.Level2, LevelText = "LV. 5", + Genre = "J-Rock", HandledValue = BaseNoteFile.Handled.HighestClear }, - new EZ2DJMAXNoteFile("https://store.steampowered.com/app/1386612") + new EZ2DJMAXNoteFile("https://store.steampowered.com/app/2681820") { - Title = "ALiCE HARD", - Artist = "seibin", + Title = "Shining Light (feat. Shabel Tonya) HARD", + Artist = "INFX / MIIM", LevelValue = BaseNoteFile.Level.Level3, LevelText = "LV. 9", + Genre = "J-Rock", HandledValue = BaseNoteFile.Handled.HigherClear }, - new EZ2DJMAXNoteFile("https://store.steampowered.com/app/1386612") + new EZ2DJMAXNoteFile("https://store.steampowered.com/app/2681820") { - Title = "ALiCE MAXIMUM", - Artist = "seibin", + Title = "Shining Light (feat. Shabel Tonya) MAXIMUM", + Artist = "INFX / MIIM", LevelValue = BaseNoteFile.Level.Level4, LevelText = "LV. 11", + Genre = "J-Rock", HandledValue = BaseNoteFile.Handled.Clear }, - new EZ2DJMAXNoteFile("https://store.steampowered.com/app/1386612") + new EZ2DJMAXNoteFile("https://store.steampowered.com/app/2681820") { - Title = "ALiCE SC", - Artist = "seibin", + Title = "Shining Light (feat. Shabel Tonya) SC", + Artist = "INFX / MIIM", LevelValue = BaseNoteFile.Level.Level5, - LevelText = "LV. 11", + LevelText = "LV. 7", + Genre = "J-Rock", HandledValue = BaseNoteFile.Handled.AssistClear } }, diff --git a/Qwilight/Qwilight.csproj b/Qwilight/Qwilight.csproj index 20f4b1b..c0dae51 100644 --- a/Qwilight/Qwilight.csproj +++ b/Qwilight/Qwilight.csproj @@ -22,6 +22,10 @@ app.manifest true + + + + $(DefineConstants);X64 @@ -48,11 +52,11 @@ - + all - + @@ -62,7 +66,7 @@ - + diff --git a/Qwilight/System/DrawingSystem/DrawingSystem.cs b/Qwilight/System/DrawingSystem/DrawingSystem.cs index eab44b6..42b35d4 100644 --- a/Qwilight/System/DrawingSystem/DrawingSystem.cs +++ b/Qwilight/System/DrawingSystem/DrawingSystem.cs @@ -1060,6 +1060,7 @@ { if (netItem.TargetPosition == i) { + var targetPositionStatus = netItem.TargetPositionStatus; var drawings = netItem.Drawings; var drawingPosition = netItem.DrawingPosition - levyingNetPosition; var d2dHitPointsPaint = BaseUI.Instance.D2DHitPointsPaints[(int)netItem.HitPointsModeValue][netItem.IsMyNetItem ? netItemFaintInt : netItemFaintInt / 2]; @@ -1137,6 +1138,7 @@ r.Set(r.Position0 + Levels.StandardEdgeFloat32, r.Position1 + Levels.StandardEdgeFloat32, r.Length - 2 * Levels.StandardEdgeFloat32, r.Height - 2 * Levels.StandardEdgeFloat32); targetSession.FillRectangle(r, netWallPaint); + targetSession.FillRectangle(r, FaintClearedPaints[(int)(100.0 * targetPositionStatus)]); r.Position0 += highestNetHeight; r.Length = (highestNetLength - 2 * highestNetHeight) * netItemValue; diff --git a/Qwilight/System/UI/UI.cs b/Qwilight/System/UI/UI.cs index 3f2d82f..8c59a7f 100644 --- a/Qwilight/System/UI/UI.cs +++ b/Qwilight/System/UI/UI.cs @@ -1623,10 +1623,10 @@ var longNoteContents = Utility.ToInt32(fileNameContents.ElementAtOrDefault(4)); if (fileNameContents[0] == getNote([main, frame, text, longNoteContents])) { - var status = fileNameContents.Length > 4 ? longNoteContents : LongNote.LongNoteBefore; + var longNoteStatus = fileNameContents.Length > 4 ? longNoteContents : LongNote.LongNoteBefore; foreach (var drawing in drawingMap[main]) { - noteDrawings.SetValue(drawing, frame, text, status, drawingItem); + noteDrawings.SetValue(drawing, frame, text, longNoteStatus, drawingItem); } } break; diff --git a/Qwilight/UIComponent/NetItem.cs b/Qwilight/UIComponent/NetItem.cs index c732370..1ce29e3 100644 --- a/Qwilight/UIComponent/NetItem.cs +++ b/Qwilight/UIComponent/NetItem.cs @@ -5,11 +5,26 @@ { public sealed class NetItem : IComparable { + int _targetPosition; Comment _comment; public double DrawingPosition { get; set; } - public int TargetPosition { get; set; } + public double TargetPositionStatus { get; set; } + + public int TargetPosition + { + get => _targetPosition; + + set + { + if (_targetPosition != value) + { + _targetPosition = value; + TargetPositionStatus = 1.0; + } + } + } public int SetTargetPosition { get; set; } diff --git a/Qwilight/View/LevelWindow.xaml b/Qwilight/View/LevelWindow.xaml index aea173e..afabbe4 100644 --- a/Qwilight/View/LevelWindow.xaml +++ b/Qwilight/View/LevelWindow.xaml @@ -51,12 +51,14 @@ + + + + + - - - diff --git a/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/ViewModel/MainViewModel.cs index 4591cb7..94c117d 100644 --- a/Qwilight/ViewModel/MainViewModel.cs +++ b/Qwilight/ViewModel/MainViewModel.cs @@ -809,6 +809,13 @@ { Configure.Instance.DefaultEntryItems.Add(defaultEntryItem); } + UIHandler.Instance.HandleParallel(() => + { + if (!ViewModels.Instance.ModifyDefaultEntryValue.DefaultEntryItemCollection.Contains(defaultEntryItem)) + { + ViewModels.Instance.ModifyDefaultEntryValue.DefaultEntryItemCollection.Add(defaultEntryItem); + } + }); lastDefaultEntryItem = defaultEntryItem; } } diff --git a/Qwilight/ViewModel/WwwLevelViewModel.cs b/Qwilight/ViewModel/WwwLevelViewModel.cs index fe019c3..d60a9f3 100644 --- a/Qwilight/ViewModel/WwwLevelViewModel.cs +++ b/Qwilight/ViewModel/WwwLevelViewModel.cs @@ -64,14 +64,17 @@ } } - readonly WwwLevelData _wwwLevelDataValue = new(); + readonly WwwLevelData _wwwLevelData = new(); readonly double[] _audioMultipliers = new double[2]; - WwwLevelAvatar? _wwwLevelAvatarValue; + WwwLevelAvatar? _wwwLevelAvatar; + WwwLevelAvatar? _lastWwwLevelAvatar; string _levelName; + string _lastLevelName; bool _isAvatarIDsLoading; bool _isLevelNamesLoading; bool _isLevelNameLoading; WwwLevelItem _wwwLevelItem; + WwwLevelItem _lastWwwLevelItem; string _levelID; string _title; string _comment; @@ -163,7 +166,7 @@ } modeComponent.PutCopyNotesValueV2 = ModeComponent.PutCopyNotes.Default; var entryItem = mainViewModel.EventNoteEntryItems[GetEventNoteID()]; - mainViewModel.HandleLevyNoteFile(entryItem.NoteFile, entryItem, _wwwLevelDataValue, defaultModeComponentValue); + mainViewModel.HandleLevyNoteFile(entryItem.NoteFile, entryItem, _wwwLevelData, defaultModeComponentValue); } string GetEventNoteID() => string.Join('/', WwwLevelComputingCollection.Select(wwwLevelComputing => wwwLevelComputing.GetNoteID512())); @@ -296,6 +299,7 @@ { if (SetProperty(ref _wwwLevelItem, value, nameof(WwwLevelItemValue)) && value != null) { + _lastWwwLevelItem = value; _ = Awaitable(); async Task Awaitable() { @@ -324,8 +328,8 @@ } } OnPropertyChanged(nameof(StandContents)); - _wwwLevelDataValue.Stand = twilightWwwLevelValue.stand; - _wwwLevelDataValue.StandContents = string.Join(" ", StandContents).Trim(); + _wwwLevelData.Stand = twilightWwwLevelValue.stand; + _wwwLevelData.StandContents = string.Join(" ", StandContents).Trim(); Array.Fill(PointContents, null); if (twilightWwwLevelValue.point != null) @@ -340,8 +344,8 @@ } } OnPropertyChanged(nameof(PointContents)); - _wwwLevelDataValue.Point = twilightWwwLevelValue.point; - _wwwLevelDataValue.PointContents = string.Join(" ", PointContents).Trim(); + _wwwLevelData.Point = twilightWwwLevelValue.point; + _wwwLevelData.PointContents = string.Join(" ", PointContents).Trim(); Array.Fill(BandContents, null); if (twilightWwwLevelValue.band != null) @@ -356,8 +360,8 @@ } } OnPropertyChanged(nameof(BandContents)); - _wwwLevelDataValue.Band = twilightWwwLevelValue.band; - _wwwLevelDataValue.BandContents = string.Join(" ", BandContents).Trim(); + _wwwLevelData.Band = twilightWwwLevelValue.band; + _wwwLevelData.BandContents = string.Join(" ", BandContents).Trim(); Array.Fill(AudioMultiplierContents, null); if (twilightWwwLevelValue.audioMultiplier != null) @@ -382,8 +386,8 @@ } } OnPropertyChanged(nameof(AudioMultiplierContents)); - _wwwLevelDataValue.LowestAudioMultiplier = (twilightWwwLevelValue.audioMultiplier?[0] == -1.0 ? null : twilightWwwLevelValue.audioMultiplier?[0] as double?) ?? 0.5; - _wwwLevelDataValue.HighestAudioMultiplier = (twilightWwwLevelValue.audioMultiplier?[1] == -1.0 ? null : twilightWwwLevelValue.audioMultiplier?[1] as double?) ?? 2.0; + _wwwLevelData.LowestAudioMultiplier = (twilightWwwLevelValue.audioMultiplier?[0] == -1.0 ? null : twilightWwwLevelValue.audioMultiplier?[0] as double?) ?? 0.5; + _wwwLevelData.HighestAudioMultiplier = (twilightWwwLevelValue.audioMultiplier?[1] == -1.0 ? null : twilightWwwLevelValue.audioMultiplier?[1] as double?) ?? 2.0; Array.Fill(JudgmentContents, null); if (twilightWwwLevelValue.judgments != null) @@ -405,16 +409,16 @@ } } OnPropertyChanged(nameof(JudgmentContents)); - _wwwLevelDataValue.Judgments = twilightWwwLevelValue.judgments; - _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Highest] = JudgmentContents[(int)Component.Judged.Highest] != null ? $"Yell! {string.Join(" ", JudgmentContents[(int)Component.Judged.Highest]).Trim()}" : null; - _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Higher] = JudgmentContents[(int)Component.Judged.Higher] != null ? $"Yell {string.Join(" ", JudgmentContents[(int)Component.Judged.Higher]).Trim()}" : null; - _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.High] = JudgmentContents[(int)Component.Judged.High] != null ? $"Cool {string.Join(" ", JudgmentContents[(int)Component.Judged.High]).Trim()}" : null; - _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Low] = JudgmentContents[(int)Component.Judged.Low] != null ? $"Good {string.Join(" ", JudgmentContents[(int)Component.Judged.Low]).Trim()}" : null; - _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Lower] = JudgmentContents[(int)Component.Judged.Lower] != null ? $"Poor {string.Join(" ", JudgmentContents[(int)Component.Judged.Lower]).Trim()}" : null; - _wwwLevelDataValue.JudgmentContents[(int)Component.Judged.Lowest] = JudgmentContents[(int)Component.Judged.Lowest] != null ? $"Failed {string.Join(" ", JudgmentContents[(int)Component.Judged.Lowest]).Trim()}" : null; + _wwwLevelData.Judgments = twilightWwwLevelValue.judgments; + _wwwLevelData.JudgmentContents[(int)Component.Judged.Highest] = JudgmentContents[(int)Component.Judged.Highest] != null ? $"Yell! {string.Join(" ", JudgmentContents[(int)Component.Judged.Highest]).Trim()}" : null; + _wwwLevelData.JudgmentContents[(int)Component.Judged.Higher] = JudgmentContents[(int)Component.Judged.Higher] != null ? $"Yell {string.Join(" ", JudgmentContents[(int)Component.Judged.Higher]).Trim()}" : null; + _wwwLevelData.JudgmentContents[(int)Component.Judged.High] = JudgmentContents[(int)Component.Judged.High] != null ? $"Cool {string.Join(" ", JudgmentContents[(int)Component.Judged.High]).Trim()}" : null; + _wwwLevelData.JudgmentContents[(int)Component.Judged.Low] = JudgmentContents[(int)Component.Judged.Low] != null ? $"Good {string.Join(" ", JudgmentContents[(int)Component.Judged.Low]).Trim()}" : null; + _wwwLevelData.JudgmentContents[(int)Component.Judged.Lower] = JudgmentContents[(int)Component.Judged.Lower] != null ? $"Poor {string.Join(" ", JudgmentContents[(int)Component.Judged.Lower]).Trim()}" : null; + _wwwLevelData.JudgmentContents[(int)Component.Judged.Lowest] = JudgmentContents[(int)Component.Judged.Lowest] != null ? $"Failed {string.Join(" ", JudgmentContents[(int)Component.Judged.Lowest]).Trim()}" : null; AllowPause = twilightWwwLevelValue.allowPause; - _wwwLevelDataValue.AllowPause = twilightWwwLevelValue.allowPause; + _wwwLevelData.AllowPause = twilightWwwLevelValue.allowPause; var mainViewModel = ViewModels.Instance.MainValue; var siteContainerViewModel = ViewModels.Instance.SiteContainerValue; @@ -736,22 +740,25 @@ public WwwLevelAvatar? WwwLevelAvatarValue { - get => _wwwLevelAvatarValue; + get => _wwwLevelAvatar; set { - if (SetProperty(ref _wwwLevelAvatarValue, value, nameof(WwwLevelAvatarValue))) + if (SetProperty(ref _wwwLevelAvatar, value, nameof(WwwLevelAvatarValue)) && value.HasValue) { + _lastWwwLevelAvatar = value; + _lastLevelName = null; + _lastWwwLevelItem = null; _ = Awaitable(); async Task Awaitable() { - var avatarID = value?.AvatarWwwValue?.AvatarID ?? string.Empty; + var avatarID = value.Value.AvatarWwwValue.AvatarID; IsLevelNamesLoading = true; var levelNames = await TwilightSystem.Instance.GetWwwParallel($"{QwilightComponent.QwilightAPI}/level?avatarID={WebUtility.UrlEncode(avatarID)}"); if (levelNames != null && (WwwLevelAvatarValue?.AvatarWwwValue?.AvatarID ?? string.Empty) == avatarID) { Utility.SetUICollection(LevelNameCollection, levelNames); - LevelName ??= LevelNameCollection.FirstOrDefault(); + LevelName ??= _lastLevelName ?? LevelNameCollection.FirstOrDefault(); } IsLevelNamesLoading = false; } @@ -783,8 +790,10 @@ set { - if (SetProperty(ref _levelName, value, nameof(LevelName)) && value != null) + if (SetProperty(ref _levelName, value, nameof(LevelName)) && !string.IsNullOrEmpty(value)) { + _lastLevelName = value; + _lastWwwLevelItem = null; _ = Awaitable(); async Task Awaitable() { @@ -806,7 +815,7 @@ Avatars = twilightWwwLevel.avatars }; }).ToArray()); - WwwLevelItemValue ??= WwwLevelItemCollection.FirstOrDefault(); + WwwLevelItemValue ??= _lastWwwLevelItem ?? WwwLevelItemCollection.FirstOrDefault(); } IsLevelNameLoading = false; } @@ -832,7 +841,7 @@ AvatarWwwValue = new(avatar.avatarID), AvatarName = avatar.avatarName }).ToArray()); - WwwLevelAvatarValue ??= WwwLevelAvatarCollection.FirstOrDefault(); + WwwLevelAvatarValue ??= _lastWwwLevelAvatar ?? WwwLevelAvatarCollection.FirstOrDefault(); } IsAvatarIDsLoading = false; });