123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System.Collections.Generic;
- using Fort23.UTool;
- using GameLogic.Bag;
- using UnityEngine;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "ProfessionEquipmentPanel" )]
- public partial class ProfessionEquipmentPanel : UIPanel
- {
- private void Init()
- {
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- btnBack.onClick.AddListener(OnclickBack);
- btnZs.onClick.AddListener(OnclickZS);
- btnFs.onClick.AddListener(OnclickFS);
- btnMs.onClick.AddListener(OnclickMS);
- btnYx.onClick.AddListener(OnclickYX);
- }
- private async void OnclickZS()
- {
- OpenSpecificProfessionEquipmentPanel(1);
- }
-
- private async void OnclickFS()
- {
- OpenSpecificProfessionEquipmentPanel(2);
- }
-
- private async void OnclickMS()
- {
- OpenSpecificProfessionEquipmentPanel(3);
- }
-
- private async void OnclickYX()
- {
- OpenSpecificProfessionEquipmentPanel(4);
- }
- /// <summary>
- /// 打开对应职业的装备面板
- /// </summary>
- /// <param name="zy">1战士;2法师;3牧师;4游侠</param>
- private async void OpenSpecificProfessionEquipmentPanel(int zy)
- {
- SpecificProfessionEquipmentPanel specificProfessionEquipmentPanel
- = await UIManager.Instance.LoadAndOpenPanel<SpecificProfessionEquipmentPanel>(null);
- specificProfessionEquipmentPanel.InitPanel(zy);
- }
- private void OnclickBack()
- {
- UIManager.Instance.HideUIUIPanel(this);
- }
- public async void InitPanel()
- {
-
- SetZyEqs(zsEqs, 1);
- SetZyEqs(fsEqs, 2);
- SetZyEqs(msEqs, 3);
- SetZyEqs(yxEqs, 4);
-
- }
- private async void SetZyEqs(List<object> eqs, int zy)
- {
- foreach (GameObject eqGo in eqs)
- {
- WidgetItem eqItem = await UIManager.Instance.
- CreateGComponentForObject<WidgetItem>(eqGo,
- null, root:eqGo.GetComponent<RectTransform>());
- LogTool.Log(eqGo + "设置");
- eqItem.SetEmpty();
- }
- if (BagController.Instance.EqDic.ContainsKey(zy))
- {
- List<ItemInfo> eqList = BagController.Instance.EqDic[zy];
- foreach (ItemInfo eqInfo in eqList)
- {
- if (eqInfo.eqInfo.isEquip)
- {
- // if(eqInfo.eqInfo.basicEquipConfig.Type)
- GameObject eqGo = eqs[eqInfo.eqInfo.basicEquipConfig.Type - 1] as GameObject;
- WidgetItem eqItem = await UIManager.Instance.
- CreateGComponentForObject<WidgetItem>(eqGo, null, root:eqGo.GetComponent<RectTransform>());
- eqItem.InitWidget(eqInfo);
- }
- }
- }
-
- }
- }
- }
|