public Armor(MaterialType m, ArmorEffectType e, int level) { int strBuff = 0; int dexBuff = 0; int ConBuff = 0; texture = 'A'; if (e == ArmorEffectType.none) { name = m.ToString() + " Armor"; } else if (level < 2) { name = m.ToString() + " Armor of " + e.ToString(); } else { name = m.ToString() + " Armor of " + e.ToString() + " +" + level; } maxStackSize = 1; currentStackSize = 1; value = 10 * level; weight = 20; if (m == MaterialType.Leather) { damageReduct = 5 * level; value -= 5 * level; weight -= 5; } else if (m == MaterialType.Iron) { damageReduct = 10 * level; } else if (m == MaterialType.Steel) { damageReduct = 15 * level; value += 5 * level; weight += 10; } if (e == ArmorEffectType.strength) { strBuff += 1 * level; value += 5 * level; } else if (e == ArmorEffectType.speed) { dexBuff += 1 * level; value += 5 * level; } else if (e == ArmorEffectType.hardening) { ConBuff += 1 * level; value += 5 * level; } }
private string GetMaterialKey(Material source, MaterialType materialType) { if (source.name.Contains("_")) { return(string.Format("{0}_{1}", source.name.Split(new char[] { '_' })[0], materialType.ToString())); } else { return(string.Format("{0}_{1}", source.name, materialType.ToString())); } }
public override string ToString() { string value = type.ToString(); if (NumTags > 1) { value += ":" + (string.IsNullOrEmpty(tag1) ? "*" : tag1); } if (NumTags > 2) { value += ":" + (string.IsNullOrEmpty(tag2) ? "*" : tag2); } return(value); }
private void Start() { hp = 500; effect_Parents = GameObject.Find("TempObject/Decal_" + materialType.ToString() + "_Effects").GetComponent <Transform>(); materialParents = GameObject.Find("EnvManager/MaterialManager").GetComponent <Transform>(); woodPrefab = Resources.Load <GameObject>("Env/WoodMaterial"); stonePrefab = Resources.Load <GameObject>("Env/StoneMaterial"); metalPrefab = Resources.Load <GameObject>("Env/MetalMaterial"); bulletEffect = Resources.Load <GameObject>("Effects/Gun/Bullet Impact FX_" + materialType.ToString()); mark_Texture = Resources.Load <Texture2D>("Gun/BulletMarks/Bullet Decal_" + materialType.ToString()); if (gameObject.name == "Conifer") { main_Texture = (Texture2D)gameObject.GetComponent <MeshRenderer>().materials[2].mainTexture; } else if (gameObject.name == "Broadleaf") { main_Texture = (Texture2D)gameObject.GetComponent <MeshRenderer>().materials[3].mainTexture; } else if (gameObject.name == "Palm") { main_Texture = (Texture2D)gameObject.GetComponent <MeshRenderer>().materials[1].mainTexture; } else { main_Texture = (Texture2D)gameObject.GetComponent <MeshRenderer>().material.mainTexture; } main_Texture_Back = GameObject.Instantiate <Texture2D>(main_Texture); main_Texture_Back_Shoot = GameObject.Instantiate <Texture2D>(main_Texture); gameObject.GetComponent <Renderer>().material.mainTexture = main_Texture_Back_Shoot; markQueue = new Queue <Vector2>(); // 对象池对象 pool = gameObject.GetComponent <ObjectPool>(); if (pool == null) { pool = gameObject.AddComponent <ObjectPool>(); } }
public Furniture(string model, MaterialType materialType, decimal price, decimal height) { this.Model = model; this.Material = materialType.ToString(); this.Price = price; this.Height = height; }
private void searchMaterial(object sender, EventArgs e) { searchOutput.Items.Clear(); SurfaceMaterials MaterialType; string searchInput = SearchBox.SelectedItem.ToString(); Enum.TryParse(searchInput, out MaterialType); try { string QuoteFile = @"C:\Users\Makram\Desktop\quotes.txt"; using (StreamReader sr = new StreamReader(QuoteFile)) { string line; while ((line = sr.ReadLine()) != null) { if (line.Contains(MaterialType.ToString())) { searchOutput.Items.Add(line); } } } } catch (Exception ex) { MessageBox.Show(ex.Message + " Error, can't read the file"); } }
protected Furniture(string model, MaterialType materialType, decimal price, decimal height) { this.Model = model; this.Price = price; this.Height = height; this.Material = materialType.ToString(); }
static XmlElement writeMaterialElement(XmlDocument doc, MaterialType type) { XmlElement elem = doc.CreateElement(type.ToString()); elem.AppendChild(writeTransformationNode(doc, type)); return(elem); }
protected Furnture(string model, MaterialType material, decimal price, decimal height) { this.Model = model; this.Material = material.ToString(); this.Price = price; this.Height = height; }
private void searchByMaterial(object sender, EventArgs e) { searchResults.Items.Clear(); MaterialType MaterialType; string searchInput = materialSearchBox.SelectedItem.ToString(); Enum.TryParse(searchInput, out MaterialType); try { string cFile = @"quotes.txt"; using (StreamReader sr = new StreamReader(cFile)) { string line; while ((line = sr.ReadLine()) != null) { if (line.Contains(MaterialType.ToString())) { searchResults.Items.Add(line); } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "There is a problem"); } }
static void readMaterialElement(XmlElement root, MaterialType type) { XmlElement node = (XmlElement)root.SelectSingleNode(type.ToString()); if (node != null) { readTransformationNode(node, type); } }
public static string GetMaterialName(MaterialType materialType) { var dualDIDs = DatManager.PortalDat.ReadFromDat <DualDidMapper>(MaterialDualDID); if (!dualDIDs.ClientEnumToName.TryGetValue((uint)materialType, out var materialName)) { Console.WriteLine($"RecipeManager.GetMaterialName({materialType}): couldn't find material name"); return(materialType.ToString()); } return(materialName.Replace("_", " ")); }
static public float MaterialHeat(MaterialType material) { if (s_singleton.m_coefficientsOfThermalConductivity.ContainsKey(material)) { return(s_singleton.m_coefficientsOfThermalConductivity[material]); } else { Debug.LogWarning("Attention : Matériel non repertorié (" + material.ToString() + "). Valeur renvoyée : 0"); return(0); } }
private void CreateShader(MaterialType material, ShadingTechnique shadingTechnique, RenderQueue renderQueue) { if (shadingTechnique == ShadingTechnique.Deferred && RenderQueue == RenderQueue.CustomShaderOpaque) { throw new NotSupportedException("CustomOpaque shaders are not supported yet in Deferred Shading mode."); } this.RenderQueue = renderQueue; this.MaterialType = material; this.ShadingTechnique = shadingTechnique; OpenGLShader shader; this._shader = shader = new OpenGLShader(); _shader.Code = GetDefaultShaderCode(); _shader.Code += string.Format("\n#if defined FRAGMENT_SHADER\n{0}\n#endif\n", Resources.StandardShaders); shader.Define(material.ToString()); switch (material) { case MaterialType.FlatColor: case MaterialType.FlatTextureColor: case MaterialType.FlatVertexColor: break; case MaterialType.DiffuseColor: case MaterialType.DiffuseColorTexture: case MaterialType.DiffuseNormalTextureColor: case MaterialType.ReflectionDiffuseColor: case MaterialType.RimDiffuseColorTexture: case MaterialType.RimReflectionDiffuseTextureColor: shader.Flags = ShaderDefines.USE_LIGHTING; break; default: throw new NotSupportedException(material.ToString()); } InitShader(); }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("MaterialType", true, out subEle); subEle.Value = MaterialType.ToString(); ele.TryPathTo("Friction", true, out subEle); subEle.Value = Friction.ToString(); ele.TryPathTo("Restitution", true, out subEle); subEle.Value = Restitution.ToString(); }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("MaterialType", true, out subEle); subEle.Value = MaterialType.ToString(); ele.TryPathTo("OldImpact", true, out subEle); OldImpact.WriteXML(subEle, master); ele.TryPathTo("NewImpact", true, out subEle); NewImpact.WriteXML(subEle, master); }
public void Setup(MaterialType type, List <MyMaterial> materials, ScrollRect parent) { RectTransform content = GetComponent <RectTransform>(); materialType.text = type.ToString(); if (materials != null) { foreach (MyMaterial m_Mat in materials) { var materialPost = Instantiate(materialPostPrefab, content); materialPost.Setup(m_Mat, parent); } } }
/// <summary> /// 获取永久素材列表 /// </summary> /// <param name="materialType">素材类型</param> /// <param name="offset">从全部素材的该偏移位置开始返回,0表示从第一个素材 返回</param> /// <param name="count">返回素材的数量,取值在1到20之间</param> /// <returns></returns> public ApiResult Get(MaterialType materialType, int offset = 0, int count = 20) { //获取api请求url var url = GetAccessApiUrl("batchget_material", ApiName); var data = new { type = materialType.ToString(), offset, count }; if (materialType == MaterialType.news) { return(Post <NewsGetApiResult>(url, data)); } return(Post <OtherMaterialResult>(url, data)); }
public static Material CreateRoadMaterial(MaterialType type, Texture2D texture, Texture2D apr = null, int renderQueue = 2461) { var material = new Material(Shader.Find("Custom/Net/Road")) { name = type.ToString(), mainTexture = texture, color = new Color(1f, 1f, 1f, 1f), renderQueue = renderQueue, }; if (apr != null) { material.SetTexture("_APRMap", apr); } material.EnableKeyword("NET_SEGMENT"); return(material); }
/// <summary> /// 获取永久素材列表,会包含公众号在公众平台官网素材管理模块中新建的图文消息、语音、视频等素材(但需要先通过获取素材列表来获知素材的media_id) ///临时素材无法通过本接口获取 /// </summary> /// <param name="mediaType">素材类型</param> /// <param name="index">从全部素材的指定索引开始返回。0表示从第一个素材返回</param> /// <param name="count">返回素材的数量,取值在1到20之间</param> /// <param name="accessToken">全局票据</param> public static MaterialList GetList(MaterialType mediaType, int index, int count, string accessToken) { if (count < 1 || count > 20) { return(new MaterialList { ErrCode = -2, ErrDescription = "素材的数量,取值在1到20之间" }); } if (index < 0) { return(new MaterialList { ErrCode = -2, ErrDescription = "索引不能小于0" }); } var url = string.Format("https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token={0}", accessToken); var obj = new { type = mediaType.ToString(), offset = index, count = count }; return(Utils.PostResult <MaterialList>(obj, url)); }
private void searchByMaterial(object sender, EventArgs e) { searchResults.Items.Clear(); MaterialType MaterialType; string searchInput = materialSearchBox.SelectedItem.ToString(); Enum.TryParse(searchInput, out MaterialType); try { string cFile = @"quotes.json"; using (StreamReader sr = new StreamReader(cFile)) { string line; //string display; while ((line = sr.ReadLine()) != null) { DeskQuote fromFile = JsonConvert.DeserializeObject <DeskQuote>(line); if (fromFile.Desk.MaterialName == MaterialType.ToString()) { //display = fromFile.CustomerName + ", " + fromFile.QuoteDate.ToString("dd MMMMM yyyy") + ", " // + fromFile.Desk.Width + ", " + fromFile.Desk.Depth + ", " + fromFile.Desk.NumOfDrawers + ", " // + fromFile.Desk.MaterialName + ", " + fromFile.RushDays + ", " + fromFile.QuotePrice; searchResults.Items.Add(new ListViewItem(new[] { fromFile.CustomerName, fromFile.QuoteDate.ToString("dd MMM yyyy"), fromFile.Desk.Width.ToString(), fromFile.Desk.Depth.ToString(), fromFile.Desk.NumOfDrawers.ToString(), fromFile.Desk.MaterialName, fromFile.RushDays.ToString(), fromFile.QuotePrice.ToString() } )); } } } } catch (Exception ex) { MessageBox.Show(ex.Message + "There is a problem"); } }
public DisplayQuote(string customerName, string quoteDate, decimal width, decimal depth, int drawers, MaterialType material, int rushOptions, decimal quotePrice) { InitializeComponent(); customerNameSpot.Text = customerName; quoteDateSpot.Text = quoteDate; widthSpot.Text = width.ToString() + " inches"; depthSpot.Text = depth.ToString() + " inches"; numOfDrawersSpot.Text = drawers.ToString(); materialTypeSpot.Text = material.ToString(); if (rushOptions == 0) { rushOrderSpot.Text = "none"; } else { rushOrderSpot.Text = rushOptions.ToString() + " Days"; } quotePriceSpot.Text = "$" + quotePrice.ToString(); }
internal string[][] GetPropertyArray() { // detect material type: if ((TypeOfRecord == "a" || TypeOfRecord == "t") && (BibliographicLevel == "a" || BibliographicLevel == "c" || BibliographicLevel == "d" || BibliographicLevel == "m")) { materialType = MaterialType.Book; } else if (TypeOfRecord == "m") { materialType = MaterialType.ComputerFile; } else if ((TypeOfRecord == "a") && (BibliographicLevel == "b" || BibliographicLevel == "i" || BibliographicLevel == "s")) { materialType = MaterialType.ContinuingResource; } else if (TypeOfRecord == "e" || TypeOfRecord == "f") { materialType = MaterialType.Map; } else if (TypeOfRecord == "p") { materialType = MaterialType.MixedMaterial; } else if (TypeOfRecord == "c" || TypeOfRecord == "d" || TypeOfRecord == "i" || TypeOfRecord == "j") { materialType = MaterialType.Music; } else if (TypeOfRecord == "g" || TypeOfRecord == "k" || TypeOfRecord == "o" || TypeOfRecord == "r") { materialType = MaterialType.VisualMaterial; } var strList = new[] { new[] { "MaterialType", materialType.ToString() }, }; return(strList); }
/// <summary>Creates material with the specified attributes.</summary> /// <param name="subtitlesStream">Subtitles file stream.</param> /// <param name="imageStream">Image file stream.</param> /// <param name="mimeType">Mime type of image.</param> /// <param name="type">Material type <see cref="MaterialType"/>.</param> /// <param name="name">Name of the material.</param> /// <param name="description">Description of the material.</param> /// <param name="userId">Owner Id.</param> /// <param name="width">Material image width.</param> /// <param name="height">Material image height.</param> /// <returns>Created material by specific attributes.</returns> public Material CreateMaterial(Stream subtitlesStream, Stream imageStream, string mimeType, MaterialType type, string name, string description, int userId, int width, int height) { //TODO: this material exist check var material = new Material { Description = description, Name = name, Type = type, MimeType = mimeType }; using (var streamReader = new StreamReader(subtitlesStream, Encoding.GetEncoding("Windows-1251"))) { var file = new File { Path = userId.ToString(), Filename = name, Extension = type.ToString(), FullName = userId + name + type }; file.Words = _parser.ParseUnigueWordsInFile(file, streamReader); material.File = file; } material.Image = _imageService.CropImage(imageStream, width, height); material.Owner = _accountService.GetByExternalId(userId); return(material); }
/// <summary> /// 上传永久素材(图片(image)、语音(voice)、视频(video)和缩略图(thumb)) /// </summary> /// <param name="file"></param> /// <param name="title"></param> /// <param name="introduction"></param> /// <param name="materialType"></param> /// <param name="timeOut"></param> /// <returns></returns> public UploadForeverMaterialApiResult UploadForeverMaterial(string file, string title, string introduction, MaterialType materialType, int timeOut = 40000) { var url = GetAccessApiUrl("add_material", ApiName, urlParams: new Dictionary <string, string>() { { "type", materialType.ToString() } }); var resultStr = RequestUtility.HttpPost( url, null, null, new Dictionary <string, string> { ["media"] = file, }, encoding: Encoding.UTF8); var result = JsonConvert.DeserializeObject <UploadForeverMaterialApiResult>(resultStr); if (result != null) { result.DetailResult = resultStr; } RefreshAccessTokenWhenTimeOut(result); return(result); }
/// <summary> /// 获取Grid所在节点 /// </summary> /// <param name="mt"></param> /// <param name="areaIndex"></param> /// <returns></returns> public Transform GetGridRoot(MaterialType mt, int areaIndex) { string areaKey = areaIndex.ToString(); var areaTransform = transform.Find(areaKey); // 创建区域节点 if (areaTransform == null) { areaTransform = CreateArea(areaIndex); } // 创建区域材料节点 FieldInfo[] fields = typeof(MaterialType).GetFields(); for (int i = 0; i < fields.Length; i++) { var name = fields[i].Name; if (!name.Equals("value__")) { if (mt.ToString().Equals(name)) { var materialTransform = areaTransform.Find(name); if (materialTransform == null) { GameObject materialGo = new GameObject(); materialGo.name = name; materialGo.transform.parent = areaTransform; materialTransform = materialGo.transform; } return(materialTransform); } } } return(null); }
/// <summary> /// /// </summary> /// <param name="accessToken"></param> /// <param name="materialType">news, image, video, voice</param> /// <returns></returns> public static async Task <BatchGetMaterialsJson> GetAllMaterialsAsync(string accessToken, MaterialType materialType) { var type = materialType.ToString(); var result = new BatchGetMaterialsJson(); var materialCount = await GetMaterialCount(accessToken); var newsCount = materialCount.NewsCount; int callLoopTimes = (int)(((double)newsCount) / 20); for (int i = 0; i < callLoopTimes; i++) { var partialResult = await BatchGetMaterials(accessToken, type, i * 20, 20); result.item.AddRange(partialResult.item); } result.total_count = newsCount; result.item_count = newsCount; return(result); }
//public static BHM.Material FromDatabase(string name) //{ // IDataAdapter database = Instance.Active.GetDatabase<MaterialRow>(DatabaseType.Material); // database.TableName = Instance.Active.Config.MaterialDatabase; // MaterialRow data = (MaterialRow)database.GetDataRow("Name", name); // if (data != null) // { // return FromDataRow(data); // } // return null; //} public static BHM.Material Default(MaterialType type) { return(new Material(type.ToString(), type, 0, 0, 0, 0, 0)); }
public decimal GetQuotePrice() { //Make sure all the variables have a value? or just a try catch block //Find the size of the desk decimal deskSize = Width * Depth; //Create QuotePrice and add each of the price adjustments decimal QuotePrice = BasePrice; //Add the price adjustment for the surface area if (deskSize > 1000) { QuotePrice += (deskSize - 1000) * RateLargeDesk; } //Add the price adjustment for the drawers QuotePrice += (NumDrawers * RatePerDrawer); //Add the price adjustment for the surface material QuotePrice += materialPrices[MaterialType.ToString()]; //Does this work? Putting the string of the Enum as the key in the dictionary? /*switch (MaterialType.ToString()) * { * case "Oak": * QuotePrice += materialPrices["Oak"]; * break; * case "Laminate": * QuotePrice += materialPrices["Laminate"]; * break; * case "Pine": * QuotePrice += materialPrices["Pine"]; * break; * case "Rosewood": * QuotePrice += materialPrices["Rosewood"]; * break; * case "Veneer": * QuotePrice += materialPrices["Veneer"]; * break; * }*/ //Add the price adjustment for the Rush Order //Build the rushOrder prices array string[] file = File.ReadLines(@"rushOrderPrices.txt").ToArray(); decimal[,] prices = new decimal[3, 3]; int x = 0; int y = 0; for (int z = 0; z < file.Length; z++) { prices[y, x] = Convert.ToDecimal(file[z]); x++; if (x == 3) { x = 0; y++; } } Console.WriteLine(prices.ToString()); //Choose the correct part of the array switch ((int)ShippingDays) { case 3: x = 0; break; case 5: x = 1; break; case 7: x = 2; break; case 14: x = 4; break; default: x = 4; break; } if (deskSize < 1000) { y = 0; } else if (deskSize < 2000) { y = 1; } else { y = 2; } if (x < 4) { QuotePrice += prices[y, x]; } return(QuotePrice); //return 0; }
/// <summary> /// 添加一个其他类型的永久素材。 /// </summary> /// <param name="bytes">素材内容。</param> /// <param name="type">素材类型。</param> /// <returns>添加素材的结果模型。</returns> public AddMaterialResultModel AddOther(byte[] bytes, MaterialType type) { return Upload<AddMaterialResultModel>(string.Format("https://api.weixin.qq.com/cgi-bin/material/add_material?access_token={0}", _accountModel.GetAccessToken()), bytes, "media", createBytes => new[] { createBytes.CreateFieldData("type", type.ToString().ToLower()) }); }
public override string ToString() { return(materialType.ToString() + " f:" + faceIndex.ToString() + " i:" + illumination.ToString()); }
/// <summary> /// 添加素材。临时素材的有效时间为3天 /// </summary> /// <param name="filePath">服务器文件的物理路径,可用Request.MapPath将虚拟路径转换为物理路径。也可为网络路径,如:http://XXXX</param> /// <param name="accessToken">调用凭据</param> /// <param name="mediaType">媒体类型枚举</param> /// <param name="IsTemp">是否是临时素材</param> /// <param name="videotitle">永久视频素材标题</param> /// <param name="videointroduction">永久视频素材描述</param> public static UpLoadInfo Add(string filePath, string accessToken, MaterialType mediaType, bool IsTemp = true, string videotitle = "", string videointroduction = "") { try { //临时素材接口 var url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={0}&type={1}"; if (!IsTemp) { //永久素材接口 url = "http://api.weixin.qq.com/cgi-bin/material/add_material?access_token={0}&type={1}"; } var formlist = new List <FormEntity> { new FormEntity { IsFile = true, Name = "media", Value = filePath } }; if (mediaType == MaterialType.video && !IsTemp) { //新增视频素材的特殊处理 var value = JsonConvert.SerializeObject(new { title = videotitle, introduction = videointroduction }); formlist.Add(new FormEntity { IsFile = false, Name = "description", Value = value }); } return(Utils.PostResult <UpLoadInfo>(formlist, string.Format(url, accessToken, mediaType.ToString()))); } catch (Exception e) { return(new UpLoadInfo { ErrCode = -2, ErrDescription = e.Message }); } }