Пример #1
0
        public override void Start()
        {
            base.Start();

            UIView view = UIView.GetAView();

            width            = WIDTH;
            height           = HEIGHT;
            backgroundSprite = "MenuPanel2";
            name             = VehicleEffectsMod.name + " Effects Panel";
            canFocus         = true;
            isInteractive    = true;
            isVisible        = false;
            // Start in the center of the screen
            relativePosition = new Vector3(Mathf.FloorToInt((view.fixedWidth - width) / 2), Mathf.FloorToInt((view.fixedHeight - height) / 2));

            // Create add panel
            m_effectListPanel = new GameObject().AddComponent <UIEffectListPanel>();
            m_effectListPanel.gameObject.transform.SetParent(transform.parent);
            m_effectListPanel.m_mainPanel = this;

            // Create save panel
            m_savePanel = new GameObject().AddComponent <UISaveDefPanel>();
            m_savePanel.gameObject.transform.SetParent(transform.parent);

            // Create load panel
            m_loadPanel = new GameObject().AddComponent <UILoadDefPanel>();
            m_loadPanel.gameObject.transform.SetParent(transform.parent);

            // Create flags panel
            m_flagsPanel = new GameObject().AddComponent <UIFlagsPanel>();
            m_flagsPanel.transform.SetParent(transform.parent);

            PrefabWatcher.instance.prefabBecameVehicle += () =>
            {
                isVisible = m_wasVisible;
                PrefabWatcher.instance.prefabChanged   += OnPrefabChanged;
                PrefabWatcher.instance.trailersChanged += OnTrailersChanged;
                UpdateVehicles();
            };
            PrefabWatcher.instance.prefabWasVehicle += () =>
            {
                Hide();
                PrefabWatcher.instance.prefabChanged   -= OnPrefabChanged;
                PrefabWatcher.instance.trailersChanged -= OnTrailersChanged;
            };

            m_previewer = new EffectPreviewer();

            CompileEffectsList();
            CreateComponents();
        }
Пример #2
0
        public override void Start()
        {
            base.Start();

            if (main == null)
            {
                main = this;
            }

            UIView view = UIView.GetAView();

            width            = WIDTH;
            height           = HEIGHT;
            backgroundSprite = "MenuPanel2";
            name             = VehicleEffectsMod.name + " Add Effects Panel";
            canFocus         = true;
            isInteractive    = true;
            isVisible        = false;
            relativePosition = new Vector3(Mathf.FloorToInt((view.fixedWidth - width) / 2), Mathf.FloorToInt((view.fixedHeight - height) / 2));

            CreateComponents();
            PopulateList();
        }