当前位置: 首页>>代码示例>>C#>>正文


C# Rect.CenterScreen方法代码示例

本文整理汇总了C#中UnityEngine.Rect.CenterScreen方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.CenterScreen方法的具体用法?C# Rect.CenterScreen怎么用?C# Rect.CenterScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Rect的用法示例。


在下文中一共展示了Rect.CenterScreen方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDraw

        private void OnDraw()
        {
            if (this.vessel == FlightGlobals.ActiveVessel && this.part.IsPrimary(this.vessel.parts, this.ClassID)) // If the primary part is destroyed this allows the other part to "take over"
            {
            _windowPosition = GUILayout.Window(10, _windowPosition, OnWindow, "This is a title", _windowStyle);

                if (_windowPosition.x == 0f && _windowPosition.y == 0f)
                    _windowPosition = _windowPosition.CenterScreen();
            }
        }
开发者ID:Kerbal007,项目名称:PluginTutorial,代码行数:10,代码来源:PluginTutorial.cs

示例2: OnDraw

        public void OnDraw()
        {
            //Checks if player has toggled the window on or off.
            if (windowState == true)
            {
                windowPosition = GUI.Window(1234, windowPosition, OnWindow, "Kustom Kerbals", windowStyle);

                //Resets window position to middle of screen.
                if (windowPosition.x == 0f && windowPosition.y == 0f)
                {
                    windowPosition = windowPosition.CenterScreen();
                }
            }
        }
开发者ID:CliftonMarien,项目名称:KustomKerbals,代码行数:14,代码来源:Kraken+Handler.cs

示例3: OnDraw

        public void OnDraw()
        {
            //Checks if player has toggled the window on or off.
            if (windowState == true)
            {
                windowPosition = GUI.Window(1234, windowPosition, OnWindow, "Kustom Kerbals", windowStyle);

                //Resets window position to middle of screen.
                if (windowPosition.x == 0f && windowPosition.y == 0f)
                {
                    windowPosition = windowPosition.CenterScreen();
                    Debug.Log("First Message: 00001b400048785b002820d500d0e363");
                }
            }
        }
开发者ID:CliftonMarien,项目名称:KustomKerbals,代码行数:15,代码来源:KreationHandler.cs

示例4: OnDraw

        private void OnDraw()
        {
            // if the current vessel is the same as the one the part is on
            if (this.vessel == FlightGlobals.ActiveVessel && this.part.IsPrimary(this.vessel.parts, this.ClassID))
            {
                windowPosition = GUILayout.Window(10, windowPosition, OnWindow, "Noise Profile", windowStyle);

                if (windowPosition.x == 0f && windowPosition.y == 0f)
                    windowPosition = windowPosition.CenterScreen();
            }
        }
开发者ID:Skoth,项目名称:KSPCommEngr,代码行数:11,代码来源:RCSPrototype.cs

示例5: OnDraw

        // GUI FUNCTIONS
        private void OnDraw()
        {
            if (m_Active && vessel.isActiveVessel)
            {
                GUI.skin = HighLogic.Skin;
                m_WindowPosition = GUILayout.Window(GetInstanceID(), m_WindowPosition, OnWindow, "Assemble Vehicle", m_WindowStyle);

                if (m_WindowPosition.position.SqrMagnitude() == 0)
                {
                    m_WindowPosition = m_WindowPosition.CenterScreen();
                }

                if (m_CraftList != null)
                {
                    m_CraftList.OnGUI();
                }
            }
        }
开发者ID:MauriceH1,项目名称:KSP_MobileConstruction,代码行数:19,代码来源:MobileConstructionPort.cs

示例6: Awake

        protected override void Awake()
        {
            //toolbar
            if (ToolbarManager.ToolbarAvailable)
            {
                _toolbarItem = AddComponent<LaunchCountDownToolbar>();
            }

            Visible = !ToolbarManager.ToolbarAvailable;

            if (LaunchCountdownConfig.Instance.Info.IsLoaded)
            {
                WindowRect = LaunchCountdownConfig.Instance.Info.WindowPosition;
            }
            else
            {
                WindowRect = new Rect(0, 0, 459, 120);
                WindowRect.CenterScreen();
            }

            WindowStyle = StyleFactory.MainWindowStyle;

            _launchSequenceWindow = AddComponent<LaunchSequenceWindow>();
            _launchSequenceWindow.WindowStyle = StyleFactory.LaunchSequenceStyle;
            _launchSequenceWindow.OnClosed += WindowOnClosed;

            _settingsWindow = AddComponent<SettingsWindow>();
            _settingsWindow.WindowStyle = StyleFactory.SettingsStyle;
            _settingsWindow.OnClosed += WindowOnClosed;

            _launcher = AddComponent<LaunchControl>();
            _launcher.OnTick += _launcher_OnTick;
            _launcher.OnVesselLaunched += _launcher_OnVesselLaunched;
            _launcher.OnVesselAborted += _launcher_OnVesselAborted;

            LaunchCountdownConfig.Instance.Info.OnChanged += Instance_OnChanged;
        }
开发者ID:Kerbas-ad-astra,项目名称:LaunchCountdownEx,代码行数:37,代码来源:MainWindow.cs

示例7: OnDraw

        private void OnDraw()
        {
            if (this.vessel == FlightGlobals.ActiveVessel && this.part.IsPrimary(this.vessel.parts, this.ClassID))
            {
                _windowsPosition = GUILayout.Window(10, _windowsPosition, OnWindow, "Launch Control", _windowStyle);

                if (_windowsPosition.x == 0f && _windowsPosition.y == 0f || _windowsPosition.x > Screen.width || _windowsPosition.y > Screen.height)
                    _windowsPosition = _windowsPosition.CenterScreen();
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:LaunchCountDown,代码行数:10,代码来源:LaunchUI.cs

示例8: OnDraw

        private void OnDraw()
        {
            if (isVisible)
            {
                _windowsPosition = GUILayout.Window(10, _windowsPosition, OnWindow, "Launch Controller", _windowStyle);

                if (_windowsPosition.x == 0f && _windowsPosition.y == 0f || _windowsPosition.x > Screen.width || _windowsPosition.y > Screen.height)
                    _windowsPosition = _windowsPosition.CenterScreen();
            }

            if (isVisible && isSettingsVisible)
            {
                _windowsPosition = GUILayout.Window(10, _windowsPosition, OnWindowSettings, "Audio Settings", _windowStyle);

                if (_windowsPosition.x == 0f && _windowsPosition.y == 0f || _windowsPosition.x > Screen.width || _windowsPosition.y > Screen.height)
                    _windowsPosition = _windowsPosition.CenterScreen();
            }
        }
开发者ID:Summerfirefly,项目名称:LaunchCountDown,代码行数:18,代码来源:LaunchUI.cs


注:本文中的UnityEngine.Rect.CenterScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。