radial menu work
This commit is contained in:
@@ -11,26 +11,43 @@ public class CashierDesk : BaseInteractableObject
|
||||
private List<JobInfoSO> _jobsInfoList;
|
||||
private JobInfoSO _playerJob;
|
||||
|
||||
protected override void InteractAction()
|
||||
private bool CheckIfPlayerHaveItems()
|
||||
{
|
||||
if (_player.IsHoldContainerItem())
|
||||
{
|
||||
BuyItems();
|
||||
var playerContainer = _player.GetContainerItem();
|
||||
if (playerContainer.IsSalebleItems())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerJob = _jobsInfoList.Where(x => x.JobPosition == _player.JobPosition).FirstOrDefault();
|
||||
print($"playerJob is {_playerJob}");
|
||||
if (_playerJob != null)
|
||||
{
|
||||
UIManager.Instance.ShowTimeSliderDialog($"Work", $"Work as {_playerJob.Description}", OnCancel, OnConfirm);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print("You don't work here");
|
||||
}
|
||||
}
|
||||
protected override void PrepareMenuActions()
|
||||
{
|
||||
_playerJob = _jobsInfoList.Where(x => x.JobPosition == _player.JobPosition).FirstOrDefault();
|
||||
if (_playerJob != null)
|
||||
_menuActions[RadialMenuActions.Work].IsEnabled = true;
|
||||
|
||||
_menuActions[RadialMenuActions.Buy].IsEnabled = CheckIfPlayerHaveItems();
|
||||
|
||||
}
|
||||
|
||||
protected override void InteractAction(RadialMenuActions interactAction)
|
||||
{
|
||||
switch (interactAction)
|
||||
{
|
||||
case RadialMenuActions.Buy:
|
||||
BuyItems();
|
||||
break;
|
||||
case RadialMenuActions.Work:
|
||||
UIManager.Instance.ShowTimeSliderDialog($"Work", $"Work as {_playerJob.Description}", OnCancel, OnConfirm);
|
||||
break;
|
||||
default:
|
||||
print("unknown action");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void BuyItems()
|
||||
|
||||
Reference in New Issue
Block a user