• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MaterialType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CosntructionRequestCantBeNull

        public void CosntructionRequestCantBeNull()
        {
            var offer = new MaterialType[] { MaterialType.Brick };
            var player = new Mock<IPlayer>();

            Assert.Throws<ArgumentNullException>(() => new Trade(offer, null, player.Object));
        }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:TradeTest.cs


示例2: ConstructionOfferCantBeNull

        public void ConstructionOfferCantBeNull()
        {
            var request = new MaterialType[] { MaterialType.Brick };
            var player = new Mock<IPlayer>();

            Assert.Throws<ArgumentNullException>(() => new Trade(null, request, player.Object));
        }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:TradeTest.cs


示例3: ConstructionPlayerCantBeNull

        public void ConstructionPlayerCantBeNull()
        {
            var request = new MaterialType[] { MaterialType.Lumber };
            var offer = new MaterialType[] { MaterialType.Wool };

            Assert.Throws<ArgumentNullException>(() => new Trade(offer, request, null));
        }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:TradeTest.cs


示例4: Create

 public static Material Create(string description, MaterialType type, HttpPostedFileBase file, BaseDbContext db)
 {
     if (!type.Match(file))
         return null;
     string uploadFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(file.FileName);
     string absolutFileName;
     switch (type)
     {
         case MaterialType.Identity:
             absolutFileName = HttpContext.Current.Server.MapPath("~/UserUpload/") + "Identity/" + uploadFileName;
             break;
         case MaterialType.Avatar:
             absolutFileName = HttpContext.Current.Server.MapPath("~/UserUpload/") + "Avatar/" + uploadFileName;
             break;
         default:
             absolutFileName = HttpContext.Current.Server.MapPath("~/UserUpload/") + "Administrator/" + uploadFileName;
             break;
     }
     //执行上传
     if (File.Exists(absolutFileName))
     {
         File.Delete(absolutFileName);
     }
     file.SaveAs(absolutFileName);
     Material material = new Material(uploadFileName, description, type);
     //添加Material记录
     db.Materials.Add(material);
     //保存更改
     db.SaveChanges();
     return db.Materials.Find(material.Id);
 }
开发者ID:Pyuuma,项目名称:SITE,代码行数:31,代码来源:MaterialModels.cs


示例5: Tile

 public Tile(int x, int y, int number, MaterialType material)
 {
     X = x;
     Y = y;
     Number = number;
     Rawmaterial = material;
 }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:Tile.cs


示例6: FarmTest

        public void FarmTest(MaterialType type)
        {
            var tile = new Tile(1, 2, 3, type);
            IRawMaterial material = tile.Farm();

            Assert.Equal(type, material.Type);
        }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:TileTest.cs


示例7: Table

 public Table(string model, MaterialType initialMaterial, decimal price, decimal height, 
     decimal initalLength, decimal initialWidth)
     : base(model, initialMaterial, price, height)
 {
     this.Length = initalLength;
     this.Width = initialWidth;
 }
开发者ID:Borayvor,项目名称:TelerikAcademy,代码行数:7,代码来源:Table.cs


示例8: Furniture

 public Furniture(string initialModel, MaterialType initialMaterialType, decimal initialPrice, decimal initialHeight)
 {
     this.Model = initialModel;
     this.materialType = initialMaterialType;
     this.Price = initialPrice;
     this.Height = initialHeight;
 }
开发者ID:IvanPanchev,项目名称:TelerikAcademy,代码行数:7,代码来源:Furniture.cs


示例9: fillSchemesMap

	public static void fillSchemesMap () {
		schemesMaterials = new Dictionary<WorkbenchSchemeType, MaterialType[]>();

		MaterialType[] materials = new MaterialType[2];
		materials[0] = MaterialType.STEEL_BAR;
		materials[1] = MaterialType.WOOD_STICK;
		schemesMaterials.Add(WorkbenchSchemeType.IRON_DAGGER, materials);

		materials = new MaterialType[3];
		materials[0] = MaterialType.STEEL_BAR;
		materials[1] = MaterialType.STEEL_BAR;
		materials[2] = MaterialType.WOOD_STICK;
		schemesMaterials.Add(WorkbenchSchemeType.IRON_SWORD, materials);

		materials = new MaterialType[3];
		materials[0] = MaterialType.STEEL_BAR;
		materials[1] = MaterialType.WOOD_STICK;
		materials[2] = MaterialType.WOOD_STICK;
		schemesMaterials.Add(WorkbenchSchemeType.IRON_AXE, materials);

		materials = new MaterialType[4];
		materials[0] = MaterialType.STEEL_BAR;
		materials[1] = MaterialType.STEEL_BAR;
		materials[2] = MaterialType.STEEL_BAR;
		materials[3] = MaterialType.STEEL_BAR;
		schemesMaterials.Add(WorkbenchSchemeType.STEEL_ARMOR, materials);
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:27,代码来源:WorkbenchSchemeType.cs


示例10: Furniture

 protected Furniture(string model, decimal price, decimal height, MaterialType material)
 {
     this.Model = model;
     this.Price = price;
     this.Height = height;
     this.material = material;
 }
开发者ID:reminchev,项目名称:SoftUni-Projects,代码行数:7,代码来源:Furniture.cs


示例11: ETool

 public ETool()
 {
     _processSpd = 0.0f;
     _swingType = SwingType.Dig;
     _materialType = MaterialType.Wood;
     _maxRange = 0;
 }
开发者ID:chozandrias76,项目名称:Pangolin-Source-Code,代码行数:7,代码来源:ETool.cs


示例12: Furniture

 protected Furniture(string model, MaterialType type, decimal price, decimal height)
 {
     this.Model = model;
     this._type = type;
     this.Price = price;
     this.Height = height;
 }
开发者ID:dhristoskov,项目名称:HighQualityCode,代码行数:7,代码来源:Furniture.cs


示例13: Table

 public Table(string model, MaterialType material, decimal price, decimal height, decimal length, decimal width) 
     : base(model, material, price, height)
 {
     this.width = width;
     this.length = length;
     this.Area = this.Length*this.Width;
 }
开发者ID:StanislavBozhilov,项目名称:SoftwareUniversity,代码行数:7,代码来源:Table.cs


示例14: ConstructionCantTradeSeaAndDessert

        public void ConstructionCantTradeSeaAndDessert(MaterialType[] request, MaterialType[] offer)
        {
            var player = new Mock<IPlayer>();

            Assert.Throws<ArgumentException>(() => new Trade(offer, request, player.Object));

        }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:TradeTest.cs


示例15: Furniture

 public Furniture(string model, MaterialType materialType, decimal price, decimal height)
 {
     this.Model = model;
     this.Price = price;
     this.material = materialType;
     this.height = height;
 }
开发者ID:alex687,项目名称:SoftUni-Homeworks,代码行数:7,代码来源:Furniture.cs


示例16: TextureFromVertices

        public Texture2D TextureFromVertices(Vertices vertices, MaterialType type, Color color, float materialScale)
        {
            // copy vertices
            Vertices verts = new Vertices(vertices);

            // scale to display units (i.e. pixels) for rendering to texture
            Vector2 scale = ConvertUnits.ToDisplayUnits(Vector2.One);
            verts.Scale(ref scale);

            // translate the boundingbox center to the texture center
            // because we use an orthographic projection for rendering later
            AABB vertsBounds = verts.GetCollisionBox();
            verts.Translate(-vertsBounds.Center);

            List<Vertices> decomposedVerts;
            if (!verts.IsConvex())
            {
                decomposedVerts = EarclipDecomposer.ConvexPartition(verts);
            }
            else
            {
                decomposedVerts = new List<Vertices>();
                decomposedVerts.Add(verts);
            }
            List<VertexPositionColorTexture[]> verticesFill =
                new List<VertexPositionColorTexture[]>(decomposedVerts.Count);

            materialScale /= _materials[type].Width;

            for (int i = 0; i < decomposedVerts.Count; ++i)
            {
                verticesFill.Add(new VertexPositionColorTexture[3 * (decomposedVerts[i].Count - 2)]);
                for (int j = 0; j < decomposedVerts[i].Count - 2; ++j)
                {
                    // fill vertices
                    verticesFill[i][3 * j].Position = new Vector3(decomposedVerts[i][0], 0f);
                    verticesFill[i][3 * j + 1].Position = new Vector3(decomposedVerts[i].NextVertex(j), 0f);
                    verticesFill[i][3 * j + 2].Position = new Vector3(decomposedVerts[i].NextVertex(j + 1), 0f);
                    verticesFill[i][3 * j].TextureCoordinate = decomposedVerts[i][0] * materialScale;
                    verticesFill[i][3 * j + 1].TextureCoordinate = decomposedVerts[i].NextVertex(j) * materialScale;
                    verticesFill[i][3 * j + 2].TextureCoordinate = decomposedVerts[i].NextVertex(j + 1) * materialScale;
                    verticesFill[i][3 * j].Color =
                        verticesFill[i][3 * j + 1].Color = verticesFill[i][3 * j + 2].Color = color;
                }
            }

            // calculate outline
            VertexPositionColor[] verticesOutline = new VertexPositionColor[2 * verts.Count];
            for (int i = 0; i < verts.Count; ++i)
            {
                verticesOutline[2 * i].Position = new Vector3(verts[i], 0f);
                verticesOutline[2 * i + 1].Position = new Vector3(verts.NextVertex(i), 0f);
                verticesOutline[2 * i].Color = verticesOutline[2 * i + 1].Color = Color.Black;
            }

            Vector2 vertsSize = new Vector2(vertsBounds.UpperBound.X - vertsBounds.LowerBound.X,
                                            vertsBounds.UpperBound.Y - vertsBounds.LowerBound.Y);
            return RenderTexture((int)vertsSize.X, (int)vertsSize.Y,
                                 _materials[type], verticesFill, verticesOutline);
        }
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:60,代码来源:AssetCreator.cs


示例17: InitialTileShouldBeDesert

        public void InitialTileShouldBeDesert(MaterialType type)
        {
            var tile = new Mock<ITile>();
            tile.Setup(t => t.Rawmaterial).Returns(type);

            Assert.Throws<ArgumentException>(() => new Robber(tile.Object));
        }
开发者ID:Corne,项目名称:VOC,代码行数:7,代码来源:RobberTest.cs


示例18: Furniture

 protected Furniture(string model, MaterialType materialType, decimal price, decimal height)
 {
     this.Model = model;
     this.Price = price;
     this.Height = height;
     this.Material = materialType.ToString();
 }
开发者ID:deyantodorov,项目名称:TelerikAcademy,代码行数:7,代码来源:Furniture.cs


示例19: GetNotCulledObjectsList

        public override List<IObject> GetNotCulledObjectsList(MaterialType? Filter, CullerComparer CullerComparer = CullerComparer.None, Vector3? CameraPosition = null)
        {         
                switch (CullerComparer)
                {
                    case CullerComparer.ComparerFrontToBack:
                        System.Diagnostics.Debug.Assert(CameraPosition.HasValue);
                        ComparerFrontToBack.CameraPosition = CameraPosition.Value;
                        forward.Sort(ComparerFrontToBack);
                        deferred.Sort(ComparerFrontToBack);
                        break;
                    case CullerComparer.ComparerBackToFront:
                        System.Diagnostics.Debug.Assert(CameraPosition.HasValue);
                        ComparerBackToFront.CameraPosition = CameraPosition.Value;
                        forward.Sort(ComparerBackToFront);
                        deferred.Sort(ComparerBackToFront);
                        break;
                    default:
                        break;
                }

            if (Filter == PloobsEngine.Material.MaterialType.DEFERRED)
                return deferred.ToList();
            else if (Filter == PloobsEngine.Material.MaterialType.FORWARD)
                return forward.ToList();
            else
            {
                List<IObject> objs = new List<IObject>();
                objs.AddRange(deferred);
                objs.AddRange(forward);
                return objs;
            }
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:32,代码来源:SimpleCuller.cs


示例20: AddChilds

        public void AddChilds(MaterialCategoryObject materialCategory)
        {
            try
            {
                Revision blRev = new Revision();
                MaterialType bl = new MaterialType();
                materialCategory.Types = bl.GetByCategory(materialCategory);
                materialCategory.Revisions = blRev.GetByMaterialCategory(materialCategory);
                foreach (MaterialTypeObject materialType in  materialCategory.Types)
                {
                    materialType.SubTypes = new MaterialSubType().GetSubTypesByType(materialType);
                    materialType.Revisions = blRev.GetByMaterialType(materialType);
                    materialType.ChildsAdded = true;
                    foreach (MaterialSubTypeObject materialSubType in materialType.SubTypes)
                    {
                        materialSubType.Revisions = blRev.GetByMaterialSubType(materialSubType);
                        materialSubType.ChildsAdded = true;
                    }

                }
                materialCategory.ChildsAdded = true;
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
开发者ID:GianiWVL,项目名称:VUYLSTEKE,代码行数:28,代码来源:MaterialCategory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MathIdentifier类代码示例发布时间:2022-05-24
下一篇:
C# MaterialProperty类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap