온라인 구현

This commit is contained in:
김도환
2026-05-01 05:47:12 +09:00
parent 5695b4036f
commit a36270f77a
996 changed files with 267058 additions and 75 deletions

View File

@@ -0,0 +1,22 @@
using UnityEngine;
namespace Photon.Chat.DemoChat.Utilities
{
/// <summary>
/// This is used in the Editor Splash to properly inform the developer about the chat AppId requirement.
/// </summary>
[ExecuteInEditMode]
public class ChatIdCheckerUI : MonoBehaviour
{
public GameObject VisibilityRoot; // must be set in inspector
void Update()
{
if (this.VisibilityRoot != null)
{
this.VisibilityRoot.SetActive(string.IsNullOrEmpty(ChatSettings.Instance.AppId));
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 49f8b1206d1f448aca7d730f027d8c09
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 119922
packageName: PUN 2 - FREE
packageVersion: 2.52
assetPath: Assets/Photon/PhotonChat/Demos/Demo Chat/Code/Utilities/ChatIdCheckerUI.cs
uploadId: 817708

View File

@@ -0,0 +1,22 @@
using UnityEngine;
namespace Photon.Chat.DemoChat.Utilities
{
/// <summary>This component will destroy the Target GameObject (or the one it is attached to).</summary>
public class DestroyOnStart : MonoBehaviour
{
[Tooltip("If null, this game object gets destroyed in this Start().")]
public GameObject Target; // set in inspector
void Start()
{
if (this.Target == null)
{
this.Target = this.gameObject;
}
GameObject.Destroy(this.Target);
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: a2895d30d4d2c3f4cb5d2c92fcd9125f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 119922
packageName: PUN 2 - FREE
packageVersion: 2.52
assetPath: Assets/Photon/PhotonChat/Demos/Demo Chat/Code/Utilities/DestroyOnStart.cs
uploadId: 817708

View File

@@ -0,0 +1,22 @@
using UnityEngine;
namespace Photon.Chat.DemoChat.Utilities
{
/// <summary>This component will enable (setactive) the Target GameObject (or the one it is attached to).</summary>
public class EnableOnStart : MonoBehaviour
{
[Tooltip("If null, this game object becomes active in this Start().")]
public GameObject Target; // set in inspector
void Start()
{
if (this.Target == null)
{
this.Target = this.gameObject;
}
this.Target.SetActive(true);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8555b4060b53841439f2c0c6f10db6ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 119922
packageName: PUN 2 - FREE
packageVersion: 2.52
assetPath: Assets/Photon/PhotonChat/Demos/Demo Chat/Code/Utilities/EnableOnStart.cs
uploadId: 817708

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace Photon.Chat.DemoChat.Utilities
{
// small script to avoid clicks picking inactive UI elements
public class IgnoreUiRaycastWhenInactive : MonoBehaviour, ICanvasRaycastFilter
{
public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
{
return gameObject.activeInHierarchy;
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 4ba4c747f6975ea46bcc0a55ffe3bfe8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 119922
packageName: PUN 2 - FREE
packageVersion: 2.52
assetPath: Assets/Photon/PhotonChat/Demos/Demo Chat/Code/Utilities/IgnoreUiRaycastWhenInactive.cs
uploadId: 817708

View File

@@ -0,0 +1,43 @@
// --------------------------------------------------------------------------------------------------------------------
// <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.DemoChat.Utilities
{
/// <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;
public Color NormalColor= Color.white;
public Color HoverColor = Color.black;
public void Awake()
{
_text = GetComponent<Text>();
}
public void OnPointerEnter(PointerEventData eventData)
{
_text.color = HoverColor;
}
public void OnPointerExit(PointerEventData eventData)
{
_text.color = NormalColor;
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 0a2169250a70845ffa2a9d25e9cd84cd
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 119922
packageName: PUN 2 - FREE
packageVersion: 2.52
assetPath: Assets/Photon/PhotonChat/Demos/Demo Chat/Code/Utilities/TextButtonTransition.cs
uploadId: 817708

View File

@@ -0,0 +1,64 @@
// --------------------------------------------------------------------------------------------------------------------
// <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.DemoChat.Utilities
{
/// <summary>
/// Use this on toggles texts to have some color transition on the text depending on the isOnState.
/// </summary>
[RequireComponent(typeof(Text))]
public class TextToggleIsOnTransition : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public Toggle toggle;
Text _text;
public Color NormalOnColor = Color.white;
public Color NormalOffColor = Color.black;
public Color HoverOnColor = Color.black;
public Color HoverOffColor = Color.black;
bool isHover;
public void OnEnable()
{
_text = GetComponent<Text>();
toggle.onValueChanged.AddListener(OnValueChanged);
}
public void OnDisable()
{
toggle.onValueChanged.RemoveListener(OnValueChanged);
}
public void OnValueChanged(bool isOn)
{
_text.color = isOn ? (isHover ? HoverOnColor : HoverOffColor) : (isHover ? NormalOnColor : 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;
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 5f64fb930d3f24c5ebc31aa95dba1c0b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 119922
packageName: PUN 2 - FREE
packageVersion: 2.52
assetPath: Assets/Photon/PhotonChat/Demos/Demo Chat/Code/Utilities/TextToggleIsOnTransition.cs
uploadId: 817708