當前位置: 首頁>>代碼示例>>C#>>正文


C# UnityEngine.RectOffset類代碼示例

本文整理匯總了C#中UnityEngine.RectOffset的典型用法代碼示例。如果您正苦於以下問題:C# RectOffset類的具體用法?C# RectOffset怎麽用?C# RectOffset使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RectOffset類屬於UnityEngine命名空間,在下文中一共展示了RectOffset類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的UnityEngine.RectOffset類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。