mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
32 lines
609 B
C#
32 lines
609 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
namespace Spine.Unity.Examples {
|
|
public class EquipButtonExample : MonoBehaviour {
|
|
public EquipAssetExample asset;
|
|
public EquipSystemExample equipSystem;
|
|
public Image inventoryImage;
|
|
|
|
void OnValidate () {
|
|
MatchImage();
|
|
}
|
|
|
|
void MatchImage () {
|
|
if (inventoryImage != null)
|
|
inventoryImage.sprite = asset.sprite;
|
|
}
|
|
|
|
void Start () {
|
|
MatchImage();
|
|
|
|
var button = GetComponent<Button>();
|
|
button.onClick.AddListener(
|
|
delegate { equipSystem.Equip(asset); }
|
|
);
|
|
}
|
|
}
|
|
}
|