示例#1
0
        protected override void OnAfterDeserialize()
        {
            if (this.worldsSerialized != null)
            {
                foreach (var t in this.types)
                {
                    var genType = Type.GetType(t);
                    if (genType != null)
                    {
                        var openGeneric   = typeof(CacheTypeIdentifier <>);
                        var closedGeneric = openGeneric.MakeGenericType(genType);
                        var infoFI        = closedGeneric.GetField("info", BindingFlags.Static | BindingFlags.NonPublic);
                        infoFI.GetValue(null);
                    }
                    else
                    {
                        CommonCacheTypeIdentifier.GetID();
                    }
                }

                foreach (var world in this.worldsSerialized)
                {
                    world?.Ctor();
                }

                World.worlds     = this.worldsSerialized;
                this.hotReloaded = true;
            }
        }
示例#2
0
        protected override void OnAfterDeserialize()
        {
            if (this.worldsSerialized != null)
            {
                foreach (var t in this.types)
                {
                    var genType = Type.GetType(t);
                    if (genType != null)
                    {
                        var openGeneric   = typeof(CacheTypeIdentifier <>);
                        var closedGeneric = openGeneric.MakeGenericType(genType);
                        var infoFI        = closedGeneric.GetField("info", BindingFlags.Static | BindingFlags.NonPublic);
                        infoFI.GetValue(null);
                    }
                    else
                    {
                        CommonCacheTypeIdentifier.GetID();
                    }
                }

                foreach (var world in this.worldsSerialized)
                {
                    if (world != null && world.entities != null)
                    {
                        for (int i = 0, length = world.entities.Length; i < length; i++)
                        {
                            var e = world.entities[i];
                            if (e == null)
                            {
                                continue;
                            }

                            if (e.componentsIds == null)
                            {
                                world.entities[i] = null;
                            }
                        }

                        world.Ctor();
                    }
                }

                World.worlds = this.worldsSerialized;
            }
        }