Add interactive dome view and five-chapter story
This commit is contained in:
@@ -45,17 +45,24 @@ namespace DomeShift
|
||||
private readonly GUIStyle item = Style(16, FontStyle.Bold);
|
||||
private readonly GUIStyle key = Style(12, FontStyle.Bold, TextAnchor.MiddleCenter);
|
||||
private readonly GUIStyle time = Style(31, FontStyle.Bold, TextAnchor.MiddleRight);
|
||||
private readonly GUIStyle percentage = Style(24, FontStyle.Bold, TextAnchor.MiddleRight);
|
||||
private readonly GUIStyle title = Style(78, FontStyle.Bold);
|
||||
private readonly GUIStyle headline = Style(42, FontStyle.Bold);
|
||||
private readonly GUIStyle section = Style(22, FontStyle.Bold);
|
||||
private readonly GUIStyle longLocation = Style(18, FontStyle.Bold);
|
||||
private readonly GUIStyle regionLabel = Style(16, FontStyle.Bold, TextAnchor.MiddleCenter);
|
||||
private readonly GUIStyle longRegionLabel = Style(14, FontStyle.Bold, TextAnchor.MiddleCenter);
|
||||
private readonly GUIStyle chapterTitle = Style(22, FontStyle.Bold, wraps: true);
|
||||
private readonly GUIStyle storyHeadline = Style(34, FontStyle.Bold, wraps: true);
|
||||
private readonly GUIStyle prompt = Style(16, FontStyle.Bold, TextAnchor.MiddleCenter, true);
|
||||
private readonly GUIStyle fine = Style(13, wraps: true);
|
||||
private GUIStyle seedInput;
|
||||
|
||||
private int lastSeconds = -1;
|
||||
private string clockText;
|
||||
private bool viewingDome;
|
||||
private bool parametersOpen;
|
||||
private ViewParameters viewParameters;
|
||||
|
||||
public void Draw(DomeGame game)
|
||||
{
|
||||
@@ -70,6 +77,13 @@ namespace DomeShift
|
||||
|
||||
try
|
||||
{
|
||||
if (game.Phase == GamePhase.Viewer)
|
||||
{
|
||||
DrawViewer(game, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
viewingDome = false;
|
||||
if (game.Phase == GamePhase.Title)
|
||||
{
|
||||
DrawTitle(game, width, height);
|
||||
@@ -109,31 +123,159 @@ namespace DomeShift
|
||||
Label(new Rect(left, top + 189, 350, 43),
|
||||
"You came looking for a bathroom. The greenhouse locked you in.", body, Ink);
|
||||
Label(new Rect(left, top + 232, 371, 57),
|
||||
"Tour the Rainforest, Tropical Lagoon, Farm and Great Desert, or repair three stations before lockdown.", body, MutedInk);
|
||||
"See Bud and Doyle through their stay, explore all ten regions, or take a closer look at the dome itself.", body, MutedInk);
|
||||
|
||||
Label(new Rect(left, top + 299, 215, 19), "CHOOSE A CHARACTER", tag, Amber);
|
||||
Label(new Rect(left + 206, top + 299, 169, 19), "LEFT / RIGHT ARROWS", tagRight, MutedInk);
|
||||
DrawCharacterOption(game, new Rect(left, top + 324, 181, 58), PlayableCharacter.Bud);
|
||||
DrawCharacterOption(game, new Rect(left + 194, top + 324, 181, 58), PlayableCharacter.Doyle);
|
||||
|
||||
if (ActionButton(new Rect(left, top + 397, 375, 52), "EXPLORE DOME", "X"))
|
||||
if (ActionButton(new Rect(left, top + 397, 375, 50), "STORY MODE", "S"))
|
||||
game.StartStory();
|
||||
if (SecondaryButton(new Rect(left, top + 459, 181, 41), "Explore Dome", "X"))
|
||||
game.StartExplore();
|
||||
if (SecondaryButton(new Rect(left, top + 462, 375, 42), "Start timed shift", "ENTER", 63))
|
||||
if (SecondaryButton(new Rect(left + 194, top + 459, 181, 41), "Dome View", "P"))
|
||||
game.StartViewer();
|
||||
if (SecondaryButton(new Rect(left, top + 512, 375, 38), "Timed repair shift", "ENTER", 63))
|
||||
game.StartShift();
|
||||
|
||||
float controls = top + 524;
|
||||
DrawBinding(left, controls, 118, "WASD / ARROWS", "Move");
|
||||
DrawBinding(left + 175, controls, 30, "E", "Use");
|
||||
DrawBinding(left + 266, controls, 46, "ESC", "Pause");
|
||||
|
||||
if (game.CanToggleFullscreen)
|
||||
DrawFullscreenButton(game, new Rect(width - 325, 24, 167, 34));
|
||||
DrawSoundButton(game, new Rect(width - 150, 24, 126, 34));
|
||||
}
|
||||
|
||||
private void DrawViewer(DomeGame game, float width, float height)
|
||||
{
|
||||
if (!viewingDome)
|
||||
{
|
||||
viewParameters = new ViewParameters(game.Profile);
|
||||
parametersOpen = true;
|
||||
viewingDome = true;
|
||||
}
|
||||
|
||||
if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.H)
|
||||
{
|
||||
parametersOpen = !parametersOpen;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
Event.current.Use();
|
||||
}
|
||||
|
||||
if (NavigationButton(new Rect(24, 24, 165, 33), parametersOpen ? "Hide parameters" : "Show parameters", "H", 24, parametersOpen))
|
||||
parametersOpen = !parametersOpen;
|
||||
|
||||
Rect heading = new Rect(197, 24, 130, 33);
|
||||
Fill(heading, Panel);
|
||||
Stroke(heading, Border);
|
||||
Label(heading, "DOME VIEW", key, Mint);
|
||||
|
||||
if (NavigationButton(new Rect(width - 490, 24, 148, 33), game.Cutaway ? "Roof cutaway" : "Roof visible", "V", 24, game.Cutaway))
|
||||
game.ToggleRoof();
|
||||
if (NavigationButton(new Rect(width - 334, 24, 154, 33), "Recenter", "HOME", 48, false))
|
||||
game.ResetCamera();
|
||||
if (NavigationButton(new Rect(width - 172, 24, 148, 33), "Back to title", "ESC", 33, false))
|
||||
{
|
||||
game.ExitViewer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (parametersOpen)
|
||||
DrawViewerParameters(game, new Rect(24, 68, 272, 466));
|
||||
|
||||
Rect camera = new Rect(width * 0.5f - 201, height - 59, 402, 35);
|
||||
DrawPanel(camera);
|
||||
DrawCameraHint(camera);
|
||||
}
|
||||
|
||||
private void DrawViewerParameters(DomeGame game, Rect card)
|
||||
{
|
||||
DrawPanel(card);
|
||||
Fill(new Rect(card.x, card.y, 3, card.height), Mint);
|
||||
Label(new Rect(card.x + 16, card.y + 12, card.width - 32, 28), "Model parameters", section, Ink);
|
||||
|
||||
Rect first = new Rect(card.x + 16, card.y + 52, card.width - 32, 35);
|
||||
viewParameters.Width = DrawSlider(first, "Width", viewParameters.Width, 68, 126, .1f, "0.0");
|
||||
first.y += 43;
|
||||
viewParameters.Depth = DrawSlider(first, "Depth", viewParameters.Depth, 52, 96, .1f, "0.0");
|
||||
first.y += 43;
|
||||
viewParameters.Height = DrawSlider(first, "Roof height", viewParameters.Height, 10, 22, .1f, "0.0");
|
||||
first.y += 43;
|
||||
viewParameters.Bays = Mathf.RoundToInt(DrawSlider(first, "Roof bays", viewParameters.Bays, 4, 12, 1, "0"));
|
||||
first.y += 43;
|
||||
viewParameters.Glass = DrawSlider(first, "Glass opacity", viewParameters.Glass, .06f, .4f, .01f, "0%");
|
||||
first.y += 43;
|
||||
viewParameters.Vegetation = DrawSlider(first, "Vegetation density", viewParameters.Vegetation, .3f, 1.5f, .01f, "0%");
|
||||
first.y += 43;
|
||||
viewParameters.Relief = DrawSlider(first, "Terrain relief", viewParameters.Relief, 0, 1.6f, .01f, "0%");
|
||||
|
||||
seedInput ??= new GUIStyle(GUI.skin.textField) { alignment = TextAnchor.MiddleRight, fontSize = 13 };
|
||||
Rect seed = new Rect(card.xMax - 116, card.y + 361, 100, 28);
|
||||
Label(new Rect(card.x + 16, seed.y, 114, seed.height), "Scene seed", fine, Ink);
|
||||
viewParameters.Seed = GUI.TextField(seed, viewParameters.Seed, 11, seedInput);
|
||||
bool validSeed = int.TryParse(viewParameters.Seed, out int seedValue);
|
||||
if (!validSeed)
|
||||
Stroke(seed, Alarm);
|
||||
|
||||
Rect apply = new Rect(card.x + 16, card.y + 408, card.width - 32, 42);
|
||||
if (ActionButton(apply, validSeed ? "APPLY CHANGES" : "ENTER A VALID SEED", null, validSeed && viewParameters.DiffersFrom(game.Profile, seedValue)))
|
||||
{
|
||||
game.ApplyViewParameters(viewParameters.Width, viewParameters.Depth, viewParameters.Height, viewParameters.Bays,
|
||||
viewParameters.Glass, viewParameters.Vegetation, viewParameters.Relief, seedValue);
|
||||
viewParameters = new ViewParameters(game.Profile);
|
||||
}
|
||||
}
|
||||
|
||||
private float DrawSlider(Rect row, string name, float value, float min, float max, float step, string format)
|
||||
{
|
||||
Label(new Rect(row.x, row.y, row.width - 67, 16), name, fine, Ink);
|
||||
Label(new Rect(row.xMax - 64, row.y, 64, 16), value.ToString(format), tagRight, Mint);
|
||||
float next = GUI.HorizontalSlider(new Rect(row.x, row.y + 18, row.width, 17), value, min, max);
|
||||
return Mathf.Approximately(next, value) ? value : Mathf.Clamp(Mathf.Round(next / step) * step, min, max);
|
||||
}
|
||||
|
||||
private struct ViewParameters
|
||||
{
|
||||
public float Width;
|
||||
public float Depth;
|
||||
public float Height;
|
||||
public int Bays;
|
||||
public float Glass;
|
||||
public float Vegetation;
|
||||
public float Relief;
|
||||
public string Seed;
|
||||
|
||||
public ViewParameters(DomeEnvironment profile)
|
||||
{
|
||||
Width = profile.Width;
|
||||
Depth = profile.Depth;
|
||||
Height = profile.RoofHeight;
|
||||
Bays = profile.RoofBays;
|
||||
Glass = profile.GlazingOpacity;
|
||||
Vegetation = profile.VegetationDensity;
|
||||
Relief = profile.TerrainRelief;
|
||||
Seed = profile.Seed.ToString();
|
||||
}
|
||||
|
||||
public bool DiffersFrom(DomeEnvironment profile, int seed)
|
||||
{
|
||||
return !Mathf.Approximately(Width, profile.Width)
|
||||
|| !Mathf.Approximately(Depth, profile.Depth)
|
||||
|| !Mathf.Approximately(Height, profile.RoofHeight)
|
||||
|| Bays != profile.RoofBays
|
||||
|| !Mathf.Approximately(Glass, profile.GlazingOpacity)
|
||||
|| !Mathf.Approximately(Vegetation, profile.VegetationDensity)
|
||||
|| !Mathf.Approximately(Relief, profile.TerrainRelief)
|
||||
|| seed != profile.Seed;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawGameplay(DomeGame game, float width, float height)
|
||||
{
|
||||
if (game.Exploring)
|
||||
if (game.InStory)
|
||||
{
|
||||
DrawStoryChapter(new Rect(24, 24, 311, 222), game);
|
||||
DrawHomeostasis(new Rect(width - 231, 24, 207, 82), game.Homeostasis);
|
||||
}
|
||||
else if (game.Exploring)
|
||||
{
|
||||
Rect location = new Rect(24, 24, 252, 75);
|
||||
DrawPanel(location);
|
||||
@@ -156,22 +298,58 @@ namespace DomeShift
|
||||
Rect radio = new Rect(24, bottom - 64, 326, 64);
|
||||
Rect pocket = new Rect(width - 217, bottom - 64, 193, 64);
|
||||
if (!string.IsNullOrWhiteSpace(game.Dispatch))
|
||||
DrawRadio(radio, game.Dispatch);
|
||||
if (!game.Exploring || game.Carried >= 0)
|
||||
DrawPocket(pocket, game.Carried, game.Character);
|
||||
DrawRadio(radio, game.Dispatch, game.InStory ? "STORY UPDATE" : "DISPATCH");
|
||||
int carried = game.InStory ? game.StoryCarried : game.Carried;
|
||||
if (carried >= 0 || (!game.Exploring && !game.InStory))
|
||||
DrawPocket(pocket, carried, game.Character, game.InStory);
|
||||
|
||||
float center = width * 0.5f;
|
||||
if (!string.IsNullOrWhiteSpace(game.Prompt))
|
||||
{
|
||||
Rect cue = new Rect(center - 184, bottom - 64, 368, 36);
|
||||
Rect cue = new Rect(center - 184, bottom - 86, 368, 36);
|
||||
DrawPanel(cue);
|
||||
Fill(new Rect(cue.x, cue.y, 3, cue.height), Amber);
|
||||
Label(new Rect(cue.x + 9, cue.y, cue.width - 18, cue.height), game.Prompt, prompt, Ink);
|
||||
}
|
||||
|
||||
Rect controls = new Rect(center - 192, bottom - 24, 384, 24);
|
||||
Rect controls = new Rect(center - 195, bottom - 43, 390, 43);
|
||||
Fill(controls, Panel);
|
||||
Label(controls, "WASD / Arrows Move E Use Esc Pause M Sound", key, MutedInk);
|
||||
Label(new Rect(controls.x, controls.y + 2, controls.width, 19), "WASD / Arrows Move E Use Esc Pause M Sound", key, Ink);
|
||||
DrawCameraHint(new Rect(controls.x, controls.y + 21, controls.width, 19));
|
||||
}
|
||||
|
||||
private void DrawStoryChapter(Rect rect, DomeGame game)
|
||||
{
|
||||
DrawPanel(rect);
|
||||
Fill(new Rect(rect.x, rect.y, 3, rect.height), Amber);
|
||||
float left = rect.x + 15;
|
||||
float content = rect.width - 30;
|
||||
Label(new Rect(left, rect.y + 10, content, 20), $"CHAPTER {game.StoryChapter} OF {game.StoryChapterCount}", tag, Amber);
|
||||
Label(new Rect(left, rect.y + 33, content, 29), game.StoryTitle, chapterTitle, Ink);
|
||||
Label(new Rect(left, rect.y + 64, content, 18), game.StoryStatus, tag, MutedInk);
|
||||
Label(new Rect(left, rect.y + 82, content, 68), game.StoryBrief, fine, Ink);
|
||||
Fill(new Rect(left, rect.y + 156, content, 1), Border);
|
||||
Label(new Rect(left, rect.y + 162, content - 60, 18), "CURRENT OBJECTIVE", tag, Amber);
|
||||
Label(new Rect(rect.xMax - 67, rect.y + 162, 52, 18), $"{game.StoryDone} / {game.StoryTotal}", tagRight, Ink);
|
||||
Label(new Rect(left, rect.y + 181, content, 36), game.StoryGoal, fine, Ink);
|
||||
}
|
||||
|
||||
private void DrawHomeostasis(Rect rect, float homeostasis)
|
||||
{
|
||||
DrawPanel(rect);
|
||||
float amount = Mathf.Clamp01(homeostasis);
|
||||
Color color = amount < 0.4f ? Alarm : amount < 0.7f ? Amber : Mint;
|
||||
Label(new Rect(rect.x + 13, rect.y + 14, 112, 36), "HOMEOSTASIS", tag, MutedInk);
|
||||
Label(new Rect(rect.xMax - 84, rect.y + 10, 71, 43), $"{amount:0%}", percentage, color);
|
||||
|
||||
Rect meter = new Rect(rect.x + 13, rect.yMax - 20, rect.width - 26, 6);
|
||||
Fill(meter, Inset);
|
||||
Fill(new Rect(meter.x, meter.y, meter.width * amount, meter.height), color);
|
||||
}
|
||||
|
||||
private void DrawCameraHint(Rect rect)
|
||||
{
|
||||
Label(rect, "RMB Orbit Shift+RMB Pan Wheel Zoom Home Reset", key, MutedInk);
|
||||
}
|
||||
|
||||
private void DrawNavigation(DomeGame game, float width)
|
||||
@@ -214,7 +392,9 @@ namespace DomeShift
|
||||
DrawMapCorridor(floor, -11, false);
|
||||
|
||||
DrawNorthArrow(card.x + 37, floor.y + 7);
|
||||
if (!game.Exploring)
|
||||
if (game.InStory)
|
||||
DrawStoryPins(floor, game);
|
||||
else if (!game.Exploring)
|
||||
DrawChallengePins(floor, game);
|
||||
|
||||
Vector2 player = CanvasPoint(floor, game.MapPosition);
|
||||
@@ -229,7 +409,12 @@ namespace DomeShift
|
||||
Fill(new Rect(card.x + 212, legendY + 10, 13, 2), MapCorridor);
|
||||
Label(new Rect(card.x + 233, legendY, 92, 24), "Corridor", fine, MutedInk);
|
||||
|
||||
if (!game.Exploring)
|
||||
if (game.InStory)
|
||||
{
|
||||
DrawMapPin(new Vector2(card.x + 331, legendY + 12), Amber, PinKind.Station);
|
||||
Label(new Rect(card.x + 346, legendY, 160, 24), "Story objective", fine, MutedInk);
|
||||
}
|
||||
else if (!game.Exploring)
|
||||
{
|
||||
DrawMapPin(new Vector2(card.x + 331, legendY + 12), Ink, PinKind.Station);
|
||||
Label(new Rect(card.x + 346, legendY, 84, 24), "Station", fine, MutedInk);
|
||||
@@ -316,6 +501,27 @@ namespace DomeShift
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawStoryPins(Rect floor, DomeGame game)
|
||||
{
|
||||
const float labelWidth = 166f;
|
||||
const float labelHeight = 29f;
|
||||
for (int index = 0; index < game.StoryPinCount; index++)
|
||||
{
|
||||
Vector2 target = CanvasPoint(floor, game.StoryPin(index));
|
||||
DrawMapPin(target, Amber, PinKind.Station);
|
||||
|
||||
float preferredX = target.x + 9;
|
||||
if (preferredX + labelWidth > floor.xMax)
|
||||
preferredX = target.x - labelWidth - 9;
|
||||
float y = target.y + (index % 2 == 0 ? -labelHeight - 6 : 7);
|
||||
Rect label = new Rect(Mathf.Clamp(preferredX, floor.xMin + 3, floor.xMax - labelWidth - 3),
|
||||
Mathf.Clamp(y, floor.yMin + 3, floor.yMax - labelHeight - 3), labelWidth, labelHeight);
|
||||
Fill(label, Panel);
|
||||
Fill(new Rect(label.x, label.y, 2, label.height), Amber);
|
||||
Label(new Rect(label.x + 7, label.y, label.width - 14, label.height), game.StoryPinName(index), fine, Amber);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawMapPin(Vector2 point, Color color, PinKind kind)
|
||||
{
|
||||
Rect square = new Rect(point.x - 5, point.y - 5, 10, 10);
|
||||
@@ -412,15 +618,15 @@ namespace DomeShift
|
||||
Fill(new Rect(meter.x, meter.y, meter.width * ratio, meter.height), color);
|
||||
}
|
||||
|
||||
private void DrawRadio(Rect rect, string message)
|
||||
private void DrawRadio(Rect rect, string message, string channel)
|
||||
{
|
||||
DrawPanel(rect);
|
||||
Fill(new Rect(rect.x + 14, rect.y + 15, 6, 6), Mint);
|
||||
Label(new Rect(rect.x + 27, rect.y + 9, rect.width - 39, 18), "DISPATCH", tag, Mint);
|
||||
Label(new Rect(rect.x + 27, rect.y + 9, rect.width - 39, 18), channel, tag, Mint);
|
||||
Label(new Rect(rect.x + 14, rect.y + 26, rect.width - 28, 30), message, fine, Ink);
|
||||
}
|
||||
|
||||
private void DrawPocket(Rect rect, int carried, PlayableCharacter character)
|
||||
private void DrawPocket(Rect rect, int carried, PlayableCharacter character, bool inStory)
|
||||
{
|
||||
DrawPanel(rect);
|
||||
Label(new Rect(rect.x + 14, rect.y + 9, rect.width - 28, 18),
|
||||
@@ -428,8 +634,9 @@ namespace DomeShift
|
||||
bool occupied = carried >= 0 && carried < Supplies.Length;
|
||||
if (occupied)
|
||||
DrawStationIcon(rect.x + 15, rect.y + 35, carried, StationColors[carried]);
|
||||
string part = occupied ? (inStory && carried == 2 ? "Seed tray" : Supplies[carried]) : "Empty";
|
||||
Label(new Rect(rect.x + (occupied ? 39 : 14), rect.y + 27, rect.width - 49, 30),
|
||||
occupied ? Supplies[carried] : "Empty", item, occupied ? Ink : MutedInk);
|
||||
part, item, occupied ? Ink : MutedInk);
|
||||
}
|
||||
|
||||
private void DrawShiftCard(DomeGame game, float width, float height)
|
||||
@@ -437,23 +644,32 @@ namespace DomeShift
|
||||
Fill(new Rect(0, 0, width, height), Overlay);
|
||||
bool won = game.Phase == GamePhase.Won;
|
||||
bool paused = game.Phase == GamePhase.Paused;
|
||||
bool showReturn = !paused || game.Exploring;
|
||||
float cardHeight = showReturn ? 352 : 294;
|
||||
const float cardHeight = 352;
|
||||
Rect card = new Rect((width - 434) * 0.5f, (height - cardHeight) * 0.5f, 434, cardHeight);
|
||||
DrawPanel(card);
|
||||
Color accent = won ? Mint : paused ? Amber : Alarm;
|
||||
Fill(new Rect(card.x, card.y, card.width, 4), accent);
|
||||
|
||||
float left = card.x + 26;
|
||||
Label(new Rect(left, card.y + 23, 300, 20), paused ? "SHIFT CONTROL" : "SHIFT REPORT", tag, accent);
|
||||
string report = game.InStory ? (paused ? "STORY PAUSED" : "STORY REPORT") : paused ? "SHIFT CONTROL" : "SHIFT REPORT";
|
||||
Label(new Rect(left, card.y + 23, 300, 20), report, tag, accent);
|
||||
string heading = paused ? "Taking a break?" : won ? "You made it out." : "Lockdown.";
|
||||
Label(new Rect(left, card.y + 46, 380, 58), heading, headline, Ink);
|
||||
if (game.InStory && !paused)
|
||||
heading = won ? "Balance restored." : "Balance disrupted.";
|
||||
Label(new Rect(left, card.y + 46, 380, 58), heading, game.InStory ? storyHeadline : headline, Ink);
|
||||
|
||||
if (paused)
|
||||
{
|
||||
string detail = game.Exploring ? DomeEnvironment.RegionName(game.CurrentRegion) : "The shift clock is paused.";
|
||||
string detail = game.InStory ? game.StoryTitle
|
||||
: game.Exploring ? DomeEnvironment.RegionName(game.CurrentRegion)
|
||||
: "The shift clock is paused.";
|
||||
Label(new Rect(left, card.y + 106, 380, 48), detail, body, MutedInk);
|
||||
}
|
||||
else if (game.InStory)
|
||||
{
|
||||
DrawStat(new Rect(left, card.y + 113, 187, 63), "CHAPTER", $"{game.StoryChapter} / {game.StoryChapterCount}");
|
||||
DrawStat(new Rect(left + 195, card.y + 113, 187, 63), "HOMEOSTASIS", $"{game.Homeostasis:0%}");
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawStat(new Rect(left, card.y + 113, 187, 63), "STATIONS ONLINE", Progress[CountRepairs(game.RepairedMask)]);
|
||||
@@ -461,7 +677,9 @@ namespace DomeShift
|
||||
}
|
||||
|
||||
string retry = game.Character == PlayableCharacter.Bud ? "RETRY AS BUD" : "RETRY AS DOYLE";
|
||||
if (ActionButton(new Rect(left, card.y + 198, 382, 50), paused ? "RESUME SHIFT" : retry, "ENTER"))
|
||||
string primary = game.InStory ? (paused ? "RESUME STORY" : won ? "PLAY STORY AGAIN" : "RETRY STORY")
|
||||
: paused ? (game.Exploring ? "RESUME EXPLORING" : "RESUME SHIFT") : retry;
|
||||
if (ActionButton(new Rect(left, card.y + 198, 382, 50), primary, "ENTER"))
|
||||
{
|
||||
if (paused)
|
||||
game.Resume();
|
||||
@@ -469,11 +687,11 @@ namespace DomeShift
|
||||
game.Restart();
|
||||
}
|
||||
|
||||
if (showReturn && SecondaryButton(new Rect(left, card.y + 261, 382, 42), paused ? "Return to title" : "Change character", "B"))
|
||||
if (SecondaryButton(new Rect(left, card.y + 261, 382, 42), paused || game.InStory ? "Return to title" : "Change character", "B"))
|
||||
game.ChooseCharacter();
|
||||
|
||||
bool showFullscreen = paused && game.CanToggleFullscreen;
|
||||
Label(new Rect(left, card.yMax - 38, showFullscreen ? 90 : 226, 24), paused ? "ESC Resume" : "R Retry shift", tag, MutedInk);
|
||||
Label(new Rect(left, card.yMax - 38, showFullscreen ? 90 : 226, 24), paused ? "ESC Resume" : "R Replay", tag, MutedInk);
|
||||
if (showFullscreen)
|
||||
DrawFullscreenButton(game, new Rect(left + 94, card.yMax - 39, 154, 25));
|
||||
DrawSoundButton(game, new Rect(card.xMax - 151, card.yMax - 39, 125, 25));
|
||||
@@ -549,14 +767,16 @@ namespace DomeShift
|
||||
game.ToggleFullscreen();
|
||||
}
|
||||
|
||||
private bool ActionButton(Rect rect, string text, string binding)
|
||||
private bool ActionButton(Rect rect, string text, string binding, bool enabled = true)
|
||||
{
|
||||
bool hovered = rect.Contains(Event.current.mousePosition);
|
||||
Fill(new Rect(rect.x, rect.y + 3, rect.width, rect.height), Shadow);
|
||||
Fill(rect, hovered ? Ink : Mint);
|
||||
Label(new Rect(rect.x + 16, rect.y, rect.width - 102, rect.height), text, item, Panel);
|
||||
DrawKey(new Rect(rect.xMax - 76, rect.y + 12, 63, rect.height - 24), binding, Panel, Inset, Ink);
|
||||
return GUI.Button(rect, GUIContent.none, GUIStyle.none);
|
||||
Fill(rect, enabled ? hovered ? Ink : Mint : Inset);
|
||||
float reservedWidth = binding == null ? 32 : 102;
|
||||
Label(new Rect(rect.x + 16, rect.y, rect.width - reservedWidth, rect.height), text, item, enabled ? Panel : MutedInk);
|
||||
if (binding != null)
|
||||
DrawKey(new Rect(rect.xMax - 76, rect.y + 12, 63, rect.height - 24), binding, Panel, Inset, Ink);
|
||||
return enabled && GUI.Button(rect, GUIContent.none, GUIStyle.none);
|
||||
}
|
||||
|
||||
private bool SecondaryButton(Rect rect, string text, string binding, float bindingWidth = 24)
|
||||
@@ -564,7 +784,7 @@ namespace DomeShift
|
||||
bool hovered = rect.Contains(Event.current.mousePosition);
|
||||
Fill(rect, hovered ? Border : Inset);
|
||||
Stroke(rect, Border);
|
||||
Label(new Rect(rect.x + 16, rect.y, rect.width - bindingWidth - 44, rect.height), text, item, Ink);
|
||||
Label(new Rect(rect.x + 16, rect.y, rect.width - bindingWidth - 39, rect.height), text, item, Ink);
|
||||
DrawKey(new Rect(rect.xMax - bindingWidth - 13, rect.center.y - 12, bindingWidth, 24), binding, Inset, Border, Ink);
|
||||
return GUI.Button(rect, GUIContent.none, GUIStyle.none);
|
||||
}
|
||||
@@ -579,12 +799,6 @@ namespace DomeShift
|
||||
return GUI.Button(rect, GUIContent.none, GUIStyle.none);
|
||||
}
|
||||
|
||||
private void DrawBinding(float x, float y, float keyWidth, string binding, string action)
|
||||
{
|
||||
DrawKey(new Rect(x, y, keyWidth, 24), binding, Inset, Border, Ink);
|
||||
Label(new Rect(x + keyWidth + 8, y, 72, 24), action, fine, MutedInk);
|
||||
}
|
||||
|
||||
private void DrawKey(Rect rect, string text, Color background, Color edge, Color ink)
|
||||
{
|
||||
Fill(rect, background);
|
||||
|
||||
Reference in New Issue
Block a user