少年修仙传客户端代码仓库
Client_PangDeRong
2018-09-21 d1a2ab5b56bae336a1b5cbc4f307cb67e76c22e6
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]);
                }
            }
        }
    }
}