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


C# UIView.GetScreenResolution方法代码示例

本文整理汇总了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;
        }
开发者ID:CWMlolzlz,项目名称:Challenges,代码行数:22,代码来源:UIDialog.cs

示例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;
            };
        }
开发者ID:AmonRGT,项目名称:CSLMusicMod,代码行数:36,代码来源:MusicUI.cs


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