public void initModel(HeroMgr hMgr, MapMgr mMgr) { MapConfig cfg = _cfg; _randomMonsterModels = new List <HeroModel> (); int monsterSize = cfg.monsterData.Length; for (int i = 0; i < monsterSize; i += 2) { int id = Convert.ToInt32(cfg.monsterData[i]); int level = Convert.ToInt32(cfg.monsterData[i + 1]); HeroModel model = hMgr.createHero(id, level, 1); _randomMonsterModels.Add(model); } _canAtkModels = new List <MapModel> (); int canAtkSize = cfg.canAtkIds.Length; for (int i = 0; i < canAtkSize; i++) { int canAtkId = Convert.ToInt32(cfg.canAtkIds[i]); MapModel mapModel = mMgr.getMapModel(canAtkId); _canAtkModels.Add(mapModel); } }
void Start() { backBtn.onClicked += _onBackClicked; SolaEngine engine = SolaEngine.getInstance(); MapMgr mMgr = (MapMgr)engine.getMgr(typeof(MapMgr)); for (int i = 0; i < mapItems.Length; i++) { MapItem mapItem = mapItems[i]; MapModel mapModel = mMgr.getMapModel(i + 1); mapItem.setMapModel(mapModel, toBattleDialog, this); } }