本文整理汇总了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();
}
}
示例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();
}
}
}
示例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");
}
}
}
示例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();
}
}
示例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();
}
}
}
示例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;
}
示例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();
}
}
示例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();
}
}