first commit

This commit is contained in:
2022-07-08 09:14:55 +08:00
commit 4d6bd72555
1123 changed files with 456307 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PhotonNetwork.CurrentRoom.IsOpen.cs" company="Exit Games GmbH">
// Part of: Pun Cockpit Demo
// </copyright>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Photon.Pun.Demo.Cockpit
{
/// <summary>
/// PhotonNetwork.CurrentRoom.IsOpen UI Toggle
/// </summary>
[RequireComponent(typeof(Toggle))]
public class CurrentRoomIsOpenToggle : MonoBehaviour, IPointerClickHandler
{
Toggle _toggle;
// Use this for initialization
void OnEnable()
{
_toggle = GetComponent<Toggle>();
}
void Update()
{
if (PhotonNetwork.CurrentRoom == null && _toggle.interactable)
{
_toggle.interactable = false;
}
else if (PhotonNetwork.CurrentRoom != null && !_toggle.interactable)
{
_toggle.interactable = true;
}
if (PhotonNetwork.CurrentRoom!=null && PhotonNetwork.CurrentRoom.IsOpen != _toggle.isOn)
{
Debug.Log("Update toggle : PhotonNetwork.CurrentRoom.IsOpen = " + PhotonNetwork.CurrentRoom.IsOpen, this);
_toggle.isOn = PhotonNetwork.CurrentRoom.IsOpen;
}
}
public void ToggleValue(bool value)
{
if (PhotonNetwork.CurrentRoom != null)
{
Debug.Log("PhotonNetwork.CurrentRoom.IsOpen = " + value, this);
PhotonNetwork.CurrentRoom.IsOpen = value;
}
}
public void OnPointerClick(PointerEventData eventData)
{
ToggleValue(_toggle.isOn);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fa1f9506beac441fa984720f2b92a92a
timeCreated: 1559569034
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,65 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CurrentRoomIsVisibleToggle.cs" company="Exit Games GmbH">
// Part of: Pun Cockpit Demo
// </copyright>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Photon.Pun.Demo.Cockpit
{
/// <summary>
/// PhotonNetwork.CurrentRoom.IsVisible UI Toggle
/// </summary>
[RequireComponent(typeof(Toggle))]
public class CurrentRoomIsVisibleToggle : MonoBehaviour, IPointerClickHandler
{
Toggle _toggle;
// Use this for initialization
void OnEnable()
{
_toggle = GetComponent<Toggle>();
}
void Update()
{
if (PhotonNetwork.CurrentRoom == null && _toggle.interactable)
{
_toggle.interactable = false;
}
else if (PhotonNetwork.CurrentRoom != null && !_toggle.interactable)
{
_toggle.interactable = true;
}
if (PhotonNetwork.CurrentRoom!=null && PhotonNetwork.CurrentRoom.IsVisible != _toggle.isOn)
{
Debug.Log("Update toggle : PhotonNetwork.CurrentRoom.IsVisible = " + PhotonNetwork.CurrentRoom.IsVisible, this);
_toggle.isOn = PhotonNetwork.CurrentRoom.IsVisible;
}
}
public void ToggleValue(bool value)
{
if (PhotonNetwork.CurrentRoom != null)
{
Debug.Log("PhotonNetwork.CurrentRoom.IsVisible = " + value, this);
PhotonNetwork.CurrentRoom.IsVisible = value;
}
}
public void OnPointerClick(PointerEventData eventData)
{
ToggleValue(_toggle.isOn);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d221ad35d6c3f4da9b735a5e819ed1d3
timeCreated: 1559569034
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: