<?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;
    
    /**
     * 角色卡解锁英雄记录
     * @var type
     */
    #[ArrayType]
    public $roleCardUnlockHeroList = array();

    /**
     * 初始化玩家英雄数据
     */
    public function initialize() {
        $heroConf = GameConfig::hero();
        foreach ($heroConf as $heroId => $mo) {
            if (!StlUtil::dictHasProperty($this->Dic, $heroId) && $mo->starLv == 1) {
                $insHero = new Ins_Hero();
                $insHero->Id = $heroId;
                $insHero->isUnlock = 0;               
                if ($mo->isDefaultUnlock == 1) {
                    $insHero->isUnlock = 1;
                }                              
                $this->Dic->$heroId = $insHero;
            }
        }

        if ($this->CurrentHeroId == 0) {
            $this->CurrentHeroId = glc()->CreateUserGame_defaultHeroId;
        } 
    }

    public function __construct($arg = null) {
        if ($arg == null) {
            $this->Dic = new \stdClass();
        } else {
            parent::__construct($arg);
        }
    }

}
