You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
public class MouseFollow : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
public Image image;
|
|
public int 正确ID;
|
|
public Button 正确button, 错误button;
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
image.transform.position = Input.mousePosition;
|
|
}
|
|
public void ChangeMouse(int id)
|
|
{
|
|
if (id == 正确ID)
|
|
{
|
|
正确button.gameObject.SetActive(true);
|
|
错误button.gameObject.SetActive(false);
|
|
|
|
}
|
|
else
|
|
{
|
|
正确button.gameObject.SetActive(false);
|
|
错误button.gameObject.SetActive(true);
|
|
}
|
|
image.gameObject.SetActive(true);
|
|
image.sprite = EventSystem.current.currentSelectedGameObject.GetComponent<Image>().sprite;
|
|
|
|
}
|
|
public void ChangID(int id)
|
|
{
|
|
正确ID = id;
|
|
}
|
|
public void Change正确button(Button obj)
|
|
{
|
|
正确button = obj;
|
|
}
|
|
|
|
|
|
}
|