fix null proplem in quickBar
This commit is contained in:
@@ -762,6 +762,10 @@ namespace BrewMonster
|
||||
/// </summary>
|
||||
public int GetShortcutNum()
|
||||
{
|
||||
if(m_aShortcuts == null || m_aShortcuts.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_aShortcuts.Count;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ namespace BrewMonster
|
||||
}
|
||||
public bool UpdateShortcuts()
|
||||
{
|
||||
if(AUIImagePictureList == null || AUIImagePictureList.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CECShortcut pSC;
|
||||
CECSCSkill pSCSkill;
|
||||
AUIImagePicture pCell;
|
||||
@@ -60,13 +64,15 @@ namespace BrewMonster
|
||||
int nCurPanel9 = GetCurPanel1();
|
||||
int nCurPanel8 = GetCurPanel2();
|
||||
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
||||
if (pHost == null) return false;
|
||||
if (pHost == null)
|
||||
return false;
|
||||
var a_pSCS = new List<CECShortcutSet>();
|
||||
var a_pszPanel = new List<string>();
|
||||
GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8);
|
||||
if (a_pSCS == null || a_pSCS.Count < 2)
|
||||
return false;
|
||||
|
||||
|
||||
if(currentListIndex >= a_pSCS.Count )
|
||||
{
|
||||
currentListIndex = 0;
|
||||
@@ -80,7 +86,12 @@ namespace BrewMonster
|
||||
// }
|
||||
// currentOffsetIndex += a_pSCS[i].GetShortcutNum();
|
||||
// }
|
||||
int nSlots = Mathf.Min(a_pSCS[currentListIndex].GetShortcutNum(), AUIImagePictureList.Count);
|
||||
var shortcutNum = a_pSCS[currentListIndex]?.GetShortcutNum() ?? 0;
|
||||
if(shortcutNum <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int nSlots = Mathf.Min(shortcutNum, AUIImagePictureList.Count);
|
||||
for (int j = 0; j < nSlots; j++)
|
||||
{
|
||||
pCell = AUIImagePictureList[j];
|
||||
|
||||
Reference in New Issue
Block a user