//------------------ // Stage Run //----------------- public void ParserScript( CTextLine line ,cUnitData data_I=null , cUnitData data_E=null ) { List<cTextFunc> funcList =line.GetFuncList(); foreach( cTextFunc func in funcList ) { if( func.sFunc == "POPCHAR" ) { StagePopUnitEvent evt = new StagePopUnitEvent (); evt.eCamp = _CAMP._PLAYER; evt.nCharID = func.I( 0 ); evt.nX = func.I( 1 ); evt.nY = func.I( 2 ); evt.nValue1 = func.I( 3 ); // pop num GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "POPMOB" ) { StagePopUnitEvent evt = new StagePopUnitEvent (); evt.eCamp = _CAMP._ENEMY; evt.nCharID = func.I( 0 ); evt.nX = func.I( 1 ); evt.nY = func.I( 2 ); evt.nValue1 = func.I( 3 ); // pop num //test code GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "POP" ) { StagePopUnitEvent evt = new StagePopUnitEvent (); evt.eCamp = (_CAMP)func.I( 0 ); evt.nCharID = func.I( 1 ); evt.nX = func.I( 2 ); evt.nY = func.I( 3 ); evt.nValue1 = func.I( 4 ); // pop num GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "POPGROUP" ) { StagePopGroupEvent evt = new StagePopGroupEvent (); //evt.eCamp = (_CAMP)func.I( 0 ); evt.nLeaderCharID = func.I( 0 ); evt.nCharID = func.I( 1 ); evt.stX = func.I( 2 ); evt.stY = func.I( 3 ); evt.edX = func.I( 4 ); evt.edY = func.I( 5 ); evt.nPopType = func.I( 6 ); // pop num GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "TALK" ) // open talkui { #if UNITY_EDITOR // return ; #endif int nID = func.I( 0 ); GameSystem.TalkEvent( nID ); } else if( func.sFunc == "BGM" ) { int nID = func.I( 0 ); // change bgm GameSystem.PlayBGM ( nID ); } else if( func.sFunc == "SAY" ) { TalkSayEvent evt = new TalkSayEvent(); //evt.nType = func.I(0); evt.nChar = func.I(0); evt.nSayID = func.I(1); //Say( func.I(0), func.I(1) ); GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "SETCHAR" ) { TalkSetCharEvent evt = new TalkSetCharEvent(); evt.nType = func.I(0); evt.nChar = func.I(1); //Say( func.I(0), func.I(1) ); GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "CHANGEBACK") { } else if( func.sFunc == "SAYEND") { TalkSayEndEvent evt = new TalkSayEndEvent(); //evt.nType = func.I(0); evt.nChar = func.I(0); GameEventManager.DispatchEvent ( evt ); // CloseBox( func.I(0), func.I(1) ); } // stage event else if( func.sFunc == "STAGEBGM") { GameEventManager.DispatchEvent ( new StageBGMEvent() ); } else if( func.sFunc == "ATTACK") // pop a group of mob { StageBattleAttackEvent evt = new StageBattleAttackEvent(); evt.nAtkCharID = func.I(0); evt.nDefCharID = func.I(1); evt.nAtkSkillID = func.I(2); GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "MOVETOUNIT") // pop a group of mob { StageMoveToUnitEvent evt = new StageMoveToUnitEvent(); evt.nAtkCharID = func.I(0); evt.nDefCharID = func.I(1); //evt.nAtkSkillID = func.I(2); GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "DELUNIT") { StageDelUnitEvent evt = new StageDelUnitEvent (); //evt.eCamp = (_CAMP)func.I( 0 ); evt.nCharID = func.I( 0 ); GameEventManager.DispatchEvent ( evt ); } else if( func.sFunc == "WIN") { PanelManager.Instance.OpenUI( Panel_Win.Name ); //Panel_StageUI.Instance.bIsStageEnd = true; } else if( func.sFunc == "LOST") { PanelManager.Instance.OpenUI( Panel_Lost.Name ); //Panel_StageUI.Instance.bIsStageEnd = true; } else { Debug.LogError( string.Format( "Error-Can't find script func '{0}'" , func.sFunc ) ); } } }
List< List<cTextFunc> > CondLst; // multi array. public void Add( CTextLine line ) { if (CondLst == null) CondLst = new List< List<cTextFunc> > (); if (line == null) return; CondLst.Add (line.GetFuncList ()); }
public bool CheckEventCondition( CTextLine line ) { if( line == null ) return false; List<cTextFunc> funcList =line.GetFuncList(); foreach( cTextFunc func in funcList ) { if( func.sFunc == "GO" ) { if( ConditionGO( ) == false ) { return false; } } else if( func.sFunc == "ALLDEAD" ) { if( ConditionAllDead( func.I(0) ) == false ) { return false; } } else if( func.sFunc == "DEAD" ) { if( ConditionUnitDead( func.I(0), func.I(1) ) == false ) { return false; } } else if( func.sFunc == "ROUND" ) { if( ConditionRound( func.I(0) ) == false ) { return false; } } else if( func.sFunc == "AFTER" ) { if( ConditionAfter( func.I(0),func.I(1) ) == false ) { return false; } } else if( func.sFunc == "COMBAT" ) { if( ConditionCombat( func.I(0),func.I(1) ) == false ) { return false; } } else if( func.sFunc == "DIST" ) { if( ConditionDist( func.I(0),func.I(1) ,func.I(2) ) == false ) { return false; } } else if( func.sFunc == "HP" ) { if( ConditionHp( func.I(0), func.S(1) ,func.F(2) ) == false ) { return false; } } else{ Debug.LogError( string.Format( "Error-Can't find script cond func '{0}'" , func.sFunc ) ); } } return true; }