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.
62 lines
1.5 KiB
62 lines
1.5 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace UltraCombos.Marvel.DrawHeroes
|
|
{
|
|
public class DevelopMode : MonoBehaviour, IDragHandler
|
|
{
|
|
float time_step = 0.5f;
|
|
float timestamp;
|
|
float trigger_stamp;
|
|
|
|
bool is_triggered = false;
|
|
|
|
public UnityEvent onTriggered = new UnityEvent();
|
|
|
|
private void Start()
|
|
{
|
|
AppData.Instance.dev = false;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (is_triggered)
|
|
return;
|
|
|
|
float dt = Time.time - timestamp;
|
|
if (dt > time_step)
|
|
{
|
|
trigger_stamp = Time.time;
|
|
}
|
|
|
|
if (Time.time - trigger_stamp > 3.0f)
|
|
{
|
|
is_triggered = true;
|
|
OnTrigger();
|
|
onTriggered.Invoke();
|
|
}
|
|
}
|
|
|
|
public void OnDrag(PointerEventData eventData)
|
|
{
|
|
timestamp = Time.time;
|
|
}
|
|
|
|
private void OnTrigger()
|
|
{
|
|
var pages = AppData.Instance.pages;
|
|
var names = new string[pages.Count];
|
|
pages.Keys.CopyTo(names, 0);
|
|
var index = Random.Range(0, names.Length);
|
|
global::PaintCraft.Canvas.AppData.SelectedPageConfig = pages[names[index]];
|
|
|
|
AppData.Instance.dev = true;
|
|
AppData.Instance.roleId = names[index];
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|