TestCodeStructure/Assets/Scripts/BulletinBoardController.cs

60 lines
2.5 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 System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ZenFulcrum.EmbeddedBrowser;
using UnityEngine.UI;
//============================================================
//支持中文文件使用UTF-8编码
//@author Zhaozibo
//@create 20230131
//@company WT
//
//@description:看板展示脚本需要在StreamingAssets文件下创建“看板地址管理.txt”文件
//里面需要填入前端提供的网页地址bullerinBoards的数量需要和“看板地址管理”里中的链接
//数量一致。插件中提供链接参考。
//============================================================
namespace Controller
{
public class BulletinBoardController : MonoBehaviour
{
public Browser[] bullerinBoards;
//获取网页传来得信息“SendMachineStationNumberToUnity”网页端必须有这个方法
// bullerinBoards[0].RegisterFunction("SendMachineStationNumberToUnity", (JSONNode jk)=>{function});
//调用网页上得方法“GetCurrentStationNumberFormUnity”网页端必须有这个方法
//bullerinBoards[3].CallFunction("GetCurrentStationNumberFormUnity", currentStationName).Done();
private void Start()
{
string[] urls = FileUtil.ReadAllFromLocal("看板地址管理.txt");
for (int i = 0; i < bullerinBoards.Length; i++)
{
int index = i;
bullerinBoards[index].Url = urls[index+1];
}
// bullerinBoards[0].RegisterFunction("SendMachineStationNumberToUnity", (JSONNode jk) =>
//{
// stationInformation.SwitchSelf(true);
// currentStationName = jk[0].Value.ToString();
// if (MachineManager.Instance.GetMachineByName(currentStationName, out machineBase))
// {
// target = machineBase.BoxCollider.bounds.center;
// stationInformation.Init(target, currentStationName);
// }
// Debug.Log(jk[0].Value);
//});
// stationInformation.selfBtn.onClick.AddListener(OnStationInformationClick);
}
//public void OnStationInformationClick()
//{
// currentStationName = stationInformation.stationName.text;
// bullerinBoards[3].CallFunction("GetCurrentStationNumberFormUnity", currentStationName).Done();
// informationToggle.isOn = true;
// stationInformation.SwitchSelf(false);
//}
}
}