示例#1
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            ui = ModMenuUI.Instance;

            if (_modMenuListViewController == null)
            {
                _modMenuListViewController = ui.CreateViewController <ModMenuListViewController>();

                PushViewController(_modMenuListViewController, true);
            }
            else
            {
                if (_viewControllers.IndexOf(_modMenuListViewController) < 0)
                {
                    PushViewController(_modMenuListViewController, true);
                }
            }

            if (_backButton == null)
            {
                _backButton = ui.CreateBackButton(rectTransform);

                _backButton.onClick.AddListener(delegate()
                {
                    DismissModalViewController(null, false);
                });
            }

            base.DidActivate(firstActivation, activationType);
        }
示例#2
0
        public void OnApplicationStart()
        {
            if (_init)
            {
                return;
            }
            _init = true;

            SettingsUI.OnLoad();
            ModMenuUI.OnLoad();
        }
示例#3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(this);
     }
 }
示例#4
0
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            ui = ModMenuUI.Instance;
            _parentMasterViewController = transform.parent.GetComponent <ModMenuMasterViewController>();

            try
            {
                rectTransform.anchorMin = new Vector2(0.1f, 0f);
                rectTransform.anchorMax = new Vector2(0.9f, 1f);

                if (_modListTableCellInstance == null)
                {
                    var modMenuListItem = new GameObject("ModMenuListTableCell");

                    var listItemRectTransform = modMenuListItem.AddComponent <RectTransform>();
                    listItemRectTransform.anchorMin = new Vector2(0f, 0f);
                    listItemRectTransform.anchorMax = new Vector2(1f, 1f);

                    var horiz = modMenuListItem.AddComponent <HorizontalLayoutGroup>();
                    horiz.spacing               = 4f;
                    horiz.childControlHeight    = false;
                    horiz.childControlWidth     = false;
                    horiz.childForceExpandWidth = false;
                    horiz.childAlignment        = TextAnchor.MiddleCenter;

                    _modListTableCellInstance = modMenuListItem.AddComponent <ModMenuListTableCell>();
                }

                if (_tableView == null)
                {
                    _tableView = new GameObject().AddComponent <TableView>();

                    _tableView.transform.SetParent(rectTransform, false);

                    _tableView.dataSource = this;

                    (_tableView.transform as RectTransform).anchorMin        = new Vector2(0f, 0.5f);
                    (_tableView.transform as RectTransform).anchorMax        = new Vector2(1f, 0.5f);
                    (_tableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 60f);
                    (_tableView.transform as RectTransform).position         = new Vector3(0f, 0f, 2.4f);
                    (_tableView.transform as RectTransform).anchoredPosition = new Vector3(0f, 0f); // -3

                    _modMenuTableViewHelper = _tableView.gameObject.AddComponent <TableViewHelper>();
                }
                else
                {
                    _tableView.ReloadData();
                }

                if (_pageUpButton == null)
                {
                    _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(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(0f, -10f);//-14
                    _pageUpButton.interactable = true;
                    _pageUpButton.onClick.AddListener(delegate()
                    {
                        _modMenuTableViewHelper.PageScrollUp();
                    });
                }

                if (_pageDownButton == null)
                {
                    _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(0f, 10);//8
                    _pageDownButton.interactable = true;
                    _pageDownButton.onClick.AddListener(delegate()
                    {
                        _modMenuTableViewHelper.PageScrollDown();
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION IN DidActivate: " + e);
            }
        }