GameConstants.php 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace loyalsoft;
  3. // 所谓const是指游戏上线后就不再变动的变量
  4. /**
  5. * 游戏内常量
  6. * @author gwang email:wanggangzero@qq.com
  7. * @copyright © 2015-3-9, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  8. */
  9. class GameConstants {
  10. // <editor-fold defaultstate="collapsed" desc=" 兑换码相关 ">
  11. /**
  12. * @var string 全平台后缀字符串
  13. */
  14. const AllPlatStr = "all";
  15. /**
  16. * 密码本
  17. * @return string
  18. */
  19. public static function GetCipherString() {
  20. switch (PLAT) {
  21. case 'and': # android平台 20171101110403
  22. return "qh6jid4g598rfnwp37xyb2vetzuskcam";
  23. case 'web': # web平台
  24. return "zgyqfmpav4whex9td7nu2kj8b5ris36c";
  25. case 'ios': # ios平台
  26. return "m8hsn46efyuatvp972cdgz3qrxj5wibk";
  27. case 'and_hw': # android平台 20171101110403
  28. return "qh6jid4g598rfnwp37xyb2vetzuskcam";
  29. default : # 默认采用原文密码本
  30. return "abcdefghijkmnpqrstuvwxyz23456789";
  31. }
  32. }
  33. /**
  34. * 根据激活码拿到平台字符串,增加新的平台的时候需要对应修改常量配置
  35. * @param ActiveCode $code
  36. */
  37. public static function GetPlatStringByActivteCode($code) {
  38. if (isset(self::$platStr[$code->plat])) {
  39. return self::$platStr[$code->plat];
  40. }
  41. return "unknown";
  42. }
  43. /**
  44. * 平台字符串,这是和客户端的一个约定,所上的渠道咱们给他们加个字符串后缀,方便区分.
  45. * @var array(string)
  46. */
  47. private static $platStr = array(
  48. "all", # # 0 全平台
  49. "yyb", # # 1 腾讯
  50. "uc", # # 2 九游
  51. "xiaomi_yj", # # 3 小米
  52. "qh360", # # 4 360
  53. "baidu", # # 5 百度
  54. "huawei", # # 6 华为
  55. "lenove", # # 7 联想
  56. "oppo_yj", # # 8 OPPO(易接)
  57. "wandoujia", # # 9 豌豆荚
  58. "dangle_yj", # # 10 当乐(易接)
  59. "meizu_yj", # # 11 魅族(易接)
  60. "yijie", # # 12 安智(易接)
  61. "jinli", # # 13 金立
  62. "anysdk", # # 14 anysdk
  63. "vivo", # # 15 vivo
  64. "samsung", # # 16 三星()
  65. "x7sy", # # 17 小七手游
  66. "yile_yj", # # 18 以乐易接
  67. );
  68. // </editor-fold>
  69. }
  70. // <=> 元数据定义 <=>
  71. define("META_EXP", 0); # 指挥官经验
  72. define("META_GOLD_ITEMID", 1); # 金币物品id
  73. define("META_CASH_ITEMID", 2); # 宝石物品id
  74. define("META_tili_ITEMID", 3); # 体力的物品ID
  75. define('META_FriendShipPoit_ItemId', 4); # 友情点的物品ID
  76. define("META_PVPCOIN_ITEMID", 5); # PVP竞技币物品id
  77. define("META_ActivePoint_ITEMID", 6); # 每日任务活跃点物品id
  78. define("META_YUANBAOITEMID", 7); # 元宝物品ID
  79. define("META_RESPOINT_ITEMID", 8); #资源点
  80. // TODO: config the c-s offset data
  81. //define("OFFSET_TIMESPAN", -3); # 服务端相对于客户端的偏移时间戳
  82. define("OFFSET_MSGTIME", 30); # 客户端服务端时间戳偏移最大误差
  83. require_once __DIR__ . '/defines/const_' . PLAT . '.php'; # 引入个平台特定设置: and,ios,web