private static Texture2D Load(string texfile) { if (!outUtil.Exists(texfile)) { return(null); } Texture2D tex = null; LogUtil.Debug("load tex:", texfile); try { tex = outUtil.LoadTexture(texfile); // サイズ変更 if (tex.width <= 1 || tex.height <= 1) { TextureScale.Point(tex, IMG_WIDTH, IMG_HEIGHT); } else { TextureScale.Bilinear(tex, IMG_WIDTH, IMG_HEIGHT); } } catch (Exception e) { LogUtil.Debug(e); } return(tex); }
// Token: 0x060001A5 RID: 421 RVA: 0x0000FC7C File Offset: 0x0000DE7C public bool Write(ACCMaterial target, string mateText, int apply) { using (StringReader stringReader = new StringReader(mateText)) { FileUtilEx instance = FileUtilEx.Instance; stringReader.ReadLine(); Material material = target.material; stringReader.ReadLine(); stringReader.ReadLine(); string text = stringReader.ReadLine(); stringReader.ReadLine(); if ((apply & MateHandler.MATE_SHADER) > 0 && material.shader.name != text) { target.ChangeShader(text, -1); } ShaderType type = target.type; string text2 = stringReader.ReadLine(); List <string> list = new List <string>(); while (text2 != null) { if (text2.Length != 0 && text2[0] != '\t') { list.Clear(); string text3 = text2.Trim(); while ((text2 = stringReader.ReadLine()) != null) { if (text2.Length != 0) { if (text2[0] != '\t') { break; } string text4 = text2.Trim(); if (text4.Length > 0) { list.Add(text4); } } } string a; if (list.Count != 0 && (a = text3) != null) { if (!(a == "tex")) { if (!(a == "col") && !(a == "vec")) { if (a == "f") { if ((apply & MateHandler.MATE_FLOAT) > 0 && list.Count >= 2) { string text5 = list[0]; ShaderProp shaderProp = type.GetShaderProp(text5); float value; if (shaderProp == null) { LogUtil.Log(new object[] { "シェーダに対応していないプロパティのためスキップします.propName=", text5 }); } else if (!float.TryParse(list[1], out value)) { LogUtil.Log(new object[] { "指定文字列はfloatに変換できません。スキップします。propName={0}, text={1}", text5, list[1] }); } else { material.SetFloat(shaderProp.propId, value); LogUtil.DebugF("float set({0})", new object[] { text5 }); } } } } else if ((apply & MateHandler.MATE_COLOR) > 0 && list.Count >= 2) { string text6 = list[0]; ShaderProp shaderProp2 = type.GetShaderProp(text6); if (shaderProp2 == null) { LogUtil.Log(new object[] { "シェーダに対応していないプロパティのためスキップします.propName=", text6 }); } else { float[] array = this.ParseVals(list[1], text6, 4); if (array != null) { Color value2 = new Color(array[0], array[1], array[2], array[3]); material.SetColor(shaderProp2.propId, value2); LogUtil.DebugF("color set ({0})", new object[] { text6 }); } } } } else if ((apply & MateHandler.MATE_TEX) > 0) { if (list.Count == 2) { if (list[1] == "null") { material.SetTexture(list[0], null); } } else if (list.Count < 5) { string text7 = string.Empty; if (list.Count >= 1) { text7 = "propName=" + list[0]; } LogUtil.Log(new object[] { "指定パラメータが不足しているためtexの適用をスキップします.", text7 }); } else { string text8 = list[0]; string text9 = list[2]; ShaderProp shaderProp3 = type.GetShaderProp(text8); if (shaderProp3 == null) { LogUtil.Log(new object[] { "シェーダに対応していないプロパティのためスキップします.propName=", text8 }); } else { Texture texture = material.GetTexture(shaderProp3.propId); if (texture == null || texture.name != text9) { if (!text9.ToLower().EndsWith(FileConst.EXT_TEXTURE, StringComparison.Ordinal)) { text9 += FileConst.EXT_TEXTURE; } if (!instance.Exists(text9)) { LogUtil.LogF("tex({0}) not found. (propName={1})", new object[] { text9, text8 }); continue; } Texture2D value3 = instance.LoadTexture(text9); material.SetTexture(shaderProp3.propId, value3); } float[] array2 = this.ParseVals(list[4], text8, 4); if (array2 == null) { LogUtil.DebugF("tex({0}) prop is null", new object[] { text9 }); } else { material.SetTextureOffset(shaderProp3.propId, new Vector2(array2[0], array2[1])); material.SetTextureScale(shaderProp3.propId, new Vector2(array2[2], array2[3])); LogUtil.DebugF("tex({0}) loaded to {1}", new object[] { text9, shaderProp3.keyName }); } } } } } } else { text2 = stringReader.ReadLine(); } } } return(true); }