-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tweak(ui): don't leak cell objects, nicer loading animation
- Loading branch information
Showing
4 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace ServerBrowser.UI.Components | ||
{ | ||
public class ListLoadingControl | ||
{ | ||
private static Transform _controlTemplate; | ||
|
||
private static void LoadTemplate() | ||
{ | ||
if (_controlTemplate != null) | ||
return; | ||
|
||
var nativeGameServerList = Resources.FindObjectsOfTypeAll<GameServersListTableView>().First(); | ||
|
||
if (nativeGameServerList == null) | ||
return; | ||
|
||
_controlTemplate = nativeGameServerList.transform.Find("TableView/Viewport/MainLoadingControl"); | ||
} | ||
|
||
public static LoadingControl Create(Transform parentTransform) | ||
{ | ||
LoadTemplate(); | ||
|
||
if (_controlTemplate == null) | ||
return null; | ||
|
||
var newObject = Object.Instantiate(_controlTemplate, parentTransform, false); | ||
|
||
var loadingControl = newObject.GetComponent<LoadingControl>(); | ||
loadingControl.gameObject.SetActive(true); | ||
loadingControl.Hide(); | ||
|
||
return loadingControl; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters