protected void AddActorButton_Click(object sender, EventArgs e) { string firstName = FirstNameTextBox.Text.Trim(); string lastName = LastNameTextBox.Text.Trim(); if (firstName != "" && lastName != "") { int country = int.Parse(CountriesDropDownList.SelectedValue); int bYear = int.Parse(BornYearTextBox.Text.Trim()); string pic = ""; if (PhotoFileUpload.PostedFile != null) { if (PhotoFileUpload.PostedFile.FileName.Trim().Length > 0 && PhotoFileUpload.PostedFile.ContentLength > 0) { pic = Path.GetFileName(PhotoFileUpload.PostedFile.FileName.Trim()); string dir = Server.MapPath("~/Pictures/Actors/"); string file = Path.GetFileName(PhotoFileUpload.PostedFile.FileName.Trim()); PhotoFileUpload.PostedFile.SaveAs(dir + file); } } Actor a1 = new Actor(0, firstName, lastName, bYear, country, pic); Actors.AddActor(a1); int actorID = Actors.GetLastActorID(); Response.Redirect("/Pages/OneActor.aspx?aid=" + actorID); } }
internal void AddActor(Actor actor) { allActors.Add(actor); Actors.AddActor(actor); DrawList.Add(actor); DrawListLookUp.Add(actor.Id, actor); if (!textures.ContainsKey(actor.GetComponent <Sprite>().Data.TexturePath)) { textures.Add(actor.GetComponent <Sprite>().Data.TexturePath, Calamity.Instance.ContentManager.GetTexture2D(actor.GetComponent <Sprite>().Data.TexturePath)); } }
internal void AddActor(Actor actor) { if (OutPhaseList.Count == 0) { actor.Id = Actors.GetCount(); foreach (Component component in actor.components) { component.Owner = actor; } Actors.AddActor(actor); SortActor(actor); } if (OutPhaseList.Count > 0) { var tempID = OutPhaseList.Dequeue(); actor.Id = tempID; Actors.actors[tempID] = actor; foreach (Component component in actor.components) { component.Owner = actor; } SortActor(actor); } }