public void PopulateScreen(ushort mode) { var childClone = new List<UIElement>(Children); var config = Neighborhoods[mode - 1]; foreach (var child in childClone) Remove(child); var shad = new UIImage(Content.Get().CustomUI.Get("ngbh_outline.png").Get(GameFacade.GraphicsDevice)) .With9Slice(24, 24, 24, 24); shad.SetSize(800 + 48, 600 + 48); shad.Position = new Vector2(-24); Add(shad); var bg = new UIImage(((ITextureRef)Provider.Get(config.Graphic)).Get(GameFacade.GraphicsDevice)); Add(bg); bg.ListenForMouse((evt, state) => { if (evt == UIMouseEventType.MouseDown) ResetZoom(); }); HousePositions = new Dictionary<int, Vector2>(); var locationIff = Content.Get().Neighborhood.LotLocations; var locations = locationIff.Get<STR>(mode); if (locations == null) return; var buttons = new List<UINeighborhoodHouseButton>(); for (int i = 0; i < locations.Length; i++) { Console.WriteLine(locations.GetString(i)); var loc = locations.GetString(i).Split(','); var num = int.Parse(loc[0].TrimStart()); var button = new UINeighborhoodHouseButton(num, SelectHouse, config.Scale); button.Position = new Vector2(int.Parse(loc[1].TrimStart()), int.Parse(loc[2].TrimStart())); HousePositions[num] = button.Position; buttons.Add(button); } var ordered = buttons.OrderBy(x => x.Y); foreach (var btn in ordered) Add(btn); foreach (var layer in config.FullImageAnimations) { var lelem = new UINeighborhoodAnimationLayer(layer, config.Pulsate, config.FrameDuration); lelem.Position = layer.Position; Add(lelem); } BgSound?.RemoveOwner(-25); if (config.Music != null) FSO.HIT.HITVM.Get().PlaySoundEvent(config.Music); if (config.BGSound != null) { BgSound = HITVM.Get().PlaySoundEvent(config.BGSound); BgSound.AddOwner(-25); } Mode = mode; Zoom = Zoom; CenterPositionX = CenterPositionX; CenterPositionY = CenterPositionY; }
public void PopulateScreen(ushort mode) { var childClone = new List <UIElement>(Children); var config = Neighborhoods[mode - 1]; foreach (var child in childClone) { Remove(child); } var bg = new UIImage(((ITextureRef)Provider.Get(config.Graphic)).Get(GameFacade.GraphicsDevice)); Add(bg); bg.BlockInput(); var locationIff = Content.Content.Get().Neighborhood.LotLocations; var locations = locationIff.Get <STR>(mode); if (locations == null) { return; } var buttons = new List <UINeighborhoodHouseButton>(); for (int i = 0; i < locations.Length; i++) { var loc = locations.GetString(i).Split(','); var button = new UINeighborhoodHouseButton(int.Parse(loc[0].TrimStart()), SelectHouse, config.Scale); button.Position = new Vector2(int.Parse(loc[1].TrimStart()), int.Parse(loc[2].TrimStart())); buttons.Add(button); } var ordered = buttons.OrderBy(x => x.Y); foreach (var btn in ordered) { Add(btn); } foreach (var layer in config.FullImageAnimations) { var lelem = new UINeighborhoodAnimationLayer(layer, config.Pulsate, config.FrameDuration); lelem.Position = layer.Position; Add(lelem); } BgSound?.RemoveOwner(-25); if (config.Music != null) { HIT.HITVM.Get().PlaySoundEvent(config.Music); } if (config.BGSound != null) { BgSound = HITVM.Get().PlaySoundEvent(config.BGSound); BgSound.AddOwner(-25); } }
public void PlaySound(string evt) { LastSound?.RemoveOwner(-1); LastSound = HIT.HITVM.Get().PlaySoundEvent(evt); LastSound?.AddOwner(-1); }