show skill icon and asign skill

This commit is contained in:
NguyenVanDat
2026-04-10 09:33:02 +07:00
parent fd970c3123
commit 9eb53ef562
13 changed files with 1459 additions and 12 deletions
@@ -23,6 +23,9 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
private Color m_color = Color.white;
private bool m_bUpdateRenderTarget;
private bool m_bForceDynamicRender;
private int skillID;
public int SkillId => skillID;
private AUIDialog m_pParent;
public override void Awake()
@@ -35,6 +38,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
skillbutton.onClick.RemoveAllListeners();
skillbutton.onClick.AddListener(Execute);
m_pParent = GetComponentInParent<AUIDialog>();
skillID = int.Parse(this.name.Split('_')[1]);
}
public void SetInteract(bool isInteract)
@@ -66,7 +70,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
{
EventBus.Publish(new OpenAssignSkillUIEvent());
}
// Show tooltip if hint exists
if (!string.IsNullOrEmpty(m_hintText))
{
@@ -74,8 +78,8 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
if (uiManager != null)
{
var rectTransform = GetComponent<RectTransform>();
int skillID = int.Parse(this.name.Split('_')[1]);
uiManager.ShowSkillTooltip(m_hintText, rectTransform, () => EventBus.Publish(new AssignSkillSelectionChangedEvent(skillID, true)));
// int skillID = int.Parse(this.name.Split('_')[1]);
uiManager.ShowSkillTooltip(m_hintText, rectTransform, () => EventBus.Publish(new AssignSkillSelectionChangedEvent(skillID, true)));
}
}
}
@@ -13,6 +13,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
// Hint/tooltip data storage
protected string m_hintText = string.Empty;
public int GetSlotIndex => slotIndex;
public virtual void Awake()
{
@@ -32,6 +32,7 @@ namespace BrewMonster.UI
private const string ACTION_ICONLIST_NAME = "ActionIcon/iconlist_action_multisprite";
private const string INVENTORY_ICONLIST_NAME = "UI/IconSprites/iconlist_ivtrm_multisprite";
private const string STATE_ICONLIST_NAME = "iconlist_state";
private const string SKILL_GROUP_ICON_NAME = "SkillGroupIcon/iconlist_skillgrp_multisprite";
public CDlgMiniMap m_pDlgMiniMap;
@@ -378,6 +379,7 @@ namespace BrewMonster.UI
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_ACTION] = (ACTION_ICONLIST_NAME, Resources.LoadAll<Sprite>(ACTION_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_INVENTORY] = (INVENTORY_ICONLIST_NAME, Resources.LoadAll<Sprite>(INVENTORY_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE] = (STATE_ICONLIST_NAME, Resources.LoadAll<Sprite>(STATE_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_SKILLGRP] = (SKILL_GROUP_ICON_NAME, Resources.LoadAll<Sprite>(SKILL_GROUP_ICON_NAME));
}
public void SetCover(AUIImagePictureBase pImgPic, string nameImage, EC_GAMEUI_ICONS iCONS_TYPE)
{
@@ -14,8 +14,11 @@ namespace BrewMonster
[SerializeField] private Transform psSkillContainer;
[SerializeField] private List<AUIImagePicture> psSkillSlotList;
[SerializeField] private List<AUIImagePicture> ptSkillSlotList;
[SerializeField] private SkillSetUpComboWidget _skillSetUpComboWidget;
private AUIImagePicture _currentSelectSkill;
private SkillSlotWidget _currentSelectComboSlot;
private bool _isInEditComboMode;
private void Awake()
{
@@ -29,6 +32,25 @@ namespace BrewMonster
}
}
public override void OnEnable()
{
UpdateView();
_skillSetUpComboWidget.ShowSetUpContent(false);
_skillSetUpComboWidget.OnClickedSkillSlot += OnClickedSkillSlot;
_skillSetUpComboWidget.OnClickedAssignSkill += OnClickedAssignSkill;
_skillSetUpComboWidget.OnClickedEditCombo += OnClickedEditCombo;
_skillSetUpComboWidget.OnClickedConfirmCombo += OnClickedConfirmCombo;
}
public override void OnDisable()
{
base.OnDisable();
_skillSetUpComboWidget.OnClickedSkillSlot -= OnClickedSkillSlot;
_skillSetUpComboWidget.OnClickedAssignSkill -= OnClickedAssignSkill;
_skillSetUpComboWidget.OnClickedEditCombo -= OnClickedEditCombo;
_skillSetUpComboWidget.OnClickedConfirmCombo -= OnClickedConfirmCombo;
}
private void OnDestroy()
{
foreach (var skill in ptSkillSlotList)
@@ -59,15 +81,9 @@ namespace BrewMonster
private void OnClickedSkill(AUIImagePicture imagePicture)
{
BMLogger.LogError("Skill Click: ");
_currentSelectSkill = imagePicture;
}
public override void OnEnable()
{
UpdateView();
}
private void UpdateView()
{
m_skills.Clear();
@@ -110,5 +126,31 @@ namespace BrewMonster
BMLogger.Log($"CDlgSkillSubPool::SetImage SkillID={cECSkill.GetSkillID()} SkillName={cECSkill.GetName()} IconFile={cECSkill.GetIconFile()}");
GetGameUIMan().SetCover(learnedSkillUI, cECSkill.GetIconFile(), EC_GAMEUI_ICONS.ICONS_SKILL);
}
private void OnClickedSkillSlot(SkillSlotWidget skillSlot)
{
_currentSelectComboSlot = skillSlot;
_skillSetUpComboWidget.ShowSetUpContent(true);
}
private void OnClickedEditCombo()
{
if(_currentSelectComboSlot !=null)
{
_isInEditComboMode = true;
}
}
private void OnClickedConfirmCombo()
{
//save
_isInEditComboMode = true;
_currentSelectComboSlot = null;
}
private void OnClickedAssignSkill(SkillSlotWidget slotWidget)
{
if(_isInEditComboMode && _currentSelectSkill != null && _currentSelectSkill is LearnedSkillUI skillUI)
{
_skillSetUpComboWidget.SetSkillToCurrentCombo(slotWidget.GetSlotIndex,(short)skillUI.SkillId);
}
}
}
}
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using BrewMonster.Network;
using BrewMonster.Scripts.Skills;
using BrewMonster.UI;
using UnityEngine;
using UnityEngine.UI;
@@ -8,6 +10,9 @@ namespace BrewMonster
{
public class SkillSetUpComboWidget : MonoBehaviour
{
public const int NormalAttackId = -1;
public const int LoopAttackId = -2;
[SerializeField] private List<SkillSlotWidget> _combosList;
[SerializeField] private Button _btnEditCombo;
[SerializeField] private Button _btnDeleteCombo;
@@ -18,9 +23,51 @@ namespace BrewMonster
[SerializeField] private List<SkillSlotWidget> _detailCombosList;
[SerializeField] private Button _btnConfirmCombo;
private SkillSlotWidget _currentSlotWidget;
public event Action<SkillSlotWidget> OnClickedSkillSlot;
public event Action OnClickedEditCombo;
public event Action<SkillSlotWidget> OnClickedAssignSkill; // click to asign skill to combo
public event Action OnClickedDeleteCombo;
public event Action OnClickedConfirmCombo;
public CECGameUIMan GetGameUIMan()
{
return EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
}
private void OnEnable()
{
ShowCurrentCombos();
for (var index = 0; index < _combosList.Count; index++)
{
var slotWidget = _combosList[index];
slotWidget.SetSlotIndex(index);
slotWidget.OnClickedSkillSlot += OnClickedSkillSlotBtn;
}
for (var index = 0; index < _detailCombosList.Count; index++)
{
var slotWidget = _detailCombosList[index];
slotWidget.SetSlotIndex(index);
slotWidget.OnClickedSkillSlot += OnClickedAssignSkillBtn;
}
_btnEditCombo.onClick.AddListener(OnClickedEditComboBtn);
_btnConfirmCombo.onClick.AddListener(OnClickedConfirmComboBtn);
}
private void OnDisable()
{
foreach (var slotWidget in _combosList)
{
slotWidget.OnClickedSkillSlot -= OnClickedSkillSlotBtn;
}
foreach (var slotWidget in _detailCombosList)
{
slotWidget.OnClickedSkillSlot -= OnClickedAssignSkillBtn;
}
_btnEditCombo.onClick.RemoveListener(OnClickedEditComboBtn);
_btnConfirmCombo.onClick.RemoveListener(OnClickedConfirmComboBtn);
_currentSlotWidget = null;
}
private void ShowCurrentCombos()
@@ -42,10 +89,22 @@ namespace BrewMonster
{
_combosList[i].SetImage(null);
}
else
{
}
}
}
}
private void ShowComboInDetail(short[] idSkills)
{
for (int i = 0; i < idSkills.Length; i++)
{
var nameskill = ElementSkill.GetIcon((uint)idSkills[i]);
if (idSkills[i] == NormalAttackId || idSkills[i] == LoopAttackId)
{
GetGameUIMan().SetCover(_detailCombosList[i] ,$"{Mathf.Abs(idSkills[i])}", EC_GAMEUI_ICONS.ICONS_SKILLGRP);
}
else
{
GetGameUIMan().SetCover(_detailCombosList[i] ,nameskill, EC_GAMEUI_ICONS.ICONS_SKILL);
}
}
}
@@ -62,5 +121,38 @@ namespace BrewMonster
}
return isValid;
}
private void OnClickedSkillSlotBtn(SkillSlotWidget slotWidget)
{
OnClickedSkillSlot?.Invoke(slotWidget);
_currentSlotWidget = slotWidget;
}
public void ShowSetUpContent(bool setActive)
{
_contentSetUpCombo.SetActive(setActive);
}
private void OnClickedEditComboBtn()
{
OnClickedEditCombo?.Invoke();
if(_currentSlotWidget == null) return;
EC_VIDEO_SETTING setting = EC_Game.GetConfigs().GetVideoSettings();
ShowComboInDetail(setting.comboSkill[_currentSlotWidget.GetSlotIndex].idSkill);
}
private void OnClickedConfirmComboBtn()
{
OnClickedConfirmCombo?.Invoke();
}
private void OnClickedAssignSkillBtn(SkillSlotWidget slotWidget)
{
OnClickedAssignSkill?.Invoke(slotWidget);
}
public void SetSkillToCurrentCombo(int slotIndex, short skillId)
{
if(_currentSlotWidget == null) return;
EC_VIDEO_SETTING setting = EC_Game.GetConfigs().GetVideoSettings();
setting.comboSkill[_currentSlotWidget.GetSlotIndex].idSkill[slotIndex] = skillId;
ShowComboInDetail(setting.comboSkill[_currentSlotWidget.GetSlotIndex].idSkill);
}
}
}
+1
View File
@@ -2530,6 +2530,7 @@ MonoBehaviour:
psSkillContainer: {fileID: 6640795756162075713}
psSkillSlotList: []
ptSkillSlotList: []
_skillSetUpComboWidget: {fileID: 6869948338941520170}
--- !u!1 &2052529161125217892
GameObject:
m_ObjectHideFlags: 0
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fae6ba1fe8169124daa635f32c729f88
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 79c89e0db9858bd4298bfa3be8b0d68a
IHVImageFormatImporter:
externalObjects: {}
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
isReadable: 0
sRGBTexture: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
ignoreMipmapLimit: 0
mipmapLimitGroupName:
userData:
assetBundleName:
assetBundleVariant:
+48
View File
@@ -0,0 +1,48 @@
32
32
6
8
1.dds
2.dds
爱你.dds
八卦石.dds
白萼梅.dds
白沙毒鳞蛇牙.dds
白雪莲.dds
百辟腰饰.dds
碧玉珠.dds
冰雪护符.dds
彩鹫之羽.dds
蚕丝.dds
地之圣印.dds
顶针.dds
恶魔图腾.dds
凤凰羽.dds
鬼阴火枪.dds
海盗喽罗的心脏.dds
海蓝之石.dds
合欢坠子.dds
虎魄.dds
虎珠唾液.dds
护甲符.dds
化解灵符.dds
幻胧披风.dds
幻舞隐月剑.dds
黄沉之石.dds
火岩项链.dds
火岩腰佩.dds
金线芍.dds
九鬼裂风.dds
九鬼破天.dds
狂刃符.dds
鲲鹏战铠.dds
炼狱之火.dds
裂天之斧.dds
六合石.dds
颅骨.dds
魔煞腰佩.dds
木制头颅.dds
情丝节鞭.dds
韬光披风.dds
剔透的碧空项链.dds
剔透的忘忧坠子.dds
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 660881ad7a538af4a85af5d158cbcba6
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: