public Game(Configuration configuration) { Configuration = configuration; Actors = new ActorCollection(this); Behaviors = new BehaviorCollection(this); Players = new PlayerCollection(this); }
public MainWindow() { InitializeComponent(); LibraryCollection = new LibraryCollection(); ItemCollection = new MetadataItemCollection(); CastCollection = new ActorCollection(); AllActorsCollection = new ActorCollection(); }
/// <summary> /// Remove an actor from the actor collection by ID /// </summary> /// <param name="id"></param> /// <returns></returns> public bool RemoveActor(long id) { if (ActorCollection.Count(ent => ent.ID == id) > 0) { return(ActorCollection.Remove(ActorCollection.First(ent => ent.ID == id))); } else { return(false); } }
/// <summary> /// Remove an actor from the Actor collection /// </summary> /// <param name="actor"></param> /// <returns></returns> public bool RemoveActor(BaseActor actor) { if (ActorCollection.Contains(actor)) { return(ActorCollection.Remove(actor)); } else { return(false); } }
/// <summary> /// Get an actor from the Actor collection by their ID number /// </summary> /// <param name="id"></param> /// <returns></returns> public BaseActor GetActor(long id) { if (ActorCollection.Count(ent => ent.ID == id) > 0) { return(ActorCollection.First(ent => ent.ID == id)); } else { return(null); } }
private void SetupDefaults() { Scene = new Scene(); Viewport = Display.CreateViewport(0, 0, DefaultDisplayDimension.Width, DefaultDisplayDimension.Height); Display.BackgroundColor = Color.FromArgb(0xff, 0xff, 0xff, 0xff); Camera = new Camera(); Camera.Prepare(Viewport); Viewport.Camera = Camera; Viewport.Scene = Scene; Actors = new ActorCollection(); }
internal Map(List <Texture2D> textures, Texture2D background, int[,] map, List <GameObject> objects, string ambientAudio, DoorCollection <Door> doors, ActorCollection <Actor> actors, SecretCollection <Secret> secrets, Vector2 spawnPoint) { Textures = textures; Background = background; this.ObjectDatabase = objects; WorldMap = map; AmbientAudio = ambientAudio; Doors = doors; SpawnPoint = spawnPoint; Actors = actors; Secrets = secrets; CreatePathFinder(map); Bullets = new BulletCollection <Bullet>(); }
/// <summary> /// Registers an Actor with the Manager. If the registration /// is successful, return TRUE. /// Registration can only fail if the ID is in use or an ID <= 0 is used by an actor /// </summary> /// <param name="actor"></param> /// <returns></returns> public bool RegisterActor(BaseActor actor) { if (ActorCollection.Count(ent => ent.ID == actor.ID) > 0) { return(false); } else if (actor.ID <= 0) { return(false); // ID's must be 1 or greater. message dispatcher uses 0 and -1 as specials } else { ActorCollection.Add(actor); return(true); } }
protected Actor() { Actors = new ActorCollection(); }
/// <summary> /// Class Constructor. /// </summary> /// <param name="profileName">Integration Profile Name.</param> public IheFramework(System.String profileName) { _iheFrameworkConfig = new IheFrameworkConfig(profileName); _actors = new ActorCollection(); _actorsTransactionLog = new ActorsTransactionLog(); }
protected Actor() { Actors = new ActorCollection(); Constructed(); }
/// <summary> /// Clears the managers actor collection /// This WILL NOT dispose the actors within the collection /// </summary> public void ClearAllActors() { ActorCollection.Clear(); ActorCollection = null; ActorCollection = new HashSet <BaseActor>(); }
/// <summary> /// Check all registered actors and see if the ID is currently in use by another actor /// </summary> /// <param name="id"></param> /// <returns></returns> public bool IsIDAvailable(long id) { return(ActorCollection.Count(ent => ent.ID == id) == 0); }
/// <summary> /// Get the actor collection as a List object /// </summary> /// <returns></returns> public List <BaseActor> GetActorList() { return(ActorCollection.ToList()); }
public Player(Game game) { Game = game; Actors = new ActorCollection(game); }
public static void ResetTaggings(MetadataItem metadataItem, ActorCollection cast) { // metadata_items.userfields must have lockedFields with 19 in "|" piped delimited list string user_fields = "lockedFields=19"; // If there is an equal sign, assume that everything after is pipe delitemed ints // Don't throw an exception try { if (!string.IsNullOrWhiteSpace(metadataItem.user_fields) && metadataItem.user_fields.Contains("=")) { List <int> lockedFieldList = metadataItem.user_fields.Substring(metadataItem.user_fields.IndexOf("=") + 1).Split('|').Select(Int32.Parse).ToList(); if (!lockedFieldList.Contains(19)) { lockedFieldList.Add(19); lockedFieldList.Sort(); } user_fields = "lockedFields=" + string.Join("|", lockedFieldList); } } catch { } StringBuilder deleteTaggings = new StringBuilder(); deleteTaggings.AppendLine("DELETE FROM taggings"); deleteTaggings.AppendLine("WHERE id in ("); deleteTaggings.AppendLine(" SELECT ti.id"); deleteTaggings.AppendLine(" FROM taggings ti"); deleteTaggings.AppendLine(" JOIN tags t"); deleteTaggings.AppendLine(" ON ti.tag_id = t.id"); deleteTaggings.AppendLine(" AND t.tag_type = 6"); deleteTaggings.AppendLine(" WHERE ti.metadata_item_id = @metadata_item_id"); deleteTaggings.AppendLine(" );"); StringBuilder insertTag = new StringBuilder(); insertTag.AppendLine("INSERT INTO tags (tag,tag_type,created_at,updated_at)"); insertTag.AppendLine("VALUES("); insertTag.AppendLine(" @tag"); insertTag.AppendLine(" ,6"); insertTag.AppendLine(" ,datetime(current_timestamp, 'localtime')"); insertTag.AppendLine(" ,datetime(current_timestamp, 'localtime')"); insertTag.AppendLine(" );"); StringBuilder updateUserFields = new StringBuilder(); updateUserFields.AppendLine("UPDATE metadata_items"); updateUserFields.AppendLine("SET user_fields = @user_fields"); updateUserFields.AppendLine("WHERE id = @metadata_item_id"); string comma = ""; int index = 0; StringBuilder insertTaggging = new StringBuilder(); insertTaggging.AppendLine("insert into taggings(metadata_item_id, tag_id, [index], created_at)"); insertTaggging.AppendLine("values"); using (var connection = new SQLiteConnection(string.Format("Data Source={0};Version=3;", DBFile))) { connection.Open(); using (SQLiteTransaction transaction = connection.BeginTransaction()) { using (SQLiteCommand command = new SQLiteCommand(connection)) { foreach (Actor actor in cast) { // Create tag for actors that don't exist if (actor.id < 0) { command.CommandText = insertTag.ToString(); command.Parameters.AddWithValue("@tag", actor.tag); command.ExecuteNonQuery(); command.CommandText = "SELECT last_insert_rowid()"; actor.id = (long)command.ExecuteScalar(); } insertTaggging.AppendLine(string.Format(" {0}({1}, {2}, {3}, datetime(current_timestamp, 'localtime'))", comma, metadataItem.id, actor.id, index)); comma = ","; index++; } // Delete all existing actor taggings command.CommandText = deleteTaggings.ToString(); command.Parameters.AddWithValue("@metadata_item_id", metadataItem.id); command.ExecuteNonQuery(); if (cast.Count > 0) { // Insert all new actor taggings command.CommandText = insertTaggging.ToString(); command.ExecuteNonQuery(); } // Updating user_fileds with value of 19 in pipe list command.CommandText = updateUserFields.ToString(); command.Parameters.AddWithValue("@user_fields", user_fields); command.Parameters.AddWithValue("@metadata_item_id", metadataItem.id); command.ExecuteNonQuery(); } transaction.Commit(); } connection.Close(); } }