/// <summary>
        /// Saves the mod controls' positions to settings and destroys the City Vitals Watch panel.
        /// </summary>
        public static void DestroyPanel() {
            var resolutionData = CityVitalsWatch.Settings.GetResolutionData(Screen.currentResolution.width, Screen.currentResolution.height);
            resolutionData.PanelPositionX = Panel.relativePosition.x;
            resolutionData.PanelPositionY = Panel.relativePosition.y;
            resolutionData.ToggleButtonPositionX = Panel.ToggleButton.absolutePosition.x;
            resolutionData.ToggleButtonPositionY = Panel.ToggleButton.absolutePosition.y;

            CityVitalsWatchSerializer.SaveSettings(CityVitalsWatch.Settings);

            Panel.gameObject.SetActive(false);
            GameObject.Destroy(Panel.gameObject);
            Panel = null;
        }
예제 #2
0
        /// <summary>
        /// Saves the mod controls' positions to settings and destroys the City Vitals Watch panel.
        /// </summary>
        public static void DestroyPanel()
        {
            var resolutionData = CityVitalsWatch.Settings.GetResolutionData(Screen.currentResolution.width, Screen.currentResolution.height);

            resolutionData.PanelPositionX        = Panel.relativePosition.x;
            resolutionData.PanelPositionY        = Panel.relativePosition.y;
            resolutionData.ToggleButtonPositionX = Panel.ToggleButton.absolutePosition.x;
            resolutionData.ToggleButtonPositionY = Panel.ToggleButton.absolutePosition.y;

            CityVitalsWatchSerializer.SaveSettings(CityVitalsWatch.Settings);

            Panel.gameObject.SetActive(false);
            GameObject.Destroy(Panel.gameObject);
            Panel = null;
        }
        /// <summary>
        /// Loads the mod's settings and creates the City Vitals Watch panel.
        /// </summary>
        public static void CreatePanel() {
            CityVitalsWatch.Settings = CityVitalsWatchSerializer.LoadSettings();

            UIView uiViewParent = null;

            foreach (var uiView in GameObject.FindObjectsOfType<UIView>()) {
                if (uiView.name == "UIView") {
                    uiViewParent = uiView;
                    break;
                }
            }

            if (uiViewParent != null) {
                GameObject obj = new GameObject("CityVitalsWatchPanel");
                obj.transform.parent = uiViewParent.cachedTransform;
                Panel = obj.AddComponent<CityVitalsWatchPanel>();
            }
        }
예제 #4
0
        /// <summary>
        /// Loads the mod's settings and creates the City Vitals Watch panel.
        /// </summary>
        public static void CreatePanel()
        {
            CityVitalsWatch.Settings = CityVitalsWatchSerializer.LoadSettings();

            UIView uiViewParent = null;

            foreach (var uiView in GameObject.FindObjectsOfType <UIView>())
            {
                if (uiView.name == "UIView")
                {
                    uiViewParent = uiView;
                    break;
                }
            }

            if (uiViewParent != null)
            {
                GameObject obj = new GameObject("CityVitalsWatchPanel");
                obj.transform.parent = uiViewParent.cachedTransform;
                Panel = obj.AddComponent <CityVitalsWatchPanel>();
            }
        }