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,57 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConnectToRegionUIForm.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.Forms
{
/// <summary>
/// Manager for ConnectToRegion UI Form
/// </summary>
public class ConnectToRegionUIForm : MonoBehaviour
{
public InputField RegionInput;
public Dropdown RegionListInput;
[System.Serializable]
public class OnSubmitEvent : UnityEvent<string>{}
public OnSubmitEvent OnSubmit;
public void Start()
{
}
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
public void EndEditOnEnter()
{
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
{
this.SubmitForm();
}
}
public void SetRegionFromDropDown(int index)
{
if (index == 0) {
return;
}
RegionInput.text = RegionListInput.options[index].text;
RegionListInput.value = 0;
}
public void SubmitForm()
{
OnSubmit.Invoke (RegionInput.text);
}
}
}

View File

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

View File

@ -0,0 +1,71 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CreateRoomUiForm.cs" company="Exit Games GmbH">
// Part of: Pun Cockpit Demo
// </copyright>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using Photon.Realtime;
namespace Photon.Pun.Demo.Cockpit.Forms
{
/// <summary>
/// Create room user interface form.
/// </summary>
public class CreateRoomUiForm : MonoBehaviour
{
public InputField RoomNameInput;
public InputField LobbyNameInput;
public InputField ExpectedUsersInput;
public Dropdown LobbyTypeInput;
[System.Serializable]
public class OnSubmitEvent : UnityEvent<string, string, LobbyType, string[]> { }
public OnSubmitEvent OnSubmit;
public void Start()
{
}
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
public void EndEditOnEnter()
{
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
{
this.SubmitForm();
}
}
public void SubmitForm()
{
LobbyType _t = LobbyType.Default;
if (LobbyTypeInput.value == 1)
{
_t = LobbyType.SqlLobby;
}
else if (LobbyTypeInput.value == 2)
{
_t = LobbyType.AsyncRandomLobby;
}
string[] _expectedUsers = string.IsNullOrEmpty(ExpectedUsersInput.text) ? null : ExpectedUsersInput.text.Split(',').Select(t => t.Trim()).ToArray();
OnSubmit.Invoke(
string.IsNullOrEmpty(RoomNameInput.text) ? null : RoomNameInput.text,
string.IsNullOrEmpty(LobbyNameInput.text) ? null : LobbyNameInput.text,
_t,
_expectedUsers);
}
}
}

View File

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

View File

@ -0,0 +1,47 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SetRoomCustomPropertyUIForm.cs" company="Exit Games GmbH">
// Part of: Pun Cockpit Demo
// </copyright>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
namespace Photon.Pun.Demo.Cockpit.Forms
{
/// <summary>
/// Level Loading UI Form.
/// </summary>
public class LoadLevelUIForm : MonoBehaviour
{
public InputField PropertyValueInput;
[System.Serializable]
public class OnSubmitEvent : UnityEvent<string> { }
public OnSubmitEvent OnSubmit;
public void Start()
{
}
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
public void EndEditOnEnter()
{
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
{
this.SubmitForm();
}
}
public void SubmitForm()
{
OnSubmit.Invoke(PropertyValueInput.text);
}
}
}

View File

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

View File

@ -0,0 +1,47 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SetRoomCustomPropertyUIForm.cs" company="Exit Games GmbH">
// Part of: Pun Cockpit Demo
// </copyright>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
namespace Photon.Pun.Demo.Cockpit.Forms
{
/// <summary>
/// Room custom properties UI Form.
/// </summary>
public class SetRoomCustomPropertyUIForm : MonoBehaviour
{
public InputField PropertyValueInput;
[System.Serializable]
public class OnSubmitEvent : UnityEvent<string> { }
public OnSubmitEvent OnSubmit;
public void Start()
{
}
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
public void EndEditOnEnter()
{
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
{
this.SubmitForm();
}
}
public void SubmitForm()
{
OnSubmit.Invoke(PropertyValueInput.text);
}
}
}

View File

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

View File

@ -0,0 +1,54 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UserIdUiForm.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.Forms
{
/// <summary>
/// User Id UI form.
/// </summary>
public class UserIdUiForm : MonoBehaviour
{
public const string UserIdPlayerPref = "PunUserId";
public InputField idInput;
[System.Serializable]
public class OnSubmitEvent : UnityEvent<string> { }
public OnSubmitEvent OnSubmit;
public void Start()
{
string prefsName = PlayerPrefs.GetString(UserIdUiForm.UserIdPlayerPref);
if (!string.IsNullOrEmpty(prefsName))
{
this.idInput.text = prefsName;
}
}
// new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
public void EndEditOnEnter()
{
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
{
this.SubmitForm();
}
}
public void SubmitForm()
{
PlayerPrefs.SetString(UserIdUiForm.UserIdPlayerPref, idInput.text);
OnSubmit.Invoke(idInput.text);
}
}
}

View File

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