2using System.Collections;
41 renderTexture =
new RenderTexture(Screen.width, Screen.height, 24);
42 texture2D =
new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, mipChain:
false);
43 pixelBlock =
new Texture2D(16, 16, TextureFormat.ARGB32, mipChain:
false);
80 renderTexture =
new RenderTexture(Screen.width, Screen.height, 24);
88 yield
return new WaitForEndOfFrame();
91 int num = (int)Mathf.Clamp(Input.mousePosition.x, 0f,
texture2D.width);
92 int num2 = (int)Mathf.Clamp(Input.mousePosition.y, 0f,
texture2D.height);
93 Vector2 vector =
new Vector2(num - 8, num2 - 8);
94 Vector2 vector2 =
new Vector2(num + 8, num2 + 8);
95 Vector2 vector3 =
new Vector2(Mathf.Clamp(vector.x, 0f,
texture2D.width - 8), Mathf.Clamp(vector.y, 0f,
texture2D.height - 8));
96 Vector2 vector4 =
new Vector2(Mathf.Clamp(vector2.x, 8f,
texture2D.width), Mathf.Clamp(vector2.y, 8f,
texture2D.height));
97 int blockWidth = (int)vector4.x - (
int)vector3.x;
98 int blockHeight = (int)vector4.y - (
int)vector3.y;
99 Color[] pixels =
texture2D.GetPixels((
int)vector3.x, (int)vector3.y, blockWidth, blockHeight);
100 float num3 = vector3.x - vector.x;
101 float num4 = vector3.y - vector.y;
103 pixelBlock.SetPixels((
int)num3, (int)num4, blockWidth, blockHeight, pixels);
116 int num = (int)Mathf.Clamp(Input.mousePosition.x, 0f,
texture2D.width);
117 int num2 = (int)Mathf.Clamp(Input.mousePosition.y, 0f,
texture2D.height);
118 Vector2 vector =
new Vector2(num - 8, num2 - 8);
119 Vector2 vector2 =
new Vector2(num + 8, num2 + 8);
120 Vector2 vector3 =
new Vector2(Mathf.Clamp(vector.x, 0f,
texture2D.width - 8), Mathf.Clamp(vector.y, 0f,
texture2D.height - 8));
121 Vector2 vector4 =
new Vector2(Mathf.Clamp(vector2.x, 8f,
texture2D.width), Mathf.Clamp(vector2.y, 8f,
texture2D.height));
122 int num3 = (int)vector4.x - (
int)vector3.x;
123 int num4 = (int)vector4.y - (
int)vector3.y;
124 color =
texture2D.GetPixel((
int)vector3.x + num3 / 2, (int)vector3.y + num4 / 2);
149 UnityEngine.Object.Destroy(
blocker.gameObject);
void ShowEnlargedPixels(Color[] colors)
void ShowDropperMarker(bool value)
void UpdateColorByMousePosition()
void PickColors(Action< Color > onColorPicked, Action onDropCanceled)
IEnumerator EnlargeAreaAroundPointer()
Action< Color > onColorPicked
RenderTexture renderTexture
void UpdateRenderTextureIfNecessary()