UIWindowBase.cs 693 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.EventSystems;
  4. using System.Collections;
  5. public class UIWindowBase : MonoBehaviour, IDragHandler
  6. {
  7. RectTransform m_transform = null;
  8. // Use this for initialization
  9. void Start () {
  10. m_transform = GetComponent<RectTransform>();
  11. }
  12. public void OnDrag(PointerEventData eventData)
  13. {
  14. m_transform.position += new Vector3(eventData.delta.x, eventData.delta.y);
  15. // magic : add zone clamping if's here.
  16. }
  17. public void ChangeStrength(float value) {
  18. GetComponent<Image>().material.SetFloat("_Size", value);
  19. }
  20. public void ChangeVibrancy(float value) {
  21. GetComponent<Image>().material.SetFloat("_Vibrancy", value);
  22. }
  23. }