internal int GetRandFriendId(int campId)
{
int id = 0;
List<int> ids = new List<int>();
for (LinkedListNode<EntityInfo> linkNode = ClientModule.Instance.EntityManager.Entities.FirstValue; null != linkNode; linkNode = linkNode.Next) {
EntityInfo info = linkNode.Value;
if (EntityInfo.GetRelation(campId, info.GetCampId()) == CharacterRelation.RELATION_FRIEND && info.EntityType != (int)EntityTypeEnum.Tower) {
ids.Add(info.GetId());
}
}
int index = Helper.Random.Next(ids.Count);
if (index >= 0 && index < ids.Count) {
id = ids[index];
}
return id;
}
EntityController::GetRandFriendId ( int campId, HashSet |
static public int GetRandFriendId(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { GameFramework.EntityController self = (GameFramework.EntityController)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.GetRandFriendId(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { GameFramework.EntityController self = (GameFramework.EntityController)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Collections.Generic.HashSet <System.Int32> a2; checkType(l, 3, out a2); var ret = self.GetRandFriendId(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }