Info_Heros.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of Info_Heros
  10. *
  11. * @author c'y'zhao
  12. */
  13. class Info_Heros extends Object_ext {
  14. /**
  15. * 当前的hero
  16. */
  17. public $CurrentHeroId = 0;
  18. /**
  19. * 所有的hero集合
  20. * @var type
  21. */
  22. public $Dic = null;
  23. public function initialize() {
  24. $heroConf = GameConfig::hero();
  25. foreach ($heroConf as $heroId => $mo) {
  26. if(!StlUtil::dictHasProperty($this->Dic, $heroId) ){
  27. $insHero = new Ins_Hero();
  28. $insHero->Id = $heroId;
  29. $insHero->isUnlock = 0;
  30. if($heroId == 1 && $heroId == 2){
  31. $insHero->isUnlock = 1;
  32. }
  33. $this->Dic->$heroId = $insHero;
  34. }
  35. }
  36. if($this->CurrentHeroId == 0){
  37. $this->CurrentHeroId = 1;
  38. }
  39. // $curHeroId = 1; //临时
  40. // $this->CurrentHeroId = $curHeroId;
  41. // $this->Dic = new \stdClass();
  42. // $insHero = new Ins_Hero();
  43. // $insHero->Id = $curHeroId;
  44. // $this->Dic->$curHeroId = $insHero;
  45. // $id2 = 2;
  46. // $ins2 = new Ins_Hero();
  47. // $ins2->Id = 2;
  48. // $this->Dic->$id2 = $ins2;
  49. }
  50. public function __construct($arg = null) {
  51. if ($arg == null) {
  52. if ($this->CurrentHeroId == 0) {
  53. $curHeroId = 1; //临时
  54. $this->CurrentHeroId = $curHeroId;
  55. $this->Dic = new \stdClass();
  56. $insHero = new Ins_Hero();
  57. $insHero->Id = $curHeroId;
  58. $this->Dic->$curHeroId = $insHero;
  59. }
  60. } else {
  61. parent::__construct($arg);
  62. }
  63. }
  64. }