Browse Source

Fixed DownloadProgress list

pull/46/head
Anairkoen Schno 5 years ago
parent
commit
e52a1f1d95
1 changed files with 30 additions and 2 deletions
  1. +30
    -2
      BSIPA-ModList/UI/ViewControllers/DownloadProgressViewController.cs

+ 30
- 2
BSIPA-ModList/UI/ViewControllers/DownloadProgressViewController.cs View File

@ -25,6 +25,9 @@ namespace BSIPA_ModList.UI.ViewControllers
private Button _restartGame; private Button _restartGame;
private TableView _currentlyUpdatingTableView; private TableView _currentlyUpdatingTableView;
private LevelListTableCell _songListTableCellInstance; private LevelListTableCell _songListTableCellInstance;
private Button _pageUpButton;
private Button _pageDownButton;
private TableViewScroller _scroller;
private const float TableXOffset = -20f; private const float TableXOffset = -20f;
private const float ButtonXOffset = 36f; private const float ButtonXOffset = 36f;
@ -48,6 +51,28 @@ namespace BSIPA_ModList.UI.ViewControllers
_manualDownloadText.fontSize = 4f; _manualDownloadText.fontSize = 4f;
_manualDownloadText.gameObject.SetActive(false); _manualDownloadText.gameObject.SetActive(false);
_pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().Last(x => (x.name == "PageUpButton")), rectTransform, false);
(_pageUpButton.transform as RectTransform).anchorMin = new Vector2(0.5f, 1f);
(_pageUpButton.transform as RectTransform).anchorMax = new Vector2(0.5f, 1f);
(_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(TableXOffset, -14f);
(_pageUpButton.transform as RectTransform).sizeDelta = new Vector2(40f, 10f);
_pageUpButton.interactable = true;
_pageUpButton.onClick.AddListener(delegate ()
{
_scroller.PageScrollUp();
});
_pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "PageDownButton")), rectTransform, false);
(_pageDownButton.transform as RectTransform).anchorMin = new Vector2(0.5f, 0f);
(_pageDownButton.transform as RectTransform).anchorMax = new Vector2(0.5f, 0f);
(_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(TableXOffset, 8f);
(_pageDownButton.transform as RectTransform).sizeDelta = new Vector2(40f, 10f);
_pageDownButton.interactable = true;
_pageDownButton.onClick.AddListener(delegate ()
{
_scroller.PageScrollDown();
});
var gobj = new GameObject("DownloadTable"); var gobj = new GameObject("DownloadTable");
gobj.SetActive(false); gobj.SetActive(false);
_currentlyUpdatingTableView = gobj.AddComponent<TableView>(); _currentlyUpdatingTableView = gobj.AddComponent<TableView>();
@ -60,8 +85,6 @@ namespace BSIPA_ModList.UI.ViewControllers
viewport.SetParent(gobj.GetComponent<RectTransform>(), false); viewport.SetParent(gobj.GetComponent<RectTransform>(), false);
gobj.GetComponent<ScrollRect>().viewport = viewport; gobj.GetComponent<ScrollRect>().viewport = viewport;
_currentlyUpdatingTableView.Init();
RectMask2D viewportMask = Instantiate(Resources.FindObjectsOfTypeAll<RectMask2D>().First(), _currentlyUpdatingTableView.transform, false); RectMask2D viewportMask = Instantiate(Resources.FindObjectsOfTypeAll<RectMask2D>().First(), _currentlyUpdatingTableView.transform, false);
viewportMask.transform.DetachChildren(); viewportMask.transform.DetachChildren();
_currentlyUpdatingTableView.GetComponentsInChildren<RectTransform>().First(x => x.name == "Content").transform.SetParent(viewportMask.rectTransform, false); _currentlyUpdatingTableView.GetComponentsInChildren<RectTransform>().First(x => x.name == "Content").transform.SetParent(viewportMask.rectTransform, false);
@ -71,9 +94,14 @@ namespace BSIPA_ModList.UI.ViewControllers
(_currentlyUpdatingTableView.transform as RectTransform).sizeDelta = new Vector2(0f, 60f); (_currentlyUpdatingTableView.transform as RectTransform).sizeDelta = new Vector2(0f, 60f);
(_currentlyUpdatingTableView.transform as RectTransform).anchoredPosition = new Vector3(TableXOffset, -3f); (_currentlyUpdatingTableView.transform as RectTransform).anchoredPosition = new Vector3(TableXOffset, -3f);
ReflectionUtil.SetPrivateField(_currentlyUpdatingTableView, "_pageUpButton", _pageUpButton);
ReflectionUtil.SetPrivateField(_currentlyUpdatingTableView, "_pageDownButton", _pageDownButton);
_currentlyUpdatingTableView.selectionType = TableViewSelectionType.None; _currentlyUpdatingTableView.selectionType = TableViewSelectionType.None;
_currentlyUpdatingTableView.Init();
_currentlyUpdatingTableView.dataSource = this; // calls Init _currentlyUpdatingTableView.dataSource = this; // calls Init
_scroller = gobj.GetComponent<TableViewScroller>();
gobj.SetActive(true); gobj.SetActive(true);
_currentlyUpdatingTableView.RefreshScrollButtons(); _currentlyUpdatingTableView.RefreshScrollButtons();


Loading…
Cancel
Save