少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 aecb6a5a62d8a4cfc7b924ce957a9c7ea90c235d
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    public class OSRedEnvelopeCell : CellView
    {
        [SerializeField] RedPackBehaviour[] m_RedEnvelopes;
 
        OSRedEnvelopeModel m_Model;
        OSRedEnvelopeModel model
        {
            get
            {
                return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<OSRedEnvelopeModel>());
            }
        }
 
        public void Init(int _line)
        {
            for (int i = 0; i < m_RedEnvelopes.Length; i++)
            {
                var _index = _line * 5 + i;
                m_RedEnvelopes[i].gameObject.SetActive(_index < model.m_OSRedEnvelopes.Count);
                if (_index < model.m_OSRedEnvelopes.Count)
                {
                    m_RedEnvelopes[i].Init(model.m_OSRedEnvelopes[_index]);
                }
            }
        }
    }
}