123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?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() {
- $heroConf = GameConfig::hero();
-
- foreach ($heroConf as $heroId => $mo) {
- if(!StlUtil::dictHasProperty($this->Dic, $heroId) ){
- $insHero = new Ins_Hero();
- $insHero->Id = $heroId;
- $insHero->isUnlock = 0;
- if($heroId == 1 && $heroId == 2){
- $insHero->isUnlock = 1;
- }
-
- $this->Dic->$heroId = $insHero;
- }
-
- }
-
- if($this->CurrentHeroId == 0){
- $this->CurrentHeroId = 1;
- }
- // $curHeroId = 1; //临时
- // $this->CurrentHeroId = $curHeroId;
- // $this->Dic = new \stdClass();
- // $insHero = new Ins_Hero();
- // $insHero->Id = $curHeroId;
- // $this->Dic->$curHeroId = $insHero;
- // $id2 = 2;
- // $ins2 = new Ins_Hero();
- // $ins2->Id = 2;
- // $this->Dic->$id2 = $ins2;
- }
- public function __construct($arg = null) {
- if ($arg == 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);
- }
- }
- }
|