// 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); }
// Token: 0x0600039B RID: 923 RVA: 0x000204D4 File Offset: 0x0001E6D4 private bool MapPickerEvent(ref Rect rect) { if (this._lightDragging) { return(false); } Event current = Event.current; if (current.button == 0 && (current.type == EventType.MouseDown || current.type == EventType.MouseDrag)) { Vector2 mousePosition = current.mousePosition; if (this._mapDragging || rect.Contains(mousePosition)) { int num = (int)(mousePosition.x - rect.x); int num2 = (int)(mousePosition.y - rect.y); Color color; if (this._mapDragging) { int num3 = this._mapTex.width / 2; int num4 = Mathf.CeilToInt((float)this._mapTex.height / 2f); int num5 = Math.Min(num3, num4); float num6 = ColorPicker.Distance(num, num2, num3, num4); if (num6 <= (float)num5) { color = this.GetMapColor(num, num2); } else { color = ColorPicker.GetEdgeColor((float)(num - num3), (float)(-(float)(num2 - num4)), num6) * this._light; color.a = 1f; float num7 = (float)num5 / num6; num = (int)((float)(num - num3) * num7) + num3; num2 = (int)((float)(num2 - num4) * num7) + num4; } } else { if (current.type != EventType.MouseDown) { return(false); } color = this.GetMapColor(num, num2); if (ColorPicker.Equals(color.a, 0f)) { return(false); } this._mapDragging = true; } this._color = color; this.SetTexColor(ref this._color, this.texEdgeSize); this.ToColorCode(); this._pos.x = (float)num; this._pos.y = (float)num2; current.Use(); return(true); } } else if (this._mapDragging && current.type == EventType.MouseUp) { this._mapDragging = false; } return(false); }