• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.RectOffset类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



RectOffset类属于UnityEngine命名空间,在下文中一共展示了RectOffset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GUILayoutGroup

 public GUILayoutGroup(GUIStyle _style, GUILayoutOption[] options) : base(0f, 0f, 0f, 0f, _style)
 {
     this.entries = new List<GUILayoutEntry>();
     this.isVertical = true;
     this.resetCoords = false;
     this.spacing = 0f;
     this.sameSize = true;
     this.isWindow = false;
     this.windowID = -1;
     this.m_Cursor = 0;
     this.m_StretchableCountX = 100;
     this.m_StretchableCountY = 100;
     this.m_UserSpecifiedWidth = false;
     this.m_UserSpecifiedHeight = false;
     this.m_ChildMinWidth = 100f;
     this.m_ChildMaxWidth = 100f;
     this.m_ChildMinHeight = 100f;
     this.m_ChildMaxHeight = 100f;
     this.m_Margin = new RectOffset();
     if (options != null)
     {
         this.ApplyOptions(options);
     }
     this.m_Margin.left = _style.margin.left;
     this.m_Margin.right = _style.margin.right;
     this.m_Margin.top = _style.margin.top;
     this.m_Margin.bottom = _style.margin.bottom;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:28,代码来源:GUILayoutGroup.cs


示例2: UpdateBar

    private void UpdateBar()
    {
        /*
         * Calculate offset of bar texture based on percent points.
         */
        percentage = Mathf.Clamp (percentage, -100, 100);
        RectOffset tempOffset = new RectOffset(0, 0, -(percentage*edges)/100, 0);

        if(percentage > 0)
        {
            happyBar.border = tempOffset;
            sadBar.border = new RectOffset(0, 0, 0, 0);
        }
        else
        {
            happyBar.border = new RectOffset(0, 0, 0, 0);
            sadBar.border = tempOffset;
        }

        CheckGlow();

        if(percentage <= -99)
        {
            gameOverScript.TriggerGameOver();
        }
    }
开发者ID:johannes-qvarford,项目名称:LunchLadySimulator,代码行数:26,代码来源:HappyBarController.cs


示例3: OnGUI

    void OnGUI()
    {
        GUIStyle myStyle = new GUIStyle (GUI.skin.box);
        myStyle.normal.textColor = Color.white;

        myStyle.onNormal.textColor = Color.white;
        myStyle.onHover.textColor = Color.white;

        myStyle.alignment = TextAnchor.MiddleCenter;

        RectOffset margin = new RectOffset ();
        margin.bottom = 10;
        margin.top = 10;
        myStyle.margin = margin;

        int ftSize = (int)(Screen.height * .07);
        myStyle.fontSize = ftSize;

        if (GUI.Button (new Rect (Screen.width * .25f, Screen.height * .30f, Screen.width * .5f, Screen.height * .1f), "New Game", myStyle)) {
        }

        if (GUI.Button (new Rect (Screen.width * .25f, Screen.height * .42f, Screen.width * .5f, Screen.height * .1f), "Leaderboard", myStyle)) {
            Application.LoadLevel (1);
        }

        if (GUI.Button (new Rect (Screen.width * .25f, Screen.height * .66f, Screen.width * .5f, Screen.height * .1f), "Quit", myStyle)) {
            Application.Quit();
        }
    }
开发者ID:Pringlez,项目名称:Alien-Danger-TD,代码行数:29,代码来源:MainMenu.cs


示例4: Awake

        public override void Awake()
        {
            size = new Vector2(400, 100);

            anchor = UIAnchorStyle.Bottom & UIAnchorStyle.Left;
            backgroundSprite = "ButtonMenu";

            autoLayoutPadding = new RectOffset(10, 10, 4, 4);
            autoLayout = true;
            autoFitChildrenVertically = true;
            autoLayoutDirection = LayoutDirection.Vertical;

            timeOfDay = AddUIComponent<UILabel>();
            timeOfDay.textAlignment = UIHorizontalAlignment.Center;
            timeOfDay.size = new Vector2(width - 20, 20);
            timeOfDay.autoSize = false;

            timeSlider = UIFactory.CreateSlider(this, 0.0f, 24.0f);
            timeSlider.stepSize = 1f / 60.0f;
            timeSlider.eventValueChanged += ChangeTime;
            ((UIPanel)timeSlider.parent).backgroundSprite = "BudgetBarBackground";
            ((UISprite)timeSlider.thumbObject).spriteName = "InfoIconBasePressed";

            timeSlider.eventDragStart += timeSlider_eventDragStart;
            //timeSlider.eventDragEnd += timeSlider_eventDragEnd;

            eventMouseUp += timeSlider_eventDragEnd;

            UISprite pad = AddUIComponent<UISprite>();
            pad.autoSize = false;
            pad.size = new Vector2(10, 5);
        }
开发者ID:dmantione,项目名称:TimeWarp,代码行数:32,代码来源:TimeSlider.cs


示例5: SkinBG

    public SkinBG(Texture2D bgTex, RectOffset b)
    {
        size = new Vector2(bgTex.width, bgTex.height);
        border = b;
        if(border.left > 0)
        {
            // bottom left
            this.bl = TextureDrawer.GetSecuredPixels(bgTex, 0, 0, border.left, border.bottom);
            // left center
            this.cl = TextureDrawer.GetSecuredPixels(bgTex, 0, border.bottom, border.left, bgTex.height-border.vertical);
            // top left
            this.tl =TextureDrawer.GetSecuredPixels(bgTex, 0, bgTex.height-border.top, border.left, border.top);
        }

        // bottom center
        this.bc = TextureDrawer.GetSecuredPixels(bgTex, border.left, 0, bgTex.width-border.horizontal, border.bottom);
        // center center
        this.cc = TextureDrawer.GetSecuredPixels(bgTex, border.left, border.bottom, bgTex.width-border.horizontal, bgTex.height-border.vertical);
        // top center
        this.tc = TextureDrawer.GetSecuredPixels(bgTex, border.left, bgTex.height-border.top, bgTex.width-border.horizontal, border.top);

        if(border.right > 0)
        {
            // bottom right
            this.br = TextureDrawer.GetSecuredPixels(bgTex, bgTex.width-border.right, 0, border.right, border.bottom);
            // right center
            this.cr = TextureDrawer.GetSecuredPixels(bgTex, bgTex.width-border.right, border.bottom, border.right, bgTex.height-border.vertical);
            // top right
            this.tr = TextureDrawer.GetSecuredPixels(bgTex, bgTex.width-border.right, bgTex.height-border.top, border.right, border.top);
        }
    }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:31,代码来源:SkinBG.cs


示例6: constructor

 public static int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.RectOffset o;
         if(argc==1){
             o=new UnityEngine.RectOffset();
             pushValue(l,true);
             pushValue(l,o);
             return 2;
         }
         else if(argc==5){
             System.Int32 a1;
             checkType(l,2,out a1);
             System.Int32 a2;
             checkType(l,3,out a2);
             System.Int32 a3;
             checkType(l,4,out a3);
             System.Int32 a4;
             checkType(l,5,out a4);
             o=new UnityEngine.RectOffset(a1,a2,a3,a4);
             pushValue(l,true);
             pushValue(l,o);
             return 2;
         }
         return error(l,"New object failed.");
     }
     catch(Exception e) {
         return error(l,e);
     }
 }
开发者ID:jadie,项目名称:slua_test,代码行数:31,代码来源:Lua_UnityEngine_RectOffset.cs


示例7: SetRectOffset

 public static RectOffset SetRectOffset(RectOffset tmpRectOffset, int Left, int Right, int Top, int Bottom)
 {
     tmpRectOffset.left = Left;
     tmpRectOffset.top = Top;
     tmpRectOffset.right = Right;
     tmpRectOffset.bottom = Bottom;
     return tmpRectOffset;
 }
开发者ID:yaus,项目名称:EnhancedNavBall,代码行数:8,代码来源:BasicResources.cs


示例8: OnPreviewGUI

        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            if (Event.current.type != EventType.Repaint)
                return;

            if (m_Styles == null)
                m_Styles = new Styles();

            GameObject go = target as GameObject;
            RectTransform rect = go.transform as RectTransform;
            if (rect == null)
                return;

            // Apply padding
            RectOffset previewPadding = new RectOffset(-5, -5, -5, -5);
            r = previewPadding.Add(r);

            // Prepare rects for columns
            r.height = EditorGUIUtility.singleLineHeight;
            Rect labelRect = r;
            Rect valueRect = r;
            Rect sourceRect = r;
            labelRect.width = kLabelWidth;
            valueRect.xMin += kLabelWidth;
            valueRect.width = kValueWidth;
            sourceRect.xMin += kLabelWidth + kValueWidth;

            // Headers
            GUI.Label(labelRect, "Property", m_Styles.headerStyle);
            GUI.Label(valueRect, "Value", m_Styles.headerStyle);
            GUI.Label(sourceRect, "Source", m_Styles.headerStyle);
            labelRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            valueRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            sourceRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

            // Prepare reusable variable for out argument
            ILayoutElement source = null;

            // Show properties

            ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Width", LayoutUtility.GetLayoutProperty(rect, e => e.minWidth, 0, out source).ToString(), source);
            ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Height", LayoutUtility.GetLayoutProperty(rect, e => e.minHeight, 0, out source).ToString(), source);
            ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Width", LayoutUtility.GetLayoutProperty(rect, e => e.preferredWidth, 0, out source).ToString(), source);
            ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Height", LayoutUtility.GetLayoutProperty(rect, e => e.preferredHeight, 0, out source).ToString(), source);

            float flexible = 0;

            flexible = LayoutUtility.GetLayoutProperty(rect, e => e.flexibleWidth, 0, out source);
            ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Width", flexible > 0 ? ("enabled (" + flexible.ToString() + ")") : "disabled", source);
            flexible = LayoutUtility.GetLayoutProperty(rect, e => e.flexibleHeight, 0, out source);
            ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Height", flexible > 0 ? ("enabled (" + flexible.ToString() + ")") : "disabled", source);

            if (!rect.GetComponent<LayoutElement>())
            {
                Rect noteRect = new Rect(labelRect.x, labelRect.y + 10, r.width, EditorGUIUtility.singleLineHeight);
                GUI.Label(noteRect, "Add a LayoutElement to override values.", m_Styles.labelStyle);
            }
        }
开发者ID:gdzzzyyy,项目名称:UGUIlok,代码行数:58,代码来源:LayoutPropertiesPreview.cs


示例9: Awake

        public override void Awake()
        {
            autoFitChildrenVertically = true;
            backgroundSprite = "MenuPanel";
            width = 200;
            height = 400;
            anchor = UIAnchorStyle.Top | UIAnchorStyle.Left;

            m_AutoLayoutPadding = new RectOffset(5, 5, 5, 0);
            m_AutoLayoutDirection = LayoutDirection.Vertical;

            m_AutoLayout = true;

            title = AddUIComponent<UILabel>();
            title.autoSize = false;
            title.textScale = 1.1f;
            title.verticalAlignment = UIVerticalAlignment.Middle;
            title.textAlignment = UIHorizontalAlignment.Center;
            title.size = new Vector2(width - 10, 40);

            chart = AddUIComponent<BreakdownPercent>();
            chart.size = new Vector2(190, 190);

            chart.spriteName = "PieChartWhiteBg";

            breakdown = new BreakdownElement[20];

            for(int i = 0; i < breakdown.Length; i++)
            {
                BreakdownElement view = AddUIComponent<BreakdownElement>();
                view.tooltip = "Click to toggle display";
                view.size = new Vector2(200, 15);

                view.eventMouseEnter += (UIComponent component, UIMouseEventParameter eventParam) =>
                {
                    if (eventHighlightType != null)
                        eventHighlightType(view.type);
                };
                view.eventMouseLeave += (UIComponent component, UIMouseEventParameter eventParam) =>
                {
                    if (eventHighlightType != null)
                        eventHighlightType(null);
                };

                breakdown[i] = view;
            }

            total = AddUIComponent<UILabel>();
            total.autoSize = false;
            total.text = "Total: 0";
            total.textColor = new Color32(206, 248, 0, 255);
            total.textScale = 0.9f;
            total.verticalAlignment = UIVerticalAlignment.Middle;
            total.size = new Vector2(190, 35);

            Invalidate();
        }
开发者ID:akira-ishizaki,项目名称:TrafficReport,代码行数:57,代码来源:BreakdownPanel.cs


示例10: DrawOptionData

 private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
 {
   SerializedProperty arrayElementAtIndex = this.m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
   SerializedProperty propertyRelative1 = arrayElementAtIndex.FindPropertyRelative("m_Text");
   SerializedProperty propertyRelative2 = arrayElementAtIndex.FindPropertyRelative("m_Image");
   rect = new RectOffset(0, 0, -1, -3).Add(rect);
   rect.height = EditorGUIUtility.singleLineHeight;
   EditorGUI.PropertyField(rect, propertyRelative1, GUIContent.none);
   rect.y += EditorGUIUtility.singleLineHeight;
   EditorGUI.PropertyField(rect, propertyRelative2, GUIContent.none);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:11,代码来源:DropdownOptionListDrawer.cs


示例11: Awake

		protected override void Awake()
		{
			WindowCaption = "S.C.A.N. Instruments";
			WindowRect = sessionRect;
			WindowStyle = SCANskins.SCAN_window;
			WindowOptions = new GUILayoutOption[2] { GUILayout.Width(260), GUILayout.Height(60) };
			Visible = false;
			DragEnabled = true;
			ClampToScreenOffset = new RectOffset(-200, -200, -40, -40);

			SCAN_SkinsLibrary.SetCurrent("SCAN_Unity");
		}
开发者ID:DBT85,项目名称:SCANsat,代码行数:12,代码来源:SCANinstrumentUI.cs


示例12: Awake

		protected override void Awake()
		{
			WindowCaption = "S.C.A.N. Planetary Mapping";
			WindowRect = sessionRect;
			WindowOptions = new GUILayoutOption[2] { GUILayout.Width(380), GUILayout.Height(230) };
			WindowStyle = SCANskins.SCAN_window;
			Visible = false;
			DragEnabled = true;
			TooltipMouseOffset = new Vector2d(-10, -25);
			ClampToScreenOffset = new RectOffset(-300, -300, -200, -200);

			SCAN_SkinsLibrary.SetCurrent("SCAN_Unity");
			SCAN_SkinsLibrary.SetCurrentTooltip();
		}
开发者ID:DBT85,项目名称:SCANsat,代码行数:14,代码来源:SCANmainMap.cs


示例13: Horizontal

 /// <summary>
 /// Shows the given block delegate using an horizontal layout.
 /// </summary>
 /// <example><code>HOGUILayout.Horizontal(myGUIStyle, () => { block code here; };</code></example>
 public static void Horizontal(RectOffset padding, GUIStyle guiStyle, Color backgroundShade, Action blockAction, params GUILayoutOption[] options)
 {
     GUIStyle style;
     if (padding != null) {
         style = guiStyle == null ? new GUIStyle() : new GUIStyle(guiStyle);
         style.padding.left += padding.left;
         style.padding.right += padding.right;
         style.padding.top += padding.top;
         style.padding.bottom += padding.bottom;
     } else {
         style = guiStyle;
     }
     _Horizontal(style, backgroundShade, blockAction, options);
 }
开发者ID:fergu00,项目名称:hounitylibs,代码行数:18,代码来源:HOGUILayout.cs


示例14: Awake

		protected override void Awake()
		{
			WindowCaption = "S.C.A.N. Color Management";
			WindowRect = sessionRect;
			WindowStyle = SCANskins.SCAN_window;
			WindowOptions = new GUILayoutOption[2] { GUILayout.Width(780), GUILayout.Height(360) };
			Visible = false;
			DragEnabled = true;
			ClampToScreenOffset = new RectOffset(-450, -450, -250, -250);

			SCAN_SkinsLibrary.SetCurrent("SCAN_Unity");

			removeControlLocks();
		}
开发者ID:DBT85,项目名称:SCANsat,代码行数:14,代码来源:SCANcolorSelection.cs


示例15: DrawOptionData

        private void DrawOptionData(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty itemData = m_ReorderableList.serializedProperty.GetArrayElementAtIndex(index);
            SerializedProperty itemText = itemData.FindPropertyRelative("m_Text");
            SerializedProperty itemImage = itemData.FindPropertyRelative("m_Image");

            RectOffset offset = new RectOffset(0, 0, -1, -3);
            rect = offset.Add(rect);
            rect.height = EditorGUIUtility.singleLineHeight;

            EditorGUI.PropertyField(rect, itemText, GUIContent.none);
            rect.y += EditorGUIUtility.singleLineHeight;
            EditorGUI.PropertyField(rect, itemImage, GUIContent.none);
        }
开发者ID:gdzzzyyy,项目名称:UGUIlok,代码行数:14,代码来源:DropdownOptionListDrawer.cs


示例16: GUILayoutGroup

 public GUILayoutGroup() : base(0f, 0f, 0f, 0f, GUIStyle.none)
 {
     this.entries = new List<GUILayoutEntry>();
     this.isVertical = true;
     this.sameSize = true;
     this.windowID = -1;
     this.m_StretchableCountX = 100;
     this.m_StretchableCountY = 100;
     this.m_ChildMinWidth = 100f;
     this.m_ChildMaxWidth = 100f;
     this.m_ChildMinHeight = 100f;
     this.m_ChildMaxHeight = 100f;
     this.m_Margin = new RectOffset();
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:14,代码来源:GUILayoutGroup.cs


示例17: Awake

		protected override void Awake()
		{
			WindowCaption = "S.C.A.N. Settings";
			WindowRect = defaultRect;
			WindowStyle = SCANskins.SCAN_window;
			WindowOptions = new GUILayoutOption[2] { GUILayout.Width(360), GUILayout.Height(300) };
			Visible = false;
			DragEnabled = true;
			TooltipMouseOffset = new Vector2d(-10, -25);
			ClampToScreenOffset = new RectOffset(-280, -280, -600, -600);

			SCAN_SkinsLibrary.SetCurrent("SCAN_Unity");

			removeControlLocks();
		}
开发者ID:DBT85,项目名称:SCANsat,代码行数:15,代码来源:SCANsettingsUI.cs


示例18: Settings

        internal Settings()
        {
            DefaultMargin = new RectOffset(8, 8, 8, 8);
              DefaultPadding = new RectOffset(8, 8, 6, 6);

              LowMargin = new RectOffset(4, 4, 4, 4);
              LowPadding = new RectOffset(4, 4, 2, 2);

              HierarchyPanelWidth = 350;
              InspectorPanelWidth = 450;

              ConsoleSize = new Vector2(550, 600);

              LogEntrySize = 16;
              TreeEntryIndention = 20;
        }
开发者ID:buckle2000,项目名称:besiege-modloader,代码行数:16,代码来源:Settings.cs


示例19: Styles

			public Styles()
			{
				this.m_CopyLabelStyle = new GUIStyle(EditorStyles.label);
				this.m_CopyLabelStyle.name = "CopyLabel";
				GUIStyle arg_43_0 = this.m_CopyLabelStyle;
				RectOffset rectOffset = new RectOffset(0, 0, 0, 0);
				this.m_CopyLabelStyle.padding = rectOffset;
				arg_43_0.margin = rectOffset;
				this.m_FontColorTexture = new Texture2D(1, 1);
				this.m_FontColorTexture.SetPixels(new Color[]
				{
					EditorStyles.label.onNormal.textColor,
					EditorStyles.label.onNormal.textColor
				});
				this.m_FontColorTexture.Apply();
			}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:16,代码来源:BuildUploadCompletedWindow.cs


示例20: Awake

		protected override void Awake()
		{
			WindowCaption = "Map of ";
			WindowRect = sessionRect;
			WindowOptions = new GUILayoutOption[2] { GUILayout.Width(740), GUILayout.Height(420) };
			WindowStyle = SCANskins.SCAN_window;
			Visible = false;
			DragEnabled = true;
			TooltipMouseOffset = new Vector2d(-10, -25);
			ClampToScreenOffset = new RectOffset(-600, -600, -400, -400);
			waypoints = HighLogic.LoadedScene != GameScenes.SPACECENTER;

			SCAN_SkinsLibrary.SetCurrent("SCAN_Unity");
			SCAN_SkinsLibrary.SetCurrentTooltip();

			removeControlLocks();
		}
开发者ID:DBT85,项目名称:SCANsat,代码行数:17,代码来源:SCANkscMap.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.RectTransform类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.Rect类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap