PlayerPreviewItemNestedCtrl.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FL.Data;
  7. using System.Collections.Generic;
  8. using XGame.Database;
  9. using XGame.Framework.UI;
  10. namespace FL.FGUI
  11. {
  12. public struct PreviewParam
  13. {
  14. public bool bSelectJob; // 是否转职路线
  15. public eAdvanceType[] advancedTypeArray; // 进阶职业分支类型
  16. public careerTable curJobInfo;
  17. public List<careerTable> preDataList; // 前置数据(初始职业和10级转职数据)
  18. public Dictionary<eAdvanceType, List<careerTable>> careerDataMap; // 进阶线路数据
  19. }
  20. /// <summary>
  21. /// UI逻辑处理类
  22. /// </summary>
  23. /// <typeparam name=""></typeparam>
  24. public partial class PlayerPreviewItemNestedCtrl : UIController<PlayerPreviewItemNestedVM>
  25. {
  26. protected override void OnEnable(object intent)
  27. {
  28. AddUIListenres();
  29. }
  30. protected override void OnDisable()
  31. {
  32. RemoveUIListenres();
  33. }
  34. #region UI事件
  35. private void AddUIListenres()
  36. {
  37. }
  38. private void RemoveUIListenres()
  39. {
  40. }
  41. #endregion
  42. public void ShowUI(PreviewParam param)
  43. {
  44. if (param.bSelectJob)
  45. {
  46. bool bTransferred = param.curJobInfo.Change_times > 0; // 已转职
  47. bool bAdvanced = param.curJobInfo.Change_times > 1; // 已转职并且进阶过
  48. VM.JobCtrl.selectedIndex = bTransferred ? (bAdvanced ? 2 : 1) : 0;
  49. if (bAdvanced)
  50. {
  51. eAdvanceType advancedType = (eAdvanceType)param.curJobInfo.Type;
  52. int advanceCount = param.curJobInfo.Change_times - 1; // 进阶的次数
  53. if (advancedType == eAdvanceType.ShieldWarrior || advancedType == eAdvanceType.CriticalShooter || advancedType == eAdvanceType.SpellMage)
  54. {
  55. VM.LowerCtrl.selectedIndex = 0;
  56. VM.UpperCtrl.selectedIndex = advanceCount;
  57. }
  58. else
  59. {
  60. VM.UpperCtrl.selectedIndex = 0;
  61. VM.LowerCtrl.selectedIndex = advanceCount;
  62. }
  63. }
  64. else
  65. {
  66. VM.UpperCtrl.selectedIndex = 0;
  67. VM.LowerCtrl.selectedIndex = 0;
  68. }
  69. }
  70. else
  71. {
  72. VM.JobCtrl.selectedIndex = 0;
  73. VM.UpperCtrl.selectedIndex = 0;
  74. VM.LowerCtrl.selectedIndex = 0;
  75. }
  76. ShowJobUI(param);
  77. }
  78. /// <summary>
  79. ///
  80. /// </summary>
  81. /// <param name="param"></param>
  82. private void ShowJobUI(PreviewParam param)
  83. {
  84. var upperDataList = param.careerDataMap[param.advancedTypeArray[0]];
  85. var lowerDataList = param.careerDataMap[param.advancedTypeArray[1]];
  86. bool bUpperCurStep = param.bSelectJob && param.curJobInfo.Type == (int)param.advancedTypeArray[0];
  87. bool bLowerCurStep = param.bSelectJob && param.curJobInfo.Type == (int)param.advancedTypeArray[1];
  88. // 转职次数
  89. int transferCount = param.curJobInfo.Change_times;
  90. VM.JobLv30.Ctrl.ShowUI(param.preDataList[upperDataList[0].Careertype], param.bSelectJob && transferCount == 1);
  91. VM.JobLv60_1.Ctrl.ShowUI(upperDataList[0], bUpperCurStep && transferCount == 2);
  92. VM.JobLv80_1.Ctrl.ShowUI(upperDataList[1], bUpperCurStep && transferCount == 3);
  93. VM.JobLv100_1.Ctrl.ShowUI(upperDataList[2], bUpperCurStep && transferCount == 4);
  94. VM.JobLv120_1.Ctrl.ShowUI(upperDataList[3], bUpperCurStep && transferCount == 5);
  95. VM.JobLv60_2.Ctrl.ShowUI(lowerDataList[0], bLowerCurStep && transferCount == 2);
  96. VM.JobLv80_2.Ctrl.ShowUI(lowerDataList[1], bLowerCurStep && transferCount == 3);
  97. VM.JobLv100_2.Ctrl.ShowUI(lowerDataList[2], bLowerCurStep && transferCount == 4);
  98. VM.JobLv120_2.Ctrl.ShowUI(lowerDataList[3], bLowerCurStep && transferCount == 5);
  99. }
  100. }
  101. }