using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public interface IVideoCallSession { void OnAnswer(); void OnDecline(); void OnHangup(); void OnDraw(); void OnEndDraw(byte[] image); } public class RemoteClickAction : MonoBehaviour, IVideoCallSession { public uint SessionCallerId; const int SCREENSHOT_SUPER_SIZE = 1; private enum STATE { RELEASED, SHOWING_REMOTE, DRAWING, CAPTURING_SCREENSHOT, SCREENSHOT_CAPTURING_COROUTINE }; private STATE state_ = STATE.RELEASED; //bool pointerDown_ = false; private IVideoCallSession session_; private RectTransform remoteImageRt_; private GameObject callCanvas_; private Button answerButton_; private Button declineButton_; public Text callerName_; private GameObject onConnectCanvas_; private Button drawButton_; private Button hangupButton_; private GameObject background_; private GameObject remoteCanvas_; private GameObject drawCanvas_; private RawImage drawImage_; private RectTransform curDrawTextRt_; private GameObject drawTextPattern_; private GameObject drawToolsCanvas_; private Button sendImageButton_; private Button cancelDrawButton_; private Button undoButton_; private Button redoButton_; DrawControl drawControl_; private GameObject toolsCanvas; private GameObject loginCanvas; private AspectRatioFitter fit; public RawImage remoteCamImage; GameObject RemoteCameraView_; // Use this for initialization void Start () { Client.instance.RemoteAssistCanvas = GameObject.Find("RemoteAssistCanvas"); var lst = Client.instance.RemoteAssistCanvas.GetComponentsInChildren(true); drawControl_ = FindObjectOfType(); foreach (var l in lst) { switch (l.name) { case "background": fit = l.gameObject.GetComponent(); background_ = l.gameObject; break; case "RemoteCameraView": remoteCamImage = l.gameObject.GetComponent(); remoteImageRt_ = l.gameObject.GetComponent(); RemoteCameraView_ = l.gameObject; break; case "ToolsCanvas": toolsCanvas = l.gameObject; break; case "RemoteCanvas": remoteCanvas_ = l.gameObject; break; case "LoginCanvas": loginCanvas = l.gameObject; break; case "CallCanvas": callCanvas_ = l.gameObject; break; case "AnswerButton": answerButton_ = l.gameObject.GetComponent