ShanxiKnowledgeBase/SXElectricalInspection/Assets/Adam/Scripts/GoToSceneController.cs

81 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Data;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Utility;
//============================================================
//支持中文文件使用UTF-8编码
//@author YangHua
//@create 20230913
//@company QianHuo
//
//@description:
//============================================================
namespace Adam
{
public class GoToSceneController : MonoBehaviour
{
public Button goToSceneBtn;
public InputField userID;
public GameObject GoToTheScenePlane;
public Text request;
// Use this for initialization
private void Start()
{
goToSceneBtn.onClick.AddListener(() => OnGo(userID.text));
}
public void OnGo(string userid)
{
if (string.IsNullOrEmpty(userid))
{
request.text = "编号未输入";
return;
}
userid = ToolUtility.SubUserNum(userid);
if (UIManager.Instance.toolsItemManager.recoverBtn.gameObject.activeSelf)
{
UIManager.Instance.toolsItemManager.recoverBtn.onClick?.Invoke();
}
UIManager.Instance.bottomCotroller.BirdEyeView.isOn = false;
SceneLoad.Instance.isOnece = true;
SceneLoad.Instance.MaskLoadInfoPanel();
ExamusersController.Instance.Init(userid);
bool sceneState = ExamusersController.Instance.GetSceneState();
request.text = "";
if (sceneState)
{
string sceneInfo = ExamusersController.Instance.GetSceneInfo();
GlobalFlag.userId = userid;
//Debug.Log(GlobalFlag.userId);
string[] tt = ToolUtility.GetInfos(sceneInfo, '_');
if (!string.IsNullOrWhiteSpace(tt[0]))
{
SceneInfoData sceneInfoData = new SceneInfoData(tt[0], tt[1], tt[2]);
GlobalFlag.sceneData = sceneInfoData;
SwitchPanel();
UIManager.Instance.backToToolBtn.gameObject.SetActive(true);
UIManager.Instance.threeDTip.transform.parent.gameObject.SetActive(false);
SceneLoad.Instance.SceneChange(tt[3]);
}
}
else
{
SceneLoad.Instance.isOnece = false;
SceneLoad.Instance.ResetLoadInfoPanel(false);
request.text = "用户信息不存在";
}
}
public void SwitchPanel()
{
UIManager.Instance.threeDTip.transform.parent.gameObject.SetActive(false);
GoToTheScenePlane.SetActive(false);
}
}
}