Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@arun02139
Created November 19, 2015 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun02139/06736c1a3f5893732a83 to your computer and use it in GitHub Desktop.
Save arun02139/06736c1a3f5893732a83 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using NUnit.Framework;
public class TurnListTap : MonoBehaviour, IPointerClickHandler
{
public Transform Target;
bool open;
Vector3 originalPosition;
void Awake()
{
originalPosition = Target.position;
}
public void OnPointerClick(PointerEventData dt)
{
if(open)
{
Target.position = originalPosition;
open = false;
}
else
{
var skipButton = UIManager.I.FindLastInstance<SkipTurnBtnPUI>();
if(skipButton != null)
{
//var w = skipButton.GetComponent<RectTransform>().GetWidth() / 4f;
print ("width = " + skipButton.GetComponent<RectTransform>().GetWidth());
Target.position = new Vector3(skipButton.transform.position.x, Target.position.y, Target.position.z);
open = true;
}
}
print ("open = " + open);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment