Exemplo n.º 1
0
    override public void OnSceneLoaded()
    {
        SceneCsvData csvData = GameMgr.Instance.m_csvMgr.mSceneCsv.Lookup(SceneID);

        if (csvData == null)
        {
            Debug.LogError("EctypeScene::OnSceneLoaded sceneCsvData load error id = " + SceneID);
            return;
        }

        GameObject scene = GameMgr.Instance.m_resMgr.LoadResource(csvData.sceneID);

        scene.name = csvData.sceneName;

        EctypeCsvData ectypeCsvData = GameMgr.Instance.m_csvMgr.mEctypeCsv.Lookup((int)EctypeId);

        if (ectypeCsvData == null)
        {
            Debug.LogError(string.Format("EctypeScene::OnSceneLoaded, m_ectypeId={0}", EctypeId));
            return;
        }

        int monsterID        = ectypeCsvData.monsterID; //副本Monster表
        EctypeMonsterCsv csv = GameMgr.Instance.m_csvMgr.MonsterCsvs.Lookup(monsterID);

        if (csv == null)
        {
            Debug.LogError(string.Format("EctypeScene::OnSceneLoaded, monsterID={0}", monsterID));
            return;
        }
        EctypeCreatContext ctx = new EctypeCreatContext();

        ctx.dwEctypeID = EctypeId;
        ctx.sceneID    = SceneID;

        foreach (EctypeMonsterCsvData data in csv.EctypeMonsterDic.Values)
        {
            EntityCreateCtx defenders = new EntityCreateCtx();
            int             enemyID   = data.monsterID;
            defenders.type  = (EntityType)GameMgr.Instance.m_csvMgr.mMonsterCsv.LookUpType(enemyID);
            defenders.id    = enemyID;
            defenders.pos   = new Vector3(2f, 0f, 0f);
            defenders.dir   = Vector3.zero;
            defenders.scene = this;
            defenders.camp  = EntityCamp.Defender;

            ctx.defenderTeam.entityList.Add(defenders);
        }

        EntityCreateCtx attackers = CreateAttacker();

        ctx.attackerTeam.entityList.Add(attackers);

        GameMgr.Instance.m_ectypeMgr.CreateEctype(ctx);
    }
Exemplo n.º 2
0
    public bool OnSchemeLoad(ICsvReader reader)
    {
        int nRowCount = reader.GetRowCount();

        m_ectypeDic.Clear();

        try
        {
            for (int i = 0; i < nRowCount; i++)
            {
                int           j    = 0;
                EctypeCsvData data = new EctypeCsvData();

                reader.GetData(out data.ectypeID, i, j++, "副本ID");
                reader.GetData(out data.sceneID, i, j++, "场景ID");
                reader.GetData(out data.level, i, j++, "等级");
                reader.GetData(out data.ectypeName, i, j++, "名称");
                reader.GetData(out data.monsterID, i, j++, "摆怪ID");

                if (m_ectypeDic.ContainsKey(data.ectypeID))
                {
                    Debug.Log("EctypeCsv::OnSchemeLoad 存在相同的资源包名称 ectypeID=" + data.ectypeID);
                    continue;
                }

                m_ectypeDic.Add(data.ectypeID, data);
            }
        }
        catch (Exception e)
        {
            Debug.Log("EctypeCsv OnSchemeLoad Load Config error.. msg=" + e.Message);
            return(false);
        }

        return(true);
    }