123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace loyalsoft;
- /**
- * Description of MapProc
- * 地图数据处理逻辑
- * @author gwang
- */
- class MapProc {
- /**
- * 地图处理逻辑分发
- * 所有的Proc中必须有这样一个方法
- */
- static function procMain() {
- switch (req()->cmd) {
- case CmdCode::map_EnterFootHold: # [7501] 进入据点
- return self::EnterFootHold();
- case CmdCode::map_FixUpTransmission: # [7502] 开启传送阵
- return self::FixUpTransmision();
- case CmdCode::map_UpdateExplorerationProgress: # [7503] 更新探索进度
- return self::UpdateExplorationProgress();
- case CmdCode::map_UnlockMap: # [7504] 解锁据点
- return self::UnlockMap();
- default: # err: 未知的命令码
- return Resp::err(ErrCode::cmd_err);
- }
- }
- /**
- * 7504 解锁据点
- * @return Resp
- */
- public static function UnlockMap() {
- $targetMapId = req()->paras[0]; # 提取参数
- $newMap = req()->userInfo->game->newMap();
- # 检查目标地图是否已经解锁
- my_Assert(!isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_Unlocked);
- $mo = GameConfig::map_scene_getItem($targetMapId);
- $footHold = new Ins_FootHold();
- $footHold->mapId = $mo->mapId;
- $footHold->curMapType = $mo->mapType;
- $this->unlockedFootholds->$targetMapId = $footHold; # 添加解锁据点数据
- req()->userInfo->game->newMap = $newMap;
- UserProc::updateUserInfo();
- return Resp::ok($newMap);
- }
- /**
- * 7501 进入据点
- * @return Resp
- */
- public static function EnterFootHold() {
- $targetMapId = req()->paras[0]; # 提取参数
- $newMap = req()->userInfo->game->newMap();
- # 检查目标地图是否已经解锁
- my_Assert(isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_NotUnlocked);
- $newMap->curMapId = $targetMapId;
- req()->userInfo->game->newMap = $newMap;
- UserProc::updateUserInfo();
- return Resp::ok();
- }
- /**
- * 7502 开启传送阵
- * @return Resp
- */
- public static function FixUpTransmision() {
-
- }
- /**
- * 7503 更新探索进度
- * @return Resp
- */
- public static function UpdateExplorationProgress() {
-
- }
- }
|