11using System . Collections . Generic ;
22using System . Linq ;
33using UnityEngine ;
4- using UnityEngine . Serialization ;
54using UnityEngine . UIElements ;
65
76[ System . Serializable ]
@@ -10,9 +9,7 @@ public class SkillTab : L2Tab
109 public enum SkillTabType { ACTIVE , PASSIVE }
1110
1211 [ SerializeField ] private SkillTabType _tabType ;
13- private SkillSlot [ ] _skillSlots ;
1412 private VisualElement _contentContainer ;
15- private short skillSlotIx ;
1613
1714 public override void Initialize ( L2TabView tabView , VisualElement tabContainer , VisualElement tabHeader )
1815 {
@@ -22,25 +19,14 @@ public override void Initialize(L2TabView tabView, VisualElement tabContainer, V
2219
2320 public void UpdateSkills ( List < SkillWindowInfo > [ ] skills )
2421 {
25- if ( _skillSlots != null )
26- {
27- foreach ( SkillSlot slot in _skillSlots )
28- {
29- slot . UnregisterClickableCallback ( ) ;
30- slot . ClearManipulators ( ) ;
31- }
32- }
33-
34- skillSlotIx = 0 ;
3522 _contentContainer . Clear ( ) ;
23+
3624 if ( _tabType == SkillTabType . PASSIVE )
3725 {
38- _skillSlots = new SkillSlot [ skills [ 1 ] . Count ] ;
3926 ShowPassiveSkills ( skills [ 1 ] ) ;
4027 }
4128 else if ( _tabType == SkillTabType . ACTIVE )
4229 {
43- _skillSlots = new SkillSlot [ skills [ 0 ] . Count ] ;
4430 ShowActiveSkills ( skills [ 0 ] ) ;
4531 }
4632 }
@@ -83,31 +69,31 @@ private void ShowPassiveSkills(List<SkillWindowInfo> skills)
8369
8470 if ( equipmentSkills . Any ( ) )
8571 {
86- VisualElement section = AddSection ( equipmentSkills , "Equipment Skills" ) ;
72+ VisualElement section = AddSection ( equipmentSkills , SysStringTable . Instance . GetSysString ( 1702 ) . Name ) ;
8773 _contentContainer . Add ( section ) ;
8874 }
8975
9076 if ( abilitySkills . Any ( ) )
9177 {
92- VisualElement section = AddSection ( abilitySkills , "Ability Skills" ) ;
78+ VisualElement section = AddSection ( abilitySkills , SysStringTable . Instance . GetSysString ( 1703 ) . Name ) ;
9379 _contentContainer . Add ( section ) ;
9480 }
9581
9682 if ( clanHeroMentoringSkills . Any ( ) )
9783 {
98- VisualElement section = AddSection ( clanHeroMentoringSkills , "Clan/Hero/Mentoring Skills" ) ;
84+ VisualElement section = AddSection ( clanHeroMentoringSkills , SysStringTable . Instance . GetSysString ( 1699 ) . Name ) ;
9985 _contentContainer . Add ( section ) ;
10086 }
10187
10288 if ( itemSkills . Any ( ) )
10389 {
104- VisualElement section = AddSection ( itemSkills , "Item Skills" ) ;
90+ VisualElement section = AddSection ( itemSkills , SysStringTable . Instance . GetSysString ( 1700 ) . Name ) ;
10591 _contentContainer . Add ( section ) ;
10692 }
10793
10894 if ( raceSkills . Any ( ) )
10995 {
110- VisualElement section = AddSection ( raceSkills , "Race Skills" ) ;
96+ VisualElement section = AddSection ( raceSkills , SysStringTable . Instance . GetSysString ( 1704 ) . Name ) ;
11197 _contentContainer . Add ( section ) ;
11298 }
11399 }
@@ -174,42 +160,42 @@ private void ShowActiveSkills(List<SkillWindowInfo> skills)
174160
175161 if ( physicalSkills . Any ( ) )
176162 {
177- VisualElement section = AddSection ( physicalSkills , "Physical Skills" ) ;
163+ VisualElement section = AddSection ( physicalSkills , SysStringTable . Instance . GetSysString ( 1694 ) . Name ) ;
178164 _contentContainer . Add ( section ) ;
179165 }
180166 if ( magicSkills . Any ( ) )
181167 {
182- VisualElement section = AddSection ( magicSkills , "Magical Skills" ) ;
168+ VisualElement section = AddSection ( magicSkills , SysStringTable . Instance . GetSysString ( 1695 ) . Name ) ;
183169 _contentContainer . Add ( section ) ;
184170 }
185171 if ( reinforcementSkills . Any ( ) )
186172 {
187- VisualElement section = AddSection ( reinforcementSkills , "Reinforcement Skills" ) ;
173+ VisualElement section = AddSection ( reinforcementSkills , SysStringTable . Instance . GetSysString ( 1696 ) . Name ) ;
188174 _contentContainer . Add ( section ) ;
189175 }
190176 if ( weakenSkills . Any ( ) )
191177 {
192- VisualElement section = AddSection ( weakenSkills , "Weaken Skills" ) ;
178+ VisualElement section = AddSection ( weakenSkills , SysStringTable . Instance . GetSysString ( 1697 ) . Name ) ;
193179 _contentContainer . Add ( section ) ;
194180 }
195181 if ( clanHeroMentoringSkills . Any ( ) )
196182 {
197- VisualElement section = AddSection ( clanHeroMentoringSkills , "Clan/Hero/Mentoring Skills" ) ;
183+ VisualElement section = AddSection ( clanHeroMentoringSkills , SysStringTable . Instance . GetSysString ( 1699 ) . Name ) ;
198184 _contentContainer . Add ( section ) ;
199185 }
200186 if ( itemSkills . Any ( ) )
201187 {
202- VisualElement section = AddSection ( itemSkills , "Item Skills" ) ;
188+ VisualElement section = AddSection ( itemSkills , SysStringTable . Instance . GetSysString ( 1700 ) . Name ) ;
203189 _contentContainer . Add ( section ) ;
204190 }
205191 if ( toggleSkills . Any ( ) )
206192 {
207- VisualElement section = AddSection ( toggleSkills , "Toggle Skills" ) ;
193+ VisualElement section = AddSection ( toggleSkills , SysStringTable . Instance . GetSysString ( 1698 ) . Name ) ;
208194 _contentContainer . Add ( section ) ;
209195 }
210196 if ( transformSkills . Any ( ) )
211197 {
212- VisualElement section = AddSection ( transformSkills , "Transform Skills" ) ;
198+ VisualElement section = AddSection ( transformSkills , SysStringTable . Instance . GetSysString ( 1701 ) . Name ) ;
213199 _contentContainer . Add ( section ) ;
214200 }
215201 }
@@ -220,59 +206,23 @@ public VisualElement AddSection(List<SkillWindowInfo> skills, string name)
220206 section . Q < Label > ( "SkillsSectionHeaderLabel" ) . text = name ;
221207 VisualElement sectionContainer = section . Q < VisualElement > ( "SkillsSectionBarContainer" ) ;
222208
223- //TODO: Use L2SlotContainers
224-
225209 // maybe use onclick on whole header
226210 Button btn = section . Q < Button > ( "PlusMinusBtn" ) ;
227211 btn . RegisterCallback < ClickEvent > ( HandleSlotClick , TrickleDown . TrickleDown ) ;
228212
229- // for (var i = 0; i < skills.Count; ++i)
230- // {
231- // VisualElement slotElement = L2SlotManager.Instance.SkillSlotTemplate.Instantiate()[0];
232- // SkillSlot skillSlot = new SkillSlot(i, slotElement, L2Slot.SlotType.Skill);
233- // _skillSlots[skillSlotIx++] = skillSlot;
234- // skillSlot.AssignSkill(skills[i]);
235- // sectionContainer.Add(slotElement);
236- // }
237-
238- // int rowLength = 6;
239- // int padSlot = 0;
240- // if (skills.Count < 8 * rowLength)
241- // {
242- // padSlot = 8 * rowLength - skills.Count;
243- // }
244- // else if (skills.Count % rowLength != 0)
245- // {
246- // padSlot = rowLength - skills.Count % rowLength;
247- // }
248-
249- // for (int i = 0; i < padSlot; i++)
250- // {
251- // VisualElement slotElement = L2SlotManager.Instance.SkillSlotTemplate.Instantiate()[0];
252- // slotElement.AddToClassList("skillbar-slot.empty");
253- // // slotElement.AddToClassList("disabled");
254- // sectionContainer.Add(slotElement);
255- // }
256- // return section;
257-
258213 L2SlotContainer basicSlotContainer = new L2SlotContainer ( ) ;
259214 basicSlotContainer . Initialize ( sectionContainer , 6 , 6 ) ;
260215 basicSlotContainer . CreateSlots ( skills . Count , L2Slot . SlotType . Skill ) ;
261216
262217 for ( var i = 0 ; i < skills . Count ; ++ i )
263218 {
264219 basicSlotContainer . AssignSkill ( i , skills [ i ] ) ;
220+ SkillWindow . Instance . AddSlot ( basicSlotContainer . Slots [ i ] ) ;
265221 }
266222
267223 return section ;
268224 }
269225
270- public override void SelectSlot ( int slotPosition )
271- {
272- // use skill
273-
274- }
275-
276226 private void HandleSlotClick ( ClickEvent evt )
277227 {
278228 ToggleShrink ( ( VisualElement ) evt . currentTarget ) ;
0 commit comments