コード例 #1
0
        internal LootInfo Add(int minValue, int maxValue)
        {
            LootInfo result = new LootInfo(minValue, maxValue);

            list.Add(result);
            return(result);
        }
コード例 #2
0
        public int Set(int minValue, int maxValue)
        {
            int result = -1;

            if (count == 0 || (0 < count && (list.Count <= index)))
            {
                LootInfoList listItem;
                if (isSetItem || lastLootInfo == null)
                {
                    listItem = new LootInfoList();
                    list.Add(listItem);
                    isSetItem = false;
                }
                else
                {
                    listItem = list[index];
                }
                lastLootInfo = listItem.Add(minValue, maxValue);
                index        = list.Count - 1;
                indexSub     = list[index].Count - 1;
                result       = minValue;
            }
            else
            {
                for (; index < list.Count; index++)
                {
                    lastLootInfo = list[index][indexSub];
                    if (lastLootInfo.minValue == minValue && lastLootInfo.maxValue == maxValue)
                    {
                        if (indexSub == 0)
                        {
                            list[index].Increment();
                        }
                        result = lastLootInfo.value;

                        ++indexSub;
                        if (list[index].Count <= indexSub)
                        {
                            indexSub = 0;
                            ++index;
                        }
                        break;
                    }
                }
                //if (result < 0)
                //{
                //	var listItem = new LootInfoList();
                //	list.Add(listItem);
                //	index = list.Count - 1;
                //	indexSub = 0;
                //	lastLootInfo = list[index].Add(minValue, maxValue);
                //	result = 0;
                //}
            }
            return(result);
        }
コード例 #3
0
 internal static void NextLoop(int val)
 {
     if (val == 0)
     {
         list.Clear();
         lastLootInfo = null;
         isSetItem    = false;
     }
     count    = val;
     index    = 0;
     indexSub = 0;
 }