Ins_GateInfo.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 extends Object_ext {
  14. public $GateId = 0;
  15. /**
  16. * 0: 未领取,1: 五分钟奖励已领取 ,2: 十分钟奖励已领取, 3: 通关奖励已领取
  17. */
  18. #[ArrayType]
  19. public $FirstReward = array();
  20. /**
  21. * 坚持生存的最长时间(单位秒)
  22. * @var type
  23. */
  24. public $MaxSeconds = 0;
  25. /**
  26. * 1:通关
  27. * @param type $arg
  28. */
  29. public $pass = 0;
  30. /**
  31. * 本关剧情是否已经播放过 0:没有 1:有
  32. * @var type
  33. */
  34. public $plotStart = 0;
  35. /**
  36. * @return bool 是否主线关卡
  37. */
  38. public function IsMainPlotGate() {
  39. return self::GateTypeFromId($this->GateId) == 1;
  40. }
  41. /**
  42. * @return /sm_gate 模板数据
  43. */
  44. public function mo() {
  45. return GameConfig::gate_getItem($this->GateId);
  46. }
  47. /**
  48. * 从gateId中提取关卡类型
  49. * @param type $gateId
  50. * @return int 1 主线剧情, 2 主线挑战, 9 爬塔挑战
  51. */
  52. public static function GateTypeFromId($gateId) {
  53. return Ints::Slice($gateId, 0, 1);
  54. }
  55. /**
  56. * 从gateId中提取关卡地图资源类型(前端用)
  57. * @param type $gateId 1 无限地图 2 上下地图 3 有限地图
  58. * @return int 0..999
  59. */
  60. public static function GateMapRes($gateId) {
  61. return Ints::Slice($gateId, 1, 4);
  62. }
  63. /**
  64. * 从gateId中提取关卡难度(挑战关卡分1,2,3)
  65. * @param type $gateId
  66. * @return int
  67. */
  68. public static function GateDifficultyFromId($gateId) {
  69. return Ints::Slice($gateId, 5, 1);
  70. }
  71. /**
  72. * 关卡序号(最大999)
  73. * @param type $gateId
  74. * @return int
  75. */
  76. public static function gateNum($gateId) {
  77. return Ints::Slice($gateId, 6, 3);
  78. }
  79. }