Here are the examples of the csharp api UnityEngine.GUI.DrawTexture(UnityEngine.Rect, UnityEngine.Texture) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
55 Examples
19
View Source File : HTGUILayout.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
public static void DrawTileTexture (Rect rect, Texture tex)
{
GUI.BeginGroup(rect);
{
int width = Mathf.RoundToInt(rect.width);
int height = Mathf.RoundToInt(rect.height);
for (int y = 0; y < height; y += tex.height)
{
for (int x = 0; x < width; x += tex.width)
{
GUI.DrawTexture(new Rect(x, y, tex.width, tex.height), tex);
}
}
}
GUI.EndGroup();
}
19
View Source File : ETCGuiTools.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
private static Rect DrawGradient(int padding, int width, int height=35){
GUILayout.Space(height);
Rect lastRect = GUILayoutUtility.GetLastRect();
lastRect.yMin = lastRect.yMin + 7;
lastRect.yMax = lastRect.yMax - 7;
lastRect.width = Screen.width;
GUI.DrawTexture(new Rect(padding,lastRect.yMin+1,width, lastRect.yMax- lastRect.yMin), GetGradientTexture());
return lastRect;
}
19
View Source File : EyeAdaptationComponent.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
public void OnGUI()
{
if (m_DebugHistogram == null || !m_DebugHistogram.IsCreated())
return;
var rect = new Rect(context.viewport.x * Screen.width + 8f, 8f, m_DebugHistogram.width, m_DebugHistogram.height);
GUI.DrawTexture(rect, m_DebugHistogram);
}
19
View Source File : WelcomeWindow.cs
License : MIT License
Project Creator : seldomU
License : MIT License
Project Creator : seldomU
void OnGUI()
{
if ( !resourcesLoaded )
{
if ( !LoadAllTextures() )
{
GUILayout.Label( "Window resources are missing" );
return;
}
resourcesLoaded = true;
}
if ( !stylesInitialized )
{
InitStyles();
stylesInitialized = true;
}
GUILayout.Space( toolbarToHeaderSpace );
// draw replacedle
GUILayout.BeginHorizontal();
var replacedleTexture = EditorGUIUtility.isProSkin ? textureByName[ TNamereplacedleWhite ] : textureByName[ TNamereplacedleBlack ];
GUILayout.Space( ( position.width - replacedleTexture.width ) / 2 );
GUI.DrawTexture( ReserveRect( replacedleTexture.width, replacedleTexture.height ), replacedleTexture );
GUILayout.EndHorizontal();
string version = GetType().replacedembly.GetName().Version.ToString();
#if RIDEMO
version += " Demo";
#endif
GUILayout.Label( version, versionLabelStyle );
GUILayout.Space( headerToListSpace );
// draw integrations header
GUILayout.BeginHorizontal();
GUILayout.Space( integrationIconHorSpacing );
var iconRect = ReserveRect( new Vector2( listIconSize, listIconSize ) );
GUILayout.Space( integrationIconHorSpacing );
GUI.DrawTexture( iconRect, textureByName[TNameIntegration] );
GUILayout.Label( "Installable Add-ons", listHeaderStyle );
GUILayout.EndHorizontal();
scrollPosition = GUILayout.BeginScrollView( scrollPosition );
{
// integrations
foreach ( var pInfo in packageMetadata )
DrawPackageContent( pInfo );
}
GUILayout.EndScrollView();
GUILayout.FlexibleSpace();
// link bar
GUILayout.Space( toolbarTopSpace );
GUILayout.BeginHorizontal();
float linkBarSpacing = ( position.width - ( headlineContent.Length * toolbarIconSize ) ) / ( headlineContent.Length + 1 );
foreach ( var item in headlineContent )
{
GUILayout.Space( linkBarSpacing );
var rect = ReserveRect( new Vector2( toolbarIconSize, toolbarIconSize ) );
if ( GUI.Button( rect, new GUIContent( "", null, item.replacedle ), buttonStyles[item.bStTexName] ) )
item.onClick.Invoke();
}
GUILayout.EndHorizontal();
// tooltip
GUILayout.Label( GUI.tooltip, tooltipStyle );
GUILayout.Space( toolbarTopSpace );
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private void DrawLayers(Rect verticalParent) {
Vector2 offset = new Vector2(10, 20);
// INIT LAYER RECT
float layerRectPositionX = verticalParent.x + offset.x;
float layerRectPositionY = verticalParent.yMax + offset.y;
float layerRectWidth = verticalParent.width-offset.x*2;
float layerRectHeight = 40;
float spaceBetweenLayers = 10;
// SCROLL VIEW STUFF
Rect viewRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth+ offset.x, (layerRectHeight + spaceBetweenLayers) * (PIASession.Instance.ImageData.Layers.Count + 1) + offset.y*2);
Rect sliderRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth+offset.x, leftSide.GetRect().height - verticalParent.height - offset.y);
// caching and changing default gui skins for scroll view
GUIStyle nativeVerticalScrollbarThumb = GUI.skin.verticalScrollbarThumb;
GUI.skin.verticalScrollbarThumb.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
GUIStyle nativeVerticalScrollbarDownButton = GUI.skin.verticalScrollbarDownButton;
GUI.skin.verticalScrollbarDownButton.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
GUIStyle nativeVerticalScrollbarUpButton = GUI.skin.verticalScrollbarUpButton;
GUI.skin.verticalScrollbarUpButton.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
// DRAWING LAYERS
layersSlider = GUI.BeginScrollView(sliderRect, layersSlider, viewRect, false, false, skin.GetStyle("horizontalscrollbar"), skin.GetStyle("verticalscrollbar"));
{
for (int i = 0; i < PIASession.Instance.ImageData.Layers.Count; i++)
{
var item = PIASession.Instance.ImageData.Layers[i];
Rect layerRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth, layerRectHeight);
GUI.DrawTexture(layerRect, blackBarBG);
GUILayout.BeginArea(layerRect);
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
// LABEL
GUILayout.BeginVertical();
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
GUILayout.Space(15);
GUILayout.Label(item.Name, skin.GetStyle("editorbutton2"));
GUILayout.FlexibleSpace();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
// EYE & DELETE & TOOLTIP
GUILayout.BeginVertical();
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
item.Hidden = GUILayout.Toggle(item.Hidden, GUIContent.none, skin.GetStyle("layereye"), GUILayout.MaxWidth(30), GUILayout.MaxHeight(30));
Rect layerEyeGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), layerRect, new Rect(-5, 40, 1, 1));
Rect layerEyeTooltipRect = new Rect(0, 0, 150, 22.5f);
PIATooltip layerEyeTooltip = new PIATooltip(layerEyeTooltipRect, "Show layer On / Off");
PIATooltip.SetPositionPreset(ref layerEyeTooltip, layerEyeGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(layerEyeGlobalRect, layerEyeTooltip);
GUILayout.Space(5);
if (i != 0)
{
if (GUILayout.Button(GUIContent.none, skin.GetStyle("deletelayer"), GUILayout.MaxWidth(30), GUILayout.MaxHeight(30)))
{
PIASession.Instance.ImageData.RemoveLayer(i);
return;
}
Rect deleteLayerGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), layerRect, new Rect(-5, 40, 1, 1));
Rect deleteLayerTooltipRect = new Rect(0, 0, 50, 22.5f);
PIATooltip deleteLayerTooltip = new PIATooltip(deleteLayerTooltipRect, "Delete");
PIATooltip.SetPositionPreset(ref deleteLayerTooltip, deleteLayerGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(deleteLayerGlobalRect, deleteLayerTooltip);
}
GUILayout.Space(5);
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndArea();
// LAYER SELECTION BUTTON
if (GUI.Button(layerRect, GUIContent.none, skin.GetStyle("bglayerbutton")))
{
PIASession.Instance.ImageData.CurrentLayer = i;
}
layerRectPositionY += layerRectHeight + spaceBetweenLayers;
// SELECTED LAYER OVERLAY
if (i == PIASession.Instance.ImageData.CurrentLayer)
{
GUI.Label(layerRect, GUIContent.none, skin.GetStyle("selectedlayeroverlay"));
}
PIASession.Instance.ImageData.Layers[i] = item;
}
// ADD LAYER
Rect addLayerRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth, layerRectHeight);
GUI.DrawTexture(addLayerRect, blackBarBG);
GUILayout.BeginArea(addLayerRect);
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
// ICON
GUILayout.BeginVertical();
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
GUILayout.Space(15);
GUILayout.Label("", skin.GetStyle("addlayerlabelicon"), GUILayout.MaxWidth(30), GUILayout.MaxHeight(30));
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
// LABEL
GUILayout.BeginVertical();
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
GUILayout.Space(15);
GUILayout.Label("Add layer", skin.GetStyle("editorbutton2"));
GUILayout.FlexibleSpace();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndArea();
// ADD LAYER BUTTON
if (GUI.Button(addLayerRect, "", skin.GetStyle("bglayerbutton")))
{
PIASession.Instance.ImageData.AddLayer();
}
}
GUI.EndScrollView();
// resetting scroll view gui skin
GUI.skin.verticalScrollbarThumb = nativeVerticalScrollbarThumb;
GUI.skin.verticalScrollbarDownButton = nativeVerticalScrollbarDownButton;
GUI.skin.verticalScrollbarUpButton = nativeVerticalScrollbarUpButton;
}
19
View Source File : Example.cs
License : GNU General Public License v3.0
Project Creator : KleskBY
License : GNU General Public License v3.0
Project Creator : KleskBY
public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
{
float num = pointB.x - pointA.x;
float num2 = pointB.y - pointA.y;
float num3 = Mathf.Sqrt(num * num + num2 * num2);
if (num3 < 0.001f)
{
return;
}
Texture2D texture2D;
if (antiAlias)
{
width *= 3f;
texture2D = aaLineTex;
Material material = blendMaterial;
}
else
{
texture2D = lineTex;
Material material2 = blitMaterial;
}
float num4 = width * num2 / num3;
float num5 = width * num / num3;
Matrix4x4 idenreplacedy = Matrix4x4.idenreplacedy;
idenreplacedy.m00 = num;
idenreplacedy.m01 = -num4;
idenreplacedy.m03 = pointA.x + 0.5f * num4;
idenreplacedy.m10 = num2;
idenreplacedy.m11 = num5;
idenreplacedy.m13 = pointA.y - 0.5f * num5;
GL.PushMatrix();
GL.MultMatrix(idenreplacedy);
GUI.color = color;
GUI.DrawTexture(lineRect, texture2D);
GL.PopMatrix();
}
19
View Source File : NodeKnob.cs
License : MIT License
Project Creator : virror
License : MIT License
Project Creator : virror
public virtual void DrawKnob ()
{
Rect knobRect = GetGUIKnob ();
GUI.DrawTexture (knobRect, knobTexture);
}
19
View Source File : SteamVR_Menu.cs
License : MIT License
Project Creator : dag10
License : MIT License
Project Creator : dag10
void OnGUI()
{
if (overlay == null)
return;
var texture = overlay.texture as RenderTexture;
var prevActive = RenderTexture.active;
RenderTexture.active = texture;
if (Event.current.type == EventType.Repaint)
GL.Clear(false, true, Color.clear);
var area = new Rect(0, 0, texture.width, texture.height);
// Account for screen smaller than texture (since mouse position gets clamped)
if (Screen.width < texture.width)
{
area.width = Screen.width;
overlay.uvOffset.x = -(float)(texture.width - Screen.width) / (2 * texture.width);
}
if (Screen.height < texture.height)
{
area.height = Screen.height;
overlay.uvOffset.y = (float)(texture.height - Screen.height) / (2 * texture.height);
}
GUILayout.BeginArea(area);
if (background != null)
{
GUI.DrawTexture(new Rect(
(area.width - background.width) / 2,
(area.height - background.height) / 2,
background.width, background.height), background);
}
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
if (logo != null)
{
GUILayout.Space(area.height / 2 - logoHeight);
GUILayout.Box(logo);
}
GUILayout.Space(menuOffset);
bool bHideMenu = GUILayout.Button("[Esc] - Close menu");
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Scale: {0:N4}", scale));
{
var result = GUILayout.HorizontalSlider(scale, scaleLimits.x, scaleLimits.y);
if (result != scale)
{
SetScale(result);
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Scale limits:"));
{
var result = GUILayout.TextField(scaleLimitX);
if (result != scaleLimitX)
{
if (float.TryParse(result, out scaleLimits.x))
scaleLimitX = result;
}
}
{
var result = GUILayout.TextField(scaleLimitY);
if (result != scaleLimitY)
{
if (float.TryParse(result, out scaleLimits.y))
scaleLimitY = result;
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Scale rate:"));
{
var result = GUILayout.TextField(scaleRateText);
if (result != scaleRateText)
{
if (float.TryParse(result, out scaleRate))
scaleRateText = result;
}
}
GUILayout.EndHorizontal();
if (SteamVR.active)
{
var vr = SteamVR.instance;
GUILayout.BeginHorizontal();
{
var t = SteamVR_Camera.sceneResolutionScale;
int w = (int)(vr.sceneWidth * t);
int h = (int)(vr.sceneHeight * t);
int pct = (int)(100.0f * t);
GUILayout.Label(string.Format("Scene quality: {0}x{1} ({2}%)", w, h, pct));
var result = Mathf.RoundToInt(GUILayout.HorizontalSlider(pct, 50, 200));
if (result != pct)
{
SteamVR_Camera.sceneResolutionScale = (float)result / 100.0f;
}
}
GUILayout.EndHorizontal();
}
overlay.highquality = GUILayout.Toggle(overlay.highquality, "High quality");
if (overlay.highquality)
{
overlay.curved = GUILayout.Toggle(overlay.curved, "Curved overlay");
overlay.antialias = GUILayout.Toggle(overlay.antialias, "Overlay RGSS(2x2)");
}
else
{
overlay.curved = false;
overlay.antialias = false;
}
var tracker = SteamVR_Render.Top();
if (tracker != null)
{
tracker.wireframe = GUILayout.Toggle(tracker.wireframe, "Wireframe");
var render = SteamVR_Render.instance;
if (render.trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
{
if (GUILayout.Button("Switch to Standing"))
render.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseStanding;
if (GUILayout.Button("Center View"))
{
var system = OpenVR.System;
if (system != null)
system.ResetSeatedZeroPose();
}
}
else
{
if (GUILayout.Button("Switch to Seated"))
render.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseSeated;
}
}
#if !UNITY_EDITOR
if (GUILayout.Button("Exit"))
Application.Quit();
#endif
GUILayout.Space(menuOffset);
var env = System.Environment.GetEnvironmentVariable("VR_OVERRIDE");
if (env != null)
{
GUILayout.Label("VR_OVERRIDE=" + env);
}
GUILayout.Label("Graphics device: " + SystemInfo.graphicsDeviceVersion);
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndArea();
if (cursor != null)
{
float x = Input.mousePosition.x, y = Screen.height - Input.mousePosition.y;
float w = cursor.width, h = cursor.height;
GUI.DrawTexture(new Rect(x, y, w, h), cursor);
}
RenderTexture.active = prevActive;
if (bHideMenu)
HideMenu();
}
19
View Source File : SF_EditorNodeData.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public SF_EditorNodeData CheckHotkeyInput(bool mouseOverSomeNode) {
bool mouseInNodeView = SF_Editor.instance.nodeView.MouseInsideNodeView(false);
if(Event.current.type == EventType.repaint){
smoothHotkeySelectorIndex = Mathf.Lerp(smoothHotkeySelectorIndex, hotkeySelectorIndex, 0.5f);
}
bool useScroll = SF_Settings.quickPickScrollWheel;
if(holding && Event.current.type == EventType.scrollWheel && HotkeyFriends.Count > 0 && mouseInNodeView){
if(useScroll){
hotkeySelectorIndex += (int)Mathf.Sign(Event.current.delta.y);
hotkeySelectorIndex = Mathf.Clamp(hotkeySelectorIndex, 0, HotkeyFriends.Count-1);
}
// hotkeySelectorIndex = ( hotkeySelectorIndex + HotkeyFriends.Count ) % HotkeyFriends.Count; // Wrap
Event.current.Use();
}
if( key == KeyCode.None )
return null;
if( Event.current.keyCode == key ) {
if( Event.current.type == EventType.keyDown && !SF_GUI.HoldingControl() && holding == false && mouseInNodeView ){
hotkeySelectorIndex = defaultHotkeySelectorIndex;
smoothHotkeySelectorIndex = defaultHotkeySelectorIndex;
quickpickerStartPosition = Event.current.mousePosition;
holding = true;
}
if( Event.current.rawType == EventType.keyUp ){
holding = false;
}
}
if(holding && !mouseOverSomeNode){
float width = 166f; // nodeName.Length*8 + 10;
Rect dispPos = new Rect(0, 0, width, 36);
Vector2 centerPos = useScroll ? Event.current.mousePosition : quickpickerStartPosition;
dispPos.center = centerPos;
dispPos.y -= dispPos.height*0.3333f;
//
//GUI.Box(dispPos, nodeName, GUI.skin.button);
//
// Draw hotkey node picker
//if(Event.current.type == EventType.keyDown){
//Debug.Log(Event.current.keyCode);
Rect nRect = dispPos; //new Rect(0,0,128,32);
nRect.center = centerPos - Vector2.up*nRect.height*0.3333f;
//nRect = nRect.MovedRight();
if(useScroll)
nRect.y -= nRect.height * smoothHotkeySelectorIndex;
else
nRect.y -= nRect.height * defaultHotkeySelectorIndex;
//if(Event.current.keyCode != KeyCode.None){
Color prevCol = GUI.color;
int i = 0;
foreach( SF_EditorNodeData node in HotkeyFriends){
//float dist = Mathf.Abs(smoothHotkeySelectorIndex - i);
//float alpha = Mathf.Clamp(1f-Mathf.Clamp01(dist*0.25f), 0.2f, 0.8f);
float offset = 0f;//(dist*dist)/3f;
//if(i == hotkeySelectorIndex){
//alpha = 1;
//offset -= 8f;
//GUI.Box(nRect, node.nodeName, PopupButtonStyle);
//}
Rect newNRect = nRect;
newNRect.x += offset;
if(!useScroll && newNRect.Contains(Event.current.mousePosition)){
hotkeySelectorIndex = i;
}
bool selected = (i == hotkeySelectorIndex);
if( selected )
GUI.color = new Color(1f,1f,1f,1f);
else
GUI.color = new Color(0.6f,0.6f,0.6f,0.5f);
if(node.isProperty){
GUI.color *= SF_Node.colorExposed;
}
Texture2D icon = SF_Resources.LoadNodeIcon( node.type.Split('.')[1].ToLower() );
if(icon != null){
newNRect.width -= newNRect.height;
}
//if(useScroll){
GUI.Box(newNRect, node.nodeName, PopupButtonStyle);
//} else {
//if(GUI.Button(newNRect, node.nodeName, PopupButtonStyle)){
//hotkeySelectorIndex = i;
//}
//}
if(icon != null){
Rect iconRect = newNRect;
iconRect = iconRect.MovedRight();
iconRect.width = iconRect.height;
GUI.color = selected ? Color.white : new Color(1f,1f,1f,0.4f);
GUI.DrawTexture(iconRect, icon);
}
nRect = nRect.MovedDown();
i++;
}
GUI.color = prevCol;
//}
if(Event.current.type == EventType.keyDown/* && Event.current.type == EventType.layout*/ /*&& GUI.GetNameOfFocusedControl() == "defocus"*/){
Event.current.Use();
}
//}
//}
//GUI.Label(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 256,32),"currentindex = " + hotkeySelectorIndex);
}
bool clicked = Event.current.type == EventType.mouseDown;
if(holding && clicked){
return HotkeyFriends[hotkeySelectorIndex];
} else {
return null;
}
}
19
View Source File : Spinner.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
public void Render()
{
var matrix = GUI.matrix;
// draw the background
GUI.DrawTexture(backgroundRect, Utility.GetTextureFromColor(new Color(0.2f, 0.2f, 0.2f, 0.9f)));
// draw the center
GUI.DrawTexture(insideRect, Inside);
// draw the outside ring, rotated
PushRotation(currentRotation, center);
GUI.DrawTexture(outsideRect, Outside);
PopRotation();
// draw the code icon inside the ring unrotated
PushRotation(-currentRotation, codeIconCenter);
PushRotation(currentRotation, center);
GUI.DrawTexture(new Rect(codeIconTopLeft.x, codeIconTopLeft.y, Code.width, Code.height), Code);
PopRotation();
PopRotation();
// draw the merge icon inside the ring unrotated
PushRotation(-currentRotation, mergeIconCenter);
PushRotation(currentRotation, center);
GUI.DrawTexture(new Rect(mergeIconTopLeft.x, mergeIconTopLeft.y, Merge.width, Merge.height), Merge);
PopRotation();
PopRotation();
// draw the rocket icon inside the ring unrotated
PushRotation(-currentRotation, rocketIconCenter);
PushRotation(currentRotation, center);
GUI.DrawTexture(new Rect(rocketIconTopLeft.x, rocketIconTopLeft.y, Rocket.width, Rocket.height), Rocket);
PopRotation();
PopRotation();
GUI.matrix = matrix;
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private void DrawSessionBar(Rect parent) {
Vector2 offset = new Vector2(5, 180);
Vector2 bgOffset = new Vector2(8, 8);
// INIT BUTTONS RECT
float buttonWidth = 46;
float buttonHeight = 46;
float spaceBetweenRects = 20;
Rect firstRect = new Rect(parent.width - buttonWidth - offset.x, offset.y, buttonWidth, buttonHeight * 3);
Rect firstRectBG = new Rect(firstRect.x - bgOffset.x / 2, firstRect.y - bgOffset.y / 2, firstRect.width + bgOffset.x, firstRect.height + bgOffset.y);
// BG
GUI.DrawTexture(firstRectBG, blackBarBG);
GUILayout.BeginArea(firstRect);
{
GUILayout.BeginVertical();
{
// NEW SESSION
if (GUILayout.Button(GUIContent.none, skin.GetStyle("newsession"), GUILayout.MaxWidth(buttonWidth), GUILayout.MaxHeight(buttonHeight))) {
PIANewImageWindow.ShowWindow();
}
Rect newSessionGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), firstRect, parent);
Rect newSessionTooltipRect = new Rect(0, 0, 105, 45);
PIATooltip newSessionTooltip = new PIATooltip(newSessionTooltipRect, "Create a new doreplacedent");
PIATooltip.SetPositionPreset(ref newSessionTooltip, newSessionGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(newSessionGlobalRect, newSessionTooltip);
// OPEN replacedET
if (GUILayout.Button(GUIContent.none, skin.GetStyle("openreplacedet"), GUILayout.MaxWidth(buttonWidth), GUILayout.MaxHeight(buttonHeight))) {
PIASession.Instance.Loadreplacedet();
}
Rect openreplacedetGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), firstRect, parent);
Rect openreplacedetTooltipRect = new Rect(0, 0, 120, 45);
PIATooltip openreplacedetTooltip = new PIATooltip(openreplacedetTooltipRect, "Open an existing doreplacedent");
PIATooltip.SetPositionPreset(ref openreplacedetTooltip, openreplacedetGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(openreplacedetGlobalRect, openreplacedetTooltip);
// SAVE CURRENT SESSION
if (GUILayout.Button(GUIContent.none, skin.GetStyle("savesession"), GUILayout.MaxWidth(buttonWidth), GUILayout.MaxHeight(buttonHeight))) {
PIASession.Instance.Savereplacedet();
}
Rect saveSessionGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), firstRect, parent);
Rect saveSessionTooltipRect = new Rect(0, 0, 120, 45);
PIATooltip saveSessionTooltip = new PIATooltip(saveSessionTooltipRect, "Save the current doreplacedent");
PIATooltip.SetPositionPreset(ref saveSessionTooltip, saveSessionGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(saveSessionGlobalRect, saveSessionTooltip);
}
GUILayout.EndVertical();
}
GUILayout.EndArea();
Rect secondRect = new Rect(firstRect.x,firstRect.yMax+ spaceBetweenRects,firstRect.width, buttonHeight * 2);
Rect secondRectBG = new Rect(secondRect.x - bgOffset.x / 2, secondRect.y - bgOffset.y / 2, secondRect.width + bgOffset.x, secondRect.height + bgOffset.y);
GUI.DrawTexture(secondRectBG, blackBarBG);
GUILayout.BeginArea(secondRect);
{
GUILayout.BeginVertical();
{
// IMPORT IMAGE
if (GUILayout.Button(GUIContent.none, skin.GetStyle("importtexture"), GUILayout.MaxWidth(buttonWidth), GUILayout.MaxHeight(buttonHeight))) {
PIASession.Instance.LoadImageFromFile();
}
Rect importGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), secondRect, parent);
Rect importTooltipRect = new Rect(0, 0, 105, 45);
PIATooltip importTooltip = new PIATooltip(importTooltipRect, "Import a new image");
PIATooltip.SetPositionPreset(ref importTooltip, importGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(importGlobalRect, importTooltip);
// EXPORT PROJECT
if (GUILayout.Button(GUIContent.none, skin.GetStyle("exporttexture"), GUILayout.MaxWidth(buttonWidth), GUILayout.MaxHeight(buttonHeight))) {
PIAExportSettingsWindow.ShowWindow();
}
Rect exportGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), secondRect, parent);
Rect exportTooltipRect = new Rect(0, 0, 105, 45);
PIATooltip exportTooltip = new PIATooltip(exportTooltipRect, "Export the doreplacedent");
PIATooltip.SetPositionPreset(ref exportTooltip, exportGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(exportGlobalRect, exportTooltip);
}
GUILayout.EndVertical();
}
GUILayout.EndArea();
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private void DrawFrames(Rect parent)
{
PIAImageData imageData = PIASession.Instance.ImageData;
Vector2 offset = new Vector2(20, 20);
Vector2 bgSize = new Vector2(15, 15);
// FRAME RECT
float frameRectPositionX = offset.x;
float frameRectPositionY = offset.y;
float frameRectWidth = 100;
float frameRectHeight = frameRectWidth;
float spaceBetweenFrames = 25;
// FRAME INDEX RECT
float frameNumberRectWidth = 22;
float frameNumberRectHeight = 22;
// DELETE RECT
float deleteFrameRectWidth = 32;
float deleteFrameRectHeight = 32;
Vector2 deleteFrameRectOffset = new Vector2(2, 2);
// DUPLICATE RECT
float duplicateFrameRectWidth = 32;
float duplicateFrameRectHeight = 32;
Vector2 duplicateFrameRectOffset = new Vector2(2, 2);
// MOVE UP RECT
float moveFrameUpRectWidth = 32;
float moveFrameUpRectHeight = 32;
Vector2 moveFrameUpRectOffset = new Vector2(2, 2);
// MOVE DOWN RECT
float moveFrameDownRectWidth = 32;
float moveFrameDownRectHeight = 32;
Vector2 moveFrameDownRectOffset = new Vector2(2, 2);
// ADD FRAME RECT
float addFrameIconRectWidth = 40;
float addFrameIconRectHeight = 40;
// SCROLL VIEW RECT
Rect viewRect = new Rect(0, 0, parent.width, (frameRectHeight+spaceBetweenFrames) * (imageData.Frames.Count+1)+offset.y);
Rect sliderRect = new Rect(0, 0, parent.width, parent.height-offset.y);
// caching and changing default gui skins for scroll view
GUIStyle nativeVerticalScrollbarThumb = GUI.skin.verticalScrollbarThumb;
GUI.skin.verticalScrollbarThumb.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
GUIStyle nativeVerticalScrollbarDownButton = GUI.skin.verticalScrollbarDownButton;
GUI.skin.verticalScrollbarDownButton.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
GUIStyle nativeVerticalScrollbarUpButton = GUI.skin.verticalScrollbarUpButton;
GUI.skin.verticalScrollbarUpButton.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
// DRAWING FRAMES
framesSlider = GUI.BeginScrollView(sliderRect, framesSlider,viewRect,false,false,skin.GetStyle("horizontalscrollbar"),skin.GetStyle("verticalscrollbar"));
{
for (int i = 0; i < imageData.Frames.Count; i++)
{
var item = imageData.Frames[i];
// refreshing rects
Rect frameRect = new Rect(frameRectPositionX, frameRectPositionY, frameRectWidth, frameRectHeight);
Rect frameBGRect = new Rect(frameRect.x - bgSize.x / 2, frameRect.y - bgSize.y / 2, frameRect.width + bgSize.x,
frameRect.height + bgSize.y);
Rect frameNumberBGRect = new Rect(frameBGRect.xMax, frameBGRect.center.y - frameNumberRectHeight / 2, frameNumberRectWidth, frameNumberRectHeight);
Rect deleteFrameRect = new Rect(frameRect.xMax - deleteFrameRectWidth - deleteFrameRectOffset.x,
frameRect.y + deleteFrameRectOffset.y, deleteFrameRectWidth, deleteFrameRectHeight);
Rect duplicateFrameRect = new Rect(frameRect.xMax - duplicateFrameRectWidth - duplicateFrameRectOffset.x,
frameRect.yMax - duplicateFrameRectOffset.y - duplicateFrameRectHeight, duplicateFrameRectWidth, duplicateFrameRectHeight);
Rect moveFrameUpFrameRect = new Rect(frameRect.x + moveFrameUpRectOffset.x,
frameRect.y + moveFrameUpRectOffset.y , moveFrameUpRectWidth, moveFrameUpRectHeight);
Rect moveFrameDownFrameRect = new Rect(frameRect.x + moveFrameDownRectOffset.x,
frameRect.yMax - moveFrameDownRectOffset.y - moveFrameDownRectHeight, moveFrameDownRectWidth, moveFrameDownRectHeight);
// INDEX NUMBER
GUI.DrawTexture(frameNumberBGRect, blackBarBG);
GUI.Label(frameNumberBGRect, i.ToString(), skin.GetStyle("editorbutton2"));
// BG
GUI.DrawTexture(frameBGRect, blackBarBG);
// FRAME CONTENT
EditorGUI.DrawTextureTransparent(frameRect, imageData.Frames[i].GetFrameTexture());
if (PIAInputArea.IsMouseInsideRect(frameBGRect))
{
if (imageData.Frames.Count > 1)
{
// DELETE
if (GUI.Button(deleteFrameRect, GUIContent.none, skin.GetStyle("deleteframe")))
{
PIASession.Instance.ImageData.RemoveFrame(i);
}
Rect deleteFrameGlobalRect = PIATooltipUtility.ChildToGlobalRect(deleteFrameRect,parent);
Rect deleteFrameTooltipRect = new Rect(0, 0, 50, 22.5f);
PIATooltip deleteFrameTooltip = new PIATooltip(deleteFrameTooltipRect, "Delete");
PIATooltip.SetPositionPreset(ref deleteFrameTooltip, deleteFrameGlobalRect, PIATooltip.PIATooltipPreset.Right);
PIATooltipUtility.AddTooltip(deleteFrameGlobalRect, deleteFrameTooltip);
}
// DUPLICATE
if (GUI.Button(duplicateFrameRect, GUIContent.none, skin.GetStyle("copyframe")))
{
PIAFrame newFrame = PIASession.Instance.ImageData.AddFrame();
newFrame.CopyFrom(item);
}
Rect duplicateFrameGlobalRect = PIATooltipUtility.ChildToGlobalRect(duplicateFrameRect, parent);
Rect duplicateFrameTooltipRect = new Rect(0, 0, 75, 22.5f);
PIATooltip duplicateFrameTooltip = new PIATooltip(duplicateFrameTooltipRect, "Duplicate");
PIATooltip.SetPositionPreset(ref duplicateFrameTooltip, duplicateFrameGlobalRect, PIATooltip.PIATooltipPreset.Up);
PIATooltipUtility.AddTooltip(duplicateFrameGlobalRect, duplicateFrameTooltip);
// MOVE UP
if (i > 0) {
if (GUI.Button(moveFrameUpFrameRect, GUIContent.none, skin.GetStyle("moveframup")))
{
imageData.MoveFrameUp(i);
}
Rect moveFrameUpGlobalRect = PIATooltipUtility.ChildToGlobalRect(moveFrameUpFrameRect, parent);
Rect moveFrameUpTooltipRect = new Rect(0, 0, 75, 22.5f);
PIATooltip moveFrameUpTooltip = new PIATooltip(moveFrameUpTooltipRect, "Move up");
PIATooltip.SetPositionPreset(ref moveFrameUpTooltip, moveFrameUpGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(moveFrameUpGlobalRect, moveFrameUpTooltip);
}
// MOVE DOWN
if (i < imageData.Frames.Count - 1) {
if (GUI.Button(moveFrameDownFrameRect, GUIContent.none, skin.GetStyle("moveframedown")))
{
imageData.MoveFrameDown(i);
}
Rect moveFrameDownGlobalRect = PIATooltipUtility.ChildToGlobalRect(moveFrameDownFrameRect,parent);
Rect moveFrameDownTooltipRect = new Rect(0, 0, 90, 22.5f);
PIATooltip moveFrameDownTooltip = new PIATooltip(moveFrameDownTooltipRect, "Move down");
PIATooltip.SetPositionPreset(ref moveFrameDownTooltip, moveFrameDownGlobalRect, PIATooltip.PIATooltipPreset.Left);
PIATooltipUtility.AddTooltip(moveFrameDownGlobalRect, moveFrameDownTooltip);
}
}
// FRAME SELECTION BG
if (GUI.Button(frameBGRect, GUIContent.none, skin.GetStyle("bglayerbutton")))
{
PIASession.Instance.ImageData.CurrentFrameIndex = i;
}
frameRectPositionY += frameRectHeight + spaceBetweenFrames;
// FRAME SELECTION OVERLAY
if (i == PIASession.Instance.ImageData.CurrentFrameIndex)
{
GUI.Label(frameBGRect, GUIContent.none, skin.GetStyle("selectedframeoverlay"));
}
}
// ADD NEW FRAME
Rect addFrameRect = new Rect(frameRectPositionX, frameRectPositionY, frameRectWidth, frameRectHeight);
Rect addFrameBGRect = new Rect(addFrameRect.x - bgSize.x / 2, addFrameRect.y - bgSize.y / 2, addFrameRect.width + bgSize.x,
addFrameRect.height + bgSize.y);
Rect addFrameBGLabelIcon = new Rect(addFrameRect.center.x - addFrameIconRectWidth / 2, addFrameRect.center.y - addFrameIconRectHeight / 2, addFrameIconRectWidth, addFrameIconRectHeight);
GUI.DrawTexture(addFrameBGRect, blackBarBG);
GUI.Label(addFrameBGLabelIcon, GUIContent.none, skin.GetStyle("addframe"));
if (GUI.Button(addFrameRect, GUIContent.none, skin.GetStyle("bglayerbutton")))
{
PIASession.Instance.ImageData.AddFrame();
}
frameRectPositionY += frameRectHeight + spaceBetweenFrames;
}
GUI.EndScrollView();
// resetting scroll view gui skin
GUI.skin.verticalScrollbarThumb = nativeVerticalScrollbarThumb;
GUI.skin.verticalScrollbarDownButton = nativeVerticalScrollbarDownButton;
GUI.skin.verticalScrollbarUpButton = nativeVerticalScrollbarUpButton;
}
19
View Source File : IMLNodeEditor.cs
License : MIT License
Project Creator : Interactml
License : MIT License
Project Creator : Interactml
protected virtual void DrawPortLayout()
{
// Add x units to height per extra port
if (m_PortPairs == null)
m_PortPairs = new List<IMLNodePortPair>();
// Check whether we need to recalculate rects because there are more portPairs
if (m_KnownNumPortPairs != m_PortPairs.Count)
{
m_KnownNumPortPairs = m_PortPairs.Count;
m_RecalculateRects = true;
}
if (m_RecalculateRects)
{
int extraHeight = (m_PortPairs.Count * 10);
// Draw body background purple rect below header
m_PortRect.x = 5;
m_PortRect.y = HeaderRect.height;
m_PortRect.width = NodeWidth - 10;
m_PortRect.height = 50 + extraHeight;
}
//GUI.DrawTexture(m_PortRect, NodeColor);
if (Event.current.type == EventType.Repaint)
{
// Calculate rect for line below ports
Rect lineRect = new Rect(m_PortRect.x, HeaderRect.height + m_PortRect.height - WeightOfSectionLine, m_PortRect.width, WeightOfSectionLine);
Texture2D lineTex = GetColorTextureFromHexString("#888EF7");
// Draw line below ports
GUI.DrawTexture(lineRect, lineTex);
}
}
19
View Source File : GUIEasyJoystickCallBack.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
{
GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (gameObject != null && gameObject.GetComponent<EasyJoystick>() != null)
{
Rect rect = new Rect(selectionRect.x + selectionRect.width - 16f, selectionRect.y, 16f, 16f);
GUI.DrawTexture( rect,GUIEasyJoystickCallBack.HierarchyIcon);
}
}
19
View Source File : LeanTouch.cs
License : GNU General Public License v3.0
Project Creator : Cytoid
License : GNU General Public License v3.0
Project Creator : Cytoid
protected virtual void OnGUI()
{
// Show simulated multi fingers?
if (FingerTexture != null && Input.touchCount == 0 && Fingers.Count > 1)
{
for (var i = Fingers.Count - 1; i >= 0; i--)
{
var finger = Fingers[i];
// Don't show fingers that just went up, because real touches will be up the frame they release
if (finger.Up == false)
{
var screenPosition = finger.ScreenPosition;
var screenRect = new Rect(0, 0, FingerTexture.width, FingerTexture.height);
screenRect.center = new Vector2(screenPosition.x, UnityEngine.Screen.height - screenPosition.y);
GUI.DrawTexture(screenRect, FingerTexture);
}
}
}
}
19
View Source File : EasyButton.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
void OnGUI(){
if (enable){
GUI.depth = guiDepth;
useGUILayout = isUseGuiLayout;
VirtualScreen.ComputeVirtualScreen();
VirtualScreen.SetGuiScaleMatrix();
if (normalTexture!=null && activeTexture!=null){
ComputeButtonAnchor(anchor);
if (normalTexture!=null){
if (Application.isEditor && !Application.isPlaying){
currentTexture = normalTexture;
}
if (showDebugArea && Application.isEditor){
GUI.Box( buttonRect,"");
}
if (currentTexture!=null){
if (isActivated){
GUI.color = currentColor;
if (Application.isPlaying){
EasyTouch.RemoveReservedArea( buttonRect);
EasyTouch.AddReservedArea( buttonRect);
}
}
else{
GUI.color = new Color(currentColor.r,currentColor.g,currentColor.b,0.2f);
if (Application.isPlaying){
EasyTouch.RemoveReservedArea( buttonRect);
}
}
GUI.DrawTexture( buttonRect,currentTexture);
GUI.color = Color.white;
}
}
}
}
else{
EasyTouch.RemoveReservedArea( buttonRect);
}
}
19
View Source File : Example.cs
License : GNU General Public License v3.0
Project Creator : KleskBY
License : GNU General Public License v3.0
Project Creator : KleskBY
public static void GI(int id)
{
MenuItemStyle = new GUIStyle(GUI.skin.button);
MenuItemStyle.fontStyle = FontStyle.Bold;
MenuItemStyle.normal.textColor = Color.white;
MenuItemStyle.normal.background = texture;
MenuItemStyle.hover.textColor = Color.gray;
MenuItemStyle.hover.background = inactivetexture;
MenuItemStyle.active.background = inactivetexture;
ActiveMenuItemStyle = new GUIStyle(GUI.skin.button);
ActiveMenuItemStyle.fontStyle = FontStyle.Bold;
ActiveMenuItemStyle.normal.textColor = Color.white;
ActiveMenuItemStyle.normal.background = texture2;
ActiveMenuItemStyle.hover.textColor = Color.gray;
ActiveMenuItemStyle.hover.background = Activetexture;
ActiveMenuItemStyle.active.background = Activetexture;
GUIStyle TextStyle = new GUIStyle(GUI.skin.label);
TextStyle.fontStyle = FontStyle.Bold;
TextStyle.fontSize = 15;
GUIStyle Button1;
if (nameToAdd == "client_u") Button1 = ActiveMenuItemStyle;
else Button1 = MenuItemStyle;
GUIStyle Button2;
if (nameToAdd == "client_bear") Button2 = ActiveMenuItemStyle;
else Button2 = MenuItemStyle;
GUIStyle Button3;
if (nameToAdd == "client_player") Button3 = ActiveMenuItemStyle;
else Button3 = MenuItemStyle;
GUIStyle Button4;
if (nogrreplaced) Button4 = ActiveMenuItemStyle;
else Button4 = MenuItemStyle;
GUIStyle Button5;
if (NoTreeButton.Contains("ON")) Button5 = ActiveMenuItemStyle;
else Button5 = MenuItemStyle;
GUIStyle Button6;
if (amlight) Button6 = ActiveMenuItemStyle;
else Button6 = MenuItemStyle;
GUIStyle Button7;
if (ChamsButton.Contains("ON")) Button7 = ActiveMenuItemStyle;
else Button7 = MenuItemStyle;
GUIStyle Button8;
if (BoxButton.Contains("ON")) Button8 = ActiveMenuItemStyle;
else Button8 = MenuItemStyle;
GUIStyle Button9;
if (LineButton.Contains("ON")) Button9 = ActiveMenuItemStyle;
else Button9 = MenuItemStyle;
GUIStyle Button10;
if (DistButton.Contains("ON")) Button10 = ActiveMenuItemStyle;
else Button10 = MenuItemStyle;
GUI.DrawTexture(new Rect(0, 0, 350, 20), hoverbackground);
GUI.Label(new Rect(60, 0, 350, 20), "INTERIUM.OOO © KleskBY 2019", TextStyle);
GUI.Label(new Rect(39, 20, 140, 20), "TARGET TEAM:", TextStyle);
if (GUI.Button(new Rect(20, 40, 140, 20), "USEC", Button1))
{
badguys.Clear();
nameToAdd = "client_u";
}
if (GUI.Button(new Rect(20, 60, 140, 20), "BEAR", Button2))
{
badguys.Clear();
nameToAdd = "client_bear";
}
if (GUI.Button(new Rect(20, 80, 140, 20), "DeathMatch", Button3))
{
badguys.Clear();
nameToAdd = "client_player";
}
GUI.Label(new Rect(67, 100, 140, 20), "MISC:", TextStyle);
if (GUI.Button(new Rect(20, 120, 140, 20), NoGrreplacedButton, Button4))
{
if (nogrreplaced)
{
nogrreplaced = false;
NoGrreplacedButton = "NoGrreplaced: OFF";
try
{
foreach (GameObject go in grreplaced) go.SetActive(true);
}
catch
{
nogrreplaced = false;
NoGrreplacedButton = "NoGrreplaced: OFF";
}
}
else
{
grreplaced.Clear();
foreach (GameObject go in GameObject.FindObjectsOfType(typeof(GameObject)))
{
if (go.activeInHierarchy)
{
if (go.name.Contains("grreplaced") || go.name.Contains("brush") || go.name.Contains("paporotnik") || go.name.Contains("bush"))
{
grreplaced.Add(go);
go.SetActive(false);
}
}
}
nogrreplaced = true;
NoGrreplacedButton = "NoGrreplaced: ON";
}
}
if (GUI.Button(new Rect(20, 140, 140, 20), LightButton, Button6))
{
if (amlight)
{
amlight = false;
try
{
RenderSettings.fog = true;
RenderSettings.ambientLight = AmbientColor;
LightButton = "Brightness: OFF";
}
catch { amlight = false; }
}
else
{
AmbientColor = RenderSettings.ambientLight;
RenderSettings.fog = false;
RenderSettings.ambientLight = Color.white;
LightButton = "Brightness: ON";
amlight = true;
}
}
if (GUI.Button(new Rect(20, 160, 140, 20), ChamsButton, Button7))
{
if(wallhack)
{
ChamsButton = "WALLHACK: OFF";
wallhack = false;
}
else
{
ChamsButton = "WALLHACK: ON";
wallhack = true;
}
}
if (GUI.Button(new Rect(20, 180, 140, 20), "Patch chams", MenuItemStyle))
{
foreach (GameObject gameObj in badguys)
{
var distance = Vector3.Distance(Camera.main.transform.position, gameObj.transform.position);
{
if (distance < 10 && distance > 2)
{
gameObj.SetActive(false);
}
else
{
var rend = gameObj.GetComponentsInChildren<Renderer>();
foreach (Renderer renderer in rend) renderer.material.mainTexture = texture;
}
}
}
}
GUI.Label(new Rect(215, 20, 140, 20), "VISUALS:", TextStyle);
if (GUI.Button(new Rect(180, 40, 140, 20), BoxButton, Button8))
{
if (BoxEsp)
{
BoxEsp = false;
BoxButton = "BOX ESP: OFF";
}
else
{
BoxEsp = true;
BoxButton = "BOX ESP: ON";
}
}
if (GUI.Button(new Rect(180, 60, 140, 20), LineButton, Button9))
{
if (LineESP)
{
LineESP = false;
LineButton = "LINE ESP: OFF";
}
else
{
LineESP = true;
LineButton = "LINE ESP: ON";
}
}
if (GUI.Button(new Rect(180, 80, 140, 20), DistButton, Button10))
{
if (DistESP)
{
DistESP = false;
DistButton = "DIST ESP: OFF";
}
else
{
DistESP = true;
DistButton = "DIST ESP: ON";
}
}
GUI.Label(new Rect(220, 100, 140, 20), "AIMBOT:", TextStyle);
if (GUI.Button(new Rect(180, 120, 140, 20), AimButton, MenuItemStyle))
{
if(AimButton.Contains("HEAD"))
{
bone = "NPC_Neck";
AimButton = "BONE: NECK";
}
else if (AimButton.Contains("NECK"))
{
bone = "NPC_Spine1";
AimButton = "BONE: BODY";
}
else if (AimButton.Contains("BODY"))
{
bone = "NPC_Head";
AimButton = "BONE: HEAD";
}
}
FovButton = "FOV: " + fov.ToString();
if (GUI.Button(new Rect(180, 140, 140, 20), FovButton, MenuItemStyle))
{
if (fov == 1) fov = 2;
else if (fov == 2) fov = 3;
else if (fov == 3) fov = 4;
else if (fov == 4) fov = 5;
else if (fov == 5) fov = 1;
}
SmoothButton = "SMOOTH: " + smooth.ToString();
if (GUI.Button(new Rect(180, 160, 140, 20), SmoothButton, MenuItemStyle))
{
if (smooth == 1) smooth = 2;
else if(smooth == 2) smooth = 3;
else if(smooth == 3) smooth = 4;
else if (smooth == 4) smooth = 5;
else if (smooth == 5) smooth = 1;
}
SmoothButton = "SMOOTH: " + smooth.ToString();
if (GUI.Button(new Rect(180, 160, 140, 20), SmoothButton, MenuItemStyle))
{
if (smooth == 1) smooth = 2;
else if (smooth == 2) smooth = 3;
else if (smooth == 3) smooth = 4;
else if (smooth == 4) smooth = 5;
else if (smooth == 5) smooth = 1;
}
KeyButton = "KEY: " + aimkey.ToString();
if (GUI.Button(new Rect(180, 180, 140, 20), KeyButton, MenuItemStyle))
{
if (aimkey == KeyCode.V) aimkey = KeyCode.Mouse1;
else if (aimkey == KeyCode.Mouse1) aimkey = KeyCode.Mouse0;
else if (aimkey == KeyCode.Mouse0) aimkey = KeyCode.LeftShift;
else if (aimkey == KeyCode.LeftShift) aimkey = KeyCode.LeftAlt;
else if (aimkey == KeyCode.LeftAlt) aimkey = KeyCode.V;
}
GUI.DragWindow();
}
19
View Source File : EasytouchHierachyCallBack.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
{
GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (gameObject != null){
Rect rect = new Rect(selectionRect.x + selectionRect.width - 16f, selectionRect.y, 16f, 16f);
if ( gameObject.GetComponent<EasyTouch>() != null){
GUI.DrawTexture( rect,EasytouchHierachyCallBack.HierarchyIcon);
}
else if (gameObject.GetComponent<QuickBase>() != null){
GUI.DrawTexture( rect,EasytouchHierachyCallBack.HierarchyEventIcon);
}
#if FALSE
else if (gameObject.GetComponent<EasyTouchSceneProxy>() != null){
GUI.DrawTexture( rect,EasytouchHierachyCallBack.HierarchyIcon);
}
#endif
}
}
19
View Source File : Background.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
protected internal override void Draw()
{
if (movie != null)
{
UnityEngine.GUI.DrawTexture(screenRect, movie);
}
else
{
UnityEngine.GUI.DrawTexture(screenRect, texture);
}
UnityEngine.GUI.Label(screenRect, UIMainReferences.VersionShow, style);
}
19
View Source File : SFPSC_Console.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public override float DrawInner(ref Rect r){
float prevYpos = r.y;
r.y = 0;
r.xMin += 20;
r.y += 20;
//GUI.DrawTexture(r.ClampSize(0,SF_Styles.IconWarningSmall.width),SF_Styles.IconWarningSmall);
//r.xMin += 20;
//GUI.Label(r, "Experimental features may not work");
//r.xMin -= 20;
// r.height += 20;
r.height = 20;
for( int i = 0; i < treeStatus.Errors.Count; i++ ) {
bool isNode = treeStatus.Errors[i].node != null;
Texture2D icon = treeStatus.Errors[i].icon;
Rect blockRect = r;
blockRect.height = treeStatus.Errors[i].rows * 14f + 6;
Rect iconRect = blockRect;
iconRect.width = icon.width;
iconRect.height = icon.height;
//iconRect.x += 1;
//iconRect.y += 1;
Rect textRect = blockRect;
textRect.xMin += iconRect.width + 3;
iconRect.center = new Vector2( iconRect.center.x, textRect.center.y );
bool hasAction = treeStatus.Errors[i].action != null;
if( isNode || hasAction ) {
if( GUI.Button( iconRect.Pad( -2 ).PadHorizontal(-3), "" ) ) {
if( hasAction ) {
treeStatus.Errors[i].OnPress();
break;
} else if( isNode ) {
editor.nodeView.selection.DeselectAll( true );
treeStatus.Errors[i].node.Select( true );
}
}
}
GUI.DrawTexture( iconRect, icon );
EditorGUI.SelectableLabel( textRect, treeStatus.Errors[i].error, SF_Styles.SmallTextArea );
r.y += textRect.height;
}
r.y += prevYpos;
return (int)r.yMax;
}
19
View Source File : TrackballGroupDrawer.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
void OnWheelGUI(Rect position, int size, SerializedProperty property)
{
if (Event.current.type == EventType.Layout)
return;
var value = property.colorValue;
float offset = value.a;
var wheelDrawArea = position;
wheelDrawArea.height = size;
if (wheelDrawArea.width > wheelDrawArea.height)
{
wheelDrawArea.x += (wheelDrawArea.width - wheelDrawArea.height) / 2.0f;
wheelDrawArea.width = position.height;
}
wheelDrawArea.width = wheelDrawArea.height;
float hsize = size / 2f;
float radius = 0.38f * size;
Vector3 hsv;
Color.RGBToHSV(value, out hsv.x, out hsv.y, out hsv.z);
if (Event.current.type == EventType.Repaint)
{
float scale = EditorGUIUtility.pixelsPerPoint;
// Wheel texture
var oldRT = RenderTexture.active;
var rt = RenderTexture.GetTemporary((int)(size * scale), (int)(size * scale), 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
s_Material.SetFloat("_Offset", offset);
s_Material.SetFloat("_DisabledState", GUI.enabled ? 1f : 0.5f);
s_Material.SetVector("_Resolution", new Vector2(size * scale, size * scale / 2f));
Graphics.Blit(null, rt, s_Material, EditorGUIUtility.isProSkin ? 0 : 1);
RenderTexture.active = oldRT;
GUI.DrawTexture(wheelDrawArea, rt);
RenderTexture.ReleaseTemporary(rt);
// Thumb
var thumbPos = Vector2.zero;
float theta = hsv.x * (Mathf.PI * 2f);
float len = hsv.y * radius;
thumbPos.x = Mathf.Cos(theta + (Mathf.PI / 2f));
thumbPos.y = Mathf.Sin(theta - (Mathf.PI / 2f));
thumbPos *= len;
var thumbSize = FxStyles.wheelThumbSize;
var thumbSizeH = thumbSize / 2f;
FxStyles.wheelThumb.Draw(new Rect(wheelDrawArea.x + hsize + thumbPos.x - thumbSizeH.x, wheelDrawArea.y + hsize + thumbPos.y - thumbSizeH.y, thumbSize.x, thumbSize.y), false, false, false, false);
}
var bounds = wheelDrawArea;
bounds.x += hsize - radius;
bounds.y += hsize - radius;
bounds.width = bounds.height = radius * 2f;
hsv = GetInput(bounds, hsv, radius);
value = Color.HSVToRGB(hsv.x, hsv.y, 1f);
value.a = offset;
// Luminosity booster
position = wheelDrawArea;
float oldX = position.x;
float oldW = position.width;
position.y += position.height + 4f;
position.x += (position.width - (position.width * 0.75f)) / 2f;
position.width = position.width * 0.75f;
position.height = EditorGUIUtility.singleLineHeight;
value.a = GUI.HorizontalSlider(position, value.a, -1f, 1f);
// Advanced controls
var data = Vector3.zero;
if (TryGetDisplayValue(value, property, out data))
{
position.x = oldX;
position.y += position.height;
position.width = oldW / 3f;
using (new EditorGUI.DisabledGroupScope(true))
{
GUI.Label(position, data.x.ToString("F2"), EditorStyles.centeredGreyMiniLabel);
position.x += position.width;
GUI.Label(position, data.y.ToString("F2"), EditorStyles.centeredGreyMiniLabel);
position.x += position.width;
GUI.Label(position, data.z.ToString("F2"), EditorStyles.centeredGreyMiniLabel);
position.x += position.width;
}
}
// replacedle
position.x = oldX;
position.y += position.height;
position.width = oldW;
GUI.Label(position, property.displayName, EditorStyles.centeredGreyMiniLabel);
if (m_ResetState)
{
value = Color.clear;
m_ResetState = false;
}
property.colorValue = value;
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private void DrawProjectName(Rect parent)
{
float projectNameRectHeight = 40;
Rect projectNameRect = new Rect(0, parent.height - projectNameRectHeight, parent.width, projectNameRectHeight);
// DRAWING BACKGROUND
GUI.DrawTexture(projectNameRect, blackBarBG);
// DRAWING PROJECT NAME LABEL
GUILayout.BeginArea(projectNameRect);
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
GUILayout.Label(PIASession.Instance.ProjectName, skin.GetStyle("projectname"));
GUILayout.FlexibleSpace();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndArea();
}
19
View Source File : GUI.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
public static void DrawTexture(Rect position, Texture tex)
{
UGUI.DrawTexture(position, tex);
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private void DrawToolbar()
{
float iconWidth = 36;
int spaceBetweenIcons = 8;
Rect firstColorRect;
Rect secondColorRect;
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
// SELECTED TOOL BOX
switch (drawer.ToolType) {
case PIAToolType.Paint:
selectedToolRect = new Rect(15, 4, iconWidth, iconWidth);
break;
case PIAToolType.Erase:
selectedToolRect = new Rect(15 + iconWidth + spaceBetweenIcons, 4, iconWidth, iconWidth);
break;
case PIAToolType.Selection:
selectedToolRect = new Rect(15 + iconWidth * 2 + spaceBetweenIcons * 2, 4, iconWidth, iconWidth);
break;
case PIAToolType.Rectangle:
selectedToolRect = new Rect(15 + iconWidth * 3 + spaceBetweenIcons * 3 , 4, iconWidth, iconWidth);
break;
case PIAToolType.RectangleFilled:
selectedToolRect = new Rect(15 + iconWidth * 4 + spaceBetweenIcons * 4, 4, iconWidth, iconWidth);
break;
case PIAToolType.Dithering:
selectedToolRect = new Rect(15 + iconWidth * 5 + spaceBetweenIcons * 5, 4, iconWidth, iconWidth);
break;
}
GUI.DrawTexture(selectedToolRect, selectedToolBG);
// PAINT TOOL
GUILayout.Space(15);
if (GUILayout.Button(pen, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
{
drawer.ToolType = PIAToolType.Paint;
}
Rect penGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
Rect penTooltipRect = new Rect(0, 0, 75, 22.5f);
PIATooltip penTooltip = new PIATooltip(penTooltipRect, "Paint (Q)");
PIATooltip.SetPositionPreset(ref penTooltip, penGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(penGlobalRect, penTooltip);
GUILayout.Space(spaceBetweenIcons);
// ERASER TOOL
if (GUILayout.Button(eraser, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
{
drawer.ToolType = PIAToolType.Erase;
}
Rect eraseGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
Rect eraseTooltipRect = new Rect(0, 0, 75, 22.5f);
PIATooltip eraseTooltip = new PIATooltip(eraseTooltipRect, "Erase (E)");
PIATooltip.SetPositionPreset(ref eraseTooltip, eraseGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(eraseGlobalRect, eraseTooltip);
GUILayout.Space(spaceBetweenIcons);
// SELECTION TOOL
if (GUILayout.Button(selectionBox, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
{
drawer.ToolType = PIAToolType.Selection;
}
Rect selectionBoxGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
Rect selectionBoxTooltipRect = new Rect(0, 0, 150, 22.5f);
PIATooltip selectionBoxTooltip = new PIATooltip(selectionBoxTooltipRect, "Filled Erase (Shift+E)");
PIATooltip.SetPositionPreset(ref selectionBoxTooltip, selectionBoxGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(selectionBoxGlobalRect, selectionBoxTooltip);
GUILayout.Space(spaceBetweenIcons);
// RECTANGLE TOOL
if (GUILayout.Button(squareTool, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
{
drawer.ToolType = PIAToolType.Rectangle;
}
Rect squareGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
Rect squareTooltipRect = new Rect(0, 0, 105, 22.5f);
PIATooltip squareTooltip = new PIATooltip(squareTooltipRect, "Rectangle (R)");
PIATooltip.SetPositionPreset(ref squareTooltip, squareGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(squareGlobalRect, squareTooltip);
GUILayout.Space(spaceBetweenIcons);
// FILLED RECTANGLE TOOL
if (GUILayout.Button(filledSquareTool, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
{
drawer.ToolType = PIAToolType.RectangleFilled;
}
Rect filledSquareGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
Rect filledSquareTooltipRect = new Rect(0, 0, 175, 22.5f);
PIATooltip filledSquareTooltip = new PIATooltip(filledSquareTooltipRect, "Filled Rectangle (Shift+R)");
PIATooltip.SetPositionPreset(ref filledSquareTooltip, filledSquareGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(filledSquareGlobalRect, filledSquareTooltip);
GUILayout.Space(spaceBetweenIcons);
// DITHERING TOOL
if (GUILayout.Button(ditheringTool, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
{
drawer.ToolType = PIAToolType.Dithering;
}
Rect ditheringToolGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
Rect ditheringToolTooltipRect = new Rect(0, 0, 120, 22.5f);
PIATooltip ditheringToolTooltip = new PIATooltip(ditheringToolTooltipRect, "Dithering tool (T)");
PIATooltip.SetPositionPreset(ref ditheringToolTooltip, ditheringToolGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(ditheringToolGlobalRect, ditheringToolTooltip);
// COLORS FIELDS RECT
firstColorRect = new Rect(GUILayoutUtility.GetLastRect().x + 40 + spaceBetweenIcons, 8, 60, 20);
secondColorRect = new Rect(firstColorRect.x + 35, 18, 60, 20);
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
// DRAWING COLORS FIELDS
drawer.FirstColor = EditorGUI.ColorField(firstColorRect, new GUIContent(""), drawer.FirstColor, false, true, false, null);
drawer.SecondColor = EditorGUI.ColorField(secondColorRect, new GUIContent(""), drawer.SecondColor, false, true, false, null);
}
19
View Source File : TreeControl.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
public TreeNodeRenderResult Render(Rect rect, float indentation, bool isSelected, bool treeIsBusy, GUIStyle toggleStyle, GUIStyle nodeStyle, GUIStyle activeNodeStyle)
{
var renderResult = TreeNodeRenderResult.None;
if (treeIsBusy)
{
GUI.enabled = false;
}
if (IsHidden)
return renderResult;
var fillRect = rect;
var nodeStartX = Level * indentation + rect.x;
nodeStartX += 2 * level;
var nodeRect = new Rect(nodeStartX, rect.y, fillRect.width - nodeStartX, rect.height);
var reserveToggleSpace = TreeIsCheckable || isFolder;
var toggleRect = new Rect(nodeStartX, nodeRect.y, reserveToggleSpace ? indentation : 0, nodeRect.height);
nodeStartX += toggleRect.width;
if (reserveToggleSpace)
{
nodeStartX += 2;
}
var checkRect = new Rect(nodeStartX, nodeRect.y, TreeIsCheckable ? indentation : 0, nodeRect.height);
nodeStartX += checkRect.width;
if (TreeIsCheckable)
{
nodeStartX += 2;
}
var iconRect = new Rect(nodeStartX, nodeRect.y, fillRect.width - nodeStartX, nodeRect.height);
var statusRect = new Rect(iconRect.x + 6, iconRect.yMax - 9, 9, 9);
var contentStyle = IsActive ? activeNodeStyle : nodeStyle;
if (Event.current.type == EventType.Repaint)
{
contentStyle.Draw(fillRect, GUIContent.none, false, false, false, isSelected);
}
var styleOn = false;
if (IsFolderOrContainer)
{
styleOn = !IsCollapsed;
if (Event.current.type == EventType.Repaint)
{
toggleStyle.Draw(toggleRect, GUIContent.none, false, false, styleOn, isSelected);
}
EditorGUI.BeginChangeCheck();
{
GUI.Toggle(toggleRect, !IsCollapsed, GUIContent.none, GUIStyle.none);
}
if (EditorGUI.EndChangeCheck())
{
renderResult = TreeNodeRenderResult.VisibilityChange;
}
}
if (TreeIsCheckable)
{
var selectionStyle = GUI.skin.toggle;
var selectionValue = false;
if (CheckState == CheckState.Checked)
{
selectionValue = true;
}
else if (CheckState == CheckState.Mixed)
{
selectionStyle = Styles.ToggleMixedStyle;
}
EditorGUI.BeginChangeCheck();
{
GUI.Toggle(checkRect, selectionValue, GUIContent.none, selectionStyle);
}
if (EditorGUI.EndChangeCheck())
{
renderResult = TreeNodeRenderResult.CheckChange;
}
}
if (Event.current.type == EventType.Repaint)
{
contentStyle.Draw(iconRect, content, false, false, false, isSelected);
}
if (IconBadge != null)
{
GUI.DrawTexture(statusRect, IconBadge);
}
if (treeIsBusy)
{
GUI.enabled = true;
}
return renderResult;
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private Rect DrawPreview(Rect parent) {
Vector2 offset = new Vector2(20, 20);
// PREVIEW RECT
Vector2 previewLocalPosition = new Vector2(offset.x, offset.y);
Vector2 previewDimension = new Vector2(parent.width - offset.x * 2, parent.width - offset.x * 2);
Rect previewRect = new Rect(previewLocalPosition, previewDimension);
// FPS COUNTER RECT
Vector2 fpsLocalPosition = new Vector2(previewRect.x, previewRect.yMax);
Vector2 fpsDimension = new Vector2(40, 20);
Rect fpsRect = new Rect(fpsLocalPosition, fpsDimension);
// SLIDER RECT
Vector2 speedSliderLocalPosition = new Vector2(fpsRect.xMax, previewRect.yMax);
Vector2 speedSliderDimension = new Vector2(previewRect.width - fpsRect.width, 20);
Rect speedSliderRect = new Rect(speedSliderLocalPosition, speedSliderDimension);
// BG RECT
Rect previewBGRect = new Rect(previewRect.x - offset.x / 2, previewRect.y - offset.y / 2, previewRect.width + offset.x,
previewRect.height + speedSliderRect.height + offset.y / 2);
// EXTEND WINDOW RECT
Vector2 extendWindowRectOffset = new Vector2(5, 5);
float extendWindowRectWidth = 24;
float extendWindowRectHeight = 24;
Rect extendWindowRect = new Rect(previewRect.xMax - extendWindowRectWidth - extendWindowRectOffset.x,
previewRect.yMax - extendWindowRectHeight - extendWindowRectOffset.y, extendWindowRectWidth, extendWindowRectHeight);
// DRAWING STUFF
GUI.DrawTexture(previewBGRect, blackBarBG);
EditorGUI.DrawTextureTransparent(previewRect,PIAAnimator.Instance.GetFrameOrFirst().GetFrameTexture());
GUI.Label(fpsRect, PIAAnimator.Instance.Speed + " FPS", skin.GetStyle("fpscounter"));
PIAAnimator.Instance.Speed = (int)GUI.HorizontalSlider(speedSliderRect, PIAAnimator.Instance.Speed, 0, 24);
if (PIAInputArea.IsMouseInsideRect(previewBGRect))
{
if (GUI.Button(extendWindowRect, GUIContent.none,skin.GetStyle("extendpreview")))
PIAExtendedPreviewWindow.ShowWindow();
Rect extendWindowGlobalRect = PIATooltipUtility.ChildToGlobalRect(extendWindowRect, parent);
Rect extendWindowTooltipRect = new Rect(0, 0, 105, 22.5f);
PIATooltip extendWindowTooltip = new PIATooltip(extendWindowTooltipRect, "Extend preview");
PIATooltip.SetPositionPreset(ref extendWindowTooltip, extendWindowGlobalRect, PIATooltip.PIATooltipPreset.Down);
PIATooltipUtility.AddTooltip(extendWindowGlobalRect, extendWindowTooltip);
}
return previewBGRect;
}
19
View Source File : UPADrawer.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
public static void DrawImage (UPAImage img) {
Rect texPos = img.GetImgRect();
Texture2D bg = new Texture2D (1,1);
bg.SetPixel (0,0, Color.clear);
bg.Apply();
EditorGUI.DrawTextureTransparent (texPos, bg);
DestroyImmediate (bg);
//Calculate the final image from the layers list
Texture2D _result = CalculateBlendedTex(img.layers);
//Draw the image
_result.SetPixel(1, 1, Color.black);
GUI.DrawTexture(texPos, _result);
// Draw a grid above the image (y axis first)
for (int x = 0; x <= img.width; x += 1) {
float posX = texPos.xMin + ( (float)texPos.width / (float)img.width ) * x - 0.2f;
EditorGUI.DrawRect (new Rect (posX, texPos.yMin, 1, texPos.height), gridBGColor);
}
// Then x axis
for (int y = 0; y <= img.height; y += 1) {
float posY = texPos.yMin + ( (float)texPos.height / (float)img.height ) * y - 0.2f;
EditorGUI.DrawRect (new Rect (texPos.xMin, posY, texPos.width, 1), gridBGColor);
}
}
19
View Source File : IMLNodeEditor.cs
License : MIT License
Project Creator : Interactml
License : MIT License
Project Creator : Interactml
public override void OnHeaderGUI()
{
if(EditorWindow.focusedWindow != null)
{
/*if (!EditorWindow.focusedWindow.ToString().Contains("XNodeEditor.NodeEditorWindow") && lastWindow != EditorWindow.focusedWindow.ToString())
{
Resources.UnloadUnusedreplacedets();
lastWindow = EditorWindow.focusedWindow.ToString();
}*/
}
// Load node skin
if (m_NodeSkin == null)
m_NodeSkin = Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin");
IMLGraph m_IMLGraph = target.graph as IMLGraph;
if (!m_IMLGraph.IsGraphRunning/* && Event.current.type == EventType.Repaint*/)
{
HeaderRect.height = 500;
HeaderRect.width = 800;
GUILayout.BeginArea(HeaderRect);
GUILayout.Label("Graph not in this scene", m_NodeSkin.GetStyle("Header"), GUILayout.MinWidth(200));
GUILayout.Label("Please open scene with this graph in or add to this scene", m_NodeSkin.GetStyle("Header Small"), GUILayout.MinWidth(200));
GUILayout.EndArea();
} else
{
// If we want to reskin the node
if (UIReskinAuto)
{
// Get references
m_IMLNode = target as IMLNode;
m_IMLNodeSerialized = new SerializedObject(m_IMLNode);
NodeWidth = this.GetWidth();
// Draws header with live subreplacedle if input connected - only data type nodes
string name = m_IMLNode.GetType().ToString();
//find out if the node is a data type node
if (name.Contains("DataType"))
NodeSubreplacedle = m_IMLNode.GetInputNodesConnected("m_In")!=null ? "LIVE" : null;
// Initialise header background Rects
InitHeaderRects();
NodeColor = GetColorTextureFromHexString("#3A3B5B");
if (Event.current.type == EventType.Repaint)
{
// Draw over xnode header tint
//GUI.DrawTexture(new Rect(6, 6, GetWidth() - 12, 24), NodeColor);
// Draw line below header
GUI.DrawTexture(LineBelowHeader, GetColorTextureFromHexString("#888EF7"));
}
//Display Node name
if (String.IsNullOrEmpty(NodeName))
NodeName = target.GetType().Name;
GUILayout.BeginArea(HeaderRect);
GUILayout.Label(NodeName, m_NodeSkin.GetStyle("Header"), GUILayout.MinWidth(NodeWidth - 10));
//if(!String.IsNullOrEmpty(NodeSubreplacedle)) this causes the GUI to stutter
//commented out nodeid in subreplacedle for debugging
GUILayout.Label(NodeSubreplacedle, m_NodeSkin.GetStyle("Header Small"), GUILayout.MinWidth(NodeWidth - 10));
GUILayout.EndArea();
GUILayout.Label("", GUILayout.MinHeight(60));
}
// If we want to keep xNode's default skin
else
{
base.OnHeaderGUI();
}
}
}
19
View Source File : UIPrefabTool.cs
License : MIT License
Project Creator : mamoniem
License : MIT License
Project Creator : mamoniem
void OnGUI ()
{
Event currentEvent = Event.current;
EventType type = currentEvent.type;
int x = cellPadding, y = cellPadding;
int width = Screen.width - cellPadding;
int spacingX = cellSize + cellPadding;
int spacingY = spacingX;
if (mMode == Mode.DetailedMode) spacingY += 32;
GameObject dragged = draggedObject;
bool isDragging = (dragged != null);
int indexUnderMouse = GetCellUnderMouse(spacingX, spacingY);
Item selection = isDragging ? FindItem(dragged) : null;
string searchFilter = NGUISettings.searchField;
int newTab = mTab;
GUILayout.BeginHorizontal();
if (GUILayout.Toggle(newTab == 0, "1", "ButtonLeft")) newTab = 0;
if (GUILayout.Toggle(newTab == 1, "2", "ButtonMid")) newTab = 1;
if (GUILayout.Toggle(newTab == 2, "3", "ButtonMid")) newTab = 2;
if (GUILayout.Toggle(newTab == 3, "4", "ButtonMid")) newTab = 3;
if (GUILayout.Toggle(newTab == 4, "5", "ButtonRight")) newTab = 4;
GUILayout.EndHorizontal();
if (mTab != newTab)
{
Save();
mTab = newTab;
mReset = true;
NGUISettings.SetInt("NGUI Prefab Tab", mTab);
Load();
}
if (mReset && type == EventType.Repaint)
{
mReset = false;
foreach (Item item in mItems) GeneratePreview(item, null);
RectivateLights();
}
// Search field
GUILayout.BeginHorizontal();
{
string after = EditorGUILayout.TextField("", searchFilter, "SearchTextField", GUILayout.Width(Screen.width - 20f));
if (GUILayout.Button("", "SearchCancelButton", GUILayout.Width(18f)))
{
after = "";
GUIUtility.keyboardControl = 0;
}
if (searchFilter != after)
{
NGUISettings.searchField = after;
searchFilter = after;
}
}
GUILayout.EndHorizontal();
bool eligibleToDrag = (currentEvent.mousePosition.y < Screen.height - 40);
if (type == EventType.MouseDown)
{
mMouseIsInside = true;
}
else if (type == EventType.MouseDrag)
{
mMouseIsInside = true;
if (indexUnderMouse != -1 && eligibleToDrag)
{
// Drag operation begins
if (draggedObjectIsOurs) DragAndDrop.StartDrag("Prefab Tool");
currentEvent.Use();
}
}
else if (type == EventType.MouseUp)
{
DragAndDrop.PrepareStartDrag();
mMouseIsInside = false;
Repaint();
}
else if (type == EventType.DragUpdated)
{
// Something dragged into the window
mMouseIsInside = true;
UpdateVisual();
currentEvent.Use();
}
else if (type == EventType.DragPerform)
{
// We've dropped a new object into the window
if (dragged != null)
{
if (selection != null)
{
DestroyTexture(selection);
mItems.Remove(selection);
}
AddItem(dragged, indexUnderMouse);
draggedObject = null;
}
mMouseIsInside = false;
currentEvent.Use();
}
else if (type == EventType.DragExited || type == EventType.Ignore)
{
mMouseIsInside = false;
}
// If the mouse is not inside the window, clear the selection and dragged object
if (!mMouseIsInside)
{
selection = null;
dragged = null;
}
// Create a list of indices, inserting an entry of '-1' underneath the dragged object
BetterList<int> indices = new BetterList<int>();
for (int i = 0; i < mItems.size; )
{
if (dragged != null && indices.size == indexUnderMouse)
indices.Add(-1);
if (mItems[i] != selection)
{
if (string.IsNullOrEmpty(searchFilter) ||
mItems[i].prefab.name.IndexOf(searchFilter, System.StringComparison.CurrentCultureIgnoreCase) != -1)
indices.Add(i);
}
++i;
}
// There must always be '-1' (Add/Move slot) present
if (!indices.Contains(-1)) indices.Add(-1);
// We want to start dragging something from within the window
if (eligibleToDrag && type == EventType.MouseDown && indexUnderMouse > -1)
{
GUIUtility.keyboardControl = 0;
if (currentEvent.button == 0 && indexUnderMouse < indices.size)
{
int index = indices[indexUnderMouse];
if (index != -1 && index < mItems.size)
{
selection = mItems[index];
draggedObject = selection.prefab;
dragged = selection.prefab;
currentEvent.Use();
}
}
}
//else if (type == EventType.MouseUp && currentEvent.button == 1 && indexUnderMouse > mItems.size)
//{
// NGUIContextMenu.AddItem("Reset", false, RemoveItem, index);
// NGUIContextMenu.Show();
//}
// Draw the scroll view with prefabs
mPos = GUILayout.BeginScrollView(mPos);
{
Color normal = new Color(1f, 1f, 1f, 0.5f);
for (int i = 0; i < indices.size; ++i)
{
int index = indices[i];
Item ent = (index != -1) ? mItems[index] : selection;
if (ent != null && ent.prefab == null)
{
mItems.RemoveAt(index);
continue;
}
Rect rect = new Rect(x, y, cellSize, cellSize);
Rect inner = rect;
inner.xMin += 2f;
inner.xMax -= 2f;
inner.yMin += 2f;
inner.yMax -= 2f;
rect.yMax -= 1f; // Button seems to be mis-shaped. It's height is larger than its width by a single pixel.
if (!isDragging && (mMode == Mode.CompactMode || (ent == null || ent.tex != null)))
mContent.tooltip = (ent != null) ? ent.prefab.name : "Click to add";
else mContent.tooltip = "";
//if (ent == selection)
{
GUI.color = normal;
NGUIEditorTools.DrawTiledTexture(inner, NGUIEditorTools.backdropTexture);
}
GUI.color = Color.white;
GUI.backgroundColor = normal;
if (GUI.Button(rect, mContent, "Button"))
{
if (ent == null || currentEvent.button == 0)
{
string path = EditorUtility.OpenFilePanel("Add a prefab", NGUISettings.currentPath, "prefab");
if (!string.IsNullOrEmpty(path))
{
NGUISettings.currentPath = System.IO.Path.GetDirectoryName(path);
Item newEnt = CreateItemByPath(path);
if (newEnt != null)
{
mItems.Add(newEnt);
Save();
}
}
}
else if (currentEvent.button == 1)
{
NGUIContextMenu.AddItem("Delete", false, RemoveItem, index);
NGUIContextMenu.Show();
}
}
string caption = (ent == null) ? "" : ent.prefab.name.Replace("Control - ", "");
if (ent != null)
{
if (ent.tex != null)
{
GUI.DrawTexture(inner, ent.tex);
}
else if (mMode != Mode.DetailedMode)
{
GUI.Label(inner, caption, mStyle);
caption = "";
}
}
else GUI.Label(inner, "Add", mStyle);
if (mMode == Mode.DetailedMode)
{
GUI.backgroundColor = new Color(1f, 1f, 1f, 0.5f);
GUI.contentColor = new Color(1f, 1f, 1f, 0.7f);
GUI.Label(new Rect(rect.x, rect.y + rect.height, rect.width, 32f), caption, "ProgressBarBack");
GUI.contentColor = Color.white;
GUI.backgroundColor = Color.white;
}
x += spacingX;
if (x + spacingX > width)
{
y += spacingY;
x = cellPadding;
}
}
GUILayout.Space(y);
}
GUILayout.EndScrollView();
// Mode
Mode modeAfter = (Mode)EditorGUILayout.EnumPopup(mMode);
if (modeAfter != mMode)
{
mMode = modeAfter;
mReset = true;
NGUISettings.SetEnum("NGUI Prefab Mode", mMode);
}
}
19
View Source File : TrafficRulesOverlay.cs
License : MIT License
Project Creator : CitiesSkylinesMods
License : MIT License
Project Creator : CitiesSkylinesMods
public bool DrawSign(bool small,
ref Vector3 camPos,
Color guiColor,
Texture2D signTexture)
{
int col = counter_ / signsPerRow_;
int row = counter_ - (col * signsPerRow_);
counter_++;
// +0.5f so that the signs don't cover crossings.
Vector3 signCenter =
origin_ +
((signSizeMeters_ * (col + 0.5f)) * dirY_) +
(((signSizeMeters_ * row) + startX_) * dirX_);
bool visible = GeometryUtil.WorldToScreenPoint(worldPos: signCenter,
screenPos: out Vector3 signScreenPos);
if (!visible) {
return false;
}
Vector3 diff = signCenter - camPos;
float zoom = 100.0f * baseZoom_ / diff.magnitude;
float size = (small ? 0.75f : 1f)
* (viewOnly_ ? VIEW_SIZE_RATIO : 1f)
* SIGN_SIZE_PIXELS * zoom;
var boundingBox = new Rect(
x: signScreenPos.x - (size * 0.5f),
y: signScreenPos.y - (size * 0.5f),
width: size,
height: size);
bool hoveredHandle = !viewOnly_ && TrafficManagerTool.IsMouseOver(boundingBox);
if (viewOnly_) {
// Readonly signs look grey-ish
guiColor = Color.Lerp(guiColor, Color.gray, 0.5f);
guiColor.a = TrafficManagerTool.GetHandleAlpha(hovered: false);
} else {
// Handles in edit mode are always visible. Hovered handles are also highlighted.
guiColor.a = 1f;
if (hoveredHandle) {
guiColor = Color.Lerp(
a: guiColor,
b: new Color(r: 1f, g: .7f, b: 0f),
t: 0.5f);
}
}
// guiColor.a = TrafficManagerTool.GetHandleAlpha(hoveredHandle);
GUI.color = guiColor;
GUI.DrawTexture(boundingBox, signTexture);
return hoveredHandle;
}
19
View Source File : GUIEasyButtonCallBack.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
{
GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (gameObject != null && gameObject.GetComponent<EasyButton>() != null)
{
Rect rect = new Rect(selectionRect.x + selectionRect.width - 16f, selectionRect.y, 16f, 16f);
GUI.DrawTexture( rect,GUIEasyButtonCallBack.HierarchyIcon);
}
}
19
View Source File : IMLNodeEditor.cs
License : MIT License
Project Creator : Interactml
License : MIT License
Project Creator : Interactml
protected virtual void DrawHelpButtonLayout(float y)
{
//if (Event.current.type == EventType.Repaint)
//{
m_HelpRect.x = 5;
m_HelpRect.y = y;
m_HelpRect.width = NodeWidth - 10;
m_HelpRect.height = 40;
Texture2D texture = GetColorTextureFromHexString("#888EF7");
//Draw separator line
GUI.DrawTexture(new Rect(m_HelpRect.x, HeaderRect.height + m_PortRect.height + m_BodyRect.height - WeightOfSeparatorLine, m_HelpRect.width, WeightOfSeparatorLine * 2), texture);
//}
}
19
View Source File : GUIEasytouchCallBack.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
{
GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (gameObject != null && gameObject.GetComponent<EasyTouch>() != null)
{
Rect rect = new Rect(selectionRect.x + selectionRect.width - 16f, selectionRect.y, 16f, 16f);
GUI.DrawTexture( rect,GUIEasytouchCallBack.HierarchyIcon);
}
}
19
View Source File : BackgroundOnStart.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
private void OnGUI()
{
UnityEngine.GUI.DrawTexture(position, background);
}
19
View Source File : HTGUILayout.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
private static Rect DrawreplacedleGradient(int padding, int width)
{
int space=35;
GUILayout.Space(space);
Rect lastRect = GUILayoutUtility.GetLastRect();
lastRect.yMin = lastRect.yMin + 7;
lastRect.yMax = lastRect.yMax - 7;
lastRect.width = Screen.width;
if (width==-1)
GUI.DrawTexture(new Rect(padding,lastRect.yMin+1,Screen.width, lastRect.yMax- lastRect.yMin), GetGradientTexture());
else
GUI.DrawTexture(new Rect(padding,lastRect.yMin+1,width, lastRect.yMax- lastRect.yMin), GetGradientTexture());
return lastRect;
}
19
View Source File : Example.cs
License : GNU General Public License v3.0
Project Creator : KleskBY
License : GNU General Public License v3.0
Project Creator : KleskBY
public static void RectFilled(float x, float y, float width, float height, Texture2D text)
{
GUI.DrawTexture(new Rect(x, y, width, height), text);
}
19
View Source File : EasyTouch.cs
License : MIT License
Project Creator : slicol
License : MIT License
Project Creator : slicol
void OnGUI(){
Vector2 finger = input.GetSecondFingerPosition();
if (finger!=new Vector2(-1,-1)){
GUI.DrawTexture( new Rect(finger.x-16,Screen.height-finger.y-16,32,32),secondFingerTexture);
}
}
19
View Source File : SteamVR_LoadLevel.cs
License : MIT License
Project Creator : dag10
License : MIT License
Project Creator : dag10
void OnGUI()
{
if (_active != this)
return;
// Optionally create an overlay for our progress bar to use, separate from the loading screen.
if (progressBarEmpty != null && progressBarFull != null)
{
if (progressBarOverlayHandle == OpenVR.k_ulOverlayHandleInvalid)
progressBarOverlayHandle = GetOverlayHandle("progressBar", progressBarTransform != null ? progressBarTransform : transform, progressBarWidthInMeters);
if (progressBarOverlayHandle != OpenVR.k_ulOverlayHandleInvalid)
{
var progress = (async != null) ? async.progress : 0.0f;
// Use the full bar size for everything.
var w = progressBarFull.width;
var h = progressBarFull.height;
// Create a separate render texture so we can composite the full image on top of the empty one.
if (renderTexture == null)
{
renderTexture = new RenderTexture(w, h, 0);
renderTexture.Create();
}
var prevActive = RenderTexture.active;
RenderTexture.active = renderTexture;
if (Event.current.type == EventType.Repaint)
GL.Clear(false, true, Color.clear);
GUILayout.BeginArea(new Rect(0, 0, w, h));
GUI.DrawTexture(new Rect(0, 0, w, h), progressBarEmpty);
// Reveal the full bar texture based on progress.
GUI.DrawTextureWithTexCoords(new Rect(0, 0, progress * w, h), progressBarFull, new Rect(0.0f, 0.0f, progress, 1.0f));
GUILayout.EndArea();
RenderTexture.active = prevActive;
// Texture needs to be set every frame after it is updated since SteamVR makes a copy internally to a shared texture.
var overlay = OpenVR.Overlay;
if (overlay != null)
{
var texture = new Texture_t();
texture.handle = renderTexture.GetNativeTexturePtr();
texture.eType = SteamVR.instance.textureType;
texture.eColorSpace = EColorSpace.Auto;
overlay.SetOverlayTexture(progressBarOverlayHandle, ref texture);
}
}
}
#if false
// Draw loading screen and progress bar to 2d companion window as well.
if (loadingScreen != null)
{
var screenAspect = (float)Screen.width / Screen.height;
var textureAspect = (float)loadingScreen.width / loadingScreen.height;
float w, h;
if (screenAspect < textureAspect)
{
// Clamp horizontally
w = Screen.width * 0.9f;
h = w / textureAspect;
}
else
{
// Clamp vertically
h = Screen.height * 0.9f;
w = h * textureAspect;
}
GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
var x = Screen.width / 2 - w / 2;
var y = Screen.height / 2 - h / 2;
GUI.DrawTexture(new Rect(x, y, w, h), loadingScreen);
GUILayout.EndArea();
}
if (renderTexture != null)
{
var x = Screen.width / 2 - renderTexture.width / 2;
var y = Screen.height * 0.9f - renderTexture.height;
GUI.DrawTexture(new Rect(x, y, renderTexture.width, renderTexture.height), renderTexture);
}
#endif
}
19
View Source File : OverlayGUI.cs
License : MIT License
Project Creator : virror
License : MIT License
Project Creator : virror
private void DrawItem (MenuItem item, Rect groupRect)
{
if (item.separator)
{
if (Event.current.type == EventType.Repaint)
RTEditorGUI.Seperator (new Rect (backgroundStyle.contentOffset.x+1, currenreplacedemHeight+1, groupRect.width-2, 1));
currenreplacedemHeight += 3;
}
else
{
Rect labelRect = new Rect (backgroundStyle.contentOffset.x, currenreplacedemHeight, groupRect.width, itemHeight);
if (labelRect.Contains (Event.current.mousePosition))
selectedPath = item.path;
bool selected = selectedPath == item.path || selectedPath.Contains (item.path + "/");
GUI.Label (labelRect, item.content, selected? selectedLabel : GUI.skin.label);
if (item.group)
{
GUI.DrawTexture (new Rect (labelRect.x+labelRect.width-12, labelRect.y+(labelRect.height-12)/2, 12, 12), expandRight);
if (selected)
{
item.groupPos = new Rect (groupRect.x+groupRect.width+4, groupRect.y+currenreplacedemHeight-2, 0, 0);
groupToDraw = item;
}
}
else if (selected && (Event.current.type == EventType.MouseDown || (Event.current.button != 1 && Event.current.type == EventType.MouseUp)))
{
item.Execute ();
close = true;
Event.current.Use ();
}
currenreplacedemHeight += itemHeight;
}
}
19
View Source File : Menu.cs
License : GNU General Public License v2.0
Project Creator : lauw
License : GNU General Public License v2.0
Project Creator : lauw
public void BoxRect(float x, float y, float w, float h)
{
if (Texture != null)
{
GUI.DrawTexture(new Rect(x, y, w, h), Texture);
}
}
19
View Source File : ETCGuiTools.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static void DrawTileTexture (Rect rect, Texture tex)
{
GUI.BeginGroup(rect);
{
int width = Mathf.RoundToInt(rect.width);
int height = Mathf.RoundToInt(rect.height);
for (int y = 0; y < height; y += tex.height)
{
for (int x = 0; x < width; x += tex.width)
{
GUI.DrawTexture(new Rect(x, y, tex.width, tex.height), tex);
}
}
}
GUI.EndGroup();
}
19
View Source File : PanelMain.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
protected internal override void Draw()
{
GUI.DrawTexture(urlRect, patreonIcon);
Vector2 position = Event.current.mousePosition;
if (urlRect.Contains(position))
{
GUI.Label(new Rect(position.x, position.y, 500f, 200f), locale["aottg2Message1"] + "\n" + locale["aottg2Message2"]);
}
if(UnityEngine.GUI.Button(urlRect, string.Empty, GUIStyle.none))
{
Application.OpenURL("https://www.patreon.com/aottg2");
}
enabledPanel = CheckActivePanel();
if (GUI.Button(profileRect, locale["profile"] + " <b>" + User.ProfileName + "</b>"))
{
CheckEnabled(AnarchyManager.ProfilePanel, new GUIBase[] { AnarchyManager.SinglePanel, AnarchyManager.ServerList, AnarchyManager.SettingsPanel });
}
rect.Reset();
if (Button("single"))
{
CheckEnabled(AnarchyManager.SinglePanel, new GUIBase[] { AnarchyManager.ProfilePanel, AnarchyManager.ServerList, AnarchyManager.SettingsPanel });
}
if (Button("multi"))
{
CheckEnabled(AnarchyManager.ServerList, new GUIBase[] { AnarchyManager.ProfilePanel, AnarchyManager.SinglePanel, AnarchyManager.SettingsPanel });
}
if (Button("settings"))
{
CheckEnabled(AnarchyManager.SettingsPanel, new GUIBase[] { AnarchyManager.ProfilePanel, AnarchyManager.ServerList, AnarchyManager.SinglePanel });
}
if (Button("custom_characters"))
{
if (enabledPanel < 0)
{
Application.LoadLevel("characterCreation");
return;
}
}
if(Button("snapshots"))
{
if(enabledPanel < 0)
{
Application.LoadLevel("SnapShot");
return;
}
}
if (Button("exit"))
{
Application.Quit();
}
}
19
View Source File : HTGuiTools.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
private static Rect DrawGradient(int padding, int width, int height=35){
GUILayout.Space(height);
Rect lastRect = GUILayoutUtility.GetLastRect();
lastRect.yMin = lastRect.yMin + 7;
lastRect.yMax = lastRect.yMax - 7;
lastRect.width = Screen.width;
GUI.DrawTexture(new Rect(padding,lastRect.yMin+1,width, lastRect.yMax- lastRect.yMin), GetGradientTexture());
return lastRect;
}
19
View Source File : ColorGradingModelEditor.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
void DrawBackgroundTexture(Rect rect, int preplaced)
{
float scale = EditorGUIUtility.pixelsPerPoint;
var oldRt = RenderTexture.active;
var rt = RenderTexture.GetTemporary(Mathf.CeilToInt(rect.width * scale), Mathf.CeilToInt(rect.height * scale), 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
s_MaterialSpline.SetFloat("_DisabledState", GUI.enabled ? 1f : 0.5f);
s_MaterialSpline.SetFloat("_PixelScaling", EditorGUIUtility.pixelsPerPoint);
Graphics.Blit(null, rt, s_MaterialSpline, preplaced);
RenderTexture.active = oldRt;
GUI.DrawTexture(rect, rt);
RenderTexture.ReleaseTemporary(rt);
}
19
View Source File : RuleTileEditor.cs
License : Apache License 2.0
Project Creator : DarkLop
License : Apache License 2.0
Project Creator : DarkLop
private static void RuleMatrixOnGUI(Rect rect, RuleTile.TilingRule tilingRule)
{
Handles.color = EditorGUIUtility.isProSkin ? new Color(1f, 1f, 1f, 0.2f) : new Color(0f, 0f, 0f, 0.2f);
int index = 0;
float w = rect.width / 3f;
float h = rect.height / 3f;
for (int y = 0; y <= 3; y++)
{
float top = rect.yMin + y * h;
Handles.DrawLine(new Vector3(rect.xMin, top), new Vector3(rect.xMax, top));
}
for (int x = 0; x <= 3; x++)
{
float left = rect.xMin + x * w;
Handles.DrawLine(new Vector3(left, rect.yMin), new Vector3(left, rect.yMax));
}
Handles.color = Color.white;
for (int y = 0; y <= 2; y++)
{
for (int x = 0; x <= 2; x++)
{
Rect r = new Rect(rect.xMin + x * w, rect.yMin + y * h, w - 1, h - 1);
if (x != 1 || y != 1)
{
switch (tilingRule.m_Neighbors[index])
{
case RuleTile.TilingRule.Neighbor.This:
GUI.DrawTexture(r, arrows[y*3 + x]);
break;
case RuleTile.TilingRule.Neighbor.NotThis:
GUI.DrawTexture(r, arrows[9]);
break;
}
if (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition))
{
tilingRule.m_Neighbors[index] = (RuleTile.TilingRule.Neighbor) (((int)tilingRule.m_Neighbors[index] + 1) % 3);
GUI.changed = true;
Event.current.Use();
}
index++;
}
else
{
switch (tilingRule.m_RuleTransform)
{
case RuleTile.TilingRule.Transform.Rotated:
GUI.DrawTexture(r, autoTransforms[0]);
break;
case RuleTile.TilingRule.Transform.MirrorX:
GUI.DrawTexture(r, autoTransforms[1]);
break;
case RuleTile.TilingRule.Transform.MirrorY:
GUI.DrawTexture(r, autoTransforms[2]);
break;
}
if (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition))
{
tilingRule.m_RuleTransform = (RuleTile.TilingRule.Transform)(((int)tilingRule.m_RuleTransform + 1) % 4);
GUI.changed = true;
Event.current.Use();
}
}
}
}
}
19
View Source File : ColorCorrectionLookupEditor.cs
License : Apache License 2.0
Project Creator : activey
License : Apache License 2.0
Project Creator : activey
public override void OnInspectorGUI () {
serObj.Update ();
EditorGUILayout.LabelField("Converts textures into color lookup volumes (for grading)", EditorStyles.miniLabel);
//EditorGUILayout.LabelField("Change Lookup Texture (LUT):");
//EditorGUILayout.BeginHorizontal ();
//Rect r = GUILayoutUtility.GetAspectRect(1.0ff);
Rect r; Texture2D t;
//EditorGUILayout.Space();
tempClutTex2D = EditorGUILayout.ObjectField (" Based on", tempClutTex2D, typeof(Texture2D), false) as Texture2D;
if (tempClutTex2D == null) {
t = replacedetDatabase.LoadMainreplacedetAtPath(((ColorCorrectionLookup)target).basedOnTempTex) as Texture2D;
if (t) tempClutTex2D = t;
}
Texture2D tex = tempClutTex2D;
if (tex && (target as ColorCorrectionLookup).basedOnTempTex != replacedetDatabase.GetreplacedetPath(tex))
{
EditorGUILayout.Separator();
if (!(target as ColorCorrectionLookup).ValidDimensions(tex))
{
EditorGUILayout.HelpBox ("Invalid texture dimensions!\nPick another texture or adjust dimension to e.g. 256x16.", MessageType.Warning);
}
else if (GUILayout.Button ("Convert and Apply"))
{
string path = replacedetDatabase.GetreplacedetPath (tex);
TextureImporter textureImporter = replacedetImporter.GetAtPath(path) as TextureImporter;
bool doImport = textureImporter.isReadable == false;
if (textureImporter.mipmapEnabled == true) {
doImport = true;
}
if (textureImporter.textureCompression != TextureImporterCompression.Uncompressed) {
doImport = true;
}
if (doImport)
{
textureImporter.isReadable = true;
textureImporter.mipmapEnabled = false;
textureImporter.textureCompression = TextureImporterCompression.Uncompressed;
replacedetDatabase.Importreplacedet (path, ImportreplacedetOptions.ForceUpdate);
//tex = replacedetDatabase.LoadMainreplacedetAtPath(path);
}
(target as ColorCorrectionLookup).Convert(tex, path);
}
}
if ((target as ColorCorrectionLookup).basedOnTempTex != "")
{
EditorGUILayout.HelpBox("Using " + (target as ColorCorrectionLookup).basedOnTempTex, MessageType.Info);
t = replacedetDatabase.LoadMainreplacedetAtPath(((ColorCorrectionLookup)target).basedOnTempTex) as Texture2D;
if (t) {
r = GUILayoutUtility.GetLastRect();
r = GUILayoutUtility.GetRect(r.width, 20);
r.x += r.width * 0.05f/2.0f;
r.width *= 0.95f;
GUI.DrawTexture (r, t);
GUILayoutUtility.GetRect(r.width, 4);
}
}
//EditorGUILayout.EndHorizontal ();
serObj.ApplyModifiedProperties();
}
19
View Source File : Background.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
protected internal override void Draw()
{
if (movie != null)
{
UnityEngine.GUI.DrawTexture(screenRect, movie);
}
else
{
UnityEngine.GUI.DrawTexture(screenRect, texture);
}
UnityEngine.GUI.Label(screenRect, string.Format(UIMainReferences.VersionShow, AnarchyManager.AnarchyVersion.ToString()), style);
}
19
View Source File : ConsoleWindow.cs
License : MIT License
Project Creator : akof1314
License : MIT License
Project Creator : akof1314
void OnGUI()
{
Event e = Event.current;
LoadIcons();
LogEntries.wrapped.UpdateEntries();
if (!m_HasUpdatedGuiStyles)
{
m_LineHeight = Mathf.RoundToInt(Constants.ErrorStyle.lineHeight);
m_BorderHeight = Constants.ErrorStyle.border.top + Constants.ErrorStyle.border.bottom;
UpdateListView();
}
GUILayout.BeginHorizontal(Constants.Toolbar);
if (LogEntries.wrapped.imporreplacedching)
{
LogEntries.wrapped.imporreplacedching = GUILayout.Toggle(LogEntries.wrapped.imporreplacedching, Constants.ImporreplacedchingLabel, Constants.MiniButton);
}
if (GUILayout.Button(Constants.ClearLabel, Constants.MiniButton))
{
LogEntries.Clear();
GUIUtility.keyboardControl = 0;
}
int currCount = LogEntries.wrapped.GetCount();
if (m_ListView.totalRows != currCount && m_ListView.totalRows > 0)
{
// scroll bar was at the bottom?
if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight)
{
m_ListView.scrollPos.y = currCount * RowHeight - ms_LVHeight;
}
}
if (LogEntries.wrapped.searchFrame)
{
LogEntries.wrapped.searchFrame = false;
int selectedIndex = LogEntries.wrapped.GetSelectedEntryIndex();
if (selectedIndex != -1)
{
int showIndex = selectedIndex + 1;
if (currCount > showIndex)
{
int showCount = ms_LVHeight / RowHeight;
showIndex = showIndex + showCount / 2;
}
m_ListView.scrollPos.y = showIndex * RowHeight - ms_LVHeight;
}
}
EditorGUILayout.Space();
bool wasCollapsed = LogEntries.wrapped.collapse;
LogEntries.wrapped.collapse = GUILayout.Toggle(wasCollapsed, Constants.CollapseLabel, Constants.MiniButton);
bool collapsedChanged = (wasCollapsed != LogEntries.wrapped.collapse);
if (collapsedChanged)
{
// unselect if collapsed flag changed
m_ListView.row = -1;
// scroll to bottom
m_ListView.scrollPos.y = LogEntries.wrapped.GetCount() * RowHeight;
}
SetFlag(ConsoleFlags.ClearOnPlay, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnPlay), Constants.ClearOnPlayLabel, Constants.MiniButton));
#if UNITY_2019_1_OR_NEWER
SetFlag(ConsoleFlags.ClearOnBuild, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnBuild), Constants.ClearOnBuildLabel, Constants.MiniButton));
#endif
SetFlag(ConsoleFlags.ErrorPause, GUILayout.Toggle(HasFlag(ConsoleFlags.ErrorPause), Constants.ErrorPauseLabel, Constants.MiniButton));
#if UNITY_2018_3_OR_NEWER
ConnectionGUILayout.AttachToPlayerDropdown(m_ConsoleAttachToPlayerState, EditorStyles.toolbarDropDown);
#endif
EditorGUILayout.Space();
if (m_DevBuild)
{
GUILayout.FlexibleSpace();
SetFlag(ConsoleFlags.StopForreplacedert, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForreplacedert), Constants.StopForreplacedertLabel, Constants.MiniButton));
SetFlag(ConsoleFlags.StopForError, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForError), Constants.StopForErrorLabel, Constants.MiniButton));
}
GUILayout.FlexibleSpace();
// Search bar
GUILayout.Space(4f);
SearchField(e);
int errorCount = 0, warningCount = 0, logCount = 0;
LogEntries.wrapped.GetCountsByType(ref errorCount, ref warningCount, ref logCount);
EditorGUI.BeginChangeCheck();
bool setLogFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelLog), new GUIContent((logCount <= 999 ? logCount.ToString() : "999+"), logCount > 0 ? iconInfoSmall : iconInfoMono), Constants.MiniButton);
bool setWarningFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelWarning), new GUIContent((warningCount <= 999 ? warningCount.ToString() : "999+"), warningCount > 0 ? iconWarnSmall : iconWarnMono), Constants.MiniButton);
bool setErrorFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelError), new GUIContent((errorCount <= 999 ? errorCount.ToString() : "999+"), errorCount > 0 ? iconErrorSmall : iconErrorMono), Constants.MiniButton);
// Active entry index may no longer be valid
if (EditorGUI.EndChangeCheck())
{ }
LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelLog, setLogFlag);
LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelWarning, setWarningFlag);
LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelError, setErrorFlag);
if (GUILayout.Button(new GUIContent(errorCount > 0 ? iconFirstErrorSmall : iconFirstErrorMono, Constants.FirstErrorLabel), Constants.MiniButton))
{
int firstErrorIndex = LogEntries.wrapped.GetFirstErrorEntryIndex();
if (firstErrorIndex != -1)
{
SetActiveEntry(firstErrorIndex);
LogEntries.wrapped.searchFrame = true;
}
}
GUILayout.EndHorizontal();
SplitterGUILayout.BeginVerticalSplit(spl);
int rowHeight = RowHeight;
EditorGUIUtility.SetIconSize(new Vector2(rowHeight, rowHeight));
GUIContent tempContent = new GUIContent();
int id = GUIUtility.GetControlID(0);
int rowDoubleClicked = -1;
/////@TODO: Make Frame selected work with ListViewState
using (new GettingLogEntriesScope(m_ListView))
{
int selectedRow = -1;
bool openSelectedItem = false;
bool collapsed = LogEntries.wrapped.collapse;
foreach (ListViewElement el in ListViewGUI.ListView(m_ListView, Constants.Box))
{
if (e.type == EventType.MouseDown && e.button == 0 && el.position.Contains(e.mousePosition))
{
m_ListView.row = el.row;
selectedRow = el.row;
if (e.clickCount == 2)
openSelectedItem = true;
}
else if (e.type == EventType.Repaint)
{
int mode = 0;
int entryCount = 0;
int searchIndex = 0;
int searchEndIndex = 0;
string text = LogEntries.wrapped.GetEntryLinesAndFlagAndCount(el.row, ref mode, ref entryCount,
ref searchIndex, ref searchEndIndex);
ConsoleFlags flag = (ConsoleFlags)mode;
bool isSelected = LogEntries.wrapped.IsEntrySelected(el.row);
// Draw the background
GUIStyle s = el.row % 2 == 0 ? Constants.OddBackground : Constants.EvenBackground;
s.Draw(el.position, false, false, isSelected, false);
// Draw the icon
#if !UNITY_2017_3_OR_NEWER
if (Constants.LogStyleLineCount == 1)
{
Rect rt = el.position;
rt.x += 6f;
rt.y += 2f;
rt.width = 16f;
rt.height = 16f;
GUI.DrawTexture(rt, GetIconForErrorMode(flag, false));
}
else
#endif
{
GUIStyle iconStyle = GetStyleForErrorMode(flag, true, Constants.LogStyleLineCount == 1);
iconStyle.Draw(el.position, false, false, isSelected, false);
}
// Draw the text
tempContent.text = text;
GUIStyle errorModeStyle = GetStyleForErrorMode(flag, false, Constants.LogStyleLineCount == 1);
if (string.IsNullOrEmpty(LogEntries.wrapped.searchString) || searchIndex == -1 || searchIndex >= text.Length)
{
errorModeStyle.Draw(el.position, tempContent, id, isSelected);
}
else
{
errorModeStyle.DrawWithTextSelection(el.position, tempContent, GUIUtility.keyboardControl, searchIndex, searchEndIndex);
}
if (collapsed)
{
Rect badgeRect = el.position;
tempContent.text = entryCount.ToString(CultureInfo.InvariantCulture);
Vector2 badgeSize = Constants.CountBadge.CalcSize(tempContent);
badgeRect.xMin = badgeRect.xMax - badgeSize.x;
badgeRect.yMin += ((badgeRect.yMax - badgeRect.yMin) - badgeSize.y) * 0.5f;
badgeRect.x -= 5f;
GUI.Label(badgeRect, tempContent, Constants.CountBadge);
}
}
}
if (selectedRow != -1)
{
if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight)
m_ListView.scrollPos.y = m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight - 1;
}
// Make sure the selected entry is up to date
if (m_ListView.totalRows == 0 || m_ListView.row >= m_ListView.totalRows || m_ListView.row < 0)
{
}
else
{
if (m_ListView.selectionChanged)
{
SetActiveEntry(m_ListView.row);
}
}
// Open entry using return key
if ((GUIUtility.keyboardControl == m_ListView.ID) && (e.type == EventType.KeyDown) && (e.keyCode == KeyCode.Return) && (m_ListView.row != 0))
{
selectedRow = m_ListView.row;
openSelectedItem = true;
}
if (e.type != EventType.Layout && ListViewGUI.ilvState.rectHeight != 1)
ms_LVHeight = ListViewGUI.ilvState.rectHeight;
if (openSelectedItem)
{
rowDoubleClicked = selectedRow;
e.Use();
}
if (selectedRow != -1)
{
SetActiveEntry(selectedRow);
}
}
// Prevent dead locking in EditorMonoConsole by delaying callbacks (which can log to the console) until after LogEntries.EndGettingEntries() has been
// called (this releases the mutex in EditorMonoConsole so logging again is allowed). Fix for case 1081060.
if (rowDoubleClicked != -1)
LogEntries.wrapped.StacktraceListView_RowGotDoubleClicked();
EditorGUIUtility.SetIconSize(Vector2.zero);
StacktraceListView(e, tempContent);
SplitterGUILayout.EndVerticalSplit();
// Copy & Paste selected item
if ((e.type == EventType.ValidateCommand || e.type == EventType.ExecuteCommand) && e.commandName == "Copy")
{
if (e.type == EventType.ExecuteCommand)
LogEntries.wrapped.StacktraceListView_CopyAll();
e.Use();
}
}
19
View Source File : ColorCorrectionLookupEditor.cs
License : MIT License
Project Creator : GlaireDaggers
License : MIT License
Project Creator : GlaireDaggers
public override void OnInspectorGUI () {
serObj.Update ();
EditorGUILayout.LabelField("Converts textures into color lookup volumes (for grading)", EditorStyles.miniLabel);
//EditorGUILayout.LabelField("Change Lookup Texture (LUT):");
//EditorGUILayout.BeginHorizontal ();
//Rect r = GUILayoutUtility.GetAspectRect(1.0ff);
Rect r; Texture2D t;
//EditorGUILayout.Space();
tempClutTex2D = EditorGUILayout.ObjectField (" Based on", tempClutTex2D, typeof(Texture2D), false) as Texture2D;
if (tempClutTex2D == null) {
t = replacedetDatabase.LoadMainreplacedetAtPath(((ColorCorrectionLookup)target).basedOnTempTex) as Texture2D;
if (t) tempClutTex2D = t;
}
Texture2D tex = tempClutTex2D;
if (tex && (target as ColorCorrectionLookup).basedOnTempTex != replacedetDatabase.GetreplacedetPath(tex))
{
EditorGUILayout.Separator();
if (!(target as ColorCorrectionLookup).ValidDimensions(tex))
{
EditorGUILayout.HelpBox ("Invalid texture dimensions!\nPick another texture or adjust dimension to e.g. 256x16.", MessageType.Warning);
}
else if (GUILayout.Button ("Convert and Apply"))
{
string path = replacedetDatabase.GetreplacedetPath (tex);
TextureImporter textureImporter = replacedetImporter.GetAtPath(path) as TextureImporter;
bool doImport = textureImporter.isReadable == false;
if (textureImporter.mipmapEnabled == true) {
doImport = true;
}
if (textureImporter.textureFormat != TextureImporterFormat.AutomaticTruecolor) {
doImport = true;
}
if (doImport)
{
textureImporter.isReadable = true;
textureImporter.mipmapEnabled = false;
textureImporter.textureFormat = TextureImporterFormat.AutomaticTruecolor;
replacedetDatabase.Importreplacedet (path, ImportreplacedetOptions.ForceUpdate);
//tex = replacedetDatabase.LoadMainreplacedetAtPath(path);
}
(target as ColorCorrectionLookup).Convert(tex, path);
}
}
if ((target as ColorCorrectionLookup).basedOnTempTex != "")
{
EditorGUILayout.HelpBox("Using " + (target as ColorCorrectionLookup).basedOnTempTex, MessageType.Info);
t = replacedetDatabase.LoadMainreplacedetAtPath(((ColorCorrectionLookup)target).basedOnTempTex) as Texture2D;
if (t) {
r = GUILayoutUtility.GetLastRect();
r = GUILayoutUtility.GetRect(r.width, 20);
r.x += r.width * 0.05f/2.0f;
r.width *= 0.95f;
GUI.DrawTexture (r, t);
GUILayoutUtility.GetRect(r.width, 4);
}
}
//EditorGUILayout.EndHorizontal ();
serObj.ApplyModifiedProperties();
}
19
View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame
License : MIT License
Project Creator : liangxiegame
private void DrawGridInfo(Rect parent)
{
PIAImageData imageData = PIASession.Instance.ImageData;
//GRID INFO RECT
float gridInfoRectHeight = 40;
Rect gridInfoRect = new Rect(0, parent.height - gridInfoRectHeight, parent.width, gridInfoRectHeight);
//DRAWING STUFF
GUI.DrawTexture(gridInfoRect, blackBarBG);
GUILayout.BeginArea(gridInfoRect);
{
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
{
GUILayout.Label("[" + imageData.Width + "x" + imageData.Height + "]", skin.GetStyle("editorbutton2"));
GUILayout.Label(mouseCellCoordinate.ToString(), skin.GetStyle("editorbutton2"));
}
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
}
GUILayout.EndArea();
}
See More Examples