コード例 #1
0
ファイル: Actor.cs プロジェクト: zx8326123/LGame
        /// <summary>
        /// 矫正当前图像大小
        /// </summary>
        ///
        private void CalcBounds()
        {
            ActorLayer layer = this.GetLLayer();

            if (layer != null)
            {
                int width;
                int height;
                int cellSize = layer.GetCellSize();
                int minY     = 0;
                if (this.image == null)
                {
                    width             = location.X() * cellSize + cellSize;
                    height            = location.Y() * cellSize + cellSize;
                    this.boundingRect = new RectBox(width, height, 0, 0);
                    for (minY = 0; minY < 4; ++minY)
                    {
                        this.xs[minY] = width;
                        this.ys[minY] = height;
                    }
                }
                else
                {
                    this.boundingRect = MathUtils.GetBounds(location.x,
                                                            location.y, this.image.GetWidth(),
                                                            this.image.GetHeight(), rotation);
                }
            }
        }
コード例 #2
0
ファイル: Actor.cs プロジェクト: zx8326123/LGame
 internal void AddLayer(float x, float y, ActorLayer g)
 {
     if (g.IsBounded())
     {
         x = this.LimitValue(x, g.GetWidth() - GetWidth());
         y = this.LimitValue(y, g.GetHeight() - GetHeight());
     }
     this.boundingRect = null;
     this.SetLayer(g);
     this.SetLocation(x, y);
 }
コード例 #3
0
ファイル: Actor.cs プロジェクト: zx8326123/LGame
 protected internal virtual void AddLayer(ActorLayer g)
 {
 }
コード例 #4
0
ファイル: Actor.cs プロジェクト: zx8326123/LGame
 internal void SetLayer(ActorLayer g)
 {
     this.gameLayer = g;
 }
コード例 #5
0
ファイル: Actor.cs プロジェクト: keppelcao/LGame
 internal void SetLayer(ActorLayer g)
 {
     this.gameLayer = g;
 }
コード例 #6
0
ファイル: Actor.cs プロジェクト: keppelcao/LGame
 internal void AddLayer(float x, float y, ActorLayer g)
 {
     if (g.IsBounded())
     {
         x = this.LimitValue(x, g.GetWidth() - GetWidth());
         y = this.LimitValue(y, g.GetHeight() - GetHeight());
     }
     this.boundingRect = null;
     this.SetLayer(g);
     this.SetLocation(x, y);
 }
コード例 #7
0
ファイル: Actor.cs プロジェクト: keppelcao/LGame
 protected internal virtual void AddLayer(ActorLayer g)
 {
 }
コード例 #8
0
ファイル: TDScreen.cs プロジェクト: keppelcao/LGame
 protected override void AddLayer(ActorLayer layer)
 {
     this.x = this.GetX();
     this.y = this.GetY();
 }
コード例 #9
0
ファイル: TDScreen.cs プロジェクト: keppelcao/LGame
            // 首次注入Layer时调用此函数
            protected override void AddLayer(ActorLayer layer)
            {

                // 坐标矫正,用以让角色居于瓦片中心
                int offsetX = (GetLLayer().GetField2D().GetTileWidth() - this
                       .GetWidth()) / 2;
                int offsetY = (GetLLayer().GetField2D().GetTileWidth() - this
                       .GetHeight()) / 2;
                // 初始化角色在Layer中坐标
                SetLocation(startX + offsetX, startY + offsetY);
                // 命令角色向指定坐标自行移动(参数为false为四方向寻径,为true时八方向),并返回移动控制器
                // PS:endX与endY非显示位置,所以不必矫正
                MoveTo move = MoveTo(endX, endY, false);

                // 矫正坐标,让角色居中
                move.SetOffset(offsetX, offsetY);
                // 启动角色事件监听
                move.SetActionListener(new MoveAction(move, layer));
                // 设定移动速度
                move.SetSpeed(speed);
            }
コード例 #10
0
ファイル: TDScreen.cs プロジェクト: keppelcao/LGame
 public MoveAction(MoveTo move, ActorLayer layer)
 {
     this.move = move;
     this.layer = layer;
 }
コード例 #11
0
ファイル: TDScreen.cs プロジェクト: keppelcao/LGame
 protected override void AddLayer(ActorLayer layer)
 {
     // 让角色渐进式出现
     FadeTo fade = FadeOut();
     fade.SetActionListener(new RotationAction());
 }