Beispiel #1
0
        public void InstantiateView(DrawMeshViewSourceBase prefab, Entity entity)
        {
            if (prefab == null)
            {
                ViewSourceIsNullException.Throw();
            }

            this.InstantiateView(prefab.GetSource(), entity);
        }
Beispiel #2
0
        public ViewId RegisterViewSource(DrawMeshViewSourceBase prefab)
        {
            if (prefab == null)
            {
                ViewSourceIsNullException.Throw();
            }

            return(this.RegisterViewSource(new UnityDrawMeshProviderInitializer(), prefab.GetSource()));
        }
Beispiel #3
0
        public ViewId RegisterViewSource(UnityGameObjectProviderInitializer providerInitializer, UnityEngine.GameObject prefab)
        {
            if (prefab == null)
            {
                ViewSourceIsNullException.Throw();
            }

            if (prefab.TryGetComponent(out IView component) == true)
            {
                return(this.RegisterViewSource(providerInitializer, component));
            }

            return(ViewId.Zero);
        }
        public static ViewId RegisterViewSource <TProvider>(this ViewsModule viewsModule, TProvider providerInitializer, UnityEngine.AddressableAssets.AssetReference addressablePrefab) where TProvider : struct, IViewsProviderInitializer
        {
            if (addressablePrefab == null)
            {
                ViewSourceIsNullException.Throw();
            }

            #if VIEWS_REGISTER_VIEW_SOURCE_CHECK_STATE
            if (viewsModule.world.HasStep(WorldStep.LogicTick) == true)
            {
                throw new InStateException();
            }
            #endif

            var handle = addressablePrefab.LoadAssetAsync <IView>();
            var prefab = handle.WaitForCompletion();
            return(viewsModule.RegisterViewSource(providerInitializer, prefab));
        }