当前位置: 首页>>代码示例>>C#>>正文


C# ModelObject类代码示例

本文整理汇总了C#中ModelObject的典型用法代码示例。如果您正苦于以下问题:C# ModelObject类的具体用法?C# ModelObject怎么用?C# ModelObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModelObject类属于命名空间,在下文中一共展示了ModelObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestFlattering

        public void TestFlattering()
        {
            var source = new ModelObject
            {
                BaseDate = DateTime.Now,
                Sub = new ModelSubObject
                {
                    ProperName = "Some name",
                    SubSub = new ModelSubSubObject
                    {
                        IAmACoolProperty = "Cool daddy-o"
                    }
                },
                Sub2 = new ModelSubObject
                {
                    ProperName = "Sub 2 name"
                },
                SubWithExtraName = new ModelSubObject
                {
                    ProperName = "Some other name"
                },
            };

            var b =Mapper.Map<ModelObject, ModelDto>(source);

            Assert.AreEqual(source.BaseDate, b.BaseDate);
            Assert.AreEqual(source.Sub.ProperName, b.SubProperName);
            Assert.AreEqual(source.Sub2.ProperName, b.Sub2ProperName);
            Assert.AreEqual(source.SubWithExtraName.ProperName, b.SubWithExtraNameProperName);
            Assert.AreEqual(source.Sub.SubSub.IAmACoolProperty, b.SubSubSubIAmACoolProperty);
        }
开发者ID:netcasewqs,项目名称:nlite,代码行数:31,代码来源:Flattering.cs

示例2: TestFlattering

        public void TestFlattering()
        {
            var source = new ModelObject
                {
                    BaseDate = DateTime.Now,
                    Sub = new ModelSubObject
                    {
                        ProperName = "Some name",
                        SubSub = new ModelSubSubObject
                        {
                            IAmACoolProperty = "Cool daddy-o"
                        }
                    },
                    Sub2 = new ModelSubObject
                    {
                        ProperName = "Sub 2 name"
                    },
                    SubWithExtraName = new ModelSubObject
                    {
                        ProperName = "Some other name"
                    },
                };

            var mapper = ObjectMapperManager.DefaultInstance.GetMapper<ModelObject, ModelDto>(
                new FlatteringConfig()
            );

            var b = mapper.Map(source);
        }
开发者ID:antonsamarsky,项目名称:emitmapper-tools,代码行数:29,代码来源:Flattering.cs

示例3: Because_of

 protected override void Because_of()
 {
     var model = new ModelObject
     {
         Child = new SubChildModelObject {ChildProperty = "child property value"}
     };
     _result = Mapper.Map<ModelObject, DtoObject>(model);
 }
开发者ID:garora,项目名称:AutoMapper,代码行数:8,代码来源:InterfaceMapping.cs

示例4: Waffen

 //Controller rausgenommen
 public Waffen(ModelObject MO, int Lebenspunkte, float Schusswinkel, float ShootSpeed, string Waffentyp)
 {
     mo = MO;
     lebenspunkte = Lebenspunkte;
     schusswinkel = Schusswinkel;
     waffentyp = Waffentyp;
     shootspeed = ShootSpeed;
 }
开发者ID:kvowinckel,项目名称:CCC,代码行数:9,代码来源:Waffen.cs

示例5: Parse

        internal static dynamic[] Parse(Stream stream, string key)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            var objects = new List<ModelObject>();

            using (BinaryReader reader = new BinaryReader(stream))
            {
                while (stream.Position < stream.Length)
                {
                    reader.ReadByte();
                    var language = reader.ReadByte();
                    int id = 0x100 * reader.ReadByte() | reader.ReadByte();

                    dynamic entry = new ModelObject();
                    entry.id = id;

                    string name;

                    if ((id & 0xFF) == 0)
                    {
                        var bracket_name_data = reader.ReadBytes(0x20);
                        var name_data = reader.ReadBytes(0x20);
                        var phrases = reader.ReadInt32();
                        var block_size = reader.ReadInt32();

                        var length = 0;
                        for (; name_data[length] != 0x00; ++length);

                        name = ShiftJISFF11Encoding.ShiftJISFF11.GetString(name_data, 0, length);
                    }
                    else
                    {
                        var length = reader.ReadByte();
                        name = ShiftJISFF11Encoding.ShiftJISFF11.GetString(reader.ReadBytes(length), 0, length - 1);

                        if (language == 1)
                        {
                            reader.ReadBytes(reader.ReadByte());
                        }
                    }

                    entry[key] = name;

                    objects.Add(entry);
                }
            }

            return objects.ToArray();
        }
开发者ID:Kinematics,项目名称:ResourceExtractor,代码行数:53,代码来源:ATParser.cs

示例6: AddInstance

 public void AddInstance(ModelObject obj)
 {
     if (obj.MModel != null && obj.MModel != this)
     {
         throw new ModelException("The object "+obj+" is already contained by another model.");
     }
     else
     {
         this.instances.Add(obj);
         obj.MModel = this;
     }
 }
开发者ID:Bubesz,项目名称:meta-cs,代码行数:12,代码来源:ModelContext.cs

示例7: Establish_context

            protected override void Establish_context()
            {
                Mapper.AddFormatter<HardEncoder>();
                Mapper.AddFormatter(new SoftEncoder());
                Mapper.AddFormatter(typeof(RokkenEncoder));
                Mapper.AddFormatExpression(context => context.SourceValue + " Medium");

                Mapper.CreateMap<ModelObject, ModelDto>();

                var modelObject = new ModelObject { Value = 14 };

                _modelDto = Mapper.Map<ModelObject, ModelDto>(modelObject);
            }
开发者ID:JonKruger,项目名称:AutoMapper,代码行数:13,代码来源:CustomFormatters.cs

示例8: createObj

        //private static List<Waffen> waffenListe = new List<Waffen>();
        public static Objekte createObj(int auswahl, Spieler spieler, float xPos, Vector2 rHv2s)
        {
            idnummer++;
            Vector3 startort = new Vector3(xPos, 2, -5);
            SceneObject newobj;
            Objekte dasobj;

            if (auswahl == 1)//Würfel
            {
                newobj = buildbox(startort, new Vector3(0.4f, 0.4f, 0.4f));
                DrawHelper.setmoney(spieler, -150, rHv2s);
                /*spieler.setMoney(spieler.getMoney() - 150); //Rohkosten abziehen
                Gamestart.setShowGeld(-150, 100);           //Kosten visualisieren
                */
                newobj.Physics.Mass = 1f;
            }
            else if (auswahl == 2)
            {
                ModelObject l = new ModelObject(startort, Quaternion.CreateFromAxisAngle(new Vector3(1,2,0),(float)Math.PI), new Vector3(1, 1, 1), CollisionType.ExactMesh, "", "L", 1f);
                l.SubModels[0].RenderMaterial.Diffuse = new Vector4(1, 1, 1, 1);
                l.SubModels[0].RenderMaterial.Specular = new Vector4(0.1f, 0.1f, 0.1f, 1);
                newobj = l;
                DrawHelper.setmoney(spieler, -200, rHv2s);
            }
            else if (auswahl == 3) // Latte
            {
                newobj = buildbox(startort, new Vector3(1.2f, 0.1f, 0.4f));
                DrawHelper.setmoney(spieler, -200, rHv2s);
                newobj.Physics.Mass = 2f;
            }
            else if (auswahl == 4) // Quader       das kommentierte ist die //Pyramide
            {
                newobj = buildbox(startort, new Vector3(0.8f, 0.4f, 0.4f));
                newobj.Physics.Mass = 2f;
                DrawHelper.setmoney(spieler, -200, rHv2s);
            }
            else
            {
                newobj = buildbox(startort, new Vector3(0.1f, 0.1f, 0.1f));
            }

            //TODO z-Achse sperren
            newobj.Physics.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;
            newobj.Tag = idnummer;
            newobj.PhysicsMaterial.Bounciness = 0.2f;
            scene.Add(newobj);
            dasobj = new Objekte(newobj, 1, "blank");
            objListe.Add(dasobj); //Liste hinzufügen
            return dasobj;
        }
开发者ID:kvowinckel,项目名称:CCC,代码行数:51,代码来源:Objektverwaltung.cs

示例9: createObj

        //private static List<Waffen> waffenListe = new List<Waffen>();

        public static Objekte createObj(int auswahl, Spieler spieler, float xPos)
        {
            idnummer++;
            Vector3 startort = new Vector3(xPos, 2, -5);
            SceneObject newobj;
            Objekte dasobj;

            if (auswahl == 1)//Würfel
            {
                newobj = buildbox(startort, new Vector3(0.4f, 0.4f, 0.4f));
                spieler.setMoney(spieler.getMoney() - 150); //Rohkosten abziehen
                newobj.Physics.Mass = 1f;
            }
            else if (auswahl == 2)
            {
                ModelObject l = new ModelObject(startort, Quaternion.CreateFromAxisAngle(new Vector3(1,2,0),(float)Math.PI), new Vector3(1, 1, 1), CollisionType.ExactMesh, "", "L", 2f);
                newobj = l;
                spieler.setMoney(spieler.getMoney() - 200);
            }
            else if (auswahl == 3) // Latte
            {
                newobj = buildbox(startort, new Vector3(1.2f, 0.1f, 0.4f));
                spieler.setMoney(spieler.getMoney() - 200); //Rohkosten abziehen
                newobj.Physics.Mass = 2f;
            }
            else if (auswahl == 4) // Quader       das kommentierte ist die //Pyramide
            {
                newobj = buildbox(startort, new Vector3(0.8f, 0.4f, 0.4f));
                newobj.Physics.Mass = 2f;
                /*ModelObject p = new ModelObject(startort, Quaternion.CreateFromAxisAngle(new Vector3(1, 2, 0), (float)Math.PI), new Vector3(1, 1, 1), CollisionType.ExactMesh, "", "Pyramide", 1f);
                newobj = p;*/
                spieler.setMoney(spieler.getMoney() - 200);
            }
            else
            {
                newobj = buildbox(startort, new Vector3(0.1f, 0.1f, 0.1f));
            }

            //TODO z-Achse sperren
            newobj.Physics.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;
            newobj.Tag = idnummer;
            newobj.PhysicsMaterial.Bounciness = 0.2f;
            scene.Add(newobj);
            dasobj = new Objekte(newobj, 1, "blank");
            objListe.Add(dasobj); //Liste hinzufügen
            return dasobj;
        }
开发者ID:ClemensTechmer,项目名称:Projektpraktikum.Multimedia.CrazyCastleCrush,代码行数:49,代码来源:Objektverwaltung.cs

示例10: LoadStartObjects

        public void LoadStartObjects(int level)
        {
            if (level == 1)
            {
                Scene.ShowTriangleCount = true;
                ModelObject Welt = new ModelObject(new Vector3(0, -1.5f, -5f), Quaternion.Identity, new Vector3(1, 1, 1), CollisionType.ExactMesh, " ", "Welt_xna_rotiert", 0f);
                Welt.PhysicsMaterial.Bounciness = 0.2f;
                Welt.SubModels[0].RenderMaterial.Diffuse = new Vector4(1, 1, 1, 1);
                Welt.SubModels[0].RenderMaterial.Specular = new Vector4(0.1f, 0.1f, 0.1f, 0.1f);

                Welt.Name = "Welt";
                scene.Add(Welt);
                Objektverwaltung.addToUmgebungsListe(Welt);

                //Lädt Spielhintergrund
                LoadBackground("himmel");
            }
        }
开发者ID:kvowinckel,项目名称:CCC,代码行数:18,代码来源:StartObjects.cs

示例11: Parse

        internal static dynamic[] Parse(Stream stream, string key)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            Header header = stream.Read<Header>(0);
            // First valid value was included in the header to get the table size
            stream.Position -= 4;

            if (header.FileSize != stream.Length - 4)
            {
                throw new InvalidOperationException("Data is corrupt.");
            }

            var data = new byte[header.FileSize];
            stream.Read(data, 0, data.Length);
            for (var i = 0; i < data.Length; ++i)
            {
                data[i] ^= 0x80;
            }
            int[] table;
            using (var datastream = new MemoryStream(data))
            {
                table = datastream.ReadArray<int>((int)header.TableSize);
            }

            dynamic objects = new ModelObject[header.TableSize];

            for (var i = 0; i < table.Length; ++i)
            {
                var offset = table[i];
                var length = (int)(i + 1 < table.Length ? table[i + 1] : data.Length) - offset;

                for (; data[offset + length - 1] == 0; --length) ;

                objects[i] = new ModelObject {
                    {key, ShiftJISFF11Encoding.ShiftJISFF11.GetString(data, offset, length)}
                };
            }

            return objects;
        }
开发者ID:smd111,项目名称:ResourceExtractor,代码行数:44,代码来源:DialogParser.cs

示例12: Establish_context

            protected override void Establish_context()
            {
                Mapper.Reset();

                var model = new ModelObject
                {
                    Child = new SubChildModelObject {ChildProperty = "child property value"}
                };

                Mapper.CreateMap<ModelObject, DtoObject>();

                Mapper.CreateMap<IChildModelObject, DtoChildObject>()
                    .Include<SubChildModelObject, SubDtoChildObject>();

                Mapper.CreateMap<SubChildModelObject, SubDtoChildObject>();

                Mapper.AssertConfigurationIsValid();

                _result = Mapper.Map<ModelObject, DtoObject>(model);
            }
开发者ID:paulbatum,项目名称:automapper,代码行数:20,代码来源:InterfaceMapping.cs

示例13: PostProcess

        private static void PostProcess()
        {
            Console.WriteLine("Post-processing parsed data...");

            bool success = false;
            try
            {
                // Add log names for non-english languages
                foreach (var buff in model.buffs)
                {
                    if (buff.ContainsKey("ja"))
                    {
                        buff.jal = buff.ja;
                    }
                }

                // Populate ability recast table with proper names
                foreach (var recast in model.ability_recasts)
                {
                    foreach (var action in model.actions)
                    {
                        if (recast.id == action.recast_id)
                        {
                            recast.en = action.en;
                            recast.ja = action.ja;
                            break;
                        }
                    }
                }

                // Add categories to key items
                var category = "";
                for (var i = model.key_items.Count - 1; i >= 0; --i)
                {
                    dynamic ki = model.key_items[i];
                    if (ki.en.StartsWith("-"))
                    {
                        category = ki.en.Substring(1);
                        model.key_items.Remove(ki);
                    }
                    else
                    {
                        ki.category = category;
                    }
                }

                // Move item descriptions into separate table
                //TODO: Remove when shared resources are implemented
                model.item_descriptions = new List<dynamic> { };
                foreach (var item in model.items)
                {
                    dynamic item_description = new ModelObject();
                    item_description.id = item.id;
                    item_description.en = item.endesc;
                    item_description.ja = item.jadesc;

                    item.endesc = null;
                    item.jadesc = null;

                    model.item_descriptions.Add(item_description);
                }

                // Fill in linked auto-translate names
                foreach (var at in model.auto_translates)
                {
                    if (at.en.StartsWith("@"))
                    {
                        int id = int.Parse(at.en.Substring(2), NumberStyles.HexNumber);

                        string key;
                        switch ((char)at.en[1])
                        {
                        case 'A':
                            key = "zones";
                            break;
                        case 'C':
                            key = "spells";
                            break;
                        case 'J':
                            key = "jobs";
                            break;
                        case 'Y':
                            key = "actions";
                            break;
                        default:
                            throw new InvalidDataException(string.Format("Unknown auto-translate code: {0}", at.en));
                        }

                        dynamic item = null;
                        foreach (var i in model[key])
                        {
                            if (i.id == id)
                            {
                                item = i;
                                break;
                            }
                        }

                        if (item != null)
                        {
//.........这里部分代码省略.........
开发者ID:smd111,项目名称:ResourceExtractor,代码行数:101,代码来源:Program.cs

示例14: Should_throw_a_mapping_exception

        public void Should_throw_a_mapping_exception()
        {
            var model = new ModelObject();
            model.NullableDate = "Lorem Ipsum";

            typeof(AutoMapperMappingException).ShouldBeThrownBy(() => Mapper.Map<ModelObject, ModelDto>(model));
        }
开发者ID:ouyh18,项目名称:LtePlatform,代码行数:7,代码来源:General.cs

示例15: PrintScope

 private static void PrintScope(string indent, ModelObject scope)
 {
     foreach (var entry in scope.MChildren)
     {
         Console.WriteLine(indent + entry);
         if (entry.IsMetaScope())
         {
             PrintScope(indent + "  ", entry);
         }
     }
 }
开发者ID:Bubesz,项目名称:meta-cs,代码行数:11,代码来源:Program.cs


注:本文中的ModelObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。