Beispiel #1
0
 public static ItemInfo GenerateItemInfoByDrop(DropData dropData)
 {
     int index = RandomUtils.Weight(dropData.WeightList);
     int itemKid = dropData.ItemKidList[index];
     int count = RandomUtils.Range(dropData.MinCountList[index], dropData.MaxCountList[index]);
     ItemData data = ItemDataManager.Instance.GetData(itemKid) as ItemData;
     ItemInfo info = new ItemInfo(data, count);
     return info;
 }
Beispiel #2
0
        public static Item Create(DropData dropData, Vector3 position)
        {
            ItemInfo info = DropProxy.GenerateItemInfoByDrop(dropData);

            Item item = new Item();
            item.Uid = Guid.NewGuid().ToString();
            item.Data = info.Data;
            item.Info = info;
            item.Script = ResourceManager.Instance.LoadAsset<ItemScript>(ObjectType.GameObject, item.Data.GetResPath());
            item.Script.transform.parent = RootTransform.Instance.DropRoot; 
            item.Script.Uid = item.Uid;

            item.SetPosition(position);

            return item;
        }
Beispiel #3
0
        public void Parse(string name, out Dictionary<int, DropData> kvDic)
        {
			LoadFile(name);
			
			kvDic = new Dictionary<int, DropData>();
			
			while (!EndOfRow)
			{
				int col = 0;
				
				DropData data = new DropData();
                data.Kid = ReadInt(col++);
                data.MaxNum = ReadInt(col++);
                data.ItemKidList = ReadIntList(col++);
                data.MinCountList = ReadIntList(col++);
                data.MaxCountList = ReadIntList(col++);
                data.WeightList = ReadIntList(col++);

				kvDic.Add(data.Kid, data);
				
				NextLine();
			}
        }