first commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 474af3605718d36449f5dbe2c9ecdb8c
|
||||
folderAsset: yes
|
||||
timeCreated: 1515418582
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,61 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="AutoSyncSceneToggle.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.AutomaticallySyncScene UI Toggle
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Toggle))]
|
||||
public class AutoSyncSceneToggle : MonoBehaviour
|
||||
{
|
||||
Toggle _toggle;
|
||||
|
||||
bool registered;
|
||||
|
||||
// Use this for initialization
|
||||
void OnEnable()
|
||||
{
|
||||
|
||||
_toggle = GetComponent<Toggle>();
|
||||
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
_toggle.onValueChanged.AddListener(ToggleValue);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (_toggle != null)
|
||||
{
|
||||
registered = false;
|
||||
_toggle.onValueChanged.RemoveListener(ToggleValue);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.AutomaticallySyncScene != _toggle.isOn)
|
||||
{
|
||||
_toggle.isOn = PhotonNetwork.AutomaticallySyncScene;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ToggleValue(bool value)
|
||||
{
|
||||
PhotonNetwork.AutomaticallySyncScene = value;
|
||||
//Debug.Log("PhotonNetwork.CrcCheckEnabled = " + PhotonNetwork.CrcCheckEnabled, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 345270254ed7b49e89ce5662ca70a091
|
||||
timeCreated: 1538567993
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,68 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="BackgroundTimeOutField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.BackgroundTimeout UI InputField.
|
||||
/// </summary>
|
||||
public class BackgroundTimeOutField : MonoBehaviour
|
||||
{
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
float _cache;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(OnEndEdit);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(OnEndEdit);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.KeepAliveInBackground != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.KeepAliveInBackground;
|
||||
PropertyValueInput.text = _cache.ToString("F1");
|
||||
}
|
||||
}
|
||||
|
||||
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
|
||||
public void OnEndEdit(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
_cache = float.Parse(value);
|
||||
PhotonNetwork.KeepAliveInBackground = _cache;
|
||||
//Debug.Log("PhotonNetwork.BackgroundTimeout = " + PhotonNetwork.BackgroundTimeout, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44aff3084c8664497aa6048e66e71a7c
|
||||
timeCreated: 1519126771
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,61 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CrcCheckToggle.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CrcCheckEnabled UI Toggle
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Toggle))]
|
||||
public class CrcCheckToggle : MonoBehaviour
|
||||
{
|
||||
Toggle _toggle;
|
||||
|
||||
bool registered;
|
||||
|
||||
// Use this for initialization
|
||||
void OnEnable()
|
||||
{
|
||||
|
||||
_toggle = GetComponent<Toggle>();
|
||||
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
_toggle.onValueChanged.AddListener(ToggleValue);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (_toggle != null)
|
||||
{
|
||||
registered = false;
|
||||
_toggle.onValueChanged.RemoveListener(ToggleValue);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.CrcCheckEnabled != _toggle.isOn)
|
||||
{
|
||||
_toggle.isOn = PhotonNetwork.CrcCheckEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ToggleValue(bool value)
|
||||
{
|
||||
PhotonNetwork.CrcCheckEnabled = value;
|
||||
//Debug.Log("PhotonNetwork.CrcCheckEnabled = " + PhotonNetwork.CrcCheckEnabled, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac5f2e2d5fa8e4143ab9b97b523d3990
|
||||
timeCreated: 1519127346
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44872d445f2594fbeb2bd8fba90f1f08
|
||||
folderAsset: yes
|
||||
timeCreated: 1559569017
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa1f9506beac441fa984720f2b92a92a
|
||||
timeCreated: 1559569034
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d221ad35d6c3f4da9b735a5e819ed1d3
|
||||
timeCreated: 1559569034
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,33 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="DocLinkButton.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun demos
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using Photon.Pun.Demo.Shared;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Open an Url on Pointer Click.
|
||||
/// </summary>
|
||||
public class DocLinkButton : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
public DocLinks.DocTypes Type = DocLinks.DocTypes.Doc;
|
||||
|
||||
public string Reference = "getting-started/pun-intro";
|
||||
|
||||
|
||||
// Just so that Unity expose the enable Check Box inside the Component Inspector Header.
|
||||
public void Start(){}
|
||||
|
||||
//Detect if a click occurs
|
||||
public void OnPointerClick(PointerEventData pointerEventData)
|
||||
{
|
||||
Application.OpenURL(DocLinks.GetLink(Type,Reference));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09b634200c91b4206aa56038f7647fb5
|
||||
timeCreated: 1530884945
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,68 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="GameVersionField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Game version field.
|
||||
/// </summary>
|
||||
public class GameVersionField : MonoBehaviour
|
||||
{
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
private string _cache;
|
||||
|
||||
private bool registered;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!this.registered)
|
||||
{
|
||||
this.registered = true;
|
||||
this.PropertyValueInput.onEndEdit.AddListener(this.OnEndEdit);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
this.registered = false;
|
||||
this.PropertyValueInput.onEndEdit.RemoveListener(this.OnEndEdit);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (PhotonNetwork.PhotonServerSettings.AppSettings.AppVersion != this._cache)
|
||||
{
|
||||
this._cache = PhotonNetwork.PhotonServerSettings.AppSettings.AppVersion;
|
||||
this.PropertyValueInput.text = this._cache;
|
||||
}
|
||||
}
|
||||
|
||||
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then submit form.
|
||||
public void OnEndEdit(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
this._cache = value;
|
||||
PunCockpit.Instance.GameVersionOverride = this._cache;
|
||||
//Debug.Log("PunCockpit.GameVersionOverride = " + PunCockpit.Instance.GameVersionOverride, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74b76e97b5bf042e3b0a981241bce379
|
||||
timeCreated: 1524053508
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6ff6c1b4167dd340a8b3aaae892b377
|
||||
folderAsset: yes
|
||||
timeCreated: 1519216796
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,54 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CrcCheckToggle.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Boolean UI UI Toggle input.
|
||||
/// </summary>
|
||||
public class BoolInputField : MonoBehaviour
|
||||
{
|
||||
public Toggle PropertyValueInput;
|
||||
|
||||
[System.Serializable]
|
||||
public class OnSubmitEvent : UnityEvent<bool> { }
|
||||
|
||||
public OnSubmitEvent OnSubmit;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onValueChanged.AddListener(OnValueChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onValueChanged.RemoveListener(OnValueChanged);
|
||||
}
|
||||
|
||||
void OnValueChanged(bool value)
|
||||
{
|
||||
OnSubmit.Invoke(PropertyValueInput.isOn);
|
||||
}
|
||||
|
||||
public void SetValue(bool value)
|
||||
{
|
||||
PropertyValueInput.isOn = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d7694afd58e94f988b7b524da7b97b9
|
||||
timeCreated: 1519218811
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,67 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CrcCheckToggle.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Int UI InputField.
|
||||
/// </summary>
|
||||
public class IntInputField : MonoBehaviour
|
||||
{
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
[System.Serializable]
|
||||
public class OnSubmitEvent : UnityEvent<int> { }
|
||||
|
||||
public OnSubmitEvent OnSubmit;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(EndEditOnEnter);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(EndEditOnEnter);
|
||||
}
|
||||
|
||||
public void SetValue(int value)
|
||||
{
|
||||
PropertyValueInput.text = value.ToString();
|
||||
}
|
||||
|
||||
public void EndEditOnEnter(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
int _value = 0;
|
||||
int.TryParse(value, out _value);
|
||||
OnSubmit.Invoke(_value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd06272cdb8d849f0ab251f0678c9eca
|
||||
timeCreated: 1518011577
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,65 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="StringInputField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// String UI InputField.
|
||||
/// </summary>
|
||||
public class StringInputField : MonoBehaviour
|
||||
{
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
[System.Serializable]
|
||||
public class OnSubmitEvent : UnityEvent<string> { }
|
||||
|
||||
public OnSubmitEvent OnSubmit;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(EndEditOnEnter);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(EndEditOnEnter);
|
||||
}
|
||||
|
||||
public void SetValue(string value)
|
||||
{
|
||||
PropertyValueInput.text = value.ToString();
|
||||
}
|
||||
|
||||
public void EndEditOnEnter(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
OnSubmit.Invoke(value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e02d5b184c20e43ebba343cc89e35962
|
||||
timeCreated: 1519216710
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,45 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="ToggleExpand.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// UI toggle to activate GameObject.
|
||||
/// </summary>
|
||||
public class ToggleExpand : MonoBehaviour
|
||||
{
|
||||
public GameObject Content;
|
||||
|
||||
public Toggle Toggle;
|
||||
|
||||
bool _init;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
Content.SetActive(Toggle.isOn);
|
||||
|
||||
if (!_init)
|
||||
{
|
||||
_init = true;
|
||||
Toggle.onValueChanged.AddListener(HandleToggleOnValudChanged);
|
||||
}
|
||||
|
||||
HandleToggleOnValudChanged(Toggle.isOn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void HandleToggleOnValudChanged(bool value)
|
||||
{
|
||||
Content.SetActive(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50b3f63970a204e72b36153eb93684bf
|
||||
timeCreated: 1525954565
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,40 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="LayoutElementMatchSize.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Force a LayoutElement to march a RectTransform sizeDelta. Useful for complex child content
|
||||
/// </summary>
|
||||
public class LayoutElementMatchSize : MonoBehaviour
|
||||
{
|
||||
|
||||
public LayoutElement layoutElement;
|
||||
public RectTransform Target;
|
||||
|
||||
|
||||
public bool MatchHeight = true;
|
||||
public bool MatchWidth;
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (MatchHeight)
|
||||
{
|
||||
if (layoutElement.minHeight != Target.sizeDelta.y)
|
||||
{
|
||||
layoutElement.minHeight = Target.sizeDelta.y;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ec618017b87f49b4a2bfc6a0a0bff3d
|
||||
timeCreated: 1526042927
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,68 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="NickNameField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Nickname InputField.
|
||||
/// </summary>
|
||||
public class NickNameField : MonoBehaviour
|
||||
{
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
string _cache;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(OnEndEdit);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(OnEndEdit);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.NickName != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.NickName;
|
||||
PropertyValueInput.text = _cache;
|
||||
}
|
||||
}
|
||||
|
||||
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then submit form.
|
||||
public void OnEndEdit(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
_cache = value;
|
||||
PhotonNetwork.NickName = _cache;
|
||||
//Debug.Log("PhotonNetwork.NickName = " + PhotonNetwork.NickName, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea425f69fa0f244a79a3514a6d64cab2
|
||||
timeCreated: 1521548922
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,27 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="OnlineDocButton.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Open an Url on Pointer Click.
|
||||
/// </summary>
|
||||
public class OnlineDocButton : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
public string Url = "https://doc.photonengine.com/en-us/pun/v2/getting-started/pun-intro";
|
||||
|
||||
//Detect if a click occurs
|
||||
public void OnPointerClick(PointerEventData pointerEventData)
|
||||
{
|
||||
Application.OpenURL(Url);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 738f2e2e03bb948949a9823e60ee65d5
|
||||
timeCreated: 1519212778
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,70 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="SendRateField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.SendRate InputField.
|
||||
/// </summary>
|
||||
public class SendRateField : MonoBehaviour
|
||||
{
|
||||
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
int _cache;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(OnEndEdit);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(OnEndEdit);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.SendRate != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.SendRate;
|
||||
PropertyValueInput.text = _cache.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
|
||||
public void OnEndEdit(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
_cache = int.Parse(value);
|
||||
PhotonNetwork.SendRate = _cache;
|
||||
//Debug.Log("PhotonNetwork.SendRate = " + PhotonNetwork.SendRate, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6ed1c2b7c01b4b3cba625a08a991c7f
|
||||
timeCreated: 1519133073
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,69 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="SendRateOnSerializeField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.SerializationRate InputField
|
||||
/// </summary>
|
||||
public class SendRateOnSerializeField : MonoBehaviour
|
||||
{
|
||||
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
int _cache;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(OnEndEdit);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(OnEndEdit);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.SerializationRate != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.SerializationRate;
|
||||
PropertyValueInput.text = _cache.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
|
||||
public void OnEndEdit(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
_cache = int.Parse(PropertyValueInput.text);
|
||||
PhotonNetwork.SerializationRate = _cache;
|
||||
//Debug.Log("PhotonNetwork.SerializationRate = " + PhotonNetwork.SerializationRate, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8014b533c3a148558bd8c78ceea7a5f
|
||||
timeCreated: 1519134196
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 901592418674487429f301516272f6b6
|
||||
folderAsset: yes
|
||||
timeCreated: 1516282208
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,239 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="PlayerDetailsController.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
using Photon.Pun.UtilityScripts;
|
||||
using Hashtable = ExitGames.Client.Photon.Hashtable;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Controller for the Playerdetails UI view
|
||||
/// </summary>
|
||||
public class PlayerDetailsController : MonoBehaviourPunCallbacks
|
||||
{
|
||||
|
||||
public GameObject ContentPanel;
|
||||
public PropertyCell PropertyCellPrototype;
|
||||
public Text UpdateStatusText;
|
||||
|
||||
public Transform BuiltInPropertiesPanel;
|
||||
public Transform PlayerNumberingExtensionPanel;
|
||||
public Transform ScoreExtensionPanel;
|
||||
public Transform TeamExtensionPanel;
|
||||
public Transform TurnExtensionPanel;
|
||||
public Transform CustomPropertiesPanel;
|
||||
|
||||
public GameObject MasterClientToolBar;
|
||||
|
||||
|
||||
|
||||
public GameObject NotInRoomLabel;
|
||||
|
||||
|
||||
Dictionary<string, PropertyCell> builtInPropsCellList = new Dictionary<string, PropertyCell>();
|
||||
|
||||
Player _player;
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
this.PropertyCellPrototype.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable(); // as this inherits from MonoBehaviourPunCallbacks, we need to call base
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
NotInRoomLabel.SetActive(false);
|
||||
|
||||
PlayerNumbering.OnPlayerNumberingChanged += OnPlayerNumberingChanged;
|
||||
}
|
||||
|
||||
public override void OnDisable()
|
||||
{
|
||||
base.OnDisable(); // as this inherits from MonoBehaviourPunCallbacks, we need to call base
|
||||
PlayerNumbering.OnPlayerNumberingChanged -= OnPlayerNumberingChanged;
|
||||
}
|
||||
|
||||
|
||||
public void SetPlayerTarget(Player player)
|
||||
{
|
||||
//Debug.Log("SetPlayerTarget " + player);
|
||||
this._player = player;
|
||||
|
||||
ContentPanel.SetActive(true);
|
||||
NotInRoomLabel.SetActive(false);
|
||||
|
||||
this.ResetList();
|
||||
|
||||
foreach (DictionaryEntry item in this.GetAllPlayerBuiltIntProperties())
|
||||
{
|
||||
this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.BuiltInPropertiesPanel);
|
||||
}
|
||||
|
||||
// PlayerNumbering extension
|
||||
this.AddProperty("Player Number", "#" + player.GetPlayerNumber().ToString("00"), this.PlayerNumberingExtensionPanel);
|
||||
|
||||
|
||||
// Score extension
|
||||
this.AddProperty(PunPlayerScores.PlayerScoreProp, player.GetScore().ToString(), this.ScoreExtensionPanel);
|
||||
|
||||
|
||||
foreach (DictionaryEntry item in _player.CustomProperties)
|
||||
{
|
||||
this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.CustomPropertiesPanel);
|
||||
}
|
||||
|
||||
MasterClientToolBar.SetActive(PhotonNetwork.CurrentRoom.PlayerCount>1 && PhotonNetwork.LocalPlayer.IsMasterClient);
|
||||
}
|
||||
|
||||
void AddProperty(string property, string value, Transform parent)
|
||||
{
|
||||
PropertyCell _cell = Instantiate(PropertyCellPrototype);
|
||||
builtInPropsCellList.Add(property, _cell);
|
||||
_cell.transform.SetParent(parent, false);
|
||||
_cell.gameObject.SetActive(true);
|
||||
_cell.AddToList(property, value, false);
|
||||
}
|
||||
|
||||
|
||||
string ParseKey(object key)
|
||||
{
|
||||
if (key.GetType() == typeof(byte))
|
||||
{
|
||||
byte _byteKey = (byte)key;
|
||||
|
||||
switch (_byteKey)
|
||||
{
|
||||
case (byte)255:
|
||||
return "PlayerName";
|
||||
case (byte)254:
|
||||
return "Inactive";
|
||||
case (byte)253:
|
||||
return "UserId";
|
||||
}
|
||||
|
||||
}
|
||||
return key.ToString();
|
||||
}
|
||||
|
||||
public void KickOutPlayer()
|
||||
{
|
||||
PhotonNetwork.CloseConnection(_player);
|
||||
}
|
||||
|
||||
public void SetAsMaster()
|
||||
{
|
||||
PhotonNetwork.SetMasterClient(_player);
|
||||
}
|
||||
|
||||
#region Photon CallBacks
|
||||
|
||||
public override void OnPlayerLeftRoom(Player otherPlayer)
|
||||
{
|
||||
NotInRoomLabel.SetActive(otherPlayer == _player);
|
||||
ContentPanel.SetActive(otherPlayer != _player);
|
||||
}
|
||||
|
||||
public override void OnMasterClientSwitched(Player newMasterClient)
|
||||
{
|
||||
MasterClientToolBar.SetActive(_player == newMasterClient);
|
||||
}
|
||||
|
||||
public override void OnPlayerPropertiesUpdate(Player target, ExitGames.Client.Photon.Hashtable changedProps)
|
||||
{
|
||||
//Debug.Log("OnPlayerPropertiesUpdate " + target.ActorNumber + " " + target.ToStringFull() + " " + changedProps.ToStringFull());
|
||||
|
||||
//Debug.Log("_player.ID " + _player.ActorNumber);
|
||||
if (_player.ActorNumber == target.ActorNumber)
|
||||
{
|
||||
|
||||
foreach (DictionaryEntry entry in changedProps)
|
||||
{
|
||||
string _key = this.ParseKey(entry.Key);
|
||||
if (this.builtInPropsCellList.ContainsKey(_key))
|
||||
{
|
||||
this.builtInPropsCellList[_key].UpdateInfo(entry.Value.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.AddProperty(_key, entry.Value.ToString(), this.CustomPropertiesPanel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StartCoroutine("UpdateUIPing");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void OnPlayerNumberingChanged()
|
||||
{
|
||||
if (_player != null)
|
||||
{ // we might be called before player is setup
|
||||
this.builtInPropsCellList["Player Number"].UpdateInfo("#" + _player.GetPlayerNumber().ToString("00"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IEnumerator UpdateUIPing()
|
||||
{
|
||||
UpdateStatusText.text = "Updated";
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
foreach (KeyValuePair<string, PropertyCell> entry in builtInPropsCellList)
|
||||
{
|
||||
if (entry.Value != null)
|
||||
{
|
||||
Destroy(entry.Value.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
builtInPropsCellList = new Dictionary<string, PropertyCell>();
|
||||
}
|
||||
|
||||
|
||||
Hashtable GetAllPlayerBuiltIntProperties()
|
||||
{
|
||||
Hashtable allProps = new Hashtable();
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
|
||||
allProps["ID"] = _player.ActorNumber;
|
||||
allProps[ActorProperties.UserId] = _player.UserId != null ? _player.UserId : string.Empty;
|
||||
allProps["NickName"] = _player.NickName != null ? _player.NickName : string.Empty;
|
||||
allProps["IsLocal"] = _player.IsLocal;
|
||||
allProps[ActorProperties.IsInactive] = _player.IsInactive;
|
||||
allProps["IsMasterClient"] = _player.IsMasterClient;
|
||||
}
|
||||
|
||||
Debug.Log(allProps.ToStringFull());
|
||||
|
||||
return allProps;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9eaa48793ddf4344b22871af0652c69
|
||||
timeCreated: 1516282139
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,24 @@
|
||||
// <copyright file="PlayerDetailsController.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Infos panel placeholder. Defines the place where the infos panel should go. It will request InfoPanel when Component is enabled.
|
||||
/// </summary>
|
||||
public class InfosPanelPlaceholder : MonoBehaviour
|
||||
{
|
||||
public PunCockpit Manager;
|
||||
|
||||
// Use this for initialization
|
||||
void OnEnable()
|
||||
{
|
||||
Manager.RequestInfosPanel(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d85daee5b585047f89b7e2dde78b336b
|
||||
timeCreated: 1524225584
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d9560529ca07d147b217827aa339f0b
|
||||
folderAsset: yes
|
||||
timeCreated: 1511958157
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,63 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="FriendListCell.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Friend list cell
|
||||
/// </summary>
|
||||
public class FriendListCell : MonoBehaviour
|
||||
{
|
||||
public FriendListView ListManager;
|
||||
|
||||
public Text NameText;
|
||||
public GameObject OnlineFlag;
|
||||
|
||||
public GameObject inRoomText;
|
||||
public GameObject JoinButton;
|
||||
|
||||
FriendInfo _info;
|
||||
|
||||
|
||||
public void RefreshInfo(FriendListView.FriendDetail details)
|
||||
{
|
||||
NameText.text = details.NickName;
|
||||
|
||||
OnlineFlag.SetActive(false);
|
||||
|
||||
inRoomText.SetActive(false);
|
||||
JoinButton.SetActive(false);
|
||||
}
|
||||
|
||||
public void RefreshInfo(FriendInfo info)
|
||||
{
|
||||
_info = info;
|
||||
|
||||
OnlineFlag.SetActive(_info.IsOnline);
|
||||
|
||||
inRoomText.SetActive(_info.IsInRoom);
|
||||
JoinButton.SetActive(_info.IsInRoom);
|
||||
}
|
||||
|
||||
public void JoinFriendRoom()
|
||||
{
|
||||
//Debug.Log("FriendListCell:JoinFriendRoom " + _info.Room);
|
||||
ListManager.JoinFriendRoom(_info.Room);
|
||||
}
|
||||
|
||||
public void RemoveFromList()
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7be18b2f537f4428b8e4cd92373a1e0
|
||||
timeCreated: 1513083244
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,162 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="FriendListView.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Friend list UI view.
|
||||
/// </summary>
|
||||
public class FriendListView : MonoBehaviourPunCallbacks
|
||||
{
|
||||
/// <summary>
|
||||
/// Friend detail class
|
||||
/// This info comes from your social network and is meant to be matched against the friendInfo from Photon
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FriendDetail
|
||||
{
|
||||
public FriendDetail(string NickName, string UserId)
|
||||
{
|
||||
this.NickName = NickName;
|
||||
this.UserId = UserId;
|
||||
}
|
||||
|
||||
public string NickName;
|
||||
public string UserId;
|
||||
}
|
||||
|
||||
public FriendListCell CellPrototype;
|
||||
|
||||
public Text ContentFeedback;
|
||||
|
||||
public Text UpdateStatusText;
|
||||
|
||||
[System.Serializable]
|
||||
public class OnJoinRoomEvent : UnityEvent<string> { }
|
||||
|
||||
public OnJoinRoomEvent OnJoinRoom;
|
||||
|
||||
Dictionary<string, FriendListCell> FriendCellList = new Dictionary<string, FriendListCell>();
|
||||
|
||||
string[] FriendsLUT = new string[0];
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
CellPrototype.gameObject.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
ContentFeedback.text = string.Empty;;
|
||||
}
|
||||
|
||||
|
||||
public void SetFriendDetails(FriendDetail[] friendList)
|
||||
{
|
||||
ResetList();
|
||||
|
||||
List<string> _list = new List<string>();
|
||||
foreach (FriendDetail _friend in friendList)
|
||||
{
|
||||
if (_friend.UserId != PhotonNetwork.LocalPlayer.UserId)
|
||||
{
|
||||
FriendCellList[_friend.UserId] = Instantiate(CellPrototype);
|
||||
FriendCellList[_friend.UserId].transform.SetParent(CellPrototype.transform.parent, false);
|
||||
FriendCellList[_friend.UserId].gameObject.SetActive(true);
|
||||
FriendCellList[_friend.UserId].RefreshInfo(_friend);
|
||||
|
||||
_list.Add(_friend.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
this.FriendsLUT = _list.ToArray<string>();
|
||||
|
||||
FindFriends();
|
||||
}
|
||||
|
||||
public void FindFriends()
|
||||
{
|
||||
|
||||
PhotonNetwork.FindFriends(FriendsLUT);
|
||||
|
||||
ContentFeedback.text = "Finding Friends...";
|
||||
}
|
||||
|
||||
public override void OnFriendListUpdate(List<FriendInfo> friendList)
|
||||
{
|
||||
StartCoroutine("UpdateUIPing");
|
||||
|
||||
if (friendList.Count == 0)
|
||||
{
|
||||
ContentFeedback.text = "No Friends Found";
|
||||
}else
|
||||
{
|
||||
ContentFeedback.text = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
foreach (FriendInfo _info in friendList)
|
||||
{
|
||||
if (FriendCellList.ContainsKey(_info.UserId))
|
||||
{
|
||||
FriendCellList[_info.UserId].RefreshInfo(_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRoomListUpdateCallBack(List<RoomInfo> roomList)
|
||||
{
|
||||
PhotonNetwork.FindFriends(FriendsLUT);
|
||||
}
|
||||
|
||||
public void JoinFriendRoom(string RoomName)
|
||||
{
|
||||
//Debug.Log("FriendListView:JoinFriendRoom " + RoomName);
|
||||
OnJoinRoom.Invoke(RoomName);
|
||||
}
|
||||
|
||||
IEnumerator UpdateUIPing()
|
||||
{
|
||||
UpdateStatusText.text = "Updated";
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
foreach (KeyValuePair<string, FriendListCell> entry in FriendCellList)
|
||||
{
|
||||
if (entry.Value != null)
|
||||
{
|
||||
Destroy(entry.Value.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
FriendCellList = new Dictionary<string, FriendListCell>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce2efcae64ac14edebdffc99a93e401a
|
||||
timeCreated: 1513083233
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,134 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="PlayerListCell.cs" company="Exit Games GmbH">
|
||||
// Part of: Photon Unity Utilities,
|
||||
// </copyright>
|
||||
// <summary>
|
||||
// Player list cell representing a given PhotonPlayer
|
||||
// </summary>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
using Photon.Pun.UtilityScripts;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Player list cell representing a given PhotonPlayer
|
||||
/// </summary>
|
||||
public class PlayerListCell : MonoBehaviour
|
||||
{
|
||||
|
||||
public PlayerListView ListManager;
|
||||
|
||||
public Text NumberText;
|
||||
public Text NameText;
|
||||
public Image ActiveFlag;
|
||||
public Color InactiveColor;
|
||||
public Color ActiveColor;
|
||||
|
||||
public Text isLocalText;
|
||||
public Image isMasterFlag;
|
||||
|
||||
public LayoutElement LayoutElement;
|
||||
|
||||
Player _player;
|
||||
|
||||
public bool isInactiveCache;
|
||||
|
||||
|
||||
|
||||
public void RefreshInfo(ExitGames.Client.Photon.Hashtable changedProps)
|
||||
{
|
||||
UpdateInfo();
|
||||
}
|
||||
|
||||
public void AddToList(Player info, bool animate = false)
|
||||
{
|
||||
//Debug.Log("AddToList " + info.ToStringFull());
|
||||
|
||||
_player = info;
|
||||
|
||||
UpdateInfo();
|
||||
|
||||
if (animate)
|
||||
{
|
||||
|
||||
StartCoroutine("Add");
|
||||
}
|
||||
else
|
||||
{
|
||||
LayoutElement.minHeight = 30f;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveFromList()
|
||||
{
|
||||
StartCoroutine("Remove");
|
||||
}
|
||||
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
ListManager.SelectPlayer(_player);
|
||||
}
|
||||
|
||||
void UpdateInfo()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_player.NickName))
|
||||
{
|
||||
NameText.text = _player.ActorNumber.ToString();
|
||||
}
|
||||
|
||||
int _index = _player.GetPlayerNumber();
|
||||
NumberText.text = "#" + _index.ToString("00"); // if this function was not called on every update, we would need to listen to the PlayerNumbering delegate
|
||||
|
||||
NameText.text = _player.NickName;
|
||||
|
||||
ActiveFlag.color = _player.IsInactive ? InactiveColor : ActiveColor;
|
||||
|
||||
isLocalText.gameObject.SetActive(_player.IsLocal);
|
||||
|
||||
isMasterFlag.gameObject.SetActive(_player.IsMasterClient);
|
||||
|
||||
|
||||
// reorder the list to match player number
|
||||
if (_index >= 0 && this.transform.GetSiblingIndex() != _index)
|
||||
{
|
||||
this.transform.SetSiblingIndex(_index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IEnumerator Add()
|
||||
{
|
||||
this.isInactiveCache = false;
|
||||
|
||||
LayoutElement.minHeight = 0f;
|
||||
|
||||
while (LayoutElement.minHeight != 30f)
|
||||
{
|
||||
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 30f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Remove()
|
||||
{
|
||||
while (LayoutElement.minHeight != 0f)
|
||||
{
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 0f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0170261016c824eebb6c78e47e0b9ea0
|
||||
timeCreated: 1512563044
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,184 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="PlayerListView.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Player list UI View.
|
||||
/// </summary>
|
||||
public class PlayerListView : MonoBehaviourPunCallbacks
|
||||
{
|
||||
public PlayerDetailsController PlayerDetailManager;
|
||||
|
||||
public PlayerListCell CellPrototype;
|
||||
|
||||
public Text PlayerCountsText;
|
||||
|
||||
public Text UpdateStatusText;
|
||||
|
||||
Dictionary<int, PlayerListCell> playerCellList = new Dictionary<int, PlayerListCell>();
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
CellPrototype.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
|
||||
base.OnEnable();
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
|
||||
if (PhotonNetwork.CurrentRoom == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshCount();
|
||||
|
||||
foreach (KeyValuePair<int, Player> _entry in PhotonNetwork.CurrentRoom.Players)
|
||||
{
|
||||
if (playerCellList.ContainsKey(_entry.Key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Debug.Log("PlayerListView:adding player " + _entry.Key);
|
||||
playerCellList[_entry.Key] = Instantiate(CellPrototype);
|
||||
playerCellList[_entry.Key].transform.SetParent(CellPrototype.transform.parent, false);
|
||||
playerCellList[_entry.Key].gameObject.SetActive(true);
|
||||
playerCellList[_entry.Key].AddToList(_entry.Value, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectPlayer(Player player)
|
||||
{
|
||||
PlayerDetailManager.SetPlayerTarget(player);
|
||||
}
|
||||
|
||||
public override void OnPlayerEnteredRoom(Player newPlayer)
|
||||
{
|
||||
//Debug.Log("PlayerListView:OnPlayerEnteredRoom:" + newPlayer);
|
||||
|
||||
// we create the cell
|
||||
if (!playerCellList.ContainsKey(newPlayer.ActorNumber))
|
||||
{
|
||||
playerCellList[newPlayer.ActorNumber] = Instantiate(CellPrototype.gameObject).GetComponent<PlayerListCell>();
|
||||
playerCellList[newPlayer.ActorNumber].transform.SetParent(CellPrototype.transform.parent, false);
|
||||
playerCellList[newPlayer.ActorNumber].gameObject.SetActive(true);
|
||||
playerCellList[newPlayer.ActorNumber].AddToList(newPlayer, true);
|
||||
}
|
||||
else // rejoin
|
||||
{
|
||||
playerCellList[newPlayer.ActorNumber].RefreshInfo(null);
|
||||
}
|
||||
|
||||
|
||||
StartCoroutine("UpdateUIPing");
|
||||
}
|
||||
|
||||
public override void OnMasterClientSwitched(Player newMasterClient)
|
||||
{
|
||||
foreach (KeyValuePair<int, Player> _entry in PhotonNetwork.CurrentRoom.Players)
|
||||
{
|
||||
playerCellList[_entry.Key].RefreshInfo(null);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerPropertiesUpdate(Player target, ExitGames.Client.Photon.Hashtable changedProps)
|
||||
{
|
||||
if (playerCellList.ContainsKey(target.ActorNumber))
|
||||
{
|
||||
playerCellList[target.ActorNumber].RefreshInfo(changedProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("PlayerListView: missing Player Ui Cell for " + target, this);
|
||||
}
|
||||
|
||||
StartCoroutine("UpdateUIPing");
|
||||
}
|
||||
|
||||
public override void OnPlayerLeftRoom(Player otherPlayer)
|
||||
{
|
||||
//Debug.Log("OnPlayerLeftRoom isinactive " + otherPlayer.IsInactive);
|
||||
|
||||
// bool _remove = false;
|
||||
|
||||
if (!PhotonNetwork.PlayerListOthers.Contains(otherPlayer))
|
||||
{
|
||||
playerCellList[otherPlayer.ActorNumber].RemoveFromList();
|
||||
playerCellList.Remove(otherPlayer.ActorNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
playerCellList[otherPlayer.ActorNumber].RefreshInfo(null);
|
||||
}
|
||||
|
||||
// _remove = otherPlayer.IsInactive && playerCellList [otherPlayer.ID].isInactiveCache;
|
||||
//
|
||||
// if (otherPlayer.IsInactive && ! playerCellList [otherPlayer.ID].isInactiveCache) {
|
||||
//
|
||||
// //playerCellList [otherPlayer.ID].isInactiveCache = true;
|
||||
// playerCellList[otherPlayer.ID].RefreshInfo(null);
|
||||
// }
|
||||
//
|
||||
// if (_remove)
|
||||
// {
|
||||
// playerCellList[otherPlayer.ID].RemoveFromList ();
|
||||
// playerCellList.Remove (otherPlayer.ID);
|
||||
// }
|
||||
|
||||
StartCoroutine("UpdateUIPing");
|
||||
}
|
||||
|
||||
|
||||
void RefreshCount()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
PlayerCountsText.text = PhotonNetwork.CurrentRoom.PlayerCount.ToString("00");
|
||||
}
|
||||
|
||||
}
|
||||
IEnumerator UpdateUIPing()
|
||||
{
|
||||
UpdateStatusText.text = "Updated";
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
foreach (KeyValuePair<int, PlayerListCell> entry in playerCellList)
|
||||
{
|
||||
if (entry.Value != null)
|
||||
{
|
||||
Destroy(entry.Value.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
playerCellList = new Dictionary<int, PlayerListCell>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9df448c4ba9a4d4cb5a369b4692ceb2
|
||||
timeCreated: 1512479385
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,101 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="PropertyCell.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic string Property Cell.
|
||||
/// </summary>
|
||||
public class PropertyCell : MonoBehaviour
|
||||
{
|
||||
public Text PropertyText;
|
||||
public Text ValueText;
|
||||
|
||||
public Image isUpdatedFlag;
|
||||
|
||||
public LayoutElement LayoutElement;
|
||||
|
||||
public void UpdateInfo(string value)
|
||||
{
|
||||
bool _pingUpdate = string.Equals(this.ValueText.text, value);
|
||||
this.ValueText.text = value;
|
||||
|
||||
if (this!=null && this.isActiveAndEnabled && _pingUpdate)
|
||||
{
|
||||
StartCoroutine(UpdateUIPing());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddToList(string property, string value, bool animate = false)
|
||||
{
|
||||
this.PropertyText.text = property;
|
||||
if (animate)
|
||||
{
|
||||
UpdateInfo(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ValueText.text = value;
|
||||
isUpdatedFlag.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (animate)
|
||||
{
|
||||
|
||||
StartCoroutine("Add");
|
||||
}
|
||||
else
|
||||
{
|
||||
LayoutElement.minHeight = 30f;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveFromList()
|
||||
{
|
||||
StartCoroutine("Remove");
|
||||
}
|
||||
|
||||
IEnumerator UpdateUIPing()
|
||||
{
|
||||
isUpdatedFlag.gameObject.SetActive(true);
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
isUpdatedFlag.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
IEnumerator Add()
|
||||
{
|
||||
LayoutElement.minHeight = 0f;
|
||||
|
||||
while (LayoutElement.minHeight != 30f)
|
||||
{
|
||||
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 30f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Remove()
|
||||
{
|
||||
while (LayoutElement.minHeight != 0f)
|
||||
{
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 0f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b130ea0b2adec46ef87072879b8ac38c
|
||||
timeCreated: 1516282317
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,81 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="RoomListCell.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Region list cell.
|
||||
/// </summary>
|
||||
public class RegionListCell : MonoBehaviour
|
||||
{
|
||||
public RegionListView ListManager;
|
||||
|
||||
public Text CodeText;
|
||||
public Text IpText;
|
||||
public Text PingText;
|
||||
|
||||
public LayoutElement LayoutElement;
|
||||
|
||||
int _index;
|
||||
|
||||
Region info;
|
||||
|
||||
public void RefreshInfo(Region info)
|
||||
{
|
||||
this.info = info;
|
||||
CodeText.text = this.info.Code;
|
||||
IpText.text = this.info.HostAndPort;
|
||||
PingText.text = this.info.Ping +"ms";
|
||||
}
|
||||
|
||||
public void AddToList(Region info,int index)
|
||||
{
|
||||
RefreshInfo(info);
|
||||
_index = index;
|
||||
|
||||
StartCoroutine("AnimateAddition");
|
||||
|
||||
}
|
||||
|
||||
public void RemoveFromList()
|
||||
{
|
||||
StartCoroutine("AnimateRemove");
|
||||
}
|
||||
|
||||
IEnumerator AnimateAddition()
|
||||
{
|
||||
LayoutElement.minHeight = 0f;
|
||||
|
||||
yield return new WaitForSeconds(_index * 0.04f);
|
||||
|
||||
while (LayoutElement.minHeight != 30f)
|
||||
{
|
||||
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 30f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AnimateRemove()
|
||||
{
|
||||
while (LayoutElement.minHeight != 0f)
|
||||
{
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 0f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02fae3d80c772498b829c70de76f4ba7
|
||||
timeCreated: 1530794662
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,64 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="RoomListView.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Region list UI View.
|
||||
/// </summary>
|
||||
public class RegionListView : MonoBehaviour
|
||||
{
|
||||
|
||||
public RegionListCell CellPrototype;
|
||||
|
||||
Dictionary<string, RegionListCell> regionCellList = new Dictionary<string, RegionListCell>();
|
||||
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
ResetList();
|
||||
|
||||
CellPrototype.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnRegionListUpdate(List<Region> regionList)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (Region entry in regionList)
|
||||
{
|
||||
// we create the cell
|
||||
regionCellList[entry.Code] = Instantiate(CellPrototype);
|
||||
regionCellList[entry.Code].gameObject.SetActive(true);
|
||||
regionCellList[entry.Code].transform.SetParent(CellPrototype.transform.parent, false);
|
||||
regionCellList[entry.Code].AddToList(entry,i);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
foreach (KeyValuePair<string, RegionListCell> entry in regionCellList)
|
||||
{
|
||||
|
||||
if (entry.Value != null)
|
||||
{
|
||||
Destroy(entry.Value.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
regionCellList = new Dictionary<string, RegionListCell>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a77cb50929af40fb99c6452cf870935
|
||||
timeCreated: 1530794653
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,102 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="RoomListCell.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Roomlist cell.
|
||||
/// </summary>
|
||||
public class RoomListCell : MonoBehaviour
|
||||
{
|
||||
public RoomListView ListManager;
|
||||
|
||||
public Text RoomNameText;
|
||||
public Text PlayerCountText;
|
||||
public Text OpenText;
|
||||
public CanvasGroup JoinButtonCanvasGroup;
|
||||
public LayoutElement LayoutElement;
|
||||
|
||||
public RoomInfo info;
|
||||
|
||||
public void RefreshInfo(RoomInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
RoomNameText.text = info.Name;
|
||||
PlayerCountText.text = info.PlayerCount + "/" + info.MaxPlayers;
|
||||
if (info.IsOpen)
|
||||
{
|
||||
OpenText.text = "Open";
|
||||
OpenText.color = Color.green;
|
||||
JoinButtonCanvasGroup.blocksRaycasts = true;
|
||||
JoinButtonCanvasGroup.alpha = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenText.text = "Closed";
|
||||
OpenText.color = Color.red;
|
||||
JoinButtonCanvasGroup.blocksRaycasts = false;
|
||||
JoinButtonCanvasGroup.alpha = 0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnJoinRoomButtonClick()
|
||||
{
|
||||
ListManager.OnRoomCellJoinButtonClick(info.Name);
|
||||
}
|
||||
|
||||
|
||||
public void AddToList(RoomInfo info, bool animate = false)
|
||||
{
|
||||
RefreshInfo(info);
|
||||
|
||||
if (animate)
|
||||
{
|
||||
StartCoroutine("AnimateAddition");
|
||||
}
|
||||
else
|
||||
{
|
||||
LayoutElement.minHeight = 30f;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveFromList()
|
||||
{
|
||||
StartCoroutine("AnimateRemove");
|
||||
}
|
||||
|
||||
IEnumerator AnimateAddition()
|
||||
{
|
||||
LayoutElement.minHeight = 0f;
|
||||
|
||||
while (LayoutElement.minHeight != 30f)
|
||||
{
|
||||
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 30f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AnimateRemove()
|
||||
{
|
||||
while (LayoutElement.minHeight != 0f)
|
||||
{
|
||||
LayoutElement.minHeight = Mathf.MoveTowards(LayoutElement.minHeight, 0f, 2f);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 347470b28bdc940a9b92930118dbc7e0
|
||||
timeCreated: 1511958255
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,147 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="RoomListView.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// Room list UI View.
|
||||
/// </summary>
|
||||
public class RoomListView : MonoBehaviourPunCallbacks
|
||||
{
|
||||
[System.Serializable]
|
||||
public class OnJoinRoomEvent : UnityEvent<string> { }
|
||||
|
||||
public OnJoinRoomEvent OnJoinRoom;
|
||||
|
||||
public RoomListCell CellPrototype;
|
||||
|
||||
public Text UpdateStatusText;
|
||||
|
||||
public Text ContentFeedback;
|
||||
|
||||
public InputField LobbyNameInputField;
|
||||
public InputField SqlQueryInputField;
|
||||
|
||||
bool _firstUpdate = true;
|
||||
|
||||
Dictionary<string, RoomListCell> roomCellList = new Dictionary<string, RoomListCell>();
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
ResetList();
|
||||
CellPrototype.gameObject.SetActive(false);
|
||||
UpdateStatusText.text = string.Empty;
|
||||
ContentFeedback.text = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void OnRoomCellJoinButtonClick(string roomName)
|
||||
{
|
||||
OnJoinRoom.Invoke(roomName);
|
||||
}
|
||||
|
||||
public override void OnRoomListUpdate(List<RoomInfo> roomList)
|
||||
{
|
||||
UpdateStatusText.text = "Updated";
|
||||
|
||||
if (roomList.Count == 0 && !PhotonNetwork.InLobby) {
|
||||
ContentFeedback.text = "No Room found in lobby "+LobbyNameInputField.text+" Matching: "+SqlQueryInputField.text;
|
||||
}
|
||||
|
||||
foreach (RoomInfo entry in roomList)
|
||||
{
|
||||
if (roomCellList.ContainsKey(entry.Name))
|
||||
{
|
||||
if (entry.RemovedFromList)
|
||||
{
|
||||
// we delete the cell
|
||||
roomCellList[entry.Name].RemoveFromList();
|
||||
roomCellList.Remove(entry.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we update the cell
|
||||
roomCellList[entry.Name].RefreshInfo(entry);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!entry.RemovedFromList)
|
||||
{
|
||||
// we create the cell
|
||||
roomCellList[entry.Name] = Instantiate(CellPrototype);
|
||||
roomCellList[entry.Name].gameObject.SetActive(true);
|
||||
roomCellList[entry.Name].transform.SetParent(CellPrototype.transform.parent, false);
|
||||
roomCellList[entry.Name].AddToList(entry, !_firstUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StartCoroutine("clearStatus");
|
||||
|
||||
_firstUpdate = false;
|
||||
}
|
||||
|
||||
IEnumerator clearStatus()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
UpdateStatusText.text = string.Empty;
|
||||
}
|
||||
|
||||
public void OnJoinedLobbyCallBack()
|
||||
{
|
||||
_firstUpdate = true;
|
||||
ContentFeedback.text = string.Empty;
|
||||
}
|
||||
|
||||
public void GetRoomList()
|
||||
{
|
||||
ResetList ();
|
||||
|
||||
|
||||
TypedLobby sqlLobby = new TypedLobby(LobbyNameInputField.text, LobbyType.SqlLobby);
|
||||
|
||||
Debug.Log ("Cockpit: GetCustomRoomList() matchmaking against '"+LobbyNameInputField.text+"' SqlLobby using query : "+SqlQueryInputField.text);
|
||||
|
||||
PhotonNetwork.GetCustomRoomList(sqlLobby, SqlQueryInputField.text ); //"C0 = 'Hello'"
|
||||
|
||||
ContentFeedback.text = "looking for Rooms in Lobby '"+LobbyNameInputField.text+"' Matching: '"+SqlQueryInputField.text;
|
||||
}
|
||||
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
_firstUpdate = true;
|
||||
|
||||
foreach (KeyValuePair<string, RoomListCell> entry in roomCellList)
|
||||
{
|
||||
|
||||
if (entry.Value != null)
|
||||
{
|
||||
Destroy(entry.Value.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
roomCellList = new Dictionary<string, RoomListCell>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5c9e34bb9f7d43a4a17eb45abbba66e
|
||||
timeCreated: 1511958165
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 738dd6f6259233a4fb0d3e871097dacf
|
||||
folderAsset: yes
|
||||
timeCreated: 1521549690
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,71 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UserIdField.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// User identifier InputField.
|
||||
/// </summary>
|
||||
public class UserIdField : MonoBehaviour
|
||||
{
|
||||
|
||||
public PunCockpit Manager;
|
||||
|
||||
public InputField PropertyValueInput;
|
||||
|
||||
string _cache;
|
||||
|
||||
bool registered;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
PropertyValueInput.onEndEdit.AddListener(OnEndEdit);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
registered = false;
|
||||
PropertyValueInput.onEndEdit.RemoveListener(OnEndEdit);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Manager.UserId != _cache)
|
||||
{
|
||||
_cache = Manager.UserId;
|
||||
PropertyValueInput.text = _cache;
|
||||
}
|
||||
}
|
||||
|
||||
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then submit form.
|
||||
public void OnEndEdit(string value)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
this.SubmitForm(value.Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SubmitForm(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SubmitForm(string value)
|
||||
{
|
||||
_cache = value;
|
||||
Manager.UserId = _cache;
|
||||
//Debug.Log("PunCockpit.UserId = " + Manager.UserId, this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cc6aa808aba246ffa12d8e765f470ff
|
||||
timeCreated: 1521549697
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 418caa004faab434da814c76a8704dd8
|
||||
folderAsset: yes
|
||||
timeCreated: 1524135954
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,32 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="AppVersionProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.AppVersion UI property.
|
||||
/// </summary>
|
||||
public class AppVersionProperty : MonoBehaviour
|
||||
{
|
||||
|
||||
public Text Text;
|
||||
|
||||
string _cache;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.AppVersion != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.AppVersion;
|
||||
Text.text = _cache;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd20e7aa24847434aae5f175732ef601
|
||||
timeCreated: 1529581501
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,40 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="BestRegionInPrefsProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.BestRegionSummaryInPreferences UI property.
|
||||
/// </summary>
|
||||
public class BestRegionInPrefsProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
string _cache;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.BestRegionSummaryInPreferences != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.BestRegionSummaryInPreferences;
|
||||
|
||||
this.OnValueChanged();
|
||||
|
||||
if (string.IsNullOrEmpty(_cache))
|
||||
{
|
||||
Text.text = "n/a";
|
||||
}
|
||||
else
|
||||
{
|
||||
Text.text = _cache;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc582575c6a1e4ec08d8233345cc9ce5
|
||||
timeCreated: 1530877238
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,38 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CloudRegionProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CloudRegion UI property.
|
||||
/// </summary>
|
||||
public class CloudRegionProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
string _cache;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CloudRegion != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CloudRegion;
|
||||
this.OnValueChanged();
|
||||
if (string.IsNullOrEmpty(_cache))
|
||||
{
|
||||
Text.text = "n/a";
|
||||
}
|
||||
else
|
||||
{
|
||||
Text.text = _cache;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e873bef6b926e45989cc835cb13ef3c2
|
||||
timeCreated: 1524137791
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CountOfPlayersInRoomProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CountOfPlayersInRooms UI property.
|
||||
/// </summary>
|
||||
public class CountOfPlayersInRoomProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.NetworkingClient.Server == ServerConnection.MasterServer)
|
||||
{
|
||||
if (PhotonNetwork.CountOfPlayersInRooms != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CountOfPlayersInRooms;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efbb55080baae4567af10254c267900c
|
||||
timeCreated: 1524139797
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CountOfPlayersOnMasterProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CountOfPlayersOnMaster UI property.
|
||||
/// </summary>
|
||||
public class CountOfPlayersOnMasterProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.NetworkingClient.Server == ServerConnection.MasterServer)
|
||||
{
|
||||
if (PhotonNetwork.CountOfPlayersOnMaster != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CountOfPlayersOnMaster;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8567842684394fb7a291f803abfb20e
|
||||
timeCreated: 1524140344
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CountOfPlayersProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CountOfPlayers UI property.
|
||||
/// </summary>
|
||||
public class CountOfPlayersProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.NetworkingClient.Server == ServerConnection.MasterServer)
|
||||
{
|
||||
if (PhotonNetwork.CountOfPlayers != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CountOfPlayers;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c65e89c2d31b54d119911da56af443b6
|
||||
timeCreated: 1524139376
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CountOfRoomsProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CountOfRooms UIs property.
|
||||
/// </summary>
|
||||
public class CountOfRoomsProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.NetworkingClient.Server == ServerConnection.MasterServer)
|
||||
{
|
||||
if (PhotonNetwork.CountOfRooms != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CountOfRooms;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8da0abdf8617d4c76bc84fc49e21c53b
|
||||
timeCreated: 1524140003
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomAutoCleanupProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.AutoCleanUp UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomAutoCleanupProperty : PropertyListenerBase
|
||||
{
|
||||
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.CurrentRoom != null && PhotonNetwork.CurrentRoom.AutoCleanUp)
|
||||
{
|
||||
if ((PhotonNetwork.CurrentRoom.AutoCleanUp && _cache != 1) || (!PhotonNetwork.CurrentRoom.AutoCleanUp && _cache != 0))
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.AutoCleanUp ? 1 : 0;
|
||||
Text.text = PhotonNetwork.CurrentRoom.AutoCleanUp ? "true" : "false";
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5de4d7e09db242c4aa0d47c4416630b
|
||||
timeCreated: 1526298103
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomEmptyRoomTtlProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.EmptyRoomTtl UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomEmptyRoomTtlProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom.EmptyRoomTtl != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.EmptyRoomTtl;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67529d68dc8144ab1a5b19abf91fce56
|
||||
timeCreated: 1526041823
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,58 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomExpectedUsersProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System.Linq;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.ExpectedUsers UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomExpectedUsersProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
string[] _cache = null;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.CurrentRoom == null || PhotonNetwork.CurrentRoom.ExpectedUsers == null)
|
||||
{
|
||||
if (_cache != null)
|
||||
{
|
||||
_cache = null;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (_cache == null || (PhotonNetwork.CurrentRoom.ExpectedUsers != null && !PhotonNetwork.CurrentRoom.ExpectedUsers.SequenceEqual(_cache)))
|
||||
{
|
||||
|
||||
Text.text = string.Join("\n", PhotonNetwork.CurrentRoom.ExpectedUsers);
|
||||
|
||||
this.OnValueChanged();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (PhotonNetwork.CurrentRoom.ExpectedUsers == null && _cache != null)
|
||||
{
|
||||
|
||||
Text.text = string.Join("\n", PhotonNetwork.CurrentRoom.ExpectedUsers);
|
||||
|
||||
this.OnValueChanged();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83b21b2f76c734bfab616bc7a3ff65c5
|
||||
timeCreated: 1526043583
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomIsOfflineProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.IsOffline UI property
|
||||
/// </summary>
|
||||
public class CurrentRoomIsOfflineProperty : PropertyListenerBase
|
||||
{
|
||||
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if ((PhotonNetwork.CurrentRoom.IsOffline && _cache != 1) || (!PhotonNetwork.CurrentRoom.IsOffline && _cache != 0))
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.IsOffline ? 1 : 0;
|
||||
Text.text = PhotonNetwork.CurrentRoom.IsOffline ? "true" : "false";
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2e2a33f898da45eb9d44ea357e325db
|
||||
timeCreated: 1531142804
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,42 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomIsOpenProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.IsOpen UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomIsOpenProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if ((PhotonNetwork.CurrentRoom.IsOpen && _cache != 1) || (!PhotonNetwork.CurrentRoom.IsOpen && _cache != 0))
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.IsOpen ? 1 : 0;
|
||||
Text.text = PhotonNetwork.CurrentRoom.IsOpen ? "true" : "false";
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 616aae5178f614b47911b3ada06ac650
|
||||
timeCreated: 1526039184
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,44 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomIsVisibleProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.IsVisible UI property
|
||||
/// </summary>
|
||||
public class CurrentRoomIsVisibleProperty : PropertyListenerBase
|
||||
{
|
||||
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if ((PhotonNetwork.CurrentRoom.IsVisible && _cache != 1) || (!PhotonNetwork.CurrentRoom.IsVisible && _cache != 0))
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.IsVisible ? 1 : 0;
|
||||
Text.text = PhotonNetwork.CurrentRoom.IsVisible ? "true" : "false";
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9caca36858e0a4cdb9511261f0525c72
|
||||
timeCreated: 1526040810
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,42 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomMasterClientIdProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.MasterClientId UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomMasterClientIdProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom.MasterClientId != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.MasterClientId;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ded3411e394ba4dcc82f3b6e25871839
|
||||
timeCreated: 1531143038
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,42 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomMaxPlayersProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.MaxPlayers UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomMaxPlayersProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom.MaxPlayers != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.MaxPlayers;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 917233b0ebdbc43ff89ee3e8d30b5d88
|
||||
timeCreated: 1526041461
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomNameProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.Name UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomNameProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
string _cache = null;
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if ((PhotonNetwork.CurrentRoom.Name != _cache))
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.Name;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache == null)
|
||||
{
|
||||
_cache = null;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ca44b3b830b44829ba0990f748904ae
|
||||
timeCreated: 1526040981
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,42 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomPlayerCountProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.PlayerCount UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomPlayerCountProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom.PlayerCount != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.PlayerCount;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 333fe1be201784f8382dd2e7a1d5c610
|
||||
timeCreated: 1526038701
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="CurrentRoomPlayerTtlProperty.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.PlayerTtl UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomPlayerTtlProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
int _cache = -1;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom.PlayerTtl != _cache)
|
||||
{
|
||||
_cache = PhotonNetwork.CurrentRoom.PlayerTtl;
|
||||
Text.text = _cache.ToString();
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != -1)
|
||||
{
|
||||
_cache = -1;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0888b956b57041c5892998316eb5a59
|
||||
timeCreated: 1526041715
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,47 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="RoomListView.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using UnityEngine.UI;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// PhotonNetwork.CurrentRoom.PropertiesListedInLobby UI property.
|
||||
/// </summary>
|
||||
public class CurrentRoomPropertiesListedInLobbyProperty : PropertyListenerBase
|
||||
{
|
||||
public Text Text;
|
||||
|
||||
string[] _cache = null;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PhotonNetwork.CurrentRoom != null)
|
||||
{
|
||||
|
||||
if (_cache == null || !PhotonNetwork.CurrentRoom.PropertiesListedInLobby.SequenceEqual(_cache))
|
||||
{
|
||||
|
||||
_cache = PhotonNetwork.CurrentRoom.PropertiesListedInLobby.Clone() as string[];
|
||||
Text.text = string.Join("\n", PhotonNetwork.CurrentRoom.PropertiesListedInLobby);
|
||||
this.OnValueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cache != null)
|
||||
{
|
||||
_cache = null;
|
||||
Text.text = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user