private void button1_Click(object sender, EventArgs e) { buttonSample.PlaySync(); Racing racing = new Racing(); this.Hide(); simpleSound.Stop(); racing.ShowDialog(); }
static void Main(string[] args) { Car bmw = new Racing(); Game game = new Game(); game.cars.Add(bmw); game.cars.Add(new Racing()); game.cars.Add(new Bus()); game.StartGame(); }
public async Task <IHttpActionResult> DeleteTeams([FromUri] int id) { Racing racing = await _content.Racings.FindAsync(id); var service = CreateRaceService(); if (racing != null) { await service.DeleteTeam(id); return(Ok()); } return(InternalServerError()); }
public async Task <bool> CreateATeam(RacingCreate model) { var entity = new Racing() { BasedOutOF = model.BasedOutOF, Drivers = model.Drivers, RaceEvent = model.RaceEvent, TeamName = model.TeamName, ManufacturerID = model.ManufacturerID }; using (var ctx = new ApplicationDbContext()) { ctx.Racings.Add(entity); return(await ctx.SaveChangesAsync() == 1); } }
public async Task <IHttpActionResult> UpdateTeams([FromUri] int id, [FromBody] RacingEdit model) { if (ModelState.IsValid) { Racing racing = await _content.Racings.FindAsync(id); var service = CreateRaceService(); if (racing != null) { await service.UpdateTeam(model); return(Ok(model)); } } return(BadRequest()); }
public void BetTest() { var world = new Racing(); }
public override int compareLaps(LapCompleted a, LapCompleted b) { return(Racing.compareByBestLap(a, b)); }
public static void PopulatePieMenuPickerWithOutfits(CustomPedestal pedestal, Sim actor, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows, OutfitUtils.GreyedOutOutfitCallback greyed) { if (pedestal == null) { CMShopping.PrintMessage("Pedestal null"); } NumSelectableRows = 1; headers = new List <ObjectPicker.HeaderInfo>(); listObjs = new List <ObjectPicker.TabInfo>(); headers.Add(new ObjectPicker.HeaderInfo("Ui/Caption/ObjectPicker:Outfit", "Ui/Tooltip/ObjectPicker:Outfit")); headers[0].Width = 250; if (actor != null) { SimDescription simDescription = actor.SimDescription; ResourceKey resourceKey = CASUtils.GetOutfitInGameObject(actor.ObjectId); if (simDescription.HasSupernaturalOutfit(resourceKey) && simDescription.CreatedSim != null) { OutfitCategories currentOutfitCategory = simDescription.CreatedSim.CurrentOutfitCategory; int currentOutfitIndex = simDescription.CreatedSim.CurrentOutfitIndex; SimOutfit outfit = simDescription.GetOutfit(currentOutfitCategory, currentOutfitIndex); if (outfit != null && outfit.Key != ResourceKey.kInvalidResourceKey) { resourceKey = outfit.Key; } } ObjectPicker.TabInfo tabInfo = new ObjectPicker.TabInfo("glb_all_r2", Localization.LocalizeString("Ui/Caption/ObjectPicker:All", new object[0]), new List <ObjectPicker.RowInfo>()); string text = Localization.LocalizeString("Ui/Caption/ObjectPicker:Everyday", new object[0]); string text2 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Formalwear", new object[0]); string text3 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Sleepwear", new object[0]); string text4 = null; string text5 = null; string text6 = null; string text7 = null; string text8 = null; string text9 = null; string text10 = null; ObjectPicker.TabInfo tabInfo2 = new ObjectPicker.TabInfo(actor.IsHorse ? "cas_acc_riding" : "shopping_clothing_everyday_r2", text, new List <ObjectPicker.RowInfo>()); ObjectPicker.TabInfo tabInfo3 = new ObjectPicker.TabInfo("shopping_clothing_formal_r2", text2, new List <ObjectPicker.RowInfo>()); ObjectPicker.TabInfo tabInfo4 = new ObjectPicker.TabInfo("shopping_clothing_sleepwear_r2", text3, new List <ObjectPicker.RowInfo>()); ObjectPicker.TabInfo tabInfo5 = null; ObjectPicker.TabInfo tabInfo6 = null; ObjectPicker.TabInfo tabInfo7 = null; ObjectPicker.TabInfo tabInfo8 = null; ObjectPicker.TabInfo tabInfo9 = null; ObjectPicker.TabInfo tabInfo10 = null; ObjectPicker.TabInfo tabInfo11 = null; ObjectPicker.TabInfo tabInfo12 = null; if (simDescription.ToddlerOrAbove) { if (!simDescription.Toddler) { text4 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Swimwear", new object[0]); text5 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Athletic", new object[0]); tabInfo5 = new ObjectPicker.TabInfo("shopping_clothing_swimwear_r2", text4, new List <ObjectPicker.RowInfo>()); tabInfo6 = new ObjectPicker.TabInfo("shopping_clothing_athletic_r2", text5, new List <ObjectPicker.RowInfo>()); } if (GameUtils.IsInstalled(ProductVersion.EP8)) { text10 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Outerwear", new object[0]); tabInfo12 = new ObjectPicker.TabInfo("cas_clothing_i_outerwear", text10, new List <ObjectPicker.RowInfo>()); } } if (simDescription.IsHorse) { text7 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Racing", new object[0]); tabInfo9 = new ObjectPicker.TabInfo("cas_acc_racing", text7, new List <ObjectPicker.RowInfo>()); text8 = Localization.LocalizeString("Ui/Caption/ObjectPicker:Jumping", new object[0]); tabInfo10 = new ObjectPicker.TabInfo("cas_acc_jumping", text8, new List <ObjectPicker.RowInfo>()); text9 = Localization.LocalizeString("Ui/Caption/ObjectPicker:BridleOnly", new object[0]); tabInfo11 = new ObjectPicker.TabInfo("cas_acc_horse_bridles", text9, new List <ObjectPicker.RowInfo>()); } SkillManager skillManager = actor.SkillManager; if (skillManager != null && skillManager.HasElement(SkillNames.MartialArts) && !simDescription.IsVisuallyPregnant) { headers[0].Width += 50; text6 = Localization.LocalizeString("Ui/Caption/ObjectPicker:MartialArts", new object[0]); tabInfo7 = new ObjectPicker.TabInfo("w_simple_martialarts_skill_s", text6, new List <ObjectPicker.RowInfo>()); } if (actor.Occupation != null) { SimOutfit outfit2 = simDescription.GetOutfit(OutfitCategories.Career, 0); if (outfit2 != null) { headers[0].Width += 50; string tabText = Localization.LocalizeString("Ui/Caption/ObjectPicker:Miscellaneous", new object[0]); tabInfo8 = new ObjectPicker.TabInfo("glb_i_options32", tabText, new List <ObjectPicker.RowInfo>()); } } string textLabel = Localization.LocalizeString("Ui/Caption/ObjectPicker:Career", new object[0]); if (!actor.IsFoal) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Everyday, text, tabInfo2, greyed); } OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Formalwear, text2, tabInfo3, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Sleepwear, text3, tabInfo4, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Swimwear, text4, tabInfo5, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Athletic, text5, tabInfo6, greyed); if (tabInfo12 != null) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Outerwear, text10, tabInfo12, greyed); } OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.MartialArts, text6, tabInfo7, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Career, textLabel, tabInfo8, greyed); OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Bridle, text9, tabInfo11, greyed); Racing racing = skillManager.GetElement(SkillNames.Racing) as Racing; if (racing != null && racing.HasRacingSaddleOutfit) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Racing, text7, tabInfo9, greyed); } Jumping jumping = skillManager.GetElement(SkillNames.Jumping) as Jumping; if (jumping != null && jumping.HasJumpOutfit) { OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Jumping, text8, tabInfo10, greyed); } listObjs.Add(tabInfo); if (tabInfo2.RowInfo.Count > 0) { listObjs.Add(tabInfo2); } if (tabInfo3.RowInfo.Count > 0) { listObjs.Add(tabInfo3); } if (tabInfo4.RowInfo.Count > 0) { listObjs.Add(tabInfo4); } if (tabInfo5 != null && tabInfo5.RowInfo.Count > 0) { listObjs.Add(tabInfo5); } if (tabInfo6 != null && tabInfo6.RowInfo.Count > 0) { listObjs.Add(tabInfo6); } if (tabInfo12 != null && tabInfo12.RowInfo.Count > 0) { listObjs.Add(tabInfo12); } if (tabInfo7 != null && tabInfo7.RowInfo.Count > 0) { listObjs.Add(tabInfo7); } if (tabInfo11 != null && tabInfo11.RowInfo.Count > 0) { listObjs.Add(tabInfo11); } if (tabInfo9 != null && tabInfo9.RowInfo.Count > 0) { listObjs.Add(tabInfo9); } if (tabInfo10 != null && tabInfo10.RowInfo.Count > 0) { listObjs.Add(tabInfo10); } if (tabInfo8 != null && tabInfo8.RowInfo.Count > 0) { listObjs.Add(tabInfo8); } } }
protected override bool PrivateUpdate(ScenarioFrame frame) { mPushes++; if (Sim.CreatedSim == null) { IncStat("Hibernating"); return false; } else if (Sim.CreatedSim.InteractionQueue == null) { IncStat("No Queue"); return false; } if (mPushes <= 1) { Sim.CreatedSim.InteractionQueue.CancelAllInteractions(); } bool maxSkill = true; List<SkillNames> practiceSkills = new List<SkillNames>(); RidingSkill riding = Sim.SkillManager.GetSkill<RidingSkill>(SkillNames.Riding); if ((riding == null) || (!riding.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Riding); } Racing racing = mHorse.SkillManager.GetSkill<Racing>(SkillNames.Racing); if ((racing == null) || (!racing.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Racing); } Jumping jumping = mHorse.SkillManager.GetSkill<Jumping>(SkillNames.Jumping); if ((jumping == null) || (!jumping.ReachedMaxLevel())) { maxSkill = false; practiceSkills.Add(SkillNames.Jumping); } List<EquestrianCenter> lotCenters = new List<EquestrianCenter>(); List<EquestrianCenter> centers = new List<EquestrianCenter>(); foreach (EquestrianCenter hole in Sims3.Gameplay.Queries.GetObjects<EquestrianCenter>()) { if (Sim.CreatedSim.LotCurrent == hole.LotCurrent) { lotCenters.Add(hole); } centers.Add(hole); } if (lotCenters.Count > 0) { centers = lotCenters; } EquestrianCenter center = null; if (centers.Count > 0) { center = RandomUtil.GetRandomObjectFromList(centers); } else { IncStat("No Centers"); } if (center != null) { CompetitionType type = CompetitionType.Racing; bool canCompete = (maxSkill) || (RandomUtil.CoinFlip()); if (canCompete) { List<CompetitionType> types = new List<CompetitionType>(sTypes); while (types.Count > 0) { type = RandomUtil.GetRandomObjectFromList(types); types.Remove(type); canCompete = false; switch (type) { case CompetitionType.CrossCountry: if (RidingSkill.CanEnterCrossCountryCompetition(Sim)) { canCompete = true; } break; case CompetitionType.Jumping: if (!RidingSkill.CanEnterJumpingCompetition(Sim)) { canCompete = true; } break; case CompetitionType.Racing: if (!RidingSkill.CanEnterRacingCompetition(Sim)) { canCompete = true; } break; } if (canCompete) { break; } } } if (canCompete) { List<CompetitionLevel> levels = new List<CompetitionLevel>(); foreach (CompetitionLevel level in sLevels) { GreyedOutTooltipCallback callback = null; if (EquestrianCenter.EnterEquestrianCompetition.CanEnterCompetition(type, level, Sim.CreatedSim, false, ref callback)) { levels.Add(level); } } if (levels.Count == 0) { IncStat("No Levels"); } else { CompetitionLevel level = RandomUtil.GetRandomObjectFromList(levels); if (Common.kDebugging) { Common.DebugNotify("Compete " + type + " " + level, Sim.CreatedSim); } if (!Situations.PushVisit(this, Sim, center.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<EquestrianCenter>(this, Sim, center, new EnterEquestrianCompetitionEx.Definition(type, level))) { return true; } else { IncStat("Competition Fail"); } } } } if (practiceSkills.Count == 0) { IncStat("No Practice Skills"); return false; } bool practiceJumping = true; if ((riding != null) & (riding.SkillLevel >= RidingSkill.kLevelForTrainForRacing)) { switch (RandomUtil.GetRandomObjectFromList(practiceSkills)) { case SkillNames.Riding: practiceJumping = RandomUtil.CoinFlip(); break; case SkillNames.Racing: practiceJumping = false; break; } } if (!practiceJumping) { List<TrainingPosts> lotPosts = new List<TrainingPosts>(); List<TrainingPosts> posts = new List<TrainingPosts>(); foreach(TrainingPosts post in Sims3.Gameplay.Queries.GetObjects<TrainingPosts>()) { if (Sim.CreatedSim.LotCurrent == post.LotCurrent) { lotPosts.Add(post); } posts.Add(post); } if (lotPosts.Count > 0) { posts = lotPosts; } if (posts.Count > 0) { TrainingPosts choice = RandomUtil.GetRandomObjectFromList(posts); if (!Situations.PushVisit(this, Sim, choice.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<TrainingPosts>(this, Sim, choice, new ManagerSituation.WithCallbackPush(Manager, TrainingPosts.RiderTrainForRacing.Singleton, null, null, new MountScenario(Sim, mPushes)))) { return true; } else { IncStat("Traning Fail"); } } } int ridingSkill = 0; if (riding != null) { ridingSkill = riding.SkillLevel; } List<HorseJump> lotJumps = new List<HorseJump>(); List<HorseJump> jumps = new List<HorseJump>(); foreach (HorseJump jump in Sims3.Gameplay.Queries.GetObjects<HorseJump>()) { if (jump.LotCurrent == null) continue; if (!jump.LotCurrent.IsCommunityLot) { if (!jump.LotCurrent.CanSimTreatAsHome(Sim.CreatedSim)) continue; } if (jump.JumpTuning == null) continue; if (jump.JumpTuning.HighSuccessChances[ridingSkill] < 0.75) continue; if (Sim.CreatedSim.LotCurrent == jump.LotCurrent) { lotJumps.Add(jump); } jumps.Add(jump); } if (lotJumps.Count > 0) { jumps = lotJumps; } if (jumps.Count > 0) { HorseJump choice = RandomUtil.GetRandomObjectFromList(jumps); if (!Situations.PushVisit(this, Sim, choice.LotCurrent)) { IncStat("Visit Fail"); return false; } else if (Situations.PushInteraction<HorseJump>(this, Sim, choice, new ManagerSituation.WithCallbackPush(Manager, HorseJump.Jump.Singleton, null, null, new MountScenario(Sim, mPushes)))) { return true; } else { IncStat("Jump Fail"); return false; } } else { IncStat("No Jump Choices"); return false; } }