Beispiel #1
0
        public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            if (this.Error)
            {
                return;
            }
            ASprite img = cImage;

            if (isSelecting && cImageB != null)
            {
                img = cImageB;
            }

            if (img != null && img.IsCreated)
            {
                Rectangle rect = destRect;
                //PointX微調整
                rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
                rect.Y = destRect.Y + pointY;
                img.GraphicsDraw(graph, rect);
            }
            else
            {
                if (mode == TextDrawingMode.GRAPHICS)
                {
                    graph.DrawString(AltText, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
                }
                else
                {
                    System.Windows.Forms.TextRenderer.DrawText(graph, AltText, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
                }
            }
        }
Beispiel #2
0
 public CallbackInfo(ASprite src, object obj,
                     Action <object, SpriteInfo> callback)
 {
     this.src      = src;
     this.obj      = obj;
     this.callback = callback;
 }
Beispiel #3
0
    public static void GetSprite(ASprite src,
                                 object obj, Action <object, SpriteInfo> callback)
    {
        var         basename = src.Bitmap.filename;
        TextureInfo ti       = null;

        texture_dict.TryGetValue(basename, out ti);
        if (ti == null)
        {
            var item = new CallbackInfo(src, obj, callback);
            List <CallbackInfo> list = null;
            if (loading_set.TryGetValue(basename, out list))
            {
                list.Add(item);
            }
            else
            {
                list = new List <CallbackInfo> {
                    item
                };
                loading_set.Add(basename, list);
                GenericUtils.StartCoroutine(Loading(src.Bitmap));
            }
        }
        else
        {
            callback(obj, GetSpriteInfo(ti, src));
        }
    }
Beispiel #4
0
        internal SpriteInfo GetSprite(ASprite src)
        {
            SpriteInfo sprite = null;

            if (!sprites.TryGetValue(src.Name, out sprite))
            {
                sprite = new SpriteInfo(this,
                                        Sprite.Create(texture,
                                                      GenericUtils.ToUnityRect(src.Rectangle, texture.width, texture.height),
                                                      Vector2.zero)
                                        );
                sprites[src.Name] = sprite;
            }
            if (sprite != null)
            {
                refcount += 1;
            }
            return(sprite);
        }
Beispiel #5
0
 static SpriteInfo GetSpriteInfo(TextureInfo textinfo, ASprite src)
 {
     return(textinfo.GetSprite(src));
 }
Beispiel #6
0
 public void Load(ASprite src)
 {
     SpriteManager.GetSprite(src, this, ImageInfo.OnLoadImageCallback);
 }