92 lines
2.0 KiB
C#
92 lines
2.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
|
|
public class CalendarDetails : MonoBehaviour
|
|
{
|
|
public static CalendarDetails Inst;
|
|
|
|
//public GameObject scrollView;
|
|
|
|
//public GameObject prefab;
|
|
|
|
//public Transform Content;
|
|
|
|
public Image img_bg;
|
|
public Image img;
|
|
Button img_bt;
|
|
|
|
public Button cls_bt;
|
|
public Vector3 vector3;
|
|
|
|
private void Awake()
|
|
{
|
|
Inst = this;
|
|
vector3 = img_bg.transform.localPosition;
|
|
img_bt = img.gameObject.GetComponent<Button>();
|
|
close();
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
cls_bt.onClick.AddListener(() =>
|
|
{
|
|
//scrollView.SetActive(true);
|
|
img_bg.gameObject.SetActive(false);
|
|
});
|
|
img_bt.onClick.AddListener(() =>
|
|
{
|
|
if (img_bg.transform.localScale.x > 0.6)
|
|
{
|
|
setlittle();
|
|
}
|
|
else
|
|
{
|
|
setbig();
|
|
}
|
|
});
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void open()
|
|
{
|
|
img_bg.gameObject.SetActive(true);
|
|
}
|
|
|
|
public void init()
|
|
{
|
|
img_bg.transform.localPosition = (vector3);
|
|
img_bg.transform.localScale = (Vector3.one * 0.5f);
|
|
gameObject.SetActive(true);
|
|
img_bg.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void close()
|
|
{
|
|
img_bg.gameObject.SetActive(false);
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void setbig()
|
|
{
|
|
DOTween.Kill(img_bg, false);
|
|
img_bg.transform.DOLocalMove(Vector3.right * 190f, 0.5f);
|
|
img_bg.transform.DOScale(Vector3.one, 0.5f);
|
|
}
|
|
public void setlittle()
|
|
{
|
|
DOTween.Kill(img_bg, false);
|
|
img_bg.transform.DOLocalMove(vector3, 0.5f);
|
|
img_bg.transform.DOScale(Vector3.one * 0.5f, 0.5f);
|
|
}
|
|
|
|
}
|