本文整理汇总了C#中UIView.GetScreenResolution方法的典型用法代码示例。如果您正苦于以下问题:C# UIView.GetScreenResolution方法的具体用法?C# UIView.GetScreenResolution怎么用?C# UIView.GetScreenResolution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIView
的用法示例。
在下文中一共展示了UIView.GetScreenResolution方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateUIDialog
public static UIDialog CreateUIDialog(UIView view, string title, string details, OptionClicked accept, OptionClicked decline, bool destroyOnOption)
{
UIDialog dialog = (UIDialog)view.AddUIComponent (typeof(UIDialog));
dialog.Start ();
dialog.m_title.text = title;
Vector2 screenRes = view.GetScreenResolution();
dialog.m_details.text = details;
dialog.m_title.relativePosition = new Vector3(WIDTH/2 - dialog.m_title.width/2,HEAD/2 - dialog.m_title.height/2);
if (destroyOnOption) {
dialog.eventAccept += () => {GameObject.DestroyImmediate(dialog.gameObject);};
dialog.eventDecline += () => {GameObject.DestroyImmediate(dialog.gameObject);};
}
dialog.eventAccept += accept;
dialog.eventDecline += decline;
dialog.relativePosition = new Vector3(screenRes.x/2 - dialog.width/2,screenRes.y/2 - dialog.height/2);
return dialog;
}
示例2: AddToolbarButton
private void AddToolbarButton(UIView view)
{
_toolbar_Button = (UICheckButton)view.AddUIComponent(typeof(UICheckButton));
_toolbar_Button.atlas = _atlas;
_toolbar_Button.normalBgSprite = "OptionBase";
_toolbar_Button.hoveredBgSprite = "OptionBaseFocused";
_toolbar_Button.pressedBgSprite = "OptionBasePressed";
_toolbar_Button.normalFgSprite = "Music";
_toolbar_Button.width = 36;
_toolbar_Button.height = 36;
Vector2 screenResolution = view.GetScreenResolution();
_toolbar_Button.relativePosition = new Vector3(screenResolution.x - _toolbar_Button.width - 10 - 20 - 40, screenResolution.y - _toolbar_Button.height / 2 - 120 + 7);
_toolbar_Button.eventClick += delegate
{
_toolbar_Button_MouseDown_Timer = -1;
_current_Settings_Panel.isVisible = !_current_Settings_Panel.isVisible;
};
//Drag,drop
_toolbar_Button.eventMouseDown += (component, eventParam) =>
{
_toolbar_Button_MouseDown_Timer = 60;
};
_toolbar_Button.eventMouseUp += (component, eventParam) =>
{
if (_toolbar_Button_dragging)
{
gameObject.GetComponent<SettingsManager>().SaveModSettings();
_toolbar_Button_dragging = false;
}
_toolbar_Button_dragging = false;
_toolbar_Button_MouseDown_Timer = -1;
};
}