public ItemViewModel(PlayerInventoryViewModel context, Possession possession) { Context = context; Value = possession; BaseItemInfo = new Command(async() => { await Context.Navigation.PushAsync(InfoPage.Show(Value.Item)); }, () => Value.BaseItem != null); ShowInfo = new Command(async(par) => { if (par is MagicViewModel m) { await Context.Navigation.PushAsync(InfoPage.Show(m.Magic)); } }); OnDelete = new Command((par) => { if (par is MagicViewModel m) { Value.MagicProperties.RemoveAll(s => ConfigManager.SourceInvariantComparer.Equals(s, m.Magic.Name + " " + ConfigManager.SourceSeperator + " " + m.Magic.Source)); Magic.ReplaceRange(new List <MagicViewModel>()); UpdateMagic(); IsChanged = true; Context.FirePlayerChanged(); } }); UpdateMagic(); }
private async void Button_Clicked(object sender, EventArgs e) { if (Model.IsNew) { Model.Context.Context.Player.AddPossession(Model.Value); } Model.Context.MakeHistory(""); Possession newp = new Possession(Model.Value); int stacksize = 1; if (Model.Value.Item != null) { stacksize = Math.Max(1, Model.Value.Item.StackSize); } newp.Count = Model.Value.Count - Model.Split; if (Model.Split % stacksize != 0 && Model.Value.Item != null) { Model.Context.Context.Player.Items.Add(Model.Value.BaseItem); } Model.Count = Model.Split; if (newp.Count > 0) { Model.Context.Context.Player.AddPossession(newp); } Model.Context.Save(); Model.Context.RefreshItems.Execute(null); await Navigation.PopAsync(); }
public void InstallUninstallStuff() { Possessions possessions = possession_DB.GetAllPossessions().ToList(); Console.WriteLine(possessions.ToString()); Possession thing1 = TextParser.SelectItemFromList <Possession>("Please select an object to install : ", possessions); if (thing1.PartOf != null) { Console.Write($"Object is installed in {thing1.PartOf.Name}... would you like to uninstall it? (y/n) "); string yn = Console.ReadLine(); if (yn == "y") { possession_DB.RemovePossessionFromInstallation(thing1); } Console.Write("Would you like to install it into something else? (y/n) "); yn = Console.ReadLine(); if (yn == "n") { return; } } Possession thing2 = TextParser.SelectItemFromList <Possession>($"Please select another object to install {thing1.Name} into : ", possessions); possession_DB.InstallPossession(thing1, thing2); Console.WriteLine($"Updated {thing1.Name} to be part of {thing2.Name}"); Console.WriteLine(thing1); Console.WriteLine(thing2); }
public void YouCanIncrementQuantityToCountSimilarItems() { var gear = new Gear("foo", 2, 10); var possession = new Possession(gear); possession.IncrementQuantity(); Assert.Equal(possession.Quantity, 2); }
public void PossessionsContainQuantityForGearThatSupportsIt() { var gear = new Gear("foo", 2, 10); var possession = new Possession(gear); possession.Quantity = 10; Assert.Equal(possession.Quantity, 10); }
public void PossessionsAreAssociatedWithGearAndImpersonateThem() { var gear = new Gear("foo", 2, 10); var possession = new Possession(gear); Assert.Equal(possession.Name, "foo"); Assert.Equal(possession.Quantity, 1); }
private void Possess(AI _ai) { chargedAttackTimer = 0; chargeBar.fillAmount = 0; Possession poss = _ai.gameObject.AddComponent <Possession>(); poss.enabled = true; }
void Start() { m_Rb = GetComponent <Rigidbody2D>(); possession = GetComponent <Possession>(); possession.state = possession.ghost; possession.state.speed = 3; pauseScreen = GameObject.FindGameObjectWithTag("MainMenu"); }
/// <summary> /// Updates the possession in the database /// </summary> public bool UpdatePossession(Possession updated) { Possession inDB = _DB.Possessions.Find(updated.Id); if (inDB != null && PossessionRules.VerifyUpdate(inDB, updated)) { inDB.ApplyUpdate(updated); } return(_DB.SaveChanges() != 0); }
// Update is called once per frame void Update() { HitPoint1 = CryptoPlayerPrefs.GetInt("blueOFHitPoint", 300); Attack1 = CryptoPlayerPrefs.GetInt("blueOFAttack", 300); Interval1 = CryptoPlayerPrefs.GetInt("blueOFInterval", 300); HitPoint2 = Mathf.FloorToInt(HitPoint1 * 1.1f); Attack2 = Mathf.FloorToInt(Attack1 * 1.05f); Interval2 = Mathf.FloorToInt(Interval1 * 0.95f); beforeHitPoint.text = string.Format("{0:#,0}", HitPoint1); beforeAttack.text = string.Format("{0:#,0}", Attack1); beforeInterval.text = string.Format("{0:#,0}", Interval1); afterHitPoint.text = string.Format("{0:#,0}", HitPoint2); afterAttack.text = string.Format("{0:#,0}", Attack2); afterInterval.text = string.Format("{0:#,0}", Interval2); Point1 = CryptoPlayerPrefs.GetInt("blueOFpoint1", 50); Point2 = CryptoPlayerPrefs.GetInt("blueOFpoint2", 50); Point3 = CryptoPlayerPrefs.GetInt("blueOFpoint3", 50); point1.text = string.Format("{0:#,0}", Point1); point2.text = string.Format("{0:#,0}", Point2); point3.text = string.Format("{0:#,0}", Point3); possession = Possession.getPossession(); if (possession >= Point1) { HitPointButton.SetActive(true); } else { HitPointButton.SetActive(false); } if (possession >= Point2) { AttackButton.SetActive(true); } else { AttackButton.SetActive(false); } if (possession >= Point3) { IntervalButton.SetActive(true); } else { IntervalButton.SetActive(false); } }
public Game() { GameClock = new GameClock(); Horn = new Horn(); Period = new Period(); ShotClock = new ShotClock(); Possession = new Possession(); Home = new Team(); Guest = new Team(); TimeoutClock = new TimeoutClock(); }
public bool RemovePossessionFromInstallation(Possession possession) { if (possession.PartOf == null) { return(false); } _DB.Database.Log = Console.WriteLine; var inDB = _DB.Possessions.Find(possession.Id); inDB.PartOf = null; return(_DB.SaveChanges() != 0); }
public Zone(Editor e, Point p, int index) { editor = e; attachPoint = new VertexMarker(); attachPoint.setPosition(PanAndZoom.fromLocalToGlobal(p)); attachPoint.Colour = System.Drawing.Brushes.Green; outline = new Outline(p); propertypanel = new ZoneProperty(this); possession = Possession.Neutral; Name = string.Format("Zone {0}", index); setSelected(false); }
/// <summary> /// insert method for a single possession /// </summary> public bool CreatePossession(Possession possession) { if (possession.Owner != null) { possession.Owner = _DB.Owners.Find(possession.Owner.Id); } if (possession.PartOf != null) { possession.PartOf = _DB.Possessions.Find(possession.PartOf.Id); } _DB.Possessions.Add(possession); return(_DB.SaveChanges() != 0); }
public Zone(Editor e, Area a) { //name = a.Name; editor = e; area = a; attachPoint = new VertexMarker(); attachPoint.setPosition(Geometry.Geometry.convertPoint(a.AttachmentPoint)); attachPoint.Colour = System.Drawing.Brushes.Green; outline = new Outline(Geometry.Geometry.getOutline(a.Content)); propertypanel = new ZoneProperty(this); possession = Possession.Neutral; Name = string.Format("Zone {0}", a.Id); setSelected(false); }
public Possession AssignPossession(Game game, TeamGame teamGame, GameTime gameTime) { Possession possession = CreateGameEvent <Possession>(teamGame, gameTime); Possession lastPossession = game.Possessions.LastOrDefault(); if (lastPossession != null) { lastPossession.EndDateTime = possession.StartDateTime; lastPossession.EndGameTime = possession.StartGameTime; } game.Possessions.Add(possession); return(possession); }
// Update is called once per frame void Update() { possession = Possession.getPossession(); if (possession >= Point) { HPButton.SetActive(true); ATKButton.SetActive(true); ITVButton.SetActive(true); } else { HPButton.SetActive(false); ATKButton.SetActive(false); ITVButton.SetActive(false); } }
/// <summary> /// Initializes all of the objects and variables needed for this script. /// </summary> void Start () { GameObject GameController = GameObject.FindGameObjectWithTag("GameController"); REF = GameObject.FindGameObjectWithTag("Referee").GetComponent<Referee>(); BR = GameController.GetComponent<BallReset>(); GT = GameController.GetComponent<GameTimer>(); BT = GameObject.Find("BreakTimer").GetComponent<BreakTimer>(); ballPossession = ball.GetComponent<Possession>(); ballLocation = ball.GetComponent<ListObjectLocation>(); timer = gameObject.AddComponent<Timer>(); timer.SetLengthOfTimer(TimerFoulTime); timer.Resume(); DeadBallTimer = gameObject.AddComponent<Timer>(); DeadBallTimer.SetLengthOfTimer(DeadBallTime); DeadBallTimer.Pause(); }
/// <summary> /// Adds the gear to the character. /// </summary> /// <param name="equip">Equipment to add.</param> public Possession AddGear(IGear equip) { var possession = Find(equip); if (possession == null) { possession = new Possession(equip); this.gear.Add(possession); } else { possession.IncrementQuantity(); } OnItemAdded(equip); return(possession); }
public ActionResult EditPossession(Possession possession, int FlatId, int OwnerId) { if (!CheckCookie()) { return(Redirect("/")); } var Owner = Logic.Info.DB.People.Get.FirstOrDefault(x => x.Id == OwnerId); var Flat = Logic.Info.DB.Flats.Get.FirstOrDefault(x => x.Id == FlatId); if (possession != null && Owner != null && Flat != null) { possession.Owner = Owner; possession.Flat = Flat; Logic.Info.DB.Possession.Edited(possession); Logic.Info.DB.Save(); } return(RedirectToAction("Possessions")); }
public bool InstallPossession(Possession possession, Possession installedIn) { var things = _DB.Possessions.Where(p => p.Id == installedIn.Id || p.Id == possession.Id).ToList(); if (things.Count != 2) { return(false); } if (things[0].Equals(possession)) { things[0].PartOf = things[1]; } else { things[1].PartOf = things[0]; } return(_DB.SaveChanges() != 0); }
/// <summary> /// Deletes a possession /// </summary> public bool DestroyPossession(Possession usrRequest) { Possession toBeDeleted = _DB.Possessions.Find(usrRequest.Id); if (toBeDeleted == null) { return(false); } if (toBeDeleted.Equals(usrRequest)) { var possessionsInDB = _DB.Possessions.Where(s => s.PartOf.Id == toBeDeleted.Id).ToList(); foreach (var thing in possessionsInDB) { thing.PartOf = null; } } _DB.SaveChanges(); return(_DB.SaveChanges() != 0); }
/// <summary> /// /// </summary> public bool GivePossessionToOwner(Possession possession, Owner owner) { if (possession.PartOf != null) { return(false); } List <Possession> things = _DB.Possessions .Where(s => s.Id == possession.Id || (s.PartOf != null && s.PartOf.Id == possession.Id)) .ToList(); foreach (var thing in things) { thing.Owner = owner; } _DB.SaveChanges(); return(true); }
public void ChangeOwners() { Possessions possessions = possession_DB.GetAllPossessions(); Owners owners = owner_DB.GetAllOwners(); Console.WriteLine(possessions.ToString()); Possession thing = TextParser.SelectItemFromList <Possession>("Please select a possession : ", possessions); Owner owner = TextParser.SelectItemFromList <Owner>("Please select a new owner : ", owners); if (possession_DB.GivePossessionToOwner(thing, owner)) { Console.WriteLine(thing); } else { Console.WriteLine("I can't do that, it belongs to an installation"); } }
public Possession ChangePossession(Game game, GameTime gameTime) { if (!game.Possessions.Any()) { throw new PossessionNotAssignedException(); } Possession currentPossession = game.Possessions.Last(); TeamGame newPossessionTeam; if (currentPossession.TeamId == game.HomeTeamId) { newPossessionTeam = game.AwayTeam; } else { newPossessionTeam = game.HomeTeam; } return(AssignPossession(game, newPossessionTeam, gameTime)); }
public static void SetPossession(this Myself myself, string category, string item, int amount) { var cat = EnsureCategory(myself, category); var pos = cat.possessions.FirstOrDefault(p => p.name == item); if (pos == null) { pos = new Possession { name = item, level = amount, category = category, effectiveLevel = amount }; var list = cat.possessions.ToList(); list.Add(pos); cat.possessions = list.ToArray(); } pos.level = pos.effectiveLevel = amount; }
public void WendllHolisvTexas() { var testSubject = new Felony(); //court contents the actus reus is by possession, therefore omission is not applicable var testPossession = new Possession(); testSubject.ActusReus = testPossession; testPossession.IsKnowinglyProcured = lp => lp is WendellHollis; var testResult = testPossession.IsValid(new WendellHollis()); Console.WriteLine(testPossession.ToString()); Assert.IsTrue(testResult); //defendant contents no statute duty to report multiple prescriptions var testOmission = new Duty { IsStatuteOrigin = lp => false }; testResult = testOmission.IsValid(new WendellHollis()); Assert.IsFalse(testResult); }
/// <summary> /// Does what it says on the box /// </summary> public List <Possession> GetPossessionsInInstallation(Possession installation) { return(_DB.Possessions.Where(s => s.PartOf.Id == installation.Id).ToList()); }
public bool AddPossessionsToInstallation(IEnumerable <Possession> possessions, Possession installation) { foreach (var s in possessions) { bool success = InstallPossession(s, installation); if (!success) { return(false); } } return(true); }
// Start is called before the first frame update void Start() { possession = Possession.getPossession(); }
/// <summary> /// /// </summary> public bool UnclaimPossession(Possession possession, Owner owner) { possession.Owner = null; return(UpdatePossession(possession)); }