添加商店 UI

This commit is contained in:
2026-03-07 22:50:15 +08:00
parent 2b86582ff7
commit c04c049c6a
35 changed files with 3422 additions and 10 deletions
@@ -1,24 +1,48 @@
using System.Collections.Generic;
using GameFramework.DataTable;
using GeometryTD.DataTable;
using GeometryTD.Definition;
using Newtonsoft.Json.Linq;
using GeometryTD.UI;
using UnityEngine;
using UnityGameFramework.Runtime;
using GeometryTD.CustomEvent;
using GeometryTD.Definition;
namespace GeometryTD.CustomComponent
{
public class ShopNodeComponent : GameFrameworkComponent
{
private ShopFormUseCase _shopFormUseCase;
private bool _initialized;
public void OnInit()
{
if (_initialized)
{
return;
}
_shopFormUseCase ??= new ShopFormUseCase();
GameEntry.UIRouter.BindUIUseCase(UIFormType.ShopForm, _shopFormUseCase);
_initialized = true;
}
public void StartShop()
{
//TODO
if (!_initialized)
{
OnInit();
}
if (_shopFormUseCase == null || !_shopFormUseCase.PrepareForOpen())
{
Log.Warning("ShopNodeComponent.StartShop() failed. Shop use case is unavailable or goods generation failed.");
return;
}
GameEntry.UIRouter.OpenUI(UIFormType.ShopForm);
GameEntry.Event.Fire(this, NodeEnterEventArgs.Create());
}
public void EndShop()
{
GameEntry.UIRouter.CloseUI(UIFormType.ShopForm);
GameEntry.Event.Fire(this, NodeCompleteEventArgs.Create());
}
}
}
}