45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class WebAdapter : MonoBehaviour
|
|
{
|
|
#if UNITY_WEBGL && !UNITY_EDITOR
|
|
public string head;
|
|
public string token;
|
|
[DllImport("__Internal")]
|
|
private static extern void LevelChange(int _level);
|
|
#else
|
|
public string head;
|
|
public string token;
|
|
private static void LevelChange(int _level)
|
|
{
|
|
//Debug.Log(level);
|
|
}
|
|
#endif
|
|
public UnityEvent<string> onStation;
|
|
public void OnLevelChange(int _level)
|
|
{
|
|
LevelChange(_level);
|
|
//Debug.Log("UnityLog==level==" + _level);
|
|
}
|
|
|
|
public void OnStation(string station)
|
|
{
|
|
onStation?.Invoke(station);
|
|
Debug.Log("UnityLog==station==" + station);
|
|
}
|
|
|
|
public void SetHeadAndToken(string _headAndToken)
|
|
{
|
|
string[] data = _headAndToken.Split("+");
|
|
head = data[0];
|
|
token = data[1];
|
|
Debug.Log("UnityLog==head==" + head);
|
|
Debug.Log("UnityLog==token==" + token);
|
|
}
|
|
|
|
}
|