Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
ExplorerView now refreshes onEnable if the grid layouting has been af…
Browse files Browse the repository at this point in the history
…fected by resizing, etc
  • Loading branch information
Jackson Wood committed Jul 15, 2019
1 parent 9b06d4a commit 1ba8d60
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions src/UI/ExplorerView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,26 @@ public int CurrentPageCount
}

// ---------[ INITIALIZATION ]---------
private void OnEnable()
{
// NOTE(@jackson): This appears to be unnecessary?
// UpdateCurrentPageDisplay();

if(this.isActiveIndicator != null)
{
this.isActiveIndicator.isOn = true;
}

if(this.currentPageContainer != null)
{
int viewsOnCurrentPageCount = this.currentPageContainer.childCount;
if(this.itemsPerPage != viewsOnCurrentPageCount)
{
Refresh();
}
}
}

private void Start()
{
// asserts
Expand Down Expand Up @@ -167,18 +187,6 @@ private void Start()
this.Refresh();
}

// TODO(@jackson): Recheck page size
private void OnEnable()
{
// NOTE(@jackson): This appears to be unnecessary?
// UpdateCurrentPageDisplay();

if(this.isActiveIndicator != null)
{
this.isActiveIndicator.isOn = true;
}
}

private void OnDisable()
{
if(this.isActiveIndicator != null)
Expand Down Expand Up @@ -218,7 +226,7 @@ public void Refresh()
wasDisplayUpdated = true;
}
},
null);
WebRequestError.LogAsWarning);

if(!wasDisplayUpdated)
{
Expand Down Expand Up @@ -283,10 +291,8 @@ public void UpdatePageButtonInteractibility()

public void ChangePage(int pageDifferential)
{
// TODO(@jackson): Queue on isTransitioning?
if(this.isTransitioning)
{
Debug.LogWarning("[mod.io] Cannot change during transition");
return;
}

Expand Down Expand Up @@ -573,7 +579,7 @@ private void DisplayProfiles(IEnumerable<ModProfile> profileCollection, RectTran
UpdateStatisticsDisplays(statsArray);
}
},
null);
WebRequestError.LogAsWarning);
}

// fix layouting
Expand Down Expand Up @@ -733,6 +739,11 @@ public void OnGameProfileUpdated(GameProfile gameProfile)
if(this.m_tagCategories != gameProfile.tagCategories)
{
this.m_tagCategories = gameProfile.tagCategories;

if(this.isActiveAndEnabled)
{
this.Refresh();
}
}
}

Expand Down

0 comments on commit 1ba8d60

Please sign in to comment.