Files
cruiseSimulator/Assets/Soundings/Runtime/ConstructionPages.cs

620 lines
28 KiB
C#

using UnityEngine;
using UnityEngine.UIElements;
namespace Soundings
{
public sealed partial class SoundingsApp
{
private static readonly (int HullIndex, bool Used)[] Offers =
{ (0, true), (0, false), (1, true), (1, false), (2, false) };
private bool systemTools;
private static readonly Color DraftGrid = new Color(.37f, .62f, .65f, .19f);
private static readonly Color DraftFine = new Color(.47f, .75f, .74f, .42f);
private static readonly Color DraftInk = new Color(.64f, .89f, .82f, .88f);
private static readonly Color DraftGold = new Color(.91f, .70f, .42f, .88f);
private void DrawDecks(VisualElement workspace)
{
var work = Add(workspace, "ship-work deck-work");
Ship ship = Ship;
if (ship == null)
{
var empty = Add(work, "ship-work-empty");
AddDisplay(empty, "No vessel in dock", "ship-work-heading");
AddText(empty, "Acquire a hull at the shipyard before fitting a deck.", "ship-work-detail");
empty.Add(Action("Visit shipyard", () => ChangePage(2), "work-primary", "open-shipyard"));
return;
}
deckIndex = Mathf.Clamp(deckIndex, 0, ship.Decks.Count - 1);
var titleBar = Add(work, "ship-work-head");
var heading = Add(titleBar, "ship-work-name");
AddText(heading, "DECK PLANS", "work-caption");
AddDisplay(heading, ship.Name, "ship-work-heading");
AddText(heading, $"{ship.Hull.Name} hull · Deck {deckIndex + 1} of {ship.Decks.Count}", "ship-work-detail");
var deckControls = Add(titleBar, "work-deck-controls");
var selector = Add(deckControls, "work-deck-selector");
for (int i = 0; i < ship.Decks.Count; i++)
{
int floor = i;
Button level = Action($"Deck {i + 1}", () =>
{
deckIndex = floor;
Notify(null);
Render();
}, "work-deck-tab", $"deck-{i}");
level.EnableInClassList("work-selected", deckIndex == i);
selector.Add(level);
}
int deckPrice = company.DeckPrice(ship);
string addLabel = ship.Decks.Count == ship.Hull.MaxDecks ? "Deck limit reached" : $"+ Deck {Money(deckPrice)}";
Button add = Action(addLabel, () =>
{
string failure = company.AddDeck(ship);
if (failure == null)
deckIndex = ship.Decks.Count - 1;
Apply(failure, "New deck ready to fit out.");
}, "work-deck-add", "add-deck");
add.SetEnabled(ship.Decks.Count < ship.Hull.MaxDecks && company.Cash >= deckPrice);
deckControls.Add(add);
var board = Add(work, "work-draft");
board.generateVisualContent += context => DrawDeckOutline(context, ship.Hull.Columns);
var markings = Add(board, "work-draft-markings");
markings.pickingMode = PickingMode.Ignore;
AddText(markings, "STERN", "work-caption");
AddText(markings, "TOP VIEW", "work-caption");
AddText(markings, "BOW →", "work-caption");
var layout = Add(board, "work-berth-grid");
var placement = Add(board, "work-placement");
var placementLabel = AddText(placement, PlacementInstruction(tool), "work-placement-text");
for (int row = 0; row < ship.Hull.Rows; row++)
{
var strip = Add(layout, "work-berth-row");
for (int column = 0; column < ship.Hull.Columns; column++)
{
int cell = row * ship.Hull.Columns + column;
string berthName = $"{(char)('A' + row)}{column + 1}";
Facility existing = ship.Decks[deckIndex].Cells[cell];
FacilitySpec room = Market.Facilities[(int)existing];
Button berth = Action("", () =>
{
Facility previous = ship.Decks[deckIndex].Cells[cell];
string failure = company.Build(ship, deckIndex, cell, tool);
if (failure == null && previous != tool)
SetRecommendedFuel();
string confirmation = tool == Facility.Empty
? $"Cleared berth {berthName}."
: $"Built {Market.Facilities[(int)tool].Name.ToLowerInvariant()} at {berthName}.";
Apply(failure, previous == tool ? null : confirmation);
}, "work-berth work-room-" + (int)existing, "berth-" + cell);
string description = BerthDescription(berthName, existing, tool);
berth.tooltip = description;
berth.RegisterCallback<PointerEnterEvent>(_ => placementLabel.text = description);
berth.RegisterCallback<PointerLeaveEvent>(_ => placementLabel.text = PlacementInstruction(tool));
berth.RegisterCallback<FocusInEvent>(_ => placementLabel.text = description);
berth.RegisterCallback<FocusOutEvent>(_ => placementLabel.text = PlacementInstruction(tool));
AddText(berth, berthName, "work-berth-index");
if (existing == Facility.Empty)
AddText(berth, "+", "work-berth-open");
else
{
var center = Add(berth, "work-berth-center");
center.pickingMode = PickingMode.Ignore;
AddFacilityMark(center, existing);
AddText(center, room.Name, "work-berth-name");
}
strip.Add(berth);
}
}
var fittings = Add(work, "work-fittings");
var gauges = Add(fittings, "work-capacity-strip");
if (systemTools)
{
AddText(gauges, $"{ship.GalleyCapacity:N0} galley covers", "work-capacity");
AddText(gauges, $"{ship.FoodCapacity:N0} stored portions", "work-capacity");
AddText(gauges, $"{ship.WaterCapacity:N0} L freshwater", "work-capacity");
AddText(gauges, $"{ship.WasteCapacity:N0} L sewage buffer", "work-capacity");
}
else
{
AddText(gauges, $"{ship.Beds:N0} berths", "work-capacity");
AddText(gauges, $"{ship.Meals:N0} meal covers", "work-capacity");
AddText(gauges, $"{ship.Entertainment:N0} show seats", "work-capacity");
AddText(gauges, $"{ship.Tank:N0} t bunker capacity", "work-capacity");
AddText(gauges, $"{ship.Capacity:N0} guests per sailing", "work-capacity work-capacity-emphasis");
}
var toolMode = Add(fittings, "work-fit-modes");
toolMode.Add(Action("Guest facilities", () => ChangeBuildTools(false), systemTools ? "" : "work-selected", "facility-guests"));
toolMode.Add(Action("Ship systems", () => ChangeBuildTools(true), systemTools ? "work-selected" : "", "facility-systems"));
var tools = Add(fittings, "work-tool-tray");
int start = systemTools ? (int)Facility.Galley : 1;
int end = systemTools ? Market.Facilities.Count : (int)Facility.Galley;
for (int i = start; i <= end; i++)
{
Facility option = i == end ? Facility.Empty : (Facility)i;
FacilitySpec spec = Market.Facilities[(int)option];
Button button = Action("", () =>
{
tool = option;
Notify(null);
Render();
}, "work-tool work-tool-" + (int)option, "facility-" + (int)option);
button.EnableInClassList("work-selected", option == tool);
button.tooltip = spec.Details;
AddFacilityMark(button, option);
var copy = Add(button, "work-tool-copy");
copy.pickingMode = PickingMode.Ignore;
AddText(copy, spec.Name, "work-tool-name");
AddText(copy, option == Facility.Empty ? "25% refund" : Money(spec.Price), "work-tool-cost");
tools.Add(button);
}
}
private void ChangeBuildTools(bool systems)
{
if (systemTools == systems)
return;
systemTools = systems;
tool = systems ? Facility.Galley : Facility.Cabin;
Notify(null);
Render();
}
private static string PlacementInstruction(Facility selected)
{
FacilitySpec spec = Market.Facilities[(int)selected];
return selected == Facility.Empty
? "Select a fitted berth to remove its facility and recover 25%."
: $"Select an open berth to build {spec.Name.ToLowerInvariant()}. {spec.Details} · {Money(spec.Price)}";
}
private static string BerthDescription(string berth, Facility room, Facility selected)
{
FacilitySpec existing = Market.Facilities[(int)room];
if (room == Facility.Empty)
return selected == Facility.Empty
? $"{berth} is already clear."
: $"{berth} · Place {Market.Facilities[(int)selected].Name.ToLowerInvariant()}";
return selected == Facility.Empty
? $"{berth} · Remove {existing.Name.ToLowerInvariant()} and recover {Money(existing.Price / 4)}"
: $"{berth} · {existing.Name} · {existing.Details}";
}
private static void AddFacilityMark(VisualElement parent, Facility facility)
{
var mark = Add(parent, "work-facility-icon work-mark-" + (int)facility);
mark.pickingMode = PickingMode.Ignore;
mark.generateVisualContent += context =>
{
Painter2D pen = context.painter2D;
float scale = context.visualElement.contentRect.width / 24;
Vector2 Point(float x, float y) => new Vector2(x * scale, y * scale);
pen.strokeColor = new Color(.88f, .94f, .89f);
pen.lineWidth = 1.6f;
pen.BeginPath();
void Line(float x1, float y1, float x2, float y2)
{
pen.MoveTo(Point(x1, y1));
pen.LineTo(Point(x2, y2));
}
void Segment(params float[] xy)
{
pen.MoveTo(Point(xy[0], xy[1]));
for (int i = 2; i < xy.Length; i += 2)
pen.LineTo(Point(xy[i], xy[i + 1]));
}
switch (facility)
{
case Facility.Cabin:
Segment(3,18,3,6,5,6,5,12,20,12,20,18);
Line(4,16,20,16);
Segment(6,11,6,9,10,9,10,11);
Segment(11,11,11,8,18,8,20,10,20,12);
break;
case Facility.Dining:
Segment(9,9,11,7,15,7,17,10,17,14,15,17,11,17,9,15,9,9);
Segment(3,5,3,10,5,12,7,10,7,5);
Line(5,11,5,19);
Segment(21,5,19,8,19,12,21,12,21,19);
break;
case Facility.Entertainment:
Segment(3,19,3,5,21,5,21,19);
Segment(4,7,9,7,7,13,4,16);
Segment(20,7,15,7,17,13,20,16);
Line(9,19,15,19);
break;
case Facility.Tank:
Segment(6,20,6,9,8,7,16,7,18,9,18,20,6,20);
Segment(10,7,10,4,14,4,14,7);
Line(6,11,18,11);
Line(6,16,18,16);
break;
case Facility.Bar:
Segment(4,5,20,5,12,13,4,5);
Segment(12,13,12,20,7,20);
Line(12,20,17,20);
Line(8,8,16,8);
break;
case Facility.Amenity:
Segment(4,11,6,7,10,5,14,5,18,7,20,11,4,11);
Line(12,11,12,17);
Segment(3,19,6,17,9,19,12,17,15,19,18,17,21,19);
break;
case Facility.Galley:
Segment(3,13,17,13,15,18,5,18,3,13);
Line(17,13,22,11);
Line(8,10,8,6);
Line(12,10,12,5);
break;
case Facility.Stores:
Segment(4,5,20,5,20,19,4,19,4,5);
Line(4,11,20,11);
Line(8,8,16,8);
Line(8,15,16,15);
break;
case Facility.Water:
case Facility.Waste:
Segment(12,3,18,11,19,15,17,19,12,21,7,19,5,15,6,11,12,3);
Line(8,16,16,16);
break;
case Facility.Workshop:
Segment(6,19,15,10,14,7,18,5,20,7,19,10,16,11,8,21,6,19);
break;
default:
Line(6,6,18,18);
Line(6,18,18,6);
break;
}
pen.Stroke();
};
}
private void DrawShipyard(VisualElement workspace)
{
var work = Add(workspace, "ship-work yard-work");
(int hullIndex, bool used) = Offers[yardSelection];
HullSpec hull = Market.Hulls[hullIndex];
var titleBar = Add(work, "ship-work-head");
var heading = Add(titleBar, "ship-work-name");
AddText(heading, "MIAMI SHIPYARD", "work-caption");
AddDisplay(heading, used ? $"Pre-owned {hull.Name}" : $"{hull.Name} commission", "ship-work-heading");
AddText(heading, used ? "Fitted for service · 72% condition at delivery" : hull.Description, "ship-work-detail");
var stamp = Add(titleBar, "work-yard-stamp");
AddText(stamp, "DELIVERY AT MIAMI", "work-caption");
AddText(stamp, $"{hull.MaxDecks} decks max · {hull.Columns * hull.Rows} berths per deck · {hull.Tank} t fuel", "work-yard-specs");
var slipway = Add(work, "work-slipway");
slipway.generateVisualContent += context => DrawYardElevation(context, hullIndex, used);
var markings = Add(slipway, "work-draft-markings");
markings.pickingMode = PickingMode.Ignore;
AddText(markings, "STARBOARD ELEVATION", "work-caption");
AddText(markings, used ? "FITTED HULL" : $"BARE HULL / {Market.FirstDecks} STARTER DECKS", "work-caption");
var inventory = Add(work, "work-ship-inventory");
for (int item = 0; item < Offers.Length; item++)
{
int selection = item;
var offer = Offers[item];
HullSpec candidate = Market.Hulls[offer.HullIndex];
bool locked = company.Voyages < candidate.Voyages || company.Reputation < candidate.Reputation;
Button option = Action("", () =>
{
yardSelection = selection;
Notify(null);
Render();
}, "work-offer", "yard-" + item);
option.EnableInClassList("work-selected", selection == yardSelection);
AddText(option, locked ? "LOCKED" : offer.Used ? "PRE-OWNED" : "NEW HULL", "work-caption");
AddText(option, candidate.Name, "work-offer-name");
AddText(option, Money(offer.Used ? Market.UsedPrice(offer.HullIndex) : candidate.Price), "work-offer-price");
inventory.Add(option);
}
var order = Add(work, "work-order");
DrawShipyardOrder(order, hullIndex, used);
if (Ship != null)
DrawShipyardService(order, Ship);
}
private void DrawShipyardOrder(VisualElement order, int hullIndex, bool used)
{
var purchase = Add(order, "work-purchase");
if (!used)
{
var nameControl = Add(purchase, "work-name-control");
AddText(nameControl, "VESSEL NAME", "work-caption");
var field = new TextField { value = shipName, maxLength = 24, name = "vessel-name" };
field.AddToClassList("work-name-field");
field.RegisterValueChangedCallback(evt => shipName = evt.newValue);
nameControl.Add(field);
}
string block = company.ShipyardBlock(hullIndex, used);
var contract = Add(purchase, "work-contract");
long price = used ? Market.UsedPrice(hullIndex) : Market.Hulls[hullIndex].Price;
Button buy = Action(used ? $"Purchase · {Money(price)}" : $"Commission · {Money(price)}", () =>
{
string failure = company.Acquire(hullIndex, used, shipName);
if (failure == null)
{
deckIndex = 0;
ResetItinerary();
page = used ? 0 : 1;
}
Apply(failure, used ? "The vessel is ready in Miami." : "The hull is ready. Fit cabins and dining before sailing.");
}, "work-primary work-commission", "buy-ship");
buy.SetEnabled(block == null);
contract.Add(buy);
if (block != null)
AddText(contract, block, "work-contract-block");
}
private void DrawShipyardService(VisualElement order, Ship ship)
{
var service = Add(order, "work-service");
var shipInfo = Add(service, "work-service-info");
AddText(shipInfo, ship.Name, "work-offer-name");
AddText(shipInfo, $"{ship.Condition}% condition", "work-yard-specs");
int price = company.ServiceCost(ship);
Button overhaul = Action(price > 0 ? $"Overhaul · {Money(price)}" : "No repairs needed", () =>
{
string failure = company.Service(ship);
if (failure == null)
SetRecommendedFuel();
Apply(failure, "The ship has been restored to 100% condition.");
}, "work-overhaul", "overhaul");
overhaul.SetEnabled(price > 0 && company.Cash >= price);
service.Add(overhaul);
}
private static void DrawDeckOutline(MeshGenerationContext context, int columns)
{
Rect bounds = context.visualElement.contentRect;
if (bounds.width <= 0 || bounds.height <= 0)
return;
Painter2D pen = context.painter2D;
Vector2 P(float x, float y) => new Vector2(bounds.width * x, bounds.height * y);
DrawDraftGrid(pen, bounds, 26);
void Hull(float inset)
{
Vector2 aftPort = P(.047f + inset, .37f + inset);
Vector2 portShoulder = P(.17f + inset, .145f + inset);
Vector2 portBow = P(.75f - inset, .145f + inset);
Vector2 bow = P(.965f - inset, .50f);
Vector2 starboardBow = P(.75f - inset, .855f - inset);
Vector2 starboardShoulder = P(.17f + inset, .855f - inset);
Vector2 aftStarboard = P(.047f + inset, .63f - inset);
pen.MoveTo(aftPort);
TraceDraftCurve(pen, aftPort, P(.078f + inset, .16f + inset), portShoulder);
pen.LineTo(portBow);
TraceDraftCurve(pen, portBow, P(.91f - inset, .15f + inset), bow);
TraceDraftCurve(pen, bow, P(.91f - inset, .85f - inset), starboardBow);
pen.LineTo(starboardShoulder);
TraceDraftCurve(pen, starboardShoulder, P(.078f + inset, .84f - inset), aftStarboard);
pen.LineTo(aftPort);
}
pen.fillColor = new Color(.065f, .18f, .217f, .98f);
pen.strokeColor = DraftInk;
pen.lineWidth = 2;
pen.BeginPath();
Hull(0);
pen.Fill();
pen.Stroke();
pen.strokeColor = DraftFine;
pen.lineWidth = 1;
pen.BeginPath();
Hull(.014f);
pen.Stroke();
pen.BeginPath();
void Guide(float x, float top, float control, float bottom)
{
Vector2 start = P(x, top);
pen.MoveTo(start);
TraceDraftCurve(pen, start, P(control, .50f), P(x, bottom));
}
Guide(.104f, .23f, .145f, .77f);
Guide(.780f, .18f, .853f, .82f);
Guide(.824f, .21f, .894f, .79f);
Guide(.872f, .28f, .937f, .72f);
pen.Stroke();
pen.BeginPath();
for (int i = 0; i <= columns; i++)
{
float station = Mathf.Lerp(.135f, .785f, i / (float)columns);
pen.MoveTo(P(station, .198f));
pen.LineTo(P(station, .256f));
pen.MoveTo(P(station, .744f));
pen.LineTo(P(station, .80f));
}
for (int i = 0; i < 9; i++)
{
float y = .37f + .033f * i;
pen.MoveTo(P(.073f, y));
pen.LineTo(P(.094f, y));
}
pen.MoveTo(P(.055f, .50f));
pen.LineTo(P(.131f, .50f));
pen.MoveTo(P(.789f, .50f));
pen.LineTo(P(.948f, .50f));
pen.Stroke();
pen.strokeColor = DraftGold;
pen.BeginPath();
pen.MoveTo(P(.91f, .47f));
pen.LineTo(P(.934f, .50f));
pen.LineTo(P(.91f, .53f));
pen.Stroke();
}
private static void DrawYardElevation(MeshGenerationContext context, int hullIndex, bool used)
{
Rect bounds = context.visualElement.contentRect;
if (bounds.width <= 0 || bounds.height <= 0)
return;
Painter2D pen = context.painter2D;
DrawDraftGrid(pen, bounds, 33);
Vector2 P(float x, float y) => new Vector2(bounds.width * x, bounds.height * y);
float stern = .178f - hullIndex * .028f;
float bow = .833f + hullIndex * .029f;
float L(float position) => Mathf.Lerp(stern, bow, position);
void Path(params float[] xy)
{
pen.MoveTo(P(L(xy[0]), xy[1]));
for (int i = 2; i < xy.Length; i += 2)
pen.LineTo(P(L(xy[i]), xy[i + 1]));
}
pen.strokeColor = DraftFine;
pen.lineWidth = 1;
pen.BeginPath();
for (int i = 0; i < 33; i++)
{
float x = .055f + i * .028f;
pen.MoveTo(P(x, .80f));
pen.LineTo(P(x, i % 4 == 0 ? .85f : .825f));
}
pen.MoveTo(P(.055f, .80f));
pen.LineTo(P(.955f, .80f));
for (int i = 1; i < 13; i++)
{
float position = i / 13f;
pen.MoveTo(P(L(position), .665f));
pen.LineTo(P(L(position - .022f), .80f));
pen.LineTo(P(L(position + .026f), .80f));
pen.ClosePath();
}
pen.Stroke();
pen.strokeColor = DraftGold;
pen.lineWidth = 1.35f;
pen.BeginPath();
Path(0,.875f, 0,.918f);
Path(0,.897f, 1,.897f);
Path(1,.875f, 1,.918f);
Path(0,.897f, .012f,.881f);
Path(0,.897f, .012f,.913f);
Path(1,.897f, .988f,.881f);
Path(1,.897f, .988f,.913f);
pen.Stroke();
pen.fillColor = new Color(.13f, .23f, .24f);
pen.strokeColor = DraftInk;
pen.lineWidth = 1.8f;
pen.BeginPath();
Vector2 transom = P(stern, .56f);
Vector2 aftDeck = P(L(.21f), .565f);
Vector2 foreDeck = P(L(.79f), .565f);
Vector2 stem = P(bow, .49f);
Vector2 forwardKeel = P(L(.903f), .712f);
Vector2 aftKeel = P(L(.135f), .712f);
pen.MoveTo(transom);
TraceDraftCurve(pen, transom, P(L(.11f), .57f), aftDeck);
pen.LineTo(foreDeck);
TraceDraftCurve(pen, foreDeck, P(L(.94f), .565f), stem);
TraceDraftCurve(pen, stem, P(L(.974f), .64f), forwardKeel);
pen.LineTo(aftKeel);
TraceDraftCurve(pen, aftKeel, P(L(.047f), .702f), transom);
pen.Fill();
pen.Stroke();
pen.strokeColor = DraftGold;
pen.lineWidth = 1;
pen.BeginPath();
Path(.026f,.609f, .119f,.627f, .885f,.627f, .959f,.579f);
pen.Stroke();
int levels = Market.FirstDecks;
int allowedDecks = Market.Hulls[hullIndex].MaxDecks;
pen.strokeColor = new Color(DraftFine.r, DraftFine.g, DraftFine.b, .28f);
pen.BeginPath();
for (int level = levels; level < allowedDecks; level++)
{
float y = .561f - level * .068f;
float left = .079f + level * .031f;
float right = .872f - level * .04f;
for (float x = left; x < right; x += .022f)
Path(x, y, Mathf.Min(x + .012f, right), y);
}
pen.Stroke();
for (int level = 0; level < levels; level++)
{
float bottom = .561f - level * .068f;
float left = .079f + level * .031f;
float right = .872f - level * .04f;
pen.fillColor = new Color(.17f + .022f * level, .29f, .30f);
pen.strokeColor = DraftFine;
pen.lineWidth = 1.25f;
pen.BeginPath();
Path(left,bottom, left + .006f,bottom - .055f, right - .036f,bottom - .062f, right,bottom);
pen.ClosePath();
pen.Fill();
pen.Stroke();
pen.strokeColor = DraftInk;
pen.BeginPath();
if (used)
for (float x = left + .022f; x < right - .04f; x += .028f)
Path(x,bottom - .036f, x + .014f,bottom - .036f);
else
for (float x = left + .025f; x < right - .04f; x += .1f)
Path(x,bottom - .026f, x + .050f,bottom - .026f);
pen.Stroke();
}
float top = .57f - levels * .068f;
pen.fillColor = new Color(.38f, .30f, .19f);
pen.strokeColor = DraftGold;
pen.BeginPath();
Path(.403f,top, .420f,top - .111f, .466f,top - .111f, .452f,top);
pen.ClosePath();
pen.Fill();
pen.Stroke();
pen.strokeColor = DraftInk;
pen.BeginPath();
Path(.645f,top + .01f, .645f,top - .125f);
Path(.619f,top - .090f, .671f,top - .090f);
Path(.628f,top - .108f, .662f,top - .108f);
pen.Stroke();
}
private static void TraceDraftCurve(Painter2D pen, Vector2 start, Vector2 control, Vector2 end)
{
// Explicit line segments keep UI Toolkit from closing these curves through the drawing origin.
const int subdivisions = 18;
for (int index = 1; index <= subdivisions; index++)
{
float t = index / (float)subdivisions;
pen.LineTo(Vector2.Lerp(Vector2.Lerp(start, control, t), Vector2.Lerp(control, end, t), t));
}
}
private static void DrawDraftGrid(Painter2D pen, Rect bounds, float cell)
{
pen.strokeColor = DraftGrid;
pen.lineWidth = 1;
pen.BeginPath();
for (float x = bounds.width / 2 % cell; x < bounds.width; x += cell)
{
pen.MoveTo(new Vector2(x, 0));
pen.LineTo(new Vector2(x, bounds.height));
}
for (float y = bounds.height / 2 % cell; y < bounds.height; y += cell)
{
pen.MoveTo(new Vector2(0, y));
pen.LineTo(new Vector2(bounds.width, y));
}
pen.Stroke();
}
}
}