using BeinLab.Util;
using DG.Tweening;
using LitJson;
using PublicTools.XMLDataBase;
using ShadowStudio.Model;
using ShadowStudio.UI;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using XRTool.UI;
using XRTool.Util;
using XRTool.WorldUI;
namespace ShadowStudio.Tool
{
///
/// 黑板类
///
[RequireComponent(typeof(WorldDlg))]
public class BoardDlg : UnitySingleton
{
public WorldDlg dlg;
public BoardConf boardConf;
private RectTransform container;
///
/// 存储窗口的起点和终点
///
private Dictionary cellMap;
private List dlgMap = new List();
protected override void OnDestroy()
{
base.OnDestroy();
if (cellMap != null)
{
cellMap.Clear();
}
cellMap = null;
}
///
/// 初始化窗口
///
private void InitConf()
{
#if UNITY_EDITOR || !UNITY_ANDROID
TableInterface table = XSql.Instance.OpenTable(ResourcesManager.LocalPath, typeof(BoardConf).Name, ".xml", true);
if (!table.Open())
{
table.Create(typeof(BoardConf).Name);
}
var boards = table.FindAllData();
if (boards == null || boards.Count < 1)
{
boardConf = new BoardConf();
table.InsertData(boardConf);
table.Close();
}
else
{
boardConf = boards[0];
}
#else
string fullPath = Path.Combine(ResourcesManager.LocalPath, typeof(BoardConf).Name+".xml");
GameNode.Instance. StartCoroutine( XSql.Instance.ReadServerData(fullPath,(List boards) => {
if (boards != null && boards.Count > 0)
{
boardConf = boards[0];
dlg.DlgTrans.sizeDelta = boardConf.Boundary.Trans();
dlg.SetScale(dlg.DlgTrans.sizeDelta);
}
}));
#endif
}
private GameObject blackGroud;
public GameObject BlackGroud
{
get
{
/*
if (!blackGroud)
{
var dlg = Resources.Load("BackGround");
if (dlg)
{
blackGroud = GameObject.Instantiate(dlg) as GameObject;
GameNode.Instance.SetParent(ObjNode.WorldCanvas, blackGroud.transform, blackGroud.transform.localPosition, blackGroud.transform.localEulerAngles, blackGroud.transform.localScale);
}
}*/
blackGroud = dlg.GetBreadthChild("FrontBG").gameObject;
return blackGroud;
}
}
protected override void Awake()
{
base.Awake();
InitConf();
dlg = GetComponent();
}
private static Vector3 initBoard = Vector3.zero;
//private Button loginOutBtn;
private Button outRoomBtn;
private TextMesh roomName;
private TextMesh roomType;
public TextMesh roomNum;
private TextMesh roomPass;
private TextMesh roomCreator;
private TextMesh pubRoomType;
private TextMesh roomExplain;
private Button createSenceBtn;
private Button showInfoBtn;
private Button heidInfoBtn;
private Button showUserListBtn;
private Button heidUserListBtn;
private GameObject UIRoot;
private GameObject FullUIRoot;
public GameObject AllInfoObj;
public GameObject UserListObj;
private void Start()
{
container = dlg.GetBreadthChild("Container");
//loginOutBtn = dlg.GetBreadthChild