Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tree-o
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hall of Fame
Tree-o
Commits
75bc4af9
Commit
75bc4af9
authored
2 years ago
by
Horváth István
Committed by
Isti0105
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Keep the tower placing and unit deployment UI state after resuming the game
parent
2e84aad5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!93
Keep the tower placing and unit deployment UI state after resuming the game (closes #103)
Pipeline
#25829
passed
2 years ago
Stage: prepare
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/Presentation/UI/SimulationUI.cs
+19
-13
19 additions, 13 deletions
Assets/Scripts/Presentation/UI/SimulationUI.cs
with
19 additions
and
13 deletions
Assets/Scripts/Presentation/UI/SimulationUI.cs
+
19
−
13
View file @
75bc4af9
...
...
@@ -232,23 +232,26 @@ public class SimulationUI : MonoBehaviour {
Debug
.
Log
(
"Failed to deploy unit"
);
// TODO maybe show this on the UI
}
private
void
StartTowerPlacing
(
Logic
.
Data
.
Color
player
)
{
private
void
StartTowerPlacing
(
Logic
.
Data
.
Color
player
,
bool
resetUI
)
{
_activePlayer
=
player
;
GameTeam
playerData
=
GameOverview
.
GetTeam
(
_activePlayer
);
_selectedTowerType
=
null
;
_towerPlacing
.
ResetUI
();
if
(
resetUI
)
{
_towerPlacing
.
ResetUI
();
_towerPlacing
.
SetActivePlayer
(
_activePlayer
);
_towerPlacing
.
SetPlayerMoney
(
playerData
.
TeamColor
,
playerData
.
Money
);
}
_towerPlacing
.
Show
();
_towerPlacing
.
SetActivePlayer
(
_activePlayer
);
_towerPlacing
.
SetPlayerMoney
(
playerData
.
TeamColor
,
playerData
.
Money
);
}
private
void
StepTowerPlacing
()
{
if
(
_activePlayer
==
Logic
.
Data
.
Color
.
Blue
)
{
OnTowerSelected
?.
Invoke
(
null
);
OnBuildingPossibleChanges
?.
Invoke
(
null
);
StartTowerPlacing
(
Logic
.
Data
.
Color
.
Red
);
StartTowerPlacing
(
Logic
.
Data
.
Color
.
Red
,
true
);
}
else
{
OnTowerSelected
?.
Invoke
(
null
);
OnBuildingPossibleChanges
?.
Invoke
(
null
);
...
...
@@ -302,7 +305,7 @@ public class SimulationUI : MonoBehaviour {
OnBarrackSelected
?.
Invoke
(
null
);
_selectedBarrack
=
null
;
if
(
_activePlayer
==
Logic
.
Data
.
Color
.
Blue
)
{
StartUnitDeployment
(
Logic
.
Data
.
Color
.
Red
);
StartUnitDeployment
(
Logic
.
Data
.
Color
.
Red
,
true
);
}
else
{
UpdateUiState
(
UIState
.
Battle
);
if
(
GameOverview
.
CurrentPhase
==
GamePhase
.
Prepare
...
...
@@ -311,14 +314,17 @@ public class SimulationUI : MonoBehaviour {
}
}
private
void
StartUnitDeployment
(
Logic
.
Data
.
Color
player
)
{
private
void
StartUnitDeployment
(
Logic
.
Data
.
Color
player
,
bool
resetUI
)
{
_activePlayer
=
player
;
GameTeam
playerData
=
GameOverview
.
GetTeam
(
_activePlayer
);
if
(
resetUI
)
{
_unitDeployment
.
SetActivePlayer
(
_activePlayer
);
_unitDeployment
.
SetPlayerMoney
(
player
,
playerData
.
Money
);
_unitDeployment
.
UpdateUnitStatistics
(
GameOverview
.
GetTeam
(
_activePlayer
));
}
_unitDeployment
.
Show
();
_unitDeployment
.
SetActivePlayer
(
_activePlayer
);
_unitDeployment
.
SetPlayerMoney
(
player
,
playerData
.
Money
);
_unitDeployment
.
UpdateUnitStatistics
(
GameOverview
.
GetTeam
(
_activePlayer
));
}
private
void
StartBattle
()
{
...
...
@@ -341,18 +347,18 @@ public class SimulationUI : MonoBehaviour {
}
private
void
UpdateUiState
(
UIState
uiState
)
{
Debug
.
Log
(
$"Updated UI state to:
{
uiState
}
"
)
;
bool
returnedFromPause
=
_uiState
==
UIState
.
Paused
;
if
(
_uiState
!=
uiState
)
_lastUiState
=
_uiState
;
_uiState
=
uiState
;
switch
(
_uiState
)
{
case
UIState
.
TowerPlacing
:
HideUIs
();
StartTowerPlacing
(
Logic
.
Data
.
Color
.
Blue
);
StartTowerPlacing
(
Logic
.
Data
.
Color
.
Blue
,
!
returnedFromPause
);
break
;
case
UIState
.
UnitDeployment
:
HideUIs
();
StartUnitDeployment
(
Logic
.
Data
.
Color
.
Blue
);
StartUnitDeployment
(
Logic
.
Data
.
Color
.
Blue
,
!
returnedFromPause
);
break
;
case
UIState
.
Battle
:
HideUIs
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment