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.
41 lines
1000 B
41 lines
1000 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TuioDrawer : MonoBehaviour
|
|
{
|
|
List<Button> buttons;
|
|
|
|
void Start()
|
|
{
|
|
//var btn = GetComponentInChildren<Button>();
|
|
//btn.gameObject.SetActive(false);
|
|
|
|
buttons = new List<Button>();
|
|
//buttons.Add(btn);
|
|
buttons.AddRange(GetComponentsInChildren<Button>());
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
foreach (var btn in buttons)
|
|
{
|
|
btn.gameObject.SetActive(false);
|
|
}
|
|
|
|
var touches = TUIOManager.Instance.touches;
|
|
|
|
int i = 0;
|
|
foreach (var t in touches.Values)
|
|
{
|
|
if (i < buttons.Count)
|
|
{
|
|
buttons[i].gameObject.SetActive(true);
|
|
var rt = buttons[i].transform as RectTransform;
|
|
rt.anchoredPosition = t.position;//.Scale(new Vector2(1280, 800));
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|