YZ_Constant.ts 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. const { ccclass, property } = cc._decorator;
  2. /**
  3. * banner 的位置
  4. */
  5. export enum BeForGameOverAdId {
  6. None = "none",
  7. /**
  8. * 分享
  9. */
  10. SharePanel = "share_panel",
  11. /**
  12. * 宝箱
  13. */
  14. GoldBox = "gold_box",
  15. /**
  16. * 抽奖
  17. */
  18. Turntable = "turntable",
  19. /**
  20. * 创建快捷桌面
  21. */
  22. CreateShortCut = "create_short_cut",
  23. /**
  24. * 更多游戏推荐
  25. */
  26. RecGame = "rec_game",
  27. /**
  28. * 幸运宝箱
  29. */
  30. LuckBox = "luck_box",
  31. /**
  32. * 同步显示
  33. */
  34. SyncShow = "sync_show",
  35. /**
  36. * 模版广告
  37. */
  38. CustomAd = "custom_ad",
  39. };
  40. /**
  41. * banner 的位置
  42. */
  43. export enum RewardType {
  44. /**
  45. * 金币
  46. */
  47. Gold = "gold",
  48. /**
  49. * 皮肤
  50. */
  51. Skin = "Skin"
  52. };
  53. @ccclass("YZ_Reward")
  54. export class YZ_Reward {
  55. /**
  56. * 奖励类型
  57. */
  58. rewardType: RewardType = RewardType.Gold;
  59. /**
  60. * 奖励值
  61. */
  62. rewardValue: number = 0;
  63. }
  64. /**
  65. * 上报关卡的类型
  66. * start、complete、fail 、skip
  67. */
  68. export enum LevelStatus {
  69. /**
  70. * 游戏开始
  71. */
  72. GameStart = "start",
  73. /**
  74. * 游戏胜利
  75. */
  76. GameWin = "complete",
  77. /**
  78. * 游戏失败
  79. */
  80. GameFail = "fail",
  81. /**
  82. * 跳过关卡
  83. */
  84. GameSkip = "skip",
  85. }
  86. /**
  87. * 组件类型
  88. */
  89. export enum SubLocation {
  90. /**
  91. * 当前显示的位置
  92. * isReward //激励插屏
  93. * isQCross //6个互推组件
  94. * isMoreGame //更多游戏
  95. * isStatement //结算组件
  96. * isTryGame //试玩组件
  97. * isYzBanner //自定义banner
  98. * isScrollbar //自定义滚动条
  99. * isVerticalPanel //竖状互推
  100. */
  101. /**
  102. * 激励插屏
  103. */
  104. isReward = "isReward",
  105. /**
  106. * 6个互推组件
  107. */
  108. isQCross = "isQCross",
  109. /**
  110. * 更多游戏
  111. */
  112. isMoreGame = "isMoreGame",
  113. /**
  114. * 结算组件
  115. */
  116. isStatement = "isStatement",
  117. /**
  118. * 试玩组件
  119. */
  120. isTryGame = "isTryGame",
  121. /**
  122. * 自定义banner
  123. */
  124. isYzBanner = "isYzBanner",
  125. /**
  126. * 自定义滚动条
  127. */
  128. isScrollbar = "isScrollbar",
  129. /**
  130. * 退出弹窗
  131. */
  132. isGameExitDialog = "isGameExitDialog",
  133. /**
  134. * 盒子插屏
  135. */
  136. isBoxInsertAd = "isBoxInsertAd",
  137. /**
  138. * 结算前广告
  139. */
  140. isBeforGameOverAd = "isBeforGameOverAd",
  141. /**
  142. * 竖状互推
  143. */
  144. isVerticalPanel = "isVerticalPanel"
  145. }
  146. /**
  147. * 震动类型
  148. */
  149. export enum VibrateType {
  150. /**
  151. * 短振
  152. */
  153. Short = "short",
  154. /**
  155. * 长振
  156. */
  157. Long = "long"
  158. }
  159. /**
  160. * banner 的位置
  161. */
  162. export enum BannerLocation {
  163. None = 0,
  164. Home,
  165. Level,
  166. Skin,
  167. Game,
  168. Pause,
  169. Over
  170. };
  171. /**
  172. * 视窗 的位置
  173. */
  174. export enum ViewLocation {
  175. None = 0,
  176. sign,
  177. trySkin,
  178. box,
  179. over,
  180. failBox,
  181. successBox,
  182. winPanel,
  183. turntable
  184. };
  185. /**
  186. * 阿拉丁关卡上报类型
  187. */
  188. export enum AldStageType {
  189. /**
  190. * 游戏开始
  191. */
  192. Start = "StartGame",
  193. /**
  194. * 游戏进行中
  195. */
  196. Running = "Running",
  197. /**
  198. * 游戏胜利
  199. */
  200. GameWin = "GameWin",
  201. /**
  202. * 游戏失败
  203. */
  204. GameFail = "GameFail",
  205. }
  206. /**
  207. * 阿拉丁事件上报的类型
  208. */
  209. export enum AldEventType {
  210. /**
  211. * 点击皮肤试用
  212. */
  213. TrailSkinClick = "皮肤试用点击",
  214. /**
  215. * 皮肤试用成功
  216. */
  217. TrailSkinSuccess = "皮肤试用成功",
  218. /**
  219. * 皮肤试用失败
  220. */
  221. TrailSkinFail = "皮肤试用失败",
  222. /**
  223. * 点击跳过关卡
  224. */
  225. SkipLevelClick = "点击跳过关卡",
  226. /**
  227. * 跳过关卡成功
  228. */
  229. SkipLevelSuccess = "跳过关卡成功",
  230. /**
  231. * 跳过关卡
  232. */
  233. SkipLevelFail = "跳过关卡失败",
  234. /**
  235. * 点击游戏结束双倍获取金币
  236. */
  237. GameOverDoubleGoldClick = "点击游戏结束双倍获取金币",
  238. /**
  239. * 游戏结束双倍获取金币成功
  240. */
  241. GameOverDoubleGoldSuccess = "游戏结束双倍获取金币成功",
  242. /**
  243. * 游戏结束双倍获取金币失败
  244. */
  245. GameOverDoubleGoldFail = "游戏结束双倍获取金币失败",
  246. /**
  247. * 点击签到获取双倍金币
  248. */
  249. SignDoubleGoldClick = "点击签到双倍领取",
  250. /**
  251. * 签到获取双倍金币成功
  252. */
  253. SignDoubleGoldSuccess = "签到双倍领取成功",
  254. /**
  255. * 签到获取双倍金币失败
  256. */
  257. SignDoubleGoldFail = "签到双倍领取失败",
  258. /**
  259. * 游戏结束晋级三星
  260. */
  261. GameOverDoubleStarClick = "点击游戏结束晋级三星",
  262. /**
  263. * 游戏结束晋级三星
  264. */
  265. GameOverDoubleStarSuccess = "游戏结束晋级三星成功",
  266. /**
  267. * 游戏结束晋级三星
  268. */
  269. GameOverDoubleStarFail = "游戏结束晋级三星失败",
  270. /**
  271. * 游戏版本
  272. * 游戏加载成功后上报
  273. */
  274. GameVersion = "游戏版本",
  275. /**
  276. * 进入皮肤场景
  277. */
  278. LoadSkinScene = "进入皮肤场景",
  279. /**
  280. * 购买皮肤成功
  281. */
  282. PaySkin = "购买皮肤成功",
  283. };
  284. /**
  285. * 归因事件类型
  286. */
  287. export enum AttributedType {
  288. /**
  289. * 激活
  290. */
  291. Active = 0,
  292. /**
  293. * 关键行为
  294. */
  295. GameAddiction = 25
  296. };
  297. /**
  298. * 归因事件Key
  299. */
  300. export enum AttributedKey {
  301. /**
  302. * 激活
  303. */
  304. Active = "active",
  305. /**
  306. * 关键行为
  307. */
  308. GameAddiction = "game_addiction"
  309. };
  310. /**
  311. * 归因事件Key
  312. *
  313. * user_click_insert_ad_active:"true" //用户点击插屏之后上报激活
  314. play_level_count_active:5 //验证当前闯关次数是否达到激活用户的条件
  315. pass_level_count_active:5 //验证当前通关次数是否达到激活用户的条件
  316. insert_ad_first_show_active: "true" //插屏首次展示成功是否上报激活事件
  317. */
  318. export enum AttributedValue {
  319. /**
  320. * 激活
  321. */
  322. Active = "active",
  323. /**
  324. * 关键行为-用户点击插屏之后上报激活
  325. */
  326. UserClickInsertAdAction = "user_click_insert_ad_action",
  327. /**
  328. * 关键行为-当前闯关次数行为
  329. */
  330. PlayLevelCountAction = "play_level_count_action",
  331. /**
  332. * 关键行为-当前通过关卡次数行为
  333. */
  334. PassLevelCountAction = "pass_level_count_action",
  335. /**
  336. * 关键行为-插屏首次展示成功行为
  337. */
  338. InsertAdFirstShowAction = "insert_ad_first_show_action",
  339. /**
  340. * 关键行为-游戏时长行为
  341. */
  342. GameTimeAction = "game_time_action",
  343. };
  344. /**
  345. * BannerLocation 转换成对应的字符串
  346. * @param location
  347. */
  348. export let BannerLocationToString = function (location: BannerLocation) {
  349. let str: string[] = ["none", "home", "level", "skin", "game", "pause", "over"];
  350. return str[location];
  351. };
  352. /**
  353. * Location字符串转换成对应的BannerLocation
  354. * @param locationString
  355. */
  356. export let BannerLocationToEnum = function (locationString: string) {
  357. let str: string[] = ["none", "home", "level", "skin", "game", "pause", "over"];
  358. for (let i = 0; i < str.length; i++) {
  359. if (str[i] == locationString) {
  360. return i as BannerLocation;
  361. }
  362. }
  363. return BannerLocation.None;
  364. }
  365. @ccclass
  366. export default class YZ_Constant {
  367. // 接口版本号
  368. public static SERVER_VERSION: string = "v1";
  369. // 常量定义
  370. // 设备UID
  371. public static ST_UID: string = "UID";
  372. // 服务器UID
  373. public static ST_SERVICE_UID: string = "SERVICE_UID";
  374. // 用户来源
  375. public static ST_SOURCE: string = "SOURCE";
  376. // 红包当前进度
  377. public static ST_RED_BAG_PROGRESS: string = "YZ_RED_BAG_PROGRESS";
  378. // 红包总进度
  379. public static ST_RED_BAG_TOTAL_PROGRESS: string = "YZ_RED_BAG_TOTAL_PROGRESS";
  380. // 红包余额
  381. public static ST_RED_BAG_BALANCE: string = "YZ_RED_BAG_BALANCE";
  382. // 红包总金额
  383. public static ST_RED_BAG_TOTAL_MONEY: string = "YZ_RED_BAG_TOTAL_MONEY";
  384. // 免费红包领取时间
  385. public static ST_FREE_RED_BAG_TIME: string = "YZ_ST_FREE_RED_BAG_TIME";
  386. // 最后领取红包的关卡
  387. public static ST_LAST_OPEN_LEVEL: string = "YZ_ST_LAST_OPEN_LEVEL";
  388. // 宝箱获取奖励的次数
  389. public static ST_GET_BOX_REWARD_COUNT: string = "YZ_GET_BOX_REWARD_COUNT";
  390. // 红包进度
  391. // public static ST_RED_BAG_PROGRESS: string = "YZ_RED_BAG_PROGRESS";
  392. // 组件事件定义
  393. public static YZ_EventCommon: string = "YZ_EventCommon";
  394. public static YZ_PrivacyClose: string = "YZ_PrivacyClose";
  395. public static EC_ServerInit: string = "ServerInit";
  396. public static EC_RealNameAuthPanelClose: string = "RealNameAuthPanelClose";
  397. /**
  398. * 服务器数据拉取成功
  399. */
  400. public static EC_ServerDataLoadSuccess: string = "ServerDataLoadSuccess";
  401. public static YZ_NativeAdClick: string = "YZ_NativeAdClick";
  402. public static EC_OnHide: string = "EventOnHide";
  403. public static EC_OnShow: string = "EventOnShow";
  404. public static YZ_GAME_YSXY: string = "YZ_GAME_YSXY";
  405. // 是否上报激活
  406. public static ST_IS_REPORT_USER_ACTIVE: string = "ST_IS_REPORT_USER_ACTIVE";
  407. // 是否上报关键激活
  408. public static ST_IS_REPORT_GAME_ADDICTION: string = "ST_IS_REPORT_GAME_ADDICTION";
  409. // 启动类型
  410. public static ST_LUANCH_TYPE: string = "ST_LUANCH_TYPE";
  411. // 启动参数
  412. public static ST_LUANCH_DATA: string = "ST_LUANCH_DATA";
  413. // 登录成功
  414. public static ST_LOGIN_SUCCESS: string = "ST_LOGIN_SUCCESS";
  415. // 登录失败
  416. public static ST_LOGIN_FAIL: string = "ST_LOGIN_FAIL";
  417. // 设备ID
  418. public static ST_DEVICE_ID: string = "ST_DEVICE_ID";
  419. // 本地UUID
  420. public static ST_UUID: string = "ST_UUID";
  421. // 优玩UID
  422. public static ST_YOUWAN_UID: string = "ST_YOUWAN_UID";
  423. // 是否有获取过device_id
  424. public static ST_GET_DEVICE_ID: string = "ST_GET_DEVICE_ID";
  425. }