| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, September 07, 2017 |
| | | //-------------------------------------------------------- |
| | | |
| | | using Snxxz.UI; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | namespace Snxxz.UI { |
| | | |
| | | public class WingsWin : Window |
| | | { |
| | | #region 成员变量 |
| | | [SerializeField] |
| | | WingsTip wingsTip; |
| | | [SerializeField] |
| | | BuyWingsTip buyTip; |
| | | [SerializeField] |
| | | CanvasGroup wingsTipAlpha; |
| | | [SerializeField] |
| | | CanvasGroup buyTipAlpha; |
| | | #endregion |
| | | ItemTipsModel _itemTipsModel; |
| | | ItemTipsModel itemTipsModel |
| | | { |
| | | get |
| | | { |
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); |
| | | } |
| | | } |
| | | |
| | | private List<GameObject> TempCreatelist = new List<GameObject>(); |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | KnapSackEventMgr.Instance.AddWingsWinTempObjEvent = AddTempCreatelist; |
| | | KnapSackEventMgr.Instance.HideWingsWinEvent = OnHidePanel; |
| | | wingsTipAlpha.alpha = 0; |
| | | buyTipAlpha.alpha = 0; |
| | | UIShow(); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | this.transform.SetAsLastSibling(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | for (int i = 0; i < TempCreatelist.Count; i++) |
| | | { |
| | | Destroy(TempCreatelist[i]); |
| | | } |
| | | TempCreatelist.Clear(); |
| | | wingsTip.gameObject.SetActive(false); |
| | | buyTip.gameObject.SetActive(false); |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | #endregion |
| | | |
| | | public void UIShow() |
| | | { |
| | | if (itemTipsModel.compareAttrData == null) |
| | | { |
| | | if (itemTipsModel.curAttrData != null) |
| | | { |
| | | switch (itemTipsModel.curAttrData.ChildType) |
| | | { |
| | | case ItemTipChildType.Normal: |
| | | wingsTip.InitModel(itemTipsModel.curAttrData); |
| | | wingsTip.gameObject.SetActive(true); |
| | | break; |
| | | case ItemTipChildType.Buy: |
| | | buyTip.InitModel(itemTipsModel.curAttrData); |
| | | buyTip.gameObject.SetActive(true); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (itemTipsModel.curAttrData != null) |
| | | { |
| | | switch (itemTipsModel.curAttrData.ChildType) |
| | | { |
| | | case ItemTipChildType.Normal: |
| | | |
| | | WingsTip compareTip = CloneEquipUI(this.transform, wingsTip.gameObject).GetComponent<WingsTip>(); |
| | | compareTip.InitModel(itemTipsModel.compareAttrData); |
| | | TempCreatelist.Add(compareTip.gameObject); |
| | | wingsTip.InitModel(itemTipsModel.curAttrData); |
| | | compareTip.gameObject.SetActive(true); |
| | | wingsTip.gameObject.SetActive(true); |
| | | break; |
| | | case ItemTipChildType.Buy: |
| | | buyTip.InitModel(itemTipsModel.curAttrData); |
| | | wingsTip.InitModel(itemTipsModel.compareAttrData); |
| | | buyTip.gameObject.SetActive(true); |
| | | wingsTip.gameObject.SetActive(true); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | private void AddTempCreatelist(GameObject obj) |
| | | { |
| | | TempCreatelist.Add(obj); |
| | | } |
| | | |
| | | public GameObject CloneEquipUI(Transform parent, GameObject target) |
| | | { |
| | | GameObject go = Instantiate(target); |
| | | go.transform.SetParent(parent); |
| | | go.transform.localPosition = Vector3.zero; |
| | | go.transform.localScale = Vector3.one; |
| | | return go; |
| | | } |
| | | |
| | | public void OnHidePanel() |
| | | { |
| | | CloseImmediately(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Thursday, September 07, 2017
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using Snxxz.UI;
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | | namespace Snxxz.UI {
|
| | |
|
| | | public class WingsWin : Window
|
| | | {
|
| | | #region 成员变量
|
| | | [SerializeField]
|
| | | WingsTip wingsTip;
|
| | | [SerializeField]
|
| | | BuyWingsTip buyTip;
|
| | | [SerializeField] GetWingsPathTips getWingsPathTip;
|
| | | [SerializeField]
|
| | | CanvasGroup wingsTipAlpha;
|
| | | [SerializeField]
|
| | | CanvasGroup buyTipAlpha;
|
| | | [SerializeField] CanvasGroup wingsPathAlpha;
|
| | | #endregion
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel
|
| | | {
|
| | | get
|
| | | {
|
| | | return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
|
| | | }
|
| | | }
|
| | |
|
| | | private List<GameObject> TempCreatelist = new List<GameObject>();
|
| | |
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | KnapSackEventMgr.Instance.AddWingsWinTempObjEvent = AddTempCreatelist;
|
| | | KnapSackEventMgr.Instance.HideWingsWinEvent = OnHidePanel;
|
| | | itemTipsModel.SetCurTips(null);
|
| | | itemTipsModel.SetCompareTips(null);
|
| | | wingsTipAlpha.alpha = 0;
|
| | | buyTipAlpha.alpha = 0;
|
| | | wingsPathAlpha.alpha = 0;
|
| | | UIShow();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | this.transform.SetAsLastSibling();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | for (int i = 0; i < TempCreatelist.Count; i++)
|
| | | {
|
| | | Destroy(TempCreatelist[i]);
|
| | | }
|
| | | TempCreatelist.Clear();
|
| | | wingsTip.gameObject.SetActive(false);
|
| | | buyTip.gameObject.SetActive(false);
|
| | | getWingsPathTip.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | | #endregion
|
| | |
|
| | | public void UIShow()
|
| | | {
|
| | | if (itemTipsModel.compareAttrData == null)
|
| | | {
|
| | | if (itemTipsModel.curAttrData != null)
|
| | | {
|
| | | switch (itemTipsModel.curAttrData.ChildType)
|
| | | {
|
| | | case ItemTipChildType.Normal:
|
| | | wingsTip.InitModel(itemTipsModel.curAttrData);
|
| | | wingsTip.gameObject.SetActive(true);
|
| | | break;
|
| | | case ItemTipChildType.Buy:
|
| | | buyTip.InitModel(itemTipsModel.curAttrData);
|
| | | buyTip.gameObject.SetActive(true);
|
| | | break;
|
| | | case ItemTipChildType.GetWingsPath:
|
| | | getWingsPathTip.InitModel(itemTipsModel.curAttrData);
|
| | | getWingsPathTip.gameObject.SetActive(true);
|
| | | break;
|
| | | }
|
| | | |
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (itemTipsModel.curAttrData != null)
|
| | | {
|
| | | switch (itemTipsModel.curAttrData.ChildType)
|
| | | {
|
| | | case ItemTipChildType.Normal:
|
| | | |
| | | WingsTip compareTip = CloneEquipUI(this.transform, wingsTip.gameObject).GetComponent<WingsTip>();
|
| | | compareTip.InitModel(itemTipsModel.compareAttrData);
|
| | | TempCreatelist.Add(compareTip.gameObject);
|
| | | wingsTip.InitModel(itemTipsModel.curAttrData);
|
| | | compareTip.gameObject.SetActive(true);
|
| | | wingsTip.gameObject.SetActive(true);
|
| | | break;
|
| | | case ItemTipChildType.Buy:
|
| | | buyTip.InitModel(itemTipsModel.curAttrData);
|
| | | wingsTip.InitModel(itemTipsModel.compareAttrData);
|
| | | buyTip.gameObject.SetActive(true);
|
| | | wingsTip.gameObject.SetActive(true);
|
| | | break;
|
| | | case ItemTipChildType.GetWingsPath:
|
| | | getWingsPathTip.InitModel(itemTipsModel.curAttrData);
|
| | | getWingsPathTip.gameObject.SetActive(true);
|
| | | wingsTip.InitModel(itemTipsModel.compareAttrData);
|
| | | wingsTip.gameObject.SetActive(true);
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void AddTempCreatelist(GameObject obj)
|
| | | {
|
| | | TempCreatelist.Add(obj);
|
| | | }
|
| | |
|
| | | public GameObject CloneEquipUI(Transform parent, GameObject target)
|
| | | {
|
| | | GameObject go = Instantiate(target);
|
| | | go.transform.SetParent(parent);
|
| | | go.transform.localPosition = Vector3.zero;
|
| | | go.transform.localScale = Vector3.one;
|
| | | return go;
|
| | | }
|
| | |
|
| | | public void OnHidePanel()
|
| | | {
|
| | | CloseImmediately();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|