Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
L
ldefense
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gavin An
ldefense
Commits
1e5019bd
Commit
1e5019bd
authored
Jul 28, 2026
by
Gavin An
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
작업중
parent
312e1e41
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
152 additions
and
20 deletions
+152
-20
assets/icon/context_move.png
assets/icon/context_move.png
+0
-0
assets/icon/context_move.png.import
assets/icon/context_move.png.import
+41
-0
assets/icon/context_sell.png
assets/icon/context_sell.png
+0
-0
assets/icon/context_sell.png.import
assets/icon/context_sell.png.import
+41
-0
assets/icon/context_upgrade.png
assets/icon/context_upgrade.png
+0
-0
assets/icon/context_upgrade.png.import
assets/icon/context_upgrade.png.import
+41
-0
src/core/unit_controller.gd
src/core/unit_controller.gd
+29
-20
No files found.
assets/icon/context_move.png
0 → 100644
View file @
1e5019bd
1.98 MB
assets/icon/context_move.png.import
0 → 100644
View file @
1e5019bd
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dupda8icq8yat"
path="res://.godot/imported/context_move.png-ebcafe41bbb446e50e232d09f143c108.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icon/context_move.png"
dest_files=["res://.godot/imported/context_move.png-ebcafe41bbb446e50e232d09f143c108.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/high_quality_mode=0
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
assets/icon/context_sell.png
0 → 100644
View file @
1e5019bd
1.95 MB
assets/icon/context_sell.png.import
0 → 100644
View file @
1e5019bd
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d1gfhp7nfvahr"
path="res://.godot/imported/context_sell.png-870a58eeb81393caca60a9b9e1ebb419.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icon/context_sell.png"
dest_files=["res://.godot/imported/context_sell.png-870a58eeb81393caca60a9b9e1ebb419.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/high_quality_mode=0
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
assets/icon/context_upgrade.png
0 → 100644
View file @
1e5019bd
1.94 MB
assets/icon/context_upgrade.png.import
0 → 100644
View file @
1e5019bd
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpugwp5yn0ofe"
path="res://.godot/imported/context_upgrade.png-d91aef7febf86ebafd62f12fcab2b34e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icon/context_upgrade.png"
dest_files=["res://.godot/imported/context_upgrade.png-d91aef7febf86ebafd62f12fcab2b34e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/high_quality_mode=0
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
src/core/unit_controller.gd
View file @
1e5019bd
...
@@ -4,10 +4,13 @@ extends Control
...
@@ -4,10 +4,13 @@ extends Control
## 화면 전체를 덮는 Control 노드로 작동하여 마우스 입력과 선택 유닛 액션 버튼을 처리합니다.
## 화면 전체를 덮는 Control 노드로 작동하여 마우스 입력과 선택 유닛 액션 버튼을 처리합니다.
const
HudUnitPlacementScript
:
GDScript
=
preload
(
"res://src/ui/unit_placement/hud_unit_placement.gd"
)
const
HudUnitPlacementScript
:
GDScript
=
preload
(
"res://src/ui/unit_placement/hud_unit_placement.gd"
)
const
CONTEXT_SELL_ICON
:
Texture2D
=
preload
(
"res://assets/icon/context_sell.png"
)
const
CONTEXT_MOVE_ICON
:
Texture2D
=
preload
(
"res://assets/icon/context_move.png"
)
const
CONTEXT_UPGRADE_ICON
:
Texture2D
=
preload
(
"res://assets/icon/context_upgrade.png"
)
const
UNIT_SELECTION_SCREEN_RADIUS
:
float
=
54.0
const
UNIT_SELECTION_SCREEN_RADIUS
:
float
=
54.0
const
UNIT_ACTION_BUTTON_SIZE
:
Vector2
=
Vector2
(
86.0
,
34
.0
)
const
UNIT_ACTION_BUTTON_SIZE
:
Vector2
=
Vector2
(
40.0
,
40
.0
)
const
UNIT_ACTION_BUTTON_GAP
:
float
=
8.0
const
UNIT_ACTION_BUTTON_GAP
:
float
=
8.0
const
UNIT_ACTION_BUTTON_
WORLD_HEIGHT
:
float
=
1.55
const
UNIT_ACTION_BUTTON_
SCREEN_Y_OFFSET
:
float
=
28.0
const
UNIT_SELL_REFUND_RATIO
:
float
=
0.5
const
UNIT_SELL_REFUND_RATIO
:
float
=
0.5
const
UNIT_UPGRADE_COST
:
int
=
75
const
UNIT_UPGRADE_COST
:
int
=
75
...
@@ -257,6 +260,7 @@ func _perform_hold_position() -> void:
...
@@ -257,6 +260,7 @@ func _perform_hold_position() -> void:
## 선택된 유닛 주변에 표시할 3개 액션 버튼을 생성합니다.
## 선택된 유닛 주변에 표시할 3개 액션 버튼을 생성합니다.
## 버튼은 UnitController 자식 Control로 두어 매 프레임 선택 유닛의 월드 위치를 화면 좌표로 투영해 따라다니게 합니다.
## 버튼은 UnitController 자식 Control로 두어 매 프레임 선택 유닛의 월드 위치를 화면 좌표로 투영해 따라다니게 합니다.
## 버튼 세 개는 HBoxContainer 안에 나란히 배치하고, 컨테이너 전체를 유닛 화면 위치 아래에 가운데 정렬합니다.
func
_create_unit_action_buttons
()
->
void
:
func
_create_unit_action_buttons
()
->
void
:
_action_button_container
=
HBoxContainer
.
new
()
_action_button_container
=
HBoxContainer
.
new
()
_action_button_container
.
name
=
"SelectedUnitActionButtons"
_action_button_container
.
name
=
"SelectedUnitActionButtons"
...
@@ -265,24 +269,29 @@ func _create_unit_action_buttons() -> void:
...
@@ -265,24 +269,29 @@ func _create_unit_action_buttons() -> void:
_action_button_container
.
add_theme_constant_override
(
"separation"
,
int
(
UNIT_ACTION_BUTTON_GAP
))
_action_button_container
.
add_theme_constant_override
(
"separation"
,
int
(
UNIT_ACTION_BUTTON_GAP
))
add_child
(
_action_button_container
)
add_child
(
_action_button_container
)
_sell_button
=
_create_unit_action_button
(
"SellUnitButton"
,
"팔기"
,
Color
(
0.48
,
0.08
,
0.08
,
0.94
),
Color
(
1.0
,
0.32
,
0.22
,
0.86
))
_sell_button
=
_create_unit_action_button
(
"SellUnitButton"
,
CONTEXT_SELL_ICON
,
"팔기"
,
Color
(
0.48
,
0.08
,
0.08
,
0.94
),
Color
(
1.0
,
0.32
,
0.22
,
0.86
))
_move_button
=
_create_unit_action_button
(
"MoveUnitButton"
,
"이동"
,
Color
(
0.08
,
0.22
,
0.42
,
0.94
),
Color
(
0.35
,
0.72
,
1.0
,
0.86
))
_move_button
=
_create_unit_action_button
(
"MoveUnitButton"
,
CONTEXT_MOVE_ICON
,
"이동"
,
Color
(
0.08
,
0.22
,
0.42
,
0.94
),
Color
(
0.35
,
0.72
,
1.0
,
0.86
))
_upgrade_button
=
_create_unit_action_button
(
"UpgradeUnitButton"
,
"업그레이드"
,
Color
(
0.18
,
0.20
,
0.08
,
0.94
),
Color
(
1.0
,
0.82
,
0.24
,
0.86
))
_upgrade_button
=
_create_unit_action_button
(
"UpgradeUnitButton"
,
CONTEXT_UPGRADE_ICON
,
"업그레이드"
,
Color
(
0.18
,
0.20
,
0.08
,
0.94
),
Color
(
1.0
,
0.82
,
0.24
,
0.86
))
_sell_button
.
pressed
.
connect
(
_on_sell_selected_unit_pressed
)
_sell_button
.
pressed
.
connect
(
_on_sell_selected_unit_pressed
)
_move_button
.
pressed
.
connect
(
_on_move_selected_unit_pressed
)
_move_button
.
pressed
.
connect
(
_on_move_selected_unit_pressed
)
_upgrade_button
.
pressed
.
connect
(
_on_upgrade_selected_unit_pressed
)
_upgrade_button
.
pressed
.
connect
(
_on_upgrade_selected_unit_pressed
)
## 유닛 액션 버튼 하나를 생성합니다.
## 유닛 액션 버튼 하나를 생성합니다.
##
HUD 버튼처럼 보이되 월드 선택 메뉴로 읽히도록 크기를 작게 고정하고, 입력은 반드시 버튼이 먼저 소비하게 합
니다.
##
텍스트 대신 아이콘을 중심에 두어 전투 화면에서 빠르게 구분되게 하고, tooltip으로만 기능명을 남깁
니다.
func
_create_unit_action_button
(
button_name
:
String
,
button_text
:
String
,
bg_color
:
Color
,
border_color
:
Color
)
->
Button
:
func
_create_unit_action_button
(
button_name
:
String
,
button_
icon
:
Texture2D
,
tooltip_
text
:
String
,
bg_color
:
Color
,
border_color
:
Color
)
->
Button
:
var
button
:
Button
=
Button
.
new
()
var
button
:
Button
=
Button
.
new
()
button
.
name
=
button_name
button
.
name
=
button_name
button
.
text
=
button_text
button
.
text
=
""
button
.
tooltip_text
=
tooltip_text
button
.
icon
=
button_icon
button
.
expand_icon
=
true
button
.
icon_alignment
=
HORIZONTAL_ALIGNMENT_CENTER
button
.
vertical_icon_alignment
=
VERTICAL_ALIGNMENT_CENTER
button
.
custom_minimum_size
=
UNIT_ACTION_BUTTON_SIZE
button
.
custom_minimum_size
=
UNIT_ACTION_BUTTON_SIZE
button
.
size
=
UNIT_ACTION_BUTTON_SIZE
button
.
mouse_filter
=
Control
.
MOUSE_FILTER_STOP
button
.
mouse_filter
=
Control
.
MOUSE_FILTER_STOP
button
.
focus_mode
=
Control
.
FOCUS_NONE
button
.
focus_mode
=
Control
.
FOCUS_NONE
button
.
add_theme_font_size_override
(
"font_size"
,
13
)
button
.
add_theme_stylebox_override
(
"normal"
,
_create_action_button_style
(
bg_color
,
border_color
))
button
.
add_theme_stylebox_override
(
"normal"
,
_create_action_button_style
(
bg_color
,
border_color
))
button
.
add_theme_stylebox_override
(
"hover"
,
_create_action_button_style
(
bg_color
.
lightened
(
0.10
),
border_color
.
lightened
(
0.12
)))
button
.
add_theme_stylebox_override
(
"hover"
,
_create_action_button_style
(
bg_color
.
lightened
(
0.10
),
border_color
.
lightened
(
0.12
)))
button
.
add_theme_stylebox_override
(
"pressed"
,
_create_action_button_style
(
bg_color
.
darkened
(
0.08
),
border_color
))
button
.
add_theme_stylebox_override
(
"pressed"
,
_create_action_button_style
(
bg_color
.
darkened
(
0.08
),
border_color
))
...
@@ -290,7 +299,7 @@ func _create_unit_action_button(button_name: String, button_text: String, bg_col
...
@@ -290,7 +299,7 @@ func _create_unit_action_button(button_name: String, button_text: String, bg_col
return
button
return
button
## 선택 액션 버튼의 공통 카드형 배경을 생성합니다.
## 선택 액션 버튼의 공통 카드형 배경을 생성합니다.
##
둥근 정도는 과하지 않게 두어 기존 HUD와 어울리게 하고, 테두리 색으로 버튼 성격을 구분합
니다.
##
세 버튼이 나란히 보일 때 서로 구분되도록, 버튼 성격마다 배경색과 테두리 색을 다르게 둡
니다.
func
_create_action_button_style
(
bg_color
:
Color
,
border_color
:
Color
)
->
StyleBoxFlat
:
func
_create_action_button_style
(
bg_color
:
Color
,
border_color
:
Color
)
->
StyleBoxFlat
:
var
style
:
StyleBoxFlat
=
StyleBoxFlat
.
new
()
var
style
:
StyleBoxFlat
=
StyleBoxFlat
.
new
()
style
.
bg_color
=
bg_color
style
.
bg_color
=
bg_color
...
@@ -299,14 +308,14 @@ func _create_action_button_style(bg_color: Color, border_color: Color) -> StyleB
...
@@ -299,14 +308,14 @@ func _create_action_button_style(bg_color: Color, border_color: Color) -> StyleB
style
.
border_width_top
=
1
style
.
border_width_top
=
1
style
.
border_width_right
=
1
style
.
border_width_right
=
1
style
.
border_width_bottom
=
1
style
.
border_width_bottom
=
1
style
.
corner_radius_top_left
=
6
style
.
corner_radius_top_left
=
24
style
.
corner_radius_top_right
=
6
style
.
corner_radius_top_right
=
24
style
.
corner_radius_bottom_left
=
6
style
.
corner_radius_bottom_left
=
24
style
.
corner_radius_bottom_right
=
6
style
.
corner_radius_bottom_right
=
24
style
.
content_margin_left
=
8
.0
style
.
content_margin_left
=
2
.0
style
.
content_margin_right
=
8
.0
style
.
content_margin_right
=
2
.0
style
.
content_margin_top
=
4
.0
style
.
content_margin_top
=
2
.0
style
.
content_margin_bottom
=
4
.0
style
.
content_margin_bottom
=
2
.0
return
style
return
style
## 선택 유닛이 살아 있다면 액션 버튼을 표시합니다.
## 선택 유닛이 살아 있다면 액션 버튼을 표시합니다.
...
@@ -334,7 +343,7 @@ func _update_unit_action_buttons_position() -> void:
...
@@ -334,7 +343,7 @@ func _update_unit_action_buttons_position() -> void:
_hide_unit_action_buttons
()
_hide_unit_action_buttons
()
return
return
var
anchor_world_position
:
Vector3
=
_selected_unit
.
global_position
+
Vector3
(
0.0
,
UNIT_ACTION_BUTTON_WORLD_HEIGHT
,
0.0
)
var
anchor_world_position
:
Vector3
=
_selected_unit
.
global_position
if
camera
.
is_position_behind
(
anchor_world_position
):
if
camera
.
is_position_behind
(
anchor_world_position
):
_action_button_container
.
visible
=
false
_action_button_container
.
visible
=
false
return
return
...
@@ -342,7 +351,7 @@ func _update_unit_action_buttons_position() -> void:
...
@@ -342,7 +351,7 @@ func _update_unit_action_buttons_position() -> void:
var
screen_position
:
Vector2
=
camera
.
unproject_position
(
anchor_world_position
)
var
screen_position
:
Vector2
=
camera
.
unproject_position
(
anchor_world_position
)
var
container_size
:
Vector2
=
_action_button_container
.
get_combined_minimum_size
()
var
container_size
:
Vector2
=
_action_button_container
.
get_combined_minimum_size
()
_action_button_container
.
size
=
container_size
_action_button_container
.
size
=
container_size
_action_button_container
.
position
=
screen_position
-
Vector2
(
container_size
.
x
*
0.5
,
container_size
.
y
+
10.0
)
_action_button_container
.
position
=
screen_position
-
Vector2
(
container_size
.
x
*
0.5
,
0.0
)
+
Vector2
(
0.0
,
UNIT_ACTION_BUTTON_SCREEN_Y_OFFSET
)
## 팔기 버튼 처리입니다.
## 팔기 버튼 처리입니다.
## 아직 개별 유닛 구매가를 저장하지 않으므로, 현재 기본 소환 비용의 50%를 환불 기준으로 사용합니다.
## 아직 개별 유닛 구매가를 저장하지 않으므로, 현재 기본 소환 비용의 50%를 환불 기준으로 사용합니다.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment