From 93a2a5228b2a75ff6c0e4ba1fb0ee98dd63bf5bc Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 12 二月 2019 10:24:23 +0800
Subject: [PATCH] 3335 重构窗口管理
---
System/KnapSack/New/BagWin.cs | 152 ++++++++++++++++++++++++++++----------------------
System/Message/MessageWin.cs | 4 +
2 files changed, 88 insertions(+), 68 deletions(-)
diff --git a/System/KnapSack/New/BagWin.cs b/System/KnapSack/New/BagWin.cs
index 56854aa..fe45a67 100644
--- a/System/KnapSack/New/BagWin.cs
+++ b/System/KnapSack/New/BagWin.cs
@@ -12,9 +12,11 @@
using UnityEngine.EventSystems;
using Snxxz.UI;
-namespace Snxxz.UI {
+namespace Snxxz.UI
+{
- public class BagWin : TempKnapSackBasic {
+ public class BagWin : TempKnapSackBasic
+ {
#region 鎴愬憳鍙橀噺
[SerializeField]
@@ -26,41 +28,40 @@
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;
@@ -70,18 +71,10 @@
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);
@@ -90,8 +83,9 @@
CheckAchieveJump();
LocalSave.SetString(PlayerPackModel.RecordKnapsackTitle, KnapSackWin.titleType.ToString());
}
-
- protected override void OnPreClose() {
+
+ protected override void OnPreClose()
+ {
KnapsackTimeCDMgr.Instance.RefreshItemOverdueAct -= RefreshRemainTime;
playerPack.RefreshItemCountAct -= OnAddItemCell;
@@ -101,14 +95,27 @@
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)
@@ -127,11 +134,11 @@
}
AchievementGoto.guideAchievementId = 0;
}
-
+
break;
}
}
-
+
}
}
@@ -141,7 +148,8 @@
_gridlineCtrl.m_Scorller.RefreshActiveCellViews();
}
- public void OnRefrenshUIModel() {
+ public void OnRefrenshUIModel()
+ {
packModel = playerPack.GetSinglePackModel(PackType.rptItem);
OnCreateGridLineCell(_gridlineCtrl);
}
@@ -150,7 +158,7 @@
{
if (playerPack.lookLineIndex > -1)
{
- if(playerPack.lookLineIndex >= 4)
+ if (playerPack.lookLineIndex >= 4)
{
_gridlineCtrl.JumpIndex(playerPack.lookLineIndex - 2);
}
@@ -158,11 +166,11 @@
{
_gridlineCtrl.JumpIndex(playerPack.lookLineIndex);
}
-
+
}
else
{
-
+
if (_lookEquipCell != null)
{
_lookEquipCell.uiEffect.Stop();
@@ -186,14 +194,14 @@
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();
}
@@ -201,21 +209,23 @@
#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;
@@ -224,16 +234,17 @@
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)
{
@@ -250,28 +261,30 @@
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();
};
@@ -281,7 +294,7 @@
bool isLookEquip = false;
if (playerPack.lookLineIndex > -1)
{
- if(itemModel.itemInfo.ItemGUID == playerPack.lookItemGUID)
+ if (itemModel.itemInfo.ItemGUID == playerPack.lookItemGUID)
{
gridCell.uiEffect.Play();
_lookEquipCell = gridCell;
@@ -289,12 +302,12 @@
}
}
- 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();
}
@@ -306,7 +319,7 @@
}
else
{
- if(!isLookEquip)
+ if (!isLookEquip)
{
gridCell.uiEffect.Stop();
}
@@ -319,11 +332,12 @@
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);
});
}
@@ -331,13 +345,15 @@
}
- 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;
diff --git a/System/Message/MessageWin.cs b/System/Message/MessageWin.cs
index fc66fe4..4b32aae 100644
--- a/System/Message/MessageWin.cs
+++ b/System/Message/MessageWin.cs
@@ -103,6 +103,10 @@
if (_hint != null)
{
serverTipPrepared = false;
+ if (!m_ServerTipScaleTween.gameObject.activeSelf)
+ {
+ m_ServerTipScaleTween.gameObject.SetActive(true);
+ }
m_ServerTipScaleTween.SetStartState();
m_ServerTipPositionTween.SetStartState();
m_ContainerServerTip.gameObject.SetActive(true);
--
Gitblit v1.8.0