Ejemplo n.º 1
0
    public void setCfg(DialogueInfoConfig cfg, HeroMgr hMgr)
    {
        _id      = Convert.ToInt32(cfg.id);
        _content = (string)cfg.content;

        int leftId    = Convert.ToInt32(cfg.leftSpeakerId);
        int rightId   = Convert.ToInt32(cfg.rightSpeakerId);
        int speakerId = Convert.ToInt32(cfg.speakerId);

        if (leftId != 0)
        {
            HeroModel leftModel = hMgr.createHero(leftId, 1, 0);
            _leftHeroModel = leftModel;
        }

        if (rightId != 0)
        {
            HeroModel rightModel = hMgr.createHero(rightId, 1, 0);
            _rightHeroModel = rightModel;
        }

        if (speakerId != 0)
        {
            HeroModel speakerModel = hMgr.createHero(speakerId, 1, 0);
            _speakerHeroModel = speakerModel;
        }
    }
Ejemplo n.º 2
0
    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);
        }
    }
Ejemplo n.º 3
0
    public void sign(string roleId)
    {
        if (_roleId != "")
        {
            return;
        }

        CreateRoleConfig createRoleCfg = _createRoleCfg;

        _roleId    = roleId;
        _roleLevel = 1;
        _roleExp   = 0;

        _gold  = Convert.ToInt32(createRoleCfg.gold);
        _paper = Convert.ToInt32(createRoleCfg.paper);


        int configId = Convert.ToInt32(createRoleCfg.heroId);
        int level    = Convert.ToInt32(createRoleCfg.heroLevel);

        HeroMgr   hMgr      = (HeroMgr)_engine.getMgr(typeof(HeroMgr));
        HeroModel heroModel = hMgr.createHero(configId, level, 0);

        hMgr.addHero(heroModel);
        //Fix me:Test Data.
        for (int i = 1; i <= 5; i++)
        {
            HeroModel hero = hMgr.createHero(i, 5, 5);
            hMgr.addHero(hero);
        }
        hMgr.saveData();

        PartnerMgr pMgr = (PartnerMgr)_engine.getMgr(typeof(PartnerMgr));

        pMgr.setPartner(0, heroModel);
        saveData();
    }
Ejemplo n.º 4
0
    public void setCfg(BattleInfoConfig cfg, HeroMgr hMgr)
    {
        _id       = Convert.ToInt32(cfg.id);
        _maxRound = Convert.ToInt32(cfg.round);

        int[] monsterInfos = cfg.monster;
        _monsters = new List <BattleHeroModel> ();

        for (int i = 0; i < monsterInfos.Length; i += 4)
        {
            int id    = Convert.ToInt32(monsterInfos[i]);
            int level = Convert.ToInt32(monsterInfos[i + 1]);

            HeroModel       heroModel = hMgr.createHero(id, level, 0);
            BattleHeroModel bhModel   = new BattleHeroModel();

            int x = Convert.ToInt32(monsterInfos[i + 2]);
            int y = Convert.ToInt32(monsterInfos[i + 3]);
            bhModel.setModel(heroModel, true, new Vector3(x, y, 0));

            _monsters.Add(bhModel);
        }
    }