// Token: 0x0600039F RID: 927 RVA: 0x00020950 File Offset: 0x0001EB50 private static Texture2D CreateRGBMapTex(int width, int height) { Texture2D texture2D = new Texture2D(width, height, TextureFormat.ARGB32, false); int num = width / 2; int num2 = height / 2; int num3 = Math.Min(num, num2); Color white = Color.white; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float num4 = ColorPicker.Distance(j, i, num, num2); float num5 = num4 / (float)num3; if (1f < num5) { texture2D.SetPixel(j, i, ColorPicker.Empty); } else if (ColorPicker.Equals(num5, 0f)) { texture2D.SetPixel(j, i, white); } else { int num6 = j - num; int num7 = i - num2; Color edgeColor = ColorPicker.GetEdgeColor((float)num6, (float)num7, num4); Color color = ColorPicker.GetColor(ref white, ref edgeColor, num5); texture2D.SetPixel(j, i, color); } } } return(texture2D); }
public bool Load() { if (PresetPath == null) { return(false); } presetCodes.Clear(); presetIcons.Clear(); var load = false; var empty = PresetEmptyIcon; if (File.Exists(PresetPath)) { try { var presets = File.ReadAllText(PresetPath, Encoding.UTF8); var codes = presets.Split(','); foreach (var code in codes) { var trimmedCode = code.Trim(); var col = ColorPicker.GetColor(trimmedCode); Texture2D tex; if (col.a > 0f) { presetCodes.Add(trimmedCode); var baseTex = PresetBaseIcon; tex = new Texture2D(baseTex.width, baseTex.height, baseTex.format, false); SetTexColor(ref col, baseTex, tex); } else { presetCodes.Add(string.Empty); tex = CreateEmpty(); } presetIcons.Add(tex); if (presetIcons.Count >= Count) { break; } } load = true; } catch (Exception e) { LogUtil.Error("カラープリセットのロードに失敗しました。", PresetPath, e); } } for (var i = presetIcons.Count; i < Count; i++) { var tex = new Texture2D(empty.width, empty.height, empty.format, false); tex.SetPixels32(empty.GetPixels32(0), 0); tex.Apply(); presetIcons.Add(tex); presetCodes.Add(string.Empty); } return(load); }
// 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); }