Exemplo n.º 1
0
    public void InitBattleScene()
    {
        FF9StateGlobal FF9 = FF9StateSystem.Common.FF9;

        FF9.charArray.Clear();
        this.btlScene = FF9StateSystem.Battle.FF9Battle.btl_scene = new BTL_SCENE();
        Debug.Log("battleID = " + FF9StateSystem.Battle.battleMapIndex);
        Dictionary <String, Int32> source = FF9BattleDB.SceneData;

        battleSceneName = source.FirstOrDefault(p => p.Value == FF9StateSystem.Battle.battleMapIndex).Key;
        battleSceneName = battleSceneName.Substring(4);
        Debug.Log("battleSceneName = " + battleSceneName);
        this.btlScene.ReadBattleScene(battleSceneName);
        this.StartCoroutine(PersistenSingleton <FF9TextTool> .Instance.UpdateBattleText(FF9BattleDB.SceneData["BSC_" + battleSceneName]));
        WMProfiler.Begin("Start Load Text");
        String battleModelPath = FF9BattleDB.MapModel["BSC_" + battleSceneName];

        FF9StateSystem.Battle.FF9Battle.map.btlBGPtr     = ModelFactory.CreateModel("BattleMap/BattleModel/battleMap_all/" + battleModelPath + "/" + battleModelPath, Vector3.zero, Vector3.zero, true);
        FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = FF9StateSystem.Battle.isDebug ? FF9StateSystem.Battle.patternIndex : (Byte)this.ChoicePattern();
        this.btlSeq = new btlseq();
        this.btlSeq.ReadBattleSequence(battleSceneName);
        BeginInitialize();
        battle.InitBattle();
        EndInitialize();
        if (!FF9StateSystem.Battle.isDebug)
        {
            String            ebFileName        = "EVT_BATTLE_" + battleSceneName;
            FF9StateBattleMap ff9StateBattleMap = FF9StateSystem.Battle.FF9Battle.map;
            ff9StateBattleMap.evtPtr = EventEngineUtils.loadEventData(ebFileName, "Battle/");
            PersistenSingleton <EventEngine> .Instance.StartEvents(ff9StateBattleMap.evtPtr);

            PersistenSingleton <EventEngine> .Instance.eTb.InitMessage();
        }
        this.CreateBattleData(FF9);
        if (battleSceneName == "EF_E006" || battleSceneName == "EF_E007")
        {
            BTL_DATA btlData1 = FF9StateSystem.Battle.FF9Battle.btl_data[4];
            BTL_DATA btlData2 = FF9StateSystem.Battle.FF9Battle.btl_data[5];
            this.GeoBattleAttach(btlData2.gameObject, btlData1.gameObject, 55);
            btlData2.attachOffset = 100;
        }
        FF9StateBattleSystem stateBattleSystem = FF9StateSystem.Battle.FF9Battle;
        GEOTEXHEADER         geotexheader      = new GEOTEXHEADER();

        geotexheader.ReadBGTextureAnim(battleModelPath);
        stateBattleSystem.map.btlBGTexAnimPtr = geotexheader;
        BBGINFO bbginfo = new BBGINFO();

        bbginfo.ReadBattleInfo(battleModelPath);
        FF9StateSystem.Battle.FF9Battle.map.btlBGInfoPtr = bbginfo;
        btlshadow.ff9battleShadowInit(13);
        battle.InitBattleMap();
        this.seqList = new List <Int32>();
        SB2_PATTERN sb2Pattern = this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum];

        Int32[] numArray = new Int32[sb2Pattern.MonCount];
        for (Int32 index = 0; index < (Int32)sb2Pattern.MonCount; ++index)
        {
            numArray[index] = sb2Pattern.Put[index].TypeNo;
        }
        foreach (Int32 num in numArray.Distinct().ToArray())
        {
            for (Int32 index1 = 0; index1 < this.btlSeq.sequenceProperty.Length; ++index1)
            {
                SequenceProperty sequenceProperty = this.btlSeq.sequenceProperty[index1];
                if (sequenceProperty.Montype == num)
                {
                    for (Int32 index2 = 0; index2 < sequenceProperty.PlayableSequence.Count; ++index2)
                    {
                        this.seqList.Add(sequenceProperty.PlayableSequence[index2]);
                    }
                }
            }
        }
        this.btlIDList          = FF9StateSystem.Battle.FF9Battle.seq_work_set.AnmOfsList.Distinct().ToArray();
        this.battleState        = BattleState.PlayerTurn;
        playerEnterCommand      = false;
        this.playerCastingSkill = false;
        this.enemyEnterCommand  = false;
    }
Exemplo n.º 2
0
    public void InitBattleScene()
    {
        FF9StateGlobal ff = FF9StateSystem.Common.FF9;

        ff.charArray.Clear();
        this.btlScene = (FF9StateSystem.Battle.FF9Battle.btl_scene = new BTL_SCENE());
        global::Debug.Log("battleID = " + FF9StateSystem.Battle.battleMapIndex);
        HonoluluBattleMain.battleSceneName = FF9BattleDB.SceneData.FirstOrDefault((KeyValuePair <string, int> x) => x.Value == FF9StateSystem.Battle.battleMapIndex).Key;
        HonoluluBattleMain.battleSceneName = HonoluluBattleMain.battleSceneName.Substring(4);
        global::Debug.Log("battleSceneName = " + HonoluluBattleMain.battleSceneName);
        this.btlScene.ReadBattleScene(HonoluluBattleMain.battleSceneName);
        base.StartCoroutine(PersistenSingleton <FF9TextTool> .Instance.UpdateBattleText(FF9BattleDB.SceneData["BSC_" + HonoluluBattleMain.battleSceneName]));
        WMProfiler.Begin("Start Load Text");
        string text = FF9BattleDB.MapModel["BSC_" + HonoluluBattleMain.battleSceneName];
        string path = "BattleMap/BattleModel/battleMap_all/" + text + "/" + text;

        FF9StateSystem.Battle.FF9Battle.map.btlBGPtr = ModelFactory.CreateModel(path, Vector3.zero, Vector3.zero, true);
        checked {
            if (!FF9StateSystem.Battle.isDebug)
            {
                FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = (byte)this.ChoicePattern();
            }
            else
            {
                FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = FF9StateSystem.Battle.patternIndex;
            }
            this.btlSeq = new btlseq();
            this.btlSeq.ReadBattleSequence(HonoluluBattleMain.battleSceneName);
            FF9StateSystem.Battle.FF9Battle.attr = 0;
            battle.InitBattle();
            FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle;
            ff9Battle.attr |= 1;
            if (!FF9StateSystem.Battle.isDebug)
            {
                string            ebFileName = "EVT_BATTLE_" + HonoluluBattleMain.battleSceneName;
                FF9StateBattleMap map        = FF9StateSystem.Battle.FF9Battle.map;
                map.evtPtr = EventEngineUtils.loadEventData(ebFileName, EventEngineUtils.ebSubFolderBattle);
                PersistenSingleton <EventEngine> .Instance.StartEvents(map.evtPtr);

                PersistenSingleton <EventEngine> .Instance.eTb.InitMessage();
            }
            this.CreateBattleData(ff);
            if (HonoluluBattleMain.battleSceneName == "EF_E006" || HonoluluBattleMain.battleSceneName == "EF_E007")
            {
                BTL_DATA btl_DATA  = FF9StateSystem.Battle.FF9Battle.btl_data[4];
                BTL_DATA btl_DATA2 = FF9StateSystem.Battle.FF9Battle.btl_data[5];
                this.GeoBattleAttach(btl_DATA2.gameObject, btl_DATA.gameObject, 55);
                btl_DATA2.attachOffset = 100;
            }
            FF9StateBattleSystem ff9Battle2   = FF9StateSystem.Battle.FF9Battle;
            GEOTEXHEADER         geotexheader = new GEOTEXHEADER();
            geotexheader.ReadBGTextureAnim(text);
            ff9Battle2.map.btlBGTexAnimPtr = geotexheader;
            BBGINFO bbginfo = new BBGINFO();
            bbginfo.ReadBattleInfo(text);
            FF9StateSystem.Battle.FF9Battle.map.btlBGInfoPtr = bbginfo;
            btlshadow.ff9battleShadowInit(13);
            battle.InitBattleMap();
            this.seqList = new List <int> ();
            SB2_PATTERN sb2_PATTERN = this.btlScene.PatAddr[(int)FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum];
            int[]       array       = new int[(int)sb2_PATTERN.MonCount];
            for (int i = 0; i < (int)sb2_PATTERN.MonCount; i++)
            {
                array[i] = (int)sb2_PATTERN.Put[i].TypeNo;
            }
            array = array.Distinct <int> ().ToArray <int> ();
            for (int j = 0; j < array.Length; j++)
            {
                for (int k = 0; k < this.btlSeq.sequenceProperty.Length; k++)
                {
                    SequenceProperty sequenceProperty = this.btlSeq.sequenceProperty[k];
                    if (sequenceProperty.Montype == array[j])
                    {
                        for (int l = 0; l < sequenceProperty.PlayableSequence.Count; l++)
                        {
                            this.seqList.Add(sequenceProperty.PlayableSequence[l]);
                        }
                    }
                }
            }
            this.btlIDList   = FF9StateSystem.Battle.FF9Battle.seq_work_set.AnmOfsList.Distinct <byte> ().ToArray <byte> ();
            this.battleState = HonoluluBattleMain.BattleState.PlayerTurn;
            HonoluluBattleMain.playerEnterCommand = false;
            this.playerCastingSkill = false;
            this.enemyEnterCommand  = false;
        }
    }