AVG.ts
1.48 KB
import { init, PlotManager } from "simba-avg-core";
import { ActionManager } from "simba-avg-core/dist/ActionManager";
import { GameRecordBase, GameRecordType } from "simba-avg-core/dist/game-data/GameRecord";
import { richNodesToCocosString, richNodeTextCount } from "simba-avg-core/dist/utils/RichTextUtils";
import { SDK } from "simba-sdk";
import { GameConfig } from "../GameConfig";
import {
defaultGlobalVariables, defaultRecordVariables,
globalVariableConstrains, GlobalVariableType,
recordVariableConstrains, RecordVariableType
} from "./game-data/GameVariables";
async function retrieveRecord() {
return SDK.getGameRecord();
}
async function saveRecord(record: Object) {
SDK.uploadGameRecord(record);
}
export function initAVG() {
const USE_CDN_PLOTS: boolean = false;
return init(GameConfig.gameId, "", {
cdnUrl: USE_CDN_PLOTS ? GameConfig.cdnUrl : "", defaultGlobalVariables, defaultRecordVariables,
globalVariableConstrains, recordVariableConstrains, retrieveRecord, saveRecord
})
}
let GameRecord = GameRecordBase as GameRecordType<GlobalVariableType, RecordVariableType>
export * from "simba-avg-core/dist/game-data/PlotsData";
export * from "simba-avg-core/dist/model/ActionModel";
export * from "simba-avg-core/dist/model/ConditionModel";
export * from "simba-avg-core/dist/model/PlotModel";
export * from "simba-avg-core/dist/model/RichTextModel";
export { PlotManager, GameRecord, ActionManager, richNodesToCocosString, richNodeTextCount };