public void SetBuyLimit(TSCGetPurchase msg) { if (!msg.HasUserResource || msg.UserResource.ResourceInfosCount <= 0) { foreach (var pair in mItemServerData) { pair.Value.boughtNum = 0; } } else { UserResource array = msg.UserResource; for (int i = 0; i < array.ResourceInfosCount; i++) { var data = array.GetResourceInfos(i); if (!mItemServerData.ContainsKey(data.ConfigId)) { mItemServerData[data.ConfigId] = new NItemServerData(); } mItemServerData[data.ConfigId].boughtNum = data.Number; } } }
void OnGetLimit(NetMsgDef msg) { TSCGetPurchase res = TSCGetPurchase.ParseFrom(msg.mBtsData); itemPackage.SetBuyLimit(res); }