WXMC/proj/unity/Assets/SwitchPageButton.cs

35 lines
1.2 KiB
C#
Raw Normal View History

2024-12-04 16:18:46 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
[RequireComponent(typeof(Button))]
public class SwitchPageButton : MonoBehaviour
{
public SystemPage systemPage;
public SystemPageCamera systemPageCamera;
// Start is called before the first frame update
void Start()
{
GetComponent<Button>().onClick.AddListener(onClickMoveCamera);
}
public void onClickMoveCamera()
{
//var target = systemPage.cameraTarget;
//systemPageCamera.GetComponent<Collider2D>().enabled = false;
//systemPage.SwitchAllExitColliderEnable(false);
systemPageCamera.currPage = systemPage;
systemPageCamera.isChangingPage = true;
systemPageCamera.targetPos = systemPage.cameraTarget.position + new Vector3(0, 0, -10);
//systemPageCamera.transform.DOMove(target.position + new Vector3(0, 0, -10.0f), 3.0f).onComplete = delegate {
// systemPage.SwitchAllExitColliderEnable(true);
// systemPageCamera.GetComponent<Collider2D>().enabled = true;
// systemPageCamera.isChangingPage = false;
//};
}
}