improve draw & battle display
This commit is contained in:
parent
93aae78f0d
commit
a9cd4c9e27
19 changed files with 281 additions and 150 deletions
|
|
@ -95,3 +95,6 @@ class BattleDTO:
|
|||
score: str | None
|
||||
victory_condition: str | None
|
||||
comment: str | None
|
||||
state_icon: str | None
|
||||
player1_icon: str | None
|
||||
player2_icon: str | None
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ if TYPE_CHECKING:
|
|||
from warchron.controller.app_controller import AppController
|
||||
from warchron.controller.dtos import ParticipantOption, SectorDTO, ChoiceDTO, BattleDTO
|
||||
from warchron.model.closure_service import ClosureService
|
||||
from warchron.view.choices_dialog import ChoicesDialog
|
||||
from warchron.view.battles_dialog import BattlesDialog
|
||||
from warchron.view.choice_dialog import ChoiceDialog
|
||||
from warchron.view.battle_dialog import BattleDialog
|
||||
|
||||
|
||||
class RoundController:
|
||||
|
|
@ -54,10 +54,14 @@ class RoundController:
|
|||
battles_for_display: List[BattleDTO] = []
|
||||
for sect in sectors:
|
||||
battle = rnd.get_battle(sect.id)
|
||||
|
||||
if not battle:
|
||||
battle = self.app.model.create_battle(
|
||||
round_id=rnd.id, sector_id=sect.id
|
||||
)
|
||||
state_icon = ".\\src\\warchron\\view\\ui\\../resources/hourglass.png"
|
||||
if battle.is_finished():
|
||||
state_icon = ".\\src\\warchron\\view\\ui\\../resources/tick.png"
|
||||
if battle.player_1_id:
|
||||
camp_part = camp.participants[battle.player_1_id]
|
||||
player_1_name = self.app.model.get_participant_name(
|
||||
|
|
@ -79,6 +83,16 @@ class RoundController:
|
|||
)
|
||||
else:
|
||||
winner_name = ""
|
||||
p1_icon = None
|
||||
p2_icon = None
|
||||
if battle.is_draw():
|
||||
p1_icon = ".\\src\\warchron\\view\\ui\\../resources/balance.png"
|
||||
p2_icon = ".\\src\\warchron\\view\\ui\\../resources/balance.png"
|
||||
elif battle.winner_id:
|
||||
if battle.winner_id == battle.player_1_id:
|
||||
p1_icon = ".\\src\\warchron\\view\\ui\\../resources/trophy.png"
|
||||
elif battle.winner_id == battle.player_2_id:
|
||||
p2_icon = ".\\src\\warchron\\view\\ui\\../resources/trophy.png"
|
||||
battles_for_display.append(
|
||||
BattleDTO(
|
||||
id=battle.sector_id,
|
||||
|
|
@ -89,6 +103,9 @@ class RoundController:
|
|||
score=battle.score,
|
||||
victory_condition=battle.victory_condition,
|
||||
comment=battle.comment,
|
||||
state_icon=state_icon,
|
||||
player1_icon=p1_icon,
|
||||
player2_icon=p2_icon,
|
||||
)
|
||||
)
|
||||
self.app.view.display_round_battles(battles_for_display)
|
||||
|
|
@ -143,6 +160,8 @@ class RoundController:
|
|||
major=war.get_objective_name(sect.major_objective_id),
|
||||
minor=war.get_objective_name(sect.minor_objective_id),
|
||||
influence=war.get_objective_name(sect.influence_objective_id),
|
||||
mission=sect.mission,
|
||||
description=sect.description,
|
||||
)
|
||||
for sect in sectors
|
||||
]
|
||||
|
|
@ -152,7 +171,7 @@ class RoundController:
|
|||
participant = camp.participants[choice.participant_id]
|
||||
player = self.app.model.get_player_from_campaign_participant(participant)
|
||||
part_opt = ParticipantOption(id=participant.id, name=player.name)
|
||||
dialog = ChoicesDialog(
|
||||
dialog = ChoiceDialog(
|
||||
self.app.view,
|
||||
participants=[part_opt],
|
||||
default_participant_id=participant.id,
|
||||
|
|
@ -192,13 +211,15 @@ class RoundController:
|
|||
major=war.get_objective_name(sect.major_objective_id),
|
||||
minor=war.get_objective_name(sect.minor_objective_id),
|
||||
influence=war.get_objective_name(sect.influence_objective_id),
|
||||
mission=sect.mission,
|
||||
description=sect.description,
|
||||
)
|
||||
|
||||
part_opts: List[ParticipantOption] = []
|
||||
for participant in participants:
|
||||
player = self.app.model.get_player_from_campaign_participant(participant)
|
||||
part_opts.append(ParticipantOption(id=participant.id, name=player.name))
|
||||
dialog = BattlesDialog(
|
||||
dialog = BattleDialog(
|
||||
self.app.view,
|
||||
sectors=[sect_dto],
|
||||
default_sector_id=sect.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue