Ins_GateInfo.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of Ins_GateInfo
  10. *
  11. * @author c'y'zhao
  12. */
  13. class Ins_GateInfo {
  14. public $GateId = 0;
  15. /**
  16. * 0: 未领取,1: 五分钟奖励已领取 ,2: 十分钟奖励已领取, 3: 通关奖励已领取 (这个必须顺序领取)
  17. */
  18. public $FirstReward = 0;
  19. /**
  20. * 坚持生存的最长时间(单位秒)
  21. * @var type
  22. */
  23. public $MaxSeconds = 0;
  24. /**
  25. * 1:通关
  26. * @param type $arg
  27. */
  28. public $pass = 0;
  29. /**
  30. * 本关剧情是否已经播放过 0:没有 1:有
  31. * @var type
  32. */
  33. public $plotStart = 0;
  34. /**
  35. * @return bool 是否主线关卡
  36. */
  37. public function IsMainPlotGate() {
  38. return self::GateTypeFromId($this->GateId) == 1;
  39. }
  40. /**
  41. * @return /sm_gate 模板数据
  42. */
  43. public function mo() {
  44. return GameConfig::gate_getItem($this->GateId);
  45. }
  46. /**
  47. * 从gateId中提取关卡类型
  48. * @param type $gateId
  49. * @return int 1 主线剧情, 2 主线挑战
  50. */
  51. public static function GateTypeFromId($gateId) {
  52. return Ints::Slice($gateId, 0, 1);
  53. }
  54. /**
  55. * 从gateId中提取关卡索引
  56. * @param type $gateId
  57. * @return int 0..999
  58. */
  59. public static function GateMapIdFromId($gateId) {
  60. return Ints::Slice($gateId, 1, 3);
  61. }
  62. /**
  63. * 从gateId中提取地图风格编号
  64. * @param type $gateId
  65. * @return int 0..99
  66. */
  67. public static function GateMapStyleFromId($gateId) {
  68. return Ints::Slice($gateId, 4, 2);
  69. }
  70. /**
  71. * 从gateId中提取地图类型
  72. * @param type $gateId
  73. * @return int 1 无限地图 2 上下地图 3 有限地图
  74. */
  75. public static function GateMapTypeFromId($gateId) {
  76. return Ints::Slice($gateId, 6, 1);
  77. }
  78. /**
  79. * 从gateId中提取关卡难度(挑战关卡分1,2,3)
  80. * @param type $gateId
  81. * @return int
  82. */
  83. public static function GateDifficultyFromId($gateId) {
  84. return Ints::Slice($gateId, 7, 1);
  85. }
  86. }