void OnItemClick(RoleUIItem item) { RoleInstance role = item.GetShowRole(); bool hasIt = m_params.selectList.Contains(role); if (hasIt) { if (m_params.selectList.Count <= 1) { return; } if (m_params.mustSelect != null && m_params.mustSelect.Invoke(role)) { GameUtil.DisplayPopinfo("此角色强制上场"); return; } m_params.selectList.Remove(role); item.SetSelect(false); } else { if (m_params.IsFull) { GameUtil.DisplayPopinfo($"最多只能选择{m_params.maxCount}人"); return; } m_params.selectList.Add(role); item.SetSelect(true); } }
void OnItemClick(RoleUIItem item) { if (m_currentShowItem != null && m_currentShowItem == item) { return; } if (m_currentShowItem) { m_currentShowItem.SetSelect(false); } m_currentShowItem = item; m_currentShowItem.SetSelect(true); m_currentRole = m_currentShowItem.GetShowRole(); RefreshCurrent(); }