Global.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. var Global = cc.Class({
  2. extends: cc.Component,
  3. statics: {
  4. InitGetMoneyId:1,//初始获得金钱 是第几个等级
  5. CompanyCreateCost:1000,//创办公司消耗1000手 1手= 100
  6. InitWareHouseCapcity:100,//仓库初始容量
  7. AssetExplorRate:5,//资产暴涨定位 5倍
  8. AssetExplorDownRate:0.6,//资产暴涨定位 5倍
  9. AssetBurden:30, //财富暴涨造成健康指数下降
  10. YearRecover:1, //需要两年恢复健康
  11. DateSuccescRatio:0.3, //约会到人的概率是 0.2
  12. LastEventAge:27,//上一次事件发生的年龄
  13. AddCapacityCost:10000,//扩充一个仓储容量 消耗的金钱
  14. BetWinRatio:0.3,//赌博赢钱比例 先设定为 15%
  15. RetireInitAge:70,//退休基础年龄
  16. HealthLine:50,//健康值红线
  17. showStockProfit:false,//显示股票收益
  18. HasCompanyReputationAdd:4, //拥有公司时候 会增加的名声 每年
  19. GoodsForeId:-1, //市场前瞻用的保留数据 Id
  20. //以下是可变动数据
  21. TempAdsBonus:0, //临时广告加成
  22. TempAdsBetBonus:0,
  23. TempAdsAssetBonus:0,
  24. TempAdsStockBonus:0,
  25. BetInitCost:1000,//赌博初始花费
  26. DateInitCost:1000, //约会的最低起价 今后每次递增 2 倍
  27. tmpRetireAgeBonues:5,//临时广告退休年龄加成
  28. useRetireAds:false,
  29. //成就完成所需数据记录
  30. goToHospital:0, //进入医院次数
  31. BankruptTimes:0, //破产次数
  32. CreateCompanyTimes:0,//创业次数
  33. tutorialGoodsId:-1,
  34. tutorialStep:-1,// -1 表示不在引导序列 采用 11 表示第一个大步骤 第一小步
  35. tutorialInDate:false,
  36. tutorialInBus:false,
  37. HealthSubAge:40, //多少岁开始健康随年龄下降
  38. //健康状态
  39. HpStateA:80,
  40. HpStateB:55,
  41. HpStateC:54,
  42. //赌博赢钱的概率 累加形式
  43. BetWinNullRatio:0.69,
  44. BetWinThreeRatio:0.85,
  45. BetWinFourRatio:0.95,
  46. BetWinFiveRatio:1.0,
  47. //是否激活了什么
  48. hasActiveGuShen:false,
  49. hasActiveCaiShen:false,
  50. hasActiveDuShen:false,
  51. hasActiveAiShen:false,
  52. InitChangeData:function(){
  53. this.GoodsForeId = -1;
  54. this.tutorialGoodsId = -1;
  55. this.tutorialInBus = false;
  56. this.tutorialInDate = false;
  57. this.tutorialStep = -1;
  58. this.BetInitCost = 1000;//赌博初始花费
  59. this.DateInitCost = 1000; //约会的最低起价 今后每次递增 2 倍
  60. this.showStockProfit = false;
  61. this.useRetireAds = false,
  62. this.tmpRetireAgeBonues = 5;
  63. this.BetWinRatio = 0.25;
  64. this.TempAdsBonus = 0;
  65. this.TempAdsStockBonus = 0;
  66. this.TempAdsAssetBonus = 0;
  67. this.TempAdsBetBonus = 0;
  68. //成就完成所需数据记录
  69. this.goToHospital = 0; //进入医院次数
  70. this.BankruptTimes = 0; //破产次数
  71. this.CreateCompanyTimes = 0;//创业次数
  72. //之前激活
  73. this.hasActiveAiShen = false;
  74. this.hasActiveDuShen = false;
  75. this.hasActiveCaiShen = false;
  76. this.hasActiveGuShen = false;
  77. },
  78. InitEventHappenAge:function()
  79. {
  80. this.LastEventAge = 25 + Math.floor(Math.random() * 6);
  81. },
  82. //生成一个随机整数 在 index1 - index2之间
  83. SpawnSeedBetweenTwoNum:function(index1, index2){
  84. var seed = index1 + Math.floor(Math.random() * (index2 - index1 + 1));
  85. return seed;
  86. },
  87. getTranslation:function(desId){
  88. for (var prop in cc.director.NoticeText) {
  89. if(prop.toString() == desId)
  90. {
  91. return cc.director.NoticeText[prop];
  92. }
  93. }
  94. var des = "翻译字段null";
  95. return des;
  96. },
  97. FormatNum:function(num){
  98. num = num +'';
  99. var str = "";
  100. for(var i=num.length- 1,j=1;i>=0;i--,j++){
  101. if(j%3==0 && i!=0){//每隔三位加逗号,过滤正好在第一个数字的情况
  102. str+=num[i]+",";//加千分位逗号
  103. continue;
  104. }
  105. str+=num[i];//倒着累加数字
  106. }
  107. var out = str.split('').reverse().join("");//字符串=>数组=>反转=>字符串
  108. if(out[0] == ',')
  109. return out.splice(0,1)
  110. return out;
  111. },
  112. },
  113. });
  114. module.exports = Global;