PunSystem
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.UI;
public class Punsystem : MonoBehaviour
{
public PhotonView M_Photonview; //That object we want to use this script, must be have photon view component
public GameViewDecoder GameViewDecoder; //The component of video decoder for convert the bytes to screen
public string YourName; //The name of you !!!
public GameObject Track;
public Toggle WebCamToggle;
public string ChromakeyMode;
public Toggle CaptureToggle;
public GameObject VRAvatar;
public GameObject VRGround;
public string MultiuserVRMode;
public GameObject LiveStream;
private void Start()
{
YourName = PlayerPrefs.GetString("UserName");
ChromakeyMode = PlayerPrefs.GetString("ChromakeyMode");
if (ChromakeyMode == "False")
{
CaptureToggle.isOn = false;
CaptureToggle.gameObject.SetActive(false);
}
MultiuserVRMode = PlayerPrefs.GetString("MultiuserVRMode");
if (MultiuserVRMode == "True")
{
VRAvatar.SetActive(true);
VRGround.SetActive(true);
}
}
public void WebCam()
{
if (WebCamToggle.isOn == true)
{
Track.SetActive(false);
}
if (WebCamToggle.isOn == false)
{
Track.SetActive(true);
}
}
public void LiveStreamShower()
{
if (CaptureToggle.isOn == true)
{
LiveStream.SetActive(true);
}
if (CaptureToggle.isOn == false)
{
LiveStream.SetActive(false);
}
}
public void SendMessage(byte[] _byteData, string message, string username)
{
M_Photonview.RPC("RPC_SendMessage",RpcTarget.All, _byteData, message,username);
}
[PunRPC]
private void RPC_SendMessage(byte[] _byteData, string message, string username)
{
if (ChromakeyMode == "False")
{
if (YourName != username)
{
if (message.Contains("VideoShare"))
{
GameViewDecoder.Action_ProcessImageData(_byteData);
}
}
}
}
}