Constant.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. export default class Constant {
  2. /**
  3. * 总关卡数量
  4. */
  5. public static CT_TotalLevelCount: number = 20;
  6. /**
  7. * 每过一关奖励
  8. */
  9. public static CT_RewardCoinCount: number = 100;
  10. /**
  11. * 闯关失败奖励
  12. */
  13. public static CT_FailRewardCoinCount: number = 50;
  14. public static commonCJTimes: number = 1;
  15. public static weaponLevelPriceArr: number[] = [100, 300, 600];
  16. public static skinLevelPriceArr: number[] = [100, 200, 300, 400, 500, 600];
  17. public static ST_GameData: string = "GameData_dxcyxtgd";
  18. public static ST_BuildDate: string = "ST_BuildDate";
  19. public static ST_TotoalCount: string = "ST_TotoalCount";
  20. public static ST_CurModel1MapId: string = "ST_CurModel1MapId";
  21. public static ST_CurModel2MapId: string = "ST_CurModel2MapId";
  22. public static ST_CurLevelId: string = "ST_CurLevelId";
  23. /////////////////////////// 当前用到
  24. public static ST_AudioOn: string = "ST_AudioOn"; //音频开关
  25. public static ST_ShakeOn: string = "ST_ShakeOn"; //震动开关
  26. public static ST_CoinCount: string = "ST_CoinCount"; //金币数量
  27. public static ST_DiamondCount: string = "ST_DiamondCount";
  28. public static ST_OnlineToday: string = "ST_OnlineToday";
  29. public static ST_ReceiveToday: string = "ST_ReceiveToday";
  30. public static ST_LastLoadDate: string = "ST_LastLoadDate";
  31. public static ST_LastDailyBonusTime: string = "ST_LastDailyBonusTime";
  32. public static ST_LastDailyBonusIndex: string = "ST_LastDailyBonusIndex";
  33. public static ST_SkinInfo: string = "ST_SkinInfo";
  34. public static ST_CurSkinId: string = "ST_CurSkinId";
  35. public static ST_SkillInfo: string = "ST_SkillInfo";
  36. public static ST_CurSkillId: string = "ST_CurSkillId";
  37. public static ST_GunInfo: string = "ST_GunInfo";
  38. public static ST_CurMeleeId: string = "ST_CurMeleeId";
  39. public static ST_CurRangeId: string = "ST_CurRangeId";
  40. public static ST_LevelItem: string = "LevelItem";
  41. public static ST_ShareNum: string = "ST_ShareNum";
  42. /** 游戏逻辑事件 */
  43. public static E_GAME_LOGIC: string = "E_GAME_LOGIC";
  44. /** 更新进度条事件 */
  45. public static E_UPDATE_PROGRESS: string = "E_UPDATE_PROGRESS";
  46. /** 事件: Fly_Coin */
  47. public static E_Fly_Coin: string = "E_Fly_Coin";
  48. /** 事件:金币数量改变 */
  49. public static E_COIN_CHANGE: string = "E_COIN_CHANGE";
  50. /** 事件:钻石数量改变 */
  51. public static E_Diamond_CHANGE: string = "E_Diamond_CHANGE";
  52. /** 事件:经验值改变 */
  53. public static E_EXP_CHANGE: string = "E_EXP_CHANGE";
  54. /** 事件:抽奖得皮肤 */
  55. public static E_CJ_SKIN: string = "E_CJ_SKIN";
  56. /** 事件:抽奖得武器 */
  57. public static E_CJ_Weapon: string = "E_CJ_Weapon";
  58. /** 事件:显示分享或视频 */
  59. public static E_ShareOrVideo: string = "E_ShareOrVideo";
  60. /** 事件:地下城 */
  61. public static E_Player_Death: string = "E_Player_Death";
  62. public static E_Player_Hart: string = "E_Player_Hart";
  63. public static E_Bullet_Last: string = "E_Bullet_Last";
  64. public static E_Bullet_Reload: string = "E_Bullet_Reload";
  65. public static E_Zombie_Hart: string = "E_Zombie_Hart";
  66. public static E_Zombie_Death: string = "E_Zombie_Death";
  67. public static E_Jingyan_Finish: string = "E_Jingyan_Finish";
  68. public static E_Commonzombie_Destory: string = "E_Commonzombie_Destory";
  69. public static E_Allzombie_Destory: string = "E_Allzombie_Destory";
  70. /** 事件_磁铁 */
  71. public static E_Skill_Citie: string = "E_Skill_Citie";
  72. /** 指引_全屏爆炸 */
  73. public static ST_Guide_Skill: string = "ST_Guide_Skill";
  74. }
  75. export enum GameState {
  76. None = -1,
  77. Prepare = 0,
  78. Start = 1,
  79. Success = 2,
  80. Failed = 3,
  81. Pause = 4,
  82. Relive = 5,
  83. }
  84. export enum Starstate {
  85. default = 0,
  86. bright = 1,
  87. drown = 2,
  88. }
  89. export enum ZindexLayer {
  90. zindex_min = cc.macro.MIN_ZINDEX,
  91. zinedx_floorTip = cc.macro.MIN_ZINDEX + 1,//地面提示
  92. zinedx_floorLiewen = cc.macro.MIN_ZINDEX + 2,//地面裂纹
  93. zinedx_floorSkill = cc.macro.MIN_ZINDEX + 3,//地面技能
  94. zinedx_footPrint = cc.macro.MIN_ZINDEX + 4,//脚印
  95. zinedx_gh = cc.macro.MIN_ZINDEX + 5,//人物光环
  96. zinedx_footYc = cc.macro.MIN_ZINDEX + 6,//烟尘
  97. zinedx_jingyan = cc.macro.MIN_ZINDEX + 7,//经验层
  98. zindex_shellcase = cc.macro.MIN_ZINDEX + 8,//弹壳
  99. default = 0,
  100. zindex_mb = 1,//墓碑
  101. zinedx_item = 100,//道具
  102. zinedx_dropbox = 200,//空投
  103. zindex_zombie = 300,//僵尸
  104. zindex_monster = 400,//怪物
  105. zindex_enemy = 500,//敌人
  106. zindex_soldier = 600,//敌人
  107. zindex_ai = 700,//ai
  108. zindex_player = 800,//玩家
  109. zindex_tower = 900,//塔
  110. zindex_bullet = 1000,//子弹
  111. zindex_hp = 1100,//血液
  112. zindex_bomb = 1200,//爆炸
  113. zindex_blood = 1300,//血液
  114. zindex_effect = 1400,//特效
  115. zindex_effect_fire = 1500,//特效_开火
  116. zindex_effect_spark = 1600,//特效_撞墙
  117. zindex_effect_hit = 1800,//特效_击中
  118. zindex_bullet_sky = 1900,//空中子弹
  119. zindex_skill = cc.macro.MAX_ZINDEX - 6,//技能
  120. zindex_roleLabel = cc.macro.MAX_ZINDEX - 2,//角色受伤提示文字
  121. zindex_max = cc.macro.MAX_ZINDEX,
  122. }
  123. ///////////////////////////////////////////// 界面 /////////////////////////////////////////////
  124. export class PageName {
  125. public static UILoadingPage: string = "UILoadingPage";
  126. public static UIHomePage: string = "UIHomePage";
  127. public static UIGamePage: string = "UIGamePage";
  128. public static UIOverPage: string = "UIOverPage";
  129. public static UIGameLoadingPage: string = "UIGameLoadingPage";
  130. }
  131. export class PanelName {
  132. public static UISignPanel: string = "UISignPanel";
  133. public static UITurntablePanel: string = "UITurntablePanel";
  134. public static UIRevivePanel: string = "UIRevivePanel";
  135. public static UIUpgradePanel: string = "UIUpgradePanel"
  136. public static UIPausePanel: string = "UIPausePanel";
  137. public static UITrySkinPanel: string = "UITrySkinPanel";
  138. public static UIWeaponLevelPanel: string = "UIWeaponLevelPanel";
  139. public static UITimePanel: string = "UITimePanel";
  140. }
  141. ///////////////////////////////////////////////////
  142. export class Levelitem {
  143. public Id: number;
  144. /**
  145. * 0代表上锁
  146. * 1代表未完成
  147. * 2代表完成
  148. */
  149. public State: number;
  150. public Grade: number;
  151. constructor(str: string) {
  152. let info: any = JSON.parse(str);
  153. if (info) {
  154. if (info.Id) {
  155. this.Id = parseInt(info.Id);
  156. } else {
  157. cc.log("Id 字段不存在!");
  158. }
  159. if (info.State) {
  160. this.State = parseInt(info.State);
  161. } else {
  162. cc.log("State 字段不存在!");
  163. }
  164. if (info.Grade) {
  165. this.Grade = parseInt(info.Grade);
  166. }
  167. else {
  168. cc.log("Grade 字段不存在!")
  169. }
  170. } else {
  171. cc.log("构建 Levelitem 的字符串不合法!");
  172. }
  173. }
  174. public ToString() {
  175. return `{"Id":"${this.Id}","State":"${this.State}","Grade":"${this.Grade}"}`;
  176. }
  177. }
  178. export class SkinInfo {
  179. public Id: number;
  180. /**
  181. * 0:未解锁
  182. * 1:已解锁
  183. * 2:当前使用
  184. */
  185. public State: number;
  186. public Price: number;
  187. public Level: number;
  188. public VideoCount: number;
  189. constructor(str: string) {
  190. let info: any = JSON.parse(str);
  191. if (info) {
  192. if (info.Id) {
  193. this.Id = parseInt(info.Id);
  194. } else {
  195. cc.log("Id 字段不存在!");
  196. }
  197. if (info.State) {
  198. this.State = parseInt(info.State);
  199. } else {
  200. cc.log("State 字段不存在!");
  201. }
  202. if (info.Price) {
  203. this.Price = parseInt(info.Price);
  204. } else {
  205. cc.log("Price 字段不存在!");
  206. }
  207. if (info.Level) {
  208. this.Level = parseInt(info.Level);
  209. }
  210. else {
  211. cc.log("Level 字段不存在!");
  212. }
  213. if (info.VideoCount) {
  214. this.VideoCount = parseInt(info.VideoCount);
  215. }
  216. else {
  217. cc.log("VideoCount 字段不存在!");
  218. }
  219. } else {
  220. cc.log("构建 SkinInfo 的字符串不合法!");
  221. }
  222. }
  223. public ToString() {
  224. return `{"Id":"${this.Id}","State":${this.State}","Price":"${this.Price}","VideoCount":"${this.VideoCount}"}`;
  225. }
  226. }
  227. export class GunInfo {
  228. public Id: number;
  229. /**
  230. * 0:未解锁
  231. * 1:已解锁
  232. * 2:当前使用
  233. */
  234. public State: number;
  235. public Price: number;
  236. public Level: number;
  237. public VideoCount: number;
  238. constructor(str: string) {
  239. let info: any = JSON.parse(str);
  240. if (info) {
  241. if (info.Id) {
  242. this.Id = parseInt(info.Id);
  243. } else {
  244. cc.log("Id 字段不存在!");
  245. }
  246. if (info.State) {
  247. this.State = parseInt(info.State);
  248. } else {
  249. cc.log("State 字段不存在!");
  250. }
  251. if (info.Price) {
  252. this.Price = parseInt(info.Price);
  253. } else {
  254. cc.log("Price 字段不存在!");
  255. }
  256. if (info.Level) {
  257. this.Level = parseInt(info.Level);
  258. }
  259. else {
  260. cc.log("Level 字段不存在!");
  261. }
  262. if (info.VideoCount) {
  263. this.VideoCount = parseInt(info.VideoCount);
  264. }
  265. else {
  266. cc.log("VideoCount 字段不存在!");
  267. }
  268. } else {
  269. cc.log("构建 GunInfo 的字符串不合法!");
  270. }
  271. }
  272. public ToString() {
  273. return `{"Id":"${this.Id}","State":"${this.State}","Price":"${this.Price}","Level":"${this.Level}","VideoCount":"${this.VideoCount}"}`;
  274. }
  275. }
  276. export class SkillInfo {
  277. public Id: number;
  278. /**
  279. * 0:未解锁
  280. * 1:已解锁
  281. * 2:当前使用
  282. */
  283. public State: number;
  284. public Price: number;
  285. constructor(str: string) {
  286. // cc.log("构建 SkinInfo :", str);
  287. let info: any = JSON.parse(str);
  288. if (info) {
  289. if (info.Id) {
  290. this.Id = parseInt(info.Id);
  291. } else {
  292. cc.log("Id 字段不存在!");
  293. }
  294. if (info.State) {
  295. this.State = parseInt(info.State);
  296. } else {
  297. cc.log("State 字段不存在!");
  298. }
  299. if (info.Price) {
  300. this.Price = parseInt(info.Price);
  301. } else {
  302. cc.log("Price 字段不存在!");
  303. }
  304. } else {
  305. cc.log("构建 SkillInfo 的字符串不合法!");
  306. }
  307. }
  308. public ToString() {
  309. return `{"Id":"${this.Id}","State":"${this.State}","Price":"${this.Price}"}`;
  310. }
  311. }