コード例 #1
0
        private void DrawComponent(ILegoComponent component)
        {
            var uiRxModel = ScRxModel.GetRxModel(component.ScrollViewId);

            if (uiRxModel == null)
            {
#if DEBUG
                string name = null;
                if (component.UIRect != null)
                {
                    name = component.UIRect.name;
                }
                Debug.LogError("DrawComponent错误,uiRxModel为null:  " + name
                               + "  " + component.ScrollViewId);
#endif
                return;
            }

            LegoBinder.Binding(component, componentMeta, uiRxModel);
            component.SetRxModel(uiRxModel);
            if (uiRxModel.SonComponentModels.Count != 0)
            {
                foreach (var sonComponent in component.SonComponentDict)
                {
                    var              bigId               = sonComponent.Key;
                    var              lowerId             = "";//YuBigAssetIdMap.GetLowerId(bigId);
                    LegoUIMeta       sonComponentMeta    = metaHelper.GetMeta(lowerId);
                    IYuLegoUIRxModel sonComponentRxModel = uiRxModel.SonComponentModels[bigId];

                    LegoBinder.Binding(sonComponent.Value, sonComponentMeta, sonComponentRxModel);
                    sonComponent.Value.SetRxModel(sonComponentRxModel);
                }
            }
            onDrawComponent?.Invoke(component, uiRxModel);
        }