public Menu() : base(128, 240) { // 设定menu层级高于MapLayer SetLayer(101); // 不锁定menu移动 SetLocked(false); SetLimitMove(false); // 锁定Actor拖拽 SetActorDrag(false); SetDelay(500); // 设定Menu背景 LImage image = LImage.CreateImage(this.GetWidth(), this.GetHeight(), true); LGraphics g = image.GetLGraphics(); g.SetColor(0, 0, 0, 125); g.FillRect(0, 0, GetWidth(), GetHeight()); g.SetColor(LColor.white); g.SetFont(15); g.DrawString("我是可拖拽菜单", 12, 25); g.Dispose(); SetBackground(image.GetTexture()); BulletTurret bulletTurret = new BulletTurret(); bulletTurret.SetLocation(18, 64); BombTurret bombTurret = new BombTurret(); bombTurret.SetLocation(78, 64); PoisonTurret poisonTurret = new PoisonTurret(); poisonTurret.SetLocation(18, 134); LaserTurret laserTurret = new LaserTurret(); laserTurret.SetLocation(78, 134); Button button = new Button(); button.SetLocation(27, 196); // 复合LPaper到Layer Add(bulletTurret); Add(bombTurret); Add(poisonTurret); Add(laserTurret); Add(button); }