first commit
This commit is contained in:
38
assets/scripts/map/ui/RightCityItemLogic.ts
Normal file
38
assets/scripts/map/ui/RightCityItemLogic.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { _decorator, Component, Label } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
import { MapCityData } from "../MapCityProxy";
|
||||
import { EventMgr } from '../../utils/EventMgr';
|
||||
|
||||
@ccclass('RightCityItemLogic')
|
||||
export default class RightCityItemLogic extends Component {
|
||||
@property(Label)
|
||||
labelInfo: Label = null;
|
||||
@property(Label)
|
||||
labelPos: Label = null;
|
||||
|
||||
protected _data: MapCityData = null;
|
||||
|
||||
|
||||
protected onLoad(): void {
|
||||
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
this._data = null;
|
||||
}
|
||||
|
||||
protected onClickBg(): void {
|
||||
if (this._data) {
|
||||
EventMgr.emit("scroll_to_map", this._data.x, this._data.y);
|
||||
}
|
||||
}
|
||||
|
||||
public setArmyData(data: MapCityData): void {
|
||||
this._data = data;
|
||||
if (this._data) {
|
||||
this.labelInfo.string = this._data.name;
|
||||
this.labelPos.string = "(" + this._data.x + ", " + this._data.y + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user