mirror of
https://github.com/imperialsushi/gutterball-3.git
synced 2025-06-15 05:07:42 +00:00
New Version 1.42
Moving cam replay. Fixed the bugs. New Version 1.42 Moving cam replay. Fixed the bugs. New Version 1.42 Moving cam replay, Fixed the bugs.
This commit is contained in:
parent
dcb7df5fd1
commit
1c033119df
7079 changed files with 186851 additions and 48991 deletions
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using UnityEngine.Experimental.UIElements;
|
||||
|
||||
namespace UnityEditor.PackageManager.UI
|
||||
{
|
||||
#if !UNITY_2018_3_OR_NEWER
|
||||
internal class AlertFactory : UxmlFactory<Alert>
|
||||
{
|
||||
protected override Alert DoCreate(IUxmlAttributes bag, CreationContext cc)
|
||||
{
|
||||
return new Alert();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal class Alert : VisualElement
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
internal new class UxmlFactory : UxmlFactory<Alert> { }
|
||||
#endif
|
||||
|
||||
private const string TemplatePath = PackageManagerWindow.ResourcesPath + "Templates/Alert.uxml";
|
||||
private readonly VisualElement root;
|
||||
private const float originalPositionRight = 5.0f;
|
||||
private const float positionRightWithScroll = 12.0f;
|
||||
|
||||
public Action OnCloseError;
|
||||
|
||||
public Alert()
|
||||
{
|
||||
UIUtils.SetElementDisplay(this, false);
|
||||
|
||||
root = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(TemplatePath).CloneTree(null);
|
||||
Add(root);
|
||||
root.StretchToParentSize();
|
||||
|
||||
CloseButton.clickable.clicked += () =>
|
||||
{
|
||||
if (null != OnCloseError)
|
||||
OnCloseError();
|
||||
ClearError();
|
||||
};
|
||||
}
|
||||
|
||||
public void SetError(Error error)
|
||||
{
|
||||
var message = "An error occured.";
|
||||
if (error != null)
|
||||
message = error.message ?? string.Format("An error occurred ({0})", error.errorCode.ToString());
|
||||
|
||||
AlertMessage.text = message;
|
||||
UIUtils.SetElementDisplay(this, true);
|
||||
}
|
||||
|
||||
public void ClearError()
|
||||
{
|
||||
UIUtils.SetElementDisplay(this, false);
|
||||
AdjustSize(false);
|
||||
AlertMessage.text = "";
|
||||
OnCloseError = null;
|
||||
}
|
||||
|
||||
public void AdjustSize(bool verticalScrollerVisible)
|
||||
{
|
||||
if (verticalScrollerVisible)
|
||||
style.positionRight = originalPositionRight + positionRightWithScroll;
|
||||
else
|
||||
style.positionRight = originalPositionRight;
|
||||
}
|
||||
|
||||
private Label AlertMessage { get { return root.Q<Label>("alertMessage"); } }
|
||||
private Button CloseButton { get { return root.Q<Button>("close"); } }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b274f3d1ea05d4bd8a13f4556f7797d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,87 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Experimental.UIElements;
|
||||
|
||||
namespace UnityEditor.PackageManager.UI
|
||||
{
|
||||
#if !UNITY_2018_3_OR_NEWER
|
||||
internal class LoadingSpinnerFactory : UxmlFactory<LoadingSpinner>
|
||||
{
|
||||
protected override LoadingSpinner DoCreate(IUxmlAttributes bag, CreationContext cc)
|
||||
{
|
||||
return new LoadingSpinner();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal class LoadingSpinner : VisualElement
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
internal new class UxmlFactory : UxmlFactory<LoadingSpinner, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
// This works around an issue with UXML instantiation
|
||||
// See https://fogbugz.unity3d.com/f/cases/1046459/
|
||||
internal new class UxmlTraits : VisualElement.UxmlTraits
|
||||
{
|
||||
public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
|
||||
{
|
||||
base.Init(ve, bag, cc);
|
||||
UIUtils.SetElementDisplay(ve, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public bool InvertColor { get; set; }
|
||||
public bool Started { get; private set; }
|
||||
|
||||
private int rotation;
|
||||
|
||||
public LoadingSpinner()
|
||||
{
|
||||
InvertColor = false;
|
||||
Started = false;
|
||||
UIUtils.SetElementDisplay(this, false);
|
||||
}
|
||||
|
||||
private void UpdateProgress()
|
||||
{
|
||||
if (parent == null)
|
||||
return;
|
||||
|
||||
parent.transform.rotation = Quaternion.Euler(0, 0, rotation);
|
||||
rotation += 3;
|
||||
if (rotation > 360)
|
||||
rotation -= 360;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (Started)
|
||||
return;
|
||||
|
||||
// Weird hack to make sure loading spinner doesn't generate an error every frame.
|
||||
// Cannot put in constructor as it give really strange result.
|
||||
if (parent != null && parent.parent != null)
|
||||
parent.parent.clippingOptions = ClippingOptions.ClipAndCacheContents;
|
||||
|
||||
rotation = 0;
|
||||
|
||||
EditorApplication.update += UpdateProgress;
|
||||
|
||||
Started = true;
|
||||
UIUtils.SetElementDisplay(this, true);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (!Started)
|
||||
return;
|
||||
|
||||
EditorApplication.update -= UpdateProgress;
|
||||
|
||||
Started = false;
|
||||
UIUtils.SetElementDisplay(this, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 06f8e3404d534cab82fe852ff33dad77
|
||||
timeCreated: 1504191988
|
|
@ -0,0 +1,186 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.UIElements;
|
||||
|
||||
namespace UnityEditor.PackageManager.UI
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
internal class PopupField<T> : Experimental.UIElements.PopupField<T>
|
||||
{
|
||||
private Func<T, string> m_Callback;
|
||||
|
||||
public override T value
|
||||
{
|
||||
get { return base.value; }
|
||||
set
|
||||
{
|
||||
base.value = value;
|
||||
if (m_Callback != null)
|
||||
m_TextElement.text = m_Callback(m_Value);
|
||||
else
|
||||
m_TextElement.text = m_Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback that will return the string to be set in the field's label.
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
public void SetLabelCallback(Func<T, string> callback)
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
public PopupField(List<T> choices, T defaultValue) :
|
||||
base(choices, defaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
public PopupField(List<T> choices, int defaultIndex) :
|
||||
base(choices, defaultIndex)
|
||||
{
|
||||
}
|
||||
}
|
||||
#else
|
||||
internal class PopupField<T> : BaseTextElement, INotifyValueChanged<T>
|
||||
{
|
||||
private readonly List<T> m_PossibleValues;
|
||||
private Func<T, string> m_Callback;
|
||||
private EventCallback<ChangeEvent<T>> m_valueCallback;
|
||||
private T m_Value;
|
||||
public T value
|
||||
{
|
||||
get { return m_Value; }
|
||||
set
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(m_Value, value))
|
||||
return;
|
||||
|
||||
if (!m_PossibleValues.Contains(value))
|
||||
throw new ArgumentException(string.Format("Value {0} is not present in the list of possible values", value));
|
||||
|
||||
m_Value = value;
|
||||
m_Index = m_PossibleValues.IndexOf(m_Value);
|
||||
if (m_Callback != null)
|
||||
text = m_Callback(m_Value);
|
||||
else
|
||||
text = m_Value.ToString();
|
||||
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
MarkDirtyRepaint();
|
||||
#else
|
||||
Dirty(ChangeType.Repaint);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private int m_Index = -1;
|
||||
public int index
|
||||
{
|
||||
get { return m_Index; }
|
||||
set
|
||||
{
|
||||
if (value != m_Index)
|
||||
{
|
||||
if (value >= m_PossibleValues.Count || value < 0)
|
||||
throw new ArgumentException(string.Format("Index {0} is beyond the scope of possible value", value));
|
||||
m_Index = value;
|
||||
this.value = m_PossibleValues[m_Index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback that will return the string to be set in the field's label.
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
public void SetLabelCallback(Func<T, string> callback)
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
private PopupField(List<T> possibleValues)
|
||||
{
|
||||
if (possibleValues == null)
|
||||
throw new ArgumentNullException("possibleValues can't be null");
|
||||
|
||||
m_PossibleValues = possibleValues;
|
||||
|
||||
AddToClassList("popupField");
|
||||
}
|
||||
|
||||
public PopupField(List<T> possibleValues, T defaultValue) :
|
||||
this(possibleValues)
|
||||
{
|
||||
if (defaultValue == null)
|
||||
throw new ArgumentNullException("defaultValue can't be null");
|
||||
|
||||
if (!m_PossibleValues.Contains(defaultValue))
|
||||
throw new ArgumentException(string.Format("Default value {0} is not present in the list of possible values", defaultValue));
|
||||
|
||||
// note: idx will be set when setting value
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
public PopupField(List<T> possibleValues, int defaultIndex) :
|
||||
this(possibleValues)
|
||||
{
|
||||
if (defaultIndex >= m_PossibleValues.Count || defaultIndex < 0)
|
||||
throw new ArgumentException(string.Format("Default Index {0} is beyond the scope of possible value", value));
|
||||
|
||||
// note: value will be set when setting idx
|
||||
index = defaultIndex;
|
||||
}
|
||||
|
||||
public void SetValueAndNotify(T newValue)
|
||||
{
|
||||
if (!EqualityComparer<T>.Default.Equals(newValue, value))
|
||||
{
|
||||
using (ChangeEvent<T> evt = ChangeEvent<T>.GetPooled(value, newValue))
|
||||
{
|
||||
value = newValue;
|
||||
if (m_valueCallback != null)
|
||||
m_valueCallback(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnValueChanged(EventCallback<ChangeEvent<T>> callback)
|
||||
{
|
||||
m_valueCallback = callback;
|
||||
RegisterCallback(callback);
|
||||
}
|
||||
|
||||
protected override void ExecuteDefaultAction(EventBase evt)
|
||||
{
|
||||
base.ExecuteDefaultAction(evt);
|
||||
|
||||
if (evt.GetEventTypeId() == MouseDownEvent.TypeId())
|
||||
OnMouseDown();
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
var menu = new GenericMenu();
|
||||
|
||||
foreach (T item in m_PossibleValues)
|
||||
{
|
||||
bool isSelected = EqualityComparer<T>.Default.Equals(item, value);
|
||||
menu.AddItem(new GUIContent(item.ToString()), isSelected,
|
||||
() => ChangeValueFromMenu(item));
|
||||
}
|
||||
|
||||
var menuPosition = new Vector2(0.0f, layout.height);
|
||||
menuPosition = this.LocalToWorld(menuPosition);
|
||||
var menuRect = new Rect(menuPosition, Vector2.zero);
|
||||
menu.DropDown(menuRect);
|
||||
}
|
||||
|
||||
private void ChangeValueFromMenu(T menuItem)
|
||||
{
|
||||
SetValueAndNotify(menuItem);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9e69df8ff024a4dc1a9e5c22725e4863
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,55 @@
|
|||
using UnityEngine.Experimental.UIElements;
|
||||
|
||||
namespace UnityEditor.PackageManager.UI
|
||||
{
|
||||
internal static class UIUtils
|
||||
{
|
||||
private const string DisplayNone = "display-none";
|
||||
|
||||
public static void SetElementDisplay(VisualElement element, bool value)
|
||||
{
|
||||
if (element == null)
|
||||
return;
|
||||
|
||||
if (value)
|
||||
element.RemoveFromClassList(DisplayNone);
|
||||
else
|
||||
element.AddToClassList(DisplayNone);
|
||||
|
||||
element.visible = value;
|
||||
}
|
||||
|
||||
public static void SetElementDisplayNonEmpty(Label element)
|
||||
{
|
||||
if (element == null)
|
||||
return;
|
||||
|
||||
var empty = string.IsNullOrEmpty(element.text);
|
||||
if (empty)
|
||||
element.AddToClassList(DisplayNone);
|
||||
else
|
||||
element.RemoveFromClassList(DisplayNone);
|
||||
|
||||
element.visible = !empty;
|
||||
}
|
||||
|
||||
public static void SetElementDisplayNonEmpty(Button element)
|
||||
{
|
||||
if (element == null)
|
||||
return;
|
||||
|
||||
var empty = string.IsNullOrEmpty(element.text);
|
||||
if (empty)
|
||||
element.AddToClassList(DisplayNone);
|
||||
else
|
||||
element.RemoveFromClassList(DisplayNone);
|
||||
|
||||
element.visible = !empty;
|
||||
}
|
||||
|
||||
public static bool IsElementVisible(VisualElement element)
|
||||
{
|
||||
return element.visible && !element.ClassListContains(DisplayNone);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0edd86f97b0648f685604a5582cff608
|
||||
timeCreated: 1508956933
|
|
@ -0,0 +1,66 @@
|
|||
namespace UnityEditor.PackageManager.UI
|
||||
{
|
||||
internal class VersionItem
|
||||
{
|
||||
internal PackageInfo Version;
|
||||
|
||||
public string MenuName { get; set; }
|
||||
|
||||
// Base label
|
||||
public string Label
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Version == null)
|
||||
return MenuName;
|
||||
|
||||
var label = Version.VersionWithoutTag;
|
||||
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public string DropdownLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Version == null)
|
||||
return MenuName;
|
||||
|
||||
var label = MenuName + Label;
|
||||
|
||||
if (Version.IsLocal)
|
||||
label += " - local";
|
||||
if (Version.IsCurrent)
|
||||
label += " - current";
|
||||
if (Version.IsVerified)
|
||||
label += " - verified";
|
||||
else if (!string.IsNullOrEmpty(Version.Version.Prerelease))
|
||||
label += string.Format(" - {0}", Version.Version.Prerelease);
|
||||
else if (Version.IsPreview)
|
||||
label += " - preview";
|
||||
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return DropdownLabel;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(obj, null)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
|
||||
var other = (VersionItem)obj;
|
||||
return Version == other.Version;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Version.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3877b2be7ee07495d8918dc8937e6de2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue