Merge tree2 UI improvements with equipment and safe case integration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -41,6 +42,7 @@ namespace Ironspore
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SettingsService Settings { get; private set; }
|
||||
public readonly List<string> SelectedCargo = new List<string>();
|
||||
public bool MenuOpen { get; private set; } = true;
|
||||
public bool Paused
|
||||
@@ -79,6 +81,8 @@ namespace Ironspore
|
||||
mainStore = new ProfileStore(ProfileStore.SavePath(false));
|
||||
Store = mainStore;
|
||||
Input = Instantiate(inputTemplate);
|
||||
var defaults = SettingsService.RuntimeDefaults();
|
||||
Settings = new SettingsService(new SettingsStore(Path.Combine(GameDataPaths.DirectoryPath, "settings.json"), defaults), Input, defaults);
|
||||
Input.Enable();
|
||||
World = gameObject.AddComponent<WarzoneDirector>();
|
||||
Hud = gameObject.AddComponent<GameHud>();
|
||||
@@ -182,7 +186,10 @@ namespace Ironspore
|
||||
Pilot = World.Player;
|
||||
SetMenu(false);
|
||||
Hud.ShowField();
|
||||
Notify(Trial ? "notice.range" : "notice.enter");
|
||||
if (Trial)
|
||||
Notify("notice.range", Settings.Bindings.Display("View"), Settings.Bindings.Display("Interact"));
|
||||
else
|
||||
Notify("notice.enter");
|
||||
}
|
||||
public void SetMenu(bool open)
|
||||
{
|
||||
@@ -229,6 +236,8 @@ namespace Ironspore
|
||||
EndSortie(true);
|
||||
return;
|
||||
}
|
||||
if (Hud && (Hud.SettingsOpen || Hud.MenuInputConsumedThisFrame))
|
||||
return;
|
||||
if (Action("Pause").WasPressedThisFrame())
|
||||
{
|
||||
if (MenuOpen)
|
||||
@@ -442,6 +451,11 @@ namespace Ironspore
|
||||
}
|
||||
void OnApplicationFocus(bool focus)
|
||||
{
|
||||
if (!focus && Hud && Hud.SettingsOpen)
|
||||
{
|
||||
Hud.CancelSettingsInput();
|
||||
return;
|
||||
}
|
||||
if (!focus && InField && Hud)
|
||||
{
|
||||
Paused = true;
|
||||
@@ -460,6 +474,7 @@ namespace Ironspore
|
||||
}
|
||||
void OnDestroy()
|
||||
{
|
||||
Settings?.Dispose();
|
||||
if (Input)
|
||||
Destroy(Input);
|
||||
Time.timeScale = 1;
|
||||
|
||||
@@ -21,6 +21,13 @@ namespace Ironspore
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
Transform relay, onwardGate, terminalTarget;
|
||||
public Transform NavigationTarget => game.Run.routeCompleted ? null :
|
||||
!game.Trial && game.Run.stage == 4 ? terminalTarget :
|
||||
game.Run.objectiveDone ? onwardGate : relay;
|
||||
public Vector3 ExtractionPosition => extractionPosition;
|
||||
readonly System.Collections.Generic.List<Rect> cover = new System.Collections.Generic.List<Rect>();
|
||||
public System.Collections.Generic.IReadOnlyList<Rect> Cover => cover;
|
||||
Transform root;
|
||||
GameSession game;
|
||||
Vector3 extractionPosition = new Vector3(-19, 0, -8);
|
||||
@@ -39,6 +46,8 @@ namespace Ironspore
|
||||
TransportReady = false;
|
||||
Focused = null;
|
||||
Escort = null;
|
||||
relay = onwardGate = terminalTarget = null;
|
||||
cover.Clear();
|
||||
RenderSettings.ambientLight = new Color(.27f, .34f, .38f);
|
||||
RenderSettings.fog = true;
|
||||
RenderSettings.fogColor = new Color(.09f, .14f, .18f);
|
||||
@@ -100,6 +109,7 @@ namespace Ironspore
|
||||
{
|
||||
float x = (i % 2 == 0 ? -1 : 1) * (8 + (i % 3) * 5);
|
||||
float z = -10 + i * 6;
|
||||
cover.Add(new Rect(x - 2.75f, z - 1.5f, 5.5f, 3));
|
||||
var color = i % 2 == 0 ? new Color(.22f, .34f, .37f) : new Color(.45f, .26f, .15f);
|
||||
WorldFactory.Box("FreightContainer", new Vector3(x, 1.1f, z), new Vector3(5.5f, 2.2f, 3), color, root);
|
||||
for (int rib = 0; rib < 5; rib++)
|
||||
@@ -129,10 +139,12 @@ namespace Ironspore
|
||||
}
|
||||
var objective = WorldFactory.Box("NavigationRelay", new Vector3(0, 1.5f, 23), new Vector3(2.2f, 3, 1.6f), new Color(.21f, .33f, .36f), root);
|
||||
WorldFactory.Box("RelayScreen", new Vector3(0, 2.4f, 22.14f), new Vector3(1.5f, .65f, .1f), new Color(.1f, .9f, .83f), root, false, true);
|
||||
relay = objective.transform;
|
||||
var objectiveAction = objective.AddComponent<WorldInteractable>();
|
||||
objectiveAction.kind = 1;
|
||||
objectiveAction.RefreshLabel();
|
||||
var onward = WorldFactory.Cylinder("OnwardGate", new Vector3(0, .05f, 36), new Vector3(7, .1f, 7), new Color(.3f, .6f, .65f), root, false);
|
||||
onwardGate = onward.transform;
|
||||
var onwardAction = onward.AddComponent<WorldInteractable>();
|
||||
onwardAction.kind = 2;
|
||||
onwardAction.RefreshLabel();
|
||||
@@ -158,6 +170,7 @@ namespace Ironspore
|
||||
if (run.branch == 1 && !run.routeCompleted)
|
||||
{
|
||||
var cart = WorldFactory.Box("EscortEngineer", new Vector3(0, 1.3f, 0), new Vector3(3, 2.6f, 4), new Color(.2f, .55f, .5f), root);
|
||||
terminalTarget = cart.transform;
|
||||
Escort = cart.AddComponent<EscortUnit>();
|
||||
Escort.Initialize(game);
|
||||
}
|
||||
@@ -169,6 +182,8 @@ namespace Ironspore
|
||||
obj.transform.SetParent(root);
|
||||
obj.transform.position = pos;
|
||||
obj.layer = 9;
|
||||
if (type == 3)
|
||||
terminalTarget = obj.transform;
|
||||
obj.AddComponent<EnemyUnit>().Initialize(game, type, game.mechModel, root);
|
||||
}
|
||||
public void CallExtraction()
|
||||
@@ -199,7 +214,7 @@ namespace Ironspore
|
||||
TransportReady = true;
|
||||
transport = WorldFactory.Box("RecoveryTransport", extractionPosition + new Vector3(0, 5.5f, 0), new Vector3(7, 1.8f, 10), new Color(.24f, .3f, .32f), root, false);
|
||||
WorldFactory.Box("TransportWing", transport.transform.position, new Vector3(14, .5f, 3), new Color(.32f, .4f, .41f), root, false);
|
||||
game.Notify("notice.transportReady");
|
||||
game.Notify("notice.transportReady", game.Settings.Bindings.Display("Interact"));
|
||||
GameAudio.Cue(950, .3f);
|
||||
}
|
||||
}
|
||||
@@ -236,13 +251,14 @@ namespace Ironspore
|
||||
get
|
||||
{
|
||||
var g = GameSession.Active;
|
||||
string interact = g.Settings.Bindings.Display("Interact");
|
||||
if (kind == 0)
|
||||
return GameLocalization.Text("prompt.search");
|
||||
return GameLocalization.Text("prompt.search", interact);
|
||||
if (kind == 1)
|
||||
return GameLocalization.Text(g.Run.objectiveDone ? "prompt.relayOnline" : "prompt.objective");
|
||||
return GameLocalization.Text(g.Run.objectiveDone ? "prompt.relayOnline" : "prompt.objective", interact);
|
||||
if (kind == 2)
|
||||
return GameLocalization.Text(g.Run.objectiveDone ? "prompt.route" : "prompt.routeLocked");
|
||||
return GameLocalization.Text(g.World.TransportReady ? "prompt.board" : g.World.ExtractionRemaining >= 0 ? "prompt.inbound" : "prompt.call");
|
||||
return GameLocalization.Text(g.Run.objectiveDone ? "prompt.route" : "prompt.routeLocked", interact);
|
||||
return GameLocalization.Text(g.World.TransportReady ? "prompt.board" : g.World.ExtractionRemaining >= 0 ? "prompt.inbound" : "prompt.call", interact);
|
||||
}
|
||||
}
|
||||
public void RefreshLabel()
|
||||
|
||||
Reference in New Issue
Block a user