Bladeren bron

hero和gate

cyzhao 1 jaar geleden
bovenliggende
commit
72dcedc831

+ 1 - 1
Gameserver/App/base/CmdCode.php

@@ -145,7 +145,7 @@ class CmdCode {
     const cmd_fight_settle = 6801;
     const cmd_fight_settle = 6801;
     
     
     /**
     /**
-     * 
+     * 章节宝箱的领取
      */
      */
     const cmd_fight_PassGateTsPrizeReceive = 6802;
     const cmd_fight_PassGateTsPrizeReceive = 6802;
     // </editor-fold>
     // </editor-fold>

+ 30 - 14
Gameserver/App/model/User/Data_UserGame.php

@@ -19,6 +19,18 @@ class Data_UserGame extends HashSaver {
      * @var Info_Store
      * @var Info_Store
      */
      */
     public $store;
     public $store;
+    
+    /**
+     * 关卡
+     * @var Info_Gates
+     */
+    public $gates;
+    
+    /**
+     * 关卡
+     * @var type
+     */
+    public $heros;
 
 
     /**
     /**
      * @var string token
      * @var string token
@@ -41,6 +53,8 @@ class Data_UserGame extends HashSaver {
         //$this->baseInfo = new Info_UserBase();
         //$this->baseInfo = new Info_UserBase();
         $this->baseInfo->initialize();      
         $this->baseInfo->initialize();      
         $this->store->initialize();
         $this->store->initialize();
+        $this->gates->initialize();
+        $this->heros->initialize();
     }
     }
 
 
     /**
     /**
@@ -51,6 +65,8 @@ class Data_UserGame extends HashSaver {
         if (null === $arg) {                                                    # 未传参数的情况下
         if (null === $arg) {                                                    # 未传参数的情况下
             $this->baseInfo = new Info_UserBase();
             $this->baseInfo = new Info_UserBase();
             $this->store = new Info_Store();
             $this->store = new Info_Store();
+            $this->gates = new Info_Gates();
+            $this->heros = new Info_Heros();
         } else {                                                                # 实参
         } else {                                                                # 实参
             parent::__construct($arg);                                          # 调用Object的构造函数
             parent::__construct($arg);                                          # 调用Object的构造函数
 
 
@@ -60,6 +76,19 @@ class Data_UserGame extends HashSaver {
 
 
     // <editor-fold defaultstate="collapsed" desc="实例方法">
     // <editor-fold defaultstate="collapsed" desc="实例方法">
 
 
+     /**
+     * 关卡数据
+     * @param bool $save 是否需要回存
+     * @return Info_UserGateDifficulty
+     */
+    public function gates($save = true) {
+        $this->gates = new Info_Gates($this->gates);
+        if ($save) {
+            self::save_tag("gates");
+        }
+        return $this->gates;
+    }
+    
     /**
     /**
      * 基础信息
      * 基础信息
      * @param bool $save 是否需要回存
      * @param bool $save 是否需要回存
@@ -118,7 +147,7 @@ class Data_UserGame extends HashSaver {
      * @return Info_UserGameHero
      * @return Info_UserGameHero
      */
      */
     public function heros($save = true) {
     public function heros($save = true) {
-        $this->heros = new Info_UserGameHero($this->heros);
+        $this->heros = new Info_Heros($this->heros);
         if ($save) {
         if ($save) {
             self::save_tag("heros");
             self::save_tag("heros");
         }
         }
@@ -138,19 +167,6 @@ class Data_UserGame extends HashSaver {
         return $this->privateState;
         return $this->privateState;
     }
     }
 
 
-    /**
-     * 关卡数据
-     * @param bool $save 是否需要回存
-     * @return Info_UserGateDifficulty
-     */
-    public function gates($save = true) {
-        $this->gates = new Info_UserGateDifficulty($this->gates);
-        if ($save) {
-            self::save_tag("gates");
-        }
-        return $this->gates;
-    }
-
     /**
     /**
      * 新地图数据
      * 新地图数据
      * @param bool $save 是否需要回存
      * @param bool $save 是否需要回存

+ 60 - 0
Gameserver/App/model/User/Info_Gates.php

@@ -0,0 +1,60 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Info_Gates
+ *
+ * @author c'y'zhao
+ */
+class Info_Gates extends Object_ext {
+    /**
+     * 当前剧情选择的关卡
+     */
+    public $CurrentGateId = 0;
+    /**
+     * 已解锁剧情关卡的最大id
+     * @var type
+     */
+    public $UnlockedGatesMaxId = 0; 
+    /**
+     * 章节列表
+     * @var type
+     */
+    public $GateList = null;
+    
+    public function initialize() {       
+        $startId= 1;
+        $this->CurrentGateId = $startId;
+        $this->UnlockedGatesMaxId = $startId;
+            
+        $this->GateList = new \stdClass();    
+        $Ins_GateInfo = new Ins_GateInfo();
+        $Ins_GateInfo->GateId = $this->CurrentGateId;
+        $this->GateList->$startId=$Ins_GateInfo;           
+    }
+    
+    public function __construct($arg = null) {
+        if($tag == null){            
+            if($this->CurrentGateId == 0 ){
+                $startId= 1;
+                $this->CurrentGateId = $startId;
+                $this->UnlockedGatesMaxId = $startId;
+            
+                $this->GateList = new \stdClass();    
+                $Ins_GateInfo = new Ins_GateInfo();
+                $Ins_GateInfo->GateId = $this->CurrentGateId;
+                $this->GateList->$startId=$Ins_GateInfo;                              
+            }
+            
+        }else{			
+            parent::__construct($arg);
+        }
+    }
+}

+ 52 - 0
Gameserver/App/model/User/Info_Heros.php

@@ -0,0 +1,52 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Info_Heros
+ *
+ * @author c'y'zhao
+ */
+class Info_Heros extends Object_ext {
+    /**
+     * 当前的hero
+     */
+    public $CurrentHeroId = 0;
+    
+    /**
+     * 所有的hero集合
+     * @var type
+     */
+    public $Dic = null;
+    
+    public function initialize() {
+        $curHeroId = 1;//临时
+        $this->CurrentHeroId = $curHeroId;
+        $this->Dic = new \stdClass();
+        $insHero = new Ins_Hero();
+        $insHero->Id = $curHeroId;
+        $this->Dic->$curHeroId = $insHero;
+    }
+    
+    public function __construct($arg = null) {
+        if($tag == null){
+            if($this->CurrentHeroId == 0 ){
+                $curHeroId = 1;//临时
+                $this->CurrentHeroId = $curHeroId;
+                $this->Dic = new \stdClass();
+                $insHero = new Ins_Hero();
+                $insHero->Id = $curHeroId;
+                $this->Dic->$curHeroId = $insHero;
+            }
+            
+        }else{			
+            parent::__construct($arg);
+        }
+    }
+}

+ 41 - 0
Gameserver/App/model/User/Ins_GateInfo.php

@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Ins_GateInfo
+ *
+ * @author c'y'zhao
+ */
+class Ins_GateInfo {
+    
+    public $GateId = 0;
+  
+    /**
+     * 0: 未领取,1: 五分钟奖励已领取 ,2: 十分钟奖励已领取, 3: 通关奖励已领取 (这个必须顺序领取)
+     */
+    public $FirstReward = 0;
+    
+    /**
+     * 坚持生存的最长时间(单位秒)
+     * @var type
+     */
+    public $MaxSeconds = 0;
+
+    /**
+     * 1:通关
+     * @param type $arg
+     */
+    public $pass = 0; 
+    
+    
+    public function __construct($arg = null) {
+        parent::__construct($arg);
+    }
+}

+ 35 - 0
Gameserver/App/model/User/Ins_Hero.php

@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Ins_Hero
+ *
+ * @author c'y'zhao
+ */
+class Ins_Hero {
+    
+    /**
+     * hero id
+     * @var type
+     */
+    public $Id = 0;
+    
+    public $equipPosition = null;
+
+    public function __construct($arg = null) {
+        if($arg == null){
+            //$this->equipPosition = new \stdClass();
+        } else {
+            parent::__construct($arg);
+        }
+        
+        
+    }
+}

+ 6 - 3
Gameserver/App/process/FightProc.php

@@ -21,9 +21,9 @@ class FightProc {
      */
      */
     public static function procMain($req) {
     public static function procMain($req) {
         switch ($req->cmd) {
         switch ($req->cmd) {
-            case CmdCode::cmd_fight_settle:                                     # 6801 
+            case CmdCode::cmd_fight_settle:                                     # 6801 战斗结算
                 return FightProc::settle();
                 return FightProc::settle();
-            case CmdCode::cmd_fight_PassGateTsPrizeReceive:                     # 6802
+            case CmdCode::cmd_fight_PassGateTsPrizeReceive:                     # 6802 章节宝箱的领取
                 return FightProc::PassGateTsPrizeReceive();     
                 return FightProc::PassGateTsPrizeReceive();     
             default:
             default:
                 Err(ErrCode::cmd_err);
                 Err(ErrCode::cmd_err);
@@ -38,7 +38,10 @@ class FightProc {
         list($gateId,$index) = req()->paras;                                      
         list($gateId,$index) = req()->paras;                                      
         
         
         $gateMo = GameConfig::gate_getItem($gateId);
         $gateMo = GameConfig::gate_getItem($gateId);
-//        my_Assert($gateMo!=null, ErrCode::err_const_no);
+        my_Assert($gateMo!=null, ErrCode::err_const_no);
+        
+        
+        
 //        $prizelist = ctx()->fight()->gateTsPrizeRevicedList;
 //        $prizelist = ctx()->fight()->gateTsPrizeRevicedList;
 //        $recordlist = ctx()->fight()->gateTsRecord;
 //        $recordlist = ctx()->fight()->gateTsRecord;
 //        for($i = $index -1 ; $i >0; $i--){//校验是否满足条件
 //        for($i = $index -1 ; $i >0; $i--){//校验是否满足条件