42c85499-9646-4188-ae28-8b03e19af186.js
12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
"use strict";
cc._RF.push(module, '42c85SZlkZBiK4oiwPhmvGG', 'GameDotMgr');
// script/game/GameDotMgr.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const simba_sdk_1 = require("simba-sdk");
const EditorEnums_1 = require("../avg/EditorEnums");
const AVG_1 = require("../avg/AVG");
const simba_config_manager_1 = require("simba-config-manager");
const Role_1 = require("../config/Role");
const GameConfig_1 = require("../GameConfig");
const Enums_1 = require("./Enums");
const GameModelManager_1 = require("./model/GameModelManager");
let GameDotMgr = /** @class */ (() => {
class GameDotMgr {
constructor() {
this._majorIds = [];
}
static getInstance() {
return GameDotMgr._instance;
}
async dot(eventKey, data, category) {
// if (channel === "dummy") return;
// category = category ? category : "yybs_event";
// let baseElements = this.getBaseElements();
// let biRet = await SDK.bi(category, eventKey, baseElements, data);
}
getBaseElements() {
let regV = AVG_1.GameRecord.globalVariables["register_version"];
if (!regV) {
regV = GameConfig_1.GameConfig.gameVersion;
AVG_1.GameRecord.globalVariables["register_version"] = regV;
AVG_1.GameRecord.saveRecord();
}
let player = GameModelManager_1.GameModelManager.getPlayerData();
let base = {
energy: player.getEnergy(),
gold: player.getGoldCoin(),
silver: player.getClothCoin(),
grace: [],
user_register_version: regV,
login_duration: simba_sdk_1.TimeManager.getGameTime(),
total_duration: simba_sdk_1.TimeManager.getTotalGameTime(),
daily_duration: simba_sdk_1.TimeManager.getTodayGameTime(),
};
let gArr = [];
if (!this._majorIds || 0 === this._majorIds.length) {
let r = simba_config_manager_1.ConfigManager.getAllConfig(Role_1.role);
for (let id in r) {
let c = r[id];
if (c && c.RoleType === EditorEnums_1.RoleType.Role_Major) {
this._majorIds.push(c.id);
}
}
}
for (let i = 0; i < this._majorIds.length; i++) {
let rid = this._majorIds[i];
let role = GameModelManager_1.GameModelManager.getRoleData(rid);
let gv = role === null || role === void 0 ? void 0 : role.getRoleLike();
gv = gv ? gv : 0;
let item = {
roleId: rid,
grace: gv
};
gArr.push(item);
}
base.grace = gArr;
return base;
}
async dotClickUI(uiName) {
let eventKey = "click_ui";
let recordKey = "click_ui_count_" + uiName + "_t_" + GameModelManager_1.GameModelManager.getCurDayStr();
let clickCount = AVG_1.GameRecord.globalVariables[recordKey];
if (undefined === clickCount) {
clickCount = 0;
}
clickCount += 1;
AVG_1.GameRecord.globalVariables[recordKey] = clickCount;
AVG_1.GameRecord.saveRecord();
// console.log("dotClickUI = ", { click_ui: clickCount, ui_location: uiName });
await this.dot(eventKey, { click_ui: clickCount, ui_location: uiName }, "click_ui");
}
async dotLoading(state) {
let eventKey = "loading";
await this.dot(eventKey, { loading: state }, "loading");
}
/**
*
* @param playerId 玩家的PlayerId
* @param gameConstData 兑换码兑换的道具ID
*/
async dotExchangeCodeSuccess(playerId, gameConstData) {
let eventKey = "exchange_code_success";
await this.dot(eventKey, { exchange_code_success: playerId, gameConstData: gameConstData }, "exchange_code_success");
}
async dotCost(cType, cNum) {
// let eventKey = "cost";
// let recordKey = cType + GameModelManager.getCurDayStr();
// let count = GameRecord.globalVariables[recordKey] as number;
// if (undefined === count) {
// count = 0;
// }
// count = count + cNum;
// GameRecord.globalVariables[recordKey] = count;
// GameRecord.saveRecord();
// let data = {};
// data[cType] = count;
// // console.log("dotCost = ", data);
// await this.dot(eventKey, data, "cost");
}
async dotPlot(session, state) {
let eventKey = "plot";
let v = session + "_" + state;
// console.log("dotPlot = ", { plot_state: v });
await this.dot(eventKey, { plot_state: v }, "plot");
}
async dotExposure(eType) {
// let eventKey = "show";
// // console.log("dotExposure = ", { show: eType });
// await this.dot(eventKey, { show: eType }, "show");
}
async dotShop(sType, param) {
// let eventKey = "shop";
// let data = {};
// switch (sType) {
// case DotShopType.LuckyDraw:
// {
// data[sType] = param.location;
// }
// break;
// case DotShopType.Clothes:
// {
// if (param.isWear) {
// data[sType] = "wear_" + param.sid + "_" + param.rid;
// } else {
// data[sType] = "have_" + param.sid + "_" + param.rid;
// }
// }
// break;
// }
// // console.log("dotShop = ", data);
// await this.dot(eventKey, data, "shop");
}
async dotShopTotal(sType, param) {
// let eventKey = "shop_total";
// let data = {};
// switch (sType) {
// case DotShopTotalType.ShowGift:
// {
// let rKey = "g_i_t_show_c" + GameModelManager.getCurDayStr();;
// let total = GameRecord.globalVariables[rKey] as number;
// total = total ? total : 0;
// total++;
// data[sType] = {
// show_id: "show_item_" + param.id,
// total_show: total
// }
// GameRecord.globalVariables[rKey] = total;
// }
// break;
// case DotShopTotalType.BuyItem:
// {
// let rKey = "g_i_t_buy_c" + GameModelManager.getCurDayStr();;
// let total = GameRecord.globalVariables[rKey] as number;
// total = total ? total : 0;
// total++;
// data[sType] = {
// buy_id: "buy_" + param.id,
// total_buy: total
// }
// GameRecord.globalVariables[rKey] = total;
// }
// break;
// case DotShopTotalType.SendGift:
// {
// let rKey = "g_i_t_send_c" + GameModelManager.getCurDayStr();;
// let total = GameRecord.globalVariables[rKey] as number;
// total = total ? total : 0;
// total++;
// data[sType] =
// {
// send_id: param.gid,
// role_id: param.rid,
// total_send: total
// };
// GameRecord.globalVariables[rKey] = total;
// }
// break;
// case DotShopTotalType.Popup:
// {
// data[sType] = param.popType;
// }
// break;
// }
// GameRecord.autoSave();
// // console.log("dotShopTotal = ", data);
// await this.dot(eventKey, data, "shop_total");
}
async dotTask(taskDotType, tId) {
// let eventKey = "task";
// let data = {};
// data["daily_task"] = {};
// switch (taskDotType) {
// case TaskDotType.CompleteTask:
// {
// data["daily_task"] = "completed_" + tId;
// }
// break;
// case TaskDotType.GetTaskRewards:
// {
// data["daily_task"] = "get_rewards_" + tId;
// }
// break;
// }
// await this.dot(eventKey, data, "task");
}
async dotMoment(id, optionType) {
// let eventKey = "circle_of_friends";
// let v = "circle_" + optionType;
// await this.dot(eventKey, { circle: v }, "circle_of_friends");
}
async dotTutorial(tType, state, param) {
let eventKey = "tutorial";
let k = "" + tType;
let v = "" + param.session;
switch (state) {
case Enums_1.TutorialState.SelectSentence:
{
v += state + param.plotId;
}
break;
case Enums_1.TutorialState.SelectSentenceRet:
{
k += "_plot_select";
v += Enums_1.TutorialState.SelectSentence + param.plotId + state + param.select;
}
break;
case Enums_1.TutorialState.Progress:
{
k += "_plot_progress";
v += state + param.progress;
}
break;
}
let data = {};
data[k] = v;
// console.log("dotTutorial = ", data);
await this.dot(eventKey, data, "tutorial");
}
async dotShare(shareType, shareLocation) {
let eventKey = "share";
// console.log("dotShare = ", { share_type: shareType, share_location: shareLocation });
await this.dot(eventKey, { share_type: shareType, share_location: shareLocation }, "share");
}
async dotVideo(videoType, videoLocation) {
let eventKey = "video";
// console.log("dotVideo = ", { video_type: videoType, video_location: videoLocation });
await this.dot(eventKey, { video_type: videoType, video_location: videoLocation }, "video");
}
//todo
async dotShareRes(location, titleId, imgId) {
let eventKey = "share_source";
let v = location + "_" + titleId + "_" + imgId;
await this.dot(eventKey, { share_source: v }, "share_source");
}
async dotGuide(oprType, location) {
let eventKey = "guide";
let v = location + oprType;
// console.log("dotGuide = ",{ guide: v });
await this.dot(eventKey, { guide: v }, "guide");
}
async dotEvent(oprType, location) {
let eventKey = 'event';
let v = location;
let data = {};
data[oprType] = v;
// console.log("dotEvent = ",data);
await this.dot(eventKey, data, 'event');
}
async dotSpecialPlot(sceneId, plotId, selectIndex, contenType, contentStatus) {
let eventKey = 'special_plot';
let data = {
scene: sceneId,
plot: plotId,
select: selectIndex,
contentype: contenType,
status: contentStatus
};
// console.log("dotSpecialPlot = ", data);
await this.dot(eventKey, data, 'special_plot');
}
}
GameDotMgr._instance = new GameDotMgr();
return GameDotMgr;
})();
exports.default = GameDotMgr;
cc._RF.pop();