using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using DG.Tweening;
using System.IO;
using GameFramework.Event;
using UnityEngine;
using UnityEngine.UI;
using UnityGameFramework.Runtime;
using Vuplex.WebView;
using System.Collections;
public class BaseStudyForm : UIFormLogic
{
private GameObject _devices;
private GameObject _topology;
private GameObject _scene;
private GameObject _study;
private CanvasWebViewPrefab webViewPrefab;
//切换板块按钮
private GameObject _naviObj;
private Button _baseStudyNaviB1;
private Button _baseStudyNaviB2;
private Button _baseStudyNaviB3;
private Button _baseStudyNaviB4;
private GameObject topologyLeft;
private GameObject topologyRight;
private GameObject topologyUp;
private GameObject topologyMiddle;
private GameObject topologyDown;
private Button _rltjBtn;
private Button _3dtpBtn;
private Button _2dtpBtn;
private RectTransform _3dtpList;
private RectTransform _2dtpList;
private RectTransform _eleList;
private Button _3db1;
private Button _3db2;
private Button _3db3;
private Button _3db4;
private Button _3db5;
private Button _ele1;
private Button _ele2;
private Button _ele3;
private Button _2db1;
private Button _2db2;
private Button _2db3;
private Button _2db4;
private Button _2db5;
public Sprite[] allTopo0;
public Sprite[] allTopo1;
public Sprite[] allTopo2;
public Sprite[] allTopo3;
public Sprite[] allTopo4;
public Sprite[] allTopo5;
private Image _2DTopoImage;
private Button _2DTopoClose;
private Button _2DTopoNext;
private Button _2DTopoPrev;
private Button _3dtpChangeEleBtn;
private Button _3dtpVisitBtn;
private Button _3dtpCloseBtn;
private bool _showRLTJ = true;
//当前板块
private int _currentBaseStudyType;
private int _currentPoloType;
public int CurrentBaseStudyType {
get { return _currentBaseStudyType; }
}
public int CurrentPoloType
{
get { return _currentPoloType; }
}
private int _current2DPoloType = -99;
public int Current2DPoloType
{
get { return _current2DPoloType; }
}
private int _current2DPoloSecondType = 0;
public Sprite[] current2DImages;
private bool visitMode = false;
//漫游场景切换按钮
private Button _sceneNaviB1;
private Button _sceneNaviB2;
//模型普通、爆炸图按钮
private Button _normalModel;
private Button _expModel;
//设备信息
private Text _devicesNameText;
private Text _typeIdText;
private Text _sizeText;
private Text _companyText;
//按钮图标
public Sprite[] naviButtonBGs;
public Sprite[] devicesNaviIcons;
public Sprite[] topologyNaviIcons;
public Sprite[] sceneNaviIcons;
public Sprite[] studyNaviIcons;
public Sprite[] topologyRLTJIcons;
private GameObject tvOutline;
private RawImage tvFrame;
public Transform deviceList;
public DevicesItemBase devicesItemTemplate;
protected override void OnInit(object userData)
{
base.OnInit(userData);
InItUiComponent();
}
protected override void OnOpen(object userData)
{
base.OnOpen(userData);
visitMode = false;
GameMain.Event.Subscribe(ChangeDevicesModelEvent.EventId, OnChangeModel);
GameMain.Event.Subscribe(AnyButtomClickEvent.EventId, OnCloseList);
GameMain.Event.Subscribe(DownloadSuccessEventArgs.EventId,OnDownLoadSuccess);
GameMain.Event.Subscribe(Stop3DTopoTimeLineEvent.EventId, OnEndPlayTimeLine);
}
protected override void OnClose(bool isShutdown, object userData)
{
base.OnClose(isShutdown, userData);
visitMode = false;
GameMain.Event.Unsubscribe(ChangeDevicesModelEvent.EventId, OnChangeModel);
GameMain.Event.Unsubscribe(AnyButtomClickEvent.EventId, OnCloseList);
GameMain.Event.Unsubscribe(DownloadSuccessEventArgs.EventId,OnDownLoadSuccess);
GameMain.Event.Unsubscribe(Stop3DTopoTimeLineEvent.EventId, OnEndPlayTimeLine);
}
///
/// //初始化UI组件
///
private void InItUiComponent()
{
_devices = this.transform.Find("3DDevices").gameObject;
_topology = this.transform.Find("3DTopology").gameObject;
_scene = this.transform.Find("3DScene").gameObject;
_study = this.transform.Find("3DStudy").gameObject;
_topology.SetActive(false);
_scene.SetActive(false);
_study.SetActive(false);
webViewPrefab = _study.GetComponentInChildren();
webViewPrefab.Initialized += InitWebListen;
_currentBaseStudyType = 0;
_currentPoloType = 0;
_naviObj = this.transform.Find("Navi").gameObject;
_baseStudyNaviB1 = this.transform.Find("Navi/B1").GetComponent