hy-farm/godot/FarmGodot/scripts/resources/texture_region_catalog.gd
2026-05-29 19:54:56 +08:00

118 lines
4.2 KiB
GDScript

class_name TextureRegionCatalog
extends RefCounted
const COMMON_ATLAS_PATH := "res://assets/egret/common/common.png"
const FRIEND_ATLAS_PATH := "res://assets/egret/assets/game/friend/friend.png"
const RANK_ATLAS_PATH := "res://assets/egret/assets/game/rank/rank.png"
const BUILDING_ATLAS_PATH := "res://assets/egret/assets/game/building/building.png"
const LANDUP_ATLAS_PATH := "res://assets/egret/assets/game/landup/landup.png"
const SIGN_ATLAS_PATH := "res://assets/egret/assets/game/sign/sign.png"
const COMMON_REGIONS := {
"blue_rect": Rect2(443, 387, 52, 21),
"btn_add": Rect2(157, 699, 49, 32),
"btn_close": Rect2(675, 664, 80, 74),
"btn_page_next": Rect2(301, 683, 46, 41),
"btn_page_prev": Rect2(675, 620, 46, 41),
"btn_red": Rect2(861, 661, 133, 52),
"btn_red_gray": Rect2(246, 629, 133, 52),
"btn_sub": Rect2(561, 710, 49, 32),
"c_btn1": Rect2(806, 509, 200, 70),
"c_btn2": Rect2(381, 680, 88, 44),
"c_btn3": Rect2(426, 620, 166, 58),
"c_btn3_gray": Rect2(0, 604, 166, 58),
"c_panel": Rect2(0, 0, 260, 357),
"c_panel2": Rect2(262, 0, 285, 216),
"dog_food": Rect2(208, 699, 34, 31),
"img_lock": Rect2(979, 385, 35, 40),
"inner_page": Rect2(757, 664, 70, 70),
"inp_mid": Rect2(594, 488, 62, 44),
"item_bg": Rect2(929, 182, 90, 90),
"line": Rect2(996, 304, 24, 4),
"panel_icon_building": Rect2(443, 303, 96, 82),
"panel_icon_pay": Rect2(0, 664, 71, 95),
"panel_icon_shop": Rect2(73, 664, 82, 75),
"panel_icon_warehouse": Rect2(594, 620, 79, 88),
"panel_title_building": Rect2(665, 171, 262, 84),
"panel_title_pay": Rect2(442, 523, 141, 82),
"panel_title_sell": Rect2(585, 535, 137, 83),
"panel_title_shop": Rect2(262, 218, 261, 83),
"panel_title_warehouse": Rect2(665, 85, 262, 84),
"s_tip": Rect2(829, 704, 28, 26),
"shop_itembg": Rect2(262, 303, 179, 110),
"sicon_diamond": Rect2(381, 629, 35, 32),
"sicon_gold": Rect2(979, 468, 35, 35),
"skin_top": Rect2(665, 342, 311, 61),
"tab_selected": Rect2(141, 359, 105, 47),
"tab_unselecte": Rect2(471, 680, 88, 40),
"tipbg": Rect2(0, 359, 139, 131),
"trimming1": Rect2(924, 274, 70, 63),
"trimming2": Rect2(497, 387, 35, 26),
"tuding": Rect2(959, 581, 48, 58),
}
const FRIEND_REGIONS := {
"friend_btn_caifu": Rect2(335, 0, 72, 65),
"friend_btn_find": Rect2(409, 0, 70, 65),
"friend_btn_lv": Rect2(263, 0, 70, 80),
"friend_btn_req": Rect2(418, 67, 70, 61),
"friend_btn_zhanli": Rect2(350, 67, 66, 67),
"friend_hand": Rect2(418, 130, 57, 54),
"panel_icon_friend": Rect2(262, 86, 86, 83),
"panel_title_friend": Rect2(0, 172, 261, 83),
}
const RANK_REGIONS := {
"btn_friend_home": Rect2(263, 58, 63, 59),
"friend_item": Rect2(0, 0, 430, 56),
"rank1": Rect2(360, 58, 30, 39),
"rank2": Rect2(328, 58, 30, 40),
"rank3": Rect2(392, 58, 29, 39),
}
const BUILDING_REGIONS := {
"building_up_arrow": Rect2(401, 163, 40, 53),
"btn_building_up": Rect2(240, 230, 159, 65),
"btn_building_up_gray": Rect2(240, 163, 159, 65),
"building_cost_itembg": Rect2(0, 163, 114, 149),
"building_land_item": Rect2(0, 0, 505, 161),
"building_lvbg": Rect2(116, 163, 122, 85),
}
const LANDUP_REGIONS := {
"building_land_num0": Rect2(472, 116, 20, 19),
"building_land_num1": Rect2(472, 74, 20, 19),
"building_land_num2": Rect2(472, 95, 20, 19),
"building_land_num3": Rect2(472, 137, 20, 19),
"land_up_name1": Rect2(182, 86, 178, 52),
"land_up_name2": Rect2(0, 140, 181, 50),
"land_up_name3": Rect2(0, 84, 180, 52),
"panel_icon_landopen": Rect2(362, 86, 108, 78),
"panel_icon_landup": Rect2(403, 0, 96, 72),
"panel_title_landopen": Rect2(261, 0, 140, 84),
"panel_title_landup": Rect2(0, 0, 259, 82),
}
const SIGN_REGIONS := {
"sign_btn_purple": Rect2(379, 403, 121, 49),
"sign_btn_purple_gray": Rect2(379, 454, 121, 49),
}
static func region_for(atlas_path: String, region_name: String) -> Rect2:
match atlas_path:
COMMON_ATLAS_PATH:
return COMMON_REGIONS.get(region_name, Rect2(0, 0, 1, 1))
FRIEND_ATLAS_PATH:
return FRIEND_REGIONS.get(region_name, Rect2(0, 0, 1, 1))
RANK_ATLAS_PATH:
return RANK_REGIONS.get(region_name, Rect2(0, 0, 1, 1))
BUILDING_ATLAS_PATH:
return BUILDING_REGIONS.get(region_name, Rect2(0, 0, 1, 1))
LANDUP_ATLAS_PATH:
return LANDUP_REGIONS.get(region_name, Rect2(0, 0, 1, 1))
SIGN_ATLAS_PATH:
return SIGN_REGIONS.get(region_name, Rect2(0, 0, 1, 1))
_:
return Rect2(0, 0, 1, 1)