100 lines
3.0 KiB
C#
100 lines
3.0 KiB
C#
using Assets.MyGame.Scripts.Net;
|
|
using Assets.MyGame.Scripts.Net.API;
|
|
using Assets.MyGame.Scripts.Net.WebResponses;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
public class GameMainPanel_XJMH : GameMainPanel_FishBase
|
|
{
|
|
public Transform[] tra_SettingListPos;
|
|
public Transform[] tra_SettingListComponent;
|
|
|
|
//public GameObject turretParent_Left;
|
|
|
|
|
|
public override void Awake()
|
|
{
|
|
//sceneName = "XJMH";
|
|
base.Awake();
|
|
|
|
|
|
}
|
|
public override void Start()
|
|
{
|
|
|
|
base.Start();
|
|
foreach (var item in tra_SettingListComponent)
|
|
{
|
|
if (item.name == "Setting")
|
|
{
|
|
item.GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
UIManager.Instance.Close(UIPanel.MainGamePanelXJMH);
|
|
//等待界面添加
|
|
UIManager.Instance.ShowAsync(UIPanel.HomeMainPanel, UIPanel.MainGamePanelXJMH);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
public override IEnumerator OpenSettingList()
|
|
{
|
|
tra_SettingListComponent[tra_SettingListComponent.Length - 1].localScale = Vector3.one + Vector3.left * 2;
|
|
isOpenSetting = true;
|
|
int n = 0;
|
|
while (true)
|
|
{
|
|
if (isOpenSetting == false)
|
|
{
|
|
yield break;
|
|
}
|
|
yield return null;
|
|
for (int i = 0; i < tra_SettingListPos.Length; i++)
|
|
{
|
|
tra_SettingListComponent[i].position = Vector3.Lerp(tra_SettingListComponent[i].position, tra_SettingListPos[i].position, 0.5f);
|
|
if (tra_SettingListComponent[i].position == tra_SettingListPos[i].position)
|
|
{
|
|
n++;
|
|
if (n == tra_SettingListPos.Length)
|
|
{
|
|
yield break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public override IEnumerator CloseSettingList()
|
|
{
|
|
tra_SettingListComponent[tra_SettingListComponent.Length - 1].localScale = Vector3.one;
|
|
isOpenSetting = false;
|
|
int n = 0;
|
|
while (true)
|
|
{
|
|
if (isOpenSetting)
|
|
{
|
|
yield break;
|
|
}
|
|
yield return null;
|
|
for (int i = 0; i < tra_SettingListPos.Length; i++)
|
|
{
|
|
tra_SettingListComponent[i].position = Vector3.Lerp(tra_SettingListComponent[i].position, tra_SettingListPos[tra_SettingListPos.Length - 1].position, 0.5f);
|
|
if (tra_SettingListComponent[i].position == tra_SettingListPos[i].position)
|
|
{
|
|
n++;
|
|
if (n == tra_SettingListPos.Length)
|
|
{
|
|
yield break;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|