@cc-component/cc-pathfinding 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,8 @@ import { Mapitem } from './Mapitem';
7
7
  import { instantiate } from 'cc';
8
8
  import { Cell, GridMap } from './GridMap';
9
9
  import { AStarPathfinder } from './AStarPathfinder';
10
- const { ccclass, property } = _decorator;
10
+ import { CCInteger } from 'cc';
11
+ const { ccclass, property, menu } = _decorator;
11
12
 
12
13
  /**
13
14
  * 地图格子视图层
@@ -22,18 +23,19 @@ const { ccclass, property } = _decorator;
22
23
  * - AStarPathfinder A* 寻路算法 / 攻击位查找
23
24
  */
24
25
  @ccclass('MapBoxView')
26
+ @menu("寻路组件/MapBoxView")
25
27
  export class MapBoxView extends Component {
26
28
 
27
29
  // ==================== 1. 编辑器属性 ====================
28
30
 
29
31
  @property({ type: Mapitem })
30
32
  mapItem: Mapitem;
31
- @property()
32
- row = 6;
33
- @property()
33
+ @property({ type: CCInteger })
34
+ row: number = 6;
35
+ @property({ type: CCInteger })
34
36
  col = 6;
35
37
  @property({ displayName: "顶部偏移位置" })
36
- topStart = 50
38
+ topStart = 0
37
39
  /** 六方向模式:开启后按蜂窝规则(左上/左/左下/右上/右/右下)移动、寻路、判包围 */
38
40
  @property({ tooltip: '开启后按蜂窝(六方向)规则寻路:左上/左/左下/右上/右/右下' })
39
41
  useSixDirection = true
@@ -74,7 +76,7 @@ export class MapBoxView extends Component {
74
76
  const space_x = this.item_width / 2;
75
77
  const space_y = this.item_height / 2;
76
78
 
77
- const padding_left = this.item_height / 2
79
+ const padding_left = this.item_width / 2
78
80
  let top = 0
79
81
 
80
82
  for (let i = 0; i < this.row; i++) {
@@ -95,6 +97,8 @@ export class MapBoxView extends Component {
95
97
  this.item_width * j + space_x + (i % 2 === 1 ? (this.useSixDirection ? padding_left : 0) : 0) - start_x,
96
98
  -(this.item_height * i + space_y - (this.useSixDirection ? top : 0)) + start_y,
97
99
  0);
100
+
101
+
98
102
  model.position = this.content_tf.convertToWorldSpaceAR(pos);
99
103
  model.bottom_positon = v3(model.position.x, model.position.y - this.item_height / 2, 0);
100
104
 
@@ -1,8 +1,8 @@
1
1
  import { Sprite } from 'cc';
2
2
  import { _decorator, Component, Node } from 'cc';
3
- const { ccclass, property } = _decorator;
4
-
3
+ const { ccclass, property, menu } = _decorator;
5
4
  @ccclass('Mapitem')
5
+ @menu("寻路组件/Mapitem")
6
6
  export class Mapitem extends Component {
7
7
  @property({ type: Sprite, displayName: '背景' })
8
8
  bg: Sprite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-pathfinding",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",