Example #1
0
        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();
 }
Example #3
0
 /// <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);
     }
 }
Example #4
0
 /// <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);
     }
 }
Example #5
0
 /// <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);
     }
 }
Example #6
0
		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();
		}
Example #7
0
        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();
        }
Example #8
0
 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>();
 }
Example #9
0
 /// <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);
     }
 }
Example #10
0
File: Actor.cs Project: Conn/Balder
 protected Actor()
 {
     Actors = new ActorCollection();
 }
Example #11
0
 /// <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();
 }
Example #12
0
 protected Actor()
 {
     Actors = new ActorCollection();
     Constructed();
 }
Example #13
0
 /// <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>();
 }
Example #14
0
 /// <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);
 }
Example #15
0
 /// <summary>
 /// Get the actor collection as a List object
 /// </summary>
 /// <returns></returns>
 public List <BaseActor> GetActorList()
 {
     return(ActorCollection.ToList());
 }
Example #16
0
 public Player(Game game)
 {
     Game   = game;
     Actors = new ActorCollection(game);
 }
Example #17
0
        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();
            }
        }