AR骑行动画&换装基本交互逻辑

This commit is contained in:
lishuo committed 2022-04-15 18:14:55 +08:00
1 parent d938a0c8be
commit 995aef63f8
117 files changed
+60802 -2718

No files matched your search

@@ -0,0 +1,89 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Assets.Scripts.UI.Prefab.Player
{
public abstract class AbstractEquipmentScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
{
public Image Content;//装备图片
public GameObject bglock;
public GameObject bglockLight;//选中样式
public GameObject Click;//选中勾选
public GameObject lockGrey;//灰色的锁定
public GameObject lockLight;//白色的锁定 选中时使用
public Text Title;
public Text Desc;
protected int Id { get; set; }
protected string Name { get; set; }
protected string Remark { get; set; }
protected string URL { get; set; }
protected bool IsLock { get; set; }
protected virtual void Start()
{
var btn = GetComponent<Button>();
btn.onClick.AddListener(() =>
{
Select();
});
}
public virtual void Init(int id, string name, string remark, string url, bool isLock)
{
Id = id;
Name = name;
Remark = remark;
IsLock = isLock;
URL = url;
Utils.DisplayImage(Content, url);
}
public virtual void Select()
{
UnSelectAll();
bglockLight.SetActive(true);
if (lockGrey != null && lockLight != null)
{
lockLight.SetActive(IsLock);
lockGrey.SetActive(false);
}
Title.text = Name;
Desc.text = Remark;
}
public virtual void UnSelect()
{
bglockLight.SetActive(false);
if (lockGrey != null && lockLight != null)
{
lockGrey.SetActive(IsLock);
lockLight.SetActive(false);
}
}
public virtual void UnSelectAll()
{
var list = FindObjectsOfType<AbstractEquipmentScript>();
foreach (var item in list)
{
item.UnSelect();
}
}
public void OnPointerExit(PointerEventData eventData)
{
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
public void OnPointerEnter(PointerEventData eventData)
{
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
}
public void OnPointerUp(PointerEventData eventData)
{
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81da3ad384a6846459d84bd58925d0ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scripts.UI.Prefab.Player
{
public class HelmetCardScript : AbstractEquipmentScript
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b43f05d0792ff6749a81a69b0cabdda4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scripts.UI.Prefab.Player
{
public class SkinCardScript : AbstractEquipmentScript
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00e2ed46366547b449f316f20524f2bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scripts.UI.Prefab.Player
{
public class SuitCardScript : AbstractEquipmentScript
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ad006bec4fe71b42838dc07592fcb99
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scripts.UI.Prefab.Player
{
public class UniformCardScript : AbstractEquipmentScript
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ac75d1b22152d54c94bf747ca64c677
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: