first commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8206eb39e85921d48879ad858b40a7ee
|
||||
folderAsset: yes
|
||||
timeCreated: 1511957079
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7133598fc7a8b4047b3a7b855224fcae
|
||||
timeCreated: 1527686027
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93560c151be5f43aaa41c69fba615970
|
||||
timeCreated: 1511957064
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f833cfc95509a49658fedf2e4cdc3a62
|
||||
timeCreated: 1538567673
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e264dd19757734dc8b3c48af67178478
|
||||
timeCreated: 1513602905
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a37901dfac2364b018833f32816a7a16
|
||||
timeCreated: 1511871213
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8701c2a6e3904e649bf803cefc241114
|
||||
folderAsset: yes
|
||||
timeCreated: 1519212764
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,252 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &131044
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22414286}
|
||||
- 222: {fileID: 22256986}
|
||||
- 114: {fileID: 11442032}
|
||||
- 114: {fileID: 11484926}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &162088
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22451254}
|
||||
- 222: {fileID: 22208322}
|
||||
- 114: {fileID: 11453352}
|
||||
- 114: {fileID: 11489264}
|
||||
- 114: {fileID: 11488050}
|
||||
- 114: {fileID: 11452846}
|
||||
m_Layer: 5
|
||||
m_Name: Help Button
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &11442032
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131044}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: e00995507c2406448b4c8429136104dd, type: 3}
|
||||
m_FontSize: 24
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 24
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: '?
|
||||
|
||||
'
|
||||
--- !u!114 &11452846
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 162088}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 09b634200c91b4206aa56038f7647fb5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Type: 1
|
||||
Reference: class_photon_1_1_chat_1_1_authentication_values.html#ac91cec9e6295f82a23df0e592fa23953
|
||||
--- !u!114 &11453352
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 162088}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11484926
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131044}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9d234639538a34b8d9e3cc6362a7afd0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Selectable: {fileID: 0}
|
||||
NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
HoverColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
--- !u!114 &11488050
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 162088}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e0e8b381f2c05442ca5c01638958156a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &11489264
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 162088}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
|
||||
m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
|
||||
m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 11453352}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
m_MethodName: Connect
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!222 &22208322
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 162088}
|
||||
--- !u!222 &22256986
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131044}
|
||||
--- !u!224 &22414286
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131044}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 22451254}
|
||||
m_RootOrder: 0
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &22451254
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 162088}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 22414286}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 0}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 162088}
|
||||
m_IsPrefabParent: 1
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf998ac0cf60141c597aecb3a8ffad74
|
||||
timeCreated: 1519212767
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,509 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &115674
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22402928}
|
||||
- 222: {fileID: 22262170}
|
||||
- 114: {fileID: 11463684}
|
||||
- 114: {fileID: 11485672}
|
||||
m_Layer: 5
|
||||
m_Name: Outline
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &150566
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22479552}
|
||||
- 114: {fileID: 11422640}
|
||||
m_Layer: 5
|
||||
m_Name: Tab Toggle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &172876
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22421460}
|
||||
- 222: {fileID: 22282328}
|
||||
- 114: {fileID: 11470998}
|
||||
- 114: {fileID: 11401750}
|
||||
m_Layer: 5
|
||||
m_Name: Decorator
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &179520
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22437952}
|
||||
- 222: {fileID: 22268730}
|
||||
- 114: {fileID: 11482838}
|
||||
m_Layer: 5
|
||||
m_Name: Checkmark
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &180104
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22401072}
|
||||
- 222: {fileID: 22244590}
|
||||
- 114: {fileID: 11406644}
|
||||
m_Layer: 5
|
||||
m_Name: Background
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &190380
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 224: {fileID: 22450892}
|
||||
- 222: {fileID: 22238140}
|
||||
- 114: {fileID: 11473958}
|
||||
- 114: {fileID: 11409462}
|
||||
- 114: {fileID: 11449964}
|
||||
m_Layer: 5
|
||||
m_Name: Label
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &11401750
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 172876}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 195602a009c4b42b6a62e0bdf601b70d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
toggle: {fileID: 11422640}
|
||||
NormalOnColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
NormalOffColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
HoverOnColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
HoverOffColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
--- !u!114 &11406644
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 180104}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.3843137, g: 0.3843137, b: 0.3843137, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 0
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11409462
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 190380}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||
m_EffectDistance: {x: 1, y: -1}
|
||||
m_UseGraphicAlpha: 1
|
||||
--- !u!114 &11422640
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 150566}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 2109663825, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
|
||||
m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
|
||||
m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 11406644}
|
||||
toggleTransition: 1
|
||||
graphic: {fileID: 11482838}
|
||||
m_Group: {fileID: 0}
|
||||
onValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
m_IsOn: 1
|
||||
--- !u!114 &11449964
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 190380}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ec99d371d7c8e44899ce4b834dfd4d6a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
toggle: {fileID: 11422640}
|
||||
NormalOnColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
|
||||
NormalOffColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
HoverOnColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
|
||||
HoverOffColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
--- !u!114 &11463684
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115674}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 21300000, guid: c222cd02c447941edb09ecb6433229ce, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11470998
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 172876}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 0
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11473958
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 190380}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: e00995507c2406448b4c8429136104dd, type: 3}
|
||||
m_FontSize: 20
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 2
|
||||
m_MaxSize: 20
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Actions
|
||||
--- !u!114 &11482838
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 179520}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11485672
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115674}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 195602a009c4b42b6a62e0bdf601b70d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
toggle: {fileID: 11422640}
|
||||
NormalOnColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
|
||||
NormalOffColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
HoverOnColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
|
||||
HoverOffColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
--- !u!222 &22238140
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 190380}
|
||||
--- !u!222 &22244590
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 180104}
|
||||
--- !u!222 &22262170
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115674}
|
||||
--- !u!222 &22268730
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 179520}
|
||||
--- !u!222 &22282328
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 172876}
|
||||
--- !u!224 &22401072
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 180104}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 22479552}
|
||||
m_RootOrder: 0
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &22402928
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 115674}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 22479552}
|
||||
m_RootOrder: 2
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0.0000076293945, y: -0.5}
|
||||
m_SizeDelta: {x: 0.000015258789, y: 1}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &22421460
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 172876}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 22479552}
|
||||
m_RootOrder: 4
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0.000061035156, y: -2}
|
||||
m_SizeDelta: {x: -2, y: 2}
|
||||
m_Pivot: {x: 0.5, y: 0}
|
||||
--- !u!224 &22437952
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 179520}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 22479552}
|
||||
m_RootOrder: 1
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &22450892
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 190380}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 22479552}
|
||||
m_RootOrder: 3
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &22479552
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 150566}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 22401072}
|
||||
- {fileID: 22437952}
|
||||
- {fileID: 22402928}
|
||||
- {fileID: 22450892}
|
||||
- {fileID: 22421460}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 150566}
|
||||
m_IsPrefabParent: 1
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 192c18d73e55e466d89edd9bc2ab936d
|
||||
timeCreated: 1520344180
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d6d60c803e244e51ba945a84b88757d
|
||||
timeCreated: 1511870912
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,807 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="PunCockpit.cs" company="Exit Games GmbH">
|
||||
// Part of: Pun Cockpit Demo
|
||||
// </copyright>
|
||||
// <author>developer@exitgames.com</author>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Photon.Pun.Demo.Cockpit.Forms;
|
||||
using Photon.Pun.Demo.Shared;
|
||||
using Photon.Realtime;
|
||||
using Hashtable = ExitGames.Client.Photon.Hashtable;
|
||||
|
||||
namespace Photon.Pun.Demo.Cockpit
|
||||
{
|
||||
/// <summary>
|
||||
/// UI based work in progress to test out api and act as foundation when dealing with room, friends and player list
|
||||
/// </summary>
|
||||
public class PunCockpit : MonoBehaviourPunCallbacks
|
||||
{
|
||||
public static PunCockpit Instance;
|
||||
public static bool Embedded;
|
||||
public static string EmbeddedGameTitle = "";
|
||||
|
||||
public bool debug = false;
|
||||
|
||||
public string UserId { get; set; }
|
||||
|
||||
public Text Title;
|
||||
public Text StateText; // set in inspector
|
||||
public Text UserIdText; // set in inspector
|
||||
|
||||
[Header("Demo Integration")]
|
||||
|
||||
public CanvasGroup MinimalCanvasGroup;
|
||||
public CanvasGroup MaximalCanvasGroup;
|
||||
public GameObject MinimizeButton;
|
||||
public GameObject MinimalUIEmbeddHelp;
|
||||
|
||||
[Header("Connection UI")]
|
||||
public GameObject ConnectingLabel;
|
||||
public GameObject ConnectionPanel;
|
||||
public GameObject AdvancedConnectionPanel;
|
||||
public Dropdown ConnectAsDropDown;
|
||||
|
||||
[Header("Common UI")]
|
||||
public GameObject InfosPanel;
|
||||
public GameObject MinimalUiInfosPanel;
|
||||
|
||||
[Header("Lobby UI")]
|
||||
public GameObject LobbyPanel;
|
||||
public Selectable JoinLobbyButton;
|
||||
public RoomListView RoomListManager;
|
||||
public FriendListView FriendListManager;
|
||||
public GameObject RoomListMatchMakingForm;
|
||||
|
||||
[Header("Game UI")]
|
||||
public GameObject GamePanel;
|
||||
public PlayerListView PlayerListManager;
|
||||
public PlayerDetailsController PlayerDetailsManager;
|
||||
|
||||
public InputField RoomCustomPropertyInputfield;
|
||||
|
||||
[Header("Photon Settings")]
|
||||
/// <summary>
|
||||
/// The game version override. This is one way to let the user define the gameversion, and set it properly right after we call connect to override the server settings
|
||||
/// Check ConnectAndJoinRandom.cs for another example of gameversion overriding
|
||||
/// </summary>
|
||||
public string GameVersionOverride = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The reset flag for best cloud ServerSettings.
|
||||
/// This is one way to let the user define if bestcloud cache should be reseted when connecting.
|
||||
/// </summary>
|
||||
public bool ResetBestRegionCodeInPreferences = false;
|
||||
|
||||
[Header("Room Options")]
|
||||
public int MaxPlayers = 4;
|
||||
public int PlayerTtl = 0;
|
||||
public int EmptyRoomTtl = 0;
|
||||
public string Plugins = "";
|
||||
public bool PublishUserId = true;
|
||||
public bool IsVisible = true;
|
||||
public bool IsOpen = true;
|
||||
//public bool CheckUserOnJoin = false;
|
||||
public bool CleanupCacheOnLeave = true;
|
||||
public bool DeleteNullProperties = false;
|
||||
|
||||
[Header("Room Options UI")]
|
||||
public IntInputField PlayerTtlField;
|
||||
public IntInputField EmptyRoomTtlField;
|
||||
public IntInputField MaxPlayersField;
|
||||
public StringInputField PluginsField;
|
||||
public BoolInputField PublishUserIdField;
|
||||
public BoolInputField IsVisibleField;
|
||||
public BoolInputField IsOpenField;
|
||||
public BoolInputField CleanupCacheOnLeaveField;
|
||||
// public BoolInputField CheckUserOnJoinField;
|
||||
public BoolInputField DeleteNullPropertiesField;
|
||||
|
||||
[Header("Friends Options")]
|
||||
public FriendListView.FriendDetail[] FriendsList =
|
||||
new FriendListView.FriendDetail[]{
|
||||
new FriendListView.FriendDetail("Joe","Joe"),
|
||||
new FriendListView.FriendDetail("Jane","Jane"),
|
||||
new FriendListView.FriendDetail("Bob","Bob")
|
||||
};
|
||||
|
||||
[Header("Modal window")]
|
||||
public CanvasGroup ModalWindow;
|
||||
|
||||
public RegionListView RegionListView;
|
||||
public Text RegionListLoadingFeedback;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
Instance = this;
|
||||
|
||||
// doc setup
|
||||
|
||||
DocLinks.Language = DocLinks.Languages.English;
|
||||
DocLinks.Product = DocLinks.Products.Pun;
|
||||
DocLinks.Version = DocLinks.Versions.V2;
|
||||
|
||||
//
|
||||
|
||||
ModalWindow.gameObject.SetActive (false);
|
||||
|
||||
MaximalCanvasGroup.gameObject.SetActive(true);
|
||||
|
||||
this.UserIdText.text = "";
|
||||
this.StateText.text = "";
|
||||
this.StateText.gameObject.SetActive(true);
|
||||
this.UserIdText.gameObject.SetActive(true);
|
||||
this.Title.gameObject.SetActive(true);
|
||||
|
||||
this.ConnectingLabel.SetActive(false);
|
||||
this.LobbyPanel.SetActive(false);
|
||||
this.GamePanel.SetActive(false);
|
||||
|
||||
if (string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
UserId = "user" + Environment.TickCount % 99; //made-up username
|
||||
}
|
||||
|
||||
PlayerTtlField.SetValue(this.PlayerTtl);
|
||||
EmptyRoomTtlField.SetValue(this.EmptyRoomTtl);
|
||||
MaxPlayersField.SetValue(this.MaxPlayers);
|
||||
PluginsField.SetValue(this.Plugins);
|
||||
PublishUserIdField.SetValue(this.PublishUserId);
|
||||
IsVisibleField.SetValue(this.IsVisible);
|
||||
IsOpenField.SetValue(this.IsOpen);
|
||||
CleanupCacheOnLeaveField.SetValue(this.CleanupCacheOnLeave);
|
||||
//CheckUserOnJoinField.SetValue (this.CheckUserOnJoin);
|
||||
DeleteNullPropertiesField.SetValue(this.DeleteNullProperties);
|
||||
|
||||
|
||||
|
||||
// prefill dropdown selection of users
|
||||
ConnectAsDropDown.ClearOptions();
|
||||
ConnectAsDropDown.AddOptions(FriendsList.Select(x => x.NickName).ToList());
|
||||
|
||||
|
||||
// check the current network status
|
||||
|
||||
if (PhotonNetwork.IsConnected)
|
||||
{
|
||||
if (PhotonNetwork.Server == ServerConnection.GameServer)
|
||||
{
|
||||
this.OnJoinedRoom ();
|
||||
|
||||
}
|
||||
else if (PhotonNetwork.Server == ServerConnection.MasterServer || PhotonNetwork.Server == ServerConnection.NameServer)
|
||||
{
|
||||
|
||||
if (PhotonNetwork.InLobby)
|
||||
{
|
||||
this.OnJoinedLobby ();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.OnConnectedToMaster ();
|
||||
}
|
||||
|
||||
}
|
||||
}else
|
||||
{
|
||||
this.SwitchToSimpleConnection();
|
||||
|
||||
if (!Embedded)
|
||||
{
|
||||
MinimizeButton.SetActive(false);
|
||||
SwitchtoMaximalPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Title.text = EmbeddedGameTitle;
|
||||
SwitchtoMinimalPanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchtoMinimalPanel()
|
||||
{
|
||||
MinimalCanvasGroup.gameObject.SetActive(true);
|
||||
MaximalCanvasGroup.alpha = 0f;
|
||||
MaximalCanvasGroup.blocksRaycasts = false;
|
||||
MaximalCanvasGroup.interactable = false;
|
||||
}
|
||||
|
||||
public void SwitchtoMaximalPanel()
|
||||
{
|
||||
MinimalUIEmbeddHelp.SetActive(false);
|
||||
MinimalCanvasGroup.gameObject.SetActive(false);
|
||||
|
||||
MaximalCanvasGroup.alpha = 1f;
|
||||
MaximalCanvasGroup.blocksRaycasts = true;
|
||||
MaximalCanvasGroup.interactable = true;
|
||||
}
|
||||
|
||||
public void SwitchToAdvancedConnection()
|
||||
{
|
||||
this.ConnectionPanel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void SwitchToSimpleConnection()
|
||||
{
|
||||
this.ConnectionPanel.gameObject.SetActive(true);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ToggleInfosInMinimalPanel()
|
||||
{
|
||||
MinimalUiInfosPanel.SetActive(!MinimalUiInfosPanel.activeSelf);
|
||||
}
|
||||
|
||||
public void RequestInfosPanel(GameObject Parent)
|
||||
{
|
||||
if (Parent != null)
|
||||
{
|
||||
InfosPanel.transform.SetParent(Parent.transform, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnUserIdSubmited(string userId)
|
||||
{
|
||||
this.UserId = userId;
|
||||
this.Connect();
|
||||
}
|
||||
|
||||
public void SetPlayerTtlRoomOption(int value)
|
||||
{
|
||||
this.PlayerTtl = value;
|
||||
if (debug) Debug.Log("PunCockpit:PlayerTtl = " + this.PlayerTtl);
|
||||
}
|
||||
|
||||
public void SetEmptyRoomTtlRoomOption(int value)
|
||||
{
|
||||
this.EmptyRoomTtl = value;
|
||||
if (debug) Debug.Log("PunCockpit:EmptyRoomTtl = " + this.EmptyRoomTtl);
|
||||
}
|
||||
|
||||
public void SetMaxPlayersRoomOption(int value)
|
||||
{
|
||||
this.MaxPlayers = value;
|
||||
if (debug) Debug.Log("PunCockpit:MaxPlayers = " + this.MaxPlayers);
|
||||
}
|
||||
|
||||
public void SetPluginsRoomOption(string value)
|
||||
{
|
||||
this.Plugins = value;
|
||||
if (debug) Debug.Log("PunCockpit:Plugins = " + this.Plugins);
|
||||
}
|
||||
|
||||
public void SetPublishUserId(bool value)
|
||||
{
|
||||
this.PublishUserId = value;
|
||||
if (debug) Debug.Log("PunCockpit:PublishUserId = " + this.PublishUserId);
|
||||
}
|
||||
|
||||
public void SetIsVisible(bool value)
|
||||
{
|
||||
this.IsVisible = value;
|
||||
if (debug) Debug.Log("PunCockpit:IsVisible = " + this.IsVisible);
|
||||
}
|
||||
|
||||
public void SetIsOpen(bool value)
|
||||
{
|
||||
this.IsOpen = value;
|
||||
if (debug) Debug.Log("PunCockpit:IsOpen = " + this.IsOpen);
|
||||
}
|
||||
|
||||
// public void SetCheckUserOnJoin(bool value)
|
||||
// {
|
||||
// this.CheckUserOnJoin = value;
|
||||
// Debug.Log ("CheckUserOnJoin = " + this.CheckUserOnJoin);
|
||||
// }
|
||||
|
||||
public void SetResetBestRegionCodeInPreferences(bool value)
|
||||
{
|
||||
this.ResetBestRegionCodeInPreferences = value;
|
||||
if (debug) Debug.Log("PunCockpit:ResetBestRegionCodeInPreferences = " + this.ResetBestRegionCodeInPreferences);
|
||||
}
|
||||
|
||||
public void SetCleanupCacheOnLeave(bool value)
|
||||
{
|
||||
this.CleanupCacheOnLeave = value;
|
||||
if (debug) Debug.Log("PunCockpit:CleanupCacheOnLeave = " + this.CleanupCacheOnLeave);
|
||||
}
|
||||
|
||||
public void SetDeleteNullProperties(bool value)
|
||||
{
|
||||
this.DeleteNullProperties = value;
|
||||
if (debug) Debug.Log("PunCockpit:DeleteNullProperties = " + this.DeleteNullProperties);
|
||||
}
|
||||
|
||||
LoadBalancingClient _lbc;
|
||||
bool _regionPingProcessActive;
|
||||
List<Region> RegionsList;
|
||||
|
||||
/// <summary>
|
||||
/// in progress, not fully working
|
||||
/// </summary>
|
||||
public void PingRegions()
|
||||
{
|
||||
ModalWindow.gameObject.SetActive (true);
|
||||
|
||||
RegionListLoadingFeedback.text = "Connecting to NameServer...";
|
||||
_regionPingProcessActive = true;
|
||||
if (debug) Debug.Log("PunCockpit:PingRegions:ConnectToNameServer");
|
||||
|
||||
|
||||
_lbc = new LoadBalancingClient();
|
||||
|
||||
_lbc.AddCallbackTarget(this);
|
||||
|
||||
|
||||
_lbc.StateChanged += OnStateChanged;
|
||||
|
||||
_lbc.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
|
||||
_lbc.ConnectToNameServer ();
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_lbc!=null) _lbc.Service();
|
||||
|
||||
if (RegionsList !=null)
|
||||
{
|
||||
if (this.ModalWindow.gameObject.activeInHierarchy) {
|
||||
|
||||
if (PunCockpit.Instance.debug) Debug.Log("PunCockpit:OnRegionsPinged");
|
||||
|
||||
this.RegionListView.OnRegionListUpdate (RegionsList);
|
||||
}
|
||||
|
||||
_lbc = null;
|
||||
|
||||
RegionListLoadingFeedback.text = string.Empty;
|
||||
|
||||
RegionsList = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnStateChanged(ClientState previousState, ClientState state)
|
||||
{
|
||||
if (state == ClientState.ConnectedToNameServer) {
|
||||
_lbc.StateChanged -= this.OnStateChanged;
|
||||
|
||||
if (debug) Debug.Log("PunCockpit:OnStateChanged: ClientState.ConnectedToNameServer. Waiting for OnRegionListReceived callback.");
|
||||
|
||||
RegionListLoadingFeedback.text = "Waiting for application Region List...";
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRegionListReceived(RegionHandler regionHandler)
|
||||
{
|
||||
if (PunCockpit.Instance.debug)
|
||||
Debug.Log ("PunCockpit:OnRegionListReceived: " + regionHandler);
|
||||
|
||||
if (_regionPingProcessActive)
|
||||
{
|
||||
RegionListLoadingFeedback.text = "Pinging Regions...";
|
||||
_regionPingProcessActive = false;
|
||||
regionHandler.PingMinimumOfRegions (OnRegionsPinged, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnRegionsPinged(RegionHandler regionHandler)
|
||||
{
|
||||
RegionsList = regionHandler.EnabledRegions.OrderBy(x=>x.Ping).ToList();
|
||||
// will check this on Update() to get back to the main thread.
|
||||
|
||||
}
|
||||
|
||||
public void CloseRegionListView()
|
||||
{
|
||||
|
||||
RegionsList = null;
|
||||
|
||||
if (_lbc != null) {
|
||||
_lbc.Disconnect ();
|
||||
_lbc = null;
|
||||
}
|
||||
|
||||
_regionPingProcessActive = false;
|
||||
|
||||
this.RegionListView.ResetList ();
|
||||
this.ModalWindow.gameObject.SetActive (false);
|
||||
}
|
||||
|
||||
public void LoadLevel(string level)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:LoadLevel(" +level+")");
|
||||
PhotonNetwork.LoadLevel(level);
|
||||
}
|
||||
|
||||
public void SetRoomCustomProperty(string value)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:SetRoomCustomProperty() c0 = " + value);
|
||||
PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable() { { "C0", value } });
|
||||
}
|
||||
|
||||
private string roomNameToEnter;
|
||||
|
||||
public void JoinRoom(string roomName)
|
||||
{
|
||||
this.RoomListManager.ResetList();
|
||||
this.LobbyPanel.gameObject.SetActive(false);
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
this.roomNameToEnter = roomName;
|
||||
PhotonNetwork.JoinRoom(roomName);
|
||||
}
|
||||
|
||||
public void CreateRoom()
|
||||
{
|
||||
this.CreateRoom(null, null, LobbyType.Default);
|
||||
}
|
||||
|
||||
public void CreateRoom(string roomName, string lobbyName = "MyLobby", LobbyType lobbyType = LobbyType.SqlLobby, string[] expectedUsers = null)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:CreateRoom roomName:" + roomName + " lobbyName:" + lobbyName + " lobbyType:" + lobbyType + " expectedUsers:" + (expectedUsers == null ? "null" : expectedUsers.ToStringFull()));
|
||||
|
||||
this.RoomListManager.ResetList();
|
||||
this.LobbyPanel.gameObject.SetActive(false);
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
RoomOptions _roomOptions = this.GetRoomOptions();
|
||||
if (debug) Debug.Log("PunCockpit:Room options <" + _roomOptions + ">");
|
||||
|
||||
TypedLobby sqlLobby = new TypedLobby(lobbyName, lobbyType);
|
||||
bool _result = PhotonNetwork.CreateRoom(roomName, _roomOptions, sqlLobby, expectedUsers);
|
||||
|
||||
if (debug) Debug.Log("PunCockpit:CreateRoom() -> " + _result);
|
||||
|
||||
}
|
||||
|
||||
public void JoinRandomRoom()
|
||||
{
|
||||
PhotonNetwork.JoinRandomRoom();
|
||||
}
|
||||
|
||||
public void LeaveRoom()
|
||||
{
|
||||
PlayerListManager.ResetList();
|
||||
this.GamePanel.gameObject.SetActive(false);
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
PhotonNetwork.LeaveRoom();
|
||||
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
this.ConnectionPanel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues();
|
||||
PhotonNetwork.AuthValues.UserId = this.UserId;
|
||||
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
PhotonNetwork.ConnectUsingSettings();
|
||||
//if (GameVersionOverride != string.Empty) {
|
||||
// PhotonNetwork.GameVersion = "28"; // GameVersionOverride;
|
||||
// }
|
||||
}
|
||||
|
||||
public void ReConnect()
|
||||
{
|
||||
this.ConnectionPanel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues();
|
||||
PhotonNetwork.AuthValues.UserId = this.UserId;
|
||||
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
PhotonNetwork.Reconnect();
|
||||
}
|
||||
|
||||
public void ReconnectAndRejoin()
|
||||
{
|
||||
this.ConnectionPanel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues();
|
||||
PhotonNetwork.AuthValues.UserId = this.UserId;
|
||||
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
PhotonNetwork.ReconnectAndRejoin();
|
||||
}
|
||||
|
||||
|
||||
public void ConnectToBestCloudServer()
|
||||
{
|
||||
|
||||
PhotonNetwork.NetworkingClient.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
|
||||
|
||||
this.ConnectionPanel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues();
|
||||
PhotonNetwork.AuthValues.UserId = this.UserId;
|
||||
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
if (this.ResetBestRegionCodeInPreferences) {
|
||||
ServerSettings.ResetBestRegionCodeInPreferences ();
|
||||
}
|
||||
|
||||
PhotonNetwork.ConnectToBestCloudServer();
|
||||
if (GameVersionOverride != string.Empty) {
|
||||
PhotonNetwork.GameVersion = GameVersionOverride;
|
||||
}
|
||||
}
|
||||
|
||||
public void ConnectToRegion(string region)
|
||||
{
|
||||
|
||||
if (debug) Debug.Log("PunCockpit:ConnectToRegion(" + region + ")");
|
||||
|
||||
PhotonNetwork.NetworkingClient.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
|
||||
|
||||
this.ConnectionPanel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
|
||||
PhotonNetwork.AuthValues = new AuthenticationValues();
|
||||
PhotonNetwork.AuthValues.UserId = this.UserId;
|
||||
|
||||
this.ConnectingLabel.SetActive(true);
|
||||
|
||||
bool _result = PhotonNetwork.ConnectToRegion(region);
|
||||
|
||||
if (GameVersionOverride != string.Empty) {
|
||||
PhotonNetwork.GameVersion = GameVersionOverride;
|
||||
}
|
||||
|
||||
if (debug) Debug.Log("PunCockpit:ConnectToRegion(" + region + ") ->" + _result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ConnectOffline()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:ConnectOffline()");
|
||||
PhotonNetwork.OfflineMode = true;
|
||||
}
|
||||
|
||||
public void JoinLobby()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:JoinLobby()");
|
||||
bool _result = PhotonNetwork.JoinLobby();
|
||||
|
||||
if (!_result) {
|
||||
Debug.LogError ("PunCockpit: Could not joinLobby");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:Disconnect()");
|
||||
PhotonNetwork.Disconnect();
|
||||
}
|
||||
|
||||
|
||||
public void OpenDashboard()
|
||||
{
|
||||
Application.OpenURL("https://dashboard.photonengine.com");
|
||||
}
|
||||
|
||||
|
||||
#region CONNECT UI
|
||||
public void OnDropdownConnectAs(int dropdownIndex)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnDropdownConnectAs(" + dropdownIndex + ")");
|
||||
|
||||
this.UserId = this.FriendsList[dropdownIndex].UserId;
|
||||
PlayerPrefs.SetString(UserIdUiForm.UserIdPlayerPref, this.UserId);
|
||||
|
||||
StartCoroutine(OnDropdownConnectAs_CB());
|
||||
}
|
||||
|
||||
IEnumerator OnDropdownConnectAs_CB()
|
||||
{
|
||||
// wait for the dropdown to animate.
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
this.Connect();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region IN LOBBY UI
|
||||
|
||||
public void OnLobbyToolsViewTabChanged(string tabId)
|
||||
{
|
||||
// Debug.Log("PunCockpit:OnLobbyToolsViewTabChanged("+tabId+")");
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IN ROOM UI
|
||||
|
||||
public void OnSelectPlayer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PUN CallBacks
|
||||
|
||||
public override void OnConnected()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnConnected()");
|
||||
|
||||
this.ConnectingLabel.SetActive(false);
|
||||
|
||||
this.UserIdText.text = "UserId:" + this.UserId + " Nickname:" + PhotonNetwork.NickName;
|
||||
}
|
||||
|
||||
public override void OnDisconnected(DisconnectCause cause)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnDisconnected("+cause+")");
|
||||
|
||||
this.ConnectingLabel.SetActive(false);
|
||||
this.UserIdText.text = string.Empty;
|
||||
this.StateText.text = string.Empty;
|
||||
|
||||
this.GamePanel.gameObject.SetActive(false);
|
||||
this.LobbyPanel.gameObject.SetActive(false);
|
||||
this.ConnectionPanel.gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
|
||||
public override void OnConnectedToMaster()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnConnectedToMaster()");
|
||||
|
||||
|
||||
this.StateText.text = "Connected to Master" + (PhotonNetwork.OfflineMode ? " <Color=Red><b>Offline</b></color>" : "");
|
||||
|
||||
this.SetUpLobbyGenericUI();
|
||||
}
|
||||
|
||||
public override void OnJoinedLobby()
|
||||
{
|
||||
this.StateText.text = "Connected to Lobby";
|
||||
|
||||
if (debug) Debug.Log("PunCockpit:OnJoinedLobby()");
|
||||
this.SetUpLobbyGenericUI();
|
||||
}
|
||||
|
||||
void SetUpLobbyGenericUI()
|
||||
{
|
||||
this.ConnectingLabel.gameObject.SetActive(false);
|
||||
this.AdvancedConnectionPanel.gameObject.SetActive(false);
|
||||
this.LobbyPanel.gameObject.SetActive(true);
|
||||
this.RoomListManager.OnJoinedLobbyCallBack();
|
||||
this.FriendListManager.SetFriendDetails(this.FriendsList);
|
||||
|
||||
JoinLobbyButton.interactable = !PhotonNetwork.InLobby && !PhotonNetwork.OfflineMode;
|
||||
|
||||
|
||||
RoomListManager.gameObject.SetActive(!PhotonNetwork.OfflineMode);
|
||||
FriendListManager.gameObject.SetActive(!PhotonNetwork.OfflineMode);
|
||||
|
||||
RoomListMatchMakingForm.SetActive(!PhotonNetwork.InLobby);
|
||||
}
|
||||
|
||||
public override void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnRoomPropertiesUpdate() " + propertiesThatChanged.ToStringFull());
|
||||
|
||||
if (propertiesThatChanged.ContainsKey("C0"))
|
||||
{
|
||||
RoomCustomPropertyInputfield.text = propertiesThatChanged["C0"].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnLeftLobby()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnLeftLobby()");
|
||||
|
||||
this.RoomListManager.ResetList();
|
||||
this.LobbyPanel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public override void OnCreateRoomFailed(short returnCode, string message)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnCreateRoomFailed(" + returnCode + "," + message + ")");
|
||||
}
|
||||
|
||||
public override void OnJoinRandomFailed(short returnCode, string message)
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnJoinRandomFailed(" + returnCode + "," + message + ")");
|
||||
}
|
||||
|
||||
public override void OnJoinedRoom()
|
||||
{
|
||||
|
||||
this.StateText.text = "Connected to GameServer " + (PhotonNetwork.OfflineMode ? " <Color=Red><b>Offline</b></color>" : "");
|
||||
|
||||
|
||||
if (debug) Debug.Log("PunCockpit:OnJoinedRoom()");
|
||||
|
||||
this.ConnectingLabel.gameObject.SetActive(false);
|
||||
|
||||
this.PlayerListManager.ResetList();
|
||||
|
||||
this.GamePanel.gameObject.SetActive(true);
|
||||
|
||||
this.PlayerDetailsManager.SetPlayerTarget(PhotonNetwork.LocalPlayer);
|
||||
|
||||
}
|
||||
|
||||
public override void OnJoinRoomFailed(short returnCode, string message)
|
||||
{
|
||||
switch (returnCode)
|
||||
{
|
||||
case ErrorCode.JoinFailedFoundInactiveJoiner:
|
||||
if (!string.IsNullOrEmpty(this.roomNameToEnter))
|
||||
{
|
||||
PhotonNetwork.RejoinRoom(this.roomNameToEnter);
|
||||
this.roomNameToEnter = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnLeftRoom()
|
||||
{
|
||||
if (debug) Debug.Log("PunCockpit:OnLeftRoom()");
|
||||
this.GamePanel.gameObject.SetActive(false);
|
||||
|
||||
if (PhotonNetwork.OfflineMode)
|
||||
{
|
||||
this.ConnectingLabel.gameObject.SetActive(false);
|
||||
this.ConnectionPanel.gameObject.SetActive (true);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
RoomOptions GetRoomOptions()
|
||||
{
|
||||
RoomOptions _roomOptions = new RoomOptions();
|
||||
|
||||
_roomOptions.MaxPlayers = (byte)this.MaxPlayers;
|
||||
|
||||
_roomOptions.IsOpen = this.IsOpen;
|
||||
|
||||
_roomOptions.IsVisible = this.IsVisible;
|
||||
|
||||
_roomOptions.EmptyRoomTtl = this.EmptyRoomTtl;
|
||||
|
||||
_roomOptions.PlayerTtl = this.PlayerTtl;
|
||||
|
||||
_roomOptions.PublishUserId = this.PublishUserId;
|
||||
|
||||
_roomOptions.CleanupCacheOnLeave = this.CleanupCacheOnLeave;
|
||||
_roomOptions.DeleteNullProperties = this.DeleteNullProperties;
|
||||
|
||||
_roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "C0", "Hello" } };
|
||||
_roomOptions.CustomRoomPropertiesForLobby = new string[] { "C0" };
|
||||
|
||||
|
||||
return _roomOptions;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f65282626d77d47738989d339cb4f3ff
|
||||
timeCreated: 1527164509
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2a025fd6ea894647ad6404f32fa2b5e
|
||||
folderAsset: yes
|
||||
timeCreated: 1524225548
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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:
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user