2024-12-05 14:29:27 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
|
|
|
|
|
public class MoveBg : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static MoveBg instance;
|
|
|
|
|
public RectTransform rectTransform;
|
2024-12-05 15:48:55 +08:00
|
|
|
|
|
2024-12-05 14:29:27 +08:00
|
|
|
|
private float moveX = 1372;
|
2024-12-05 15:48:55 +08:00
|
|
|
|
public bool isMove;
|
2024-12-06 16:15:57 +08:00
|
|
|
|
//public float orPosX;
|
2024-12-05 14:29:27 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2024-12-05 15:48:55 +08:00
|
|
|
|
//StartMove();
|
2024-12-06 16:15:57 +08:00
|
|
|
|
//orPosX = transform.position.x;
|
2024-12-05 14:29:27 +08:00
|
|
|
|
instance = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void StartMove()//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>
|
|
|
|
|
{
|
2024-12-06 16:15:57 +08:00
|
|
|
|
int add = 0;
|
|
|
|
|
if (Screen.width<moveX)
|
|
|
|
|
{
|
|
|
|
|
add = 30;
|
|
|
|
|
}
|
|
|
|
|
float move = -(moveX * 2 + moveX - Screen.width - 686-add);
|
|
|
|
|
rectTransform.DOAnchorPosX(move,7).SetEase(Ease.Linear);
|
2024-12-05 15:48:55 +08:00
|
|
|
|
isMove = true;
|
2024-12-05 14:29:27 +08:00
|
|
|
|
}
|
|
|
|
|
public void ReturnPos()//<2F><>λ
|
|
|
|
|
{
|
2024-12-05 15:48:55 +08:00
|
|
|
|
if (isMove)
|
|
|
|
|
{
|
2024-12-06 16:15:57 +08:00
|
|
|
|
rectTransform.DOAnchorPosX(686, 2).SetEase(Ease.Linear);
|
2024-12-05 15:48:55 +08:00
|
|
|
|
isMove = false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-05 14:29:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|