public List <Drop_GoldModel.DropGold> GetDrops() { List <Drop_GoldModel.DropGold> list = new List <Drop_GoldModel.DropGold>(); int random = this.mRandom.GetRandom(); Drop_GoldModel.DropWeightOne one = this.mList[random]; for (int i = 0; i < one.Count; i++) { Drop_GoldModel.DropGold item = new Drop_GoldModel.DropGold { Gold = GameLogic.Random(one.Min, one.Max + 1) }; list.Add(item); } return(list); }
public void Init(string[] strs) { int index = 0; int length = strs.Length; while (index < length) { char[] separator = new char[] { ',' }; string[] strArray = strs[index].Split(separator); Drop_GoldModel.DropWeightOne one = new Drop_GoldModel.DropWeightOne { Count = int.Parse(strArray[0]), Weight = int.Parse(strArray[1]), Min = int.Parse(strArray[2]), Max = int.Parse(strArray[3]) }; this.Add(index, one); index++; } }
private void Add(int id, Drop_GoldModel.DropWeightOne one) { this.mList.Add(id, one); this.mRandom.Add(id, one.Weight); }