结构大修改,改成朴实无华的结构,不过度架构。能跑就行
This commit is contained in:
6
Assets/Scripts/UI/Bag/BagPanel.Designer.cs
generated
6
Assets/Scripts/UI/Bag/BagPanel.Designer.cs
generated
@@ -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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
6
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs
generated
6
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs
generated
@@ -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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs
generated
6
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs
generated
@@ -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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user