| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, May 10, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using TableConfig; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI { |
| | | |
| | | public class OpenServerGiftWin : Window |
| | | { |
| | | [SerializeField] RectTransform m_ContainerDisplay; |
| | | [SerializeField] Button[] m_CloseBtns; |
| | | [SerializeField] OSGiftBehaviour[] m_OSGifts; |
| | | |
| | | StoreModel m_Model; |
| | | StoreModel model |
| | | { |
| | | get |
| | | { |
| | | return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<StoreModel>()); |
| | | } |
| | | } |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | for (int i = 0; i < m_CloseBtns.Length; i++) |
| | | { |
| | | m_CloseBtns[i].onClick.AddListener(OnCloseClick); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | WindowCenter.Instance.windowAfterOpenEvent += WindowAfterOpenEvent; |
| | | WindowCenter.Instance.windowAfterCloseEvent += windowAfterCloseEvent; |
| | | |
| | | model.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent; |
| | | |
| | | Display(); |
| | | |
| | | m_ContainerDisplay.gameObject.SetActive(!WindowCenter.Instance.CheckOpen<OffLineOnHookWin>()); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | WindowCenter.Instance.windowAfterOpenEvent -= WindowAfterOpenEvent; |
| | | WindowCenter.Instance.windowAfterCloseEvent -= windowAfterCloseEvent; |
| | | model.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent; |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | #endregion |
| | | |
| | | private void WindowAfterOpenEvent(Window _win) |
| | | { |
| | | if(_win is OffLineOnHookWin) |
| | | { |
| | | m_ContainerDisplay.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | private void windowAfterCloseEvent(Window _win) |
| | | { |
| | | if (_win is OffLineOnHookWin) |
| | | { |
| | | m_ContainerDisplay.gameObject.SetActive(true); |
| | | } |
| | | } |
| | | |
| | | private void RefreshBuyShopLimitEvent() |
| | | { |
| | | Display(); |
| | | } |
| | | |
| | | private void Display() |
| | | { |
| | | var _list = StoreConfig.GetTypeStoreModel((int)StoreFunc.OSGift, true); |
| | | var _index = 0; |
| | | for (int i = 0; i < _list.Count; i++) |
| | | { |
| | | var _storeConfig = ConfigManager.Instance.GetTemplate<StoreConfig>(_list[i].ID); |
| | | var _limit = model.GetBuyShopLimit((uint)_list[i].ID); |
| | | if (_limit == null || _limit.BuyCnt < _storeConfig.PurchaseNumber[0]) |
| | | { |
| | | _index = i; |
| | | m_OSGifts[i].Display(_list[i].ID); |
| | | break; |
| | | } |
| | | _index = i; |
| | | } |
| | | for (int i = 0; i < m_OSGifts.Length; i++) |
| | | { |
| | | m_OSGifts[i].gameObject.SetActive(_index == i); |
| | | } |
| | | } |
| | | |
| | | private void OnCloseClick() |
| | | { |
| | | CloseImmediately(); |
| | | if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>()) |
| | | { |
| | | WindowCenter.Instance.Open<MainInterfaceWin>(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Thursday, May 10, 2018
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using TableConfig;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI {
|
| | |
|
| | | public class OpenServerGiftWin : Window
|
| | | {
|
| | | [SerializeField] RectTransform m_ContainerDisplay;
|
| | | [SerializeField] Button[] m_CloseBtns;
|
| | | [SerializeField] OSGiftBehaviour[] m_OSGifts;
|
| | |
|
| | | StoreModel m_Model;
|
| | | StoreModel model
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<StoreModel>());
|
| | | }
|
| | | }
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | for (int i = 0; i < m_CloseBtns.Length; i++)
|
| | | {
|
| | | m_CloseBtns[i].onClick.AddListener(OnCloseClick);
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | WindowCenter.Instance.windowAfterOpenEvent += WindowAfterOpenEvent;
|
| | | WindowCenter.Instance.windowAfterCloseEvent += windowAfterCloseEvent;
|
| | | ModelCenter.Instance.GetModel<OSGiftModel>().giftGetNotify = false;
|
| | | model.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
|
| | |
|
| | | Display();
|
| | |
|
| | | m_ContainerDisplay.gameObject.SetActive(!WindowCenter.Instance.CheckOpen<OffLineOnHookWin>());
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | WindowCenter.Instance.windowAfterOpenEvent -= WindowAfterOpenEvent;
|
| | | WindowCenter.Instance.windowAfterCloseEvent -= windowAfterCloseEvent;
|
| | | model.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | | #endregion
|
| | |
|
| | | private void WindowAfterOpenEvent(Window _win)
|
| | | {
|
| | | if(_win is OffLineOnHookWin)
|
| | | {
|
| | | m_ContainerDisplay.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | private void windowAfterCloseEvent(Window _win)
|
| | | {
|
| | | if (_win is OffLineOnHookWin)
|
| | | {
|
| | | m_ContainerDisplay.gameObject.SetActive(true);
|
| | | }
|
| | | }
|
| | |
|
| | | private void RefreshBuyShopLimitEvent()
|
| | | {
|
| | | Display();
|
| | | }
|
| | |
|
| | | private void Display()
|
| | | {
|
| | | List<StoreConfig> _list = null;
|
| | | StoreConfig.TryGetStoreConfigs((int)StoreFunc.OSGift, out _list);
|
| | | var _index = 0;
|
| | | for (int i = 0; i < _list.Count; i++)
|
| | | {
|
| | | var _storeConfig = Config.Instance.Get<StoreConfig>(_list[i].ID);
|
| | | var _limit = model.GetBuyShopLimit((uint)_list[i].ID);
|
| | | if (_limit == null || _limit.BuyCnt < _storeConfig.PurchaseNumber[0])
|
| | | {
|
| | | _index = i;
|
| | | m_OSGifts[i].Display(_list[i].ID);
|
| | | break;
|
| | | }
|
| | | _index = i;
|
| | | }
|
| | | for (int i = 0; i < m_OSGifts.Length; i++)
|
| | | {
|
| | | m_OSGifts[i].gameObject.SetActive(_index == i);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnCloseClick()
|
| | | {
|
| | | CloseImmediately();
|
| | | if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
|
| | | {
|
| | | WindowCenter.Instance.Open<MainInterfaceWin>();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|