using System.Collections; using System.Collections.Generic; using UnityEngine; using EduCoderTool; using System; namespace DisComputer { /* *@func iframe 通讯 *@author lz *@date 2020/06/09 * */ public class IframeSokecter : MonoBehaviour { private string recieveStr; // Start is called before the first frame update void Start() { WebConnecter.Singleton.startHandle += OnRecStart; WebConnecter.Singleton.pauseHandle += OnRecPause; WebConnecter.Singleton.unPauseHandle += OnRecUnPause; WebConnecter.Singleton.finishHandle += OnRecFinish; } void OnRecStart() { MainControl.Instance.SetGameState(MainState.Active); } void OnRecPause() { } void OnRecUnPause() { } void OnRecFinish() { MainControl.Instance.SetGameState(MainState.Idle); } void OnRecData(string data) { try{ Debug.LogFormat("recieve wed data string {0}",data); recieveStr = data; } catch(Exception e) { Debug.Log("data is not correct:"+e); } } } }