@@ -451,13 +451,38 @@ private void BtnSave_Click(object sender, EventArgs e)
451
451
}
452
452
}
453
453
454
+ private void TabEquips_Selected ( object sender , TabControlEventArgs e )
455
+ {
456
+ Tab_Selected ( sender , e . TabPage ) ;
457
+ }
458
+
459
+ private void TabUse_Selected ( object sender , TabControlEventArgs e )
460
+ {
461
+ Tab_Selected ( sender , e . TabPage ) ;
462
+ }
463
+
464
+ private void TabSetup_Selected ( object sender , TabControlEventArgs e )
465
+ {
466
+ Tab_Selected ( sender , e . TabPage ) ;
467
+ }
468
+
469
+ private void TabControlMain_SelectedIndexChanged ( object sender , EventArgs e )
470
+ {
471
+ TabPage root = TabControlMain . SelectedTab ;
472
+ object control = root . Controls [ 0 ] ;
473
+ if ( control is TabControl tab )
474
+ Tab_Selected ( sender , tab . SelectedTab ) ;
475
+ else
476
+ Tab_Selected ( sender , root ) ;
477
+ }
478
+
454
479
private void MainForm_Load ( object sender , EventArgs e )
455
480
{
456
481
GridIOUtility . ImportGrid ( "equips/Hairs.bin" , GridEHairs , AddGridRow ) ;
457
482
}
458
483
#endregion
459
484
460
- private void TabEquips_Selected ( object sender , TabControlEventArgs e )
485
+ private void Tab_Selected ( object sender , TabPage tab )
461
486
{
462
487
FieldInfo [ ] fields = GetType ( ) . GetFields ( BindingFlags . NonPublic | BindingFlags . Instance ) ;
463
488
foreach ( FieldInfo field in fields )
@@ -468,8 +493,20 @@ private void TabEquips_Selected(object sender, TabControlEventArgs e)
468
493
GC . Collect ( ) ;
469
494
GC . WaitForPendingFinalizers ( ) ;
470
495
}
471
- if ( field . Name . Equals ( e . TabPage . Name ) )
472
- GridIOUtility . ImportGrid ( string . Format ( "equips/{0}.bin" , e . TabPage . Text ) , ( DataGridView ) e . TabPage . Controls [ 0 ] , AddGridRow ) ;
496
+ if ( field . Name . Equals ( tab . Name ) )
497
+ {
498
+ int mainSelectedIndex = TabControlMain . SelectedIndex ;
499
+ if ( mainSelectedIndex == 0 )
500
+ GridIOUtility . ImportGrid ( string . Format ( "Equips/{0}.bin" , tab . Text ) , ( DataGridView ) tab . Controls [ 0 ] , AddGridRow ) ;
501
+ else if ( mainSelectedIndex == 1 )
502
+ GridIOUtility . ImportGrid ( string . Format ( "Use/{0}.bin" , tab . Text ) , ( DataGridView ) tab . Controls [ 0 ] , AddGridRow ) ;
503
+ else if ( mainSelectedIndex == 2 )
504
+ GridIOUtility . ImportGrid ( string . Format ( "Setup/{0}.bin" , tab . Text ) , ( DataGridView ) tab . Controls [ 0 ] , AddGridRow ) ;
505
+ else if ( mainSelectedIndex == 3 )
506
+ GridIOUtility . ImportGrid ( string . Format ( "Etc/{0}.bin" , tab . Text ) , ( DataGridView ) tab . Controls [ 0 ] , AddGridRow ) ;
507
+ else if ( mainSelectedIndex == 4 )
508
+ GridIOUtility . ImportGrid ( string . Format ( "Cash/{0}.bin" , tab . Text ) , ( DataGridView ) tab . Controls [ 0 ] , AddGridRow ) ;
509
+ }
473
510
}
474
511
}
475
512
}
0 commit comments