结构大修改,改成朴实无华的结构,不过度架构。能跑就行

This commit is contained in:
2025-12-23 00:09:39 +08:00
parent 384f11f620
commit 3d14085920
2837 changed files with 149714 additions and 1100 deletions

View File

@@ -22,11 +22,11 @@ namespace NBF
public CommonItemList ItemList;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<BagPanel>(param); }
public static void Show(object param = null){ UI.Inst.OpenUI<BagPanel>(param); }
public static void Hide(){ App.UI.HideUI<BagPanel>(); }
public static void Hide(){ UI.Inst.HideUI<BagPanel>(); }
public static void Del(){ App.UI.DestroyUI<BagPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<BagPanel>(); }
}
}

View File

@@ -17,14 +17,13 @@ namespace NBF
protected override void OnShow()
{
ItemList.List.OnClickItem += OnClickItem;
Game.Input.OnUICanceled += OnUICanceled;
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
List<TabItemData> tabItemList = new List<TabItemData>();
var role = App.Main.GetComponent<Role>();
var roleBag = role.GetComponent<RoleBag>();
var dic = roleBag.GetItemsByType();
var dic = RoleModel.Instance.GetItemsByType();
foreach (var (type, list) in dic)
{
TabItemData tabItem = new TabItemData
@@ -71,7 +70,7 @@ namespace NBF
protected override void OnHide()
{
Game.Input.OnUICanceled -= OnUICanceled;
InputManager.OnUICanceled -= OnUICanceled;
ItemList.List.OnClickItem -= OnClickItem;
}

View File

@@ -26,11 +26,11 @@ namespace NBF
public ClassifyList List;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<BagSelectPanel>(param); }
public static void Show(object param = null){ UI.Inst.OpenUI<BagSelectPanel>(param); }
public static void Hide(){ App.UI.HideUI<BagSelectPanel>(); }
public static void Hide(){ UI.Inst.HideUI<BagSelectPanel>(); }
public static void Del(){ App.UI.DestroyUI<BagSelectPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<BagSelectPanel>(); }
}
}

View File

@@ -92,11 +92,11 @@ namespace NBF
private void SetList()
{
var role = App.Main.GetComponent<Role>();
var roleBag = role.GetComponent<RoleBag>();
// var role = Game.Main.GetComponent<Role>();
// var roleBag = role.GetComponent<RoleBag>();
List<object> items = roleBag.GetItemListData();
List.SetListData(items);
// List<object> items = roleBag.GetItemListData();
// List.SetListData(items);
}
}
}

View File

@@ -28,11 +28,11 @@ namespace NBF
public GLoader Test;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<BagSlotPanel>(param); }
public static void Show(object param = null){ UI.Inst.OpenUI<BagSlotPanel>(param); }
public static void Hide(){ App.UI.HideUI<BagSlotPanel>(); }
public static void Hide(){ UI.Inst.HideUI<BagSlotPanel>(); }
public static void Del(){ App.UI.DestroyUI<BagSlotPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<BagSlotPanel>(); }
}
}

View File

@@ -14,7 +14,6 @@ namespace NBF
{
private List<ItemInfo> _items = new List<ItemInfo>();
private RoleBag _roleBag;
protected override void OnInit()
{
@@ -23,8 +22,6 @@ namespace NBF
protected override void OnShow()
{
var role = App.Main.GetComponent<Role>();
_roleBag = role.GetComponent<RoleBag>();
SetList();
SetSlotList();
}
@@ -34,7 +31,7 @@ namespace NBF
private void SetList()
{
_items.Clear();
foreach (var roleBagItem in _roleBag.Items)
foreach (var roleBagItem in RoleModel.Instance.Items)
{
if (CanShow(roleBagItem))
{
@@ -42,7 +39,7 @@ namespace NBF
}
}
List<object> items = _roleBag.GetItemListData();
List<object> items = RoleModel.Instance.GetItemListData();
List.SetListData(items);
var children = List.List.GetChildren();
foreach (var gObject in children)
@@ -74,7 +71,7 @@ namespace NBF
{
if (SlotList.AddItemFromPool() is BagSlotItem slotItem)
{
slotItem.SetData(index, _roleBag.GetSlotItem(index));
slotItem.SetData(index, RoleModel.Instance.GetSlotItem(index));
slotItem.OnChangeSlot = OnChangeSlotItem;
}
}
@@ -83,7 +80,7 @@ namespace NBF
private void OnChangeSlotItem(int index, long id)
{
_roleBag.SetSlot(index, id).OnCompleted(OnChangeSlotItemDone);
RoleModel.Instance.SetSlot(index, id).OnCompleted(OnChangeSlotItemDone);
}
private void OnChangeSlotItemDone()
@@ -104,7 +101,7 @@ namespace NBF
private void SelectCallback(long selectId)
{
if (selectId < 1) return;
_roleBag.SetSlot(_lastSelectedItem, selectId).OnCompleted(OnChangeSlotItemDone);
RoleModel.Instance.SetSlot(_lastSelectedItem, selectId).OnCompleted(OnChangeSlotItemDone);
}
#endregion

View File

@@ -30,11 +30,11 @@ namespace NBF
public GImage Quality;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<ItemDetailsPanel>(param); }
public static void Show(object param = null){ UI.Inst.OpenUI<ItemDetailsPanel>(param); }
public static void Hide(){ App.UI.HideUI<ItemDetailsPanel>(); }
public static void Hide(){ UI.Inst.HideUI<ItemDetailsPanel>(); }
public static void Del(){ App.UI.DestroyUI<ItemDetailsPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<ItemDetailsPanel>(); }
}
}

View File

@@ -36,7 +36,7 @@ namespace NBF
Model.SetData(ItemInfo);
// Model.SetBackground(Back);
Game.Input.OnUICanceled += OnUICanceled;
InputManager.OnUICanceled += OnUICanceled;
}
private void OnUICanceled(string action)
@@ -60,7 +60,7 @@ namespace NBF
protected override void OnHide()
{
Model.UnloadModel();
Game.Input.OnUICanceled -= OnUICanceled;
InputManager.OnUICanceled -= OnUICanceled;
}
}
}

View File

@@ -15,7 +15,7 @@ namespace NBF
public partial class ItemGearInfoTag : GComponent
{
public ItemInfo Info { get; private set; }
private RoleBag _bag;
// private RoleBag _bag;
private List<ItemInfo> _bindItems;
private void OnInited()
@@ -30,11 +30,11 @@ namespace NBF
public void SetInfo(ItemInfo itemInfo)
{
_usedItems.Clear();
var role = App.Main.GetComponent<Role>();
_bag = role.GetComponent<RoleBag>();
// var role = Game.Main.GetComponent<Role>();
// _bag = role.GetComponent<RoleBag>();
Info = itemInfo;
_bindItems = _bag.GetBindItems(Info.Id);
// _bindItems = _bag.GetBindItems(Info.Id);
var types = itemInfo.GetBindConfig();
List.RemoveChildrenToPool();
if (types != null)
@@ -87,12 +87,12 @@ namespace NBF
{
if (_lastSelectedItem == null) return;
Log.Info($"选中id={selectId}");
_bag.AddRig(Info.Id, selectId, _lastSelectedItem.RigId).OnCompleted(ChangeInfo);
// _bag.AddRig(Info.Id, selectId, _lastSelectedItem.RigId).OnCompleted(ChangeInfo);
}
private void CloseCallback(long id, long removeId)
{
_bag.RemoveRig(Info.Id, removeId).OnCompleted(ChangeInfo);
// _bag.RemoveRig(Info.Id, removeId).OnCompleted(ChangeInfo);
}
private void ChangeInfo()