少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
142
143
144
145
146
147
148
149
150
151
152
153
154
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, October 30, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
using EnhancedUI.EnhancedScroller;
 
namespace vnxbqy.UI
{
 
    public class FeatureNotice2Win : Window,SecondWindowInterface
    {
        [SerializeField] ScrollerController m_ScrollerController;
        [SerializeField] ScaleTween m_ScaleTween;
        FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
        public int Offset = 0;//偏移
        private bool IsJump = false;
 
        public Button close { get; set; }
        #region Built-in
        protected override void BindController()
        {
            if (this is SecondWindowInterface)
            {
                var frame = this.GetComponentInChildren<SecondFrameLoader2>();
                frame.Create();
                close = frame.GetComponentInChildren<Button>();
            }
        }
 
        protected override void AddListeners()
        {
            m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
            close.AddListener(OnClickBtn);
        }
 
        protected override void OnPreOpen()
        {
            UnopenedFirst();
            m_ScaleTween.SetStartState();
            IsJump = WindowJumpMgr.Instance.IsJumpState;
            OnCreateGridLineCell(m_ScrollerController);
        }
 
        protected override void OnAfterOpen()
        {
            if (!IsJump)//是否经历跳转打开
            {
                m_ScaleTween.Play();
            }
            else
            {
                m_ScaleTween.SetEndState();
            }
            featureNoticeModel.UpdateAwarfItem += UpdateAwarfItem;
        }
 
        private void UpdateAwarfItem()
        {
            m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
            featureNoticeModel.UpdateAwarfItem -= UpdateAwarfItem;
        }
        protected override void OnActived()
        {
            var offset = 0f;
            m_ScrollerController.JumpIndex(JumpIndex(), ref offset);
            m_ScrollerController.JumpIndex(Offset + offset, 0, EnhancedScroller.TweenType.immediate);
        }
        private void OnClickBtn()
        {
            if (!WindowJumpMgr.Instance.IsJumpState)//是否经历跳
            {
                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;
            FeaturesType3 featuresType3 = cell.GetComponent<FeaturesType3>();
            featuresType3.GetTheFeatureID(funcId);
 
        }
        private void IsClose()
        {
            Close();
            WindowCenter.Instance.Open<MainInterfaceWin>();
        }
        private void UnopenedFirst()            ///找到第一个不是打开状态的细胞的的openNumber
        {
            int index = 0;
            foreach (var config in featureNoticeModel.FunctionList)
            {
                int openTag = config.FuncId;
                if (!FuncOpen.Instance.IsFuncOpen(openTag))
                {
                    featureNoticeModel.FunctionForecastIndex = index;
                    return;
                }
                index++;
            }
        }
 
        private int JumpIndex()//Jump选中
        {
            int Index = 0;
            for (int i = 0; i < featureNoticeModel.FunctionList.Count; i++)
            {
                int funcID = featureNoticeModel.FunctionList[i].FuncId;
                if (featureNoticeModel.DicRedPoint.ContainsKey(funcID) && featureNoticeModel.DicRedPoint[funcID].state==RedPointState.Simple)
                {
                    Index = i;
                    return Index;
                }
            }
            Index = featureNoticeModel.FunctionForecastIndex;
            if (Index == -1)
            {
                Index = 0;
            }
            return Index;
        }
        #endregion
 
    }
 
}