You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1005 B
39 lines
1005 B
using System.Linq;
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Game
|
|
{
|
|
public static class IconUtils
|
|
{
|
|
public static List<HeadDesc> _freeIcon = new List<HeadDesc>();
|
|
|
|
public static List<HeadDesc> GetFreeIcon()
|
|
{
|
|
if (_freeIcon.Count == 0)
|
|
{
|
|
for (int i = 0; i < HeadDescMgr.Instance.ItemTable.Values.Count; i++)
|
|
{
|
|
var _desc = HeadDescMgr.Instance.ItemTable.Values[i];
|
|
if (_desc.headType == 1)
|
|
{
|
|
_freeIcon.Add(_desc);
|
|
}
|
|
}
|
|
}
|
|
|
|
return _freeIcon;
|
|
}
|
|
|
|
public static string GetRandFreeIcon()
|
|
{
|
|
var list = GetFreeIcon();
|
|
if(list.Count == 0)
|
|
{
|
|
return "";
|
|
}
|
|
return list[GameServerUtils.GetApp().Rand.Next(list.Count)].id.ToString();
|
|
}
|
|
}
|
|
}
|
|
|