summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-04-19 17:19:32 -0400
commitc55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch)
treeee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs
downloadProject-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2
Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs')
-rw-r--r--Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs b/Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs
new file mode 100644
index 0000000..ac3754d
--- /dev/null
+++ b/Library/PackageCache/com.unity.collab-proxy@1.2.16/Editor/Collab/Views/BuildStatusButton.cs
@@ -0,0 +1,53 @@
+using System;
+using UnityEditor;
+using UnityEditor.Collaboration;
+using UnityEngine;
+
+#if UNITY_2019_1_OR_NEWER
+using UnityEngine.UIElements;
+#else
+using UnityEngine.Experimental.UIElements;
+#endif
+
+namespace UnityEditor.Collaboration
+{
+ internal class BuildStatusButton : Button
+ {
+ private readonly string iconPrefix = "Icons/Collab.Build";
+ private readonly string iconSuffix = ".png";
+ Label labelElement = new Label();
+ Image iconElement = new Image() {name = "BuildIcon"};
+
+ public BuildStatusButton(Action clickEvent) : base(clickEvent)
+ {
+ iconElement.image = EditorGUIUtility.Load(iconPrefix + iconSuffix) as Texture;
+ labelElement.text = "Build Now";
+ Add(iconElement);
+ Add(labelElement);
+ }
+
+ public BuildStatusButton(Action clickEvent, BuildState state, int failures) : base(clickEvent)
+ {
+ switch (state)
+ {
+ case BuildState.InProgress:
+ iconElement.image = EditorGUIUtility.Load(iconPrefix + iconSuffix) as Texture;
+ labelElement.text = "In progress";
+ break;
+
+ case BuildState.Failed:
+ iconElement.image = EditorGUIUtility.Load(iconPrefix + "Failed" + iconSuffix) as Texture;
+ labelElement.text = failures + ((failures == 1) ? " failure" : " failures");
+ break;
+
+ case BuildState.Success:
+ iconElement.image = EditorGUIUtility.Load(iconPrefix + "Succeeded" + iconSuffix) as Texture;
+ labelElement.text = "success";
+ break;
+ }
+
+ Add(iconElement);
+ Add(labelElement);
+ }
+ }
+}