66 lines
1.2 KiB
Plaintext
66 lines
1.2 KiB
Plaintext
note
|
|
description: "[
|
|
A widget connecting interface to a {SUBMARINE} for use in VITP.
|
|
]"
|
|
author: "Jimmy J. Johnson"
|
|
|
|
class
|
|
SUBMARINE_WIDGET
|
|
|
|
inherit
|
|
|
|
ATTACK_UNIT_WIDGET
|
|
rename
|
|
unit as submarine
|
|
redefine
|
|
position_widgets,
|
|
unit_color,
|
|
paint,
|
|
target_imp
|
|
end
|
|
|
|
create
|
|
make
|
|
|
|
feature {NONE} -- Initialization
|
|
|
|
position_widgets
|
|
-- Move Current and contained widgets to correct
|
|
-- location and set their sizes
|
|
do
|
|
Precursor {ATTACK_UNIT_WIDGET}
|
|
picture.scale (0.1)
|
|
end
|
|
|
|
feature -- Basic operations
|
|
|
|
paint
|
|
-- Set the colors for the `tile'
|
|
do
|
|
Precursor {ATTACK_UNIT_WIDGET}
|
|
bonus_circle.set_foreground_color (japanese_unit_color)
|
|
bonus_circle.set_background_color (japanese_unit_color)
|
|
end
|
|
|
|
feature {NONE} -- Implementation
|
|
|
|
unit_color: EV_COLOR
|
|
-- Get the color to paint the tile based on the unit's nationality
|
|
do
|
|
if submarine.nationality = {NATIONALITY_CONSTANTS}.Japanese then
|
|
Result := Japanese_submarine_color
|
|
elseif submarine.nationality = {NATIONALITY_CONSTANTS}.us then
|
|
Result := US_submarine_color
|
|
else
|
|
check
|
|
should_not_happen: False
|
|
end
|
|
Result := Green
|
|
end
|
|
end
|
|
|
|
target_imp: detachable SUBMARINE
|
|
-- Anchor for the `target' represented by Current
|
|
|
|
end
|