/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using FL.Data; using System.Collections.Generic; using Unity.Jobs.LowLevel.Unsafe; using XGame.Database; using XGame.Framework.UI; namespace FL.FGUI { public struct PreviewParam { public bool bSelectJob; // 是否转职路线 public eAdvanceType[] advancedTypeArray; // 进阶职业分支类型 public careerTable curJobInfo; public List preDataList; // 前置数据(初始职业和10级转职数据) public Dictionary> careerDataMap; // 进阶线路数据 } /// /// UI逻辑处理类 /// /// public partial class PlayerPreviewItemNestedCtrl : UIController { protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); } #region UI事件 private void AddUIListenres() { } private void RemoveUIListenres() { } #endregion public void ShowUI(PreviewParam param) { if (param.bSelectJob) { bool bTransferred = param.curJobInfo.Change_times > 0; // 已转职 bool bAdvanced = param.curJobInfo.Change_times > 1; // 已转职并且进阶过 VM.JobCtrl.selectedIndex = bTransferred ? (bAdvanced ? 2 : 1) : 0; if (bAdvanced) { eAdvanceType advancedType = (eAdvanceType)param.curJobInfo.Type; int advanceCount = param.curJobInfo.Change_times - 1; // 进阶的次数 if (advancedType == eAdvanceType.ShieldWarrior || advancedType == eAdvanceType.CriticalShooter || advancedType == eAdvanceType.SpellMage) { VM.LowerCtrl.selectedIndex = 0; VM.UpperCtrl.selectedIndex = advanceCount; } else { VM.UpperCtrl.selectedIndex = 0; VM.LowerCtrl.selectedIndex = advanceCount; } } else { VM.UpperCtrl.selectedIndex = 0; VM.LowerCtrl.selectedIndex = 0; } } else { VM.JobCtrl.selectedIndex = 0; VM.UpperCtrl.selectedIndex = 0; VM.LowerCtrl.selectedIndex = 0; } ShowJobUI(param); } /// /// /// /// private void ShowJobUI(PreviewParam param) { var upperDataList = param.careerDataMap[param.advancedTypeArray[0]]; var lowerDataList = param.careerDataMap[param.advancedTypeArray[1]]; bool bUpperCurStep = param.bSelectJob && param.curJobInfo.Type == (int)param.advancedTypeArray[0]; bool bLowerCurStep = param.bSelectJob && param.curJobInfo.Type == (int)param.advancedTypeArray[1]; // 转职次数 int transferCount = param.curJobInfo.Change_times; VM.JobLv30.Ctrl.ShowUI(param.preDataList[upperDataList[0].Careertype], param.bSelectJob && transferCount == 1); VM.JobLv60_1.Ctrl.ShowUI(upperDataList[0], bUpperCurStep && transferCount == 2); VM.JobLv80_1.Ctrl.ShowUI(upperDataList[1], bUpperCurStep && transferCount == 3); VM.JobLv100_1.Ctrl.ShowUI(upperDataList[2], bUpperCurStep && transferCount == 4); VM.JobLv120_1.Ctrl.ShowUI(upperDataList[3], bUpperCurStep && transferCount == 5); VM.JobLv60_2.Ctrl.ShowUI(lowerDataList[0], bLowerCurStep && transferCount == 2); VM.JobLv80_2.Ctrl.ShowUI(lowerDataList[1], bLowerCurStep && transferCount == 3); VM.JobLv100_2.Ctrl.ShowUI(lowerDataList[2], bLowerCurStep && transferCount == 4); VM.JobLv120_2.Ctrl.ShowUI(lowerDataList[3], bLowerCurStep && transferCount == 5); } } }