UnityEngine.GUI.RepeatButton(UnityEngine.Rect, UnityEngine.Texture)

Here are the examples of the csharp api UnityEngine.GUI.RepeatButton(UnityEngine.Rect, UnityEngine.Texture) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : PixelKit.cs
License : MIT License
Project Creator : liangxiegame

void GUIPalette()
		{
			// TODO: fix this nest of magic numbers
			int paletteButtonWidth = 256+16;
			int paletteButtonHeight = 64+16;
			int paletteButtonXpos = 110+10;
			int paletteButtonYpos = 595-32-8;
			if (GUI.RepeatButton(new Rect(paletteButtonXpos,paletteButtonYpos,paletteButtonWidth,paletteButtonHeight),paletteTexture))
			{
				if (!paletteTexture) return;

				Vector2 pickpos = Event.current.mousePosition;

				int pickX = (int)pickpos.x - paletteButtonXpos-(paletteButtonWidth/2-paletteTexture.width/2);
				int pickY = (int)paletteTexture.height-((int)pickpos.y - paletteButtonYpos-(paletteButtonHeight/2-paletteTexture.height/2));
				if (pickX>=0 && pickX<=paletteTexture.width && pickY>=0 && pickY<=paletteTexture.height)
				{
					paintColor1 = paletteTexture.GetPixel(pickX,pickY);
				}
			}		
			// TODO: show selected position in palette, TODO: later new palette system
			paletteTexture = EditorGUI.ObjectField(new Rect(paletteButtonXpos+paletteButtonWidth+8,595-6,46,46),paletteTexture, typeof(Texture2D),false) as Texture2D;
		}