MapProc.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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->curMapType = $mo->mapType;
  39. $this->unlockedFootholds->$targetMapId = $footHold; # 添加解锁据点数据
  40. req()->userInfo->game->newMap = $newMap;
  41. UserProc::updateUserInfo();
  42. return Resp::ok($newMap);
  43. }
  44. /**
  45. * 7501 进入据点
  46. * @return Resp
  47. */
  48. public static function EnterFootHold() {
  49. $targetMapId = req()->paras[0]; # 提取参数
  50. $newMap = req()->userInfo->game->newMap();
  51. # 检查目标地图是否已经解锁
  52. my_Assert(isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_NotUnlocked);
  53. $newMap->curMapId = $targetMapId;
  54. req()->userInfo->game->newMap = $newMap;
  55. UserProc::updateUserInfo();
  56. return Resp::ok();
  57. }
  58. /**
  59. * 7502 开启传送阵
  60. * @return Resp
  61. */
  62. public static function FixUpTransmision() {
  63. }
  64. /**
  65. * 7503 更新探索进度
  66. * @return Resp
  67. */
  68. public static function UpdateExplorationProgress() {
  69. }
  70. }