Esempio n. 1
0
        void DrawFrame()
        {
            _forceDraw = false;

            if (_currentFrame >= frames.Length)
            {
                graphics.ClearMesh();
            }
            else
            {
                Frame frame = frames[_currentFrame];

                if (frame.rect.width == 0)
                {
                    graphics.ClearMesh();
                }
                else
                {
                    Rect uvRect = frame.uvRect;
                    if (_flip != FlipType.None)
                    {
                        ToolSet.FlipRect(ref uvRect, _flip);
                    }

                    graphics.DrawRect(frame.rect, uvRect, _color);
                    if (frame.rotated)
                    {
                        NGraphics.RotateUV(graphics.uv, ref uvRect);
                    }
                    graphics.UpdateMesh();
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 public Shape()
 {
     CreateGameObject("Shape");
     graphics             = new NGraphics(gameObject);
     graphics.texture     = NTexture.Empty;
     graphics.meshFactory = null;
 }
Esempio n. 3
0
        /// <summary>
        /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。
        /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。
        /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。
        /// </summary>
        /// <param name="requestId">请求者id</param>
        /// <param name="margin">纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。</param>
        public void EnterPaintingMode(int requestorId, Margin?margin)
        {
            bool first = _paintingMode == 0;

            _paintingMode |= requestorId;
            if (first)
            {
                if (paintingGraphics == null)
                {
                    paintingGraphics = new NGraphics();
                }
                else
                {
                    paintingGraphics.enabled = true;
                }

                _paintingMargin = new Margin();
                _outlineChanged = true;
            }
            if (margin != null)
            {
                _paintingMargin = (Margin)margin;
            }
            _paintingFlag = 1;
        }
Esempio n. 4
0
 public SelectionShape()
 {
     CreateGameObject("SelectionShape");
     graphics         = new NGraphics(gameObject);
     graphics.texture = NTexture.Empty;
     _color           = Color.white;
 }
Esempio n. 5
0
 public SelectionShape()
 {
     CreateGameObject("SelectionShape");
     graphics = new NGraphics(gameObject);
     graphics.texture = NTexture.Empty;
     _color = Color.white;
 }
 static public int FillTriangles(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
             self.FillTriangles();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
             System.Int32[]     a1;
             checkArray(l, 2, out a1);
             self.FillTriangles(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 7
0
 /// <summary>
 ///
 /// </summary>
 public void CreateGraphics()
 {
     if (graphics == null)
     {
         graphics         = new NGraphics(this.gameObject);
         graphics.texture = NTexture.Empty;
     }
 }
Esempio n. 8
0
        public SelectionShape()
        {
            graphics             = new NGraphics();
            graphics.texture     = NTexture.Empty;
            graphics.meshFactory = this;

            rects = new List <Rectangle>();
        }
Esempio n. 9
0
        /// <summary>
        /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。
        /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。
        /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。
        /// </summary>
        /// <param name="requestId">请求者id</param>
        /// <param name="margin">纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。</param>
        public void EnterPaintingMode(int requestorId, Margin?margin)
        {
            bool first = _paintingMode == 0;

            _paintingMode |= requestorId;
            if (first)
            {
                if (paintingGraphics == null)
                {
                    if (graphics == null)
                    {
                        paintingGraphics = new NGraphics(this.gameObject);
                    }
                    else
                    {
                        GameObject go = new GameObject(this.gameObject.name + " (Painter)");
                        go.layer = this.gameObject.layer;
                        ToolSet.SetParent(go.transform, cachedTransform);
                        go.hideFlags     = DisplayOptions.hideFlags;
                        paintingGraphics = new NGraphics(go);
                    }
                }
                else
                {
                    paintingGraphics.enabled = true;
                }
                paintingGraphics.vertexMatrix = null;

                if (_paintingMaterial == null)
                {
                    _paintingMaterial           = new Material(ShaderConfig.GetShader(ShaderConfig.imageShader));
                    _paintingMaterial.hideFlags = DisplayOptions.hideFlags;
                }
                paintingGraphics.material = _paintingMaterial;

                if (this is Container)
                {
                    ((Container)this).SetChildrenLayer(CaptureCamera.hiddenLayer);
                    ((Container)this).UpdateBatchingFlags();
                }
                else
                {
                    this.InvalidateBatchingState();
                }

                if (graphics != null)
                {
                    this.gameObject.layer = CaptureCamera.hiddenLayer;
                }

                _paintingMargin = new Margin();
            }
            if (margin != null)
            {
                _paintingMargin = (Margin)margin;
            }
            _paintingFlag = 1;
        }
        public SelectionShape()
        {
            CreateGameObject("SelectionShape");
            graphics             = new NGraphics(gameObject);
            graphics.texture     = NTexture.Empty;
            graphics.meshFactory = this;

            rects = new List <Rect>();
        }
Esempio n. 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="texture"></param>
        public Image(NTexture texture)
        {
            _touchDisabled       = true;
            graphics             = new NGraphics();
            graphics.meshFactory = this;

            if (texture != null)
            {
                UpdateTexture(texture);
            }
        }
Esempio n. 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="texture"></param>
        public Image(NTexture texture)
        {
            _touchDisabled = true;
            graphics       = new NGraphics();

            _color = Color.White;
            if (texture != null)
            {
                UpdateTexture(texture);
            }
        }
 static public int get_blendMode(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.blendMode);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_alpha(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.alpha);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Dispose(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 16
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="texture"></param>
		public Image(NTexture texture)
			: base()
		{
			_touchDisabled = true;

			CreateGameObject("Image");
			graphics = new NGraphics(gameObject);
			graphics.shader = ShaderConfig.imageShader;
			graphics.meshFactory = this;

			if (texture != null)
				UpdateTexture(texture);
		}
 static public int set_alpha(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.alpha = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_sortingOrder(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.sortingOrder = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Alloc(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         System.Int32       a1;
         checkType(l, 2, out a1);
         self.Alloc(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_materialKeywords(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         System.String[]    v;
         checkArray(l, 2, out v);
         self.materialKeywords = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_material(IntPtr l)
 {
     try {
         FairyGUI.NGraphics   self = (FairyGUI.NGraphics)checkSelf(l);
         UnityEngine.Material v;
         checkType(l, 2, out v);
         self.material = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 22
0
        public InputCaret()
        {
            gameObject           = new GameObject("InputCaret");
            gameObject.hideFlags = HideFlags.HideInHierarchy;
            Object.DontDestroyOnLoad(gameObject);

            grahpics         = new NGraphics(gameObject);
            grahpics.texture = NTexture.Empty;
            grahpics.enabled = false;

            _size = new Vector2(1, 1);

            cachedTransform = gameObject.transform;
        }
 static public int set_cameraPosition(IntPtr l)
 {
     try {
         FairyGUI.NGraphics  self = (FairyGUI.NGraphics)checkSelf(l);
         UnityEngine.Vector3 v;
         checkValueType(l, 2, out v);
         self.cameraPosition = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_vertexMatrix(IntPtr l)
 {
     try {
         FairyGUI.NGraphics    self = (FairyGUI.NGraphics)checkSelf(l);
         UnityEngine.Matrix4x4 v;
         checkValueType(l, 2, out v);
         self.vertexMatrix = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_maskFrameId(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         System.UInt32      v;
         checkType(l, 2, out v);
         self.maskFrameId = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 26
0
        public InputCaret()
        {
            gameObject = new GameObject("InputCaret");
            gameObject.hideFlags = HideFlags.HideInHierarchy;
            Object.DontDestroyOnLoad(gameObject);

            grahpics = new NGraphics(gameObject);
            grahpics.texture = NTexture.Empty;
            grahpics.enabled = false;

            _size = new Vector2(1, 1);

            cachedTransform = gameObject.transform;
        }
 static public int UpdateMaterial(IntPtr l)
 {
     try {
         FairyGUI.NGraphics     self = (FairyGUI.NGraphics)checkSelf(l);
         FairyGUI.UpdateContext a1;
         checkType(l, 2, out a1);
         self.UpdateMaterial(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_blendMode(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         FairyGUI.BlendMode v;
         checkEnum(l, 2, out v);
         self.blendMode = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        public Highlighter()
        {
            gameObject = new GameObject("Highlighter");
            gameObject.hideFlags = HideFlags.HideInHierarchy;
            Object.DontDestroyOnLoad(gameObject);
            cachedTransform = gameObject.transform;

            grahpics = new NGraphics(gameObject);
            grahpics.texture = NTexture.Empty;
            grahpics.enabled = false;

            _color = UIConfig.inputHighlightColor;
            _rects = new List<Rect>();
        }
 static public int Tint(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         UnityEngine.Color  a1;
         checkType(l, 2, out a1);
         self.Tint(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_grayed(IntPtr l)
 {
     try {
         FairyGUI.NGraphics self = (FairyGUI.NGraphics)checkSelf(l);
         System.Boolean     v;
         checkType(l, 2, out v);
         self.grayed = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 32
0
        public Highlighter()
        {
            gameObject           = new GameObject("Highlighter");
            gameObject.hideFlags = HideFlags.HideInHierarchy;
            Object.DontDestroyOnLoad(gameObject);
            cachedTransform = gameObject.transform;

            grahpics         = new NGraphics(gameObject);
            grahpics.texture = NTexture.Empty;
            grahpics.enabled = false;

            _color = new Color(1f, 223f / 255f, 141f / 255f, 0.5f);
            _rects = new List <Rect>();
        }
Esempio n. 33
0
 static int UpdateGraphics(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.BaseFont  obj  = (FairyGUI.BaseFont)ToLua.CheckObject <FairyGUI.BaseFont>(L, 1);
         FairyGUI.NGraphics arg0 = (FairyGUI.NGraphics)ToLua.CheckObject <FairyGUI.NGraphics>(L, 2);
         obj.UpdateGraphics(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 34
0
		public TextField()
		{
			_optimizeNotTouchable = true;

			_textFormat = new TextFormat();
			_textFormat.size = 12;
			_textFormat.lineSpacing = 3;
			_strokeColor = new Color(0, 0, 0, 1);

			_wordWrap = true;
			_displayAsPassword = false;
			_maxLength = int.MaxValue;
			_text = string.Empty;

			_elements = new List<HtmlElement>(1);
			_lines = new List<LineInfo>(1);

			CreateGameObject("TextField");
			graphics = new NGraphics(gameObject);

			onFocusIn = new EventListener(this, "onFocusIn");
			onFocusOut = new EventListener(this, "onFocusOut");
			onChanged = new EventListener(this, "onChanged");
		}
Esempio n. 35
0
        void Create(NTexture texture)
        {
            _optimizeNotTouchable = true;
            _fillClockwise = true;

            CreateGameObject("Image");
            graphics = new NGraphics(gameObject);
            graphics.shader = ShaderConfig.imageShader;

            _color = Color.white;
            if (texture != null)
                UpdateTexture(texture);
        }
Esempio n. 36
0
        public TextField()
        {
            _touchDisabled = true;

            _textFormat = new TextFormat();
            _textFormat.size = 12;
            _textFormat.lineSpacing = 3;
            _strokeColor = new Color(0, 0, 0, 1);
            _fontSizeScale = 1;
            _renderScale = UIContentScaler.scaleFactor;

            _wordWrap = true;
            _text = string.Empty;

            _elements = new List<HtmlElement>(1);
            _lines = new List<LineInfo>(1);

            CreateGameObject("TextField");
            graphics = new NGraphics(gameObject);
        }
Esempio n. 37
0
 public Shape()
 {
     CreateGameObject("Shape");
     graphics = new NGraphics(gameObject);
     graphics.texture = NTexture.Empty;
 }
        public NMaterial GetMaterial(NGraphics grahpics, UpdateContext context)
        {
            frameId = UpdateContext.frameId;
            blendMode = grahpics.blendMode;
            int pool;

            if (context.clipped)
            {
                clipId = context.clipInfo.clipId;

                if (grahpics.maskFrameId == UpdateContext.frameId)
                    pool = 6;
                else if (context.rectMaskDepth == 0)
                {
                    if (grahpics.grayed)
                        pool = 1;
                    else
                        pool = 0;
                }
                else
                {
                    if (context.clipInfo.soft)
                    {
                        if (grahpics.grayed)
                            pool = 5;
                        else
                            pool = 4;
                    }
                    else
                    {
                        if (grahpics.grayed)
                            pool = 3;
                        else
                            pool = 2;
                    }
                }
            }
            else
            {
                clipId = 0;
                if (grahpics.grayed)
                    pool = 1;
                else
                    pool = 0;
            }
            return _pools[pool].Get();
        }
Esempio n. 39
0
        /// <summary>
        /// 进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。
        /// 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。
        /// 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。
        /// </summary>
        /// <param name="requestId">请求者id</param>
        /// <param name="margin">纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。</param>
        public void EnterPaintingMode(int requestorId, Margin? margin)
        {
            bool first = _paintingMode == 0;
            _paintingMode |= requestorId;
            if (first)
            {
                if (paintingGraphics == null)
                {
                    if (graphics == null)
                        paintingGraphics = new NGraphics(this.gameObject);
                    else
                    {
                        GameObject go = new GameObject(this.gameObject.name + " (Painter)");
                        go.layer = this.gameObject.layer;
                        ToolSet.SetParent(go.transform, cachedTransform);
                        go.hideFlags = DisplayOptions.hideFlags;
                        paintingGraphics = new NGraphics(go);
                    }
                }
                else
                    paintingGraphics.enabled = true;
                paintingGraphics.vertexMatrix = null;

                if (this is Container)
                {
                    ((Container)this).SetChildrenLayer(CaptureCamera.hiddenLayer);
                    ((Container)this).UpdateBatchingFlags();
                }
                else
                    this.InvalidateBatchingState();

                if (graphics != null)
                    this.gameObject.layer = CaptureCamera.hiddenLayer;

                _paintingMargin = new Margin();
            }
            if (margin != null)
                _paintingMargin = (Margin)margin;
            _paintingFlag = 1;
        }