This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-01-19 02:42:37 +08:00
parent bc2ddf1fcd
commit ed4e094536
36 changed files with 3752 additions and 123 deletions

View File

@@ -2,6 +2,7 @@ import { app } from "../App";
import GBattleData, { GBattleDataInfo } from "../battle/base/values/GAttributeData";
import { API } from "../consts/API";
import { GAPI, ModeOnHookOV } from "../consts/GAPI";
import GOnHookManager from "../manager/battle/mode/GOnHookManager";
import { GUI } from "../ui/UIConfig";
import BaseData from "./BaseData";
@@ -17,7 +18,7 @@ export default class GOnHookData extends BaseData{
//是否允许下一关
get isNextLevel(){
if(!this.info) return false;
return this.info.hookInfo.mapStates[this.info.onHookMap] == 1;
return this.info.hookInfo.mapStates[this.info.onHookMap] >= 4;
}
async onInit() {
@@ -35,21 +36,25 @@ export default class GOnHookData extends BaseData{
//切换地图
async setMap(mapId:number){
this.info = await GAPI.GOnHookSetMap(mapId);
this.info = await GAPI.GOnHookSetMap(mapId,GOnHookManager.getIns().getKillSreepsIds());
app.layer.Open(GUI.Tips,{text:"切换地图成功"});
}
//下一关
async onNextLevel(){
let info = await GAPI.GOnHookNextLevel();
if(info) this.onUpdateInfo(info);
return !!info;
let info = await GAPI.GOnHookNextLevel(GOnHookManager.getIns().getKillSreepsIds());
this.onUpdateInfo(info);
}
//战胜当前关卡
async onWinLevel(){
this.onUpdateInfo(await GAPI.GOnHookWinLevel());
this.onUpdateInfo(await GAPI.GOnHookWinLevel())
}
//返回当前进度
getProgress(){
return this.info.hookInfo.mapStates[this.info.onHookMap] || 0
}
}

View File

@@ -52,6 +52,11 @@ export default class ResourceData extends BaseData{
}
//获取所有资源Id
getIds():number[]{
return Object.keys(this.data).map(id => parseInt(id));
}
//获取指定资源的数量
getValue(type:ResourceType){
return this.data[type] || 0;