File size: 967 Bytes
4ee4376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import * as CONST from '../../constants';
import layer from './layer';

export default class edge extends layer {
  constructor (options) {
    options.type = CONST.T_EDGE;
    super(options);
  }


  hide (type) {
    this.visible = false;

    this.list.forEach((tile) => {
      tile.hide(type);
    });

    this.events.emit(CONST.E_MAP_LAYER_HIDE, this.type);
  }


  show (type) {
    this.visible = true;

    this.list.forEach((tile) => {
      tile.show(type);
    });

    this.events.emit(CONST.E_MAP_LAYER_SHOW, this.type);
  }


  onHide (type) {
    if (type == CONST.T_WATER)     this.hide(CONST.TERRAIN_WATER);
    if (type == CONST.T_TERRAIN)   this.hide(CONST.TERRAIN_BEDROCK);
    if (type == CONST.T_HEIGHTMAP) this.show(false);
  }


  onShow (type) {
    if (type == CONST.T_WATER)     this.show(CONST.TERRAIN_WATER);
    if (type == CONST.T_TERRAIN)   this.show(CONST.TERRAIN_BEDROCK);
    if (type == CONST.T_HEIGHTMAP) this.hide(false);
  }
}