Cash Money
Player credits now tracked by game manager Buying items subtracts credits Right clicking on trade menu items allows player to buy multiple Inventory panel dropdown now allows instantiating saved loadouts
This commit is contained in:
parent
b4432b7aca
commit
48abee4847
9 changed files with 239 additions and 51 deletions
|
|
@ -19,7 +19,7 @@ public class ConfirmationDialog : PropertiesPanel
|
|||
private Action _onCancel;
|
||||
private Action _onConfirm;
|
||||
|
||||
private new void Start()
|
||||
private void Start()
|
||||
{
|
||||
Cancel.onClick.AddListener(() =>
|
||||
{
|
||||
|
|
@ -62,7 +62,7 @@ public class ConfirmationDialog : PropertiesPanel
|
|||
_onCancel = onCancel;
|
||||
Cancel.gameObject.SetActive(onCancel!=null);
|
||||
|
||||
ButtonGroup.SetActive(onConfirm!=null && onCancel!=null);
|
||||
ButtonGroup.SetActive(onConfirm!=null || onCancel!=null);
|
||||
|
||||
transform.position = Mouse.current.position.ReadValue();
|
||||
CancelClickCatcher.gameObject.SetActive(true);
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ public class ContextMenu : MonoBehaviour
|
|||
optionButton.Label.text = text;
|
||||
optionButton.Button.onClick.AddListener(() =>
|
||||
{
|
||||
action();
|
||||
if(Parent!=null)
|
||||
Parent.End();
|
||||
else
|
||||
End();
|
||||
action();
|
||||
});
|
||||
optionButton.Hover.OnEnter += data =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ using UniRx;
|
|||
using UniRx.Triggers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
using int2 = Unity.Mathematics.int2;
|
||||
|
||||
|
|
@ -125,12 +125,27 @@ public class InventoryPanel : MonoBehaviour
|
|||
if(GameManager.DockingBay!=null && _displayedCargo!=GameManager.DockingBay)
|
||||
ContextMenu.AddOption(GameManager.DockingBay.Name, () => Display(GameManager.DockingBay));
|
||||
|
||||
ContextMenu.AddOption("Create Preset",
|
||||
ContextMenu.AddOption("Save Loadout",
|
||||
() =>
|
||||
{
|
||||
GameManager.SavePreset(EntityPack.Pack(_displayedEntity));
|
||||
GameManager.SaveLoadout(EntityPack.Pack(_displayedEntity));
|
||||
});
|
||||
|
||||
if (GameManager.Loadouts.Any())
|
||||
{
|
||||
ContextMenu.AddDropdown("Restore Loadout",
|
||||
GameManager.Loadouts.Select<EntityPack, (string text, Action action, bool enabled)>(pack =>
|
||||
(
|
||||
$"{pack.Name} - {pack.Price(GameManager.ItemManager):n0}", () =>
|
||||
{
|
||||
var ship = EntityPack.Unpack(GameManager.ItemManager, GameManager.CurrentShip.Zone, pack, true);
|
||||
ship.SetParent(GameManager.CurrentShip.Parent);
|
||||
GameManager.PlayerShips.Add(ship);
|
||||
GameManager.Credits -= pack.Price(GameManager.ItemManager);
|
||||
}, pack.Price(GameManager.ItemManager) < GameManager.Credits
|
||||
)));
|
||||
}
|
||||
|
||||
ContextMenu.Show();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue