Here are the examples of the csharp api UnityEngine.GUILayout.Box(UnityEngine.GUIContent, UnityEngine.GUIStyle, params UnityEngine.GUILayoutOption[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
60 Examples
19
View Source File : EditorUtils GUILayout.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public void Box(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
{
GUILayout.Box(content, style, options);
}
19
View Source File : UI.cs
License : MIT License
Project Creator : phorcys
License : MIT License
Project Creator : phorcys
private void DrawTab(int tabId, ref UnityAction buttons)
{
var minWidth = GUILayout.MinWidth(mWindowWidth);
switch (tabs[tabId])
{
case "Mods":
{
mScrollPosition[tabId] = GUILayout.BeginScrollView(mScrollPosition[tabId], minWidth, GUILayout.ExpandHeight(false));
var amountWidth = mColumns.Where(x => !x.skip).Sum(x => x.width);
var expandWidth = mColumns.Where(x => x.expand && !x.skip).Sum(x => x.width);
var mods = modEntries;
var colWidth = mColumns.Select(x =>
x.expand
? GUILayout.Width(x.width / expandWidth * (mWindowWidth - 60 + expandWidth - amountWidth))
: GUILayout.Width(x.width)).ToArray();
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal("box");
for (int i = 0; i < mColumns.Count; i++)
{
if (mColumns[i].skip)
continue;
GUILayout.Label(mColumns[i].name, colWidth[i]);
}
GUILayout.EndHorizontal();
for (int i = 0, c = mods.Count; i < c; i++)
{
int col = -1;
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal();
GUILayout.BeginHorizontal(colWidth[++col]);
if (mods[i].OnGUI != null)
{
if (GUILayout.Button(mods[i].Info.DisplayName, GUI.skin.label, GUILayout.ExpandWidth(true)))
{
mShowModSettings = (mShowModSettings == i) ? -1 : i;
}
if (GUILayout.Button(mShowModSettings == i ? Textures.SettingsActive : Textures.SettingsNormal, settings))
{
mShowModSettings = (mShowModSettings == i) ? -1 : i;
}
}
else
{
GUILayout.Label(mods[i].Info.DisplayName);
}
if (!string.IsNullOrEmpty(mods[i].Info.HomePage))
{
GUILayout.Space(10);
if (GUILayout.Button(Textures.WWW, www))
{
Application.OpenURL(mods[i].Info.HomePage);
}
}
if (mods[i].NewestVersion != null)
{
GUILayout.Space(10);
GUILayout.Box(Textures.Updates, updates);
}
GUILayout.Space(20);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(colWidth[++col]);
GUILayout.Label(mods[i].Info.Version, GUILayout.ExpandWidth(false));
// if (string.IsNullOrEmpty(mods[i].Info.Repository))
// {
// GUI.color = new Color32(255, 81, 83, 255);
// GUILayout.Label("*");
// GUI.color = Color.white;
// }
GUILayout.EndHorizontal();
if (mods[i].ManagerVersion > GetVersion())
{
GUI.color = new Color32(255, 81, 83, 255);
GUILayout.Label("Manager-" + mods[i].Info.ManagerVersion, colWidth[++col]);
GUI.color = Color.white;
}
else if (mods[i].Requirements.Count > 0)
{
GUILayout.Label(string.Join("\r\n", mods[i].Info.Requirements), colWidth[++col]);
}
else
{
GUILayout.Label("-", colWidth[++col]);
}
var action = mods[i].Enabled;
action = GUILayout.Toggle(action, "", colWidth[++col]);
if (action != mods[i].Enabled)
{
mods[i].Enabled = action;
if (mods[i].Toggleable)
mods[i].Active = action;
}
if (mods[i].Active)
{
GUILayout.Box(mods[i].Enabled ? Textures.StatusActive : Textures.StatusNeedRestart, status);
}
else
{
GUILayout.Box(!mods[i].Enabled ? Textures.StatusInactive : Textures.StatusNeedRestart, status);
}
GUILayout.EndHorizontal();
if (mShowModSettings == i)
{
GUILayout.Label("Options", h2);
try
{
mods[i].OnGUI(mods[i]);
}
catch (Exception e)
{
mShowModSettings = -1;
mods[i].Logger.Error("OnGUI error.");
Debug.LogException(e);
}
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.Space(10);
GUILayout.Box(Textures.SettingsNormal, settings);
GUILayout.Space(3);
GUILayout.Label("Options", GUILayout.ExpandWidth(false));
GUILayout.Space(15);
GUILayout.Box(Textures.WWW, www);
GUILayout.Space(3);
GUILayout.Label("Home page", GUILayout.ExpandWidth(false));
GUILayout.Space(15);
GUILayout.Box(Textures.Updates, updates);
GUILayout.Space(3);
GUILayout.Label("Available update", GUILayout.ExpandWidth(false));
GUILayout.Space(15);
GUILayout.Box(Textures.StatusActive, status);
GUILayout.Space(3);
GUILayout.Label("Active", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Box(Textures.StatusInactive, status);
GUILayout.Space(3);
GUILayout.Label("Inactive", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Box(Textures.StatusNeedRestart, status);
GUILayout.Space(3);
GUILayout.Label("Need restart", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Label("[CTRL + LClick]", bold, GUILayout.ExpandWidth(false));
GUILayout.Space(3);
GUILayout.Label("Drag window", GUILayout.ExpandWidth(false));
// GUILayout.Space(10);
// GUI.color = new Color32(255, 81, 83, 255);
// GUILayout.Label("*", bold, GUILayout.ExpandWidth(false));
// GUI.color = Color.white;
// GUILayout.Space(3);
// GUILayout.Label("Not support updates", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
if (GUI.changed)
{
}
break;
}
case "Logs":
{
if (mLogTimer > 1)
{
mLogTimer = 0;
var filepath = Logger.filepath;
if (File.Exists(filepath))
{
var fileinfo = new FileInfo(filepath);
if (mFilelogLength != fileinfo.Length)
{
mFilelogLength = fileinfo.Length;
mLogStrings = File.ReadAllLines(filepath);
}
}
}
mScrollPosition[tabId] = GUILayout.BeginScrollView(mScrollPosition[tabId], minWidth);
GUILayout.BeginVertical("box");
for (int i = Mathf.Max(0, mLogStrings.Length - 200); i < mLogStrings.Length; i++)
{
GUILayout.Label(mLogStrings[i]);
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
buttons += delegate
{
if (GUILayout.Button("Clear", GUILayout.Width(150)))
{
Logger.Clear();
}
};
if (GUI.changed)
{
}
break;
}
case "Settings":
{
mScrollPosition[tabId] = GUILayout.BeginScrollView(mScrollPosition[tabId], minWidth);
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal();
GUILayout.Label("Shortcut Key", GUILayout.ExpandWidth(false));
Params.ShortcutKeyId =
GUILayout.Toolbar(Params.ShortcutKeyId, mShortcutNames, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.Space(5);
GUILayout.BeginHorizontal();
GUILayout.Label("Check updates", GUILayout.ExpandWidth(false));
Params.CheckUpdates = GUILayout.Toolbar(Params.CheckUpdates, mCheckUpdateStrings,
GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.EndScrollView();
if (GUI.changed)
{
}
break;
}
}
}
19
View Source File : SimpleAlert.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
public override void OnGUI() {
if(Nexus.Self == null) {
Close();
return;
}
if(lastWindowWidth != Nexus.Self.position.width) {
_positionWindow = true;
}
if(_positionWindow) {
_positionWindow = false;
lastWindowWidth = Nexus.Self.position.width;
PositionWindow();
}
GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor(Color.gray));
divider = new GUIStyle(GUI.skin.box);
divider.normal.background = Swat.MakeTextureFromColor(Color.white);
divider.margin = new RectOffset(25, 0, 10, 20);
header = new GUIStyle(GUI.skin.label);
header.fontSize = 15;
header.normal.textColor = Color.white;
header.fontStyle = FontStyle.Bold;
header.alignment = TextAnchor.MiddleCenter;
header.fixedHeight = 40;
header.padding = new RectOffset(0, 0, 5, 0);
buttons = new GUIStyle(GUI.skin.button);
buttons.fixedHeight = buttonHeight;
buttons.fixedWidth = buttonWidth;
buttons.normal.background = Swat.MakeTextureFromColor((Color)new Color32(80, 80, 80, 255));
buttons.normal.textColor = Color.white;
messageLabel = new GUIStyle(GUI.skin.label);
messageLabel.fontSize = 12;
messageLabel.padding = new RectOffset(32, 0, 0, 0);
messageLabel.normal.textColor = Color.white;
messageLabel.wordWrap = true;
EditorGUILayout.LabelField("Please Confirm", header);
GUILayout.Space(20);
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
EditorGUILayout.LabelField(Message, messageLabel, new GUILayoutOption[] { GUILayout.Width(position.width - 50) });
GUILayout.Space(10);
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
buttons.margin = new RectOffset((int)System.Math.Round((position.width / 2) - buttons.fixedWidth), 0, 0, 0); //Position just left of center.
//Only show Confirm button if no action but closing of the alert is expected.
if(OnConfirm != null) {
EditorGUILayout.BeginHorizontal();
Nexus.Self.Button("Cancel", "Deny alert criteria.",
new Nexus.SwatDelegate(delegate() {
//Close and do nothing.
IsVisible = false;
Close();
}), buttons);
buttons = new GUIStyle(GUI.skin.button);
buttons.fixedHeight = buttonHeight;
buttons.fixedWidth = buttonWidth;
buttons.margin = new RectOffset(5, 0, 0, 0);
buttons.normal.background = Swat.MakeTextureFromColor((Color)new Color32(80, 80, 80, 255));
buttons.normal.textColor = Color.white;
} else {
buttons.margin = new RectOffset((int)System.Math.Round((position.width / 2) - (buttons.fixedWidth / 2)), 0, 0, 0); //Position exact center.
}
Nexus.Self.Button("Confirm", "Accept alert criteria.",
new Nexus.SwatDelegate(delegate() {
//Invoke provided delegate and close this confirmation popup.
if(OnConfirm != null) {
OnConfirm();
}
IsVisible = false;
Close();
}), buttons);
if(OnConfirm != null) {
EditorGUILayout.EndHorizontal();
}
GUILayout.Space(10);
}
19
View Source File : SliderUI.cs
License : GNU General Public License v3.0
Project Creator : Mantas-2155X
License : GNU General Public License v3.0
Project Creator : Mantas-2155X
private static void DrawWindow(int id)
{
GUIStyle lineStyle = new GUIStyle("box");
lineStyle.border.top = lineStyle.border.bottom = 1;
lineStyle.margin.top = lineStyle.margin.bottom = 1;
lineStyle.padding.top = lineStyle.padding.bottom = 1;
GUIStyle gridStyle = new GUIStyle("Button");
gridStyle.onNormal.background = Texture2D.whiteTexture;
gridStyle.onNormal.textColor = Color.black;
gridStyle.onHover.background = Texture2D.whiteTexture;
gridStyle.onHover.textColor = Color.black;
gridStyle.onActive.background = Texture2D.whiteTexture;
gridStyle.onActive.textColor = Color.black;
string[] characterNames = new string[AI_BetterHScenes.characters.Count];
string[] offsetNames = new string[] { "Whole Body", "Left Hand", "Right Hand", "Left Foot", "Right Foot" };
for (var charIndex = 0; charIndex < AI_BetterHScenes.characters.Count; charIndex++)
{
characterNames[charIndex] = AI_BetterHScenes.characters[charIndex].fileParam.fullname;
}
using (GUILayout.VerticalScope guiVerticalScope = new GUILayout.VerticalScope("box"))
{
selectedCharacter = GUILayout.SelectionGrid(selectedCharacter, characterNames, AI_BetterHScenes.characters.Count, gridStyle, GUILayout.Height(30));
GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));
using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
{
selectedOffset = GUILayout.SelectionGrid(selectedOffset, offsetNames, offsetNames.Length, gridStyle, GUILayout.Height(30));
}
using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
{
if (selectedOffset == (int)BodyPart.WholeBody)
{
GUILayout.Label("Mouth Size: ", GUILayout.Width((2 * uiWidth / 15) - 10));
mouthOffsets[selectedCharacter] = GUILayout.HorizontalSlider(mouthOffsets[selectedCharacter], 0, 1, GUILayout.Width((4 * uiWidth / 15) - 10));
GUILayout.FlexibleSpace();
GUILayout.Label("Heel Offset: ", GUILayout.Width((2 * uiWidth / 15) - 10));
shoeOffsets[selectedCharacter] = Convert.ToSingle(GUILayout.TextField(shoeOffsets[selectedCharacter].ToString("0.000"), GUILayout.Width((2 * uiWidth / 15) - 10)));
}
else
{
if (GUILayout.Button("Mirror Limb"))
MirrorActiveLimb();
bool[] lastCorrection = new bool[(int)BodyPart.BodyPartsCount];
for (var part = (int)BodyPart.LeftHand; part < (int)BodyPart.BodyPartsCount; part++)
lastCorrection[part] = characterOffsets[selectedCharacter].jointCorrection[part];
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftHand] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftHand], " Correction");
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightHand] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightHand], " Correction");
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftFoot] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftFoot], " Correction");
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightFoot] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightFoot], " Correction");
bool correctionChanged = false;
for (var part = (int)BodyPart.LeftHand; part < (int)BodyPart.BodyPartsCount; part++)
{
if (lastCorrection[part] == characterOffsets[selectedCharacter].jointCorrection[part])
continue;
correctionChanged = true;
break;
}
if (correctionChanged)
characterOffsets[selectedCharacter].ApplyJointCorrections();
}
}
GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));
string LabelName = "Hint";
float sliderMaxHint = AI_BetterHScenes.sliderMaxHintPosition.Value;
float sliderMaxRotation = AI_BetterHScenes.sliderMaxLimbRotation.Value;
float sliderMaxPosition = AI_BetterHScenes.sliderMaxLimbPosition.Value;
Vector3 lastPosition = Vector3.zero;
Vector3 lastRotation = Vector3.zero;
if (selectedOffset == (int)BodyPart.WholeBody)
{
LabelName = "Head Rotation";
sliderMaxHint = AI_BetterHScenes.sliderMaxBodyRotation.Value;
sliderMaxRotation = AI_BetterHScenes.sliderMaxBodyRotation.Value;
sliderMaxPosition = AI_BetterHScenes.sliderMaxBodyPosition.Value;
lastPosition = new Vector3(
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z);
lastRotation = new Vector3(
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z);
}
using (GUILayout.HorizontalScope positionScope = new GUILayout.HorizontalScope("box"))
{
using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
{
GUILayout.Label("Position X");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x, -sliderMaxPosition, sliderMaxPosition);
}
using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
{
GUILayout.Label("Position Y");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y, -sliderMaxPosition, sliderMaxPosition);
}
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label("Position Z");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z, -sliderMaxPosition, sliderMaxPosition);
}
}
using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
{
using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
{
GUILayout.Label("Rotation X");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x, -sliderMaxRotation, sliderMaxRotation);
}
using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
{
GUILayout.Label("Rotation Y");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y, -sliderMaxRotation, sliderMaxRotation);
}
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label("Rotation Z");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z, -sliderMaxRotation, sliderMaxRotation);
}
}
using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
{
using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
{
GUILayout.Label($"{LabelName} X");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x, -sliderMaxHint, sliderMaxHint);
}
using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
{
GUILayout.Label($"{LabelName} Y");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y, -sliderMaxHint, sliderMaxHint);
}
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label($"{LabelName} Z");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z, -sliderMaxHint, sliderMaxHint);
}
}
if (selectedOffset != (int)BodyPart.WholeBody)
{
if (selectedOffset <= (int)BodyPart.RightHand)
sliderMaxRotation /= 4;
using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
{
GUILayout.FlexibleSpace();
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label($"Digit Rotation");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation, -sliderMaxRotation, sliderMaxRotation);
}
GUILayout.FlexibleSpace();
}
}
if (selectedOffset == (int)BodyPart.WholeBody &&
(lastPosition != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position ||
lastRotation != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation))
ApplyPositionsAndCorrections();
using (GUILayout.HorizontalScope controlScope = new GUILayout.HorizontalScope("box"))
{
if (GUILayout.Button("Copy"))
CopyPositions();
if (GUILayout.Button("Paste"))
PastePositions();
if (GUILayout.Button("Reset All"))
ResetPositions();
if (GUILayout.Button("Reload"))
HSceneOffset.ApplyCharacterOffsets();
if (AI_BetterHScenes.useOneOffsetForAllMotions.Value == false && GUILayout.Button("Save This"))
SavePosition(false);
if (GUILayout.Button(AI_BetterHScenes.useUniqueOffsetForWeak.Value && AI_BetterHScenes.currentMotion.StartsWith("D_") ? "Save Weak" : "Save Default"))
SavePosition(true);
if (GUILayout.Button("Delete All"))
AI_BetterHScenes.activeConfirmDeleteUI = true;
}
}
GUI.DragWindow();
}
19
View Source File : AssetBundleSample.cs
License : MIT License
Project Creator : huanzi-qch
License : MIT License
Project Creator : huanzi-qch
void OnGUI()
{
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
GUILayout.Label("Status: " + status);
// Draw the texture from the downloaded bundle
if (texture != null)
GUILayout.Box(texture, GUILayout.MaxHeight(256));
if (!downloading && GUILayout.Button("Start Download"))
{
UnloadBundle();
StartCoroutine(DownloadreplacedetBundle());
}
});
}
19
View Source File : TextureEditorWindow.cs
License : MIT License
Project Creator : Crazy-Marvin
License : MIT License
Project Creator : Crazy-Marvin
protected void DoAlphaZoomToolbarGUI()
{
this.m_ShowAlpha = GUILayout.Toggle(this.m_ShowAlpha, (!this.m_ShowAlpha) ? s_Styles.RGBIcon : s_Styles.alphaIcon, "toolbarButton", new GUILayoutOption[0]);
this.m_Zoom = GUILayout.HorizontalSlider(this.m_Zoom, this.GetMinZoom(), 10f, s_Styles.preSlider, s_Styles.preSliderThumb, new GUILayoutOption[]
{
GUILayout.MaxWidth(64f)
});
int num = 1;
if (this.m_Texture != null)
{
num = Mathf.Max(num, m_Texture.mipmapCount);
}
EditorGUI.BeginDisabledGroup(num == 1);
GUILayout.Box(s_Styles.smallMip, s_Styles.preLabel, new GUILayoutOption[0]);
this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float)(num - 1), 0f, s_Styles.preSlider, s_Styles.preSliderThumb, new GUILayoutOption[]
{
GUILayout.MaxWidth(64f)
}));
GUILayout.Box(s_Styles.largeMip, s_Styles.preLabel, new GUILayoutOption[0]);
EditorGUI.EndDisabledGroup();
}
19
View Source File : GraphRequest.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
protected override void GetGui()
{
bool enabled = GUI.enabled;
GUI.enabled = enabled && FB.IsLoggedIn;
if (this.Button("Basic Request - Me"))
{
FB.API("/me", HttpMethod.GET, this.HandleResult);
}
if (this.Button("Retrieve Profile Photo"))
{
FB.API("/me/picture", HttpMethod.GET, this.ProfilePhotoCallback);
}
if (this.Button("Take and Upload screenshot"))
{
this.StartCoroutine(this.TakeScreenshot());
}
this.LabelAndTextField("Request", ref this.apiQuery);
if (this.Button("Custom Request"))
{
FB.API(this.apiQuery, HttpMethod.GET, this.HandleResult);
}
if (this.profilePic != null)
{
GUILayout.Box(this.profilePic);
}
GUI.enabled = enabled;
}
19
View Source File : CinemachineShotEditor.cs
License : MIT License
Project Creator : BattleDawnNZ
License : MIT License
Project Creator : BattleDawnNZ
void DrawSubeditors(CinemachineVirtualCameraBase vcam)
{
// Create an editor for each of the cinemachine virtual cam and its components
GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout) { fontStyle = FontStyle.Bold };
UpdateComponentEditors(vcam);
if (m_editors != null)
{
foreach (UnityEditor.Editor e in m_editors)
{
if (e == null || e.target == null || (e.target.hideFlags & HideFlags.HideInInspector) != 0)
continue;
// Separator line - how do you make a thinner one?
GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) } );
bool expanded = true;
if (!s_EditorExpanded.TryGetValue(e.target.GetType(), out expanded))
expanded = true;
expanded = EditorGUILayout.Foldout(
expanded, e.target.GetType().Name, true, foldoutStyle);
if (expanded)
e.OnInspectorGUI();
s_EditorExpanded[e.target.GetType()] = expanded;
}
}
}
19
View Source File : CustomGUI.cs
License : GNU General Public License v3.0
Project Creator : thiagosoara
License : GNU General Public License v3.0
Project Creator : thiagosoara
public static void DrawLineSeparator(Texture2D blackTex, float width)
{
GUIStyle separatorStyle = new GUIStyle(GUI.skin.box);
separatorStyle.fixedWidth = width;
separatorStyle.fixedHeight = 2;
separatorStyle.margin.top = 10;
separatorStyle.margin.bottom = 10;
GUILayout.Box(blackTex,separatorStyle);
}
19
View Source File : SteamVR_Menu.cs
License : GNU General Public License v3.0
Project Creator : brandonmousseau
License : GNU General Public License v3.0
Project Creator : brandonmousseau
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();
}
var tracker = SteamVR_Render.Top();
if (tracker != null)
{
tracker.wireframe = GUILayout.Toggle(tracker.wireframe, "Wireframe");
if (SteamVR.settings.trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
{
if (GUILayout.Button("Switch to Standing"))
SteamVR.settings.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseStanding;
if (GUILayout.Button("Center View"))
{
var chaperone = OpenVR.Chaperone;
if (chaperone != null)
chaperone.ResetZeroPose(SteamVR.settings.trackingSpace);
}
}
else
{
if (GUILayout.Button("Switch to Seated"))
SteamVR.settings.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 : UiTemplate.cs
License : GNU General Public License v3.0
Project Creator : k0np4ku
License : GNU General Public License v3.0
Project Creator : k0np4ku
private static void BeginInitializingPackage()
{
GUILayout.BeginVertical(UiStyle.Style[0]);
GUILayout.Box("Initializing Package...", UiStyle.Style[1]);
GUILayout.EndVertical();
}
19
View Source File : ONSPReflectionCustomGUI.cs
License : MIT License
Project Creator : IanPhilips
License : MIT License
Project Creator : IanPhilips
void Separator()
{
GUI.color = new Color(1, 1, 1, 0.25f);
GUILayout.Box("", "HorizontalSlider", GUILayout.Height(16));
GUI.color = Color.white;
}
19
View Source File : Styles.cs
License : MIT License
Project Creator : cabarius
License : MIT License
Project Creator : cabarius
public static void Div(Color color, float indent = 0, float height = 0, float width = 0) {
if (fillTexture == null)
fillTexture = new Texture2D(1, 1);
//if (divStyle == null) {
divStyle = new GUIStyle {
fixedHeight = 1,
};
//}
fillTexture.SetPixel(0, 0, color);
fillTexture.Apply();
divStyle.normal.background = fillTexture;
if (divStyle.margin == null) {
divStyle.margin = new RectOffset((int)indent, 0, 4, 4);
}
else {
divStyle.margin.left = (int)indent + 3;
}
if (width > 0)
divStyle.fixedWidth = width;
else
divStyle.fixedWidth = 0;
Space((2f * height) / 3f);
GUILayout.Box(GUIContent.none, divStyle);
Space(height / 3f);
}
19
View Source File : ShootingSound.cs
License : MIT License
Project Creator : Mukarillo
License : MIT License
Project Creator : Mukarillo
void OnGUI(){
GUILayout.BeginArea (new Rect(0, Screen.height*0.1f , Screen.width, Screen.height));
GUILayout.Box ("Wellcome to the TimeSaver SoundManager! \n\n Here you will find an example of some features that the project has, like: " +
"\n -Play a sound" +
"\n -Mute/Unmute a single SoundTrack" +
"\n -Change the volume of all tracks or a single one" +
"\n -Play random sounds, using the same sound name" +
"\n -Swap SoundManager language in run-time to use the same sound name for multiple sounds but diferent languages");
GUILayout.EndArea();
GUILayout.BeginArea (new Rect((Screen.width/2)-250, (Screen.height/2) , 500, 300));
if(GUILayout.Button("Mute/Unmute Background Sound Track")){
SoundManager.Mute(!SoundManager.bkgMuted, track.BackgroundSound);
//IF YOU WOULD LIKE TO STOP A SINGLE SOUND, DO LIKE THIS
//SoundManager.Mute(!SoundManager.GetSoundPlaying("background")[0].isMuted,"background");
}
if(GUILayout.Button("- Volume (all tracks)")){
volumeController -= 0.1f;
if(volumeController < 0) volumeController = 0;
SoundManager.Volume(volumeController,track.All);
}
if(GUILayout.Button("+ Volume (all tracks)")){
volumeController += 0.1f;
if(volumeController > 1) volumeController = 1;
SoundManager.Volume(volumeController,track.All);
}
if(GUILayout.Button("Press here to play a 'Erro' Sound, it will choose at random and play!")){
SoundManager.Play("Erro");
}
if(GUILayout.Button("Change Language, current language: "+SoundManager.language+"\n and play the 'banana' sound.\n Each banana sound has a different language, but same name. Check in inspector!", GUILayout.Height(75))){
SoundManager.language = (SoundManager.language == "Portuguese") ? "English" : "Portuguese";
SoundManager.Play("banana");
}
GUILayout.EndArea();
}
19
View Source File : Popup.cs
License : MIT License
Project Creator : Astropilot
License : MIT License
Project Creator : Astropilot
public static string SearchableSelectionPopup(string current, string[] displayOptions, ref string searchTerms)
{
var idx = Array.IndexOf(displayOptions, current);
GUILayout.Box(current, InterfaceMaker.CustomSkin.textField);
var newIdx = SearchablePopupOnLastRect(idx, displayOptions, ref searchTerms);
if (newIdx != idx)
{
current = displayOptions[newIdx];
}
return current;
}
19
View Source File : UI.cs
License : MIT License
Project Creator : newman55
License : MIT License
Project Creator : newman55
private void DrawTab(int tabId, ref UnityAction buttons)
{
var minWidth = GUILayout.MinWidth(mWindowSize.x);
switch (tabs[tabId])
{
case "Mods":
{
mScrollPosition[tabId] = GUILayout.BeginScrollView(mScrollPosition[tabId], minWidth, GUILayout.ExpandHeight(false));
var amountWidth = mColumns.Where(x => !x.skip).Sum(x => x.width);
var expandWidth = mColumns.Where(x => x.expand && !x.skip).Sum(x => x.width);
var mods = modEntries;
var colWidth = mColumns.Select(x =>
x.expand
? GUILayout.Width(x.width / expandWidth * (mWindowSize.x - 60 + expandWidth - amountWidth))
: GUILayout.Width(x.width)).ToArray();
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal("box");
for (int i = 0; i < mColumns.Count; i++)
{
if (mColumns[i].skip)
continue;
GUILayout.Label(mColumns[i].name, colWidth[i]);
}
GUILayout.EndHorizontal();
for (int i = 0, c = mods.Count; i < c; i++)
{
int col = -1;
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal();
GUILayout.BeginHorizontal(colWidth[++col]);
if (mods[i].OnGUI != null || mods[i].CanReload)
{
if (GUILayout.Button(mods[i].Info.DisplayName, GUI.skin.label, GUILayout.ExpandWidth(true)))
{
ShowModSettings = (ShowModSettings == i) ? -1 : i;
}
if (GUILayout.Button(ShowModSettings == i ? Textures.SettingsActive : Textures.SettingsNormal, settings))
{
ShowModSettings = (ShowModSettings == i) ? -1 : i;
}
}
else
{
GUILayout.Label(mods[i].Info.DisplayName);
}
if (!string.IsNullOrEmpty(mods[i].Info.HomePage))
{
GUILayout.Space(10);
if (GUILayout.Button(Textures.WWW, www))
{
Application.OpenURL(mods[i].Info.HomePage);
}
}
if (mods[i].NewestVersion != null)
{
GUILayout.Space(10);
GUILayout.Box(Textures.Updates, updates);
}
GUILayout.Space(20);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(colWidth[++col]);
GUILayout.Label(mods[i].Info.Version, GUILayout.ExpandWidth(false));
// if (string.IsNullOrEmpty(mods[i].Info.Repository))
// {
// GUI.color = new Color32(255, 81, 83, 255);
// GUILayout.Label("*");
// GUI.color = Color.white;
// }
GUILayout.EndHorizontal();
if (mods[i].ManagerVersion > GetVersion())
{
GUILayout.Label("<color=\"#CD5C5C\">Manager-" + mods[i].Info.ManagerVersion + "</color>", colWidth[++col]);
}
else if (gameVersion != VER_0 && mods[i].GameVersion > gameVersion)
{
GUILayout.Label("<color=\"#CD5C5C\">Game-" + mods[i].Info.GameVersion + "</color>", colWidth[++col]);
}
else if (mods[i].Requirements.Count > 0)
{
GUILayout.BeginHorizontal(colWidth[++col]);
mJoinList.Clear();
foreach (var item in mods[i].Requirements)
{
var id = item.Key;
var mod = FindMod(id);
mJoinList.Add(((mod == null || item.Value != null && item.Value > mod.Version || !mod.Active) && mods[i].Active) ? "<color=\"#CD5C5C\">" + id + "</color> " : id);
}
GUILayout.Label(string.Join(", ", mJoinList.ToArray()));
GUILayout.EndHorizontal();
}
else if (!string.IsNullOrEmpty(mods[i].CustomRequirements))
{
GUILayout.Label(mods[i].CustomRequirements, colWidth[++col]);
}
else
{
GUILayout.Label("-", colWidth[++col]);
}
if (!forbidDisableMods)
{
var action = mods[i].Enabled;
action = GUILayout.Toggle(action, "", colWidth[++col]);
if (action != mods[i].Enabled)
{
mods[i].Enabled = action;
if (mods[i].Toggleable)
mods[i].Active = action;
else if (action && !mods[i].Loaded)
mods[i].Active = action;
}
}
else
{
GUILayout.Label("", colWidth[++col]);
}
if (mods[i].Active)
{
GUILayout.Box(mods[i].Enabled ? Textures.StatusActive : Textures.StatusNeedRestart, status);
}
else
{
GUILayout.Box(!mods[i].Enabled ? Textures.StatusInactive : Textures.StatusNeedRestart, status);
}
if (mods[i].ErrorOnLoading)
GUILayout.Label("!!!");
GUILayout.EndHorizontal();
if (ShowModSettings == i)
{
if (mods[i].CanReload)
{
GUILayout.Label("Debug", h2);
if (GUILayout.Button("Reload", button, GUILayout.ExpandWidth(false)))
{
mods[i].Reload();
}
GUILayout.Space(5);
}
if (mods[i].Active && mods[i].OnGUI != null)
{
GUILayout.Label("Options", h2);
try
{
mods[i].OnGUI(mods[i]);
}
//catch (ExitGUIException e)
//{
// throw e;
//}
catch (Exception e)
{
mods[i].Logger.LogException("OnGUI", e);
ShowModSettings = -1;
GUIUtility.ExitGUI();
}
}
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.Space(10);
GUILayout.Box(Textures.SettingsNormal, settings);
GUILayout.Space(3);
GUILayout.Label("Options", GUILayout.ExpandWidth(false));
GUILayout.Space(15);
GUILayout.Box(Textures.WWW, www);
GUILayout.Space(3);
GUILayout.Label("Home page", GUILayout.ExpandWidth(false));
GUILayout.Space(15);
GUILayout.Box(Textures.Updates, updates);
GUILayout.Space(3);
GUILayout.Label("Available update", GUILayout.ExpandWidth(false));
GUILayout.Space(15);
GUILayout.Box(Textures.StatusActive, status);
GUILayout.Space(3);
GUILayout.Label("Active", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Box(Textures.StatusInactive, status);
GUILayout.Space(3);
GUILayout.Label("Inactive", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Box(Textures.StatusNeedRestart, status);
GUILayout.Space(3);
GUILayout.Label("Need restart", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Label("!!!", GUILayout.ExpandWidth(false));
GUILayout.Space(3);
GUILayout.Label("Errors", GUILayout.ExpandWidth(false));
GUILayout.Space(10);
GUILayout.Label("[CTRL + LClick]", bold, GUILayout.ExpandWidth(false));
GUILayout.Space(3);
GUILayout.Label("Drag window", GUILayout.ExpandWidth(false));
// GUILayout.Space(10);
// GUI.color = new Color32(255, 81, 83, 255);
// GUILayout.Label("*", bold, GUILayout.ExpandWidth(false));
// GUI.color = Color.white;
// GUILayout.Space(3);
// GUILayout.Label("Not support updates", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
if (GUI.changed)
{
}
break;
}
case "Logs":
{
mScrollPosition[tabId] = GUILayout.BeginScrollView(mScrollPosition[tabId], minWidth);
GUILayout.BeginVertical("box");
for (int c = Logger.history.Count, i = Mathf.Max(0, c - Logger.historyCapacity); i < c; i++)
{
GUILayout.Label(Logger.history[i]);
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
buttons += delegate
{
if (GUILayout.Button("Clear", button, GUILayout.ExpandWidth(false)))
{
Logger.Clear();
}
if (GUILayout.Button("Open detailed log", button, GUILayout.ExpandWidth(false)))
{
OpenUnityFileLog();
}
};
break;
}
case "Settings":
{
mScrollPosition[tabId] = GUILayout.BeginScrollView(mScrollPosition[tabId], minWidth);
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal();
GUILayout.Label("Hotkey (default Ctrl+F10)", GUILayout.ExpandWidth(false));
DrawKeybinding(ref Params.Hotkey, "UMMHotkey", null, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.Space(5);
GUILayout.BeginHorizontal();
GUILayout.Label("Check updates", GUILayout.ExpandWidth(false));
ToggleGroup(Params.CheckUpdates, mCheckUpdateStrings, i => { Params.CheckUpdates = i; }, null, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.Space(5);
GUILayout.BeginHorizontal();
GUILayout.Label("Show this window on startup", GUILayout.ExpandWidth(false));
ToggleGroup(Params.ShowOnStart, mShowOnStartStrings, i => { Params.ShowOnStart = i; }, null, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.Space(5);
GUILayout.BeginVertical("box");
GUILayout.Label("Window size", bold, GUILayout.ExpandWidth(false));
GUILayout.BeginHorizontal();
GUILayout.Label("Width ", GUILayout.ExpandWidth(false));
mExpectedWindowSize.x = GUILayout.HorizontalSlider(mExpectedWindowSize.x, Mathf.Min(Screen.width, 960), Screen.width, GUILayout.Width(200));
GUILayout.Label(" " + mExpectedWindowSize.x.ToString("f0") + " px ", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Height", GUILayout.ExpandWidth(false));
mExpectedWindowSize.y = GUILayout.HorizontalSlider(mExpectedWindowSize.y, Mathf.Min(Screen.height, 720), Screen.height, GUILayout.Width(200));
GUILayout.Label(" " + mExpectedWindowSize.y.ToString("f0") + " px ", GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
if (GUILayout.Button("Apply", button, GUILayout.ExpandWidth(false)))
{
mWindowSize.x = Mathf.Floor(mExpectedWindowSize.x) % 2 > 0 ? Mathf.Ceil(mExpectedWindowSize.x) : Mathf.Floor(mExpectedWindowSize.x);
mWindowSize.y = Mathf.Floor(mExpectedWindowSize.y) % 2 > 0 ? Mathf.Ceil(mExpectedWindowSize.y) : Mathf.Floor(mExpectedWindowSize.y);
CalculateWindowPos();
Params.WindowWidth = mWindowSize.x;
Params.WindowHeight = mWindowSize.y;
}
GUILayout.EndVertical();
GUILayout.Space(5);
GUILayout.BeginVertical("box");
GUILayout.Label("UI", bold, GUILayout.ExpandWidth(false));
GUILayout.BeginHorizontal();
GUILayout.Label("Scale", GUILayout.ExpandWidth(false), GUILayout.ExpandWidth(false));
mExpectedUIScale = GUILayout.HorizontalSlider(mExpectedUIScale, 0.5f, 2f, GUILayout.Width(200));
GUILayout.Label(" " + mExpectedUIScale.ToString("f2"), GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
if (GUILayout.Button("Apply", button, GUILayout.ExpandWidth(false)))
{
if (mUIScale != mExpectedUIScale)
{
mUIScaleChanged = true;
mUIScale = mExpectedUIScale;
Params.UIScale = mUIScale;
}
}
GUILayout.EndVertical();
GUILayout.EndVertical();
GUILayout.EndScrollView();
break;
}
}
}
19
View Source File : RunResults.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
public override void Render() {
if(_showFileDeletedMessage) {
if(DateTime.Now.Subtract(_fileDeletedTime).TotalSeconds > 2) {
_showFileDeletedMessage = false;
}
}
GUIStyle back = new GUIStyle(GUI.skin.button);
back.fontSize = 20;
back.margin = new RectOffset(25, 0, 10, 20);
if(ReDrawAutomationReports) {
ReDrawAutomationReports = false;
if(!Directory.Exists(Path.GetDirectoryName(FileBroker.REPORTS_DIRECTORY))) {
Directory.CreateDirectory(Path.GetDirectoryName(FileBroker.REPORTS_DIRECTORY));
}
//Grab any report files.
List<string> all = Directory.GetFiles(FileBroker.REPORTS_DIRECTORY, "report.html", SearchOption.AllDirectories).ToList();
automationReports = new List<FileInfo>();
for (int x = 0; x < all.Count; x++) {
automationReports.Add(new FileInfo(all[x]));
}
//Grab meta files for reports.
all = Directory.GetFiles(FileBroker.REPORTS_DIRECTORY, "report.meta", SearchOption.AllDirectories).ToList();
metaData = new List<KeyValuePair<string,List<KeyValuePair<string,string>>>>();
for(int m = 0; m < all.Count; m++) {
FileInfo info = new FileInfo(all[m]);
string[] metaLines = FileBroker.ReadUnboundFile(info.FullName);
List<KeyValuePair<string,string>> values = new List<KeyValuePair<string,string>>();
for(int ml = 0; ml < metaLines.Length; ml++) {
string[] keyVals = metaLines[ml].Split(':');
values.Add(new KeyValuePair<string,string>(keyVals[0], keyVals[1]));
}
metaData.Add(new KeyValuePair<string,List<KeyValuePair<string,string>>>(all[m].Split(new string[] { string.Format("{0}{1}", GameMaster.GAME_NAME, FileBroker.FILE_PATH_SPLIT) }, StringSplitOptions.None)[1].Replace(string.Format("{0}report.meta", FileBroker.FILE_PATH_SPLIT), ".html"), values));
}
automationReports.Reverse();
}
if(!automationReports.Any()) {
GUIStyle noResults = new GUIStyle(GUI.skin.label);
noResults.padding = new RectOffset(10, 0, 0, 0);
noResults.fontSize = 14;
noResults.normal.textColor = Color.blue;
GUILayout.Space(20);
EditorGUILayout.LabelField("No test reports currently exist.", noResults);
return;
}
Color32 boxGreen = new Color32(20, 175, 0, 255);
GUIStyle fileLabel = new GUIStyle(GUI.skin.label);
fileLabel.normal.textColor = boxGreen;
fileLabel.padding = new RectOffset(32, 0, 0, 1);
GUIStyle fileNameButton = new GUIStyle(GUI.skin.button);
fileNameButton.margin = new RectOffset(35, 0, 0, 0);
fileNameButton.normal.background = fileNameButton.active.background = fileNameButton.focused.background = Swat.TabButtonBackgroundTexture;
fileNameButton.normal.textColor = Swat.WindowDefaultTextColor;
GUIStyle deleteFileButton = new GUIStyle(GUI.skin.button);
deleteFileButton.normal.textColor = Color.red;
deleteFileButton.fontSize = 14;
deleteFileButton.margin = new RectOffset(1, 0, 0, 5);
deleteFileButton.normal.background = deleteFileButton.active.background = deleteFileButton.focused.background = Swat.TabButtonBackgroundTexture;
deleteFileButton.normal.textColor = Color.red;
GUIStyle divider = new GUIStyle(GUI.skin.box);
divider.normal.background = Swat.MakeTextureFromColor(boxGreen);
divider.margin = new RectOffset(35, 10, 10, 10);
GUIStyle deleteAllButton = new GUIStyle(GUI.skin.button);
deleteAllButton.fontSize = 12;
deleteAllButton.normal.textColor = Color.red;
deleteAllButton.fontStyle = FontStyle.Bold;
deleteAllButton.fixedHeight = 38;
deleteAllButton.margin = new RectOffset(0, 25, 5, 0);
deleteAllButton.normal.background = deleteAllButton.active.background = deleteAllButton.focused.background = Swat.TabButtonBackgroundTexture;
deleteAllButton.normal.textColor = Color.red;
GUILayout.Space(20);
GUIStyle padding = new GUIStyle();
padding.margin = new RectOffset(25, 0, 0, 0);
GUILayout.BeginHorizontal(padding);
EditorGUILayout.Space();
if(_showFileDeletedMessage) {
GUIStyle deleteFileAlert = new GUIStyle(GUI.skin.label);
deleteFileAlert.normal.textColor = Color.red;
deleteFileAlert.fontSize = 14;
deleteFileAlert.fixedHeight = 28;
deleteFileAlert.padding = new RectOffset(30, 0, 14, 0);
EditorGUILayout.LabelField("Deleted!", deleteFileAlert);
}
EditorGUILayout.Space();
if(GUILayout.Button("Delete All", deleteAllButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(75) })) {
SimpleAlert.Pop("Are you sure you want to delete all stored test run reports?", new EditorDelegate(DeleteAll));
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
for(int ar = 0; ar < automationReports.Count; ar++) {
bool isNewest = ar == 0;
string[] splitTime = automationReports[ar].CreationTime.ToShortTimeString().Split(':');
int hour = int.Parse(splitTime[0]);
bool am = true;
if(hour >= 12) {
am = false;
if(hour != 12) {
hour -= 12;
}
}
if(!isNewest) {
fileNameButton.normal.textColor = fileLabel.normal.textColor = Swat.WindowDefaultTextColor;
}
string timeOfDay = string.Format("{0}:{1} {2}", hour.ToString(), splitTime[1], am ? "AM" : "PM");
if(isNewest) {
EditorGUILayout.LabelField("-----Newest-----", fileLabel);
}
EditorGUILayout.LabelField(string.Format("{0} {1}", automationReports[ar].CreationTime.ToLongDateString(), timeOfDay), fileLabel);
List<KeyValuePair<string,List<KeyValuePair<string,string>>>> matchMetaResults = metaData.FindAll(x => automationReports[ar].Directory.ToString().Contains(x.Key.Replace(".html", string.Empty)));
if(matchMetaResults.Any()) {
KeyValuePair<string,List<KeyValuePair<string,string>>> matchMeta = matchMetaResults.First();
EditorGUILayout.LabelField(string.Format("{0}:{1} {2}:{3} {4}:{5} {6}:{7}",
TestManifest.PreplacedED, matchMeta.Value.Find(x => x.Key == "Preplacedes").Value,
TestManifest.FAILED, matchMeta.Value.Find(x => x.Key == "Fails").Value,
TestManifest.SKIPPED, matchMeta.Value.Find(x => x.Key == "Skips").Value,
TestManifest.IGNORED, matchMeta.Value.Find(x => x.Key == "Ignores").Value), fileLabel);
if(Nexus.Self.MouseOver()) {
Nexus.Self.SetToolTip(matchMeta.Value.Find(x => x.Key == "RunCommand").Value.Replace(",", "\n"));
}
}
if(isNewest) {
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(180) });
}
GUILayout.BeginHorizontal();
if(GUILayout.Button("Open Report", fileNameButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(150) })) {
System.Diagnostics.Process.Start(automationReports[ar].FullName);
}
if(GUILayout.Button("X", deleteFileButton, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(30) })) {
//Delete report and replacedociated meta file.
Directory.Delete(automationReports[ar].Directory.ToString().Replace("/report.html", string.Empty), true);
ReDrawAutomationReports = true;
_fileDeletedTime = DateTime.Now;
_showFileDeletedMessage = true;
}
GUILayout.EndHorizontal();
if(isNewest) {
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(180) });
}
EditorGUILayout.Space();
EditorGUILayout.Space();
}
}
19
View Source File : AtlasTemplateGenerator.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
void OnGUI()
{
GUILayout.Space(20);
GUIStyle replacedleStyle = new GUIStyle(EditorStyles.label);
replacedleStyle.fontSize = 32;
replacedleStyle.normal.textColor = Color.white;
replacedleStyle.fontStyle = FontStyle.Bold;
replacedleStyle.stretchWidth = true;
replacedleStyle.stretchHeight = true;
replacedleStyle.alignment = TextAnchor.MiddleCenter;
GUILayout.BeginVertical();
EditorGUILayout.LabelField("Mapbox Atlas Template Generator", replacedleStyle, GUILayout.Height(100));
GUILayout.BeginHorizontal();
GUILayout.BeginVertical(GUILayout.MinWidth(200), GUILayout.MaxWidth(300));
EditorGUI.BeginChangeCheck();
EditorGUI.indentLevel++;
m_atlasInfo = EditorGUILayout.ObjectField("Atlas info:", m_atlasInfo, typeof(AtlasInfo), true) as Mapbox.Unity.MeshGeneration.Data.AtlasInfo;
EditorGUILayout.Space();
m_generateFacadesTemplate = EditorGUILayout.Toggle("Create Facades", m_generateFacadesTemplate);
m_generateRoofsTemplate = EditorGUILayout.Toggle("Create Roofs", m_generateRoofsTemplate);
if (EditorGUI.EndChangeCheck())
{
if (m_atlasInfo != null)
{
int facadeCount = m_generateFacadesTemplate ? m_atlasInfo.Textures.Count : 0;
int roofCount = m_generateRoofsTemplate ? m_atlasInfo.Roofs.Count : 0;
int textureCount = facadeCount + roofCount;
m_colors = new Color[textureCount];
float hueIncrement = (float)1.0f / textureCount;
float hue = 0.0f;
for (int i = 0; i < textureCount; i++)
{
m_colors[i] = Color.HSVToRGB(hue, 1.0f, 1.0f);
hue += hueIncrement;
}
}
else
{
m_colors = new Color[0];
CreateTexture();
}
}
EditorGUI.BeginChangeCheck();
m_textureResolution = Mathf.Clamp(EditorGUILayout.IntField("Texture resolution:", m_textureResolution), _MIN_TEX_SIZE, _MAX_TEX_SIZE);
if (EditorGUI.EndChangeCheck())
{
CreateTexture();
}
EditorGUILayout.Space();
if (m_colors != null)
{
for (int i = 0; i < m_colors.Length; i++)
{
string colorFieldName = string.Format("Color {0}", i);
m_colors[i] = EditorGUILayout.ColorField(colorFieldName, m_colors[i]);
}
}
if (GUILayout.Button("Generate Template"))
{
if (m_atlasInfo == null)
{
EditorUtility.DisplayDialog("Atlas Template Generator", "Error: No AtlasInfo object selected.", "Ok");
return;
}
if (!m_generateFacadesTemplate && !m_generateRoofsTemplate)
{
EditorUtility.DisplayDialog("Atlas Template Generator", "Error: Template generation requires Create Facades and/or Create Roofs to be enabled.", "Ok");
return;
}
GenerateTemplate();
}
EditorGUILayout.Space();
if (GUILayout.Button("Save to file"))
{
SaveTextureAsPNG();
}
EditorGUI.indentLevel--;
GUILayout.EndVertical();
GUIStyle boxStyle = new GUIStyle();
boxStyle.alignment = TextAnchor.UpperLeft;
GUILayout.Box(m_texture, boxStyle, GUILayout.Width(300), GUILayout.Height(300), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.Space(20);
}
19
View Source File : ProductsWindow.cs
License : GNU Lesser General Public License v3.0
Project Creator : ApexGameTools
License : GNU Lesser General Public License v3.0
Project Creator : ApexGameTools
private void CreateProductEntry(ProductInfo p)
{
EditorGUILayout.BeginVertical("Box");
EditorGUILayout.BeginHorizontal();
//Create and anchor the foldout
GUILayout.Label(GUIContent.none);
var productLabel = new GUIContent(" " + p.name, p.icon.texture);
p.expanded = EditorGUI.Foldout(GUILayoutUtility.GetLastRect(), p.expanded, productLabel, true, _styles.foldout);
//New update marker
if (p.newUpdateAvailable)
{
if (p.status == ProductStatus.PatchAvailable)
{
GUILayout.Label(new GUIContent("#", "New patch available!"), _styles.labelHighlight, GUILayout.Width(20));
}
else
{
GUILayout.Label(new GUIContent("!", "New update available!"), _styles.labelHighlight, GUILayout.Width(20));
}
}
else
{
GUILayout.Label(GUIContent.none, GUILayout.Width(20));
}
//Version
GUIContent status;
if (p.installedVersion == null)
{
status = new GUIContent("N/A", "Not installed");
}
else
{
status = new GUIContent(Write(p.installedVersion), "Installed version");
}
GUILayout.Label(status, _styles.centeredText, GUILayout.Width(50));
//Link buttons / status
if (p.status != ProductStatus.UpToDate)
{
if (p.status == ProductStatus.ComingSoon)
{
EditorGUILayout.LabelField("Coming soon", GUILayout.Width(80));
}
else if (p.status == ProductStatus.UpdateAvailable)
{
if (GUILayout.Button(new GUIContent("Update It", string.Format("Version {0} is now available.\n\nClick to open the product's page on the Unity replacedet Store.", p.newestVersion)), EditorStyles.toolbarButton, GUILayout.Width(80)))
{
replacedetStore.Open(p.storeUrl);
}
}
else if (p.status == ProductStatus.ProductAvailable)
{
if (GUILayout.Button(new GUIContent("Get It", "Now available.\n\nClick to open the product's page on the Unity replacedet Store."), EditorStyles.toolbarButton, GUILayout.Width(80)))
{
replacedetStore.Open(p.storeUrl);
}
}
else if (p.status == ProductStatus.PatchAvailable)
{
if (GUILayout.Button(new GUIContent("Patch It", "A patch is available.\n\nClick to download and apply the patch. Patches are hot fixes and all patches will be included in the following product update."), EditorStyles.toolbarButton, GUILayout.Width(80)))
{
ProductManager.ApplyPatches(p, _settings);
}
}
}
else
{
GUILayout.Space(80f);
}
EditorGUILayout.EndHorizontal();
//Details
if (p.expanded)
{
GUILayout.Box(GUIContent.none, _styles.boxSeparator);
var description = string.IsNullOrEmpty(p.description) ? "No description available" : p.description;
EditorGUILayout.LabelField(description, _styles.labelWithWrap);
EditorGUILayout.BeginHorizontal();
if (!string.IsNullOrEmpty(p.productUrl))
{
if (GUILayout.Button("Product Page", _styles.labelLink))
{
Application.OpenURL(p.productUrl);
}
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
}
if (!string.IsNullOrEmpty(p.changeLogPath))
{
if (GUILayout.Button("Change Log", _styles.labelLink))
{
Application.OpenURL(p.changeLogPath);
}
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
}
19
View Source File : Test.cs
License : MIT License
Project Creator : psygames
License : MIT License
Project Creator : psygames
private void OnGUI()
{
scroll = GUILayout.BeginScrollView(scroll,GUILayout.Width(300));
// BASE
GUILayout.BeginVertical("box");
GUILayout.Label("Base:");
if (GUILayout.Button("console.log"))
{
WebGLKit.Log("test log");
}
if (GUILayout.Button("alert"))
{
WebGLKit.Alert("test alert");
}
GUILayout.EndVertical();
// OPEN FILE
GUILayout.BeginVertical("box");
if (string.IsNullOrEmpty(uploadFileName))
GUILayout.Label("Try to open a image file:");
else
GUILayout.Label("File: " + uploadFileName);
if (GUILayout.Button("Open File"))
{
uploadFileName = "";
uploadBytes = null;
uploadTexture = null;
WebGLKit.OpenFile((filename, bytes) =>
{
WebGLKit.Log("file name: " + filename);
WebGLKit.Log("file size: " + bytes.Length);
uploadFileName = filename;
uploadBytes = bytes;
// Do something else
});
}
if (uploadFileName.EndsWith(".png")
|| uploadFileName.EndsWith(".jpg")
|| uploadFileName.EndsWith(".jpeg"))
{
if (uploadTexture == null)
{
uploadTexture = new Texture2D(0, 0);
uploadTexture.LoadImage(uploadBytes);
uploadBytes = null;
}
GUILayout.Box(uploadTexture, GUILayout.Width(266), GUILayout.Height(150));
};
GUILayout.EndVertical();
// RESOLUTION
GUILayout.BeginVertical("box");
GUILayout.Label("Resolution: ");
GUILayout.BeginHorizontal();
width = int.Parse(GUILayout.TextField(width.ToString()));
GUILayout.Label(" x ");
height = int.Parse(GUILayout.TextField(height.ToString()));
GUILayout.EndHorizontal();
if (GUILayout.Button("Set Resolution"))
{
WebGLKit.SetResolution(width, height);
}
GUILayout.EndVertical();
// EVAL JS CODE
GUILayout.BeginVertical("box");
GUILayout.Label("JS Code: ");
jsCode = GUILayout.TextArea(jsCode);
if (GUILayout.Button("Eval JS"))
{
var result = WebGLKit.EvalJs(jsCode);
WebGLKit.Log(result);
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
19
View Source File : PanelCanvasEditor.cs
License : MIT License
Project Creator : Hertzole
License : MIT License
Project Creator : Hertzole
public override void OnInspectorGUI()
{
if (ancreplaceddPanelGUIStyle == null)
{
ancreplaceddPanelGUIStyle = new GUIStyle("box")
{
alignment = TextAnchor.MiddleCenter,
clipping = TextClipping.Clip
};
}
if (justClickedAncreplaceddPanel != null && Event.current.type == EventType.Layout)
{
selectedAncreplaceddPanel = justClickedAncreplaceddPanel;
selectedAncreplaceddPanelTabs = selectedAncreplaceddPanel.panel.tabs;
justClickedAncreplaceddPanel = null;
}
serializedObject.Update();
reorderableListIndex = 0;
bool multiObjectEditing = targets.Length > 1;
bool guiEnabled = !EditorApplication.isPlaying || replacedetDatabase.Contains(((PanelCanvas)serializedObject.targetObject).gameObject);
GUI.enabled = guiEnabled;
GUILayout.BeginVertical();
EditorGUILayout.LabelField("= Properties =", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(panelPrefab);
EditorGUILayout.PropertyField(leaveFreeSpace);
EditorGUI.indentLevel++;
GUI.enabled = guiEnabled && leaveFreeSpace.boolValue;
EditorGUILayout.PropertyField(minimumFreeSpace);
GUI.enabled = guiEnabled;
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField(preventDetachingLastDockedPanel);
EditorGUILayout.PropertyField(panelResizableAreaLength);
EditorGUILayout.PropertyField(canvasAnchorZoneLength);
EditorGUILayout.PropertyField(panelAnchorZoneLength);
GUILayout.Space(10f);
EditorGUILayout.LabelField("= Free Panels =", EditorStyles.boldLabel);
if (multiObjectEditing)
{
GUILayout.Label("Multi-object editing not supported");
}
else if (!guiEnabled)
{
GUILayout.Label("Can't edit in Play mode");
}
else
{
List<PanelCanvas.PanelProperties> initialPanelsUnancreplacedd = settings.InitialPanelsUnancreplacedd;
int selectedReorderableListIndex = -1;
for (int i = 0; i < initialPanelsUnancreplacedd.Count; i++)
{
if (DrawReorderableListFor(initialPanelsUnancreplacedd[i]))
{
selectedReorderableListIndex = i;
}
if (i < initialPanelsUnancreplacedd.Count - 1)
{
// Draw a horizontal line to separate the panels
GUILayout.Space(5f);
GUILayout.Box(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(2f));
}
GUILayout.Space(5f);
}
GUILayout.BeginHorizontal();
if (GUILayout.Button("Add New", GUILayout.Height(1.35f * EditorGUIUtility.singleLineHeight)))
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Add Free Panel");
initialPanelsUnancreplacedd.Add(new PanelCanvas.PanelProperties());
}
if (selectedReorderableListIndex < 0)
{
GUI.enabled = false;
}
if (GUILayout.Button("Remove Selected", GUILayout.Height(1.35f * EditorGUIUtility.singleLineHeight)))
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Remove Free Panel");
initialPanelsUnancreplacedd.RemoveAt(selectedReorderableListIndex);
}
GUI.enabled = guiEnabled;
GUILayout.EndHorizontal();
}
GUILayout.Space(13f);
EditorGUILayout.LabelField("= Docked Panels =", EditorStyles.boldLabel);
if (multiObjectEditing)
{
GUILayout.Label("Multi-object editing not supported");
}
else if (!guiEnabled)
{
GUILayout.Label("Can't edit in Play mode");
}
else
{
PanelCanvas.AncreplaceddPanelProperties initialPanelsAncreplacedd = settings.InitialPanelsAncreplacedd;
Rect previewRect = EditorGUILayout.GetControlRect(false, ANCreplacedD_PANELS_PREVIEW_HEIGHT);
DrawAncreplaceddPanelsPreview(previewRect, initialPanelsAncreplacedd);
if (selectedAncreplaceddPanel != null)
{
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(5f);
EditorGUILayout.LabelField("Selected panel:", EditorStyles.boldLabel);
if (selectedAncreplaceddPanelTabs != settings.InitialPanelsAncreplacedd.panel.tabs)
{
string initialSizeLabel = selectedAncreplaceddPanel.initialSize == Vector2.zero ? "Initial Size (not set):" : "Initial Size:";
EditorGUI.BeginChangeCheck();
Vector2 panelInitialSize = EditorGUILayout.Vector2Field(initialSizeLabel, selectedAncreplaceddPanel.initialSize);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject((PanelCanvas)target, "Change Initial Size");
selectedAncreplaceddPanel.initialSize = panelInitialSize;
}
DrawReorderableListFor(selectedAncreplaceddPanel.panel);
}
else
{
GUILayout.Label("- nothing -");
}
PanelDirection direction = ShowDirectionButtons("Dock new panel inside: ");
if (direction != PanelDirection.None)
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Dock New Panel");
selectedAncreplaceddPanel.subPanels.Add(new PanelCanvas.AncreplaceddPanelProperties() { anchorDirection = direction });
}
if (selectedAncreplaceddPanelTabs != settings.InitialPanelsAncreplacedd.panel.tabs)
{
GUILayout.Space(5f);
if (GUILayout.Button("Remove Selected", GUILayout.Height(1.35f * EditorGUIUtility.singleLineHeight)))
{
RemoveAncreplaceddPanel(settings.InitialPanelsAncreplacedd, selectedAncreplaceddPanel);
}
}
GUILayout.EndVertical();
}
GUILayout.Space(6f);
PanelDirection rootDirection = ShowDirectionButtons("Dock new panel to canvas: ");
if (rootDirection != PanelDirection.None)
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Dock New Panel");
settings.InitialPanelsAncreplacedd.subPanels.Insert(0, new PanelCanvas.AncreplaceddPanelProperties() { anchorDirection = rootDirection });
}
}
GUI.enabled = true;
GUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
}
19
View Source File : EditorMark.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
public void Inspector()
{
GUILayout.BeginHorizontal();
GUIContent cont = SeqenceWindow.inst.state.config.GetIcon(baseMarker.type);
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("- " + baseMarker.type, SeqenceStyle.replacedleStyle);
GUILayout.Space(4);
GUILayout.Box(cont, GUIStyle.none, GUILayout.MaxWidth(10), GUILayout.MaxHeight(12));
GUILayout.EndHorizontal();
baseMarker.time = EditorGUILayout.FloatField(" time", baseMarker.time);
baseMarker.reverse = EditorGUILayout.Toggle(" reverse", baseMarker.reverse);
OnInspector();
EditorGUI.indentLevel--;
}
19
View Source File : BlendshapePrinter.cs
License : GNU General Public License v3.0
Project Creator : ARPOISE
License : GNU General Public License v3.0
Project Creator : ARPOISE
void OnGUI()
{
if (shapeEnabled) {
string blendshapes = "";
string shapeNames = "";
string valueNames = "";
foreach(KeyValuePair<string,float> kvp in currentBlendShapes) {
blendshapes += " [";
blendshapes += kvp.Key.ToString ();
blendshapes += ":";
blendshapes += kvp.Value.ToString ();
blendshapes += "]\n";
shapeNames += "\"";
shapeNames += kvp.Key.ToString ();
shapeNames += "\",\n";
valueNames += kvp.Value.ToString ();
valueNames += "\n";
}
GUILayout.BeginHorizontal (GUILayout.ExpandHeight(true));
GUILayout.Box (blendshapes);
GUILayout.EndHorizontal ();
Debug.Log (shapeNames);
Debug.Log (valueNames);
}
}
19
View Source File : SocketIOWePlaySample.cs
License : MIT License
Project Creator : huanzi-qch
License : MIT License
Project Creator : huanzi-qch
void OnGUI()
{
switch (State)
{
case States.Connecting:
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
GUIHelper.DrawCenteredText("Connecting to the server...");
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
});
break;
case States.WaitForNick:
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
DrawLoginScreen();
});
break;
case States.Joined:
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
// Draw Texture
if (FrameTexture != null)
GUILayout.Box(FrameTexture);
DrawControls();
DrawChat();
});
break;
}
}
19
View Source File : Widget.cs
License : MIT License
Project Creator : ByronMayne
License : MIT License
Project Creator : ByronMayne
public virtual void OnWidgetGUI(ScriptForgeStyles style)
{
GUI.backgroundColor = m_BackgroundColor;
Rect headerRect = EditorGUILayout.BeginVertical(GUI.skin.box);
{
GUILayout.BeginHorizontal();
{
OnreplacedleBarGUI(style);
}
GUILayout.EndHorizontal();
headerRect.height = 30f;
if (Event.current.type == EventType.MouseDown && headerRect.Contains(Event.current.mousePosition))
{
// They left clicked.
if(Event.current.button == 0)
{
FlashColor(Color.gray, 0.25f);
m_IsOpen = !m_IsOpen;
GUIUtility.hotControl = -1;
GUIUtility.keyboardControl = -1;
}
// They right clicked.
else if(Event.current.button == 1)
{
// Create our menu.
GenericMenu menu = new GenericMenu();
// Populate it
OnGenerateContexMenu(menu);
// Check if we have any elements
if(menu.GereplacedemCount() > 0)
{
// Show it.
menu.DropDown(headerRect);
}
}
}
// As long as our animation is playing we
// want to force a repaint.
if(m_OpenAnimation.isAnimating)
{
m_ScriptableForge.Repaint();
}
if (EditorGUILayout.BeginFadeGroup(m_OpenAnimation.faded))
{
GUILayout.Box(GUIContent.none, style.spacer);
if (m_ErrorCode != ScriptForgeErrors.Codes.None)
{
EditorGUILayout.HelpBox(m_ErrorMessage, MessageType.Error);
}
EditorGUI.BeginChangeCheck();
{
DrawWidgetContent(style);
}
if (EditorGUI.EndChangeCheck())
{
OnContentChanged();
}
GUILayout.Box(GUIContent.none, style.spacer);
DrawWidgetFooter(style);
}
EditorGUILayout.EndFadeGroup();
}
EditorGUILayout.EndVertical();
if (m_ScriptableForge.animateWidgets)
{
m_OpenAnimation.target = m_IsOpen;
}
else
{
m_OpenAnimation.value = m_IsOpen;
}
GUI.backgroundColor = Color.white;
}
19
View Source File : MLSystemEditor.cs
License : MIT License
Project Creator : Interactml
License : MIT License
Project Creator : Interactml
protected void ShowTrainingIcon(string MLS)
{
m_IconCenter.x = m_BodyRect.x;
m_IconCenter.y = m_BodyRect.y;
m_IconCenter.width = m_BodyRect.width;
m_IconCenter.height = 150;
GUILayout.BeginArea(m_IconCenter);
GUILayout.Space(bodySpace);
GUILayout.BeginHorizontal();
GUILayout.Box("", m_NodeSkin.GetStyle(MLS + " MLS Image"));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(MLS, m_NodeSkin.GetStyle(MLS + " Label"));
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
19
View Source File : ONSPPropagationGeometryEditor.cs
License : MIT License
Project Creator : IanPhilips
License : MIT License
Project Creator : IanPhilips
void Separator()
{
GUI.color = new Color(1, 1, 1, 0.25f);
GUILayout.Box("", "HorizontalSlider", GUILayout.Height(16));
GUI.color = Color.white;
}
19
View Source File : GUIHelper.cs
License : MIT License
Project Creator : cabarius
License : MIT License
Project Creator : cabarius
public static void Div(Color color, float indent = 0, float height = 0, float width = 0) {
if (fillTexture == null)
fillTexture = new Texture2D(1, 1);
var divStyle = new GUIStyle {
fixedHeight = 1
};
fillTexture.SetPixel(0, 0, color);
fillTexture.Apply();
divStyle.normal.background = fillTexture;
divStyle.margin = new RectOffset((int)indent, 0, 4, 4);
if (width > 0)
divStyle.fixedWidth = width;
else
divStyle.fixedWidth = 0;
GUILayout.Space((1f * height) / 2f);
GUILayout.Box(GUIContent.none, divStyle);
GUILayout.Space(height / 2f);
}
19
View Source File : FaceUpdate.cs
License : MIT License
Project Creator : m969
License : MIT License
Project Creator : m969
void OnGUI ()
{
GUILayout.Box ("Face Update", GUILayout.Width (170), GUILayout.Height (25 * (animations.Length + 2)));
Rect screenRect = new Rect (10, 25, 150, 25 * (animations.Length + 1));
GUILayout.BeginArea (screenRect);
foreach (var animation in animations) {
if (GUILayout.RepeatButton (animation.name)) {
anim.CrossFade (animation.name, 0);
}
}
isKeepFace = GUILayout.Toggle (isKeepFace, " Keep Face");
GUILayout.EndArea ();
}
19
View Source File : Popup.cs
License : MIT License
Project Creator : Astropilot
License : MIT License
Project Creator : Astropilot
public static int SelectionPopup(int selectionIndex, string[] displayOptions)
{
var label = (selectionIndex < 0 || displayOptions.Length <= selectionIndex) ? "" : displayOptions[selectionIndex];
GUILayout.Box(label, InterfaceMaker.CustomSkin.textField);
return PopupOnLastRect(selectionIndex, displayOptions);
}
19
View Source File : SliderUI.cs
License : GNU General Public License v3.0
Project Creator : Mantas-2155X
License : GNU General Public License v3.0
Project Creator : Mantas-2155X
private static void DrawWindow(int id)
{
GUIStyle lineStyle = new GUIStyle("box");
lineStyle.border.top = lineStyle.border.bottom = 1;
lineStyle.margin.top = lineStyle.margin.bottom = 1;
lineStyle.padding.top = lineStyle.padding.bottom = 1;
GUIStyle gridStyle = new GUIStyle("Button");
gridStyle.onNormal.background = Texture2D.whiteTexture;
gridStyle.onNormal.textColor = Color.black;
gridStyle.onHover.background = Texture2D.whiteTexture;
gridStyle.onHover.textColor = Color.black;
gridStyle.onActive.background = Texture2D.whiteTexture;
gridStyle.onActive.textColor = Color.black;
string[] characterNames = new string[HS2_BetterHScenes.characters.Count];
string[] offsetNames = new string[] { "Whole Body", "Left Hand", "Right Hand", "Left Foot", "Right Foot" };
for (var charIndex = 0; charIndex < HS2_BetterHScenes.characters.Count; charIndex++)
{
characterNames[charIndex] = HS2_BetterHScenes.characters[charIndex].fileParam.fullname;
}
using (GUILayout.VerticalScope guiVerticalScope = new GUILayout.VerticalScope("box"))
{
selectedCharacter = GUILayout.SelectionGrid(selectedCharacter, characterNames, HS2_BetterHScenes.characters.Count, gridStyle, GUILayout.Height(30));
GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));
using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
{
selectedOffset = GUILayout.SelectionGrid(selectedOffset, offsetNames, offsetNames.Length, gridStyle, GUILayout.Height(30));
}
using (GUILayout.HorizontalScope linkScope = new GUILayout.HorizontalScope("box"))
{
if (selectedOffset == (int)BodyPart.WholeBody)
{
GUILayout.Label("Mouth Size: ", GUILayout.Width((2 * uiWidth / 15) - 10));
mouthOffsets[selectedCharacter] = GUILayout.HorizontalSlider(mouthOffsets[selectedCharacter], 0, 1, GUILayout.Width((4 * uiWidth / 15) - 10));
GUILayout.FlexibleSpace();
GUILayout.Label("Heel Offset: ", GUILayout.Width((2 * uiWidth / 15) - 10));
shoeOffsets[selectedCharacter] = Convert.ToSingle(GUILayout.TextField(shoeOffsets[selectedCharacter].ToString("0.000"), GUILayout.Width((2 * uiWidth / 15) - 10)));
}
else
{
if (GUILayout.Button("Mirror Limb"))
MirrorActiveLimb();
bool[] lastCorrection = new bool[(int)BodyPart.BodyPartsCount];
for (var part = (int)BodyPart.LeftHand; part < (int)BodyPart.BodyPartsCount; part++)
lastCorrection[part] = characterOffsets[selectedCharacter].jointCorrection[part];
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftHand] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftHand], " Correction");
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightHand] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightHand], " Correction");
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftFoot] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.LeftFoot], " Correction");
characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightFoot] =
GUILayout.Toggle(characterOffsets[selectedCharacter].jointCorrection[(int)BodyPart.RightFoot], " Correction");
bool correctionChanged = false;
for (var part = (int)BodyPart.LeftHand; part < (int)BodyPart.BodyPartsCount; part++)
{
if (lastCorrection[part] == characterOffsets[selectedCharacter].jointCorrection[part])
continue;
correctionChanged = true;
break;
}
if (correctionChanged)
characterOffsets[selectedCharacter].ApplyJointCorrections();
}
}
GUILayout.Box(GUIContent.none, lineStyle, GUILayout.ExpandWidth(true), GUILayout.Height(1f));
string LabelName = "Hint";
float sliderMaxHint = HS2_BetterHScenes.sliderMaxHintPosition.Value;
float sliderMaxRotation = HS2_BetterHScenes.sliderMaxLimbRotation.Value;
float sliderMaxPosition = HS2_BetterHScenes.sliderMaxLimbPosition.Value;
Vector3 lastPosition = Vector3.zero;
Vector3 lastRotation = Vector3.zero;
if (selectedOffset == (int)BodyPart.WholeBody)
{
LabelName = "Head Rotation";
sliderMaxHint = HS2_BetterHScenes.sliderMaxBodyRotation.Value;
sliderMaxRotation = HS2_BetterHScenes.sliderMaxBodyRotation.Value;
sliderMaxPosition = HS2_BetterHScenes.sliderMaxBodyPosition.Value;
lastPosition = new Vector3(
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z);
lastRotation = new Vector3(
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y,
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z);
}
using (GUILayout.HorizontalScope positionScope = new GUILayout.HorizontalScope("box"))
{
using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
{
GUILayout.Label("Position X");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.x, -sliderMaxPosition, sliderMaxPosition);
}
using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
{
GUILayout.Label("Position Y");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.y, -sliderMaxPosition, sliderMaxPosition);
}
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label("Position Z");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position.z, -sliderMaxPosition, sliderMaxPosition);
}
}
using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
{
using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
{
GUILayout.Label("Rotation X");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.x, -sliderMaxRotation, sliderMaxRotation);
}
using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
{
GUILayout.Label("Rotation Y");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.y, -sliderMaxRotation, sliderMaxRotation);
}
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label("Rotation Z");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation.z, -sliderMaxRotation, sliderMaxRotation);
}
}
using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
{
using (GUILayout.VerticalScope verticalScopeX = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeX = new GUILayout.HorizontalScope())
{
GUILayout.Label($"{LabelName} X");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.x, -sliderMaxHint, sliderMaxHint);
}
using (GUILayout.VerticalScope verticalScopeY = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeY = new GUILayout.HorizontalScope())
{
GUILayout.Label($"{LabelName} Y");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.y, -sliderMaxHint, sliderMaxHint);
}
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label($"{LabelName} Z");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].hint.z, -sliderMaxHint, sliderMaxHint);
}
}
if (selectedOffset != (int)BodyPart.WholeBody)
{
if (selectedOffset <= (int)BodyPart.RightHand)
sliderMaxRotation /= 4;
using (GUILayout.HorizontalScope rotationScope = new GUILayout.HorizontalScope("box"))
{
GUILayout.FlexibleSpace();
using (GUILayout.VerticalScope verticalScopeZ = new GUILayout.VerticalScope("box"))
{
using (GUILayout.HorizontalScope horizontalScopeZ = new GUILayout.HorizontalScope())
{
GUILayout.Label($"Digit Rotation");
if (GUILayout.Button("Reset", GUILayout.MaxWidth(uiWidth / 12)))
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation = 0;
}
characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation =
GUILayout.HorizontalSlider(characterOffsets[selectedCharacter].offsetVectors[selectedOffset].digitRotation, -sliderMaxRotation, sliderMaxRotation);
}
GUILayout.FlexibleSpace();
}
}
if (selectedOffset == (int)BodyPart.WholeBody &&
(lastPosition != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].position ||
lastRotation != characterOffsets[selectedCharacter].offsetVectors[selectedOffset].rotation))
ApplyPositionsAndCorrections();
using (GUILayout.HorizontalScope controlScope = new GUILayout.HorizontalScope("box"))
{
if (GUILayout.Button("Copy"))
CopyPositions();
if (GUILayout.Button("Paste"))
PastePositions();
if (GUILayout.Button("Reset All"))
ResetPositions();
if (GUILayout.Button("Reload"))
HSceneOffset.ApplyCharacterOffsets();
if (HS2_BetterHScenes.useOneOffsetForAllMotions.Value == false && GUILayout.Button("Save This"))
SavePosition(false);
if (GUILayout.Button(HS2_BetterHScenes.useUniqueOffsetForWeak.Value && HS2_BetterHScenes.currentMotion.StartsWith("D_") ? "Save Weak" : "Save Default"))
SavePosition(true);
if (GUILayout.Button("Delete All"))
HS2_BetterHScenes.activeConfirmDeleteUI = true;
}
}
GUI.DragWindow();
}
19
View Source File : CFXEasyEditor.cs
License : MIT License
Project Creator : Crazy-Marvin
License : MIT License
Project Creator : Crazy-Marvin
void OnGUI()
{
GUILayout.BeginArea(new Rect(0,0,this.position.width - 8,this.position.height));
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.Label("CARTOON FX Easy Editor", EditorStyles.boldLabel);
pref_ShowAsToolbox = GUILayout.Toggle(pref_ShowAsToolbox, new GUIContent("Toolbox", "If enabled, the window will be displayed as an external toolbox.\nIf false, it will act as a dockable Unity window."), GUILayout.Width(60));
if(GUI.changed)
{
EditorPrefs.SetBool("CFX_ShowAsToolbox", pref_ShowAsToolbox);
this.Close();
CFXEasyEditor.ShowWindow();
}
GUILayout.EndHorizontal();
GUILayout.Label("Easily change properties of any Particle System!", EditorStyles.miniLabel);
//----------------------------------------------------------------
pref_IncludeChildren = GUILayout.Toggle(pref_IncludeChildren, new GUIContent("Include Children", "If checked, changes will affect every Particle Systems from each child of the selected GameObject(s)"));
if(GUI.changed)
{
EditorPrefs.SetBool("CFX_IncludeChildren", pref_IncludeChildren);
}
EditorGUILayout.BeginHorizontal();
GUILayout.Label("Test effect(s):");
if(GUILayout.Button("Play", EditorStyles.miniButtonLeft, GUILayout.Width(50f)))
{
foreach(GameObject go in Selection.gameObjects)
{
ParticleSystem[] systems = go.GetComponents<ParticleSystem>();
if(systems.Length == 0) continue;
foreach(ParticleSystem system in systems)
system.Play(pref_IncludeChildren);
}
}
if(GUILayout.Button("Pause", EditorStyles.miniButtonMid, GUILayout.Width(50f)))
{
foreach(GameObject go in Selection.gameObjects)
{
ParticleSystem[] systems = go.GetComponents<ParticleSystem>();
if(systems.Length == 0) continue;
foreach(ParticleSystem system in systems)
system.Pause(pref_IncludeChildren);
}
}
if(GUILayout.Button("Stop", EditorStyles.miniButtonMid, GUILayout.Width(50f)))
{
foreach(GameObject go in Selection.gameObjects)
{
ParticleSystem[] systems = go.GetComponents<ParticleSystem>();
if(systems.Length == 0) continue;
foreach(ParticleSystem system in systems)
system.Stop(pref_IncludeChildren);
}
}
if(GUILayout.Button("Clear", EditorStyles.miniButtonRight, GUILayout.Width(50f)))
{
foreach(GameObject go in Selection.gameObjects)
{
ParticleSystem[] systems = go.GetComponents<ParticleSystem>();
if(systems.Length == 0) continue;
foreach(ParticleSystem system in systems)
{
system.Stop(pref_IncludeChildren);
system.Clear(pref_IncludeChildren);
}
}
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
//----------------------------------------------------------------
//Separator
GUILayout.Box("",GUILayout.Width(this.position.width - 12), GUILayout.Height(3));
EditorGUI.BeginChangeCheck();
basicFoldout = EditorGUILayout.Foldout(basicFoldout, "QUICK EDIT");
if(EditorGUI.EndChangeCheck())
{
foldoutChanged = true;
}
if(basicFoldout)
{
//----------------------------------------------------------------
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Scale Size", "Changes the size of the Particle System(s) and other values accordingly (speed, gravity, etc.)"), GUILayout.Width(120)))
{
applyScale();
}
GUILayout.Label("Multiplier:",GUILayout.Width(110));
ScalingValue = EditorGUILayout.FloatField(ScalingValue,GUILayout.Width(50));
if(ScalingValue <= 0) ScalingValue = 0.1f;
GUILayout.EndHorizontal();
//----------------------------------------------------------------
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Set Speed", "Changes the speed of the Particle System(s) (if you want quicker or longer effects, 100% = default speed)"), GUILayout.Width(120)))
{
applySpeed();
}
GUILayout.Label("Speed (%):",GUILayout.Width(110));
LTScalingValue = EditorGUILayout.FloatField(LTScalingValue,GUILayout.Width(50));
if(LTScalingValue < 0.1f) LTScalingValue = 0.1f;
else if(LTScalingValue > 9999) LTScalingValue = 9999;
GUILayout.EndHorizontal();
//----------------------------------------------------------------
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Set Duration", "Changes the duration of the Particle System(s)"), GUILayout.Width(120)))
{
applyDuration();
}
GUILayout.Label("Duration (sec):",GUILayout.Width(110));
DurationValue = EditorGUILayout.FloatField(DurationValue,GUILayout.Width(50));
if(DurationValue < 0.1f) DurationValue = 0.1f;
else if(DurationValue > 9999) DurationValue = 9999;
GUILayout.EndHorizontal();
//----------------------------------------------------------------
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Set Delay", "Changes the delay of the Particle System(s)"), GUILayout.Width(120)))
{
applyDelay();
}
GUILayout.Label("Delay :",GUILayout.Width(110));
DelayValue = EditorGUILayout.FloatField(DelayValue,GUILayout.Width(50));
if(DelayValue < 0.0f) DelayValue = 0.0f;
else if(DelayValue > 9999f) DelayValue = 9999f;
GUILayout.EndHorizontal();
//----------------------------------------------------------------
GUILayout.Space(2);
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Loop", "Loop the effect (might not work properly on some effects such as explosions)"), EditorStyles.miniButtonLeft))
{
loopEffect(true);
}
if(GUILayout.Button(new GUIContent("Unloop", "Remove looping from the effect"), EditorStyles.miniButtonRight))
{
loopEffect(false);
}
if(GUILayout.Button(new GUIContent("Prewarm On", "Prewarm the effect (if looped)"), EditorStyles.miniButtonLeft))
{
prewarmEffect(true);
}
if(GUILayout.Button(new GUIContent("Prewarm Off", "Don't prewarm the effect (if looped)"), EditorStyles.miniButtonRight))
{
prewarmEffect(false);
}
GUILayout.EndHorizontal();
GUILayout.Space(2);
//----------------------------------------------------------------
}
//Separator
GUILayout.Box("",GUILayout.Width(this.position.width - 12), GUILayout.Height(3));
EditorGUI.BeginChangeCheck();
colorFoldout = EditorGUILayout.Foldout(colorFoldout, "COLOR EDIT");
if(EditorGUI.EndChangeCheck())
{
foldoutChanged = true;
}
if(colorFoldout)
{
//----------------------------------------------------------------
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Set Start Color(s)", "Changes the color(s) of the Particle System(s)\nSecond Color is used when Start Color is 'Random Between Two Colors'."),GUILayout.Width(120)))
{
applyColor();
}
ColorValue = EditorGUILayout.ColorField(ColorValue);
ColorValue2 = EditorGUILayout.ColorField(ColorValue2);
AffectAlpha = GUILayout.Toggle(AffectAlpha, new GUIContent("Alpha", "If checked, the alpha value will also be changed"));
GUILayout.EndHorizontal();
//----------------------------------------------------------------
GUILayout.BeginHorizontal();
if(GUILayout.Button(new GUIContent("Tint Colors", "Tints the colors of the Particle System(s), including gradients!\n(preserving their saturation and lightness)"),GUILayout.Width(120)))
{
tintColor();
}
TintColorValue = EditorGUILayout.ColorField(TintColorValue);
TintColorValue = HSLColor.FromRGBA(TintColorValue).VividColor();
GUILayout.EndHorizontal();
//----------------------------------------------------------------
/*
GUILayout.BeginHorizontal();
GUILayout.Label("Add/Substract Lightness:");
LightnessStep = EditorGUILayout.IntField(LightnessStep, GUILayout.Width(30));
if(LightnessStep > 99) LightnessStep = 99;
else if(LightnessStep < 1) LightnessStep = 1;
GUILayout.Label("%");
if(GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.Width(22)))
{
addLightness(true);
}
if(GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.Width(22)))
{
addLightness(false);
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
*/
//----------------------------------------------------------------
GUILayout.Label("Color Modules to affect:");
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = TintStartColor ? ColorSelected : Color.white; if(GUILayout.Button(new GUIContent("Start Color", "If checked, the \"Start Color\" value(s) will be affected."), EditorStyles.toolbarButton, GUILayout.Width(70))) TintStartColor = !TintStartColor;
GUI.color = TintColorModule ? ColorSelected : Color.white; if(GUILayout.Button(new GUIContent("Color over Lifetime", "If checked, the \"Color over Lifetime\" value(s) will be affected."), EditorStyles.toolbarButton, GUILayout.Width(110))) TintColorModule = !TintColorModule;
GUI.color = TintColorSpeedModule ? ColorSelected : Color.white; if(GUILayout.Button(new GUIContent("Color by Speed", "If checked, the \"Color by Speed\" value(s) will be affected."), EditorStyles.toolbarButton, GUILayout.Width(100))) TintColorSpeedModule = !TintColorSpeedModule;
GUI.color = Color.white;
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(4);
//----------------------------------------------------------------
}
//Separator
GUILayout.Box("",GUILayout.Width(this.position.width - 12), GUILayout.Height(3));
// GUILayout.Space(6);
//----------------------------------------------------------------
EditorGUI.BeginChangeCheck();
copyFoldout = EditorGUILayout.Foldout(copyFoldout, "COPY MODULES");
if(EditorGUI.EndChangeCheck())
{
foldoutChanged = true;
}
if(copyFoldout)
{
GUILayout.Label("Copy properties from a Particle System to others!", EditorStyles.miniLabel);
GUILayout.BeginHorizontal();
GUILayout.Label("Source Object:", GUILayout.Width(110));
sourceObject = (ParticleSystem)EditorGUILayout.ObjectField(sourceObject, typeof(ParticleSystem), true);
GUILayout.EndHorizontal();
EditorGUILayout.LabelField("Modules to Copy:");
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if(GUILayout.Button("ALL", EditorStyles.miniButtonLeft, GUILayout.Width(120)))
{
for(int i = 0; i < b_modules.Length; i++) b_modules[i] = true;
}
if(GUILayout.Button("NONE", EditorStyles.miniButtonRight, GUILayout.Width(120)))
{
for(int i = 0; i < b_modules.Length; i++) b_modules[i] = false;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[0] ? ColorSelected : Color.white; if(GUILayout.Button("Initial", EditorStyles.toolbarButton, GUILayout.Width(70))) b_modules[0] = !b_modules[0];
GUI.color = b_modules[1] ? ColorSelected : Color.white; if(GUILayout.Button("Emission", EditorStyles.toolbarButton, GUILayout.Width(70))) b_modules[1] = !b_modules[1];
GUI.color = b_modules[2] ? ColorSelected : Color.white; if(GUILayout.Button("Shape", EditorStyles.toolbarButton, GUILayout.Width(70))) b_modules[2] = !b_modules[2];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[3] ? ColorSelected : Color.white; if(GUILayout.Button("Velocity", EditorStyles.toolbarButton, GUILayout.Width(70))) b_modules[3] = !b_modules[3];
GUI.color = b_modules[4] ? ColorSelected : Color.white; if(GUILayout.Button("Limit Velocity", EditorStyles.toolbarButton, GUILayout.Width(100))) b_modules[4] = !b_modules[4];
GUI.color = b_modules[5] ? ColorSelected : Color.white; if(GUILayout.Button("Force", EditorStyles.toolbarButton, GUILayout.Width(70))) b_modules[5] = !b_modules[5];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[6] ? ColorSelected : Color.white; if(GUILayout.Button("Color over Lifetime", EditorStyles.toolbarButton, GUILayout.Width(120))) b_modules[6] = !b_modules[6];
GUI.color = b_modules[7] ? ColorSelected : Color.white; if(GUILayout.Button("Color by Speed", EditorStyles.toolbarButton, GUILayout.Width(120))) b_modules[7] = !b_modules[7];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[8] ? ColorSelected : Color.white; if(GUILayout.Button("Size over Lifetime", EditorStyles.toolbarButton, GUILayout.Width(120))) b_modules[8] = !b_modules[8];
GUI.color = b_modules[9] ? ColorSelected : Color.white; if(GUILayout.Button("Size by Speed", EditorStyles.toolbarButton, GUILayout.Width(120))) b_modules[9] = !b_modules[9];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[10] ? ColorSelected : Color.white; if(GUILayout.Button("Rotation over Lifetime", EditorStyles.toolbarButton, GUILayout.Width(120))) b_modules[10] = !b_modules[10];
GUI.color = b_modules[11] ? ColorSelected : Color.white; if(GUILayout.Button("Rotation by Speed", EditorStyles.toolbarButton, GUILayout.Width(120))) b_modules[11] = !b_modules[11];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[12] ? ColorSelected : Color.white; if(GUILayout.Button("Collision", EditorStyles.toolbarButton, GUILayout.Width(100))) b_modules[12] = !b_modules[12];
GUI.color = b_modules[13] ? ColorSelected : Color.white; if(GUILayout.Button("Sub Emitters", EditorStyles.toolbarButton, GUILayout.Width(100))) b_modules[13] = !b_modules[13];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUI.color = b_modules[14] ? ColorSelected : Color.white; if(GUILayout.Button("Texture Animation", EditorStyles.toolbarButton, GUILayout.Width(110))) b_modules[14] = !b_modules[14];
GUI.color = b_modules[15] ? ColorSelected : Color.white; if(GUILayout.Button("Renderer", EditorStyles.toolbarButton, GUILayout.Width(90))) b_modules[15] = !b_modules[15];
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUI.color = Color.white;
GUILayout.Space(4);
if(GUILayout.Button("Copy properties to selected Object(s)"))
{
bool foundPs = false;
foreach(GameObject go in Selection.gameObjects)
{
ParticleSystem[] systems;
if(pref_IncludeChildren) systems = go.GetComponentsInChildren<ParticleSystem>(true);
else systems = go.GetComponents<ParticleSystem>();
if(systems.Length == 0) continue;
foundPs = true;
foreach(ParticleSystem system in systems) CopyModules(sourceObject, system);
}
if(!foundPs)
{
Debug.LogWarning("CartoonFX Easy Editor: No Particle System found in the selected GameObject(s)!");
}
}
}
//----------------------------------------------------------------
GUILayout.Space(8);
//Resize window
if(foldoutChanged && Event.current.type == EventType.Repaint)
{
foldoutChanged = false;
Rect r = GUILayoutUtility.GetLastRect();
this.minSize = new Vector2(300,r.y + 8);
this.maxSize = new Vector2(300,r.y + 8);
}
GUILayout.EndArea();
}
19
View Source File : AstarPathEditor.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
static void DrawColorSlider (ref float left, ref float right, bool editable) {
GUILayout.BeginHorizontal();
GUILayout.Space(20);
GUILayout.BeginVertical();
GUILayout.Box("", astarSkin.GetStyle("ColorInterpolationBox"));
GUILayout.BeginHorizontal();
if (editable) {
left = EditorGUILayout.IntField((int)left);
} else {
GUILayout.Label(left.ToString("0"));
}
GUILayout.FlexibleSpace();
if (editable) {
right = EditorGUILayout.IntField((int)right);
} else {
GUILayout.Label(right.ToString("0"));
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.Space(4);
GUILayout.EndHorizontal();
}
19
View Source File : GUILayout.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
public static void Box(string text, GUILayoutOption[] opts)
{
UGUI.Box(text, Style.Box, opts);
}
19
View Source File : EditorUtils GUILayout.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public void Box(GUIContent content, params GUILayoutOption[] options)
{
GUILayout.Box(content, options);
}
19
View Source File : RunTestsAlert.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
public override void OnGUI() {
if(Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint) {
Close();
return;
}
if(lastWindowWidth != Nexus.Self.position.width) {
positionWindow = true;
}
if(positionWindow) {
positionWindow = false;
lastWindowWidth = Nexus.Self.position.width;
PositionWindow();
}
GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor(Color.gray));
scrollBar = new GUIStyle();
scrollBar.margin = new RectOffset(25, 20, 0, 0);
toggleGroup = new GUIStyle();
toggleGroup.margin = new RectOffset(12, 0, 0, 0);
divider = new GUIStyle(GUI.skin.box);
divider.normal.background = Swat.MakeTextureFromColor(Swat.ActionButtonTextColor);
divider.margin = new RectOffset(25, 0, 10, 20);
requiredTestsStyle = new GUIStyle(GUI.skin.label);
requiredTestsStyle.normal.textColor = Swat.ActionButtonTextColor;
additionalTestsStyle = new GUIStyle(GUI.skin.label);
additionalTestsStyle.normal.textColor = Swat.ActionButtonTextColor;
testsToggle = new GUIStyle(GUI.skin.label);
testsToggle.normal.textColor = Swat.ActionButtonTextColor;
testsToggle.fixedWidth = 50;
testsToggle.fixedHeight = 25;
fo = new GUIStyle(EditorStyles.foldout);
fo.margin = new RectOffset(-10, 0, 5, 5);
fo.normal.textColor = fo.hover.textColor = fo.active.textColor = Swat.ActionButtonTextColor;
header = new GUIStyle(GUI.skin.label);
header.fontSize = 15;
header.normal.textColor = Color.white;
header.fontStyle = FontStyle.Bold;
header.alignment = TextAnchor.MiddleCenter;
buttons = new GUIStyle(GUI.skin.button);
buttons.fixedHeight = buttonHeight;
buttons.fixedWidth = buttonWidth;
buttons.normal.textColor = Swat.ActionButtonTextColor;
buttons.normal.background = Swat.MakeTextureFromColor((Color)new Color32(80, 80, 80, 255));
EditorGUILayout.BeginVertical();
GUILayout.Space(15);
EditorGUILayout.LabelField("Please Confirm", header);
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
scrollY = EditorGUILayout.BeginScrollView(scrollY, scrollBar);
string testListFoldout = string.Empty;
for(int x = 0; x < requestedTests.Count; x++) {
if(!requestedTestNames.Contains(requestedTests[x].Value.Name)) {
requestedTestNames.Add(requestedTests[x].Value.Name);
}
}
if(!isSubsetRun) {
string plurals = requestedTestNames.Count > 1 ? "these tests" : "this test";
Nexus.Self.Foldout(true, string.Format(" You requested {0}", plurals), true, fo);
for(int x = 0; x < requestedTestNames.Count; x++) {
EditorGUILayout.LabelField(string.Format(" {0}", requestedTestNames[x]), requiredTestsStyle);
GUILayout.Space(2);
}
plurals = additionalTests.Count > 1 ? "these tests" : "this test";
testListFoldout = string.Format(" Which {0} dependent on {1}", additionalTests.Count > 1 ? "are" : "is", plurals);
} else {
testListFoldout = " Select subset of tests to run";
additionalTests = requestedTests;
}
requiredTestsStyle.padding = new RectOffset(0, 0, 0, 0);
Nexus.Self.Foldout(true, testListFoldout, true, fo);
for(int x = 0; x < additionalTests.Count; x++) {
EditorGUILayout.BeginHorizontal(toggleGroup);
if(!additionalTestNames.Contains(additionalTests[x].Value.Name)) {
additionalTestNames.Add(additionalTests[x].Value.Name);
additionalTestsToggleList.Add(AutomationMaster.EntireUnitySessionCompletedTests.Contains(additionalTests[x].Value.Name) ? false : isTestSubset ? false : true);
}
testsToggle.padding = additionalTestsToggleList[x] ? new RectOffset(0, 0, -6, 0) : new RectOffset(2, 0, -2, 0);
testsToggle.fontSize = additionalTestsToggleList[x] ? 25 : 18;
if(GUILayout.Button(additionalTestsToggleList[x] ? Swat.TOGGLE_ON : Swat.TOGGLE_OFF, testsToggle, new GUILayoutOption[] { GUILayout.Width(40) })) {
additionalTestsToggleList[x] = !additionalTestsToggleList[x];
}
GUILayout.Space(-30);
if(GUILayout.Button(string.Format(" {0}", additionalTests[x].Value.Name), additionalTestsStyle)) {
additionalTestsToggleList[x] = !additionalTestsToggleList[x]; //Toggle accompanying checkbox.
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(-10);
}
EditorGUILayout.EndScrollView();
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
AutomationMaster.DisregardDependencies = false; //Reset.
float margin = (position.width - (buttonWidth * 3)) / 2;
GUIStyle buttonGroup = new GUIStyle();
buttonGroup.margin = new RectOffset((int)margin,(int)margin, 0, 10);
EditorGUILayout.BeginHorizontal(buttonGroup);
if(GUILayout.Button("Accept", buttons)) {
Nexus.Overseer.ignoreDependentTestsForRun = false;
List<string> listToRun = new List<string>();
for(int x = 0; x < additionalTestNames.Count; x++) {
if(additionalTestsToggleList[x]) {
listToRun.Add(additionalTestNames[x]);
}
}
string newTestList = "*";
if(isSubsetRun) {
newTestList += string.Join(",", listToRun.ToArray());
} else {
newTestList += string.Format("{0},{1}", string.Join(",", requestedTestNames.ToArray()), string.Join(",", listToRun.ToArray()));
}
Nexus.Overseer.Master_Editor_Override = new KeyValuePair<string, string>(newTestList, testType);
bool ready = true;
if(isSubsetRun) {
//If this is a subset run, we will not have calculated dependencies beforehand. Do that now, and open a new alert. Doing so will discard this pop automatically, as all we need is the test data from it.
List<KeyValuePair<string, MethodInfo>> selected = requestedTests.FindAll(x => listToRun.Contains(x.Value.Name));
List<KeyValuePair<string, MethodInfo>> methodsToRunAfterMappingDependencies = Nexus.AutoMaster.GatherAllTestsThatNeedToBeRunToSatisfyAllDependenciesForPartialTestRun(selected);
List<KeyValuePair<string, MethodInfo>> dependencies = methodsToRunAfterMappingDependencies.GetUniqueObjectsBetween(selected);
if(dependencies.Count > 0) {
RunTestsAlert.Pop(selected, dependencies, testName, testType, true);
ready = false;
}
}
if(ready) {
Nexus.Self.Tests.LaunchTests(newTestList, testType);
IsVisible = false;
AutomationMaster.DisregardDependencies = true; //Ignore dependencies.
Close();
}
}
if(!isSubsetRun) {
if(GUILayout.Button("Disregard", buttons)) {
string newTestList = string.Empty;
if(requestedTestNames.Count > 1) {
newTestList = string.Join(",", requestedTestNames.ToArray());
Nexus.Overseer.Master_Editor_Override = new KeyValuePair<string, string>(newTestList, testType);
AutomationMaster.DisregardDependencies = true; //Ignore dependencies.
}
AutomationMaster.DisregardDependencies = Nexus.Overseer.ignoreDependentTestsForRun = true;
Nexus.Self.Tests.LaunchTests(string.IsNullOrEmpty(newTestList) ? testName : newTestList, string.IsNullOrEmpty(newTestList) ? testType : "test");
IsVisible = false;
Close();
}
}
if(GUILayout.Button("Cancel", buttons)) {
Nexus.Overseer.Master_Editor_Override = new KeyValuePair<string, string>();
IsVisible = false;
Close();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
19
View Source File : BaseMaterialOption.cs
License : MIT License
Project Creator : oparaskos
License : MIT License
Project Creator : oparaskos
public Rect OnGUI()
{
EditorGUI.BeginChangeCheck();
var rect = EditorGUILayout.BeginVertical("Box");
EditorGUILayout.PrefixLabel(new GUIContent(name));
if (previewImage != null)
{
GUILayout.Box(previewImage.ToTexture2D(), GUILayout.Width(previewImageSize), GUILayout.Height(previewImageSize));
GUI.DrawTexture(new Rect(rect.x, rect.y, (rect.width * 2) - orgImgSize, orgImgSize), orgImage.ToTexture2D(), ScaleMode.ScaleToFit);
}
else
{
GUILayout.Box(orgImage.ToTexture2D(), GUILayout.Width(previewImageSize), GUILayout.Height(previewImageSize));
}
selectedVariant = EditorGUILayout.Popup(selectedVariant, variants);
if (GUILayout.Button(new GUIContent("Import")))
{
DoImport();
}
EditorGUILayout.EndVertical();
EditorGUI.EndChangeCheck();
return rect;
}
19
View Source File : Popup.cs
License : MIT License
Project Creator : Astropilot
License : MIT License
Project Creator : Astropilot
public static int SearchableSelectionPopup(int selectionIndex, string[] displayOptions, ref string searchTerms)
{
var label = (selectionIndex < 0 || displayOptions.Length <= selectionIndex) ? "" : displayOptions[selectionIndex];
GUILayout.Box(label, InterfaceMaker.CustomSkin.textField);
return SearchablePopupOnLastRect(selectionIndex, displayOptions, ref searchTerms);
}
19
View Source File : MenuBase.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
private void AddStatus()
{
GUILayout.Space(5);
GUILayout.Box("Status: " + this.Status, this.TextStyle, GUILayout.MinWidth(ConsoleBase.MainWindowWidth));
}
19
View Source File : RunClassesAlert.cs
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
License : GNU Lesser General Public License v3.0
Project Creator : disruptorbeam
public override void OnGUI() {
if(Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint) {
Close();
return;
}
if(lastWindowWidth != Nexus.Self.position.width) {
positionWindow = true;
}
if(positionWindow) {
positionWindow = false;
lastWindowWidth = Nexus.Self.position.width;
PositionWindow();
}
GUI.DrawTexture(new Rect(0, 0, position.width, position.height), Swat.MakeTextureFromColor(Color.gray));
scrollBar = new GUIStyle();
scrollBar.margin = new RectOffset(25, 20, 0, 0);
divider = new GUIStyle(GUI.skin.box);
divider.normal.background = Swat.MakeTextureFromColor(Color.white);
divider.margin = new RectOffset(25, 0, 10, 20);
toggleGroup = new GUIStyle();
toggleGroup.margin = new RectOffset(12, 0, 0, 0);
toggle = new GUIStyle(GUI.skin.label);
toggle.padding = new RectOffset(35, 0, 0, 0);
toggle.normal.textColor = Color.white;
toggle.fixedWidth = 25;
toggle.fixedHeight = 25;
toggleLabel = new GUIStyle(GUI.skin.label);
toggleLabel.normal.textColor = Color.white;
header = new GUIStyle(GUI.skin.label);
header.fontSize = 15;
header.fixedHeight = 20;
header.normal.textColor = Color.white;
header.fontStyle = FontStyle.Bold;
header.alignment = TextAnchor.MiddleCenter;
buttons = new GUIStyle(GUI.skin.button);
buttons.fixedHeight = buttonHeight;
buttons.fixedWidth = buttonWidth;
buttons.normal.textColor = Color.white;
buttons.normal.background = Swat.MakeTextureFromColor((Color)new Color32(80, 80, 80, 255));
buttonGroup = new GUIStyle();
EditorGUILayout.BeginVertical();
GUILayout.Space(15);
EditorGUILayout.LabelField("Select Categories", header);
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
scrollY = EditorGUILayout.BeginScrollView(scrollY, scrollBar);
for(int x = 0; x < Cats.Count; x++) {
EditorGUILayout.BeginHorizontal(toggleGroup);
toggle.padding = CatsSelected[x] ? new RectOffset(0, 0, -6, 0) : new RectOffset(2, 0, -2, 0);
toggle.fontSize = CatsSelected[x] ? 25 : 18;
if(GUILayout.Button(CatsSelected[x] ? Swat.TOGGLE_ON : Swat.TOGGLE_OFF, toggle)) {
CatsSelected[x] = !CatsSelected[x];
}
GUILayout.Space(-15);
if(GUILayout.Button(string.Format(" {0}", Cats[x]), toggleLabel)) {
CatsSelected[x] = !CatsSelected[x]; //Toggle accompanying checkbox.
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(-10);
}
EditorGUILayout.EndScrollView();
GUILayout.Box(string.Empty, divider, new GUILayoutOption[] { GUILayout.Height(1), GUILayout.Width(position.width - 50) });
GUILayout.Space(15);
EditorGUILayout.BeginHorizontal();
GUILayout.Space(50);
toggle.padding = AutomationMaster.DisregardDependencies ? new RectOffset(0, 0, -6, 0) : new RectOffset(2, 0, -2, 0);
toggle.fontSize = AutomationMaster.DisregardDependencies ? 25 : 18;
if(GUILayout.Button(AutomationMaster.DisregardDependencies ? Swat.TOGGLE_ON : Swat.TOGGLE_OFF, toggle)) {
AutomationMaster.DisregardDependencies = !AutomationMaster.DisregardDependencies;
}
GUILayout.Space(-10);
if(GUILayout.Button("Also Run Dependencies? ", toggleLabel)) {
AutomationMaster.DisregardDependencies = !AutomationMaster.DisregardDependencies; //Toggle accompanying checkbox.
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(15);
float margin = (position.width - (buttonWidth * 2)) / 2;
buttonGroup.margin = new RectOffset((int)margin,(int)margin, 0, 10);
EditorGUILayout.BeginHorizontal(buttonGroup);
if(GUILayout.Button("Cancel", buttons)) {
Nexus.Overseer.Master_Editor_Override = new KeyValuePair<string, string>();
IsVisible = false;
Close();
}
if(GUILayout.Button("Launch", buttons)) {
Nexus.Overseer.ignoreDependentTestsForRun = true;
string command = string.Empty;
string testsOnly = string.Empty;
for(int x = 0; x < Cats.Count; x++) {
if(CatsSelected[x]) {
if(Cats[x].StartsWith("*")) {
string cat = Cats[x].Replace("*", string.Empty);
List<KeyValuePair<string,List<KeyValuePair<bool,string>>>> match = Nexus.Self.Favorites.FavoritesList.FindAll(f => f.Key == cat);
if(match.Count == 0) {
SimpleAlert.Pop(string.Format("Cannot find data for Favorite, \"{0}\", selected in multi-category launch.", cat), null);
return;
} else {
List<KeyValuePair<bool,string>> contents = match.First().Value;
for(int c = 0; c < contents.Count; c++) {
if(contents[c].Key) {
//If the next item in this list is not a category, then the current category is merely a header for the test list that follows, and should not be included.
if(c + 1 < contents.Count && !contents[c + 1].Key) {
continue;
}
command += string.Format("{0},", contents[c].Value);
} else {
testsOnly += string.Format("{0},", contents[c].Value);
}
}
}
} else {
string category = string.Empty;
if(Cats[x].Contains("(")) {
category = Cats[x].Replace("<", string.Empty).Replace(">", string.Empty).Split('(')[1].Trim(')');
} else {
category = Cats[x].Replace("<", string.Empty).Replace(">", string.Empty);
}
command += string.Format("{0},", category);
}
}
}
command = command.Trim(',').Replace("*", "@"); //@ represents favorite when * represents single test.
if(testsOnly.Length > 0) {
command = string.Format("&&{0}%{1}", command, testsOnly);
}
Close();
Nexus.Self.Tests.LaunchTests(command, "clreplaced");
IsVisible = false;
AutomationMaster.DisregardDependencies = true; //Ignore dependencies.
}
EditorGUILayout.EndHorizontal();
}
19
View Source File : FaceMaskDataEditor.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
public override void OnInspectorGUI()
{
serializedObject.Update();
Texture2D tex = image.objectReferenceValue as Texture2D;
// Draw image.
if (tex != null)
{
GUILayout.Box(GUIContent.none, GUILayout.Width(tex.width), GUILayout.Height(tex.height));
Rect imageRect = GUILayoutUtility.GetLastRect ();
GUI.DrawTexture (imageRect, tex);
if (!isDynamicMode.boolValue) {
// Draw face rect.
DrawFaceRect (imageRect, faceRect.rectValue, Color.red);
// Draw landmark points.
DrawFaceLandmark (imageRect, landmarkPoints, Color.green, Color.blue);
// Update mouse cursor.
for (int i = 0; i < landmarkPoints.arraySize; i++) {
Vector2 pt = landmarkPoints.GetArrayElementAtIndex (i).vector2Value;
pt.x += imageRect.x;
pt.y += imageRect.y;
Rect r = new Rect (pt.x - 4, pt.y - 4, 8, 8);
EditorGUIUtility.AddCursorRect (r, MouseCursor.MoveArrow);
}
// Mouse event.
if (Event.current.type == EventType.MouseDown) {
Rect mousePosRect = new Rect (Event.current.mousePosition.x - 4, Event.current.mousePosition.y - 4, 8, 8);
int id = GetPointID (imageRect, landmarkPoints, mousePosRect);
if (id >= 0) {
isDrag = true;
currentPointID = id;
}
Repaint ();
}
if (Event.current.type == EventType.MouseDrag) {
if (isDrag && currentPointID >= 0) {
Vector2 newPt = new Vector2 (Event.current.mousePosition.x - imageRect.x, Event.current.mousePosition.y - imageRect.y);
newPt.x = Mathf.Clamp (newPt.x, 0, tex.width);
newPt.y = Mathf.Clamp (newPt.y, 0, tex.height);
landmarkPoints.GetArrayElementAtIndex (currentPointID).vector2Value = newPt;
if (!imageRect.Contains (Event.current.mousePosition)) {
isDrag = false;
currentPointID = -1;
}
}
Repaint ();
}
if (Event.current.type == EventType.MouseUp) {
if (isDrag && currentPointID >= 0) {
Vector2 newPt = new Vector2 (Event.current.mousePosition.x - imageRect.x, Event.current.mousePosition.y - imageRect.y);
newPt.x = Mathf.Clamp (newPt.x, 0, tex.width);
newPt.y = Mathf.Clamp (newPt.y, 0, tex.height);
landmarkPoints.GetArrayElementAtIndex (currentPointID).vector2Value = newPt;
}
isDrag = false;
currentPointID = -1;
Repaint ();
}
if (currentPointID > -1 && currentPointID < landmarkPoints.arraySize) {
Vector2 pt = landmarkPoints.GetArrayElementAtIndex (currentPointID).vector2Value;
pt.x += imageRect.x;
pt.y += imageRect.y;
Handles.color = Color.yellow;
Handles.DrawSolidDisc (pt, Vector3.forward, 3f);
}
}
}
// Display input field.
EditorGUILayout.PropertyField(image);
EditorGUILayout.PropertyField(isDynamicMode);
EditorGUILayout.PropertyField(enableColorCorrection);
EditorGUILayout.PropertyField(faceRect);
EditorGUILayout.PropertyField(landmarkPoints, true);
serializedObject.ApplyModifiedProperties();
}
19
View Source File : CheckResources.cs
License : Apache License 2.0
Project Creator : 365082218
License : Apache License 2.0
Project Creator : 365082218
void ListMaterials ()
{
materialListScrollPos = EditorGUILayout.BeginScrollView (materialListScrollPos);
foreach (MaterialDetails tDetails in ActiveMaterials) {
if (tDetails.material != null) {
GUILayout.BeginHorizontal ();
if (tDetails.material.mainTexture != null)
GUILayout.Box (tDetails.material.mainTexture, GUILayout.Width (ThumbnailWidth), GUILayout.Height (ThumbnailHeight));
else {
GUILayout.Box ("n/a", GUILayout.Width (ThumbnailWidth), GUILayout.Height (ThumbnailHeight));
}
if (GUILayout.Button (tDetails.material.name, GUILayout.Width (150))) {
SelectObject (tDetails.material, ctrlPressed);
}
string shaderLabel = tDetails.material.shader != null ? tDetails.material.shader.name : "no shader";
GUILayout.Label (shaderLabel, GUILayout.Width (200));
if (GUILayout.Button (tDetails.FoundInRenderers.Count + " GO", GUILayout.Width (50))) {
List<Object> FoundObjects = new List<Object> ();
foreach (Renderer renderer in tDetails.FoundInRenderers)
FoundObjects.Add (renderer.gameObject);
SelectObjects (FoundObjects, ctrlPressed);
}
GUILayout.EndHorizontal ();
}
}
EditorGUILayout.EndScrollView ();
}
19
View Source File : MoreGUILayout.cs
License : MIT License
Project Creator : PizzaLovers007
License : MIT License
Project Creator : PizzaLovers007
public static void HorizontalLine(float thickness, float length = 0f) {
GUILayout.Box(GUIContent.none, new GUIStyle() {
margin = new RectOffset(8, 8, 4, 4),
padding = new RectOffset(),
fixedHeight = thickness,
fixedWidth = length,
normal = {
background = Texture2D.whiteTexture,
},
});
}
19
View Source File : LevelEditorResourceViewEditor.cs
License : MIT License
Project Creator : Hertzole
License : MIT License
Project Creator : Hertzole
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(resources);
EditorGUILayout.PropertyField(folderTree);
EditorGUILayout.PropertyField(showRoot);
EditorGUILayout.PropertyField(rootName);
EditorGUILayout.PropertyField(replacedetsContent);
EditorGUILayout.PropertyField(replacedetButtonPrefab);
EditorGUILayout.PropertyField(displayFirstSpriteAsIcon);
EditorGUILayout.PropertyField(iconHandling);
EditorGUILayout.PropertyField(generateAsync);
EditorGUILayout.PropertyField(asyncWaitMethod);
EditorGUILayout.Space();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(isOrthographic);
EditorGUILayout.PropertyField(backgroundColor);
padding.floatValue = EditorGUILayout.Slider(padding.displayName, padding.floatValue, -0.25f, 0.25f);
EditorGUILayout.PropertyField(previewDirection);
EditorGUILayout.PropertyField(imageSize);
if (EditorGUI.EndChangeCheck())
{
generatePreview = true;
}
EditorGUIHelper.DrawFancyFoldout(isOrthographic, "Preview", false, () =>
{
if (generatePreview)
{
if (previewTexture != null)
{
DestroyImmediate(previewTexture);
}
RuntimePreviewGenerator.OrthographicMode = isOrthographic.boolValue;
RuntimePreviewGenerator.Padding = padding.floatValue;
RuntimePreviewGenerator.BackgroundColor = backgroundColor.colorValue;
RuntimePreviewGenerator.PreviewDirection = previewDirection.vector3Value;
GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
previewTexture = RuntimePreviewGenerator.GenerateModelPreview(go.transform, imageSize.vector2IntValue.x, imageSize.vector2IntValue.y, true);
DestroyImmediate(go);
generatePreview = false;
}
Color oColor = GUI.backgroundColor;
GUI.backgroundColor = Color.clear;
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Box(previewTexture, GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth));
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUI.backgroundColor = oColor;
});
serializedObject.ApplyModifiedProperties();
}
19
View Source File : NameMgrWindow.cs
License : MIT License
Project Creator : BlueMonk1107
License : MIT License
Project Creator : BlueMonk1107
private void OnGUI()
{
GUILayout.Label("资源名称管理器");
NameMgrWindowData.UpdateData();
foreach (var pair in NameMgrWindowData.SpriteDic)
{
GUILayout.BeginHorizontal();
GUILayout.Label("路径:", GUILayout.MaxWidth(50));
GUILayout.Label(pair.Key.FolderPath, GUILayout.MaxWidth(150));
GUILayout.Label("范例:", GUILayout.MaxWidth(50));
GUILayout.Label(pair.Key.NameTip, GUILayout.MaxWidth(150));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
foreach (var path in pair.Value)
{
GUILayout.BeginVertical();
var texture2D = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(path);
GUILayout.Box(texture2D, GUILayout.Height(80), GUILayout.Width(80));
var name = Path.GetFileNameWithoutExtension(path);
if (!_namesDic.ContainsKey(name)) _namesDic[name] = name;
GUILayout.BeginHorizontal();
_namesDic[name] = GUILayout.TextArea(_namesDic[name], GUILayout.Width(40));
if (GUILayout.Button("确认", GUILayout.Width(30)))
{
if (name != _namesDic[name])
{
ChangeFileName(name, _namesDic[name], path);
_namesDic.Remove(name);
}
replacedetDatabase.Refresh();
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
}
}
19
View Source File : CheckResources.cs
License : Apache License 2.0
Project Creator : 365082218
License : Apache License 2.0
Project Creator : 365082218
void ListTextures ()
{
textureListScrollPos = EditorGUILayout.BeginScrollView (textureListScrollPos);
foreach (TextureDetails tDetails in ActiveTextures) {
GUILayout.BeginHorizontal ();
GUILayout.Box (tDetails.texture, GUILayout.Width (ThumbnailWidth), GUILayout.Height (ThumbnailHeight));
if (GUILayout.Button (tDetails.texture.name, GUILayout.Width (150))) {
SelectObject (tDetails.texture, ctrlPressed);
}
string sizeLabel = "" + tDetails.texture.width + "x" + tDetails.texture.height;
if (tDetails.isCubeMap)
sizeLabel += "x6";
sizeLabel += " - " + tDetails.mipMapCount + "mip";
sizeLabel += "\n" + FormatSizeString (tDetails.memSizeKB) + " - " + tDetails.format + "";
GUILayout.Label (sizeLabel, GUILayout.Width (120));
if (GUILayout.Button (tDetails.FoundInMaterials.Count + " Mat", GUILayout.Width (50))) {
SelectObjects (tDetails.FoundInMaterials, ctrlPressed);
}
if (GUILayout.Button (tDetails.FoundInRenderers.Count + " GO", GUILayout.Width (50))) {
List<Object> FoundObjects = new List<Object> ();
foreach (Renderer renderer in tDetails.FoundInRenderers)
FoundObjects.Add (renderer.gameObject);
SelectObjects (FoundObjects, ctrlPressed);
}
GUILayout.EndHorizontal ();
}
if (ActiveTextures.Count > 0) {
GUILayout.BeginHorizontal ();
GUILayout.Box (" ", GUILayout.Width (ThumbnailWidth), GUILayout.Height (ThumbnailHeight));
if (GUILayout.Button ("Select All", GUILayout.Width (150))) {
List<Object> AllTextures = new List<Object> ();
foreach (TextureDetails tDetails in ActiveTextures)
AllTextures.Add (tDetails.texture);
SelectObjects (AllTextures, ctrlPressed);
}
EditorGUILayout.EndHorizontal ();
}
EditorGUILayout.EndScrollView ();
}
19
View Source File : GUILayout.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
public static void Box(string text)
{
UGUI.Box(text, Style.Box);
}
19
View Source File : Popup.cs
License : MIT License
Project Creator : Astropilot
License : MIT License
Project Creator : Astropilot
public static string SelectionPopup(string current, string[] displayOptions)
{
var idx = Array.IndexOf(displayOptions, current);
GUILayout.Box(current, InterfaceMaker.CustomSkin.textField);
var newIdx = PopupOnLastRect(idx, displayOptions);
if ( newIdx != idx)
{
current = displayOptions[newIdx];
}
return current;
}
19
View Source File : ScriptableForgeEditor.cs
License : MIT License
Project Creator : ByronMayne
License : MIT License
Project Creator : ByronMayne
protected override void OnHeaderGUI()
{
if (m_Styles == null)
{
m_Styles = new ScriptForgeStyles();
}
GUILayout.Space(10);
GUILayout.BeginHorizontal((GUIStyle)"ShurikenEffectBg");
{
GUILayout.Box(GUIContent.none, m_Styles.scriptForgeIconSmall);
GUILayout.Label(ScriptForgeLabels.HEADER_replacedLE, m_Styles.replacedle);
GUILayout.Label(ScriptForgeLabels.HEADER_SUB_replacedLE, m_Styles.subreplacedle);
GUILayout.FlexibleSpace();
}
GUILayout.EndHorizontal();
GUILayout.Box(FontAwesomeIcons.INFO, GUIStyle.none);
}
19
View Source File : About.cs
License : MIT License
Project Creator : IllusionMods
License : MIT License
Project Creator : IllusionMods
public void OnGUI()
{
m_scrollPosition = GUILayout.BeginScrollView(m_scrollPosition);
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Box(m_aboutImage, GUIStyle.none);
if (Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
Application.OpenURL("http://www.amplify.pt");
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUIStyle labelStyle = new GUIStyle(EditorStyles.label);
labelStyle.alignment = TextAnchor.MiddleCenter;
labelStyle.wordWrap = true;
GUILayout.Label("\nAmplify Color " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth(true));
GUILayout.Label("\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth(true));
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
See More Examples