Exemple #1
0
    public bool loadDataAfterHeroMgr(JsonObject data, HeroMgr hMgr)
    {
        string MGR_NAME = this.GetType().Name;

        if (!data.ContainsKey(MGR_NAME))
        {
            _parnerData     = new JsonObject();
            data [MGR_NAME] = _parnerData;
            Debug.Log("No " + MGR_NAME + " data");
        }
        else
        {
            _parnerData = (JsonObject)data [MGR_NAME];
            _leaderPos  = Convert.ToInt32(_parnerData [PartnerData.LEADER_POS]);

            JsonObject partnerInfos = (JsonObject)_parnerData [PartnerData.PARTNER_INFOS];
            foreach (string pos in partnerInfos.Keys)
            {
                int       heroId = Convert.ToInt32(partnerInfos[pos]);
                HeroModel hModel = hMgr.getHero(heroId);
                setPartner(Convert.ToInt32(pos), hModel);
            }
        }

        return(true);
    }