예제 #1
0
        public static IGameSnapshot Snapshot3(ITemplateGroup templates)
        {
            var builder = new TestSnapshotBuilder();

            {
                builder.NewEntity()
                .AddData(new DataEmpty());

                IEntity entity1 = builder.NewEntity()
                                  .AddData(new DataInt()
                {
                    A = 10
                })
                                  .Entity;

                builder.NewEntity()
                .AddData(new DataEmpty())
                .AddData(new DataInt()
                {
                    A = 20
                });

                IEntity entity3 = builder.NewEntity()
                                  .AddData(new DataDataReference()
                {
                    DataReference = CreateDataReference <DataEmpty>(entity1)
                })
                                  .Entity;

                builder.NewEntity()
                .AddData(new DataEntity()
                {
                    Entity = entity3
                });

                IEntity entity5 = builder.Snapshot.CreateEntity();
                entity5.AddData <DataEntity>().Entity = entity5;

                builder.NewEntity()
                .AddData(new DataQueryableEntity()
                {
                    QueryableEntity = entity5
                });

                IEntity entity7 = builder.Snapshot.CreateEntity();
                entity7.AddData <DataQueryableEntity>().QueryableEntity = entity7;
            }

            if (templates.Templates.Count() > 0)
            {
                ITemplate template = templates.Templates.First();

                builder.NewEntity()
                .AddData(new DataDataReference()
                {
                    DataReference = CreateDataReference <DataEmpty>(template)
                });

                builder.NewEntity()
                .AddData(new DataQueryableEntity()
                {
                    QueryableEntity = template
                });
            }

            return(builder.Snapshot);
        }
예제 #2
0
        public static IGameSnapshot Snapshot2(ITemplateGroup templates)
        {
            TestSnapshotBuilder builder = new TestSnapshotBuilder();

            {
                builder.NewEntity();

                builder.NewEntity()
                .AddData(new DataEmpty());

                IEntity entity1 = builder.NewEntity()
                                  .AddData(new DataInt()
                {
                    A = 10
                })
                                  .Entity;

                builder.NewEntity()
                .AddData(new DataEmpty())
                .AddData(new DataInt()
                {
                    A = 20
                });

                builder.NewEntity()
                .AddData(new DataDataReference()
                {
                    DataReference = CreateDataReference <DataEmpty>(entity1)
                });

                builder.NewEntity()
                .AddData <DataNonVersionedInt>(data => data.A = 500);

                builder.NewEntity()
                .AddData(new DataEmpty())
                .AddData <DataNonVersionedInt>(data => data.A = 510);
            }

            {
                builder.NewEntity(GameSnapshot.EntityAddTarget.Active);

                for (int i = 0; i < 5; ++i)
                {
                    builder.NewEntity(GameSnapshot.EntityAddTarget.Active)
                    .AddData(new DataEmpty());

                    builder.NewEntity(GameSnapshot.EntityAddTarget.Active)
                    .AddData(new DataInt {
                        A = 30
                    });

                    builder.NewEntity(GameSnapshot.EntityAddTarget.Active)
                    .AddData(new DataEmpty())
                    .AddData(new DataInt {
                        A = 40
                    });
                }
            }

            {
                builder.NewEntity(GameSnapshot.EntityAddTarget.Removed)
                .AddData(new DataEmpty());

                builder.NewEntity(GameSnapshot.EntityAddTarget.Removed)
                .AddData(new DataInt {
                    A = 70
                });

                builder.NewEntity(GameSnapshot.EntityAddTarget.Removed)
                .AddData(new DataEmpty())
                .AddData(new DataInt()
                {
                    A = 80
                });
            }

            return(builder.Snapshot);
        }