少年修仙传客户端代码仓库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, October 30, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TableConfig;
using EnhancedUI.EnhancedScroller;
 
namespace Snxxz.UI
{
 
    public class FeatureNotice2Win : Window
    {
 
        [SerializeField] ScrollerController m_ScrollerController;
        [SerializeField] Button m_CloseButton;
        [SerializeField] FeatureNoticeTip m_FeatureNoticeTip;
        [SerializeField] ScaleTween m_ScaleTween;
        FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
        private bool IsJump = false;
        #region Built-in
        protected override void BindController()
        {
            m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
        }
 
        protected override void AddListeners()
        {
            m_CloseButton.AddListener(OnClickBtn);
        }
 
        protected override void OnPreOpen()
        {
            UnopenedFirst();
            m_ScaleTween.SetStartState();
            IsJump = WindowJumpMgr.Instance.IsJumpState;
            m_FeatureNoticeTip.Init();
            OnCreateGridLineCell(m_ScrollerController);
        }
 
        protected override void OnAfterOpen()
        {
            if (!IsJump)//是否经历跳转打开
            {
                m_ScaleTween.Play(false, IsOpen);
            }
            else
            {
                m_ScaleTween.SetEndState();
            }
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
        }
 
        private void OnClickBtn()
        {
            if (!WindowJumpMgr.Instance.IsJumpState)//是否经历跳
            {
                m_FeatureNoticeTip.FeatureNoticeTipObj.SetActive(true);
                m_ScaleTween.Play(true, IsClose);
            }
            else
            {
                Close();
                WindowCenter.Instance.Open<MainInterfaceWin>();
            }
        }
        void OnCreateGridLineCell(ScrollerController gridCtrl)
        {
            gridCtrl.Refresh();
            for (int i = 0; i < featureNoticeModel.FunctionList.Count; i++)
            {
                gridCtrl.AddCell(ScrollerDataType.Header, featureNoticeModel.FunctionList[i].FuncId);
            }
            gridCtrl.Restart();
        }
        private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
        {
            int funcId = cell.index;
            Transform Tran = cell.transform;
            GameObject Tran1 = Tran.Find("FeaturesTypeOne").gameObject;
            GameObject Tran2 = Tran.Find("FeaturesTypeTwo").gameObject;
            if (funcId == featureNoticeModel.FunctionForecastIndex)
            {
               
                Tran1.SetActive(false);
                Tran2.SetActive(true);
                FeaturesType3 featuresType3 = Tran2.GetComponent<FeaturesType3>();
                featuresType3.GetTheFeatureID(funcId);
                return;
            }
            else
            {
                Tran1.SetActive(true);
                Tran2.SetActive(false);
                FeaturesType3 featuresType3 = Tran1.GetComponent<FeaturesType3>();
                featuresType3.GetTheFeatureID(funcId);
                return;
            }
 
        }
        private void IsOpen()
        {
            m_FeatureNoticeTip.FeatureNoticeTipObj.SetActive(false);
        }
        private void IsClose()
        {
            Close();
            WindowCenter.Instance.Open<MainInterfaceWin>();
        }
 
        private void UnopenedFirst()
        {
            var configs = Config.Instance.GetAllValues<FunctionForecastConfig>();
            foreach (var config in configs)
            {
                int openTag = config.FuncId;
                if (!FuncOpen.Instance.IsFuncOpen(openTag))
                {
                    featureNoticeModel.FunctionForecastIndex = config.OpenNumber;
                    return;
                }
            }
        }
 
        #endregion
 
    }
 
}