Passion & UI
This commit is contained in:
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons.meta
Normal file
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d92ebdf69de54042bba71c729f7a543
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ChapterButton : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public Sprite backgroundImage;
|
||||
public string buttonTitle = "My Title";
|
||||
[TextArea] public string buttonDescription = "My Description";
|
||||
|
||||
[Header("Settings")]
|
||||
public bool useCustomResources = false;
|
||||
|
||||
[Header("Status")]
|
||||
public bool enableStatus;
|
||||
public StatusItem statusItem;
|
||||
|
||||
Image backgroundImageObj;
|
||||
TextMeshProUGUI titleObj;
|
||||
TextMeshProUGUI descriptionObj;
|
||||
Transform statusNone;
|
||||
Transform statusLocked;
|
||||
Transform statusCompleted;
|
||||
|
||||
public enum StatusItem
|
||||
{
|
||||
None,
|
||||
Locked,
|
||||
Completed
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (useCustomResources == false)
|
||||
{
|
||||
backgroundImageObj = gameObject.transform.Find("Content/Background").GetComponent<Image>();
|
||||
titleObj = gameObject.transform.Find("Content/Texts/Title").GetComponent<TextMeshProUGUI>();
|
||||
descriptionObj = gameObject.transform.Find("Content/Texts/Description").GetComponent<TextMeshProUGUI>();
|
||||
|
||||
backgroundImageObj.sprite = backgroundImage;
|
||||
titleObj.text = buttonTitle;
|
||||
descriptionObj.text = buttonDescription;
|
||||
}
|
||||
|
||||
if (enableStatus == true)
|
||||
{
|
||||
statusNone = gameObject.transform.Find("Content/Texts/Status/None").GetComponent<Transform>();
|
||||
statusLocked = gameObject.transform.Find("Content/Texts/Status/Locked").GetComponent<Transform>();
|
||||
statusCompleted = gameObject.transform.Find("Content/Texts/Status/Completed").GetComponent<Transform>();
|
||||
|
||||
if (statusItem == StatusItem.None)
|
||||
{
|
||||
statusNone.gameObject.SetActive(true);
|
||||
statusLocked.gameObject.SetActive(false);
|
||||
statusCompleted.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else if (statusItem == StatusItem.Locked)
|
||||
{
|
||||
statusNone.gameObject.SetActive(false);
|
||||
statusLocked.gameObject.SetActive(true);
|
||||
statusCompleted.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else if (statusItem == StatusItem.Completed)
|
||||
{
|
||||
statusNone.gameObject.SetActive(false);
|
||||
statusLocked.gameObject.SetActive(false);
|
||||
statusCompleted.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c02d941c4fd4c54a9a3de039909e362
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/ChapterButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class FavoriteButton : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
public FavoriteItem isFavorite;
|
||||
|
||||
Image iconObj;
|
||||
Image iconFilledObj;
|
||||
Button mainButton;
|
||||
|
||||
public enum FavoriteItem
|
||||
{
|
||||
FALSE,
|
||||
TRUE
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
iconObj = gameObject.transform.Find("Icon").GetComponent<Image>();
|
||||
iconFilledObj = gameObject.transform.Find("Icon Filled").GetComponent<Image>();
|
||||
mainButton = gameObject.GetComponent<Button>();
|
||||
UpdateUI();
|
||||
mainButton.onClick.AddListener(ClickEvents);
|
||||
mainButton.onClick.AddListener(UpdateUI);
|
||||
}
|
||||
|
||||
public void ClickEvents()
|
||||
{
|
||||
if (isFavorite == FavoriteItem.FALSE)
|
||||
isFavorite = FavoriteItem.TRUE;
|
||||
|
||||
else
|
||||
isFavorite = FavoriteItem.FALSE;
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
if (isFavorite == FavoriteItem.FALSE)
|
||||
{
|
||||
iconObj.gameObject.SetActive(true);
|
||||
iconFilledObj.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
iconObj.gameObject.SetActive(false);
|
||||
iconFilledObj.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef25b60a6c0375f41868ac3428fb9725
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/FavoriteButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class MainButton : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
public string buttonText = "My Title";
|
||||
public bool useCustomText = false;
|
||||
|
||||
[Header("Resources")]
|
||||
public TextMeshProUGUI normalText;
|
||||
public TextMeshProUGUI highlightedText;
|
||||
public TextMeshProUGUI pressedText;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (useCustomText == false)
|
||||
{
|
||||
if (normalText != null) { normalText.text = buttonText; }
|
||||
if (highlightedText != null) { highlightedText.text = buttonText; }
|
||||
if (pressedText != null) { pressedText.text = buttonText; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f6465851424ac84fa7e7c1d80acd1b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/MainButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,71 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class MainPanelButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("Text")]
|
||||
public bool useCustomText = false;
|
||||
public string buttonText = "My Title";
|
||||
|
||||
[Header("Icon")]
|
||||
public bool hasIcon = false;
|
||||
public Sprite iconSprite;
|
||||
|
||||
[Header("Resources")]
|
||||
public Animator buttonAnimator;
|
||||
public TextMeshProUGUI normalText;
|
||||
public TextMeshProUGUI highlightedText;
|
||||
public TextMeshProUGUI pressedText;
|
||||
public Image normalIcon;
|
||||
public Image highlightedIcon;
|
||||
public Image pressedIcon;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (buttonAnimator == null)
|
||||
buttonAnimator = gameObject.GetComponent<Animator>();
|
||||
|
||||
if (useCustomText == false)
|
||||
{
|
||||
if (normalText != null) { normalText.text = buttonText; }
|
||||
if (highlightedText != null) { highlightedText.text = buttonText; }
|
||||
if (pressedText != null) { pressedText.text = buttonText; }
|
||||
}
|
||||
|
||||
if (hasIcon == true)
|
||||
{
|
||||
if (normalIcon != null) { normalIcon.sprite = iconSprite; }
|
||||
if (highlightedIcon != null) { highlightedIcon.sprite = iconSprite; }
|
||||
if (pressedIcon != null) { pressedIcon.sprite = iconSprite; }
|
||||
}
|
||||
|
||||
else if (hasIcon == false)
|
||||
{
|
||||
if (normalIcon != null) { Destroy(normalIcon.gameObject); }
|
||||
if (highlightedIcon != null) { Destroy(highlightedIcon.gameObject); }
|
||||
if (pressedIcon != null) { Destroy(pressedIcon.gameObject); }
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
#if !UNITY_ANDROID && !UNITY_IOS
|
||||
if (!buttonAnimator.GetCurrentAnimatorStateInfo(0).IsName("Normal to Pressed"))
|
||||
buttonAnimator.Play("Dissolve to Normal");
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
#if !UNITY_ANDROID && !UNITY_IOS
|
||||
if (!buttonAnimator.GetCurrentAnimatorStateInfo(0).IsName("Normal to Pressed"))
|
||||
buttonAnimator.Play("Normal to Dissolve");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29e38c7929fcd08448d013bee7d329f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/MainPanelButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class QuickMatchButton : MonoBehaviour
|
||||
{
|
||||
[Header("Text")]
|
||||
public bool useCustomText = false;
|
||||
public string buttonTitle = "My Title";
|
||||
|
||||
[Header("Image")]
|
||||
public bool useCustomImage = false;
|
||||
public Sprite backgroundImage;
|
||||
|
||||
TextMeshProUGUI titleText;
|
||||
Image image1;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (useCustomText == false)
|
||||
{
|
||||
titleText = gameObject.transform.Find("Content/Title").GetComponent<TextMeshProUGUI>();
|
||||
titleText.text = buttonTitle;
|
||||
}
|
||||
|
||||
if (useCustomImage == false)
|
||||
{
|
||||
image1 = gameObject.transform.Find("Content/Background").GetComponent<Image>();
|
||||
image1.sprite = backgroundImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55ef760221e79204b86f03c51bab5f7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/QuickMatchButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SettingsButton : MonoBehaviour, IPointerEnterHandler
|
||||
{
|
||||
[Header("Resources")]
|
||||
public Image detailImage;
|
||||
public Image detailIcon;
|
||||
public Image detailBackground;
|
||||
public TextMeshProUGUI detailTitle;
|
||||
public TextMeshProUGUI detailDescription;
|
||||
public TextMeshProUGUI buttonTitleObj;
|
||||
|
||||
[Header("Content")]
|
||||
public bool useCustomContent;
|
||||
public string buttonTitle;
|
||||
|
||||
[Header("Preview")]
|
||||
public bool enableIconPreview;
|
||||
public string title;
|
||||
[TextArea] public string description;
|
||||
public Sprite imageSprite;
|
||||
public Sprite iconSprite;
|
||||
public Sprite iconBackground;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (useCustomContent == false) { buttonTitleObj.text = buttonTitle; }
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (enableIconPreview == true)
|
||||
{
|
||||
detailImage.gameObject.SetActive(false);
|
||||
detailIcon.gameObject.SetActive(true);
|
||||
detailBackground.gameObject.SetActive(true);
|
||||
detailIcon.sprite = iconSprite;
|
||||
detailBackground.sprite = iconBackground;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
detailImage.gameObject.SetActive(true);
|
||||
detailIcon.gameObject.SetActive(false);
|
||||
detailBackground.gameObject.SetActive(false);
|
||||
detailImage.sprite = imageSprite;
|
||||
}
|
||||
|
||||
detailTitle.text = title;
|
||||
detailDescription.text = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54b1eb24c2f1d2f4384d7d3fa4355ed1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/SettingsButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class ShortcutButton : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public string keyText = "A";
|
||||
public string buttonText = "My Title";
|
||||
|
||||
[Header("Settings")]
|
||||
public bool useCustomText = false;
|
||||
public bool isGamepad = false;
|
||||
|
||||
[Header("Resources")]
|
||||
public TextMeshProUGUI normalText;
|
||||
public TextMeshProUGUI highlightedText;
|
||||
public TextMeshProUGUI normalKeyText;
|
||||
public TextMeshProUGUI highlightedKeyText;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (useCustomText == false)
|
||||
{
|
||||
if (isGamepad == false)
|
||||
{
|
||||
if (normalText != null) { normalText.text = buttonText; }
|
||||
if (highlightedText != null) { highlightedText.text = buttonText; }
|
||||
if (normalKeyText != null) { normalKeyText.text = keyText; }
|
||||
if (highlightedKeyText != null) { highlightedKeyText.text = keyText; }
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (normalText != null) { normalText.text = buttonText; }
|
||||
if (normalKeyText != null) { normalKeyText.text = keyText; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94b01906196fd7f47b6768d3910e9957
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/ShortcutButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SpotlightButton : MonoBehaviour
|
||||
{
|
||||
[Header("Text")]
|
||||
public bool useCustomText = false;
|
||||
public string buttonTitle = "My Title";
|
||||
public string buttonDescription = "My Description";
|
||||
|
||||
[Header("Image")]
|
||||
public bool useCustomImage = false;
|
||||
public Sprite firstImage;
|
||||
public Sprite secondImage;
|
||||
|
||||
TextMeshProUGUI titleText;
|
||||
TextMeshProUGUI descriptionText;
|
||||
Image image1;
|
||||
Image image2;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (useCustomText == false)
|
||||
{
|
||||
titleText = gameObject.transform.Find("Content/Title").GetComponent<TextMeshProUGUI>();
|
||||
descriptionText = gameObject.transform.Find("Content/Description").GetComponent<TextMeshProUGUI>();
|
||||
|
||||
titleText.text = buttonTitle;
|
||||
descriptionText.text = buttonDescription;
|
||||
}
|
||||
|
||||
if (useCustomImage == false)
|
||||
{
|
||||
image1 = gameObject.transform.Find("Content/Background/Image 1").GetComponent<Image>();
|
||||
image2 = gameObject.transform.Find("Content/Background/Image 2").GetComponent<Image>();
|
||||
|
||||
image1.sprite = firstImage;
|
||||
image2.sprite = secondImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 259e705bc7d53184f9f67edb60d52dfb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Buttons/SpotlightButton.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 673229a54516ec74bb0eccd003d0ea8e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,101 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ShiftUIEditorHandler : Editor
|
||||
{
|
||||
public static void DrawProperty(SerializedProperty property, GUISkin skin, string content)
|
||||
{
|
||||
GUILayout.BeginHorizontal(EditorStyles.helpBox);
|
||||
|
||||
EditorGUILayout.LabelField(new GUIContent(content), skin.FindStyle("Text"), GUILayout.Width(120));
|
||||
EditorGUILayout.PropertyField(property, new GUIContent(""));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static void DrawPropertyPlain(SerializedProperty property, GUISkin skin, string content)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField(new GUIContent(content), skin.FindStyle("Text"), GUILayout.Width(120));
|
||||
EditorGUILayout.PropertyField(property, new GUIContent(""));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static void DrawPropertyCW(SerializedProperty property, GUISkin skin, string content, float width)
|
||||
{
|
||||
GUILayout.BeginHorizontal(EditorStyles.helpBox);
|
||||
|
||||
EditorGUILayout.LabelField(new GUIContent(content), skin.FindStyle("Text"), GUILayout.Width(width));
|
||||
EditorGUILayout.PropertyField(property, new GUIContent(""));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static void DrawPropertyPlainCW(SerializedProperty property, GUISkin skin, string content, float width)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField(new GUIContent(content), skin.FindStyle("Text"), GUILayout.Width(width));
|
||||
EditorGUILayout.PropertyField(property, new GUIContent(""));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static int DrawTabs(int tabIndex, GUIContent[] tabs, GUISkin skin)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(17);
|
||||
|
||||
tabIndex = GUILayout.Toolbar(tabIndex, tabs, skin.FindStyle("Tab Indicator"));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(-40);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(17);
|
||||
|
||||
return tabIndex;
|
||||
}
|
||||
|
||||
public static void DrawComponentHeader(GUISkin skin, string content)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Box(new GUIContent(""), skin.FindStyle(content));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(-42);
|
||||
}
|
||||
|
||||
public static void DrawHeader(GUISkin skin, string content, int space)
|
||||
{
|
||||
GUILayout.Space(space);
|
||||
GUILayout.Box(new GUIContent(""), skin.FindStyle(content));
|
||||
}
|
||||
|
||||
public static bool DrawToggle(bool value, GUISkin skin, string content)
|
||||
{
|
||||
GUILayout.BeginHorizontal(EditorStyles.helpBox);
|
||||
|
||||
value = GUILayout.Toggle(value, new GUIContent(content), skin.FindStyle("Toggle"));
|
||||
value = GUILayout.Toggle(value, new GUIContent(""), skin.FindStyle("Toggle Helper"));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
return value;
|
||||
}
|
||||
|
||||
public static bool DrawTogglePlain(bool value, GUISkin skin, string content)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
value = GUILayout.Toggle(value, new GUIContent(content), skin.FindStyle("Toggle"));
|
||||
value = GUILayout.Toggle(value, new GUIContent(""), skin.FindStyle("Toggle Helper"));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba80bbdb2751a3c47a4ebb4ec987d2fb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Editor Handlers/ShiftUIEditorHandler.cs
|
||||
uploadId: 915518
|
||||
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Event.meta
Normal file
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Event.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4f331d4677ed6b47b5aedc6563645e0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class HoldKeyEvent : MonoBehaviour
|
||||
{
|
||||
[Header("Key")]
|
||||
[SerializeField]
|
||||
public KeyCode hotkey;
|
||||
|
||||
[Header("Action")]
|
||||
[SerializeField]
|
||||
public UnityEvent holdAction;
|
||||
[SerializeField]
|
||||
public UnityEvent releaseAction;
|
||||
|
||||
private bool isOn = false;
|
||||
private bool isHolding = false;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKey(hotkey))
|
||||
{
|
||||
isHolding = true;
|
||||
isOn = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
isHolding = false;
|
||||
isOn = true;
|
||||
}
|
||||
|
||||
if (isOn == true && isHolding == false)
|
||||
{
|
||||
releaseAction.Invoke();
|
||||
isHolding = false;
|
||||
isOn = false;
|
||||
}
|
||||
|
||||
else if (isOn == false && isHolding == true)
|
||||
{
|
||||
holdAction.Invoke();
|
||||
isHolding = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b7b672d5254df94588aba0da41bde23
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Event/HoldKeyEvent.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class PointerEnterEvents : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("Events")]
|
||||
public UnityEvent enterEvent;
|
||||
public UnityEvent exitEvent;
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
enterEvent.Invoke();
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
exitEvent.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6365b95e4c190041bcdbf44d87b4df4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Event/PointerEnterEvents.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class PressKeyEvent : MonoBehaviour
|
||||
{
|
||||
[Header("Key")]
|
||||
public KeyCode hotkey;
|
||||
public bool pressAnyKey;
|
||||
public bool invokeAtStart;
|
||||
|
||||
[Header("Action")]
|
||||
public UnityEvent pressAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (invokeAtStart)
|
||||
pressAction?.Invoke();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (pressAnyKey && Input.anyKeyDown) { pressAction?.Invoke(); }
|
||||
else if (Input.GetKeyDown(hotkey)) { pressAction?.Invoke(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdcd8c02e7b6edc45964e533ac4306cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Event/PressKeyEvent.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class TimedEvent : MonoBehaviour
|
||||
{
|
||||
[Header("Timing (seconds)")]
|
||||
public float timer = 4;
|
||||
public bool enableAtStart;
|
||||
|
||||
[Header("Timer Event")]
|
||||
public UnityEvent timerAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if(enableAtStart == true)
|
||||
{
|
||||
StartCoroutine("TimedEventStart");
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator TimedEventStart()
|
||||
{
|
||||
yield return new WaitForSeconds(timer);
|
||||
timerAction.Invoke();
|
||||
}
|
||||
|
||||
public void StartIEnumerator ()
|
||||
{
|
||||
StartCoroutine("TimedEventStart");
|
||||
}
|
||||
|
||||
public void StopIEnumerator ()
|
||||
{
|
||||
StopCoroutine("TimedEventStart");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9070c836133cc645a6a6c1a95e366a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Event/TimedEvent.cs
|
||||
uploadId: 915518
|
||||
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Input.meta
Normal file
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Input.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ca8822594a07764986a66ade81e6012
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,151 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class GamepadChecker : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public VirtualCursor virtualCursor;
|
||||
public GameObject virtualCursorHelper;
|
||||
public GameObject eventSystem;
|
||||
|
||||
[Header("Settings")]
|
||||
[Tooltip("Always update input device. If you turn off this feature, you won't able to change the input device after start, but it might increase the performance.")]
|
||||
public bool alwaysSearch = true;
|
||||
|
||||
[Header("Objects")]
|
||||
[Tooltip("Objects in this list will be active when gamepad is un-plugged.")]
|
||||
public List<GameObject> keyboardObjects = new List<GameObject>();
|
||||
[Tooltip("Objects in this list will be active when gamepad is plugged.")]
|
||||
public List<GameObject> gamepadObjects = new List<GameObject>();
|
||||
|
||||
Vector3 cursorPos;
|
||||
[HideInInspector] public bool gamepadConnected;
|
||||
[HideInInspector] public bool gamepadEnabled;
|
||||
[HideInInspector] public bool keyboardEnabled;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (virtualCursor == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
#if UNITY_2023_2_OR_NEWER
|
||||
var vCursor = FindObjectsByType<VirtualCursor>(FindObjectsSortMode.None)[0];
|
||||
#else
|
||||
var vCursor = (VirtualCursor)GameObject.FindObjectsOfType(typeof(VirtualCursor))[0];
|
||||
#endif
|
||||
virtualCursor = vCursor;
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
this.enabled = false;
|
||||
Debug.LogWarning("<b>[Gamepad Checker]</b> There is no Virtual Cursor component attached.", this);
|
||||
}
|
||||
}
|
||||
|
||||
virtualCursorHelper = virtualCursor.gameObject;
|
||||
|
||||
if (alwaysSearch == false)
|
||||
{
|
||||
this.enabled = false;
|
||||
Debug.Log("<b>[Gamepad Checker]</b> Always Search is off. Input device won't be updated in case of disconnecting/connecting.");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
this.enabled = true;
|
||||
Debug.Log("<b>[Gamepad Checker]</b> Always Search is on. Input device will be updated in case of disconnecting/connecting.");
|
||||
}
|
||||
|
||||
string[] names = Input.GetJoystickNames();
|
||||
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
{
|
||||
if (names[i].Length >= 1)
|
||||
gamepadConnected = true;
|
||||
|
||||
else if (names[i].Length == 0)
|
||||
gamepadConnected = false;
|
||||
}
|
||||
|
||||
if (gamepadConnected == true)
|
||||
SwitchToGamepad();
|
||||
else
|
||||
SwitchToKeyboard();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
string[] names = Input.GetJoystickNames();
|
||||
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
{
|
||||
if (names[i].Length >= 1)
|
||||
gamepadConnected = true;
|
||||
else if (names[i].Length == 0)
|
||||
gamepadConnected = false;
|
||||
}
|
||||
|
||||
if (gamepadConnected == true && gamepadEnabled == true
|
||||
&& keyboardEnabled == false && Input.mousePosition != cursorPos)
|
||||
SwitchToKeyboard();
|
||||
|
||||
else if (gamepadConnected == true && gamepadEnabled == false
|
||||
&& keyboardEnabled == true && Input.GetKeyDown(KeyCode.Joystick1Button0))
|
||||
SwitchToGamepad();
|
||||
|
||||
else if (gamepadConnected == false && keyboardEnabled == false)
|
||||
SwitchToKeyboard();
|
||||
}
|
||||
|
||||
public void SwitchToGamepad()
|
||||
{
|
||||
if (virtualCursor == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < keyboardObjects.Count; i++)
|
||||
keyboardObjects[i].SetActive(false);
|
||||
|
||||
for (int i = 0; i < gamepadObjects.Count; i++)
|
||||
{
|
||||
gamepadObjects[i].SetActive(true);
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(gamepadObjects[i].GetComponentInParent<RectTransform>());
|
||||
}
|
||||
|
||||
gamepadEnabled = true;
|
||||
keyboardEnabled = false;
|
||||
virtualCursor.enabled = true;
|
||||
virtualCursorHelper.SetActive(true);
|
||||
eventSystem.SetActive(false);
|
||||
Cursor.visible = false;
|
||||
cursorPos = Input.mousePosition;
|
||||
}
|
||||
|
||||
public void SwitchToKeyboard()
|
||||
{
|
||||
if (virtualCursor == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < gamepadObjects.Count; i++)
|
||||
gamepadObjects[i].SetActive(false);
|
||||
|
||||
for (int i = 0; i < keyboardObjects.Count; i++)
|
||||
{
|
||||
keyboardObjects[i].SetActive(true);
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(keyboardObjects[0].GetComponentInParent<RectTransform>());
|
||||
}
|
||||
|
||||
gamepadEnabled = false;
|
||||
keyboardEnabled = true;
|
||||
virtualCursor.enabled = false;
|
||||
virtualCursorHelper.SetActive(false);
|
||||
eventSystem.SetActive(true);
|
||||
Cursor.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47dd921c704d40d4eb96f6609f410a01
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Input/GamepadChecker.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
using UnityEngine.InputSystem.UI;
|
||||
#else
|
||||
using UnityEngine.EventSystems;
|
||||
#endif
|
||||
|
||||
namespace Evo.UI.Demo
|
||||
{
|
||||
public class InputSystemDetector : MonoBehaviour
|
||||
{
|
||||
void Awake()
|
||||
{
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
if (!gameObject.TryGetComponent<InputSystemUIInputModule>(out var _))
|
||||
{
|
||||
gameObject.AddComponent<InputSystemUIInputModule>();
|
||||
}
|
||||
#else
|
||||
if (!gameObject.TryGetComponent<StandaloneInputModule>(out var _))
|
||||
{
|
||||
gameObject.AddComponent<StandaloneInputModule>();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9237cfad763a4924d9ee390238437d6b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Input/InputSystemDetector.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ScrollGamepadManager : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
public float changeValue = 0.05f;
|
||||
Scrollbar scrollbarObject;
|
||||
|
||||
[Header("Input")]
|
||||
public string inputAxis = "Xbox Right Stick Vertical";
|
||||
public bool invertAxis = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
try { scrollbarObject = gameObject.GetComponent<Scrollbar>(); }
|
||||
catch { Debug.LogWarning("Scrollbar is missing. Scrolling via gamepad won't work."); }
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (scrollbarObject != null)
|
||||
{
|
||||
float h = Input.GetAxis(inputAxis);
|
||||
|
||||
if (invertAxis == false)
|
||||
{
|
||||
if (h == 1)
|
||||
scrollbarObject.value -= changeValue;
|
||||
else if (h == -1)
|
||||
scrollbarObject.value += changeValue;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (h == 1)
|
||||
scrollbarObject.value += changeValue;
|
||||
else if (h == -1)
|
||||
scrollbarObject.value -= changeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76695198d39c477488ca0842f020023d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Input/ScrollGamepadManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SliderGamepadManager : MonoBehaviour
|
||||
{
|
||||
[Header("Slider")]
|
||||
public float changeValue = 0.5f;
|
||||
Slider sliderObject;
|
||||
|
||||
[Header("Input")]
|
||||
public string horizontalAxis = "Xbox Right Stick Horizontal";
|
||||
|
||||
void Start()
|
||||
{
|
||||
try { sliderObject = gameObject.GetComponent<Slider>(); }
|
||||
catch { Debug.LogWarning("Slider is missing. Sliding via gamepad won't work."); }
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (sliderObject != null)
|
||||
{
|
||||
float h = Input.GetAxis(horizontalAxis);
|
||||
|
||||
if (h == 1)
|
||||
sliderObject.value += changeValue;
|
||||
else if (h == -1)
|
||||
sliderObject.value -= changeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42a6b034380c85e478dd6d6d49a406f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Input/SliderGamepadManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,88 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class VirtualCursor : PointerInputModule
|
||||
{
|
||||
[Header("Objects")]
|
||||
public RectTransform border;
|
||||
public GameObject cursorObject;
|
||||
|
||||
[Header("Input")]
|
||||
public EventSystem vEventSystem;
|
||||
public string horizontalAxis = "Horizontal";
|
||||
public string verticalAxis = "Vertical";
|
||||
|
||||
[Header("Settings")]
|
||||
[Range(0.1f, 5)] public float speed = 1;
|
||||
|
||||
Animator cursorAnim;
|
||||
PointerEventData pointer;
|
||||
Vector2 cursorPos;
|
||||
RectTransform cursorObj;
|
||||
|
||||
public new void Start()
|
||||
{
|
||||
cursorObj = this.GetComponent<RectTransform>();
|
||||
pointer = new PointerEventData(vEventSystem);
|
||||
cursorAnim = cursorObject.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
cursorPos.x += Input.GetAxis(horizontalAxis) * speed * 1000 * Time.deltaTime;
|
||||
cursorPos.x = Mathf.Clamp(cursorPos.x, -+border.rect.width / 2, border.rect.width / 2);
|
||||
|
||||
cursorPos.y += Input.GetAxis(verticalAxis) * speed * 1000 * Time.deltaTime;
|
||||
cursorPos.y = Mathf.Clamp(cursorPos.y, -+border.rect.height / 2, border.rect.height / 2);
|
||||
|
||||
cursorObj.anchoredPosition = cursorPos;
|
||||
}
|
||||
|
||||
public override void Process()
|
||||
{
|
||||
Vector2 screenPos = Camera.main.WorldToScreenPoint(cursorObj.transform.position);
|
||||
pointer.position = screenPos;
|
||||
eventSystem.RaycastAll(pointer, this.m_RaycastResultCache);
|
||||
RaycastResult raycastResult = FindFirstRaycast(this.m_RaycastResultCache);
|
||||
pointer.pointerCurrentRaycast = raycastResult;
|
||||
this.ProcessMove(pointer);
|
||||
|
||||
if (Input.GetButtonDown("Submit"))
|
||||
{
|
||||
pointer.pressPosition = cursorPos;
|
||||
pointer.clickTime = Time.unscaledTime;
|
||||
pointer.pointerPressRaycast = raycastResult;
|
||||
|
||||
if (this.m_RaycastResultCache.Count > 0)
|
||||
{
|
||||
pointer.selectedObject = raycastResult.gameObject;
|
||||
pointer.pointerPress = ExecuteEvents.ExecuteHierarchy(raycastResult.gameObject, pointer, ExecuteEvents.submitHandler);
|
||||
pointer.rawPointerPress = raycastResult.gameObject;
|
||||
}
|
||||
|
||||
else
|
||||
pointer.rawPointerPress = null;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
pointer.pointerPress = null;
|
||||
pointer.rawPointerPress = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void AnimateCursorIn()
|
||||
{
|
||||
if (gameObject.activeSelf == true)
|
||||
cursorAnim.Play("In");
|
||||
}
|
||||
|
||||
public void AnimateCursorOut()
|
||||
{
|
||||
if (gameObject.activeSelf == true)
|
||||
cursorAnim.Play("Out");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df68c33a8dc76e84d95d48c8cc5e5fef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Input/VirtualCursor.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class VirtualCursorAnimate : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("Resources")]
|
||||
public VirtualCursor virtualCursor;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (virtualCursor == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
#if UNITY_2023_2_OR_NEWER
|
||||
var vCursor = FindObjectsByType<VirtualCursor>(FindObjectsSortMode.None)[0];
|
||||
#else
|
||||
var vCursor = (VirtualCursor)GameObject.FindObjectsOfType(typeof(VirtualCursor))[0];
|
||||
#endif
|
||||
virtualCursor = vCursor;
|
||||
}
|
||||
|
||||
catch { this.enabled = false; }
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (virtualCursor != null)
|
||||
virtualCursor.AnimateCursorIn();
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
if (virtualCursor != null)
|
||||
virtualCursor.AnimateCursorOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebb34337dbca08a4cb127fe2e4365173
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Input/VirtualCursorAnimate.cs
|
||||
uploadId: 915518
|
||||
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Other.meta
Normal file
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Other.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c793d341b5ba5ee4199fc7d9f7c393cb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class CanvasManager : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public CanvasScaler canvasScaler;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (canvasScaler == null)
|
||||
canvasScaler = gameObject.GetComponent<CanvasScaler>();
|
||||
}
|
||||
|
||||
public void ScaleCanvas(int scale = 1080)
|
||||
{
|
||||
canvasScaler.referenceResolution = new Vector2(canvasScaler.referenceResolution.x, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dba074f5b1cddaf4fbaa75b9c2b532b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/CanvasManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class EditorDemoPositionFix : MonoBehaviour
|
||||
{
|
||||
public List<RectTransform> objectToRepaint;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void Awake()
|
||||
{
|
||||
if (Application.isPlaying == true || objectToRepaint.Count == 0)
|
||||
return;
|
||||
|
||||
// Rebuilding the rect in case of incorrect layout calculation
|
||||
for (int i = 0; i < objectToRepaint.Count; ++i)
|
||||
{
|
||||
if (objectToRepaint[i] != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(objectToRepaint[i].GetComponentInParent<RectTransform>());
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(objectToRepaint[i]);
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(objectToRepaint[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60198677d32fe8348aa29ac27233e2bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/EditorDemoPositionFix.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ExitToSystem : MonoBehaviour
|
||||
{
|
||||
public void ExitGame()
|
||||
{
|
||||
Debug.Log("Exit function is working on build mode.");
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57fe7425f83c9824fa81663c00e6b21c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/ExitToSystem.cs
|
||||
uploadId: 915518
|
||||
14
Assets/Shift - Complete Sci-Fi UI/Scripts/Other/LaunchURL.cs
Normal file
14
Assets/Shift - Complete Sci-Fi UI/Scripts/Other/LaunchURL.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class LaunchURL : MonoBehaviour
|
||||
{
|
||||
public string URL;
|
||||
|
||||
public void GoToURL()
|
||||
{
|
||||
Application.OpenURL(URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 848a88a94ba992240a3ce95346011e03
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/LaunchURL.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class LayoutGroupPositionFix : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private bool fixOnEnable = true;
|
||||
[SerializeField] private bool fixWithDelay = true;
|
||||
[SerializeField] private RebuildMethod rebuildMethod;
|
||||
float fixDelay = 0.025f;
|
||||
|
||||
public enum RebuildMethod { ForceRebuild, MarkRebuild }
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
|
||||
if (Application.isPlaying == false) { return; }
|
||||
#endif
|
||||
if (fixWithDelay == false && fixOnEnable == true && rebuildMethod == RebuildMethod.ForceRebuild) { ForceRebuild(); }
|
||||
else if (fixWithDelay == false && fixOnEnable == true && rebuildMethod == RebuildMethod.MarkRebuild) { MarkRebuild(); }
|
||||
else if (fixWithDelay == true) { StartCoroutine(FixDelay()); }
|
||||
}
|
||||
|
||||
public void FixLayout()
|
||||
{
|
||||
if (fixWithDelay == false && rebuildMethod == RebuildMethod.ForceRebuild) { ForceRebuild(); }
|
||||
else if (fixWithDelay == false && rebuildMethod == RebuildMethod.MarkRebuild) { MarkRebuild(); }
|
||||
else { StartCoroutine(FixDelay()); }
|
||||
}
|
||||
|
||||
void ForceRebuild()
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
|
||||
}
|
||||
|
||||
void MarkRebuild()
|
||||
{
|
||||
LayoutRebuilder.MarkLayoutForRebuild(GetComponent<RectTransform>());
|
||||
}
|
||||
|
||||
IEnumerator FixDelay()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(fixDelay);
|
||||
|
||||
if (rebuildMethod == RebuildMethod.ForceRebuild) { ForceRebuild(); }
|
||||
else if (rebuildMethod == RebuildMethod.MarkRebuild) { MarkRebuild(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68c85f85e0b459f4e9d5b0ab03afd03f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/LayoutGroupPositionFix.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,240 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.Events;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class QualityManager : MonoBehaviour
|
||||
{
|
||||
[Header("Audio")]
|
||||
public AudioMixer mixer;
|
||||
public SliderManager masterSlider;
|
||||
public SliderManager musicSlider;
|
||||
public SliderManager sfxSlider;
|
||||
|
||||
[Header("Resolution")]
|
||||
public bool preferSelector = true;
|
||||
public HorizontalSelector resolutionSelector;
|
||||
public TMP_Dropdown resolutionDropdown;
|
||||
[System.Serializable]
|
||||
public class DynamicRes : UnityEvent<int> { }
|
||||
public DynamicRes clickEvent;
|
||||
|
||||
Resolution[] resolutions;
|
||||
List<string> options = new List<string>();
|
||||
|
||||
void Start()
|
||||
{
|
||||
mixer.SetFloat("Master", Mathf.Log10(PlayerPrefs.GetFloat(masterSlider.sliderTag + "SliderValue")) * 20);
|
||||
mixer.SetFloat("Music", Mathf.Log10(PlayerPrefs.GetFloat(musicSlider.sliderTag + "SliderValue")) * 20);
|
||||
mixer.SetFloat("SFX", Mathf.Log10(PlayerPrefs.GetFloat(sfxSlider.sliderTag + "SliderValue")) * 20);
|
||||
|
||||
resolutions = Screen.resolutions;
|
||||
|
||||
if (preferSelector == true)
|
||||
{
|
||||
if (resolutionDropdown != null) { resolutionDropdown.gameObject.SetActive(false); }
|
||||
if (resolutionSelector != null) { resolutionSelector.gameObject.SetActive(true); }
|
||||
else { return; }
|
||||
|
||||
resolutionSelector.itemList.RemoveRange(0, resolutionSelector.itemList.Count);
|
||||
|
||||
int currentResolutionIndex = -1;
|
||||
for (int i = 0; i < resolutions.Length; i++)
|
||||
{
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRateRatio.numerator + "hz";
|
||||
#else
|
||||
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + "hz";
|
||||
#endif
|
||||
options.Add(option);
|
||||
|
||||
resolutionSelector.CreateNewItem(options[i]);
|
||||
// resolutionSelector.itemList[i].onValueChanged.AddListener(UpdateResolution);
|
||||
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
if (resolutions[i].width == Screen.currentResolution.width
|
||||
&& resolutions[i].height == Screen.currentResolution.height
|
||||
&& resolutions[i].refreshRateRatio.numerator == Screen.currentResolution.refreshRateRatio.numerator)
|
||||
#else
|
||||
if (resolutions[i].width == Screen.currentResolution.width
|
||||
&& resolutions[i].height == Screen.currentResolution.height
|
||||
&& resolutions[i].refreshRate == Screen.currentResolution.refreshRate)
|
||||
#endif
|
||||
{
|
||||
currentResolutionIndex = i;
|
||||
resolutionSelector.index = currentResolutionIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentResolutionIndex == 0) { resolutionSelector.index = resolutionSelector.itemList.Count - 1; }
|
||||
resolutionSelector.UpdateUI();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (resolutionSelector != null) { resolutionSelector.gameObject.SetActive(false); }
|
||||
if (resolutionDropdown != null) { resolutionDropdown.gameObject.SetActive(true); }
|
||||
else { return; }
|
||||
|
||||
resolutionDropdown.ClearOptions();
|
||||
|
||||
List<string> options = new List<string>();
|
||||
|
||||
int currentResolutionIndex = 0;
|
||||
for (int i = 0; i < resolutions.Length; i++)
|
||||
{
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRateRatio.numerator + "hz";
|
||||
#else
|
||||
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + "hz";
|
||||
#endif
|
||||
options.Add(option);
|
||||
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
if (resolutions[i].width == Screen.currentResolution.width
|
||||
&& resolutions[i].height == Screen.currentResolution.height
|
||||
&& resolutions[i].refreshRateRatio.numerator == Screen.currentResolution.refreshRateRatio.numerator)
|
||||
#else
|
||||
if (resolutions[i].width == Screen.currentResolution.width
|
||||
&& resolutions[i].height == Screen.currentResolution.height
|
||||
&& resolutions[i].refreshRate == Screen.currentResolution.refreshRate)
|
||||
#endif
|
||||
{
|
||||
currentResolutionIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
resolutionDropdown.AddOptions(options);
|
||||
resolutionDropdown.value = currentResolutionIndex;
|
||||
resolutionDropdown.RefreshShownValue();
|
||||
resolutionDropdown.onValueChanged.RemoveAllListeners();
|
||||
resolutionDropdown.onValueChanged.AddListener(SetResolution);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateResolution()
|
||||
{
|
||||
clickEvent.Invoke(resolutionSelector.index);
|
||||
}
|
||||
|
||||
public void SetResolution(int resolutionIndex)
|
||||
{
|
||||
Screen.SetResolution(resolutions[resolutionIndex].width, resolutions[resolutionIndex].height, Screen.fullScreen);
|
||||
}
|
||||
|
||||
public void AnisotrpicFilteringEnable()
|
||||
{
|
||||
QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnable;
|
||||
}
|
||||
|
||||
public void AnisotrpicFilteringDisable()
|
||||
{
|
||||
QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;
|
||||
}
|
||||
|
||||
public void AntiAlisasingSet(int index)
|
||||
{
|
||||
// 0, 2, 4, 8 - Zero means off
|
||||
QualitySettings.antiAliasing = index;
|
||||
}
|
||||
|
||||
public void VsyncSet(int index)
|
||||
{
|
||||
// 0, 1 - Zero means off
|
||||
QualitySettings.vSyncCount = index;
|
||||
}
|
||||
|
||||
public void ShadowResolutionSet(int index)
|
||||
{
|
||||
if (index == 3)
|
||||
QualitySettings.shadowResolution = ShadowResolution.VeryHigh;
|
||||
else if (index == 2)
|
||||
QualitySettings.shadowResolution = ShadowResolution.High;
|
||||
else if (index == 1)
|
||||
QualitySettings.shadowResolution = ShadowResolution.Medium;
|
||||
else if (index == 0)
|
||||
QualitySettings.shadowResolution = ShadowResolution.Low;
|
||||
}
|
||||
|
||||
public void ShadowsSet(int index)
|
||||
{
|
||||
if (index == 0)
|
||||
QualitySettings.shadows = ShadowQuality.Disable;
|
||||
else if (index == 1)
|
||||
QualitySettings.shadows = ShadowQuality.All;
|
||||
}
|
||||
|
||||
public void ShadowsCascasedSet(int index)
|
||||
{
|
||||
//0 = No, 2 = Two, 4 = Four
|
||||
QualitySettings.shadowCascades = index;
|
||||
}
|
||||
|
||||
public void TextureSet(int index)
|
||||
{
|
||||
// 0 = Full, 4 = Eight Resolution
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
QualitySettings.globalTextureMipmapLimit = index;
|
||||
#else
|
||||
QualitySettings.masterTextureLimit = index;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SoftParticleSet(int index)
|
||||
{
|
||||
if (index == 0)
|
||||
QualitySettings.softParticles = false;
|
||||
else if (index == 1)
|
||||
QualitySettings.softParticles = true;
|
||||
}
|
||||
|
||||
public void ReflectionSet(int index)
|
||||
{
|
||||
if (index == 0)
|
||||
QualitySettings.realtimeReflectionProbes = false;
|
||||
else if (index == 1)
|
||||
QualitySettings.realtimeReflectionProbes = true;
|
||||
}
|
||||
|
||||
public void VolumeSetMaster(float volume)
|
||||
{
|
||||
mixer.SetFloat("Master", Mathf.Log10(volume) * 20);
|
||||
}
|
||||
|
||||
public void VolumeSetMusic(float volume)
|
||||
{
|
||||
mixer.SetFloat("Music", Mathf.Log10(volume) * 20);
|
||||
}
|
||||
|
||||
public void VolumeSetSFX(float volume)
|
||||
{
|
||||
mixer.SetFloat("SFX", Mathf.Log10(volume) * 20);
|
||||
}
|
||||
|
||||
public void SetOverallQuality(int qualityIndex)
|
||||
{
|
||||
QualitySettings.SetQualityLevel(qualityIndex);
|
||||
}
|
||||
|
||||
public void WindowFullscreen()
|
||||
{
|
||||
Screen.fullScreen = true;
|
||||
Screen.fullScreenMode = FullScreenMode.ExclusiveFullScreen;
|
||||
}
|
||||
|
||||
public void WindowBorderless()
|
||||
{
|
||||
Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
|
||||
}
|
||||
|
||||
public void WindowWindowed()
|
||||
{
|
||||
Screen.fullScreen = false;
|
||||
Screen.fullScreenMode = FullScreenMode.Windowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6916e32cbfbb69408e0a98ac54cf42c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/QualityManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ScrollForMore : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public Scrollbar listScrollbar;
|
||||
private Animator SFMAnimator;
|
||||
|
||||
[Header("Settings")]
|
||||
public float fadeOutValue;
|
||||
public bool invertValue = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
SFMAnimator = gameObject.GetComponent<Animator>();
|
||||
CheckValue();
|
||||
}
|
||||
|
||||
public void CheckValue()
|
||||
{
|
||||
if(invertValue == false)
|
||||
{
|
||||
if (SFMAnimator != null && listScrollbar.value >= fadeOutValue)
|
||||
SFMAnimator.Play("SFM In");
|
||||
|
||||
else if (SFMAnimator != null && listScrollbar.value <= fadeOutValue)
|
||||
SFMAnimator.Play("SFM Out");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (SFMAnimator != null && listScrollbar.value <= fadeOutValue)
|
||||
SFMAnimator.Play("SFM In");
|
||||
|
||||
else if (SFMAnimator != null && listScrollbar.value >= fadeOutValue)
|
||||
SFMAnimator.Play("SFM Out");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb34e379e7cdce442bf8d77c28ca7f51
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/ScrollForMore.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(Image))]
|
||||
public class SpriteAnimator : MonoBehaviour
|
||||
{
|
||||
[SerializeField] List<Sprite> sprites = new();
|
||||
[SerializeField, Range(1, 120)] float frameRate = 24;
|
||||
|
||||
Image image;
|
||||
Coroutine animCoroutine;
|
||||
int currentFrame;
|
||||
float frameTimer;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
image = GetComponent<Image>();
|
||||
if (sprites.Count > 0 && sprites[0] != null)
|
||||
image.sprite = sprites[0];
|
||||
}
|
||||
|
||||
void OnEnable() => Play();
|
||||
|
||||
void OnDisable() => Stop();
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (sprites.Count < 2)
|
||||
return;
|
||||
|
||||
Stop();
|
||||
animCoroutine = StartCoroutine(Animate());
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (animCoroutine == null)
|
||||
return;
|
||||
|
||||
StopCoroutine(animCoroutine);
|
||||
animCoroutine = null;
|
||||
}
|
||||
|
||||
IEnumerator Animate()
|
||||
{
|
||||
float frameDuration = 1f / Mathf.Max(frameRate, 0.01f);
|
||||
|
||||
while (true)
|
||||
{
|
||||
frameTimer += Time.deltaTime;
|
||||
|
||||
while (frameTimer >= frameDuration)
|
||||
{
|
||||
frameTimer -= frameDuration;
|
||||
currentFrame = (currentFrame + 1) % sprites.Count;
|
||||
}
|
||||
|
||||
if (sprites[currentFrame] != null)
|
||||
image.sprite = sprites[currentFrame];
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15a6eb9cdcdf3164d9c38606fc4340b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/SpriteAnimator.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class UIElementInFront : MonoBehaviour
|
||||
{
|
||||
void Start()
|
||||
{
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64e621b5ded738546a4fd3e477587364
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Other/UIElementInFront.cs
|
||||
uploadId: 915518
|
||||
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Panel.meta
Normal file
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Panel.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaabc783c85a6b547b17bf3dee5d75b5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class FriendsPanelManager : MonoBehaviour
|
||||
{
|
||||
Animator windowAnimator;
|
||||
bool isOn = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
windowAnimator = gameObject.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
public void AnimateWindow()
|
||||
{
|
||||
if (isOn == false)
|
||||
{
|
||||
windowAnimator.CrossFade("Window In", 0.1f);
|
||||
isOn = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
windowAnimator.CrossFade("Window Out", 0.1f);
|
||||
isOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void WindowIn()
|
||||
{
|
||||
if (isOn == false)
|
||||
{
|
||||
windowAnimator.CrossFade("Window In", 0.1f);
|
||||
isOn = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void WindowOut()
|
||||
{
|
||||
if (isOn == true)
|
||||
{
|
||||
windowAnimator.CrossFade("Window Out", 0.1f);
|
||||
isOn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2f7c9540c6cd5a4198240c12dba77aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/FriendsPanelManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class MainPanelButtonParent : MonoBehaviour
|
||||
{
|
||||
private List<Animator> mainButtons = new List<Animator>();
|
||||
|
||||
void Awake()
|
||||
{
|
||||
foreach (Transform child in transform) { mainButtons.Add(child.GetComponent<Animator>()); }
|
||||
for (int i = 0; i < mainButtons.Count; ++i) { mainButtons[i].Play("Normal to Dissolve"); }
|
||||
|
||||
Canvas _canvas = gameObject.AddComponent<Canvas>();
|
||||
_canvas.overrideSorting = true;
|
||||
_canvas.sortingOrder = 999;
|
||||
gameObject.AddComponent<UnityEngine.UI.GraphicRaycaster>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48d691ddff0ccf545b3f6ca0647d5d2d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/MainPanelButtonParent.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,193 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class MainPanelManager : MonoBehaviour
|
||||
{
|
||||
[Header("Panel List")]
|
||||
public List<PanelItem> panels = new List<PanelItem>();
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] private bool useCulling = true;
|
||||
public int currentPanelIndex = 0;
|
||||
private int currentButtonIndex = 0;
|
||||
private int newPanelIndex;
|
||||
|
||||
private GameObject currentPanel;
|
||||
private GameObject nextPanel;
|
||||
private GameObject currentButton;
|
||||
private GameObject nextButton;
|
||||
|
||||
private Animator currentPanelAnimator;
|
||||
private Animator nextPanelAnimator;
|
||||
private Animator currentButtonAnimator;
|
||||
private Animator nextButtonAnimator;
|
||||
|
||||
string panelFadeIn = "Panel In";
|
||||
string panelFadeOut = "Panel Out";
|
||||
string buttonFadeIn = "Normal to Pressed";
|
||||
string buttonFadeOut = "Pressed to Dissolve";
|
||||
string buttonFadeNormal = "Pressed to Normal";
|
||||
|
||||
bool firstTime = true;
|
||||
|
||||
[System.Serializable]
|
||||
public class PanelItem
|
||||
{
|
||||
public string panelName;
|
||||
public GameObject panelObject;
|
||||
public GameObject buttonObject;
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (firstTime == false && nextPanelAnimator != null && nextPanelAnimator.gameObject.activeInHierarchy)
|
||||
{
|
||||
nextPanelAnimator.Play(panelFadeIn);
|
||||
nextButtonAnimator.Play(buttonFadeIn);
|
||||
}
|
||||
|
||||
else if (firstTime == false && currentPanelAnimator != null && currentPanelAnimator.gameObject.activeInHierarchy)
|
||||
{
|
||||
currentPanelAnimator.Play(panelFadeIn);
|
||||
currentButtonAnimator.Play(buttonFadeIn);
|
||||
}
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
currentButton = panels[currentPanelIndex].buttonObject;
|
||||
currentButtonAnimator = currentButton.GetComponent<Animator>();
|
||||
currentButtonAnimator.Play(buttonFadeIn);
|
||||
|
||||
currentPanel = panels[currentPanelIndex].panelObject;
|
||||
currentPanelAnimator = currentPanel.GetComponent<Animator>();
|
||||
currentPanelAnimator.Play(panelFadeIn);
|
||||
|
||||
firstTime = false;
|
||||
|
||||
if (useCulling == false)
|
||||
return;
|
||||
|
||||
StartCoroutine("DisablePreviousPanel");
|
||||
}
|
||||
|
||||
public void OpenFirstTab()
|
||||
{
|
||||
if (currentPanelIndex != 0)
|
||||
OpenPanel(panels[0].panelName);
|
||||
}
|
||||
|
||||
public void OpenPanel(string newPanel)
|
||||
{
|
||||
for (int i = 0; i < panels.Count; i++)
|
||||
{
|
||||
if (panels[i].panelName == newPanel)
|
||||
{
|
||||
newPanelIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newPanelIndex != currentPanelIndex)
|
||||
{
|
||||
StopCoroutine("DisablePreviousPanel");
|
||||
|
||||
currentPanel = panels[currentPanelIndex].panelObject;
|
||||
currentPanelIndex = newPanelIndex;
|
||||
nextPanel = panels[currentPanelIndex].panelObject;
|
||||
nextPanel.SetActive(true);
|
||||
|
||||
currentPanelAnimator = currentPanel.GetComponent<Animator>();
|
||||
nextPanelAnimator = nextPanel.GetComponent<Animator>();
|
||||
|
||||
currentPanelAnimator.Play(panelFadeOut);
|
||||
nextPanelAnimator.Play(panelFadeIn);
|
||||
|
||||
StartCoroutine("DisablePreviousPanel");
|
||||
|
||||
currentButton = panels[currentButtonIndex].buttonObject;
|
||||
currentButtonIndex = newPanelIndex;
|
||||
nextButton = panels[currentButtonIndex].buttonObject;
|
||||
|
||||
currentButtonAnimator = currentButton.GetComponent<Animator>();
|
||||
nextButtonAnimator = nextButton.GetComponent<Animator>();
|
||||
|
||||
currentButtonAnimator.Play(buttonFadeOut);
|
||||
nextButtonAnimator.Play(buttonFadeIn);
|
||||
}
|
||||
}
|
||||
|
||||
public void NextPage()
|
||||
{
|
||||
if (currentPanelIndex <= panels.Count - 2)
|
||||
{
|
||||
StopCoroutine("DisablePreviousPanel");
|
||||
|
||||
currentPanel = panels[currentPanelIndex].panelObject;
|
||||
currentButton = panels[currentButtonIndex].buttonObject;
|
||||
nextButton = panels[currentButtonIndex + 1].buttonObject;
|
||||
currentPanel.gameObject.SetActive(true);
|
||||
|
||||
currentPanelAnimator = currentPanel.GetComponent<Animator>();
|
||||
currentButtonAnimator = currentButton.GetComponent<Animator>();
|
||||
|
||||
currentButtonAnimator.Play(buttonFadeNormal);
|
||||
currentPanelAnimator.Play(panelFadeOut);
|
||||
|
||||
currentPanelIndex += 1;
|
||||
currentButtonIndex += 1;
|
||||
nextPanel = panels[currentPanelIndex].panelObject;
|
||||
nextPanel.gameObject.SetActive(true);
|
||||
|
||||
nextPanelAnimator = nextPanel.GetComponent<Animator>();
|
||||
nextButtonAnimator = nextButton.GetComponent<Animator>();
|
||||
nextPanelAnimator.Play(panelFadeIn);
|
||||
nextButtonAnimator.Play(buttonFadeIn);
|
||||
}
|
||||
}
|
||||
|
||||
public void PrevPage()
|
||||
{
|
||||
if (currentPanelIndex >= 1)
|
||||
{
|
||||
StopCoroutine("DisablePreviousPanel");
|
||||
|
||||
currentPanel = panels[currentPanelIndex].panelObject;
|
||||
currentButton = panels[currentButtonIndex].buttonObject;
|
||||
nextButton = panels[currentButtonIndex - 1].buttonObject;
|
||||
currentPanel.gameObject.SetActive(true);
|
||||
|
||||
currentPanelAnimator = currentPanel.GetComponent<Animator>();
|
||||
currentButtonAnimator = currentButton.GetComponent<Animator>();
|
||||
|
||||
currentButtonAnimator.Play(buttonFadeNormal);
|
||||
currentPanelAnimator.Play(panelFadeOut);
|
||||
|
||||
currentPanelIndex -= 1;
|
||||
currentButtonIndex -= 1;
|
||||
nextPanel = panels[currentPanelIndex].panelObject;
|
||||
nextPanel.gameObject.SetActive(true);
|
||||
|
||||
nextPanelAnimator = nextPanel.GetComponent<Animator>();
|
||||
nextButtonAnimator = nextButton.GetComponent<Animator>();
|
||||
nextPanelAnimator.Play(panelFadeIn);
|
||||
nextButtonAnimator.Play(buttonFadeIn);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator DisablePreviousPanel()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.5f);
|
||||
for (int i = 0; i < panels.Count; i++)
|
||||
{
|
||||
if (i == currentPanelIndex)
|
||||
continue;
|
||||
|
||||
panels[i].panelObject.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe03dc3b377156249a9334d486e47e91
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/MainPanelManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,73 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ModalWindowManager : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public TextMeshProUGUI windowTitle;
|
||||
public TextMeshProUGUI windowDescription;
|
||||
|
||||
[Header("Settings")]
|
||||
public bool sharpAnimations = false;
|
||||
public bool useCustomTexts = false;
|
||||
public string titleText = "Title";
|
||||
[TextArea] public string descriptionText = "Description here";
|
||||
|
||||
Animator mWindowAnimator;
|
||||
bool isOn = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
mWindowAnimator = gameObject.GetComponent<Animator>();
|
||||
|
||||
if (useCustomTexts == false)
|
||||
{
|
||||
windowTitle.text = titleText;
|
||||
windowDescription.text = descriptionText;
|
||||
}
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ModalWindowIn()
|
||||
{
|
||||
StopCoroutine("DisableWindow");
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (isOn == false)
|
||||
{
|
||||
if (sharpAnimations == false)
|
||||
mWindowAnimator.CrossFade("Window In", 0.1f);
|
||||
else
|
||||
mWindowAnimator.Play("Window In");
|
||||
|
||||
isOn = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ModalWindowOut()
|
||||
{
|
||||
if (isOn == true)
|
||||
{
|
||||
if (sharpAnimations == false)
|
||||
mWindowAnimator.CrossFade("Window Out", 0.1f);
|
||||
else
|
||||
mWindowAnimator.Play("Window Out");
|
||||
|
||||
isOn = false;
|
||||
}
|
||||
|
||||
StartCoroutine("DisableWindow");
|
||||
}
|
||||
|
||||
IEnumerator DisableWindow()
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b18e36b055152f41afbb464d8500cf7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/ModalWindowManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ServerBrowserManager : MonoBehaviour
|
||||
{
|
||||
Animator mWindowAnimator;
|
||||
bool isOn = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
mWindowAnimator = gameObject.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
public void ManageServerList()
|
||||
{
|
||||
if (isOn == false)
|
||||
{
|
||||
mWindowAnimator.CrossFade("List Minimize", 0.1f);
|
||||
isOn = true;
|
||||
}
|
||||
|
||||
else if (isOn == true)
|
||||
{
|
||||
mWindowAnimator.CrossFade("List Expand", 0.1f);
|
||||
isOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ExpandServerList()
|
||||
{
|
||||
if (isOn == true)
|
||||
{
|
||||
mWindowAnimator.CrossFade("List Expand", 0.1f);
|
||||
isOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void MinimizeServerList()
|
||||
{
|
||||
if (isOn == false)
|
||||
{
|
||||
mWindowAnimator.CrossFade("List Minimize", 0.1f);
|
||||
isOn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5ae44536018d2f4da4078d0349f4ed1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/ServerBrowserManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SplashScreenHelper : MonoBehaviour
|
||||
{
|
||||
public static bool showScreen = true;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd670d438cb60ef4985218759836aa34
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/SplashScreenHelper.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,93 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SplashScreenManager : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public GameObject splashScreen;
|
||||
public GameObject mainPanels;
|
||||
|
||||
private Animator splashScreenAnimator;
|
||||
private Animator mainPanelsAnimator;
|
||||
private TimedEvent ssTimedEvent;
|
||||
|
||||
[Header("Settings")]
|
||||
public bool disableSplashScreen;
|
||||
public bool enablePressAnyKeyScreen;
|
||||
public bool enableLoginScreen;
|
||||
public bool showOnlyOnce = true;
|
||||
|
||||
MainPanelManager mpm;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (showOnlyOnce && GameObject.Find("[Shift UI - Splash Screen Helper]") != null) { disableSplashScreen = true; }
|
||||
if (splashScreenAnimator == null) { splashScreenAnimator = splashScreen.GetComponent<Animator>(); }
|
||||
if (ssTimedEvent == null) { ssTimedEvent = splashScreen.GetComponent<TimedEvent>(); }
|
||||
if (mainPanelsAnimator == null) { mainPanelsAnimator = mainPanels.GetComponent<Animator>(); }
|
||||
if (mpm == null) { mpm = gameObject.GetComponent<MainPanelManager>(); }
|
||||
|
||||
if (disableSplashScreen == true)
|
||||
{
|
||||
splashScreen.SetActive(false);
|
||||
mainPanels.SetActive(true);
|
||||
|
||||
mainPanelsAnimator.Play("Start");
|
||||
mpm.OpenFirstTab();
|
||||
}
|
||||
|
||||
if (enableLoginScreen == false && enablePressAnyKeyScreen == true && disableSplashScreen == false)
|
||||
{
|
||||
splashScreen.SetActive(true);
|
||||
mainPanelsAnimator.Play("Invisible");
|
||||
}
|
||||
|
||||
if (enableLoginScreen == true && enablePressAnyKeyScreen == true && disableSplashScreen == false)
|
||||
{
|
||||
splashScreen.SetActive(true);
|
||||
mainPanelsAnimator.Play("Invisible");
|
||||
}
|
||||
|
||||
if (enableLoginScreen == true && enablePressAnyKeyScreen == false && disableSplashScreen == false)
|
||||
{
|
||||
splashScreen.SetActive(true);
|
||||
mainPanelsAnimator.Play("Invisible");
|
||||
splashScreenAnimator.Play("Login");
|
||||
}
|
||||
|
||||
if (enableLoginScreen == false && enablePressAnyKeyScreen == false && disableSplashScreen == false)
|
||||
{
|
||||
splashScreen.SetActive(true);
|
||||
mainPanelsAnimator.Play("Invisible");
|
||||
splashScreenAnimator.Play("Loading");
|
||||
ssTimedEvent.StartIEnumerator();
|
||||
}
|
||||
|
||||
if (showOnlyOnce == true && disableSplashScreen == false)
|
||||
{
|
||||
GameObject tempHelper = new GameObject();
|
||||
tempHelper.name = "[Shift UI - Splash Screen Helper]";
|
||||
DontDestroyOnLoad(tempHelper);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoginScreenCheck()
|
||||
{
|
||||
if (enableLoginScreen == true && enablePressAnyKeyScreen == true)
|
||||
splashScreenAnimator.Play("Press Any Key to Login");
|
||||
|
||||
else if (enableLoginScreen == false && enablePressAnyKeyScreen == true)
|
||||
{
|
||||
splashScreenAnimator.Play("Press Any Key to Loading");
|
||||
ssTimedEvent.StartIEnumerator();
|
||||
}
|
||||
|
||||
else if (enableLoginScreen == false && enablePressAnyKeyScreen == false)
|
||||
{
|
||||
splashScreenAnimator.Play("Loading");
|
||||
ssTimedEvent.StartIEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f87365a294fe01249a5225e69b4408ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Panel/SplashScreenManager.cs
|
||||
uploadId: 915518
|
||||
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Rendering.meta
Normal file
8
Assets/Shift - Complete Sci-Fi UI/Scripts/Rendering.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e314ebbee85dd79458a506eb783bdbb8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class BlurManager : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public Material blurMaterial;
|
||||
|
||||
[Header("Settings")]
|
||||
[Range(0.0f, 10)] public float blurValue = 5.0f;
|
||||
[Range(0.1f, 50)] public float animationSpeed = 25;
|
||||
public string customProperty = "_Size";
|
||||
|
||||
float currentBlurValue;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (customProperty == null)
|
||||
customProperty = "_Size";
|
||||
|
||||
blurMaterial.SetFloat(customProperty, 0);
|
||||
}
|
||||
|
||||
IEnumerator BlurIn()
|
||||
{
|
||||
currentBlurValue = blurMaterial.GetFloat(customProperty);
|
||||
|
||||
while (currentBlurValue <= blurValue)
|
||||
{
|
||||
currentBlurValue += Time.deltaTime * animationSpeed;
|
||||
|
||||
if (currentBlurValue >= blurValue)
|
||||
currentBlurValue = blurValue;
|
||||
|
||||
blurMaterial.SetFloat(customProperty, currentBlurValue);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
StopCoroutine("BlurIn");
|
||||
}
|
||||
|
||||
IEnumerator BlurOut()
|
||||
{
|
||||
currentBlurValue = blurMaterial.GetFloat(customProperty);
|
||||
|
||||
while (currentBlurValue >= 0)
|
||||
{
|
||||
currentBlurValue -= Time.deltaTime * animationSpeed;
|
||||
|
||||
if (currentBlurValue <= 0)
|
||||
currentBlurValue = 0;
|
||||
|
||||
blurMaterial.SetFloat(customProperty, currentBlurValue);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
StopCoroutine("BlurOut");
|
||||
}
|
||||
|
||||
public void BlurInAnim()
|
||||
{
|
||||
if (gameObject.activeInHierarchy == false)
|
||||
return;
|
||||
|
||||
StopCoroutine("BlurOut");
|
||||
StartCoroutine("BlurIn");
|
||||
}
|
||||
|
||||
public void BlurOutAnim()
|
||||
{
|
||||
if (gameObject.activeInHierarchy == false)
|
||||
return;
|
||||
|
||||
StopCoroutine("BlurIn");
|
||||
StartCoroutine("BlurOut");
|
||||
}
|
||||
|
||||
public void SetBlurValue(float cbv)
|
||||
{
|
||||
blurValue = cbv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6622d2cb114c7794789ae9db3cd3924c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Rendering/BlurManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,277 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class GradientEffect : BaseMeshEffect
|
||||
{
|
||||
[Header("Gradient Style")]
|
||||
[Tooltip("Gradient Direction")]
|
||||
[SerializeField] Direction m_Direction;
|
||||
|
||||
[Tooltip("Color1: Top or Left")]
|
||||
[SerializeField] Color m_Color1 = Color.white;
|
||||
|
||||
[Tooltip("Color2: Bottom or Right")]
|
||||
[SerializeField] Color m_Color2 = Color.white;
|
||||
|
||||
[Tooltip("Color3: For diagonal")]
|
||||
[SerializeField] Color m_Color3 = Color.white;
|
||||
|
||||
[Tooltip("Color4: For diagonal")]
|
||||
[SerializeField] Color m_Color4 = Color.white;
|
||||
|
||||
[Tooltip("Gradient rotation")]
|
||||
[SerializeField] [Range(-180, 180)] float m_Rotation;
|
||||
|
||||
[Tooltip("Gradient offset for Horizontal, Vertical or Angle")]
|
||||
[SerializeField] [Range(-1, 1)] float m_Offset1;
|
||||
|
||||
[Tooltip("Gradient offset for Diagonal")]
|
||||
[SerializeField] [Range(-1, 1)] float m_Offset2;
|
||||
|
||||
[Header("Settings")]
|
||||
[Tooltip("Gradient style for Text.")]
|
||||
[SerializeField] GradientStyle m_GradientStyle;
|
||||
|
||||
[Tooltip("Color space to correct color")]
|
||||
[SerializeField] ColorSpace m_ColorSpace = ColorSpace.Uninitialized;
|
||||
|
||||
[Tooltip("Ignore aspect ratio")]
|
||||
[SerializeField] bool m_IgnoreAspectRatio = true;
|
||||
|
||||
public Graphic TargetGraphic { get { return base.graphic; } }
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
Horizontal,
|
||||
Vertical,
|
||||
Angle,
|
||||
Diagonal,
|
||||
}
|
||||
|
||||
public enum GradientStyle
|
||||
{
|
||||
Rect,
|
||||
Fit,
|
||||
Split,
|
||||
}
|
||||
|
||||
public Direction DirectionMain
|
||||
{
|
||||
get { return m_Direction; }
|
||||
set
|
||||
{
|
||||
if (m_Direction != value)
|
||||
m_Direction = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color1
|
||||
{
|
||||
get { return m_Color1; }
|
||||
set
|
||||
{
|
||||
if (m_Color1 != value)
|
||||
m_Color1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color2
|
||||
{
|
||||
get { return m_Color2; }
|
||||
set
|
||||
{
|
||||
if (m_Color2 != value)
|
||||
m_Color2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color3
|
||||
{
|
||||
get { return m_Color3; }
|
||||
set
|
||||
{
|
||||
if (m_Color3 != value)
|
||||
m_Color3 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color4
|
||||
{
|
||||
get { return m_Color4; }
|
||||
set
|
||||
{
|
||||
if (m_Color4 != value)
|
||||
m_Color4 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Direction == Direction.Horizontal ? -90
|
||||
: m_Direction == Direction.Vertical ? 0
|
||||
: m_Rotation;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!Mathf.Approximately(m_Rotation, value))
|
||||
m_Rotation = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Offset
|
||||
{
|
||||
get { return m_Offset1; }
|
||||
set
|
||||
{
|
||||
if (m_Offset1 != value)
|
||||
m_Offset1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 Offset2
|
||||
{
|
||||
get { return new Vector2(m_Offset2, m_Offset1); }
|
||||
set
|
||||
{
|
||||
if (m_Offset1 != value.y || m_Offset2 != value.x)
|
||||
{
|
||||
m_Offset1 = value.y;
|
||||
m_Offset2 = value.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GradientStyle GradientStyleMain
|
||||
{
|
||||
get { return m_GradientStyle; }
|
||||
set
|
||||
{
|
||||
if (m_GradientStyle != value)
|
||||
m_GradientStyle = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ColorSpace ColorSpace
|
||||
{
|
||||
get { return m_ColorSpace; }
|
||||
set
|
||||
{
|
||||
if (m_ColorSpace != value)
|
||||
m_ColorSpace = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IgnoreAspectRatio
|
||||
{
|
||||
get { return m_IgnoreAspectRatio; }
|
||||
set
|
||||
{
|
||||
if (m_IgnoreAspectRatio != value)
|
||||
m_IgnoreAspectRatio = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
if (!IsActive())
|
||||
return;
|
||||
|
||||
Rect rect = default(Rect);
|
||||
UIVertex vertex = default(UIVertex);
|
||||
|
||||
if (m_GradientStyle == GradientStyle.Rect)
|
||||
rect = graphic.rectTransform.rect;
|
||||
|
||||
else if (m_GradientStyle == GradientStyle.Split)
|
||||
rect.Set(0, 0, 1, 1);
|
||||
|
||||
else if (m_GradientStyle == GradientStyle.Fit)
|
||||
{
|
||||
rect.xMin = rect.yMin = float.MaxValue;
|
||||
rect.xMax = rect.yMax = float.MinValue;
|
||||
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
rect.xMin = Mathf.Min(rect.xMin, vertex.position.x);
|
||||
rect.yMin = Mathf.Min(rect.yMin, vertex.position.y);
|
||||
rect.xMax = Mathf.Max(rect.xMax, vertex.position.x);
|
||||
rect.yMax = Mathf.Max(rect.yMax, vertex.position.y);
|
||||
}
|
||||
}
|
||||
|
||||
float rad = Rotation * Mathf.Deg2Rad;
|
||||
Vector2 dir = new Vector2(Mathf.Cos(rad), Mathf.Sin(rad));
|
||||
|
||||
if (!m_IgnoreAspectRatio && Direction.Angle <= m_Direction)
|
||||
{
|
||||
dir.x *= rect.height / rect.width;
|
||||
dir = dir.normalized;
|
||||
}
|
||||
|
||||
Color color;
|
||||
Vector2 nomalizedPos;
|
||||
Matrix2x3 localMatrix = new Matrix2x3(rect, dir.x, dir.y);
|
||||
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
|
||||
if (m_GradientStyle == GradientStyle.Split)
|
||||
nomalizedPos = localMatrix * s_SplitedCharacterPosition[i % 4] + Offset2;
|
||||
|
||||
else
|
||||
nomalizedPos = localMatrix * vertex.position + Offset2;
|
||||
|
||||
if (DirectionMain == Direction.Diagonal)
|
||||
{
|
||||
color = Color.LerpUnclamped(
|
||||
Color.LerpUnclamped(m_Color1, m_Color2, nomalizedPos.x),
|
||||
Color.LerpUnclamped(m_Color3, m_Color4, nomalizedPos.x),
|
||||
nomalizedPos.y);
|
||||
}
|
||||
|
||||
else
|
||||
color = Color.LerpUnclamped(m_Color2, m_Color1, nomalizedPos.y);
|
||||
|
||||
vertex.color *= (m_ColorSpace == ColorSpace.Gamma) ? color.gamma
|
||||
: (m_ColorSpace == ColorSpace.Linear) ? color.linear
|
||||
: color;
|
||||
|
||||
vh.SetUIVertex(vertex, i);
|
||||
}
|
||||
}
|
||||
|
||||
static readonly Vector2[] s_SplitedCharacterPosition = { Vector2.up, Vector2.one, Vector2.right, Vector2.zero };
|
||||
|
||||
struct Matrix2x3
|
||||
{
|
||||
public float m00, m01, m02, m10, m11, m12;
|
||||
|
||||
public Matrix2x3(Rect rect, float cos, float sin)
|
||||
{
|
||||
const float center = 0.5f;
|
||||
float dx = -rect.xMin / rect.width - center;
|
||||
float dy = -rect.yMin / rect.height - center;
|
||||
m00 = cos / rect.width;
|
||||
m01 = -sin / rect.height;
|
||||
m02 = dx * cos - dy * sin + center;
|
||||
m10 = sin / rect.width;
|
||||
m11 = cos / rect.height;
|
||||
m12 = dx * sin + dy * cos + center;
|
||||
}
|
||||
|
||||
public static Vector2 operator *(Matrix2x3 m, Vector2 v)
|
||||
{
|
||||
return new Vector2(
|
||||
(m.m00 * v.x) + (m.m01 * v.y) + m.m02,
|
||||
(m.m10 * v.x) + (m.m11 * v.y) + m.m12
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9244185ea7b8c40459faea55ff92b26f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Rendering/GradientEffect.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,293 @@
|
||||
// This class is a modification on the class shared publicly by Glenn Powell (glennpow) that can be found here
|
||||
// http://forum.unity3d.com/threads/free-script-particle-systems-in-ui-screen-space-overlay.406862/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(CanvasRenderer))]
|
||||
[RequireComponent(typeof(ParticleSystem))]
|
||||
public class UIParticleRenderer : MaskableGraphic
|
||||
{
|
||||
[Tooltip("Having this enabled run the system in LateUpdate rather than in Update making it faster but less precise (more clunky)")]
|
||||
public bool fixedTime = true;
|
||||
|
||||
private Transform _transform;
|
||||
private ParticleSystem pSystem;
|
||||
private ParticleSystem.Particle[] particles;
|
||||
private UIVertex[] _quad = new UIVertex[4];
|
||||
private Vector4 imageUV = Vector4.zero;
|
||||
private ParticleSystem.TextureSheetAnimationModule textureSheetAnimation;
|
||||
private int textureSheetAnimationFrames;
|
||||
private Vector2 textureSheetAnimationFrameSize;
|
||||
private ParticleSystemRenderer pRenderer;
|
||||
|
||||
private Material currentMaterial;
|
||||
private Texture currentTexture;
|
||||
private ParticleSystem.MainModule mainModule;
|
||||
|
||||
public override Texture mainTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentTexture;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool Initialize()
|
||||
{
|
||||
// initialize members
|
||||
if (_transform == null)
|
||||
{
|
||||
_transform = transform;
|
||||
}
|
||||
if (pSystem == null)
|
||||
{
|
||||
pSystem = GetComponent<ParticleSystem>();
|
||||
|
||||
if (pSystem == null)
|
||||
return false;
|
||||
|
||||
mainModule = pSystem.main;
|
||||
|
||||
if (pSystem.main.maxParticles > 14000)
|
||||
{
|
||||
mainModule.maxParticles = 14000;
|
||||
}
|
||||
|
||||
pRenderer = pSystem.GetComponent<ParticleSystemRenderer>();
|
||||
|
||||
if (pRenderer != null)
|
||||
pRenderer.enabled = false;
|
||||
|
||||
Shader foundShader = Shader.Find("UI/Particles/Additive");
|
||||
Material pMaterial = new Material(foundShader);
|
||||
|
||||
if (material == null)
|
||||
material = pMaterial;
|
||||
|
||||
currentMaterial = material;
|
||||
|
||||
if (currentMaterial && currentMaterial.HasProperty("_MainTex"))
|
||||
{
|
||||
currentTexture = currentMaterial.mainTexture;
|
||||
if (currentTexture == null)
|
||||
currentTexture = Texture2D.whiteTexture;
|
||||
}
|
||||
|
||||
material = currentMaterial;
|
||||
// automatically set scaling
|
||||
mainModule.scalingMode = ParticleSystemScalingMode.Hierarchy;
|
||||
particles = null;
|
||||
}
|
||||
|
||||
if (particles == null)
|
||||
particles = new ParticleSystem.Particle[pSystem.main.maxParticles];
|
||||
|
||||
imageUV = new Vector4(0, 0, 1, 1);
|
||||
|
||||
// prepare texture sheet animation
|
||||
textureSheetAnimation = pSystem.textureSheetAnimation;
|
||||
textureSheetAnimationFrames = 0;
|
||||
textureSheetAnimationFrameSize = Vector2.zero;
|
||||
|
||||
if (textureSheetAnimation.enabled)
|
||||
{
|
||||
textureSheetAnimationFrames = textureSheetAnimation.numTilesX * textureSheetAnimation.numTilesY;
|
||||
textureSheetAnimationFrameSize = new Vector2(1f / textureSheetAnimation.numTilesX, 1f / textureSheetAnimation.numTilesY);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
if (!Initialize())
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPopulateMesh(VertexHelper vh)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
if (!Initialize())
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// prepare vertices
|
||||
vh.Clear();
|
||||
|
||||
if (!gameObject.activeInHierarchy)
|
||||
return;
|
||||
|
||||
Vector2 temp = Vector2.zero;
|
||||
Vector2 corner1 = Vector2.zero;
|
||||
Vector2 corner2 = Vector2.zero;
|
||||
// iterate through current particles
|
||||
int count = pSystem.GetParticles(particles);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
ParticleSystem.Particle particle = particles[i];
|
||||
|
||||
// get particle properties
|
||||
Vector2 position = (mainModule.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
||||
|
||||
float rotation = -particle.rotation * Mathf.Deg2Rad;
|
||||
float rotation90 = rotation + Mathf.PI / 2;
|
||||
Color32 color = particle.GetCurrentColor(pSystem);
|
||||
float size = particle.GetCurrentSize(pSystem) * 0.5f;
|
||||
|
||||
// apply scale
|
||||
if (mainModule.scalingMode == ParticleSystemScalingMode.Shape)
|
||||
position /= canvas.scaleFactor;
|
||||
|
||||
// apply texture sheet animation
|
||||
Vector4 particleUV = imageUV;
|
||||
if (textureSheetAnimation.enabled)
|
||||
{
|
||||
float frameProgress = textureSheetAnimation.frameOverTime.curveMin.Evaluate(1 - (particle.remainingLifetime / particle.startLifetime));
|
||||
|
||||
frameProgress = Mathf.Repeat(frameProgress * textureSheetAnimation.cycleCount, 1);
|
||||
int frame = 0;
|
||||
|
||||
switch (textureSheetAnimation.animation)
|
||||
{
|
||||
|
||||
case ParticleSystemAnimationType.WholeSheet:
|
||||
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimationFrames);
|
||||
break;
|
||||
|
||||
case ParticleSystemAnimationType.SingleRow:
|
||||
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimation.numTilesX);
|
||||
|
||||
int row = textureSheetAnimation.rowIndex;
|
||||
// if (textureSheetAnimation.useRandomRow) { // FIXME - is this handled internally by rowIndex?
|
||||
// row = Random.Range(0, textureSheetAnimation.numTilesY, using: particle.randomSeed);
|
||||
// }
|
||||
frame += row * textureSheetAnimation.numTilesX;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
frame %= textureSheetAnimationFrames;
|
||||
particleUV.x = (frame % textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.x;
|
||||
particleUV.y = Mathf.FloorToInt(frame / textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.y;
|
||||
particleUV.z = particleUV.x + textureSheetAnimationFrameSize.x;
|
||||
particleUV.w = particleUV.y + textureSheetAnimationFrameSize.y;
|
||||
}
|
||||
|
||||
temp.x = particleUV.x;
|
||||
temp.y = particleUV.y;
|
||||
|
||||
_quad[0] = UIVertex.simpleVert;
|
||||
_quad[0].color = color;
|
||||
_quad[0].uv0 = temp;
|
||||
|
||||
temp.x = particleUV.x;
|
||||
temp.y = particleUV.w;
|
||||
_quad[1] = UIVertex.simpleVert;
|
||||
_quad[1].color = color;
|
||||
_quad[1].uv0 = temp;
|
||||
|
||||
temp.x = particleUV.z;
|
||||
temp.y = particleUV.w;
|
||||
_quad[2] = UIVertex.simpleVert;
|
||||
_quad[2].color = color;
|
||||
_quad[2].uv0 = temp;
|
||||
|
||||
temp.x = particleUV.z;
|
||||
temp.y = particleUV.y;
|
||||
_quad[3] = UIVertex.simpleVert;
|
||||
_quad[3].color = color;
|
||||
_quad[3].uv0 = temp;
|
||||
|
||||
if (rotation == 0)
|
||||
{
|
||||
// no rotation
|
||||
corner1.x = position.x - size;
|
||||
corner1.y = position.y - size;
|
||||
corner2.x = position.x + size;
|
||||
corner2.y = position.y + size;
|
||||
|
||||
temp.x = corner1.x;
|
||||
temp.y = corner1.y;
|
||||
_quad[0].position = temp;
|
||||
temp.x = corner1.x;
|
||||
temp.y = corner2.y;
|
||||
_quad[1].position = temp;
|
||||
temp.x = corner2.x;
|
||||
temp.y = corner2.y;
|
||||
_quad[2].position = temp;
|
||||
temp.x = corner2.x;
|
||||
temp.y = corner1.y;
|
||||
_quad[3].position = temp;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// apply rotation
|
||||
Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size;
|
||||
Vector2 up = new Vector2(Mathf.Cos(rotation90), Mathf.Sin(rotation90)) * size;
|
||||
|
||||
_quad[0].position = position - right - up;
|
||||
_quad[1].position = position - right + up;
|
||||
_quad[2].position = position + right + up;
|
||||
_quad[3].position = position + right - up;
|
||||
}
|
||||
|
||||
vh.AddUIVertexQuad(_quad);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!fixedTime && Application.isPlaying)
|
||||
{
|
||||
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true);
|
||||
SetAllDirty();
|
||||
|
||||
if ((currentMaterial != null && currentTexture != currentMaterial.mainTexture) ||
|
||||
(material != null && currentMaterial != null && material.shader != currentMaterial.shader))
|
||||
{
|
||||
pSystem = null;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
SetAllDirty();
|
||||
|
||||
else
|
||||
{
|
||||
if (fixedTime)
|
||||
{
|
||||
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true);
|
||||
SetAllDirty();
|
||||
|
||||
if ((currentMaterial != null && currentTexture != currentMaterial.mainTexture) ||
|
||||
(material != null && currentMaterial != null && material.shader != currentMaterial.shader))
|
||||
{
|
||||
pSystem = null;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (material == currentMaterial)
|
||||
return;
|
||||
|
||||
pSystem = null;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50bd9175b683c0d44a7f2e04e4be3c5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/Rendering/UIParticleRenderer.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcccfdceb24998d4f9eabe4a1a47247d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class CustomInputField : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
[Header("Resources")]
|
||||
public GameObject fieldTrigger;
|
||||
private TMP_InputField inputText;
|
||||
private Animator inputFieldAnimator;
|
||||
|
||||
// [Header("Settings")]
|
||||
bool isEmpty = true;
|
||||
bool isClicked = false;
|
||||
string inAnim = "In";
|
||||
string outAnim = "Out";
|
||||
|
||||
void Start()
|
||||
{
|
||||
inputFieldAnimator = gameObject.GetComponent<Animator>();
|
||||
inputText = gameObject.GetComponent<TMP_InputField>();
|
||||
|
||||
// Check if text is empty or not
|
||||
if (inputText.text.Length == 0 || inputText.text.Length <= 0)
|
||||
isEmpty = true;
|
||||
|
||||
else
|
||||
isEmpty = false;
|
||||
|
||||
// Animate if it's empty
|
||||
if (isEmpty == true)
|
||||
inputFieldAnimator.Play(outAnim);
|
||||
|
||||
else
|
||||
inputFieldAnimator.Play(inAnim);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (inputText.text.Length == 1 || inputText.text.Length >= 1)
|
||||
{
|
||||
isEmpty = false;
|
||||
inputFieldAnimator.Play(inAnim);
|
||||
}
|
||||
|
||||
else if (isClicked == false)
|
||||
inputFieldAnimator.Play(outAnim);
|
||||
}
|
||||
|
||||
public void Animate()
|
||||
{
|
||||
isClicked = true;
|
||||
inputFieldAnimator.Play(inAnim);
|
||||
fieldTrigger.SetActive(true);
|
||||
}
|
||||
|
||||
public void FieldTrigger()
|
||||
{
|
||||
if (isEmpty == true)
|
||||
{
|
||||
inputFieldAnimator.Play(outAnim);
|
||||
fieldTrigger.SetActive(false);
|
||||
isClicked = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fieldTrigger.SetActive(false);
|
||||
isClicked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
Animate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72c13cfb118586343862bc13eb5c5a51
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Element/CustomInputField.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,321 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class HorizontalSelector : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
public int defaultIndex = 0;
|
||||
public bool invokeAtStart;
|
||||
public bool invertAnimation;
|
||||
public bool loopSelection;
|
||||
[HideInInspector] public int index = 0;
|
||||
|
||||
[Header("Saving")]
|
||||
public bool saveValue;
|
||||
public string selectorTag = "Tag Text";
|
||||
|
||||
[Header("Indicators")]
|
||||
public bool enableIndicators = true;
|
||||
public Transform indicatorParent;
|
||||
public GameObject indicatorObject;
|
||||
|
||||
[Header("Items")]
|
||||
public List<Item> itemList = new List<Item>();
|
||||
|
||||
private TextMeshProUGUI label;
|
||||
private TextMeshProUGUI labeHelper;
|
||||
private Animator selectorAnimator;
|
||||
string newItemTitle;
|
||||
|
||||
[System.Serializable]
|
||||
public class Item
|
||||
{
|
||||
public string itemTitle = "Item Title";
|
||||
public UnityEvent onValueChanged = new UnityEvent();
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
selectorAnimator = gameObject.GetComponent<Animator>();
|
||||
label = transform.Find("Text").GetComponent<TextMeshProUGUI>();
|
||||
labeHelper = transform.Find("Text Helper").GetComponent<TextMeshProUGUI>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (saveValue == true)
|
||||
{
|
||||
if (PlayerPrefs.HasKey(selectorTag + "HSelectorValue") == true) { defaultIndex = PlayerPrefs.GetInt(selectorTag + "HSelectorValue"); }
|
||||
else { PlayerPrefs.SetInt(selectorTag + "HSelectorValue", defaultIndex); }
|
||||
}
|
||||
|
||||
label.text = itemList[defaultIndex].itemTitle;
|
||||
labeHelper.text = label.text;
|
||||
index = defaultIndex;
|
||||
|
||||
if(enableIndicators == true)
|
||||
{
|
||||
foreach (Transform child in indicatorParent)
|
||||
Destroy(child.gameObject);
|
||||
|
||||
for (int i = 0; i < itemList.Count; ++i)
|
||||
{
|
||||
GameObject go = Instantiate(indicatorObject, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
|
||||
go.transform.SetParent(indicatorParent, false);
|
||||
go.name = itemList[i].itemTitle;
|
||||
|
||||
Transform onObj;
|
||||
onObj = go.transform.Find("On");
|
||||
Transform offObj;
|
||||
offObj = go.transform.Find("Off");
|
||||
|
||||
if (i == index)
|
||||
{
|
||||
onObj.gameObject.SetActive(true);
|
||||
offObj.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
onObj.gameObject.SetActive(false);
|
||||
offObj.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Destroy(indicatorParent);
|
||||
}
|
||||
|
||||
if (invokeAtStart == true)
|
||||
itemList[index].onValueChanged.Invoke();
|
||||
}
|
||||
|
||||
public void PreviousClick()
|
||||
{
|
||||
if (loopSelection == false)
|
||||
{
|
||||
if (index != 0)
|
||||
{
|
||||
labeHelper.text = label.text;
|
||||
|
||||
if (index == 0)
|
||||
index = itemList.Count - 1;
|
||||
|
||||
else
|
||||
index--;
|
||||
|
||||
label.text = itemList[index].itemTitle;
|
||||
|
||||
try { itemList[index].onValueChanged.Invoke(); }
|
||||
|
||||
catch { }
|
||||
|
||||
selectorAnimator.Play(null);
|
||||
selectorAnimator.StopPlayback();
|
||||
|
||||
if (invertAnimation == true)
|
||||
selectorAnimator.Play("Forward");
|
||||
else
|
||||
selectorAnimator.Play("Previous");
|
||||
|
||||
if (saveValue == true)
|
||||
PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
labeHelper.text = label.text;
|
||||
|
||||
if (index == 0)
|
||||
index = itemList.Count - 1;
|
||||
|
||||
else
|
||||
index--;
|
||||
|
||||
label.text = itemList[index].itemTitle;
|
||||
|
||||
try { itemList[index].onValueChanged.Invoke(); }
|
||||
catch { }
|
||||
|
||||
selectorAnimator.Play(null);
|
||||
selectorAnimator.StopPlayback();
|
||||
|
||||
if (invertAnimation == true)
|
||||
selectorAnimator.Play("Forward");
|
||||
else
|
||||
selectorAnimator.Play("Previous");
|
||||
|
||||
if (saveValue == true)
|
||||
PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index);
|
||||
}
|
||||
|
||||
if (saveValue == true)
|
||||
PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index);
|
||||
|
||||
if (enableIndicators == true)
|
||||
{
|
||||
for (int i = 0; i < itemList.Count; ++i)
|
||||
{
|
||||
GameObject go = indicatorParent.GetChild(i).gameObject;
|
||||
|
||||
Transform onObj;
|
||||
onObj = go.transform.Find("On");
|
||||
Transform offObj;
|
||||
offObj = go.transform.Find("Off");
|
||||
|
||||
if (i == index)
|
||||
{
|
||||
onObj.gameObject.SetActive(true);
|
||||
offObj.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
onObj.gameObject.SetActive(false);
|
||||
offObj.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ForwardClick()
|
||||
{
|
||||
if (loopSelection == false)
|
||||
{
|
||||
if (index != itemList.Count - 1)
|
||||
{
|
||||
labeHelper.text = label.text;
|
||||
|
||||
if ((index + 1) >= itemList.Count)
|
||||
index = 0;
|
||||
else
|
||||
index++;
|
||||
|
||||
label.text = itemList[index].itemTitle;
|
||||
|
||||
try { itemList[index].onValueChanged.Invoke(); }
|
||||
catch { }
|
||||
|
||||
selectorAnimator.Play(null);
|
||||
selectorAnimator.StopPlayback();
|
||||
|
||||
if (invertAnimation == true)
|
||||
selectorAnimator.Play("Previous");
|
||||
else
|
||||
selectorAnimator.Play("Forward");
|
||||
|
||||
if (saveValue == true)
|
||||
PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
labeHelper.text = label.text;
|
||||
|
||||
if ((index + 1) >= itemList.Count)
|
||||
index = 0;
|
||||
else
|
||||
index++;
|
||||
|
||||
label.text = itemList[index].itemTitle;
|
||||
|
||||
try { itemList[index].onValueChanged.Invoke(); }
|
||||
catch { }
|
||||
|
||||
selectorAnimator.Play(null);
|
||||
selectorAnimator.StopPlayback();
|
||||
|
||||
if (invertAnimation == true)
|
||||
selectorAnimator.Play("Previous");
|
||||
else
|
||||
selectorAnimator.Play("Forward");
|
||||
|
||||
if (saveValue == true)
|
||||
PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index);
|
||||
}
|
||||
|
||||
if (saveValue == true)
|
||||
PlayerPrefs.SetInt(selectorTag + "HSelectorValue", index);
|
||||
|
||||
if (enableIndicators == true)
|
||||
{
|
||||
for (int i = 0; i < itemList.Count; ++i)
|
||||
{
|
||||
GameObject go = indicatorParent.GetChild(i).gameObject;
|
||||
|
||||
Transform onObj;
|
||||
onObj = go.transform.Find("On");
|
||||
Transform offObj;
|
||||
offObj = go.transform.Find("Off");
|
||||
|
||||
if (i == index)
|
||||
{
|
||||
onObj.gameObject.SetActive(true);
|
||||
offObj.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
onObj.gameObject.SetActive(false);
|
||||
offObj.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateNewItem(string title)
|
||||
{
|
||||
Item item = new Item();
|
||||
newItemTitle = title;
|
||||
item.itemTitle = newItemTitle;
|
||||
itemList.Add(item);
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
if (label == null || itemList.Count < index)
|
||||
return;
|
||||
|
||||
label.text = itemList[index].itemTitle;
|
||||
|
||||
if (enableIndicators == true)
|
||||
{
|
||||
foreach (Transform child in indicatorParent)
|
||||
Destroy(child.gameObject);
|
||||
|
||||
for (int i = 0; i < itemList.Count; ++i)
|
||||
{
|
||||
GameObject go = Instantiate(indicatorObject, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
|
||||
go.transform.SetParent(indicatorParent, false);
|
||||
go.name = itemList[i].itemTitle;
|
||||
|
||||
Transform onObj;
|
||||
onObj = go.transform.Find("On");
|
||||
Transform offObj;
|
||||
offObj = go.transform.Find("Off");
|
||||
|
||||
if (i == index)
|
||||
{
|
||||
onObj.gameObject.SetActive(true);
|
||||
offObj.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
onObj.gameObject.SetActive(false);
|
||||
offObj.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afd9f0db1bab82342b807fa026af05bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Element/HorizontalSelector.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SliderManager : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public TextMeshProUGUI valueText;
|
||||
|
||||
[Header("Saving")]
|
||||
public bool enableSaving = false;
|
||||
public string sliderTag = "Tag Text";
|
||||
public float defaultValue = 1;
|
||||
|
||||
[Header("Settings")]
|
||||
public bool usePercent = false;
|
||||
public bool showValue = true;
|
||||
public bool useRoundValue = false;
|
||||
|
||||
Slider mainSlider;
|
||||
float saveValue;
|
||||
|
||||
void Start()
|
||||
{
|
||||
mainSlider = gameObject.GetComponent<Slider>();
|
||||
|
||||
if (showValue == false)
|
||||
valueText.enabled = false;
|
||||
|
||||
if (enableSaving == true)
|
||||
{
|
||||
if (PlayerPrefs.HasKey(sliderTag + "SliderValue") == false)
|
||||
saveValue = defaultValue;
|
||||
else
|
||||
saveValue = PlayerPrefs.GetFloat(sliderTag + "SliderValue");
|
||||
|
||||
mainSlider.value = saveValue;
|
||||
|
||||
mainSlider.onValueChanged.AddListener(delegate
|
||||
{
|
||||
saveValue = mainSlider.value;
|
||||
PlayerPrefs.SetFloat(sliderTag + "SliderValue", saveValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (useRoundValue == true)
|
||||
{
|
||||
if (usePercent == true)
|
||||
valueText.text = Mathf.Round(mainSlider.value * 1.0f).ToString() + "%";
|
||||
else
|
||||
valueText.text = Mathf.Round(mainSlider.value * 1.0f).ToString();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (usePercent == true)
|
||||
valueText.text = mainSlider.value.ToString("F1") + "%";
|
||||
else
|
||||
valueText.text = mainSlider.value.ToString("F1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 460f5344b1de4b94494a9df2d9fa9415
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Element/SliderManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SwitchHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private SwitchManager switchSource;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (switchSource == null)
|
||||
{
|
||||
try { switchSource = gameObject.GetComponent<SwitchManager>(); }
|
||||
catch { Debug.Log("Switch Source is not assigned.", this); }
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOn()
|
||||
{
|
||||
switchSource.isOn = true;
|
||||
switchSource.switchAnimator.Play("Switch On");
|
||||
switchSource.OnEvents.Invoke();
|
||||
}
|
||||
|
||||
public void SetOff()
|
||||
{
|
||||
switchSource.isOn = false;
|
||||
switchSource.switchAnimator.Play("Switch Off");
|
||||
switchSource.OffEvents.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e151f488434a7044a8e974927bd7973
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Element/SwitchHandler.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,89 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class SwitchManager : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
[Tooltip("Each switch must have a different tag")]
|
||||
public string switchTag = "Switch";
|
||||
public bool isOn = true;
|
||||
public bool saveValue = true;
|
||||
public bool invokeAtStart = true;
|
||||
|
||||
[Header("Events")]
|
||||
public UnityEvent OnEvents;
|
||||
public UnityEvent OffEvents;
|
||||
|
||||
[HideInInspector] public Animator switchAnimator;
|
||||
Button switchButton;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (switchAnimator == null) { switchAnimator = gameObject.GetComponent<Animator>(); }
|
||||
if (switchButton == null) { switchButton = gameObject.GetComponent<Button>(); switchButton.onClick.AddListener(AnimateSwitch); }
|
||||
|
||||
if (saveValue == true)
|
||||
{
|
||||
if (PlayerPrefs.GetString(switchTag + "Switch") == "")
|
||||
{
|
||||
if (isOn == true)
|
||||
{
|
||||
switchAnimator.Play("Switch On");
|
||||
isOn = true;
|
||||
PlayerPrefs.SetString(switchTag + "Switch", "true");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
switchAnimator.Play("Switch Off");
|
||||
isOn = false;
|
||||
PlayerPrefs.SetString(switchTag + "Switch", "false");
|
||||
}
|
||||
}
|
||||
|
||||
else if (PlayerPrefs.GetString(switchTag + "Switch") == "true")
|
||||
{
|
||||
switchAnimator.Play("Switch On");
|
||||
isOn = true;
|
||||
}
|
||||
|
||||
else if (PlayerPrefs.GetString(switchTag + "Switch") == "false")
|
||||
{
|
||||
switchAnimator.Play("Switch Off");
|
||||
isOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (isOn == true) { switchAnimator.Play("Switch On"); isOn = true; }
|
||||
else { switchAnimator.Play("Switch Off"); isOn = false; }
|
||||
}
|
||||
|
||||
if (invokeAtStart == true && isOn == true) { OnEvents.Invoke(); }
|
||||
if (invokeAtStart == true && isOn == false) { OffEvents.Invoke(); }
|
||||
}
|
||||
|
||||
public void AnimateSwitch()
|
||||
{
|
||||
if (isOn == true)
|
||||
{
|
||||
switchAnimator.Play("Switch Off");
|
||||
isOn = false;
|
||||
OffEvents.Invoke();
|
||||
if (saveValue == true) { PlayerPrefs.SetString(switchTag + "Switch", "false"); }
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
switchAnimator.Play("Switch On");
|
||||
isOn = true;
|
||||
OnEvents.Invoke();
|
||||
if (saveValue == true) { PlayerPrefs.SetString(switchTag + "Switch", "true"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6da11cb47bb4c1741a0a450e9dd1e54f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Element/SwitchManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,66 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class UIElementSound : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler
|
||||
{
|
||||
[Header("Resources")]
|
||||
public UIManager UIManagerAsset;
|
||||
public AudioSource audioObject;
|
||||
|
||||
[Header("Custom SFX")]
|
||||
public AudioClip hoverSFX;
|
||||
public AudioClip clickSFX;
|
||||
|
||||
[Header("Settings")]
|
||||
public bool enableHoverSound = true;
|
||||
public bool enableClickSound = true;
|
||||
public bool checkForInteraction = true;
|
||||
|
||||
private Button sourceButton;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (UIManagerAsset == null)
|
||||
{
|
||||
try { UIManagerAsset = Resources.Load<UIManager>("Shift UI Manager"); }
|
||||
catch { Debug.Log("<b>[UI Element Sound]</b> No UI Manager found.", this); this.enabled = false; }
|
||||
}
|
||||
|
||||
if (Application.isPlaying == true && audioObject == null)
|
||||
{
|
||||
try { audioObject = GameObject.Find("UI Audio").GetComponent<AudioSource>(); }
|
||||
catch { Debug.Log("<b>[UI Element Sound]</b> No Audio Source found.", this); }
|
||||
}
|
||||
|
||||
if (checkForInteraction == true) { sourceButton = gameObject.GetComponent<Button>(); }
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (checkForInteraction == true && sourceButton != null && sourceButton.interactable == false)
|
||||
return;
|
||||
|
||||
if (enableHoverSound == true)
|
||||
{
|
||||
if (hoverSFX == null) { audioObject.PlayOneShot(UIManagerAsset.hoverSound); }
|
||||
else { audioObject.PlayOneShot(hoverSFX); }
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (checkForInteraction == true && sourceButton != null && sourceButton.interactable == false)
|
||||
return;
|
||||
|
||||
if (enableClickSound == true)
|
||||
{
|
||||
if (clickSFX == null) { audioObject.PlayOneShot(UIManagerAsset.clickSound); }
|
||||
else { audioObject.PlayOneShot(clickSFX); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fad88e459dfc77c4dbcbaff69c5e05a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Element/UIElementSound.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 675fc67ecd6e4db42b433d537e0e385e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[CreateAssetMenu(fileName = "New UI Manager", menuName = "Shift UI/New UI Manager")]
|
||||
public class UIManager : ScriptableObject
|
||||
{
|
||||
[HideInInspector] public bool enableDynamicUpdate = true;
|
||||
[HideInInspector] public bool enableExtendedColorPicker = true;
|
||||
[HideInInspector] public bool editorHints = true;
|
||||
|
||||
// [Header("BACKGROUND")]
|
||||
public Color backgroundColorTint = new Color(255, 255, 255, 255);
|
||||
public BackgroundType backgroundType;
|
||||
public Sprite backgroundImage;
|
||||
public VideoClip backgroundVideo;
|
||||
public bool backgroundPreserveAspect;
|
||||
[Range(0.1f, 5)] public float backgroundSpeed = 1;
|
||||
|
||||
// [Header("COLORS")]
|
||||
public Color primaryColor = new Color(255, 255, 255, 255);
|
||||
public Color secondaryColor = new Color(255, 255, 255, 255);
|
||||
public Color primaryReversed = new Color(255, 255, 255, 255);
|
||||
public Color negativeColor = new Color(255, 255, 255, 255);
|
||||
public Color backgroundColor = new Color(255, 255, 255, 255);
|
||||
|
||||
// [Header("FONTS")]
|
||||
public TMP_FontAsset lightFont;
|
||||
public TMP_FontAsset regularFont;
|
||||
public TMP_FontAsset mediumFont;
|
||||
public TMP_FontAsset semiBoldFont;
|
||||
public TMP_FontAsset boldFont;
|
||||
|
||||
// [Header("LOGO")]
|
||||
public Sprite gameLogo;
|
||||
public Color logoColor = new Color(255, 255, 255, 255);
|
||||
|
||||
// [Header("PARTICLES")]
|
||||
public Color particleColor = new Color(255, 255, 255, 255);
|
||||
|
||||
// [Header("SOUNDS")]
|
||||
public AudioClip backgroundMusic;
|
||||
public AudioClip hoverSound;
|
||||
public AudioClip clickSound;
|
||||
|
||||
public enum ButtonThemeType
|
||||
{
|
||||
BASIC,
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
public enum BackgroundType
|
||||
{
|
||||
BASIC,
|
||||
ADVANCED
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9aabd12c6a06b464ba68864f87a71c02
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: a1559c6a1930beb469beaff5050f4d02, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Scripts/UI Manager/UIManager.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class UIManagerBGMusic : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public UIManager UIManagerAsset;
|
||||
public AudioSource audioObject;
|
||||
|
||||
bool dynamicUpdateEnabled;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (UIManagerAsset == null)
|
||||
{
|
||||
try { UIManagerAsset = Resources.Load<UIManager>("Shift UI Manager"); }
|
||||
catch { Debug.Log("No UI Manager found. Assign it manually, otherwise it won't work properly.", this); }
|
||||
}
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (dynamicUpdateEnabled == false)
|
||||
{
|
||||
this.enabled = true;
|
||||
UpdateSource();
|
||||
}
|
||||
|
||||
if (audioObject == null)
|
||||
audioObject = gameObject.GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
if (UIManagerAsset != null)
|
||||
{
|
||||
if (UIManagerAsset.enableDynamicUpdate == true)
|
||||
dynamicUpdateEnabled = true;
|
||||
else
|
||||
dynamicUpdateEnabled = false;
|
||||
|
||||
if (dynamicUpdateEnabled == true)
|
||||
UpdateSource();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSource()
|
||||
{
|
||||
try { audioObject.clip = UIManagerAsset.backgroundMusic; }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user