Пример #1
0
    public static int GetBoxAmount(int boxId)
    {
        RandomItemBoxInfo bibi = RandomItemBoxInfo.GetBoxInfoById(boxId);

        if (bibi != null)
        {
            return(bibi.boxAmount);
        }
        return(0);
    }
Пример #2
0
    public static List <ItemIdCount> GenItemDicByBoxId(int boxId, out string path, System.Random rand = null)
    {
        //test return 1,1
        List <ItemIdCount> items = new List <ItemIdCount>();

        items.Add(new ItemIdCount(1, 1));

        //--to do
        //1.getbox
        path = testPath;
        RandomItemBoxInfo ribi = RandomItemBoxInfo.GetBoxInfoById(boxId);

        if (ribi == null)
        {
            return(null);
        }
        path = ribi.boxModelPath;

        //2.getrule
        RandomItemRulesInfo riri = RandomItemRulesInfo.GetRuleInfoById(ribi.rulesId);

        if (riri == null)
        {
            return(null);
        }

        //3.random items
        if (rand == null)
        {
            rand = new System.Random((int)System.DateTime.UtcNow.Ticks);
        }
        int itemAmount = rand.Next(ribi.boxItemAmountMin, ribi.boxItemAmountMax + 1);

        items = riri.RandomItemDict(itemAmount, rand);

        return(items);
    }