first commit

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

View File

@@ -0,0 +1,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;
}
}
}

View File

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

View File

@@ -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);
}
}
}

View File

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

View File

@@ -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);
}
}
}

View File

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

View File

@@ -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);
}
}
}

View File

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