void Awake(){ m_idToObj = new Dictionary<int, SRW_TextBox > (); // m_cTextList = new List<string> (); m_cScript = new cTextArray (); nTweenObjCount = 0; UIEventListener.Get(this.gameObject).onClick += OnPanelClick; // for trig next line UIEventListener.Get(Skip_Button).onClick += OnSkipClick; // for trig next line // templete TalkWindow_Up.SetActive( false ); TalkWindow_Down.SetActive( false ); // TalkWindow_new.SetActive( false ); // m_idToObj.Add( 0 , TalkWindow_Up ); // m_idToObj.Add( 1 , TalkWindow_Down ); // for fast debug //ConstDataManager.Instance.isLazyMode = false; //StartCoroutine(ConstDataManager.Instance.ReadDataStreaming("pcz/", Config.COMMON_DATA_NAMES)); // cmd event GameEventManager.AddEventListener( TalkSayEvent.Name , OnTalkSayEvent ); GameEventManager.AddEventListener( TalkSetCharEvent.Name , OnTalkSetCharEvent ); GameEventManager.AddEventListener( TalkSayEndEvent.Name , OnTalkSayEndEvent ); // CharSay( 1 , 9 ); // cause some mob pop in talk event. player can't skip talk event to avoid bug // NGUITools.SetActive( Skip_Button , false ); //#if UNITY_EDITOR // NGUITools.SetActive( Skip_Button , true ); //#endif }
public void SetContData( CHARS cData ) { //n_CharID = cData.n_ID; cCharData = cData; if (n_CharID != cData.n_ID) { Debug.LogErrorFormat ("cUnitData{0} set wrong SetContData{1}", n_CharID, cData.n_ID); } n_Rank = cData.n_RANK; // set school; SkillPool.Clear (); cTextArray TA = new cTextArray (); TA.SetText (cData.s_SCHOOL); for (int i = 0; i < TA.GetMaxCol(); i++) { CTextLine line = TA.GetTextLine (i); for (int j = 0; j < line.GetRowNum(); j++) { string s = line.m_kTextPool [j]; string [] arg = s.Split (",".ToCharArray ()); if (arg [0] != null) { int school = int.Parse (arg [0]); int lv = 1; if (arg [1] != null) { lv = int.Parse (arg [1]); } SetSchool (school, lv); } } } // set Ability TA.SetText (cData.s_ABILITY); for (int i = 0; i < TA.GetMaxCol(); i++) { CTextLine line = TA.GetTextLine (i); for (int j = 0; j < line.GetRowNum(); j++) { string s = line.m_kTextPool [j]; string [] arg = s.Split (",".ToCharArray ()); if (arg [0] != null) { int ability = int.Parse (arg [0]); int lv = 1; if (arg [1] != null) { lv = int.Parse (arg [1]); } SetAbility (ability, lv); //SetSchool( school , lv ); } } } //Set born Buff if (cData.s_BUFF != "0" && cData.s_BUFF.ToUpper() != "NULL") { string [] strBorn = cData.s_BUFF.Split(";".ToCharArray()); for( int i= 0 ; i <strBorn.Length; i++ ) { int nBuffID = 0; if( int.TryParse( strBorn[i] , out nBuffID ) ){ Buffs.AddBuff( nBuffID , n_Ident , 0 , 0 ); } } } // set up item if (cData.n_ITEM1 > 0) { EquipItem( _ITEMSLOT._SLOT0 , cData.n_ITEM1 ) ; } if (cData.n_ITEM2 > 0) { EquipItem( _ITEMSLOT._SLOT1 , cData.n_ITEM2 ) ; } // active school ChangeSchool( cData.n_INT_SCHOOL ); ChangeSchool( cData.n_EXT_SCHOOL ); //AvtiveSchool (0, cData.n_INT_SCHOOL); //AvtiveSchool (1, cData.n_EXT_SCHOOL); // fill base data; Relive(); }
// IEnumerator StoryLoading() // { // // Custom Update Routine which repeats forever // do // { // // wait one frame and continue // yield return 1; // // if ( bIsLoading == false ) // { // // end // PanelManager.Instance.CloseUI( "Panel_Loading"); // yield break; // } // // } while (true); // } // Use this for initialization void Start () { Debug.Log("StoryUIPanel:start"); //StartCoroutine("StoryLoading"); // load const stage data // 播放 mian BGM m_StoryData =ConstDataManager.Instance.GetRow< STAGE_STORY> ( GameDataManager.Instance.nStoryID ); if( m_StoryData != null ) { GameSystem.PlayBGM ( m_StoryData.n_BGM ); m_cScript = new cTextArray( ); m_cScript.SetText( m_StoryData.s_CONTEXT ); } // close prefab face SRW_TextBox pBox = PanelStoryText.GetComponent<SRW_TextBox>(); if (pBox != null) { pBox.ChangeFace( 0 ); } bIsLoading = false; // end PanelManager.Instance.CloseUI( "Panel_Loading"); }
public cEffectCondition CreateEffectCondition( string str ) { cEffectCondition pCon = new cEffectCondition (); cTextArray sCond = new cTextArray( ); sCond.SetText( str ); int nCol = sCond.GetMaxCol(); for (int i= 0; i <nCol; i++) { CTextLine line = sCond.GetTextLine (i); //List<cTextFunc> funcList = line.GetFuncList (); pCon.Add( line ); } return pCon; }
// Check skill trig effect // public bool CheckSkillCond( string strCond , cUnitData unit_i , cUnitData unit_e ) // { // if ( unit_i == null ) // return false; // // //cUnitData unit_e = GameDataManager.Instance.GetUnitDateByIdent ( unit.FightAttr.TarIdent ); // // cTextArray sCond = new cTextArray( ); // sCond.SetText( strCond ); // // check all line . if one line success . this event check return true // // int nCol = sCond.GetMaxCol(); // for( int i= 0 ; i <nCol ; i++ ) // { // if( CheckFightEventCondition( sCond.GetTextLine( i ) , unit_i , unit_e ) ) // { // return true; // } // } // return false; // } // public void RunSkillEffect( cUnitData atker , cUnitData defer , string strEffect , ref List<cHitResult> pool ) // { // if (atker == null ) // return; // // //cUnitData unit_e = GameDataManager.Instance.GetUnitDateByIdent ( unit.FightAttr.TarIdent ); // cTextArray Script = new cTextArray (); // Script.SetText (strEffect); // // CacheHitResultPool = pool; // // CTextLine line = Script.GetTextLine( 0 ); // if( line != null ) // { // // ParserScript( line , atker , defer ); // } // // CacheHitResultPool = null; // // } // public bool CheckFightEventCondition( CTextLine line, cUnitData data_I , cUnitData data_E ) // { // if( line == null || data_I == null ) // return false; // // List<cTextFunc> funcList =line.GetFuncList(); // foreach( cTextFunc func in funcList ) // { // if( func.sFunc == "GO" ) // { // return true; // } // // if( func.sFunc == "HP_I" ) // { // // return false; // } // else if( func.sFunc == "HP_E" ) // { // // return false; // } // else if( func.sFunc == "MAR_I" ) // { // float f1 = data_I.GetMar(); // float f2 = 0.0f; // if( func.S( 1 ) == "E" ) // { // if( data_E != null ){ // f2 = data_E.GetMar(); // }else{ // return false; // no enemy is false // } // } // else{ // f2 = func.F( 1 ); // } // // if( ConditionFloat( f1 , func.S(0) ,f2 ) == false ){ // return false; // } // } // else if( func.sFunc == "MAR_E" ) // { // // return false; // } // else if( func.sFunc == "BUFF_I" ) // { // // return false; // } // else if( func.sFunc == "BUFF_E" ) // { // // return false; // } // else if( func.sFunc == "SCHOOL_I" ) // { // // return false; // } // else if( func.sFunc == "SCHOOL_E" ) // { // // return false; // } // else if( func.sFunc == "SKILL_I" ) // { // // return false; // } // else if( func.sFunc == "SKILL_E" ) // { // // return false; // } // else if( func.sFunc == "RANGE_E" ) // { // // return false; // } // else{ // Debug.LogError( string.Format( "Error-Can't find script cond func '{0}'" , func.sFunc ) ); // } // } // return true; // } public List< cEffect > CreateEffectPool( string str ) { List< cEffect > pool = new List< cEffect > (); cTextArray sEff = new cTextArray( ); sEff.SetText( str ); // check all line . if one line success . this event check return true int nCol = sEff.GetMaxCol(); for( int i= 0 ; i <nCol ; i++ ) { CTextLine line = sEff.GetTextLine( i ); List<cTextFunc> funcList = line.GetFuncList(); foreach( cTextFunc func in funcList ) { // Fight Effect if( func.sFunc == "ADDBUFF_E") { int nBuffID = func.I(0); pool.Add( new ADDBUFF_E( nBuffID ) ); // CacheHitResultPool.Add( new cHitResult(cHitResult._TYPE._ADDBUFF , data_E.n_Ident , nBuffID ) ); } else if( func.sFunc == "ADDBUFF_I") { int nBuffID = func.I(0); pool.Add( new ADDBUFF_I( nBuffID ) ); // CacheHitResultPool.Add( new cHitResult(cHitResult._TYPE._ADDBUFF , data_I.n_Ident , nBuffID ) ); } // Attr else if( func.sFunc == "ADD_MAR") { pool.Add( new ADD_MAR( func.F(0) ) ); } else if( func.sFunc == "ADD_MAR_DIFF") { pool.Add( new ADD_MAR_DIFF( func.F(0) ) ); } else if( func.sFunc == "ADD_ATTACK_DIFF") { pool.Add( new ADD_ATTACK_DIFF( func.F(0) ) ); } else if( func.sFunc == "ADD_ATTACK") { pool.Add( new ADD_ATTACK( func.I(0) ) ); } else if( func.sFunc == "ADD_DEF") { pool.Add( new ADD_DEF( func.I(0) ) ); } else if( func.sFunc == "ADD_POWER") { pool.Add( new ADD_POWER( func.I(0) ) ); } else if( func.sFunc == "ADD_HP") { pool.Add( new ADD_HP( func.I(0) ) ); } else if( func.sFunc == "ADD_MP") { pool.Add( new ADD_MP( func.I(0) ) ); } else if( func.sFunc == "ADD_SP") { pool.Add( new ADD_SP( func.I(0) ) ); } else if( func.sFunc == "MUL_DROP") { pool.Add( new MUL_DROP( func.F(0) ) ); } else if( func.sFunc == "MUL_BRUST") { pool.Add( new MUL_BRUST( func.F(0) ) ); } else if( func.sFunc == "MUL_DAMAGE") { pool.Add( new MUL_DAMAGE( func.F(0) ) ); } else if( func.sFunc == "MUL_ATTACK") { pool.Add( new MUL_ATTACK( func.F(0) ) ); } else if( func.sFunc == "MUL_DEF") { pool.Add( new MUL_DEF( func.F(0) ) ); } else if( func.sFunc == "MUL_POWER"){ pool.Add( new MUL_POWER( func.F(0) ) ); } else if( func.sFunc == "MUL_MPCOST") { pool.Add( new MUL_MPCOST( func.F(0) ) ); } else if( func.sFunc == "ADD_MOVE") { pool.Add( new ADD_MOVE( func.I(0) ) ); // CacheHitResultPool.Add( new cHitResult(cHitResult._TYPE._ADDBUFF , data_I.n_Ident , nBuffID ) ); } } } return pool; }
// Check event bool CheckEventCanRun( STAGE_EVENT evt ) { cTextArray sCond = new cTextArray( ); sCond.SetText( evt.s_CONDITION ); // check all line . if one line success . this event check return true int nCol = sCond.GetMaxCol(); for( int i= 0 ; i <nCol ; i++ ) { if( CheckEventCondition( sCond.GetTextLine( i ) ) ) { return true; } } return false; }
// tool func to get aoe affect pool public List < iVec2 > GetAOEPool( int nX , int nY , int nAoe ) { iVec2 st = new iVec2 ( nX , nY ); Dictionary< string , iVec2 > tmp = new Dictionary< string , iVec2 >(); tmp.Add ( st.GetKey() , st ); // pool.Add ( st ); AOE aoe = ConstDataManager.Instance.GetRow<AOE> ( nAoe ) ; if (aoe != null) { // add extra first cTextArray TA = new cTextArray(); TA.SetText ( aoe.s_EXTRA ); for( int i = 0 ; i < TA.GetMaxCol(); i++ ) { CTextLine line = TA.GetTextLine( i ); for( int j = 0 ; j < line.GetRowNum() ; j++ ) { string s = line.m_kTextPool[ j ]; string [] arg = s.Split( ",".ToCharArray() ); if( arg.Length < 2 ) continue; if( arg[0] != null && arg[1] != null ) { int x = int.Parse( arg[0] ); int y = int.Parse( arg[1] ); iVec2 v = st.MoveXY( x , y ); if( Grids.Contain( v ) == false ) continue; string key = v.GetKey(); if( tmp.ContainsKey( key ) == false ){ tmp.Add( key , v ); } } } } // get range pool List<iVec2> r = Grids.GetRangePool( st , aoe.n_MAX , aoe.n_MIN ); } List < iVec2 > pool = new List < iVec2 > (); return pool; }
void PreEcecuteEvent( ) { if( NextEvent == null ){ return ; } //========== IsEventEnd = false; // record event script m_cScript = new cTextArray( ); m_cScript.SetText( NextEvent.s_BEHAVIOR ); m_nFlowIdx = 0; //NextLine(); // script to run }