|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using UltraCombos;
|
|
|
|
|
|
|
|
|
|
|
|
public class movieController : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
DShowMoviePlayer player;
|
|
|
|
|
|
public int id;
|
|
|
|
|
|
//public tuio_event tuio_event;
|
|
|
|
|
|
public float fade_speed = 0.02f;
|
|
|
|
|
|
public int stat;
|
|
|
|
|
|
float c;
|
|
|
|
|
|
public float destroy_timer;
|
|
|
|
|
|
float wait_sec = 3f;
|
|
|
|
|
|
//Vector2 pos, pre_pos;
|
|
|
|
|
|
//public Transform trans;
|
|
|
|
|
|
|
|
|
|
|
|
void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
player = GetComponent<DShowMoviePlayer>();
|
|
|
|
|
|
//trans = GetComponent<Transform>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
//player = GetComponent<DShowMoviePlayer>();
|
|
|
|
|
|
GetComponent<RawImage>().color = Color.clear;
|
|
|
|
|
|
//pos = Vector2.zero;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
#if false
|
|
|
|
|
|
transform.gameObject.SetActive(true);
|
|
|
|
|
|
|
|
|
|
|
|
trans = GetComponent<Transform>();
|
|
|
|
|
|
//Debug.Log(stat);
|
|
|
|
|
|
pre_pos = pos;
|
|
|
|
|
|
|
|
|
|
|
|
if (tuio_event.tuio_input.touchCount > 0 && id != -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
transform.gameObject.SetActive(true);
|
|
|
|
|
|
//////////////////////
|
|
|
|
|
|
///
|
|
|
|
|
|
/*
|
|
|
|
|
|
int t_c = tuio_event.tuio_input.touchCount;
|
|
|
|
|
|
if (id == t_c)
|
|
|
|
|
|
{
|
|
|
|
|
|
//id -= 1;
|
|
|
|
|
|
Debug.Log("error");
|
|
|
|
|
|
}
|
|
|
|
|
|
//Debug.Log("id = " + id + " / touch count = " + t_c);
|
|
|
|
|
|
if (id >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
pos = tuio_event.tuio_input.GetTouch(id).position;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
pos = pre_pos;
|
|
|
|
|
|
GetComponent<RectTransform>().position = new Vector3(pos.x, pos.y, 0);
|
|
|
|
|
|
*/
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
if (stat == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
c += fade_speed;
|
|
|
|
|
|
if (c > 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
c = 1;
|
|
|
|
|
|
stat = 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (stat == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
float t = Time.time;
|
|
|
|
|
|
if (t - destroy_timer > wait_sec)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log("fade");
|
|
|
|
|
|
c -= fade_speed;
|
|
|
|
|
|
if (c < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Destroy(this.gameObject);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GetComponent<RawImage>().color = new Color(1f, 1f, 1f, c);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnEnable()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (name != "RawImage") {
|
|
|
|
|
|
|
|
|
|
|
|
GetComponent<RawImage>().enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
//Debug.Log("Hi");
|
|
|
|
|
|
//Debug.Log(id.ToString());
|
|
|
|
|
|
stat = 1;
|
|
|
|
|
|
c = 0f;
|
|
|
|
|
|
Vector3 rot_axis = new Vector3(0, 0, 1);
|
|
|
|
|
|
Vector3 mid_pt = new Vector3(GetComponent<RectTransform>().position.x, GetComponent<RectTransform>().position.y, 0);
|
|
|
|
|
|
float rand_deg = Random.Range(0, 360);
|
|
|
|
|
|
GetComponent<RectTransform>().Rotate(rot_axis, rand_deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnDestroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
//Debug.Log("Bye");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|