MapProc.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * Description of MapProc
  5. * 地图数据处理逻辑
  6. * @author gwang
  7. */
  8. class MapProc {
  9. /**
  10. * 地图处理逻辑分发
  11. * 所有的Proc中必须有这样一个方法
  12. */
  13. static function procMain() {
  14. switch (req()->cmd) {
  15. case CmdCode::map_EnterFootHold: # [7501] 进入据点
  16. return self::EnterFootHold();
  17. case CmdCode::map_FixUpTransmission: # [7502] 开启传送阵
  18. return self::FixUpTransmision();
  19. case CmdCode::map_UpdateExplorerationProgress: # [7503] 更新探索进度
  20. return self::UpdateExplorationProgress();
  21. case CmdCode::map_UnlockMap: # [7504] 解锁据点
  22. return self::UnlockMap();
  23. default: # err: 未知的命令码
  24. return Resp::err(ErrCode::cmd_err);
  25. }
  26. }
  27. /**
  28. * 7504 解锁据点
  29. * @return Resp
  30. */
  31. public static function UnlockMap() {
  32. $targetMapId = req()->paras[0]; # 提取参数
  33. $newMap = req()->userInfo->game->newMap();
  34. # 检查目标地图是否已经解锁
  35. my_Assert(!isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_Unlocked);
  36. $mo = GameConfig::map_scene_getItem($targetMapId);
  37. $footHold = new Ins_FootHold();
  38. $footHold->mapId = $mo->mapId;
  39. $footHold->curMapType = $mo->mapType;
  40. $this->unlockedFootholds->$targetMapId = $footHold; # 添加解锁据点数据
  41. req()->userInfo->game->newMap = $newMap;
  42. UserProc::updateUserInfo();
  43. return Resp::ok($newMap);
  44. }
  45. /**
  46. * 7501 进入据点
  47. * @return Resp
  48. */
  49. public static function EnterFootHold() {
  50. $targetMapId = req()->paras[0]; # 提取参数
  51. $newMap = req()->userInfo->game->newMap();
  52. # 检查目标地图是否已经解锁
  53. my_Assert(isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_NotUnlocked);
  54. $newMap->curMapId = $targetMapId;
  55. req()->userInfo->game->newMap = $newMap;
  56. UserProc::updateUserInfo();
  57. return Resp::ok();
  58. }
  59. /**
  60. * 7502 开启传送阵
  61. * @return Resp
  62. */
  63. public static function FixUpTransmision() {
  64. }
  65. /**
  66. * 7503 更新探索进度
  67. * @return Resp
  68. */
  69. public static function UpdateExplorationProgress() {
  70. }
  71. }