Esempio n. 1
0
        public new void Show()
        {
            if (main == null)
            {
                main = this;
            }

            isVisible = true;
        }
Esempio n. 2
0
        public override void Start()
        {
            base.Start();

            name      = "Vehicle Effects Main Panel";
            width     = 0;
            height    = 0;
            isVisible = false;

            PrefabWatcher.instance.prefabWasVehicle += () =>
            {
                isVisible = false;
                m_effectsPanel.Hide();
            };
            PrefabWatcher.instance.prefabBecameVehicle += () =>
            {
                isVisible = true;
            };

            UIView view = UIView.GetAView();

            relativePosition = Vector3.zero;

            m_effectsPanel = new GameObject().AddComponent <UIEffectPanel>();
            m_effectsPanel.transform.SetParent(transform);

            m_toggleButton                  = UIUtils.CreateButton(this);
            m_toggleButton.text             = "Vehicle Effects";
            m_toggleButton.width            = 120;
            m_toggleButton.tooltip          = "Opens the Vehicle Effects editor";
            m_toggleButton.relativePosition = new Vector3(10, 10);
            m_toggleButton.eventClicked    += (c, b) =>
            {
                if (m_showWarning)
                {
                    m_showWarning = false;
                    UIView.library.ShowModal <ExceptionPanel>("ExceptionPanel").SetMessage("Vehicle Effects", "Do not save, load or swap an asset (or trailer) while the effect preview is enabled. The asset will be left modified which can lead to unexpected results.\r\nThis warning can be disabled in the mod options menu.", false);
                }
                if (m_effectsPanel.isVisible)
                {
                    m_effectsPanel.Hide();
                }
                else
                {
                    m_effectsPanel.Show();
                }
            };
        }