Update() public method

public Update ( ) : void
return void
Ejemplo n.º 1
0
    protected virtual void Update()
    {
        if (_texture.NeedsRedraw)
        {
            if (_texture.Update() == false)
            {
                return;
            }
            UpdateMesh();
            _material.mainTexture = Texture;
        }

        if (_texture.IsUpdated == false)
        {
            return;
        }

        if ((_fontColor != _lastFontColor) && (_material != null))
        {
            _material.color = _fontColor;
            _lastFontColor  = _fontColor;
        }

        if (_lastPivot != _pivot)
        {
            UpdatePivot();
        }
    }
Ejemplo n.º 2
0
 public override bool OnUpdate()
 {
     if (_texture.NeedsRedraw)
     {
         _texture.Update();
         _uv = new Vector2(_texture.TextWidthPixels /
                           (float)_texture.WidthPixels, _texture.TextHeightPixels /
                           (float)_texture.HeightPixels);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
    public override void Update()
    {
        base.Update();

        if (_texture.NeedsRedraw)
        {
            if (_texture.Update() == false)
            {
                return;
            }

            _uv = new Vector2(_texture.TextWidthPixels /
                              (float)_texture.WidthPixels, _texture.TextHeightPixels /
                              (float)_texture.HeightPixels);
        }
    }
Ejemplo n.º 4
0
        public TTFTextTexturePortion ComputeGlyphBitmap(object parameters, object font, char c)
        {
            SysFontTexture tex = new SysFontTexture();
            FontSelector   fs  = (FontSelector)GetFontSelectorFromFontName((string)font);

            tex.AndroidFontName = fs.AndroidFontName;
            tex.AppleFontName   = fs.AppleFontName;
            tex.Update();

            Texture2D _texture = new Texture2D(1, 1, TextureFormat.Alpha8, false);

            //Texture2D _texture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
            _texture.hideFlags  = HideFlags.HideInInspector | HideFlags.DontSave;
            _texture.filterMode = FilterMode.Point;
            _texture.wrapMode   = TextureWrapMode.Clamp;
            int textureID = _texture.GetNativeTextureID();

            SysFont.QueueTexture("" + c,
#if UNITY_ANDROID
                                 fs.AndroidFontName
#else
#if UNITY_IPHONE
                                 fs.AppleFontName
#else
                                     ((string)font)
#endif
#endif
                                 ,
                                 12,
                                 false,                  //_isBold,
                                 false,                  //_isItalic,
                                 SysFont.Alignment.Left, //_alignment,
                                 false,
                                 2048,
                                 2048,
                                 textureID
                                 );

            int _textWidthPixels  = SysFont.GetTextWidth(textureID);
            int _textHeightPixels = SysFont.GetTextHeight(textureID);



            SysFont.UpdateQueuedTexture(textureID);
            Debug.Log(".");

            Parameters cp = parameters as Parameters;
            Material   m  = null;
            if (cp != null)
            {
                Shader shader = Shader.Find(cp.shaderName);
                if (shader == null)
                {
                    shader = Shader.Find("Mobile/Diffuse");
                }
                if (shader == null)
                {
                    shader = Shader.Find("Diffuse");
                }
                m             = new Material(shader);
                m.color       = new Color(cp.red, cp.green, cp.blue, cp.alpha);
                m.mainTexture = _texture;
            }
            else
            {
                Shader shader = Shader.Find("SysFont/Unlit Transparent");
                if (shader == null)
                {
                    shader = Shader.Find("Mobile/Diffuse");
                }
                if (shader == null)
                {
                    shader = Shader.Find("Diffuse");
                }
                m             = new Material(shader);
                m.color       = Color.black;
                m.mainTexture = _texture;
            }

            TTFTextTexturePortion p = new TTFTextTexturePortion(
                m,
                0, 0, 1, 1,
                _textWidthPixels * cp.scale, _textHeightPixels * cp.scale,
                0, 0,
                true
                );

            return(p);
        }
Ejemplo n.º 5
0
        public TTFTextTexturePortion ComputeGlyphBitmap(object parameters, object font, char c)
        {
            SysFontTexture tex=new SysFontTexture();
            FontSelector fs=(FontSelector)GetFontSelectorFromFontName((string) font);
            tex.AndroidFontName=fs.AndroidFontName;
            tex.AppleFontName=fs.AppleFontName;
            tex.Update();

              Texture2D _texture = new Texture2D(1, 1, TextureFormat.Alpha8, false);
              //Texture2D _texture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
              _texture.hideFlags = HideFlags.HideInInspector | HideFlags.DontSave;
              _texture.filterMode = FilterMode.Point;
              _texture.wrapMode = TextureWrapMode.Clamp;
               	 int textureID = _texture.GetNativeTextureID();

            SysFont.QueueTexture(""+c,
            #if UNITY_ANDROID
            fs.AndroidFontName
            #else
            #if UNITY_IPHONE
            fs.AppleFontName
            #else
            ((string)font)
            #endif
            #endif
            ,
            12,
            false,//_isBold,
            false,//_isItalic,
            SysFont.Alignment.Left,//_alignment,
            false,
            2048,
              		2048,
            textureID
            );

            int _textWidthPixels  = SysFont.GetTextWidth(textureID);
            int _textHeightPixels = SysFont.GetTextHeight(textureID);

            SysFont.UpdateQueuedTexture(textureID);
            Debug.Log(".");

            Parameters cp =parameters as Parameters;
            Material m=null;
            if (cp!=null) {
              Shader shader=Shader.Find(cp.shaderName);
              if (shader==null) {shader=Shader.Find("Mobile/Diffuse");}
             	  if (shader==null) {shader=Shader.Find("Diffuse");}
              m=new Material(shader);
              m.color=new Color(cp.red,cp.green,cp.blue,cp.alpha);
              m.mainTexture=_texture;
            }
            else {
              Shader shader=Shader.Find("SysFont/Unlit Transparent");
              if (shader==null) {shader=Shader.Find("Mobile/Diffuse");}
             	  if (shader==null) {shader=Shader.Find("Diffuse");}
              m=new Material(shader);
              m.color=Color.black;
              m.mainTexture=_texture;
            }

            TTFTextTexturePortion p=new TTFTextTexturePortion(
            m,
            0,0,1,1,
            _textWidthPixels * cp.scale,_textHeightPixels *cp.scale,
            0,0,
            true
            );

            return p;
        }