Passion & UI
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user