Inheritance: DisplayObject
Example #1
0
 static public int DrawPolygon(IntPtr l)
 {
     try {
         FairyGUI.Shape    self = (FairyGUI.Shape)checkSelf(l);
         UnityEngine.Color a1;
         checkType(l, 2, out a1);
         UnityEngine.Vector2[] a2;
         checkArray(l, 3, out a2);
         self.DrawPolygon(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #2
0
    static int get_shape(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.GGraph obj = (FairyGUI.GGraph)o;
            FairyGUI.Shape  ret = obj.shape;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index shape on a nil value"));
        }
    }
 static public int DrawRect(IntPtr l)
 {
     try {
         FairyGUI.Shape self = (FairyGUI.Shape)checkSelf(l);
         System.Int32   a1;
         checkType(l, 2, out a1);
         UnityEngine.Color a2;
         checkType(l, 3, out a2);
         UnityEngine.Color a3;
         checkType(l, 4, out a3);
         self.DrawRect(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
        public override void Setup_BeforeAdd(XML xml)
        {
            string str;
            string type = xml.GetAttribute("type");
            if (type != null && type != "empty")
            {
                _shape = new Shape();
                _shape.gOwner = this;
                displayObject = _shape;
            }

            base.Setup_BeforeAdd(xml);

            if (_shape != null)
            {
                int lineSize;
                str = xml.GetAttribute("lineSize");
                if (str != null)
                    lineSize = int.Parse(str);
                else
                    lineSize = 1;

                Color lineColor;
                str = xml.GetAttribute("lineColor");
                if (str != null)
                    lineColor = ToolSet.ConvertFromHtmlColor(str);
                else
                    lineColor = Color.black;

                Color fillColor;
                str = xml.GetAttribute("fillColor");
                if (str != null)
                    fillColor = ToolSet.ConvertFromHtmlColor(str);
                else
                    fillColor = Color.white;

                if (type == "rect")
                    DrawRect(this.width, this.height, lineSize, lineColor, fillColor);
                else
                    DrawEllipse(this.width, this.height, fillColor);
            }
        }
Example #5
0
        /// <summary>
        /// 设置内容为一个原生对象。这个图形对象相当于一个占位的用途。
        /// </summary>
        /// <param name="obj">原生对象</param>
        public void SetNativeObject(DisplayObject obj)
        {
            if (displayObject == obj)
                return;

            if (displayObject != null)
            {
                if (displayObject.parent != null)
                    displayObject.parent.RemoveChild(displayObject, true);
                else
                    displayObject.Dispose();
                _shape = null;
                displayObject.gOwner = null;
                displayObject = null;
            }

            displayObject = obj;

            if (displayObject != null)
            {
                displayObject.alpha = this.alpha;
                displayObject.rotation = this.rotation;
                displayObject.visible = this.visible;
                displayObject.touchable = this.touchable;
                displayObject.gOwner = this;
            }

            if (parent != null)
                parent.ChildStateChanged(this);
            HandlePositionChanged();
        }
        static void CreateCaret()
        {
            _caret = new Shape();
            _caret.gameObject.name = "InputCaret";
            _caret.touchable = false;
            _caret._skipInFairyBatching = true;
            _caret.graphics.dontClip = true;
            _caret.home = Stage.inst.cachedTransform;

            _selectionShape = new SelectionShape();
            _selectionShape.gameObject.name = "InputSelection";
            _selectionShape.color = UIConfig.inputHighlightColor;
            _selectionShape._skipInFairyBatching = true;
            _selectionShape.touchable = false;
            _selectionShape.home = Stage.inst.cachedTransform;
        }