// public void SetData( cUnitData data , _SKILL_TYPE eType ) { if ( eType != _SKILL_TYPE._SKILL && eType != _SKILL_TYPE._ABILITY ) { return ; // don't change data } ClearData (); eSkillType = eType; // nOpIdent = data.n_Ident; nOpCharID = data.n_CharID; pData = data; DataTable pTable = ConstDataManager.Instance.GetTable < SKILL > (); if (pTable == null) return; List< SKILL > sklLst = new List< SKILL > (); if (eType == _SKILL_TYPE._SKILL) { foreach( KeyValuePair< int , cSkillData > pair in pData.SkillPool ){ SKILL skl = pair.Value.skill; if( skl.n_SCHOOL == 0 ) // == 0 is ability continue; if( skl.n_PASSIVE == 1 ) continue; sklLst.Add( skl ); } // int ISch = pData.nActSch [0]; // int ESch = pData.nActSch [1]; // int ELv = pData.GetSchoolLv (ESch); // // foreach( SKILL skl in pTable ) // { // if( skl.n_SCHOOL == 0 ) // == 0 is ability // continue; // // if( skl.n_PASSIVE == 1 ) // continue; // // // normal // if( skl.n_SCHOOL != ESch ) // continue; // // // cheat code for god // if( Config.GOD ){ // sklLst.Add( skl ); // continue; // } // // if( skl.n_LEVEL_LEARN > ELv ) // continue; // // sklLst.Add( skl ); // } } else if (eType == _SKILL_TYPE._ABILITY ) { int CLv = pData.n_Lv; foreach( KeyValuePair< int , int > pair in pData.AbilityPool ) { SKILL skl = ConstDataManager.Instance.GetRow< SKILL >( pair.Key ) ; if( skl == null ) continue; if( skl.n_SCHOOL > 0 ) // > 0 is school continue; if( skl.n_PASSIVE == 1 ) continue; if( Config.GOD ){ sklLst.Add( skl ); continue; } if( CLv < pair.Value ) continue; sklLst.Add( skl ); } // foreach( SKILL skl in pTable ) // { // if( skl.n_SCHOOL > 0 ) // > 0 is school // continue; // if( skl.n_PASSIVE == 1 ) // continue; // // if( Config.GOD ){ // sklLst.Add( skl ); // continue; // } // // check char have this ability // // if( pData.AbilityPool.ContainsKey( skl.n_ID ) == false ){ // continue; // } // // if( skl.n_LEVEL_LEARN > CLv ) // continue; // // sklLst.Add( skl ); // } } // Create UI item foreach( SKILL skl in sklLst ) { // add this skill GameObject go = ResourcesManager.CreatePrefabGameObj( SkillGrid , "Prefab/Item_Skill" ); if( go == null ) continue; Item_Skill item = go.GetComponent<Item_Skill> (); item.SetItemData( MyTool.GetSkillName( skl.n_ID ) , skl.n_RANGE , skl.n_MP ); item.SetScrollView( ScrollView ); // UIEventListener.Get(go).onClick += OnSkillClick; // for trig next line UIEventListener.Get(go).onPress += OnSkillPress; // sklPool.Add( go , skl ); } // default to 1 st skill SetSkill (null); //foreach (KeyValuePair<GameObject , SKILL> pair in sklPool) { // SetSkill( pair.Value ); // set to first // break; //} // for grid re pos UIGrid grid = SkillGrid.GetComponent<UIGrid>(); grid.repositionNow = true; // need this for second pop to re pos //CastNote.SetActive( false ); }
public static Panel_Skill OpenUI( int nIdent , _SKILL_TYPE eType ) { cUnitData data = GameDataManager.Instance.GetUnitDateByIdent ( nIdent ); if (data == null) return null; GameObject go = PanelManager.Instance.OpenUI (Name ); if (go == null) return null; Panel_Skill pUI = MyTool.GetPanel<Panel_Skill>( go ); pUI.SetData( data , eType ); return pUI; }