Merge remote-tracking branch 'origin/develop' into feature/chat_01
# Conflicts: # Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset
This commit is contained in:
@@ -345,7 +345,8 @@ namespace BrewMonster
|
||||
iWaitTime = pCmd.time + m_pCurSkill.GetExecuteTime();
|
||||
|
||||
CECHPWorkSpell pWork = (CECHPWorkSpell)m_pWorkMan.CreateWork(Host_work_ID.WORK_SPELLOBJECT);
|
||||
|
||||
BMLogger.LogError($"[SKILL_CAST_DEBUG] OnMsgPlayerCastSkill: Created CECHPWorkSpell for skillID={m_pCurSkill.GetSkillID()}, " +
|
||||
$"executeTime={m_pCurSkill.GetExecuteTime()}, waitTime={iWaitTime}");
|
||||
pWork.PrepareCast(pCmd.target, m_pCurSkill, iWaitTime);
|
||||
m_pWorkMan.StartWork_p1(pWork);
|
||||
// Debug.Log($"[SKILL_CAST_DEBUG] OnMsgPlayerCastSkill: OBJECT_CAST_SKILL - Created WORK_SPELLOBJECT, " +
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using BrewMonster;
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using BrewMonster.Network;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -11,22 +11,30 @@ public class CharacterItemUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button btnClick;
|
||||
[SerializeField] private TextMeshProUGUI nameCharacter;
|
||||
[SerializeField] private TextMeshProUGUI _labelDetailInfo;
|
||||
[SerializeField] private GameObject _goFocusImage;
|
||||
RoleInfo dataItem;
|
||||
Action<RoleInfo> onClick;
|
||||
public RoleInfo RoleInfo => dataItem;
|
||||
Action<CharacterItemUI> onClick;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_goFocusImage.SetActive(false);
|
||||
}
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
btnClick.onClick.AddListener(OnClickBtn);
|
||||
}
|
||||
|
||||
public void InitItem(RoleInfo role, Action<RoleInfo> action)
|
||||
public void InitItem(RoleInfo role, Action<CharacterItemUI> action)
|
||||
{
|
||||
dataItem = role;
|
||||
onClick = action;
|
||||
string roleName = "(Error decoding name)";
|
||||
if (role.name != null && role.name.ByteArray != null)
|
||||
{
|
||||
|
||||
// Be careful with encoding, assume UTF8 is correct
|
||||
roleName = Encoding.Unicode.GetString(
|
||||
role.name.RawBuffer,
|
||||
@@ -35,10 +43,23 @@ public class CharacterItemUI : MonoBehaviour
|
||||
);
|
||||
}
|
||||
nameCharacter.text = roleName;
|
||||
if (EC_Game.GetGameRun() != null)
|
||||
{
|
||||
_labelDetailInfo.text =$"{EC_Game.GetGameRun().GetProfName(role.occupation)} Cấp {role.level.ToString()}";
|
||||
}
|
||||
else
|
||||
{
|
||||
BMLogger.LogError("No game run found");
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClickBtn()
|
||||
{
|
||||
onClick?.Invoke(dataItem);
|
||||
onClick?.Invoke(this);
|
||||
}
|
||||
|
||||
public void SetFocus(bool focus)
|
||||
{
|
||||
_goFocusImage.SetActive(focus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,25 @@ namespace BrewMonster.UI
|
||||
[SerializeField] private GameObject addCharacterItemPrefab;
|
||||
[SerializeField] private RectTransform parentItems;
|
||||
[SerializeField] private Button createCharacterButton;
|
||||
[SerializeField] private Button _btnEnterGame;
|
||||
[SerializeField] private CreateCharacterScreen createCharacterScreen;
|
||||
|
||||
private CharacterItemUI _selectingCharacterItemUI;
|
||||
private Action<RoleInfo> _onClickItemChar;
|
||||
private Action<RoleInfo> _onCreateCharacterComplete;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_btnEnterGame.onClick.AddListener(OnClickedEnterGame);
|
||||
_btnEnterGame.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_btnEnterGame.onClick.RemoveListener(OnClickedEnterGame);
|
||||
_selectingCharacterItemUI = null;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (createCharacterButton != null)
|
||||
@@ -48,7 +62,7 @@ namespace BrewMonster.UI
|
||||
if (characterItemPrefab != null && parentItems != null)
|
||||
{
|
||||
CharacterItemUI item = Instantiate(characterItemPrefab, parentItems).GetComponent<CharacterItemUI>();
|
||||
item.InitItem(info, OnClickItemChar);
|
||||
item.InitItem(info, OnSelectCharacter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +111,23 @@ namespace BrewMonster.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectCharacter(CharacterItemUI characterItemUI)
|
||||
{
|
||||
if (_selectingCharacterItemUI == characterItemUI)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
if(_selectingCharacterItemUI!=null)
|
||||
{
|
||||
_selectingCharacterItemUI.SetFocus(false);
|
||||
}
|
||||
|
||||
_selectingCharacterItemUI = characterItemUI;
|
||||
_selectingCharacterItemUI.SetFocus(true);
|
||||
_btnEnterGame.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnCreateCharacterClicked()
|
||||
{
|
||||
if (createCharacterScreen != null)
|
||||
@@ -126,5 +157,17 @@ namespace BrewMonster.UI
|
||||
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickedEnterGame()
|
||||
{
|
||||
if (_selectingCharacterItemUI != null)
|
||||
{
|
||||
_onClickItemChar?.Invoke(_selectingCharacterItemUI.RoleInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
BMLogger.LogError("No role selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user