public void ChangeSlot() { var nIndex = 0; for (int i = 0; i < m_oItemInfoList.Count; ++i) { if (m_oItemInfoList[i].m_nAmount == 0 && m_oItemInfoList[i].m_nSlot != 0) { nIndex = i; break; } } for (int i = 0; i < m_oItemInfoList.Count; ++i) { if (m_oItemInfoList[nIndex].m_nSlot >= m_oItemInfoList[i].m_nSlot) { continue; } else { var stItemInfo = new CItemStorage.STItemInfo(); stItemInfo.m_nID = m_oItemInfoList[i].m_nID; stItemInfo.m_oName = m_oItemInfoList[i].m_oName; stItemInfo.m_nAmount = m_oItemInfoList[i].m_nAmount; stItemInfo.m_nSlot = m_oItemInfoList[i].m_nSlot - 1; m_oItemInfoList[i] = stItemInfo; } } var stLastItemInfo = new CItemStorage.STItemInfo(); stLastItemInfo.m_nID = m_oItemInfoList[nIndex].m_nID; stLastItemInfo.m_oName = m_oItemInfoList[nIndex].m_oName; stLastItemInfo.m_nAmount = m_oItemInfoList[nIndex].m_nAmount; stLastItemInfo.m_nSlot = 0; m_oItemInfoList[nIndex] = stLastItemInfo; }
private void PurchaseItem(string a_oItemName) { var oItemList = CItemStorage.Instance.GetItemInfoList(); var oCurrentSlot = oItemList[0].m_nSlot; for (int i = 0; i < oItemList.Count; ++i) { oCurrentSlot = oItemList[i].m_nSlot > oCurrentSlot ? oItemList[i].m_nSlot : oCurrentSlot; } for (int i = 0; i < oItemList.Count; ++i) { if (oItemList[i].m_oName == a_oItemName) { var stItemInfo = new CItemStorage.STItemInfo(); stItemInfo.m_nID = oItemList[i].m_nID; stItemInfo.m_oName = oItemList[i].m_oName; stItemInfo.m_nAmount = oItemList[i].m_nAmount + 1; if (oItemList[i].m_nSlot == 0) { stItemInfo.m_nSlot = oCurrentSlot + 1; } else { stItemInfo.m_nSlot = oItemList[i].m_nSlot; } oItemList[i] = stItemInfo; break; } } CItemStorage.Instance.SaveItemList(); CPlayerStorage.Instance.MoneyMinus(500); CSceneManager.CurrentSceneManager.SendMessage("SettingText"); }
private void SetMakingItem(string a_oItemName) { var oItemList = CItemStorage.Instance.GetItemInfoList(); var oCurrentSlot = oItemList[0].m_nSlot; CSoundManager.Instance.PlayEffectSound("Sounds/Effect/MixEffect"); for (int i = 0; i < oItemList.Count; ++i) { oCurrentSlot = oItemList[i].m_nSlot > oCurrentSlot ? oItemList[i].m_nSlot : oCurrentSlot; } for (int i = 0; i < oItemList.Count; ++i) { if (oItemList[i].m_oName == a_oItemName) { var stItemInfo = new CItemStorage.STItemInfo(); stItemInfo.m_nID = oItemList[i].m_nID; stItemInfo.m_oName = oItemList[i].m_oName; stItemInfo.m_nAmount = oItemList[i].m_nAmount + 1; if (oItemList[i].m_nSlot == 0) { stItemInfo.m_nSlot = oCurrentSlot + 1; } else { stItemInfo.m_nSlot = oItemList[i].m_nSlot; } oItemList[i] = stItemInfo; break; } } }
public void RemoveAmount(string a_oItemName, int a_nAmount) { for (int i = 0; i < m_oItemInfoList.Count; ++i) { if (m_oItemInfoList[i].m_oName == a_oItemName) { var stItemInfo = new CItemStorage.STItemInfo(); stItemInfo.m_nID = m_oItemInfoList[i].m_nID; stItemInfo.m_oName = m_oItemInfoList[i].m_oName; stItemInfo.m_nAmount = m_oItemInfoList[i].m_nAmount - a_nAmount; stItemInfo.m_nSlot = m_oItemInfoList[i].m_nSlot; m_oItemInfoList[i] = stItemInfo; if (m_oItemInfoList[i].m_nAmount == 0) { this.ChangeSlot(); } break; } } }
private void Reward(string a_oItemName, int a_nAmount) { var oItemList = CItemStorage.Instance.GetItemInfoList(); var oCurrentSlot = oItemList[0].m_nSlot; for (int i = 0; i < oItemList.Count; ++i) { oCurrentSlot = oItemList[i].m_nSlot > oCurrentSlot ? oItemList[i].m_nSlot : oCurrentSlot; } for (int i = 0; i < oItemList.Count; ++i) { if (oItemList[i].m_oName == a_oItemName) { var stItemInfo = new CItemStorage.STItemInfo(); stItemInfo.m_nID = oItemList[i].m_nID; stItemInfo.m_oName = oItemList[i].m_oName; stItemInfo.m_nAmount = oItemList[i].m_nAmount + a_nAmount; if (oItemList[i].m_nSlot == 0) { stItemInfo.m_nSlot = oCurrentSlot + 1; } else { stItemInfo.m_nSlot = oItemList[i].m_nSlot; } oItemList[i] = stItemInfo; break; } } }