Exemple #1
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.RectOffset o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.RectOffset();
         pushObject(l, o);
         return(1);
     }
     else if (matchType(l, 1, typeof(int), typeof(int), typeof(int), typeof(int)))
     {
         System.Int32 a1;
         checkType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         System.Int32 a3;
         checkType(l, 3, out a3);
         System.Int32 a4;
         checkType(l, 4, out a4);
         o = new UnityEngine.RectOffset(a1, a2, a3, a4);
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
Exemple #2
0
    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();
        }
    }
 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;
 }
Exemple #4
0
        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);
        }
Exemple #5
0
    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);
        }
    }
    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();
        }
    }
Exemple #7
0
 static public 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));
     }
 }
Exemple #8
0
    static public int constructor(IntPtr l)
    {
        int argc = LuaDLL.lua_gettop(l);

        UnityEngine.RectOffset o;
        if (argc == 1)
        {
            o = new UnityEngine.RectOffset();
            pushObject(l, o);
            return(1);
        }
        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);
            pushObject(l, o);
            return(1);
        }
        LuaDLL.luaL_error(l, "New object failed.");
        return(0);
    }
 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);
     }
 }
Exemple #10
0
    static void RectOffset_vertical(JSVCall vc)
    {
        UnityEngine.RectOffset _this = (UnityEngine.RectOffset)vc.csObj;
        var result = _this.vertical;

        JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
    }
 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;
 }
        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);
            }
        }
Exemple #13
0
    static public int set_right(IntPtr l)
    {
        UnityEngine.RectOffset o = (UnityEngine.RectOffset)checkSelf(l);
        int v;

        checkType(l, 2, out v);
        o.right = v;
        return(0);
    }
        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();
        }
            public void ApplyTween(float inPercent)
            {
                RectOffset final = new UnityEngine.RectOffset(
                    (int)(m_Start.left + (m_Target.left - m_Start.left) * inPercent),
                    (int)(m_Start.right + (m_Target.right - m_Start.right) * inPercent),
                    (int)(m_Start.top + (m_Target.top - m_Start.top) * inPercent),
                    (int)(m_Start.bottom + (m_Target.bottom - m_Start.bottom) * inPercent));

                m_Layout.padding = final;
            }
Exemple #16
0
            public override void ApplyTween(float inPercent)
            {
                RectOffset final = new UnityEngine.RectOffset(
                    (int)(m_Start.left + (m_End.left - m_Start.left) * inPercent),
                    (int)(m_Start.right + (m_End.right - m_Start.right) * inPercent),
                    (int)(m_Start.top + (m_End.top - m_Start.top) * inPercent),
                    (int)(m_Start.bottom + (m_End.bottom - m_Start.bottom) * inPercent));

                m_Setter(final);
            }
 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);
 }
 static public int get_left(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         pushValue(l, self.left);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #19
0
		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");
		}
Exemple #20
0
 static public int get_vertical(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.vertical);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #21
0
 static public int get_left(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         pushValue(l, self.left);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_left(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.left = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #23
0
 static public int set_bottom(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.bottom = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Remove(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         UnityEngine.Rect       a1;
         checkValueType(l, 2, out a1);
         var ret = self.Remove(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #25
0
 static public int set_bottom(IntPtr l)
 {
     try {
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.bottom = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #26
0
 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();
 }
Exemple #27
0
 /// <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);
 }
        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);
        }
Exemple #29
0
		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();
		}
Exemple #30
0
		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();
		}
Exemple #31
0
		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();
		}
Exemple #32
0
 static void GUITexture_border(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.GUITexture _this = (UnityEngine.GUITexture)vc.csObj;
         var result = _this.border;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.RectOffset arg0  = (UnityEngine.RectOffset)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.GUITexture _this = (UnityEngine.GUITexture)vc.csObj;
         _this.border = arg0;
     }
 }
Exemple #33
0
 static void RectOffset_top(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.RectOffset _this = (UnityEngine.RectOffset)vc.csObj;
         var result = _this.top;
         JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
     }
     else
     {
         System.Int32           arg0  = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
         UnityEngine.RectOffset _this = (UnityEngine.RectOffset)vc.csObj;
         _this.top = arg0;
     }
 }
Exemple #34
0
 static void GUIStyle_overflow(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.GUIStyle _this = (UnityEngine.GUIStyle)vc.csObj;
         var result = _this.overflow;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.RectOffset arg0  = (UnityEngine.RectOffset)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.GUIStyle   _this = (UnityEngine.GUIStyle)vc.csObj;
         _this.overflow = arg0;
     }
 }
Exemple #35
0
 static public int Remove(IntPtr l)
 {
     try{
         UnityEngine.RectOffset self = (UnityEngine.RectOffset)checkSelf(l);
         UnityEngine.Rect       a1;
         checkType(l, 2, out a1);
         UnityEngine.Rect ret = self.Remove(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
        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;
        }
			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();
			}
Exemple #38
0
    static int get_InitPadding(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            WrapContent            obj = (WrapContent)o;
            UnityEngine.RectOffset ret = obj.InitPadding;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index InitPadding on a nil value"));
        }
    }
Exemple #39
0
 static int QPYX_ConvertRectOffset_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 4);
         int QPYX_arg0_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 1);
         int QPYX_arg1_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 2);
         int QPYX_arg2_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 3);
         int QPYX_arg3_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 4);
         UnityEngine.RectOffset QPYX_o_YXQP = CustomerUtil.ConvertRectOffset(QPYX_arg0_YXQP, QPYX_arg1_YXQP, QPYX_arg2_YXQP, QPYX_arg3_YXQP);
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
    static int set_top(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.RectOffset obj = (UnityEngine.RectOffset)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.top = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index top on a nil value" : e.Message));
        }
    }
    static int get_bottom(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.RectOffset obj = (UnityEngine.RectOffset)o;
            int ret = obj.bottom;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index bottom on a nil value"));
        }
    }
Exemple #42
0
    static int get_horizontal(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.RectOffset obj = (UnityEngine.RectOffset)o;
            int ret = obj.horizontal;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index horizontal on a nil value" : e.Message));
        }
    }
    static int get_padding(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o;
            UnityEngine.RectOffset     ret = obj.padding;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index padding on a nil value"));
        }
    }
    static int set_bottom(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.RectOffset obj = (UnityEngine.RectOffset)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.bottom = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index bottom on a nil value"));
        }
    }
    static int Remove(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UnityEngine.RectOffset obj  = (UnityEngine.RectOffset)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectOffset));
            UnityEngine.Rect       arg0 = StackTraits <UnityEngine.Rect> .Check(L, 2);

            UnityEngine.Rect o = obj.Remove(arg0);
            ToLua.PushValue(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int set_overflow(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.GUIStyle   obj  = (UnityEngine.GUIStyle)o;
            UnityEngine.RectOffset arg0 = (UnityEngine.RectOffset)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectOffset));
            obj.overflow = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index overflow on a nil value" : e.Message));
        }
    }
    static int set_padding(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LayoutGroup obj  = (UnityEngine.UI.LayoutGroup)o;
            UnityEngine.RectOffset     arg0 = (UnityEngine.RectOffset)ToLua.CheckObject <UnityEngine.RectOffset>(L, 2);
            obj.padding = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index padding on a nil value"));
        }
    }
    static int get_overflow(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.GUIStyle   obj = (UnityEngine.GUIStyle)o;
            UnityEngine.RectOffset ret = obj.overflow;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index overflow on a nil value" : e.Message));
        }
    }
Exemple #49
0
		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();
		}
        public override void Awake()
        {
            size = new Vector2(200, 100);

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

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

            UILabel title = AddUIComponent<UILabel>();
            title.text = i18n.current["suncontrol_title"];
            title.textAlignment = UIHorizontalAlignment.Center;
            title.verticalAlignment = UIVerticalAlignment.Middle;
            title.textScale = 1.1f;
            title.autoSize = false;
            title.size = new Vector2(width - 20, 40);

            //0, 1, 2, 4, 8, 16, 32, 64, 128
            speed = AddUIComponent<UILabel>();
            speedControl = UIFactory.CreateSlider(this,0f, speeds.Length);
            speedControl.eventValueChanged += ValueChanged;

            lattitude = AddUIComponent<UILabel>();
            lattitudeControl = UIFactory.CreateSlider(this, -80f, 80f);
            lattitudeControl.eventValueChanged += ValueChanged;

            longitude = AddUIComponent<UILabel>();
            longitudeControl = UIFactory.CreateSlider(this, -180f, 180f);
            longitudeControl.eventValueChanged += ValueChanged;

            AddUIComponent<UILabel>().text = i18n.current["suncontrol_size"];
            sunSize = UIFactory.CreateSlider(this, 0.01f, 10.0f);
            sunSize.eventValueChanged += ValueChanged;

            AddUIComponent<UILabel>().text = i18n.current["suncontrol_intensity"];
            sunIntensity = UIFactory.CreateSlider(this, 0f, 20f);
            sunIntensity.stepSize = 0.1f;
            sunIntensity.eventValueChanged += ValueChanged;

            UILabel endPadding = AddUIComponent<UILabel>();
            endPadding.text = "    ";
        }
        public override void Start()
        {
            base.Start();

            _instance = this;

            isVisible = true;
            canFocus = true;
            isInteractive = true;
            backgroundSprite = "UnlockingPanel";
            padding = new RectOffset(5, 5, 5, 0);

            autoLayout = true;
            autoLayoutDirection = LayoutDirection.Vertical;
            autoLayoutPadding.top = 5;

            SetupControls();
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            SerializedProperty code = property.FindPropertyRelative("m_Glyph.m_Unicode");
            SerializedProperty name = property.FindPropertyRelative("m_Glyph.m_Name");
            SerializedProperty font = property.FindPropertyRelative("m_Font");
            GUIStyle iconStyle = new GUIStyle { font = (Font)font.objectReferenceValue, fontSize = 16 };

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

            float offsetH = 0;

            offsetH -= EditorGUI.PrefixLabel(new Rect(position.x + offsetH, position.y, 40, position.height), label).width;

            offsetH += 40;

            if (!string.IsNullOrEmpty(name.stringValue))
            {
                GUIContent iconLabel = new GUIContent(IconDecoder.Decode(code.stringValue));
                EditorGUI.LabelField(new Rect(position.x + offsetH, position.y, 16, position.height), iconLabel, iconStyle);

                float iconWidth = iconStyle.CalcSize(iconLabel).x;
                offsetH += iconWidth + 2f;

                EditorGUI.LabelField(new Rect(position.x + offsetH, position.y, position.width - offsetH - 80, position.height), name.stringValue);
            }
            else
            {
                EditorGUI.LabelField(new Rect(position.x + offsetH, position.y, position.width - 70 - 56, position.height), "No icon selected");
            }

            if (GUI.Button(new Rect(position.width - 74, position.y, 70, position.height), "Pick Icon"))
            {
                VectorImagePickerWindow.Show((VectorImageData)fieldInfo.GetValue(property.serializedObject.targetObject), property.serializedObject.targetObject);
            }
            if (GUI.Button(new Rect(position.width - 2, position.y, 18, position.height), IconDecoder.Decode(@"\ue14c"), new GUIStyle { font = VectorImageManager.GetIconFont(VectorImageManager.materialDesignIconsFontName) }))
            {
                VectorImageData data = ((VectorImageData)fieldInfo.GetValue(property.serializedObject.targetObject));
                data.font = null;
                data.glyph = null;
                EditorUtility.SetDirty(property.serializedObject.targetObject);
            }
        }
 public GUILayoutGroup() : base(0f, 0f, 0f, 0f, GUIStyle.none)
 {
     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();
 }
 static public int ctor__Int32__Int32__Int32__Int32_s(IntPtr l)
 {
     try {
         UnityEngine.RectOffset o;
         System.Int32           a1;
         checkType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         System.Int32 a3;
         checkType(l, 3, out a3);
         System.Int32 a4;
         checkType(l, 4, out a4);
         o = new UnityEngine.RectOffset(a1, a2, a3, a4);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #55
0
		protected override void Awake()
		{
			WindowRect = sessionRect;
			WindowSize_Min = new Vector2(310, 180);
			WindowSize_Max = new Vector2(540, 400);
			WindowOptions = new GUILayoutOption[2] { GUILayout.Width(340), GUILayout.Height(240) };
			WindowStyle = SCANskins.SCAN_window;
			showInfo = true;
			Visible = false;
			DragEnabled = true;
			ClampEnabled = true;
			TooltipMouseOffset = new Vector2d(-10, -25);
			ClampToScreenOffset = new RectOffset(-200, -200, -160, -160);

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

			removeControlLocks();

			Startup();
		}
        public override void Start()
        {
            base.Start();

            backgroundSprite = "CursorInfoBack";
            autoSize = true;
            padding = new RectOffset(5, 5, 5, 5);
            textScale = GetFontScale();
            textAlignment = UIHorizontalAlignment.Center;
            verticalAlignment = UIVerticalAlignment.Middle;
            zOrder = 100;

            pivot = UIPivotPoint.MiddleCenter;

            color = new Color32(255, 255, 255, 190);
            processMarkup = true;

            isInteractive = false;

            //<color #87d3ff>Construction cost: 520</color>
        }
Exemple #57
0
    public void Start()
    {
        tilesInHand = new List<Tile>();

        // set the whole layout
        // size of one square cell
        GameMatrix.GetComponent<RectTransform>().sizeDelta = new Vector2(-2 * spacing, GameMatrix.GetComponent<RectTransform>().sizeDelta.y);
        cellWidth = (int)(GameMatrix.transform.GetComponent<RectTransform>().rect.width/width);
        Vector3[] corners = new Vector3[4];
        cellHeight = cellWidth;

        bg.GetComponent<RectTransform>().sizeDelta = new Vector2(-2*spacing, cellHeight* heightMatrix + spacing);
        GameMatrix.GetComponent<RectTransform>().sizeDelta = new Vector2(-2 * spacing, cellHeight * heightMatrix + spacing);

        // offsets
        RectOffset offsets = new RectOffset (0, 0, spacing, 0);
		GameMatrix.GetComponent<HorizontalLayoutGroup> ().padding = offsets;
		bg.GetComponent<HorizontalLayoutGroup> ().padding = offsets;

        // use the existing column to create all of them
        GameObject colPrefab = GameMatrix.transform.GetChild(0).gameObject;
		colPrefab.GetComponent<LayoutElement> ().preferredWidth = cellWidth;

        columns = new List<Transform>();
        for (int i = 0; i < width; ++i)
        {
            Transform t;
			if (i != 0) {
				t = GameObject.Instantiate (colPrefab).transform;
			} else {
				t = colPrefab.transform;
			}

            columns.Add(t);
            t.SetParent(GameMatrix.transform,false);
			// set the column number
			t.GetComponent<Column> ().columnNumber = i;
        }
		StartCoroutine( Restart());
    }
 public override void OnPreviewGUI(Rect r, GUIStyle background)
 {
   if (Event.current.type != EventType.Repaint)
     return;
   if (this.m_Styles == null)
     this.m_Styles = new LayoutPropertiesPreview.Styles();
   RectTransform transform = (this.target as GameObject).transform as RectTransform;
   if ((UnityEngine.Object) transform == (UnityEngine.Object) null)
     return;
   r = new RectOffset(-5, -5, -5, -5).Add(r);
   r.height = EditorGUIUtility.singleLineHeight;
   Rect labelRect = r;
   Rect valueRect = r;
   Rect sourceRect = r;
   labelRect.width = 110f;
   valueRect.xMin += 110f;
   valueRect.width = 100f;
   sourceRect.xMin += 210f;
   GUI.Label(labelRect, "Property", this.m_Styles.headerStyle);
   GUI.Label(valueRect, "Value", this.m_Styles.headerStyle);
   GUI.Label(sourceRect, "Source", this.m_Styles.headerStyle);
   labelRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
   valueRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
   sourceRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
   ILayoutElement source = (ILayoutElement) null;
   this.ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Width", LayoutUtility.GetLayoutProperty(transform, (Func<ILayoutElement, float>) (e => e.minWidth), 0.0f, out source).ToString(), source);
   this.ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Min Height", LayoutUtility.GetLayoutProperty(transform, (Func<ILayoutElement, float>) (e => e.minHeight), 0.0f, out source).ToString(), source);
   this.ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Width", LayoutUtility.GetLayoutProperty(transform, (Func<ILayoutElement, float>) (e => e.preferredWidth), 0.0f, out source).ToString(), source);
   this.ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Preferred Height", LayoutUtility.GetLayoutProperty(transform, (Func<ILayoutElement, float>) (e => e.preferredHeight), 0.0f, out source).ToString(), source);
   float layoutProperty1 = LayoutUtility.GetLayoutProperty(transform, (Func<ILayoutElement, float>) (e => e.flexibleWidth), 0.0f, out source);
   this.ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Width", (double) layoutProperty1 <= 0.0 ? "disabled" : "enabled (" + layoutProperty1.ToString() + ")", source);
   float layoutProperty2 = LayoutUtility.GetLayoutProperty(transform, (Func<ILayoutElement, float>) (e => e.flexibleHeight), 0.0f, out source);
   this.ShowProp(ref labelRect, ref valueRect, ref sourceRect, "Flexible Height", (double) layoutProperty2 <= 0.0 ? "disabled" : "enabled (" + layoutProperty2.ToString() + ")", source);
   if ((bool) ((UnityEngine.Object) transform.GetComponent<LayoutElement>()))
     return;
   GUI.Label(new Rect(labelRect.x, labelRect.y + 10f, r.width, EditorGUIUtility.singleLineHeight), "Add a LayoutElement to override values.", this.m_Styles.labelStyle);
 }
Exemple #59
0
    public override void OnEnable()
    {
        if( padding == null )
            padding = new RectOffset();

        base.OnEnable();

        if( size.magnitude == 0 )
        {
            Size = new Vector2( 100, 20 );
        }

        cursorShown = false;
        cursorIndex = scrollIndex = 0;

        #region Ensure that this control always has a valid font, if possible

        var validFont =
            Font != null &&
            Font.IsValid;

        if( Application.isPlaying && !validFont )
        {
            Font = GetManager().DefaultFont;
        }

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

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

            Vector2 maxEventLabelSize = Vector2.zero;
            int totalInterceptedEvents = 0;

            ComponentInterceptedEvents[] componentIncerceptedEvents = m_TargetEvents[target as GameObject];

            // Find out the maximum size needed for any given label.
            foreach (ComponentInterceptedEvents componentInterceptedEvents in componentIncerceptedEvents)
            {
                foreach (GUIContent eventContent in componentInterceptedEvents.interceptedEvents)
                {
                    ++totalInterceptedEvents;
                    Vector2 labelSize = m_Styles.labelStyle.CalcSize(eventContent);
                    if (maxEventLabelSize.x < labelSize.x)
                    {
                        maxEventLabelSize.x = labelSize.x;
                    }
                    if (maxEventLabelSize.y < labelSize.y)
                    {
                        maxEventLabelSize.y = labelSize.y;
                    }
                }
            }

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

            // Figure out how many rows and columns we can/should have
            int columns = Mathf.Max(Mathf.FloorToInt(r.width / maxEventLabelSize.x), 1);
            int rows = Mathf.Max(totalInterceptedEvents / columns, 1) + componentIncerceptedEvents.Length;

            // Centering
            float initialX = r.x + Mathf.Max(0, (r.width - (maxEventLabelSize.x * columns)) / 2);
            float initialY = r.y + Mathf.Max(0, (r.height - (maxEventLabelSize.y * rows)) / 2);

            Rect labelRect = new Rect(initialX, initialY, maxEventLabelSize.x, maxEventLabelSize.y);
            int currentColumn = 0;
            foreach (ComponentInterceptedEvents componentInterceptedEvents in componentIncerceptedEvents)
            {
                GUI.Label(labelRect, componentInterceptedEvents.componentName, m_Styles.componentName);
                labelRect.y += labelRect.height;
                labelRect.x = initialX;
                foreach (GUIContent eventContent in componentInterceptedEvents.interceptedEvents)
                {
                    GUI.Label(labelRect, eventContent, m_Styles.labelStyle);
                    if (currentColumn < columns - 1)
                    {
                        labelRect.x += labelRect.width;
                    }
                    else
                    {
                        labelRect.y += labelRect.height;
                        labelRect.x = initialX;
                    }

                    currentColumn = (currentColumn + 1) % columns;
                }

                if (labelRect.x != initialX)
                {
                    labelRect.y += labelRect.height;
                    labelRect.x = initialX;
                }
            }
        }