38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using XFrame.Core.UI;
|
|
using XFrame.Core.Tool;
|
|
using System.Collections;
|
|
using DG.Tweening;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityStandardAssets.Vehicles.Car;
|
|
public class MemuPanel : XUIPanel
|
|
{
|
|
public Button 视角_外, 视角_内, 重新开始;
|
|
private RectTransform left, right;
|
|
public MemuPanel() : base(UIType.PopUp, UIMode.HideOther, UICollider.None)
|
|
{
|
|
uiPath = "UI/MemuPanel/Prefabs/MemuPanel";
|
|
}
|
|
|
|
public override void Awake(GameObject go)
|
|
{
|
|
AutoAssign.InitObject(this, transform);
|
|
CarUserControl carUser = GameObject.FindObjectOfType<CarUserControl>();
|
|
right = transform.Find("bg/right").GetComponent<RectTransform>();
|
|
left = transform.Find("bg/left").GetComponent<RectTransform>();
|
|
left.anchoredPosition = new Vector2(-176.9f,right.anchoredPosition.y);
|
|
right.anchoredPosition = new Vector2(220f, right.anchoredPosition.y);
|
|
视角_内.onClick.AddListener(()=> { carUser.SwitchView(false); });
|
|
视角_外.onClick.AddListener(()=> { carUser.SwitchView(true); });
|
|
重新开始.onClick.AddListener(()=> {
|
|
SceneManager.LoadScene("main_"); });
|
|
}
|
|
public override void Active()
|
|
{
|
|
base.Active();
|
|
left.DOAnchorPos(new Vector2( 50,left.anchoredPosition.y), 1.5f);
|
|
right.DOAnchorPos(new Vector2(-50, right.anchoredPosition.y), 1.5f);
|
|
}
|
|
}
|