fix: Fix ongoing event cycling logic
This commit is contained in:
@@ -39,19 +39,39 @@ namespace Cryville.EEW.Unity.Map {
|
||||
return _displayingElements[index].AABB;
|
||||
}
|
||||
|
||||
public void SetSelected(ReportViewModel e) {
|
||||
if (_selected is not null)
|
||||
public void SetSelected(ReportViewModel e, bool forced = false) {
|
||||
if (e == null) {
|
||||
Remove(_selected);
|
||||
if (e == null || _displayingReports.Contains(e)) {
|
||||
_selected = null;
|
||||
return;
|
||||
}
|
||||
if (_displayingReports.Contains(e)) {
|
||||
if (forced) return;
|
||||
Remove(_selected);
|
||||
_selected = null;
|
||||
return;
|
||||
}
|
||||
if (e.IsExcludedFromHistory)
|
||||
return;
|
||||
if (!Add(e))
|
||||
return;
|
||||
if (_selected is not null)
|
||||
Remove(_selected);
|
||||
_selected = e;
|
||||
}
|
||||
public void SetCurrent(ReportViewModel e) {
|
||||
public bool SetCurrent(ReportViewModel e) {
|
||||
if (e == null) {
|
||||
_current = null;
|
||||
return true;
|
||||
}
|
||||
if (!_displayingReports.Contains(e)) {
|
||||
_current = null;
|
||||
return false;
|
||||
}
|
||||
if (_current == e)
|
||||
return false;
|
||||
_current = e;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Add(ReportViewModel e) {
|
||||
@@ -68,6 +88,7 @@ namespace Cryville.EEW.Unity.Map {
|
||||
return true;
|
||||
}
|
||||
public void Remove(ReportViewModel e) {
|
||||
if (_current == e) _current = null;
|
||||
int index = _displayingReports.IndexOf(e);
|
||||
if (index == -1) return;
|
||||
_displayingElements.RemoveAt(index);
|
||||
|
Reference in New Issue
Block a user