| | |
| | | using UnityEngine.EventSystems;
|
| | | using Snxxz.UI;
|
| | |
|
| | | namespace Snxxz.UI {
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class BagWin : TempKnapSackBasic {
|
| | | public class BagWin : TempKnapSackBasic
|
| | | {
|
| | |
|
| | | #region 成员变量
|
| | | [SerializeField]
|
| | |
| | | private bool isDoubleClick = false;
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | ItemTipsModel itemTipsModel {
|
| | | get {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | PlayerPackModel _playerPack;
|
| | | PlayerPackModel playerPack
|
| | | {
|
| | | PlayerPackModel playerPack {
|
| | | get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
|
| | | }
|
| | |
|
| | | PackModelInterface _modelInterface;
|
| | | PackModelInterface modelInterface
|
| | | {
|
| | | PackModelInterface modelInterface {
|
| | | get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); }
|
| | | }
|
| | |
|
| | | private GridCell _lookEquipCell = null;
|
| | |
|
| | | #region Built-in
|
| | | protected override void BindController() {
|
| | | protected override void BindController()
|
| | | {
|
| | | _gridlineCtrl.OnRefreshCell += OnRefreshGridCell;
|
| | | _gridlineCtrl.vertical = true;
|
| | | _gridlineCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | }
|
| | |
|
| | | protected override void AddListeners() {
|
| | | |
| | | |
| | | protected override void AddListeners()
|
| | | {
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen() {
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | |
|
| | | KnapsackTimeCDMgr.Instance.RefreshItemOverdueAct += RefreshRemainTime;
|
| | | playerPack.RefreshBagEvent += RefreshBagInfo;
|
| | |
| | | playerPack.GridRefreshEvent += OnPackCanUseGrid;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen() {
|
| | |
|
| | | var knapSackWin = WindowCenter.Instance.Get<KnapSackWin>();
|
| | | if (knapSackWin!=null)
|
| | | {
|
| | | Transform parent = knapSackWin.transform;
|
| | | this.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | OnRefrenshUIModel();
|
| | | if(KnapSackWin.titleType == KnapsackFuncTitle.bag
|
| | | if (KnapSackWin.titleType == KnapsackFuncTitle.bag
|
| | | && LocalSave.GetString(PlayerPackModel.RecordKnapsackTitle) != KnapsackFuncTitle.depot.ToString())
|
| | | {
|
| | | _gridlineCtrl.JumpIndex(0);
|
| | |
| | | CheckAchieveJump();
|
| | | LocalSave.SetString(PlayerPackModel.RecordKnapsackTitle, KnapSackWin.titleType.ToString());
|
| | | }
|
| | | |
| | | protected override void OnPreClose() {
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | |
|
| | | KnapsackTimeCDMgr.Instance.RefreshItemOverdueAct -= RefreshRemainTime;
|
| | | playerPack.RefreshItemCountAct -= OnAddItemCell;
|
| | |
| | | playerPack.RefreshBagEvent -= RefreshBagInfo;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose() {
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | UI3DModelExhibition.Instance.StopShow();
|
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | | var knapSackWin = WindowCenter.Instance.Get<KnapSackWin>();
|
| | | if (knapSackWin != null)
|
| | | {
|
| | | Transform parent = knapSackWin.transform;
|
| | | this.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | private void CheckAchieveJump()
|
| | | {
|
| | | if(AchievementGoto.guideAchievementId != 0)
|
| | | if (AchievementGoto.guideAchievementId != 0)
|
| | | {
|
| | | SuccessConfig successConfig = Config.Instance.Get<SuccessConfig>(AchievementGoto.guideAchievementId);
|
| | | if (successConfig != null)
|
| | |
| | | }
|
| | | AchievementGoto.guideAchievementId = 0;
|
| | | }
|
| | | |
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | _gridlineCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | public void OnRefrenshUIModel() {
|
| | | public void OnRefrenshUIModel()
|
| | | {
|
| | | packModel = playerPack.GetSinglePackModel(PackType.rptItem);
|
| | | OnCreateGridLineCell(_gridlineCtrl);
|
| | | }
|
| | |
| | | {
|
| | | if (playerPack.lookLineIndex > -1)
|
| | | {
|
| | | if(playerPack.lookLineIndex >= 4)
|
| | | if (playerPack.lookLineIndex >= 4)
|
| | | {
|
| | | _gridlineCtrl.JumpIndex(playerPack.lookLineIndex - 2);
|
| | | }
|
| | |
| | | {
|
| | | _gridlineCtrl.JumpIndex(playerPack.lookLineIndex);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | |
| | |
|
| | | if (_lookEquipCell != null)
|
| | | {
|
| | | _lookEquipCell.uiEffect.Stop();
|
| | |
| | | TimeSpan t;
|
| | | if (cool != null)
|
| | | {
|
| | | t = TimeSpan.FromSeconds(cool.GetRemainTime());
|
| | | t = TimeSpan.FromSeconds(cool.GetRemainTime());
|
| | | }
|
| | | else
|
| | | {
|
| | | t = TimeSpan.FromSeconds(0);
|
| | | }
|
| | | |
| | | if(t.TotalSeconds <= 0)
|
| | |
|
| | | if (t.TotalSeconds <= 0)
|
| | | {
|
| | | OnRefrenshUIModel();
|
| | | }
|
| | |
| | |
|
| | | #region 共用部分
|
| | |
|
| | | public override void OnCreateGridLineCell(ScrollerController gridCtrl) {
|
| | | public override void OnCreateGridLineCell(ScrollerController gridCtrl)
|
| | | {
|
| | | base.OnCreateGridLineCell(gridCtrl);
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | public void OnRefreshGridCell(ScrollerDataType type, CellView cell) {
|
| | | public void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | int gridlineIndex = cell.index;
|
| | | int childCode = 0;
|
| | | |
| | |
|
| | | if (packModel == null)
|
| | | {
|
| | | for (childCode = 0; childCode < cell.transform.childCount; childCode++)
|
| | | {
|
| | | GridCell gridCell = cell.transform.GetChild(childCode).GetComponent<GridCell>();
|
| | | if(gridCell == null)
|
| | | if (gridCell == null)
|
| | | gridCell = cell.transform.GetChild(childCode).gameObject.AddComponent<GridCell>();
|
| | |
|
| | | gridCell.cdImag.fillAmount = 0;
|
| | |
| | | gridCell.itemCell.gameObject.SetActive(false);
|
| | | gridCell.uiEffect.Stop();
|
| | | }
|
| | | return;
|
| | | return;
|
| | | }
|
| | | for (childCode = 0; childCode < cell.transform.childCount; childCode++) {
|
| | | for (childCode = 0; childCode < cell.transform.childCount; childCode++)
|
| | | {
|
| | |
|
| | | GridCell gridCell = cell.transform.GetChild(childCode).GetComponent<GridCell>();
|
| | | if (gridCell == null)
|
| | | gridCell = cell.transform.GetChild(childCode).gameObject.AddComponent<GridCell>();
|
| | |
|
| | | int cellCount = (cell.transform.childCount) * gridlineIndex + (childCode + 1);
|
| | | |
| | |
|
| | | gridCell.itemCell.gameObject.SetActive(false);
|
| | | if (cellCount > packModel.openGridCount)
|
| | | {
|
| | |
| | | if (itemModel != null)
|
| | | {
|
| | | gridCell.itemCell.gameObject.SetActive(true);
|
| | | gridCell.itemCell.Init(itemModel,true);
|
| | | gridCell.itemCell.Init(itemModel, true);
|
| | | gridCell.itemCellBtn.OnOneParaClick = null;
|
| | | gridCell.itemCellBtn.m_OnDbClick = null;
|
| | | if (KnapSackWin.titleType == KnapsackFuncTitle.depot)
|
| | | {
|
| | | gridCell.itemCellBtn.OnOneParaClick=(int info) => {
|
| | | |
| | | gridCell.itemCellBtn.OnOneParaClick = (int info) =>
|
| | | {
|
| | |
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID, false, true);
|
| | | itemTipsModel.SetDepotBagTipsBtn(itemTipsModel.curAttrData);
|
| | | itemTipsModel.ShowUICtrl();
|
| | |
|
| | | };
|
| | | gridCell.itemCellBtn.m_OnDbClick=() =>
|
| | | {
|
| | | PackSendQuestMgr.Instance.SendPutInQuest(ItemWinBtnType.putIn, itemModel.itemInfo.ItemGUID);
|
| | | };
|
| | | gridCell.itemCellBtn.m_OnDbClick = () =>
|
| | | {
|
| | | PackSendQuestMgr.Instance.SendPutInQuest(ItemWinBtnType.putIn, itemModel.itemInfo.ItemGUID);
|
| | | };
|
| | |
|
| | | }
|
| | | else if(KnapSackWin.titleType == KnapsackFuncTitle.bag)
|
| | | else if (KnapSackWin.titleType == KnapsackFuncTitle.bag)
|
| | | {
|
| | | gridCell.itemCellBtn.OnOneParaClick=(int info) => {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID, false,true);
|
| | | gridCell.itemCellBtn.OnOneParaClick = (int info) =>
|
| | | {
|
| | | itemTipsModel.SetItemTipsModel(PackType.rptItem, itemModel.itemInfo.ItemGUID, false, true);
|
| | | itemTipsModel.SetBagTipsBtn(itemTipsModel.curAttrData);
|
| | | itemTipsModel.ShowUICtrl();
|
| | | };
|
| | |
| | | bool isLookEquip = false;
|
| | | if (playerPack.lookLineIndex > -1)
|
| | | {
|
| | | if(itemModel.itemInfo.ItemGUID == playerPack.lookItemGUID)
|
| | | if (itemModel.itemInfo.ItemGUID == playerPack.lookItemGUID)
|
| | | {
|
| | | gridCell.uiEffect.Play();
|
| | | _lookEquipCell = gridCell;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if(playerPack.isPlayBetterEquipEffect)
|
| | | if (playerPack.isPlayBetterEquipEffect)
|
| | | {
|
| | | if(modelInterface.GetBagSortBetterEquip(itemModel.chinItemModel.EquipPlace,itemModel.itemInfo.ItemPlace) != null)
|
| | | if (modelInterface.GetBagSortBetterEquip(itemModel.chinItemModel.EquipPlace, itemModel.itemInfo.ItemPlace) != null)
|
| | | {
|
| | | bool isOverdue = modelInterface.IsOverdue(itemModel.itemInfo.ItemGUID,itemModel.itemInfo.ItemID,itemModel.useDataDict);
|
| | | if(!isOverdue)
|
| | | bool isOverdue = modelInterface.IsOverdue(itemModel.itemInfo.ItemGUID, itemModel.itemInfo.ItemID, itemModel.useDataDict);
|
| | | if (!isOverdue)
|
| | | {
|
| | | gridCell.uiEffect.Play();
|
| | | }
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if(!isLookEquip)
|
| | | if (!isLookEquip)
|
| | | {
|
| | | gridCell.uiEffect.Stop();
|
| | | }
|
| | |
| | | gridCell.SetModel(null);
|
| | | gridCell.uiEffect.Stop();
|
| | | }
|
| | | |
| | |
|
| | | gridCell.lockBtn.onClick.RemoveAllListeners();
|
| | | gridCell.lockBtn.onClick.AddListener(() => {
|
| | | gridCell.lockBtn.onClick.AddListener(() =>
|
| | | {
|
| | | int selectGridIndex = cell.index * 5 + int.Parse(gridCell.gameObject.name.Substring(gridCell.gameObject.name.Length - 1, 1));
|
| | | OnClickLockBtn(selectGridIndex,packModel);
|
| | | OnClickLockBtn(selectGridIndex, packModel);
|
| | | });
|
| | |
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public override void OnPackCanUseGrid(PackType type) {
|
| | | public override void OnPackCanUseGrid(PackType type)
|
| | | {
|
| | | if (type != PackType.rptItem)
|
| | | return;
|
| | | OnRefrenshUIModel();
|
| | | }
|
| | |
|
| | | public override void OnAddItemCell(PackType type,int index,int id) {
|
| | | public override void OnAddItemCell(PackType type, int index, int id)
|
| | | {
|
| | | if (type != PackType.rptItem)
|
| | | return;
|
| | |
|