2023-12-03 03:31:19 +08:00
|
|
|
import { _decorator } from "cc";
|
|
|
|
import GBaseMode from "../../GBaseMode";
|
|
|
|
import { GMapLoop } from "../../base/common/map/GMapLoop";
|
|
|
|
import { TD, app } from "../../../App";
|
2023-12-13 19:33:57 +08:00
|
|
|
import { TB } from "../../../config/data/schema";
|
2023-12-03 03:31:19 +08:00
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
|
|
export default class GDefaultMode<T,DT> extends GBaseMode<T,DT>{
|
|
|
|
|
|
|
|
//场景地图
|
|
|
|
@property(GMapLoop)
|
|
|
|
map1:GMapLoop;
|
|
|
|
@property(GMapLoop)
|
|
|
|
map2:GMapLoop;
|
|
|
|
@property(GMapLoop)
|
|
|
|
map3:GMapLoop;
|
|
|
|
|
|
|
|
//地图信息
|
|
|
|
mapInfo:TB.TbGMap;
|
|
|
|
|
|
|
|
//设置世界地图
|
|
|
|
setWorldMap(mapId:number = 60001){
|
|
|
|
|
|
|
|
//初始化地图
|
|
|
|
this.mapInfo = TD.TbGMap.get(mapId);
|
|
|
|
|
|
|
|
let scale = this.mapInfo.scale;
|
2023-12-07 02:14:18 +08:00
|
|
|
this.map1.init(app.battleRes.getMap(mapId)[0],1,app.battleRes.getMap(mapId)[0].width * scale,app.battleRes.getMap(mapId)[0].height * scale);
|
|
|
|
this.map2.init(app.battleRes.getMap(mapId)[1],1,app.battleRes.getMap(mapId)[1].width * scale,app.battleRes.getMap(mapId)[1].height * scale);
|
2024-01-20 19:01:45 +08:00
|
|
|
this.map3.init(app.battleRes.getMap(mapId)[2],1,app.battleRes.getMap(mapId)[1].width * scale,1280 * scale);
|
2023-12-03 03:31:19 +08:00
|
|
|
|
|
|
|
//更新地图
|
|
|
|
this.onUpdateMap(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//更新地图
|
|
|
|
onUpdateMap(dt){
|
|
|
|
let cameraX = this.camera.node.worldPosition.x;
|
|
|
|
this.map1.UpdateMap(cameraX,0,this.mapInfo.map1OffsetY);
|
|
|
|
this.map2.UpdateMap(cameraX,cameraX / 10,this.mapInfo.map2OffsetY);
|
|
|
|
this.map3.UpdateMap(cameraX,0,this.mapInfo.map3OffsetY);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|