121 lines
4.7 KiB
Markdown
121 lines
4.7 KiB
Markdown
# Combo Skill Quickbar UI Summary (2026-04-17)
|
|
|
|
## Mục tiêu
|
|
|
|
Đồng bộ toàn bộ luồng combo skill giữa:
|
|
|
|
- danh sách chọn combo trong assign UI,
|
|
- assign slot (`AUIToggleAssignSlot`),
|
|
- quickbar runtime (`CDlgQuickBar`),
|
|
- icon/cooldown overlay (`AUIImagePicture`, `AUIClockIcon`),
|
|
|
|
để `SCT_SKILLGRP` hiển thị đúng icon, giữ đúng metadata group, và assign được từ UI.
|
|
|
|
## 1) Nâng cấp model hiển thị `SKILLGRP` trên slot
|
|
|
|
### File: `Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs`
|
|
|
|
- Thêm lưu trạng thái group:
|
|
- `_skillGroupIndex` (group hiện hành),
|
|
- `_skillGroupIndexes` (danh sách group khả dụng trên slot),
|
|
- `SkillGroupIndex`, `SkillGroupIndexes`.
|
|
- Thêm API:
|
|
- `SetSkillGroupIcons(IReadOnlyList<int> groupIndexes, int preferredGroupIndex = -1)`.
|
|
- Giữ API cũ `SetSkillGroupIcon(...)` nhưng chuyển sang gọi API mới.
|
|
- Chuẩn hóa resolve icon theo thứ tự:
|
|
1) `(nIcon + 1).ToString()`,
|
|
2) `nIcon.ToString()`,
|
|
3) `DefaultComboIcon = "爱你"`.
|
|
- `Clear()` reset toàn bộ metadata combo + reset cooldown state.
|
|
|
|
### File: `Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleAssignSlot.cs`
|
|
|
|
- Thêm:
|
|
- `_skillGroupIndex`,
|
|
- `_skillGroupIndexes`,
|
|
- `GetSkillGroupIndexForAssign()`,
|
|
- `GetSkillGroupIndexesForAssign()`,
|
|
- `SetSkillGroupIconsForAssign(...)`.
|
|
- `SetSkillGroupIconForAssign(...)` map sang API mới (backward compatible).
|
|
- Có check nullable cho `GetVideoSettings()` (`EC_VIDEO_SETTING?`) để tránh lỗi CS1061.
|
|
|
|
## 2) Clock/icon state cho combo group
|
|
|
|
### File: `Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/AUIClockIcon.cs`
|
|
|
|
- Bổ sung metadata bind:
|
|
- `BindSkillGroup(int groupIndex)`,
|
|
- `GetBoundSkillGroup()`,
|
|
- `ClearSkillGroupBinding()`.
|
|
- `UpdateClockIcon()` thêm guard `null` và `range <= 0` để an toàn runtime.
|
|
|
|
## 3) Update logic `SCT_SKILLGRP` khi render shortcut
|
|
|
|
### File: `Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs`
|
|
|
|
- Nhánh `SCT_SKILLGRP`:
|
|
- lấy `groupIndex` từ `CECSCSkillGrp`,
|
|
- gom danh sách `groupIndexes`:
|
|
- ưu tiên group hiện tại từ shortcut,
|
|
- cộng thêm các combo có `nIcon > 0`,
|
|
- gọi `pCell.SetSkillGroupIcons(groupIndexes, groupIndex)`.
|
|
- Mỗi vòng slot reset:
|
|
- `pSkill = null`,
|
|
- `pClock.ClearSkillGroupBinding()`,
|
|
để tránh bleed state giữa các slot.
|
|
|
|
### File: `Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSlots.cs`
|
|
|
|
- Nhánh `SCT_SKILLGRP` cũng dùng danh sách nhiều group và gọi:
|
|
- `assignSlot.SetSkillGroupIconsForAssign(groupIndexes, groupIndex)`.
|
|
- Bỏ placeholder `"unknown"`; fallback đúng icon combo group.
|
|
|
|
## 4) Fix assign combo từ `AUIToggleSkillAssign` -> `AUIToggleAssignSlot`
|
|
|
|
### Vấn đề
|
|
|
|
- `DlgAssignSub` chỉ hook toggle ở `ptSkillSlotList` (skill thường), chưa hook `psSkillSlotList` (combo list).
|
|
- Combo trong `ShowSkillGrp()` chưa có id dùng cho assign event nên không tạo được shortcut group.
|
|
|
|
### Sửa
|
|
|
|
#### File: `Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSub.cs`
|
|
|
|
- Hook/Unhook sự kiện toggle cho cả `psSkillSlotList`.
|
|
- `ShowSkillGrp()`:
|
|
- reset `_otherSkillIndex = 0` mỗi lần render,
|
|
- set icon combo group,
|
|
- encode `groupIndex` thành `skillID` âm: `-(groupIndex + 1)` để tái sử dụng `AssignSkillSelectionChangedEvent`.
|
|
|
|
#### File: `Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSlots.cs`
|
|
|
|
- Thêm pending combo state:
|
|
- `_pendingComboGroupIndex`,
|
|
- `IsPendingComboAssign()`,
|
|
- `ClearPendingComboAssign()`.
|
|
- Thêm `CreateSkillGroupShortcut()` dùng:
|
|
- `a_pSCS[currentListIndex].CreateSkillGroupShortcut(currentSelectedSlotIndex, _pendingComboGroupIndex)`.
|
|
- `OnAssignSkillSelectionChanged(...)`:
|
|
- nếu `skillID < 0` -> decode thành combo group và assign dạng `SCT_SKILLGRP`.
|
|
- `OnClickedAssignSlot(...)` xử lý pending combo giống skill/action.
|
|
- `OnAssignSkillCommitted(...)`:
|
|
- nếu event `skillID < 0`, set lại icon combo group cho slot vừa assign và uncheck toggle.
|
|
|
|
## 5) Nullable/build fixes đã xử lý
|
|
|
|
- `Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleAssignSlot.cs`
|
|
- `Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs`
|
|
|
|
Đã đổi các truy cập `setting.comboSkill` sang mẫu an toàn:
|
|
|
|
- `EC_VIDEO_SETTING? setting = ...;`
|
|
- `if (!setting.HasValue || setting.Value.comboSkill == null) return ...;`
|
|
- dùng local `comboSkills = setting.Value.comboSkill`.
|
|
|
|
## 6) Kết quả hiện tại
|
|
|
|
- Assign combo từ danh sách assign UI sang quickbar slot hoạt động lại.
|
|
- `SCT_SKILLGRP` hiển thị icon đúng (không còn placeholder sai).
|
|
- Slot có thể giữ metadata 1-nhiều group để phục vụ logic mở rộng.
|
|
- Luồng code không còn lỗi nullable CS1061 đã báo.
|