Skip to content

Commit

Permalink
Merge pull request #606 from anatawa12/reflesh-error-report-when-play…
Browse files Browse the repository at this point in the history
…mode-exit

chore: refresh error report when playmode exit
  • Loading branch information
anatawa12 authored Oct 16, 2023
2 parents b37b961 + 595ff9e commit 99856b8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog].

### Changed
- Make no-op as possible if no AAO component attached for your avatar `#603`
- Error Report window is refreshed after exiting play mode `#606`

### Deprecated

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog].

### Changed
- Make no-op as possible if no AAO component attached for your avatar `#603`
- Error Report window is refreshed after exiting play mode `#606`

### Deprecated

Expand Down
24 changes: 24 additions & 0 deletions Internal/ErrorReporter/Editor/ErrorReportUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private void OnEnable()
ReloadErrorReportEvent += RenderContent;

Selection.selectionChanged += ScheduleRender;
EditorApplication.playModeStateChanged += PlayModeStateChanged;
EditorApplication.hierarchyChanged += ScheduleRender;
ErrorReporterRuntime.OnChangeAction += ScheduleRender;
//Localization.OnLangChange += RenderContent;
Expand All @@ -66,6 +67,21 @@ private void OnDisable()
[CanBeNull] private HeaderBox _header;
[CanBeNull] private GameObject _defaultAvatarObject;

private void PlayModeStateChanged(PlayModeStateChange obj)
{
switch (obj)
{
case PlayModeStateChange.EnteredEditMode:
_header?.RedrawList();
break;
case PlayModeStateChange.ExitingEditMode:
case PlayModeStateChange.EnteredPlayMode:
case PlayModeStateChange.ExitingPlayMode:
default:
break;
}
}

private void ScheduleRender()
{
if (_delayTimer == null)
Expand Down Expand Up @@ -215,6 +231,14 @@ [CanBeNull] public AvatarReport Value

public event Action<AvatarReport> SelectionChanged;

public void RedrawList()
{
if (_field != null)
{
SelectionChanged?.Invoke(_field.value);
}
}

public HeaderBox(AvatarReport defaultValue)
{
AddToClassList("avatarHeader");
Expand Down

0 comments on commit 99856b8

Please sign in to comment.