private static List <Marshaled_SourceEntityInfo> GetMarshaledSubCards(Entity source) { List <Marshaled_SourceEntityInfo> list = new List <Marshaled_SourceEntityInfo>(); foreach (int num in source.GetSubCardIDs()) { Entity entity = GameState.Get().GetEntity(num); if (entity == null) { Log.PlayErrors.Print(string.Format("Subcard of {0} is null in GetMarshaledSubCards()!", source.GetName()), new object[0]); } else { SourceEntityInfo sourceInfo = entity.ConvertToSourceInfo(Power.GetDefaultMasterPower().GetPlayRequirementInfo(), source); list.Add(Marshaled_SourceEntityInfo.ConvertFromSourceEntityInfo(sourceInfo)); } } return(list); }
public static ErrorType GetTargetEntityError(Entity source, Entity target) { if (!s_initialized) { return(ErrorType.NONE); } Player owningPlayer = GetOwningPlayer(source); if (owningPlayer == null) { return(ErrorType.NONE); } SourceEntityInfo sourceInfo = source.ConvertToSourceInfo(GetPlayRequirementInfo(source), null); PlayerInfo playerInfo = owningPlayer.ConvertToPlayerInfo(); GameStateInfo gameInfo = GameState.Get().ConvertToGameStateInfo(); Marshaled_PlayErrorsParams playErrorsParams = new Marshaled_PlayErrorsParams(sourceInfo, playerInfo, gameInfo); Marshaled_TargetEntityInfo info4 = Marshaled_TargetEntityInfo.ConvertFromTargetEntityInfo(target.ConvertToTargetInfo()); List <Marshaled_TargetEntityInfo> marshaledEntitiesInPlay = GetMarshaledEntitiesInPlay(); return(DLL_GetTargetEntityError(playErrorsParams, info4, marshaledEntitiesInPlay.ToArray(), marshaledEntitiesInPlay.Count)); }
private static void LoadEntity(int id) { List <string> data = new List <string>(); foreach (Match match in Regex.Matches(BSP_Entities[id], "\"[^\"]*\"", RegexOptions.IgnoreCase)) { data.Add(match.Value.Trim('"')); } int classNameIndex = data.FindIndex(n => n == "classname"); WorldController.CurrentTexPath = WorldController.DefaultTexPath; if (data[classNameIndex + 1] == "worldspawn") { WorldSpawn(); return; } if (data[0] == "model") { GameObject entObject = GameObject.Find(data[data.FindIndex(n => n == "model") + 1]); SourceEntityInfo entInfo = entObject.AddComponent <SourceEntityInfo>(); entInfo.ModelId = int.Parse(entObject.name.Replace("*", "")); entInfo.baseDescription = data; entInfo.EntityId = id; entInfo.Configure(); } else { GameObject entObject = new GameObject(); entObject.transform.parent = BSP_WorldSpawn.transform; SourceEntityInfo entInfo = entObject.AddComponent <SourceEntityInfo>(); entInfo.baseDescription = data; entInfo.EntityId = id; entInfo.Configure(); } }
public static ErrorType GetPlayEntityError(Entity source) { Log.PlayErrors.Print(string.Concat(new object[] { "GetPlayEntityError (", s_initialized, ") ", source }), new object[0]); if (!s_initialized) { return(ErrorType.NONE); } Player owningPlayer = GetOwningPlayer(source); if (owningPlayer == null) { return(ErrorType.NONE); } SourceEntityInfo sourceInfo = source.ConvertToSourceInfo(GetPlayRequirementInfo(source), null); PlayerInfo playerInfo = owningPlayer.ConvertToPlayerInfo(); GameStateInfo gameInfo = GameState.Get().ConvertToGameStateInfo(); Marshaled_PlayErrorsParams playErrorsParams = new Marshaled_PlayErrorsParams(sourceInfo, playerInfo, gameInfo); List <Marshaled_TargetEntityInfo> marshaledEntitiesInPlay = GetMarshaledEntitiesInPlay(); List <Marshaled_SourceEntityInfo> marshaledSubCards = GetMarshaledSubCards(source); return(DLL_GetPlayEntityError(playErrorsParams, marshaledSubCards.ToArray(), marshaledSubCards.Count, marshaledEntitiesInPlay.ToArray(), marshaledEntitiesInPlay.Count)); }