// Token: 0x060003B6 RID: 950 RVA: 0x00020F44 File Offset: 0x0001F144 public bool Load() { if (this.PresetPath == null) { return(false); } this.presetCodes.Clear(); this.presetIcons.Clear(); bool result = false; Texture2D texture2D = ColorPresetManager.PresetEmptyIcon; if (File.Exists(this.PresetPath)) { try { string text = File.ReadAllText(this.PresetPath, Encoding.UTF8); string[] array = text.Split(new char[] { ',' }); foreach (string text2 in array) { string text3 = text2.Trim(); Color color = ColorPicker.GetColor(text3); Texture2D texture2D3; if (color.a > 0f) { this.presetCodes.Add(text3); Texture2D texture2D2 = ColorPresetManager.PresetBaseIcon; texture2D3 = new Texture2D(texture2D2.width, texture2D2.height, texture2D2.format, false); this.SetTexColor(ref color, texture2D2, texture2D3); } else { this.presetCodes.Add(string.Empty); texture2D3 = this.CreateEmpty(); } this.presetIcons.Add(texture2D3); if (this.presetIcons.Count >= this.Count) { break; } } result = true; } catch (Exception ex) { LogUtil.Error(new object[] { "カラープリセットのロードに失敗しました。", this.PresetPath, ex }); } } for (int j = this.presetIcons.Count; j < this.Count; j++) { Texture2D texture2D4 = new Texture2D(texture2D.width, texture2D.height, texture2D.format, false); texture2D4.SetPixels32(texture2D.GetPixels32(0), 0); texture2D4.Apply(); this.presetIcons.Add(texture2D4); this.presetCodes.Add(string.Empty); } return(result); }
// Token: 0x06000347 RID: 839 RVA: 0x0001AD6C File Offset: 0x00018F6C public void Show(bool reload) { GUILayout.BeginVertical(new GUILayoutOption[0]); try { //ACCMaterialsView.<>c__DisplayClass4 CS$<>8__locals1 = new ACCMaterialsView.<>c__DisplayClass4(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); try { GUIContent content = this.expand ? ACCMaterialsView.MinusIcon : ACCMaterialsView.PlusIcon; if (GUILayout.Button(content, ACCMaterialsView.bStyleLeft, new GUILayoutOption[] { ACCMaterialsView.optUnitHeight, ACCMaterialsView.optIconWidth })) { this.expand = !this.expand; } if (GUILayout.Button(this.edited.name, ACCMaterialsView.bStyleLeft, new GUILayoutOption[] { ACCMaterialsView.optUnitHeight })) { this.expand = !this.expand; } if (!this.expand) { return; } } finally { GUILayout.EndHorizontal(); } if (this.edited.type == ShaderType.UNKNOWN) { GUILayout.Label("shader: " + this.edited.material.shader.name, new GUILayoutOption[0]); } else { GUILayout.BeginHorizontal(new GUILayoutOption[0]); try { if (GUILayout.Button(ACCMaterialsView.CopyIcon, new GUILayoutOption[] { ACCMaterialsView.optUnitHeight, ACCMaterialsView.optButonWidthS })) { ACCMaterialsView.clipHandler.SetClipboard(MateHandler.Instance.ToText(this.edited)); if (this.tipsCall != null) { this.tipsCall("マテリアル情報をクリップボードに\nコピーしました"); } } GUI.enabled &= ACCMaterialsView.clipHandler.isMateText; GUIContent[] array = ACCMaterialsView.PasteIcons; if (GUILayout.Button(array[0], new GUILayoutOption[] { ACCMaterialsView.optUnitHeight, ACCMaterialsView.optButonWidthS })) { try { MateHandler.Instance.Write(this.edited, ACCMaterialsView.clipHandler.mateText); if (this.tipsCall != null) { this.tipsCall("マテリアル情報を貼付けました"); } } catch (Exception ex) { LogUtil.Error(new object[] { "failed to import mateText", ex }); } } ACCMaterialsView.includeOthers = GUILayout.Toggle(ACCMaterialsView.includeOthers, "CF", ACCMaterialsView.uiParams.tStyleSS, new GUILayoutOption[0]); ACCMaterialsView.includeShader = GUILayout.Toggle(ACCMaterialsView.includeShader, "S", ACCMaterialsView.uiParams.tStyleSS, new GUILayoutOption[0]); ACCMaterialsView.includeTex = GUILayout.Toggle(ACCMaterialsView.includeTex, "T", ACCMaterialsView.uiParams.tStyleSS, new GUILayoutOption[0]); GUI.enabled &= (ACCMaterialsView.includeTex | ACCMaterialsView.includeShader | ACCMaterialsView.includeOthers); if (GUILayout.Button(array[1], new GUILayoutOption[] { ACCMaterialsView.optUnitHeight, ACCMaterialsView.optButonWidth })) { try { int num = 0; if (ACCMaterialsView.includeTex) { num |= MateHandler.MATE_TEX; } if (ACCMaterialsView.includeShader) { num |= MateHandler.MATE_SHADER; } if (ACCMaterialsView.includeOthers) { num |= (MateHandler.MATE_COLOR | MateHandler.MATE_FLOAT); } LogUtil.DebugF("material pasting from cp... tex={0}, shader={1}, others={2}", new object[] { ACCMaterialsView.includeTex, ACCMaterialsView.includeShader, ACCMaterialsView.includeOthers }); MateHandler.Instance.Write(this.edited, ACCMaterialsView.clipHandler.mateText, num); } catch (Exception ex2) { LogUtil.Error(new object[] { "failed to import mateText", ex2 }); } if (this.tipsCall != null) { this.tipsCall("マテリアル情報を貼付けました"); } } } finally { GUI.enabled = true; GUILayout.EndHorizontal(); } var material = this.edited.material; int idx = this.edited.type.idx; if (this.shaderCombo == null) { GUIContent buttonContent = (idx >= 0 && idx < ACCMaterialsView.ShaderNames.Length) ? ACCMaterialsView.ShaderNames[idx] : GUIContent.none; this.shaderCombo = new ComboBoxLO(buttonContent, ACCMaterialsView.ShaderNames, ACCMaterialsView.uiParams.bStyleSC, ACCMaterialsView.uiParams.boxStyle, ACCMaterialsView.uiParams.listStyle, false); } else { this.shaderCombo.SelectedItemIndex = idx; } this.shaderCombo.Show(GUILayout.ExpandWidth(true)); int selectedItemIndex = this.shaderCombo.SelectedItemIndex; if (idx != selectedItemIndex && selectedItemIndex != -1) { LogUtil.Debug(new object[] { "shader changed", idx, "=>", selectedItemIndex }); string text = ACCMaterialsView.ShaderNames[selectedItemIndex].text; this.edited.ChangeShader(text, selectedItemIndex); } if (reload) { this.edited.renderQueue.Set(material.renderQueue); } this.sliderHelper.SetupFloatSlider("RQ", this.edited.renderQueue, this.edited.renderQueue.range.editMin, this.edited.renderQueue.range.editMax, delegate(float rq) { material.SetFloat(ShaderPropType.RenderQueue.propId, rq); material.renderQueue = (int)rq; }, ShaderPropType.RenderQueue.opts, ShaderPropType.RenderQueue.presetVals, ACCMaterialsView.rqResolver.Resolve(this.slotIdx)); ShaderType type = this.edited.type; for (int i = 0; i < type.colProps.Length; i++) { ShaderPropColor shaderPropColor = type.colProps[i]; EditColor editColor = this.edited.editColors[i]; ColorPicker picker = this.edited.pickers[i]; if (reload) { editColor.Set(material.GetColor(shaderPropColor.propId)); } if (this.sliderHelper.DrawColorSlider(shaderPropColor, ref editColor, picker)) { material.SetColor(shaderPropColor.propId, editColor.val); } } for (int j = 0; j < type.fProps.Length; j++) { //ACCMaterialsView.<>c__DisplayClass8 CS$<>8__locals2 = new ACCMaterialsView.<>c__DisplayClass8(); //CS$<>8__locals2.CS$<>8__locals5 = CS$<>8__locals1; var prop = type.fProps[j]; if (reload) { this.edited.editVals[j].Set(material.GetFloat(prop.propId)); } switch (prop.valType) { case ValType.Float: { ShaderPropFloat fprop = prop; this.sliderHelper.SetupFloatSlider(fprop, this.edited.editVals[j], delegate(float val) { fprop.SetValue(material, val); }); break; } case ValType.Bool: this.cbHelper.ShowCheckBox(prop.name, this.edited.editVals[j], delegate(float val) { prop.SetValue(material, val); }); break; case ValType.Enum: this.cbHelper.ShowComboBox(prop.name, this.edited.editVals[j], delegate(int val) { prop.SetValue(material, (float)val); }); break; } } } } finally { GUILayout.EndVertical(); } }