Beispiel #1
0
        public void SetInfo(BarrageItem info, float distance)
        {
            m_isSlashed = false;
            MovingTime  = 0;
            gameObject.SetActive(true);
            Info = info;
            m_pl_barrage_MakeChildTransparent.Transparent(false);
            HideSubView();
            for (int i = 0; i < info.Items.Count; i++)
            {
                var data = info.Items[i];
                if (i >= m_subViews.Count)
                {
                    PrefabManager.Instance.InstantiateAsync <UI_Judgment_BarrageText_Item_SubView>("UI_Judgment_BarrageText_Item", (
                                                                                                       result =>
                    {
                        if (result.status == RequestStatus.FAIL)
                        {
                            return;
                        }

                        var subView = result.result as UI_Judgment_BarrageText_Item_SubView;
                        subView.Init(subView.GetComponent <RectTransform>());
                        m_subViews.Add(subView);
                        subView.SetInfo(data, info.IsSpecial);
                        LayoutRebuilder.ForceRebuildLayoutImmediate(m_go_container_HorizontalLayoutGroup.rectTransform());
                        LayoutRebuilder.ForceRebuildLayoutImmediate(m_pl_barrage_HorizontalLayoutGroup.rectTransform());
                        if (data.Index == info.CorrectIndex)
                        {
                            var speed = CommonConfig.Data.ControversyBarrageMoveSpeed;
                            m_speed = (distance + subView.transform.position.x - transform.position.x) / speed;
                        }
                    }), m_go_container_ContentSizeFitter.transform);
                    continue;
                }
                m_subViews[i].gameObject.SetActive(true);
                m_subViews[i].SetInfo(data, info.IsSpecial);
                LayoutRebuilder.ForceRebuildLayoutImmediate(m_go_container_HorizontalLayoutGroup.rectTransform());
                LayoutRebuilder.ForceRebuildLayoutImmediate(m_pl_barrage_HorizontalLayoutGroup.rectTransform());
            }

            if (m_isSpecial != info.IsSpecial)
            {
                SetBG();
            }
        }
    public void SetData(SysBulletScreenVo _param)
    {
        if (_param == null)
        {
            return;
        }
        base.gameObject.name = _param.id.ToString();
        this._cfgDataVo      = _param;
        this.content         = LanguageManager.Instance.GetStringById(_param.content);
        BarrageItem component = NGUITools.AddChild(base.transform.FindChild("select").gameObject, Singleton <BarrageEmitterView> .Instance.mItemCache).GetComponent <BarrageItem>();

        BarrageEmitterView.SetFormat(_param.format.ToString(), component);
        component.transform.GetComponent <TweenPosition>().enabled = false;
        component.transform.localPosition = new Vector3(130f, 0f, 0f);
        component.fontSize = 60;
        component.ComposeText(Singleton <BarrageEmitterView> .Instance.barragePrefix, base.transform.Find("label").GetComponent <UILabel>().text);
    }