Пример #1
0
    public void SetData(string id, ActivityCapsuleTemplateModel model, bool isClearPre)
    {
        _isClearPre = isClearPre;

        ActivityCapsuleStoryRule rule = model.GetStoryRule(id);

        _data = rule;
        if (_data == null)
        {
            return;
        }
        long curTime = ClientTimer.Instance.GetCurrentTimeStamp();

        //Debug.Log("openTime:"+ _data.data.OpenTime + " curTime:"+curTime);
        _contentText.text = "剧情" + rule.index;
        if (curTime < _data.data.OpenTime)
        {
            _btnBg.interactable = false;
            _openObj.Hide();
            _lockObj.Show();
            _bg.texture    = null;
            _bg.color      = new Color(0.9f, 0.9f, 0.9f, 1);
            _lockText.text = I18NManager.Get("ActivityCapsuleTemplate_storyOpenTips", DateUtil.GetYMDD(_data.data.OpenTime));
        }
        else
        {
            _btnBg.interactable = true;
            _bg.texture         = ResourceManager.Load <Texture>("ActivityCapsuleTemplate/story_" + _data.index);
            _openObj.Show();
            _lockObj.Hide();

            if (!isClearPre)
            {
                _redPoint.Hide();
            }
            else
            {
                _redPoint.SetActive(!model.IsReadStory(id));
            }
        }
    }
    public void SetData(ActivityCapsuleTemplateModel model)
    {
        var prefab = GetPrefab("ActivityCapsuleTemplate/Prefabs/ActivityCapsuleTemplateStoryItem");

        ClearItems();
        //for (int i = 0; i < 10; ++i)
        //{
        //    GameObject go = Instantiate(prefab, _storyListGrid, false);
        //}

        bool lastIsClear = true;

        for (int i = 0; i < model.storyIds.Count; ++i)
        {
            GameObject go = Instantiate(prefab, _storyListGrid, false);
            ActivityCapsuleTemplateStoryItem item = go.GetComponent <ActivityCapsuleTemplateStoryItem>();
            item.SetData(model.storyIds[i], model, lastIsClear);
            lastIsClear = model.IsReadStory(model.storyIds[i]);
            _itemList.Add(item);
        }
    }