public async Task <IActionResult> Edit(int id, [Bind("TitleId,CharacterId,Id")] Acting acting) { if (id != acting.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(acting); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActingExists(acting.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CharacterId"] = new SelectList(_context.Characters, "Id", "Name", acting.CharacterId); ViewData["TitleId"] = new SelectList(_context.Title, "Id", "Name", acting.TitleId); return(View(acting)); }
void InsertActData() { for (int i = 0; i < actionData.Count; i++) { string[] splitedData = actionData[i]["item_var_name"].ToString().Split(new char[] { '_' }); if (splitedData.Length > 1 && splitedData[1] == curCategory.ToString()) { GameObject obj = Instantiate(Listitem); obj.transform.SetParent(Contents.transform); Acting acting = obj.GetComponent <Acting>(); acting.Title.text = actionData[i]["item_name"].ToString(); acting.Description.text = actionData[i]["item_desc"].ToString(); acting.actName = splitedData[0]; acting.category = curCategory; acting.Changement = GetChangement(i); obj.GetComponent <Image>().sprite = Resources.Load("Main/m_schedule/" + actionData[i]["item_var_name"], typeof(Sprite)) as Sprite; obj.GetComponent <Button>().onClick.AddListener(() => { curWeek.GetComponent <Week>().act = new Act(acting); }); IncreaseContentsHeight((obj.transform as RectTransform).rect.height); } } }
/// <summary> /// 获取用于展示的地块信息 /// </summary> /// <param name="player"></param> /// <returns></returns> public virtual object GetInfo(GamePlayer player) { var relativeCoordinate = Coordinate.ToRelative(player); var data = JObject.FromObject( new { Coordinate = relativeCoordinate, Terrain = Terrain == null ? null : Terrain.GetInfo(), TraficNetwork = TraficNetwork == null ? null : TraficNetwork.GetInfo(), Building = Building == null ? null : Building.GetInfo(), Resources, IsMine = Owner == player.Guid, Nearly = relativeCoordinate.NearlyCoordinates(), }); if (Acting == null) { data["Actions"] = JArray.FromObject(GetActions(player).Select(item => item.GetInfo())); } else { data["Action"] = JObject.FromObject(Acting.GetInfo()); } return(data); }
private void Activate(Acting acting) { if (!acting.actor.IsDead()) { acting.ActivateIfDidNotAct(); } }
public static void AddComponents(EntityFactory factory) { // Apply these one after the other. // This will only initialize the inject variables of the behavior / component. // So, apply will be autogenerated for the different behaviors based on their injects. // Or do it even smarter? // So, since I'd like to make components structs in the future and store them somewhere // central (optionally), these can actually reference a global storage for them. // So this just adds the behavior Acting.AddTo(factory, null, Algos.SimpleAlgo, Order.Player); Moving.AddTo(factory); Digging.AddTo(factory); Pushable.AddTo(factory); Attacking.AddTo(factory, Attacking.GetTargetProviderFromInventory, Layers.REAL, Faction.Enemy | Faction.Environment); Attackable.AddTo(factory, Attackness.ALWAYS); Damageable.AddTo(factory, new Health(5)); Displaceable.AddTo(factory, Layers.BLOCK); Ticking.AddTo(factory); FactionComponent.AddTo(factory, Faction.Player); Transform.AddTo(factory, Layers.REAL, TransformFlags.Default); Inventory.AddTo(factory); Inventory.AddInitTo(factory); // TODO: pass this an action Controllable.AddTo(factory, // The default action is the AttackDigMove action. Action.Compose(Attacking.Action, Digging.Action, Moving.Action)); // TODO: rename the namespaces Stats.AddTo(factory, Registry.Global.Stats._map); }
public InventoryTests() { InitScript.Init(); { entityFactory = new EntityFactory(); // AddComponents var transform = Transform.AddTo(entityFactory, Layers.REAL, TransformFlags.Default); var stats = Stats.AddTo(entityFactory, Registry.Global.Stats._map); var acting = Acting.AddTo(entityFactory, null, Algos.SimpleAlgo, Order.Player); var moving = Moving.AddTo(entityFactory); var displaceable = Displaceable.AddTo(entityFactory, Layers.BLOCK); var inventory = Inventory.AddTo(entityFactory); var ticking = Ticking.AddTo(entityFactory); // InitComponents acting.DefaultPreset(entityFactory); moving.DefaultPreset(); displaceable.DefaultPreset(); ticking.DefaultPreset(); // Retouch Equip.OnDisplaceHandlerWrapper.HookTo(entityFactory); Inventory.AddInitTo(entityFactory); } { itemFactory = new EntityFactory(); var transform = Transform.AddTo(itemFactory, Layers.ITEM, 0); } }
public Acting whatActing()//선원이 무엇을 행동하는지? { acting_type = Acting.NOTHING; if (Fishing == true) // 낚시중 { acting_type = Acting.FISHING; } else if (Repair == true) // 수리중 { acting_type = Acting.REPAIR; } else if (Drive == true) // 항해중 { acting_type = Acting.DRIVE; } else if (Sleep == true) // 숙면중 { acting_type = Acting.SLEEP; } else if (Eat == true) // 먹는중 { acting_type = Acting.EAT; } return(acting_type); }
public ActionResult DeleteConfirmed(int id) { Acting acting = db.Actings.Find(id); db.Actings.Remove(acting); db.SaveChanges(); return(RedirectToAction("Index")); }
public Act(Acting acting) { Title = string.Copy(acting.Title.text); Description = string.Copy(acting.Description.text); Category = acting.category; Name = string.Copy(acting.actName); Changement = acting.Changement.clone; IsEvent = acting.IsEvent; }
public ActionResult Edit([Bind(Include = "Id,Name,Gender,DOB,Bio")] Acting acting) { if (ModelState.IsValid) { db.Entry(acting).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(acting)); }
public static void AddComponents(Entity subject) { Stats.AddTo(subject, Registry.Global.Stats._map); Transform.AddTo(subject, Layers.TRAP, 0); FactionComponent.AddTo(subject, Faction.Enemy); Acting.AddTo(subject, ctx => Bouncing.UAction.Compile(), Algos.SimpleAlgo, Order.Trap); Damageable.AddTo(subject, new Health(1)); Ticking.AddTo(subject); Bouncing.AddTo(subject); }
public ActionResult Edit([Bind(Include = "ActingId,PersonId,FilmId")] Acting acting) { if (ModelState.IsValid) { db.Entry(acting).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(acting)); }
public ActionResult Create([Bind(Include = "Id,Name,Gender,DOB,Bio")] Acting acting) { if (ModelState.IsValid) { db.Actings.Add(acting); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(acting)); }
public ActionResult Create([Bind(Include = "ActingId,PersonId,FilmId")] Acting acting) { if (ModelState.IsValid) { db.Actings.Add(acting); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(acting)); }
public TurnChanged SetPlayerActing() { ClearStateVariables(); IsPlayerActing = true; var newActingState = new Acting(); var stateChanged = Next(newActingState); var turnChanged = new TurnChanged(stateChanged.FromStateName, stateChanged.ToStateName); return(turnChanged); }
public async Task <IActionResult> Create([Bind("TitleId,CharacterId,Id")] Acting acting) { if (ModelState.IsValid) { _context.Add(acting); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CharacterId"] = new SelectList(_context.Characters, "Id", "Name", acting.CharacterId); ViewData["TitleId"] = new SelectList(_context.Title, "Id", "Name", acting.TitleId); return(View(acting)); }
public Slide_Tests() { InitScript.Init(); entityFactory = new EntityFactory(); Transform.AddTo(entityFactory, Layers.REAL, TransformFlags.Default); Stats.AddTo(entityFactory, Registry.Global.Stats._map); Ticking.AddTo(entityFactory).DefaultPreset(); Displaceable.AddTo(entityFactory, Layers.BLOCK).DefaultPreset(); Moving.AddTo(entityFactory).DefaultPreset(); Pushable.AddTo(entityFactory).DefaultPreset(); Acting.AddTo(entityFactory, null, Algos.SimpleAlgo, Order.Entity).DefaultPreset(entityFactory); }
// GET: Actings/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Acting acting = db.Actings.Find(id); if (acting == null) { return(HttpNotFound()); } return(View(acting)); }
public static void AddComponents(Entity subject) { Stats.AddTo(subject, Registry.Global.Stats._map); Transform.AddTo(subject, Layers.PROJECTILE, 0); FactionComponent.AddTo(subject, Faction.Environment); Displaceable.AddTo(subject, 0); ProjectileComponent.AddTo(subject, Layers.REAL | Layers.WALL | Layers.PROJECTILE); Attackable.AddTo(subject, Attackness.CAN_BE_ATTACKED); Damageable.AddTo(subject, new Health(1)); Ticking.AddTo(subject); Acting.AddTo( subject, entity => ProjectileComponent.Action.Compile(entity.GetTransform().orientation), Algos.SimpleAlgo, Order.Projectile); }
private bool Eat; //식사유무 public Crewman(int type) { this.type = type; behavior = 10; fishing = 10; repair = 3; sailing_speed = 0; full = 4; index = -1; time = -1; Fishing = false; Repair = false; Drive = false; Sleep = false; Eat = false; acting_type = Acting.NOTHING; }
public static void AddComponents(Entity subject, System.Action <Acting.Context> Algorithm, params Step[] sequenceSteps) { Stats.AddTo(subject, Registry.Global.Stats._map); Transform.AddTo(subject, Layers.REAL, TransformFlags.Default); FactionComponent.AddTo(subject, Faction.Enemy); Acting.AddTo(subject, Sequential.CalculateAction, Algorithm, Order.Entity); Moving.AddTo(subject); Ticking.AddTo(subject); Pushable.AddTo(subject); Attacking.AddTo(subject, entity => BufferedAttackTargetProvider.Simple, Layers.REAL, Faction.Player); Sequential.AddTo(subject, new Sequence(sequenceSteps)); Attackable.AddTo(subject, Attackness.ALWAYS); Damageable.AddTo(subject, new Health(1)); Displaceable.AddTo(subject, Layers.BLOCK); MoreChains.AddTo(subject, Registry.Global.MoreChains._map); }
public static void GhostTest() { var world = new World(5, 5); var p_fact = new EntityFactory<Entity>() .AddBehavior(Acting.Preset(new Acting.Config(Algos.SimpleAlgo))) .AddBehavior(Attacking.Preset); var player = world.SpawnPlayer(p_fact, new IntVector2(1, 1)); player.Stats.GetRaw(Attack.Path).damage = 10; var ghost = world.SpawnEntity(Ghost.CreateFactory(), player.Pos + IntVector2.Right); player.Behaviors.Get<Acting>().NextAction = Action.CreateBehavioral<Attacking>().WithDir(IntVector2.Right); world.Loop(); System.Console.WriteLine($"Player's new position {player.Pos}"); }
// GET: Actings/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Acting acting = db.Actings.Find(id); if (acting == null) { return(HttpNotFound()); } //code to generate dropdowns //FILMS -------------------------------------------------------------------- //from the Films model DbSet //select all columns from the database //orderby the film title var filmQuery = from m in db.Films orderby m.FilmTitle select m; //construct full films dropdown list preselected with the foreign key //do so from the query results and display the FilmTitle //store in FilmID in the ViewBag ViewBag.FilmId = new SelectList(filmQuery, "FilmID", "FilmTitle", acting.FilmId); //PERSONS ------------------------------------------------------------------ //from the Persons model DbSet //select the fname and sname as a new field called Name //and the person id - order by the sname var personsQuery = from p in db.Persons orderby p.PersonSname select new { Name = p.PersonFname + " " + p.PersonSname, p.PersonId }; //construct full films dropdown list preselected with the foreign key //do so from the query results and display the Name (combined above) //store in FilmId in the ViewBag ViewBag.PersonId = new SelectList(personsQuery, "PersonId", "Name", acting.PersonId); return(View(acting)); }
public static void SlideTest() { var world = new World(5, 5); var p_fact = new EntityFactory<Entity>() .AddBehavior(Acting.Preset(new Acting.Config(Algos.SimpleAlgo))) .AddBehavior(Attacking.Preset) .AddBehavior(Moving.Preset) .AddBehavior(Displaceable.DefaultPreset) .AddBehavior(Statused.Preset) .Retouch(Hopper.Core.Retouchers.Reorient.OnDisplace) .Retouch(Hopper.Core.Retouchers.Skip.EmptyAttack); var player = world.SpawnPlayer(p_fact, new IntVector2(1, 1)); var ice_fact = IceFloor.CreateFactory(); var ice1 = world.SpawnEntity(ice_fact, new IntVector2(2, 1)); var ice2 = world.SpawnEntity(ice_fact, new IntVector2(3, 1)); var action = new CompositeAction( Action.CreateBehavioral<Attacking>(), Action.CreateBehavioral<Moving>() ); void SetAction(IntVector2 vec) => player.Behaviors.Get<Acting>().NextAction = action.Copy().WithDir(vec); void Print() { System.Console.WriteLine($"Is status applied? {SlideStatus.Status.IsApplied(player)}"); System.Console.WriteLine($"Position: {player.Pos}"); } SetAction(IntVector2.Right); world.Loop(); Print(); SetAction(IntVector2.Down); world.Loop(); Print(); SetAction(IntVector2.Down); world.Loop(); Print(); SetAction(IntVector2.Down); world.Loop(); Print(); }
public static void ShieldTest() { var slot = new SizedSlot<CircularItemContainer, Hopper.Core.Items.IItem>("blocking", 1); var shield = new Hopper.Core.Items.ModularItem(new ItemMetadata("Test_Shield"), slot, ShieldModule.CreateFront(2)); var enemy.Factory = new EntityFactory<Entity>().AddBehavior(Attackable.DefaultPreset); var player.Factory = new EntityFactory<Entity>() .AddBehavior(Attacking.Preset) .AddBehavior(Acting.Preset(new Acting.Config(Algos.SimpleAlgo))); var world = new World(5, 5); var player = world.SpawnPlayer(player.Factory, new IntVector2(1, 1)); player.Reorient(new IntVector2(1, 0)); var enemy = world.SpawnEntity(enemy.Factory, new IntVector2(2, 1)); enemy.Reorient(new IntVector2(-1, 0)); shield.BeEquipped(enemy); var attackAction = Action.CreateBehavioral<Attacking>(); player.Behaviors.Get<Acting>().NextAction = attackAction.WithDir(new IntVector2(1, 0)); world.Loop(); player.Stats.GetRaw(Attack.Path).pierce += 2; player.Behaviors.Get<Acting>().NextAction = attackAction.WithDir(new IntVector2(1, 0)); world.Loop(); }
public async Task <IActionResult> AddActorsToMovie([FromRoute] int id, [FromBody] ActorIdsWrapper actorIdsWrapper) { Movie movie = _movieRepository.GetSingle(m => m.ID == id); if (movie == null) { return(NotFound()); } var count = 0; // add actors to movie foreach (var actorId in actorIdsWrapper.ActorIds) { Actor actor = _actorRepository.GetSingle(a => a.ID == actorId); if (actor == null) { continue; } var acting = new Acting { ActorID = actorId, MovieID = id }; var actingAlreadyExists = _context.Actings.Where(ac => ac.ActorID == actorId && ac.MovieID == id).FirstOrDefault(); if (actingAlreadyExists != null) { continue; } count++; _context.Actings.Add(acting); _context.SaveChanges(); } return(new OkObjectResult(count)); }
private string actingEnumToString(Acting acting) { switch (acting) { case Acting.FISHING: return("낚시"); case Acting.REPAIR: return("수리"); case Acting.SLEEP: return("수면"); case Acting.EAT: return("식사"); case Acting.DRIVE: return("항해"); } return(null); }
/// <summary> /// 对地块执行例行检查,处理例行事项 /// </summary> public override void Check(DateTime now) { lock ( SyncRoot ) { Collect(); if (Acting != null) { Acting.Check(now); } if (Terrain != null) { Terrain.Check(now); } if (TraficNetwork != null) { TraficNetwork.Check(now); } if (Building != null) { Building.Check(now); } foreach (var item in GetUnits()) { item.Check(now); } SaveActing(); } }
private async void button4_Click(object sender, EventArgs e) { try { int actorId = 1 + ((List <Actor>) await Program.MobileService.GetTable <Actor>().ToListAsync()).Count; String name = textBox1.Text; String image = textBox2.Text; String desc = textBox5.Text; Actor actor = new Actor(actorId, name, image, desc); List <int> listMovieId = StringToList(textBox3.Text); foreach (int movieId in listMovieId) { Acting acting = new Acting(actorId, movieId); await Program.MobileService.GetTable <Acting>().InsertAsync(acting); } await Program.MobileService.GetTable <Actor>().InsertAsync(actor); MessageBox.Show("Create success!"); } catch { MessageBox.Show("Faild!"); } }
public void setActingType(Acting acting) { acting_type = acting; }