class_name MallCatalog extends RefCounted # ============================================================================ # MallCatalog.gd - 鲸鱼商城本地配置 # ============================================================================ # 提供商城分类、商品目录和状态文案。 # ============================================================================ const STATUS_AVAILABLE: String = "available" const STATUS_OWNED: String = "owned" const STATUS_COMING_SOON: String = "coming_soon" const STATUS_LOCKED: String = "locked" const CATEGORY_ICON_PATHS: Dictionary = { "recommended": "res://assets/ui/mall/icons/processed/category_recommended_128.png", "outfit": "res://assets/ui/mall/icons/processed/category_outfit_128.png", "items": "res://assets/ui/mall/icons/processed/category_items_128.png", "companion": "res://assets/ui/mall/icons/processed/category_companion_128.png", "space": "res://assets/ui/mall/icons/processed/category_space_128.png", "limited": "res://assets/ui/mall/icons/processed/category_limited_128.png", } const CATEGORIES: Array[Dictionary] = [ {"id": "recommended", "label": "推荐", "icon": "recommended"}, {"id": "outfit", "label": "装扮", "icon": "outfit"}, {"id": "items", "label": "道具", "icon": "items"}, {"id": "companion", "label": "伙伴", "icon": "companion"}, {"id": "space", "label": "空间", "icon": "space"}, {"id": "limited", "label": "限时", "icon": "limited"}, ] const ITEM_TYPE_SKIN: String = "skin" const ITEM_TYPE_ROOM_DECOR: String = "room_decor" const MALL_ITEMS: Array[Dictionary] = [ { "id": "skin_classic_whale", "itemType": ITEM_TYPE_SKIN, "skinId": "classic_whale", "name": "经典鲸鱼", "category": "outfit", "description": "圆润、轻快的鲸鱼居民皮肤,适合喜欢海洋感角色的玩家。", "price": 680, "status": STATUS_AVAILABLE, "tags": ["可预览", "永久", "皮肤"], "icon": "res://assets/ui/mall/skins/classic_whale_product.png", "sortOrder": 10, }, { "id": "skin_human_whale_directional_v2_8x4", "itemType": ITEM_TYPE_SKIN, "skinId": "human_whale_directional_v2_8x4", "name": "海风行者", "category": "outfit", "description": "蓝白海风主题的人类角色皮肤,带有鲸鱼小镇风格的服装细节。", "price": 680, "status": STATUS_AVAILABLE, "tags": ["可预览", "永久", "皮肤"], "icon": "res://assets/ui/mall/skins/human_whale_directional_v2_8x4_product.png", "sortOrder": 20, }, { "id": "skin_girl_sailor_turnaround_v2_8x4", "itemType": ITEM_TYPE_SKIN, "skinId": "girl_sailor_turnaround_v2_8x4", "name": "海风少女", "category": "outfit", "description": "水手风格的人类角色皮肤,适合轻松、清爽的 WhaleTown 日常。", "price": 880, "status": STATUS_AVAILABLE, "tags": ["可预览", "永久", "皮肤"], "icon": "res://assets/ui/mall/skins/girl_sailor_turnaround_v2_8x4_product.png", "sortOrder": 30, }, { "id": "skin_panda_hero_8x4", "itemType": ITEM_TYPE_SKIN, "skinId": "panda_hero_8x4", "name": "熊猫侠", "category": "outfit", "description": "黑白连帽外观的人类角色皮肤,四方向8帧动作,适合想要更鲜明角色辨识度的玩家。", "price": 980, "status": STATUS_AVAILABLE, "tags": ["可预览", "永久", "皮肤"], "icon": "res://assets/ui/mall/skins/panda_hero_8x4_product.png", "sortOrder": 40, }, { "id": "skin_ordinary_man_male_8x4", "itemType": ITEM_TYPE_SKIN, "skinId": "ordinary_man_male_8x4", "name": "普通人(男)", "category": "outfit", "description": "男性日常角色皮肤,四方向8帧动作,适合普通玩家形象。", "price": 980, "status": STATUS_AVAILABLE, "tags": ["可预览", "永久", "皮肤"], "icon": "res://assets/ui/mall/skins/ordinary_man_male_8x4_product.png", "sortOrder": 50, }, { "id": "decor_whale_floor_rug", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "whale_floor_rug", "name": "鲸浪地毯", "category": "space", "description": "蓝白鲸鱼主题地毯,购买后会进入房间家具背包,可在个人房间自由拖拽摆放。", "price": 260, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "地面"], "icon": "res://assets/ui/mall/items/room_decor_whale_floor_rug.png", "sortOrder": 110, }, { "id": "decor_whale_memory_board", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "whale_memory_board", "name": "鲸语记忆板", "category": "space", "description": "鲸鱼木质装饰板,购买后会进入房间家具背包,可在个人房间自由拖拽摆放。", "price": 220, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "挂件"], "icon": "res://assets/ui/mall/items/room_decor_whale_memory_board.png", "sortOrder": 120, }, { "id": "decor_whale_tail_lamp", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "whale_tail_lamp", "name": "鲸尾暖灯", "category": "space", "description": "鲸尾造型的温暖装饰灯,购买后会进入房间家具背包,可在个人房间自由拖拽摆放。", "price": 360, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "灯具"], "icon": "res://assets/ui/mall/items/room_decor_whale_tail_lamp.png", "sortOrder": 130, }, { "id": "decor_boat_cabin_bed", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "boat_cabin_bed", "name": "船舱小床", "category": "space", "description": "白木船舱造型的小床,带海风细节,购买后会进入家具背包,可在个人房间自由拖拽摆放。", "price": 520, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "床"], "icon": "res://assets/ui/mall/items/room_decor_boat_cabin_bed.png", "sortOrder": 140, }, { "id": "decor_low_wave_bed", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "low_wave_bed", "name": "海浪低床", "category": "space", "description": "蓝白海浪被面的低矮小床,购买后会进入家具背包,可在个人房间自由拖拽摆放。", "price": 500, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "床"], "icon": "res://assets/ui/mall/items/room_decor_low_wave_bed.png", "sortOrder": 150, }, { "id": "decor_whale_tail_headboard_bed", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "whale_tail_headboard_bed", "name": "鲸尾床头床", "category": "space", "description": "鲸尾床头和深蓝被面的主题小床,购买后会进入家具背包,可在个人房间自由拖拽摆放。", "price": 580, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "床"], "icon": "res://assets/ui/mall/items/room_decor_whale_tail_headboard_bed.png", "sortOrder": 180, }, { "id": "decor_dev_whale_bookshelf", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "dev_whale_bookshelf", "name": "程序员鲸书架", "category": "space", "description": "带 GitHub、Datawhale 和代码小物件的蓝白书架,购买后会进入家具背包,可在个人房间自由拖拽摆放。", "price": 620, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "书架"], "icon": "res://assets/ui/mall/items/room_decor_dev_whale_bookshelf.png", "sortOrder": 190, }, { "id": "decor_datawhale_bug_feature_badge", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "datawhale_bug_feature_badge", "name": "BUG特性徽章", "category": "space", "description": "写着“这不是BUG 这是feature”的佛系学习小徽章,适合贴在个人房间墙面。", "price": 120, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "徽章"], "icon": "res://assets/ui/mall/items/room_decor_datawhale_bug_feature_badge.png", "sortOrder": 200, }, { "id": "decor_datawhale_buddhist_learning_badge", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "datawhale_buddhist_learning_badge", "name": "佛系学习徽章", "category": "space", "description": "Datawhale 佛系学习主题徽章,适合贴在个人房间墙面。", "price": 140, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "徽章"], "icon": "res://assets/ui/mall/items/room_decor_datawhale_buddhist_learning_badge.png", "sortOrder": 210, }, { "id": "decor_datawhale_ok_working_badge", "itemType": ITEM_TYPE_ROOM_DECOR, "decorId": "datawhale_ok_working_badge", "name": "已经在做徽章", "category": "space", "description": "写着“OKKKK 已经在做了”的工作状态徽章,适合贴在个人房间墙面。", "price": 120, "status": STATUS_AVAILABLE, "tags": ["家具", "可拖拽", "徽章"], "icon": "res://assets/ui/mall/items/room_decor_datawhale_ok_working_badge.png", "sortOrder": 220, }, ] static func get_categories() -> Array[Dictionary]: return CATEGORIES.duplicate(true) static func get_items() -> Array[Dictionary]: return MALL_ITEMS.duplicate(true) static func get_items_for_category(categoryId: String) -> Array[Dictionary]: var result: Array[Dictionary] = [] for item in MALL_ITEMS: var itemCategory := str(item.get("category", "")) if categoryId == "recommended" or itemCategory == categoryId: result.append(item.duplicate(true)) result.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: return int(a.get("sortOrder", 0)) < int(b.get("sortOrder", 0)) ) return result static func get_category_icon_path(categoryId: String) -> String: return str(CATEGORY_ICON_PATHS.get(categoryId, CATEGORY_ICON_PATHS["recommended"])) static func get_status_label(status: String) -> String: match status: STATUS_AVAILABLE: return "可购买" STATUS_OWNED: return "已购买" STATUS_COMING_SOON: return "未开放" STATUS_LOCKED: return "未解锁" _: return "未知" static func can_purchase(item: Dictionary, balance: int) -> bool: var status := str(item.get("status", STATUS_COMING_SOON)) var price := int(item.get("price", 0)) return status == STATUS_AVAILABLE and balance >= price