|
@@ -18,55 +18,112 @@ public interface IVideoCallSession
|
|
|
public class RemoteClickAction : MonoBehaviour, IVideoCallSession
|
|
|
{
|
|
|
uint SessionCallerId;
|
|
|
- // Use this for initialization
|
|
|
- void Start ()
|
|
|
+ const int SCREENSHOT_SUPER_SIZE = 2;
|
|
|
+
|
|
|
+ private enum STATE
|
|
|
{
|
|
|
- remoteImageRt_ = GameObject.Find("RemoteCameraView").GetComponent<RectTransform>();
|
|
|
+ RELEASED,
|
|
|
+ SHOWING_REMOTE,
|
|
|
+ DRAWING,
|
|
|
+ CAPTURING_SCREENSHOT,
|
|
|
+ SCREENSHOT_CAPTURING_COROUTINE
|
|
|
+ };
|
|
|
+ private STATE state_ = STATE.RELEASED;
|
|
|
+ //bool pointerDown_ = false;
|
|
|
|
|
|
- callCanvas_ = GameObject.Find("CallCanvas");
|
|
|
+ private IVideoCallSession session_;
|
|
|
|
|
|
- answerButton_ = GameObject.Find("AnswerButton").GetComponent<Button>();
|
|
|
- declineButton_ = GameObject.Find("DeclineButton").GetComponent<Button>();
|
|
|
- callerName_ = GameObject.Find("CallerName").GetComponent<Text>();
|
|
|
+ private RectTransform remoteImageRt_;
|
|
|
|
|
|
- answerButton_.onClick.AddListener(this.OnAnswer);
|
|
|
- declineButton_.onClick.AddListener(this.OnDecline);
|
|
|
+ private GameObject callCanvas_;
|
|
|
+ private Button answerButton_;
|
|
|
+ private Button declineButton_;
|
|
|
+ private Text callerName_;
|
|
|
|
|
|
- callCanvas_.SetActive(false);
|
|
|
+ private GameObject onConnectCanvas_;
|
|
|
+ private Button drawButton_;
|
|
|
+ private Button hangupButton_;
|
|
|
|
|
|
- onConnectCanvas_ = GameObject.Find("OnConnectCanvas");
|
|
|
+ private GameObject background_;
|
|
|
+ private GameObject remoteCanvas_;
|
|
|
+ private GameObject drawCanvas_;
|
|
|
+ private RawImage drawImage_;
|
|
|
+ private RectTransform curDrawTextRt_;
|
|
|
+ private GameObject drawTextPattern_;
|
|
|
|
|
|
- drawButton_ = GameObject.Find("DrawButton").GetComponent<Button>();
|
|
|
- hangupButton_ = GameObject.Find("HangupButton").GetComponent<Button>();
|
|
|
+ private GameObject drawToolsCanvas_;
|
|
|
+ private Button sendImageButton_;
|
|
|
+ private Button cancelDrawButton_;
|
|
|
|
|
|
- drawButton_.onClick.AddListener(this.OnDraw);
|
|
|
- hangupButton_.onClick.AddListener(this.OnHangup);
|
|
|
+ DrawControl drawControl_;
|
|
|
+ private GameObject toolsCanvas;
|
|
|
+ private GameObject loginCanvas;
|
|
|
+ private AspectRatioFitter fit;
|
|
|
+ public RawImage remoteCamImage;
|
|
|
+ GameObject RemoteCameraView_;
|
|
|
|
|
|
- onConnectCanvas_.SetActive(false);
|
|
|
+ // Use this for initialization
|
|
|
+ void Start ()
|
|
|
+ {
|
|
|
+ Client.instance.RemoteAssistCanvas = GameObject.Find("RemoteAssistCanvas");
|
|
|
+ var lst = Client.instance.RemoteAssistCanvas.GetComponentsInChildren<RectTransform>(true);
|
|
|
|
|
|
- drawCanvas_ = GameObject.Find("DrawCanvas");
|
|
|
- drawImage_ = GameObject.Find("DrawImage").GetComponent<RawImage>();
|
|
|
- drawTextPattern_ = GameObject.Find("DrawTextPattern");
|
|
|
|
|
|
- drawCanvas_.SetActive(false); //TODO
|
|
|
+ foreach (var l in lst)
|
|
|
+ {
|
|
|
+ switch (l.name)
|
|
|
+ {
|
|
|
+ case "background": fit = l.gameObject.GetComponent<AspectRatioFitter>();
|
|
|
+ background_ = l.gameObject;
|
|
|
+ break;
|
|
|
+ case "RemoteCameraView": remoteCamImage = l.gameObject.GetComponent<RawImage>();
|
|
|
+ remoteImageRt_ = l.gameObject.GetComponent<RectTransform>();
|
|
|
+ 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<Button>(); break;
|
|
|
+ case "DeclineButton": declineButton_ = l.gameObject.GetComponent<Button>(); break;
|
|
|
+ case "CallerName": callerName_ = l.gameObject.GetComponent<Text>(); break;
|
|
|
+ case "OnConnectCanvas": onConnectCanvas_ = l.gameObject; break;
|
|
|
+ case "DrawButton": drawButton_ = l.gameObject.GetComponent<Button>(); break;
|
|
|
+ case "HangupButton": hangupButton_ = l.gameObject.GetComponent<Button>(); break;
|
|
|
+ case "DrawCanvas": drawCanvas_ = l.gameObject; break;
|
|
|
+ case "DrawImage": drawImage_ = l.gameObject.GetComponent<RawImage>(); break;
|
|
|
+ case "DrawTextPattern": drawTextPattern_ = l.gameObject; break;
|
|
|
+ case "DrawControlCanvas": drawToolsCanvas_ = l.gameObject; break;
|
|
|
+ case "SendImageButton": sendImageButton_ = l.gameObject.GetComponent<Button>(); break;
|
|
|
+ case "CancelDrawButton": cancelDrawButton_ = l.gameObject.GetComponent<Button>(); break;
|
|
|
+ }
|
|
|
+ // Debug.Log("asdsa " + l.name);
|
|
|
+ }
|
|
|
|
|
|
- drawToolsCanvas_ = GameObject.Find("DrawControlCanvas");
|
|
|
+
|
|
|
+ answerButton_.onClick.AddListener(this.OnAnswer);
|
|
|
+ declineButton_.onClick.AddListener(this.OnDecline);
|
|
|
+ callCanvas_.SetActive(false);
|
|
|
+ drawButton_.onClick.AddListener(this.OnDraw);
|
|
|
+ hangupButton_.onClick.AddListener(this.OnHangup);
|
|
|
+ onConnectCanvas_.SetActive(false);
|
|
|
+ drawCanvas_.SetActive(false); //TODO
|
|
|
drawControl_ = FindObjectOfType<DrawControl>();
|
|
|
-
|
|
|
- sendImageButton_ = GameObject.Find("SendImageButton").GetComponent<Button>();
|
|
|
sendImageButton_.onClick.AddListener(this.OnSendImage);
|
|
|
-
|
|
|
- cancelDrawButton_ = GameObject.Find("CancelDrawButton").GetComponent<Button>();
|
|
|
cancelDrawButton_.onClick.AddListener(this.OnCancelDraw);
|
|
|
-
|
|
|
drawToolsCanvas_.SetActive(false); //TODO
|
|
|
RemoteTextureTestFill();
|
|
|
Client.instance.RemoteAssistCanvas.SetActive(false);
|
|
|
}
|
|
|
|
|
|
+ public uint GetCallerID()
|
|
|
+ {
|
|
|
+ return SessionCallerId;
|
|
|
+ }
|
|
|
+
|
|
|
private void RemoteTextureTestFill()
|
|
|
{
|
|
|
- RawImage image = GameObject.Find("RemoteCameraView").GetComponent<RawImage>();
|
|
|
+ //RawImage image = GameObject.Find("RemoteCameraView").GetComponent<RawImage>();
|
|
|
|
|
|
/*int WIDTH = (int)remoteCanvasRt_.sizeDelta.x;
|
|
|
int HEIGHT = (int)remoteCanvasRt_.sizeDelta.y;
|
|
@@ -81,8 +138,8 @@ public class RemoteClickAction : MonoBehaviour, IVideoCallSession
|
|
|
texture.Apply();
|
|
|
|
|
|
image.texture = texture;*/
|
|
|
-
|
|
|
- image.texture = Texture2D.whiteTexture;
|
|
|
+ remoteCamImage.texture = Texture2D.whiteTexture;
|
|
|
+ //image.texture = Texture2D.whiteTexture;
|
|
|
//image.texture = Texture2D.blackTexture;
|
|
|
}
|
|
|
|
|
@@ -100,6 +157,10 @@ public class RemoteClickAction : MonoBehaviour, IVideoCallSession
|
|
|
{
|
|
|
session_ = this;
|
|
|
SessionCallerId = callerID;
|
|
|
+ remoteCanvas_.SetActive(true);
|
|
|
+ RemoteCameraView_.SetActive(true);
|
|
|
+ background_.SetActive(true);
|
|
|
+ drawCanvas_.SetActive(true);
|
|
|
callCanvas_.SetActive(true);
|
|
|
callerName_.text = "call from " + callerID + "...";
|
|
|
}
|
|
@@ -235,40 +296,4 @@ public class RemoteClickAction : MonoBehaviour, IVideoCallSession
|
|
|
state_ = STATE.SHOWING_REMOTE;
|
|
|
}
|
|
|
|
|
|
- const int SCREENSHOT_SUPER_SIZE = 2;
|
|
|
-
|
|
|
- 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_;
|
|
|
- private Text callerName_;
|
|
|
-
|
|
|
- private GameObject onConnectCanvas_;
|
|
|
- private Button drawButton_;
|
|
|
- private Button hangupButton_;
|
|
|
-
|
|
|
- private GameObject drawCanvas_;
|
|
|
- private RawImage drawImage_;
|
|
|
- private RectTransform curDrawTextRt_;
|
|
|
- private GameObject drawTextPattern_;
|
|
|
-
|
|
|
- private GameObject drawToolsCanvas_;
|
|
|
- private Button sendImageButton_;
|
|
|
- private Button cancelDrawButton_;
|
|
|
-
|
|
|
- DrawControl drawControl_;
|
|
|
}
|