public void CashMinus(int a_nPrice) { var stPlayerInfo = new STPlayerInfo(); stPlayerInfo.m_nID = m_oPlayerInfoList[0].m_nID; stPlayerInfo.m_nMoney = m_oPlayerInfoList[0].m_nMoney; stPlayerInfo.m_nCash = m_oPlayerInfoList[0].m_nCash - a_nPrice; stPlayerInfo.m_oName = m_oPlayerInfoList[0].m_oName; m_oPlayerInfoList[0] = stPlayerInfo; this.SavePlayerInfo(); }
public void LoadOriginItemInfoListFromFile(string a_oFilepath) { var oTextAsset = Resources.Load <TextAsset>(a_oFilepath); var oJSONRoot = SimpleJSON.JSON.Parse(oTextAsset.text); var oPlayerInfoList = oJSONRoot["PlayerInfoList"]; for (int i = 0; i < oPlayerInfoList.Count; ++i) { var oInfoList = oPlayerInfoList[i]; var stPlayerInfo = new STPlayerInfo(); stPlayerInfo.m_nID = int.Parse(oInfoList["ID"]); stPlayerInfo.m_nMoney = int.Parse(oInfoList["Money"]); stPlayerInfo.m_nCash = int.Parse(oInfoList["Cash"]); stPlayerInfo.m_oName = oInfoList["Name"]; m_oPlayerInfoList.Add(stPlayerInfo); } }