83 lines
1.6 KiB
GDScript
83 lines
1.6 KiB
GDScript
#@tool
|
|
extends Node2D
|
|
|
|
## 面板背景色
|
|
@export var bgColor: Color = Color.DARK_GRAY:
|
|
get:
|
|
return bgColor
|
|
set(v):
|
|
bgColor = v
|
|
update()
|
|
## 装饰条颜色
|
|
@export var stripColor: Color = Color.DARK_GREEN:
|
|
get:
|
|
return stripColor
|
|
set(v):
|
|
stripColor = v
|
|
update()
|
|
## 是否显示线路信息
|
|
@export var lineInfoShow: bool = true:
|
|
get:
|
|
return lineInfoShow
|
|
set(v):
|
|
lineInfoShow = v
|
|
update()
|
|
## 线路信息背景色
|
|
@export var lineInfoBgColor: Color = Color.DARK_GREEN:
|
|
get:
|
|
return lineInfoBgColor
|
|
set(v):
|
|
lineInfoBgColor = v
|
|
update()
|
|
## 线路号
|
|
@export_range(1, 40) var lineNumber: int = 1:
|
|
get:
|
|
return lineNumber
|
|
set(v):
|
|
lineNumber = v
|
|
update()
|
|
## 车站名称
|
|
@export var stationName: String = "车站一":
|
|
get:
|
|
return stationName
|
|
set(v):
|
|
stationName = v
|
|
update()
|
|
## 车站英文/拼音名称
|
|
@export var stationEnName: String = "CHEZHANYI":
|
|
get:
|
|
return stationEnName
|
|
set(v):
|
|
stationEnName = v
|
|
update()
|
|
|
|
var isReady: bool = false
|
|
|
|
func update():
|
|
if not isReady:
|
|
return
|
|
# 更新背景色
|
|
$Bg["theme_override_styles/panel"].bg_color = bgColor
|
|
# 装饰条颜色
|
|
$Bg/Strip["theme_override_styles/panel"].bg_color = stripColor
|
|
$Bg/Strip2["theme_override_styles/panel"].bg_color = stripColor
|
|
# 控制线路显示
|
|
if lineInfoShow:
|
|
$LineInfo["theme_override_styles/panel"].bg_color = lineInfoBgColor
|
|
var lns = str(lineNumber)
|
|
%LineNumber.text = lns
|
|
%LineNumber2.text = lns
|
|
$LineInfo.show()
|
|
else:
|
|
$LineInfo.hide()
|
|
# 车站名称
|
|
%StationName.text = stationName
|
|
%EnName.text = stationEnName
|
|
|
|
|
|
func _ready():
|
|
isReady = true
|
|
print("csPanel content ready")
|
|
update()
|
|
|