Example #1
0
    public static int CompareConsumable(WeihuaGames.ClientClass.Consumable c1, WeihuaGames.ClientClass.Consumable c2)
    {
        var i1 = ConfigDatabase.DefaultCfg.ItemConfig.GetItemById(c1.Id);
        var i2 = ConfigDatabase.DefaultCfg.ItemConfig.GetItemById(c2.Id);

        if (i1 == null)
        {
            Debug.Log(string.Format("ItemConfig id {0} not Found.", c1.Id.ToString("X")));
            return(0);
        }

        if (i2 == null)
        {
            Debug.Log(string.Format("ItemConfig id {0} not Found.", c2.Id.ToString("X")));
            return(0);
        }

        if (i1.sortIdx != i2.sortIdx)
        {
            return(i2.sortIdx - i1.sortIdx);
        }
        else
        {
            return(i2.id - i1.id);
        }
    }
Example #2
0
    public static int CompareBeastPart(WeihuaGames.ClientClass.Consumable c1, WeihuaGames.ClientClass.Consumable c2)
    {
        var i1 = ConfigDatabase.DefaultCfg.BeastConfig.GetBeastPartByBeastPartId(c1.Id);
        var i2 = ConfigDatabase.DefaultCfg.BeastConfig.GetBeastPartByBeastPartId(c2.Id);

        if (i1.SortPart != i2.SortPart)
        {
            return(i2.SortPart - i1.SortPart);
        }

        return(0);
    }