123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- var t = require;
- var e = module;
- var s = exports;
- var o =
- (this && this.__awaiter) ||
- function (t, n, r, l) {
- return new (r = r || Promise)(function (i, e) {
- function s(t) {
- try {
- a(l.next(t));
- } catch (t) {
- e(t);
- }
- }
- function o(t) {
- try {
- a(l.throw(t));
- } catch (t) {
- e(t);
- }
- }
- function a(t) {
- var e;
- t.done
- ? i(t.value)
- : ((e = t.value) instanceof r
- ? e
- : new r(function (t) {
- t(e);
- })
- ).then(s, o);
- }
- a((l = l.apply(t, n || [])).next());
- });
- };
- Object.defineProperty(s, "__esModule", {value: !0}), (s.CsvDataList = s.CsvDataMap = s.CONFIG_FILE_DIR = void 0);
- const a = t("App");
- (s.CONFIG_FILE_DIR = ""),
- (s.default = class {
- constructor(t, e, i) {
- (this._class = t), (this.csvFileName = e), (this.indexKey = i), (this.datas = {}), (this.dataCnt = 0);
- }
- loadFile(i) {
- return o(this, void 0, void 0, function* () {
- try {
- var t = yield a.default.ResManager.loadInBundle("config", s.CONFIG_FILE_DIR + i, cc.TextAsset),
- e = t.text;
- cc.assetManager.releaseAsset(t);
- } catch (t) {
- Log.error("加载配置文件出错:", i, t);
- }
- return e.replace(/\r\n/g, "\n");
- });
- }
- load() {
- return o(this, void 0, void 0, function* () {
- let s = (yield this.loadFile(this.csvFileName)).split(/\n/),
- o = s[0].split(","),
- a = (s[1].split(","), s[2].split(",")),
- t = s.length;
- for (let i = 3; i < t; i++)
- if (s[i]) {
- let t = s[i].split(","),
- e = this.datas[t[0]];
- e || ((e = new this._class()), (this.datas[t[0]] = e), this.dataCnt++), e.$parseData(t, o, a);
- }
- });
- }
- getAllDatas() {
- return this.datas;
- }
- getData(t) {
- t = this.datas[t];
- return null == t ? null : t;
- }
- }),
- (s.CsvDataMap = class {
- constructor(t, e = 1) {
- (this._class = t), (this.keyIndex = e), (this.datas = {}), (this.id = null), (this.dataCnt = 0);
- }
- $parseData(t, e, i) {
- let s = this.datas[t[this.keyIndex]];
- s || ((s = new this._class()), (this.datas[t[this.keyIndex]] = s), this.dataCnt++), s.$parseData(t, e, i);
- }
- createAwardLevel() {}
- getData(t) {
- return this.datas[t];
- }
- getAllData() {
- return this.datas;
- }
- getCount() {
- return this.dataCnt;
- }
- }),
- (s.CsvDataList = class {
- constructor(t) {
- (this._class = t), (this.awardLevel = []), (this.datas = []), (this.id = null), (this.dataCnt = 0);
- }
- $parseData(t, e, i) {
- let s = new this._class();
- s.$parseData(t, e, i), this.datas.push(s), (this.dataCnt = this.datas.length);
- }
- createAwardLevel() {}
- getData(t) {
- return this.datas[t];
- }
- getAllData() {
- return this.datas;
- }
- getCount() {
- return this.dataCnt;
- }
- });
|