体力:添加购买体力功能

This commit is contained in:
luying
2021-06-28 15:40:01 +08:00
parent 29eb2e239c
commit 621bf3d82a
7 changed files with 158 additions and 23 deletions

View File

@@ -86,6 +86,7 @@ import { dicActivityType, loadActivityType } from './dictionary/DicActivityType'
import { dicTaskTypeDesc, loadTaskType } from './dictionary/DicTaskType';
import { dicServerName, dicServerGroupName, loadServerName } from "./dictionary/DicServerName";
import { dicAp, loadAp, dicApMaxLevel } from './dictionary/DicAp';
import { dicApBuy, dicApMaxBuyTimes, loadApBuy } from "./dictionary/DicApBuy";
export const gameData = {
blurprtCompose: dicBlueprtCompose,
@@ -210,7 +211,9 @@ export const gameData = {
serverNames: dicServerName,
serverGroupNames: dicServerGroupName,
ap: dicAp,
apMaxLevel: dicApMaxLevel
apMaxLevel: dicApMaxLevel,
apBuy: dicApBuy,
apMaxBuyTimes: dicApMaxBuyTimes
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据
@@ -811,6 +814,7 @@ function loadDatas() {
loadTaskType();
loadServerName();
loadAp();
loadApBuy();
}
// 重载dicParam

View File

@@ -0,0 +1,22 @@
import { readFileAndParse, parseGoodStr } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicApBuy {
// 购买次数
readonly times: number;
// 消耗
readonly cost: RewardInter[];
}
export const dicApMaxBuyTimes = { max: 0 };
export const dicApBuy = new Map<number, RewardInter[]>();
export function loadApBuy() {
let arr = readFileAndParse(FILENAME.DIC_AP_BUY_COST);
arr.forEach(o => {
o.cost = parseGoodStr(o.cost);
dicApBuy.set(o.times, o.cost);
if(o.times > dicApMaxBuyTimes.max) dicApMaxBuyTimes.max = o.times;
});
arr = undefined;
}