added park management page
This commit is contained in:
parent
0ba3ff8eb8
commit
d34fac03bc
4 changed files with 62 additions and 17 deletions
2
Ideas.md
2
Ideas.md
|
@ -21,7 +21,7 @@
|
||||||
- Advanced version that adds modifiers to each ride automatically, regardless of whether they already contain them
|
- Advanced version that adds modifiers to each ride automatically, regardless of whether they already contain them
|
||||||
|
|
||||||
# Park management
|
# Park management
|
||||||
- Shows statistics on how much each ride type generates in the park
|
- ~~Shows statistics on how much each ride type generates in the park~~
|
||||||
- Edit park templates
|
- Edit park templates
|
||||||
- Set the minimum amount of tickets required for auto-buyers of any kind to take effect
|
- Set the minimum amount of tickets required for auto-buyers of any kind to take effect
|
||||||
- Set the amount of time between auto-buy attempts
|
- Set the amount of time between auto-buy attempts
|
|
@ -20,6 +20,10 @@
|
||||||
"KeepScreenOn": "Keep Screen On",
|
"KeepScreenOn": "Keep Screen On",
|
||||||
"RateInfo": "You've been playing the game for a while now, which probably means you're enjoying it.\nPlease <c Yellow>rate</c> the game, it really helps out! Thanks <3",
|
"RateInfo": "You've been playing the game for a while now, which probably means you're enjoying it.\nPlease <c Yellow>rate</c> the game, it really helps out! Thanks <3",
|
||||||
"Rate": "Rate",
|
"Rate": "Rate",
|
||||||
|
"ParkManagement": "Park Management",
|
||||||
|
"Attractions": "Attractions",
|
||||||
|
"Modifiers": "Modifiers",
|
||||||
|
"RideStats": "Sales per Ride",
|
||||||
"----- Tutorial -----": "",
|
"----- Tutorial -----": "",
|
||||||
"Tutorial1": "Hi! Welcome to Touchy Tickets. To start the game, simply tap the ticket booth to sell a <i ticket>. Start by racking up 50<i ticket>!",
|
"Tutorial1": "Hi! Welcome to Touchy Tickets. To start the game, simply tap the ticket booth to sell a <i ticket>. Start by racking up 50<i ticket>!",
|
||||||
"Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.",
|
"Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.",
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace TouchyTickets {
|
||||||
private readonly Attraction[,] attractionGrid;
|
private readonly Attraction[,] attractionGrid;
|
||||||
|
|
||||||
public double TicketsPerSecond { get; private set; }
|
public double TicketsPerSecond { get; private set; }
|
||||||
|
public readonly Dictionary<AttractionType, double> TicketsPerRide = new Dictionary<AttractionType, double>();
|
||||||
public Attraction PlacingAttraction;
|
public Attraction PlacingAttraction;
|
||||||
public AttractionModifier PlacingModifier;
|
public AttractionModifier PlacingModifier;
|
||||||
public Point PlacingPosition;
|
public Point PlacingPosition;
|
||||||
|
@ -68,12 +69,15 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(GameTime time, TimeSpan passed) {
|
public void Update(GameTime time, TimeSpan passed) {
|
||||||
var tickets = 0D;
|
this.TicketsPerRide.Clear();
|
||||||
|
this.TicketsPerSecond = 0;
|
||||||
foreach (var (pos, attraction) in this.attractions) {
|
foreach (var (pos, attraction) in this.attractions) {
|
||||||
var genPerSecond = attraction.Update(time, passed, this, pos);
|
var genPerSecond = attraction.Update(time, passed, this, pos);
|
||||||
tickets += genPerSecond;
|
// store ride statistics
|
||||||
|
this.TicketsPerRide.TryGetValue(attraction.Type, out var curr);
|
||||||
|
this.TicketsPerRide[attraction.Type] = curr + genPerSecond;
|
||||||
|
this.TicketsPerSecond += genPerSecond;
|
||||||
}
|
}
|
||||||
this.TicketsPerSecond = tickets;
|
|
||||||
|
|
||||||
// map movement
|
// map movement
|
||||||
if (GameImpl.Instance.DrawMap && GameImpl.Instance.UiSystem.Controls.HandleTouch) {
|
if (GameImpl.Instance.DrawMap && GameImpl.Instance.UiSystem.Controls.HandleTouch) {
|
||||||
|
|
|
@ -141,14 +141,19 @@ namespace TouchyTickets {
|
||||||
this.uiSystem.Add("Main", main);
|
this.uiSystem.Add("Main", main);
|
||||||
|
|
||||||
// buy ui
|
// buy ui
|
||||||
var buyUi = new Panel(Anchor.TopLeft, Vector2.One, Vector2.Zero, false, true, new Point(10, 30), false) {
|
var buyUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
ChildPadding = new Padding(5, 15, 5, 5),
|
IsHidden = true,
|
||||||
IsHidden = true
|
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha)
|
||||||
};
|
};
|
||||||
|
buyUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Attractions"), true) {TextScale = 0.15F});
|
||||||
|
var buyList = buyUi.AddChild(new Panel(Anchor.AutoLeft, Vector2.One, Vector2.Zero, false, true, new Point(10, 30), false) {
|
||||||
|
ChildPadding = new Padding(5, 15, 5, 5),
|
||||||
|
PreventParentSpill = true
|
||||||
|
});
|
||||||
foreach (var attraction in AttractionType.Attractions) {
|
foreach (var attraction in AttractionType.Attractions) {
|
||||||
BigInteger price = 0;
|
BigInteger price = 0;
|
||||||
var attractionAmount = 0;
|
var attractionAmount = 0;
|
||||||
var button = buyUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) {
|
var button = buyList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) {
|
||||||
ChildPadding = new Vector2(4),
|
ChildPadding = new Vector2(4),
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
OnPressed = e => {
|
OnPressed = e => {
|
||||||
|
@ -209,12 +214,17 @@ namespace TouchyTickets {
|
||||||
this.uiSystem.Add("Buy", buyUi);
|
this.uiSystem.Add("Buy", buyUi);
|
||||||
|
|
||||||
// modifier ui
|
// modifier ui
|
||||||
var modifierUi = new Panel(Anchor.TopLeft, Vector2.One, Vector2.Zero, false, true, new Point(10, 30), false) {
|
var modifierUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
ChildPadding = new Padding(5, 15, 5, 5),
|
IsHidden = true,
|
||||||
IsHidden = true
|
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha)
|
||||||
};
|
};
|
||||||
|
modifierUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Modifiers"), true) {TextScale = 0.15F});
|
||||||
|
var modifierList = modifierUi.AddChild(new Panel(Anchor.AutoLeft, Vector2.One, Vector2.Zero, false, true, new Point(10, 30), false) {
|
||||||
|
ChildPadding = new Padding(5, 15, 5, 5),
|
||||||
|
PreventParentSpill = true
|
||||||
|
});
|
||||||
foreach (var modifier in AttractionModifier.Modifiers.Values) {
|
foreach (var modifier in AttractionModifier.Modifiers.Values) {
|
||||||
var button = modifierUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(1)) {
|
var button = modifierList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1)) {
|
||||||
SetHeightBasedOnChildren = true,
|
SetHeightBasedOnChildren = true,
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
ChildPadding = new Vector2(4),
|
ChildPadding = new Vector2(4),
|
||||||
|
@ -303,9 +313,9 @@ namespace TouchyTickets {
|
||||||
desc.IsHidden = !shouldShow;
|
desc.IsHidden = !shouldShow;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
modifierUi.OnAreaUpdated += e => {
|
modifierList.OnAreaUpdated += e => {
|
||||||
// sort children by whether they should be shown or not
|
// sort children by whether they should be shown or not
|
||||||
modifierUi.ReorderChildren((e1, e2) => Comparer<bool>.Default.Compare(e2.GetData<bool>("Show"), e1.GetData<bool>("Show")));
|
modifierList.ReorderChildren((e1, e2) => Comparer<bool>.Default.Compare(e2.GetData<bool>("Show"), e1.GetData<bool>("Show")));
|
||||||
};
|
};
|
||||||
this.uiSystem.Add("Modifiers", modifierUi);
|
this.uiSystem.Add("Modifiers", modifierUi);
|
||||||
|
|
||||||
|
@ -361,7 +371,7 @@ namespace TouchyTickets {
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha)
|
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha)
|
||||||
};
|
};
|
||||||
optionsUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Options"), true) {TextScale = 0.2F});
|
optionsUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Options"), true) {TextScale = 0.15F});
|
||||||
var optionList = optionsUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, new Point(10, 30), false) {
|
var optionList = optionsUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, new Point(10, 30), false) {
|
||||||
ChildPadding = new Padding(5, 15, 5, 5),
|
ChildPadding = new Padding(5, 15, 5, 5),
|
||||||
PreventParentSpill = true
|
PreventParentSpill = true
|
||||||
|
@ -400,7 +410,33 @@ namespace TouchyTickets {
|
||||||
});
|
});
|
||||||
this.uiSystem.Add("Options", optionsUi);
|
this.uiSystem.Add("Options", optionsUi);
|
||||||
|
|
||||||
this.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi};
|
var managementUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
|
IsHidden = true,
|
||||||
|
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha)
|
||||||
|
};
|
||||||
|
managementUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("ParkManagement"), true) {TextScale = 0.15F});
|
||||||
|
var managementList = managementUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, new Point(10, 30), false) {
|
||||||
|
ChildPadding = new Padding(5, 15, 5, 5),
|
||||||
|
PreventParentSpill = true
|
||||||
|
});
|
||||||
|
managementList.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("RideStats"), true) {
|
||||||
|
PositionOffset = new Vector2(0, 4),
|
||||||
|
TextScale = 0.12F
|
||||||
|
});
|
||||||
|
foreach (var type in AttractionType.Attractions.Values) {
|
||||||
|
var group = managementList.AddChild(new Group(Anchor.AutoCenter, new Vector2(1)) {
|
||||||
|
OnUpdated = (e, time) => e.IsHidden = !GameImpl.Instance.Map.TicketsPerRide.ContainsKey(type),
|
||||||
|
PositionOffset = new Vector2(0, 1)
|
||||||
|
});
|
||||||
|
group.AddChild(new Image(Anchor.AutoLeft, new Vector2(20), Assets.AttractionTexture[type.TextureRegion]));
|
||||||
|
group.AddChild(new Paragraph(Anchor.CenterLeft, 1, p => {
|
||||||
|
GameImpl.Instance.Map.TicketsPerRide.TryGetValue(type, out var tickets);
|
||||||
|
return tickets.ToString("#,0.##") + "<i ticket>/s";
|
||||||
|
}, true) {PositionOffset = new Vector2(24, 0)});
|
||||||
|
}
|
||||||
|
this.uiSystem.Add("Management", managementUi);
|
||||||
|
|
||||||
|
this.swipeRelations = new Element[] {optionsUi, upgradeUi, managementUi, main, buyUi, modifierUi};
|
||||||
|
|
||||||
var swipeTimer = 0D;
|
var swipeTimer = 0D;
|
||||||
var swipeInfo = new Group(Anchor.BottomCenter, Vector2.One) {
|
var swipeInfo = new Group(Anchor.BottomCenter, Vector2.One) {
|
||||||
|
@ -632,7 +668,8 @@ namespace TouchyTickets {
|
||||||
if (!reachedActive && upgrade.IsActive()) {
|
if (!reachedActive && upgrade.IsActive()) {
|
||||||
reachedActive = true;
|
reachedActive = true;
|
||||||
upgradeList.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("AppliedUpgrades"), true) {
|
upgradeList.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("AppliedUpgrades"), true) {
|
||||||
PositionOffset = new Vector2(0, 4)
|
PositionOffset = new Vector2(0, 4),
|
||||||
|
TextScale = 0.12F
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var button = upgradeList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1)) {
|
var button = upgradeList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1)) {
|
||||||
|
|
Loading…
Reference in a new issue