Skip to content

Commit

Permalink
updated to PUN 2.34.1, updated other packages and assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Kwan committed Jul 29, 2021
1 parent 5bfd4bb commit 8fb6676
Show file tree
Hide file tree
Showing 645 changed files with 206,038 additions and 29 deletions.
9 changes: 9 additions & 0 deletions Assets/Photon/PhotonChat/Demos.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="EventSystemSpawner.cs" company="Exit Games GmbH">
// </copyright>
// <summary>
// For additive Scene Loading context, eventSystem can't be added to each scene and instead should be instanciated only if necessary.
// https://answers.unity.com/questions/1403002/multiple-eventsystem-in-scene-this-is-not-supporte.html
// </summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------

using UnityEngine;
using UnityEngine.EventSystems;

namespace Photon.Chat.UtilityScripts
{
/// <summary>
/// Event system spawner. Will add an EventSystem GameObject with an EventSystem component and a StandaloneInputModule component
/// Use this in additive scene loading context where you would otherwise get a "Multiple eventsystem in scene... this is not supported" error from Unity
/// </summary>
public class EventSystemSpawner : MonoBehaviour
{
void Start()
{
EventSystem sceneEventSystem = FindObjectOfType<EventSystem>();
if (sceneEventSystem == null)
{
GameObject eventSystem = new GameObject("EventSystem");

eventSystem.AddComponent<EventSystem>();
eventSystem.AddComponent<StandaloneInputModule>();
}
}
}
}
12 changes: 12 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="OnStartDelete.cs" company="Exit Games GmbH">
// Part of: Photon Unity Utilities,
// </copyright>
// <summary>
// This component will destroy the GameObject it is attached to (in Start()).
// </summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------

using UnityEngine;

namespace Photon.Chat.UtilityScripts
{
/// <summary>This component will destroy the GameObject it is attached to (in Start()).</summary>
public class OnStartDelete : MonoBehaviour
{
// Use this for initialization
private void Start()
{
Destroy(this.gameObject);
}
}
}
12 changes: 12 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TextButtonTransition.cs" company="Exit Games GmbH">
// </copyright>
// <summary>
// Use this on Button texts to have some color transition on the text as well without corrupting button's behaviour.
// </summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Photon.Chat.UtilityScripts
{

/// <summary>
/// Use this on Button texts to have some color transition on the text as well without corrupting button's behaviour.
/// </summary>
[RequireComponent(typeof(Text))]
public class TextButtonTransition : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{

Text _text;

/// <summary>
/// The selectable Component.
/// </summary>
public Selectable Selectable;

/// <summary>
/// The color of the normal of the transition state.
/// </summary>
public Color NormalColor= Color.white;

/// <summary>
/// The color of the hover of the transition state.
/// </summary>
public Color HoverColor = Color.black;

public void Awake()
{
_text = GetComponent<Text>();
}

public void OnEnable()
{
_text.color = NormalColor;
}

public void OnDisable()
{
_text.color = NormalColor;
}

public void OnPointerEnter(PointerEventData eventData)
{
if (Selectable == null || Selectable.IsInteractable()) {
_text.color = HoverColor;
}
}

public void OnPointerExit(PointerEventData eventData)
{
if (Selectable == null || Selectable.IsInteractable()) {
_text.color = NormalColor;
}
}
}
}
12 changes: 12 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TextToggleIsOnTransition.cs" company="Exit Games GmbH">
// </copyright>
// <summary>
// Use this on Button texts to have some color transition on the text as well without corrupting button's behaviour.
// </summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Photon.Chat.UtilityScripts
{

/// <summary>
/// Use this on toggles texts to have some color transition on the text depending on the isOn State.
/// </summary>
[RequireComponent(typeof(Text))]
public class TextToggleIsOnTransition : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{

/// <summary>
/// The toggle Component.
/// </summary>
public Toggle toggle;

Text _text;

/// <summary>
/// The color of the normal on transition state.
/// </summary>
public Color NormalOnColor= Color.white;

/// <summary>
/// The color of the normal off transition state.
/// </summary>
public Color NormalOffColor = Color.black;

/// <summary>
/// The color of the hover on transition state.
/// </summary>
public Color HoverOnColor= Color.black;

/// <summary>
/// The color of the hover off transition state.
/// </summary>
public Color HoverOffColor = Color.black;

bool isHover;

public void OnEnable()
{
_text = GetComponent<Text>();

OnValueChanged (toggle.isOn);

toggle.onValueChanged.AddListener(OnValueChanged);

}

public void OnDisable()
{
toggle.onValueChanged.RemoveListener(OnValueChanged);
}

public void OnValueChanged(bool isOn)
{
_text.color = isOn? (isHover?HoverOnColor:HoverOnColor) : (isHover?NormalOffColor:NormalOffColor) ;
}

public void OnPointerEnter(PointerEventData eventData)
{
isHover = true;
_text.color = toggle.isOn?HoverOnColor:HoverOffColor;
}

public void OnPointerExit(PointerEventData eventData)
{
isHover = false;
_text.color = toggle.isOn?NormalOnColor:NormalOffColor;
}

}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/Photon/PhotonChat/Demos/DemoChat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Photon.Chat;
using Photon.Realtime;

public static class AppSettingsExtensions
{
public static ChatAppSettings GetChatSettings(this AppSettings appSettings)
{
return new ChatAppSettings
{
AppIdChat = appSettings.AppIdChat,
AppVersion = appSettings.AppVersion,
FixedRegion = appSettings.IsBestRegion ? null : appSettings.FixedRegion,
NetworkLogging = appSettings.NetworkLogging,
Protocol = appSettings.Protocol,
EnableProtocolFallback = appSettings.EnableProtocolFallback,
Server = appSettings.IsDefaultNameServer ? null : appSettings.Server,
Port = (ushort)appSettings.Port
};
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class ChannelSelector : MonoBehaviour, IPointerClickHandler
{
public string Channel;

public void SetChannel(string channel)
{
this.Channel = channel;
Text t = GetComponentInChildren<Text>();
t.text = this.Channel;
}

public void OnPointerClick(PointerEventData eventData)
{
ChatGui handler = FindObjectOfType<ChatGui>();
handler.ShowChannel(this.Channel);
}
}
10 changes: 10 additions & 0 deletions Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8fb6676

Please sign in to comment.