Init, Project revived from Unity Cloud

master
Benjamin Kraft 2 years ago
commit e879ce688a
  1. 155
      .gitignore
  2. 13
      .idea/.idea.Circuits/.idea/.gitignore
  3. 4
      .idea/.idea.Circuits/.idea/encodings.xml
  4. 8
      .idea/.idea.Circuits/.idea/indexLayout.xml
  5. 9
      Assets/Fonts.meta
  6. 9
      Assets/Fonts/OpenSans.meta
  7. 202
      Assets/Fonts/OpenSans/FontLicense.txt
  8. 5
      Assets/Fonts/OpenSans/FontLicense.txt.meta
  9. BIN
      Assets/Fonts/OpenSans/OpenSansBold.ttf
  10. 20
      Assets/Fonts/OpenSans/OpenSansBold.ttf.meta
  11. BIN
      Assets/Fonts/OpenSans/OpenSansLight.ttf
  12. 20
      Assets/Fonts/OpenSans/OpenSansLight.ttf.meta
  13. BIN
      Assets/Fonts/OpenSans/OpenSansRegular.ttf
  14. 20
      Assets/Fonts/OpenSans/OpenSansRegular.ttf.meta
  15. BIN
      Assets/Fonts/OpenSans/OpenSansSemibold.ttf
  16. 20
      Assets/Fonts/OpenSans/OpenSansSemibold.ttf.meta
  17. 8
      Assets/Fonts/SquadaOne.meta
  18. 94
      Assets/Fonts/SquadaOne/OFL.txt
  19. 7
      Assets/Fonts/SquadaOne/OFL.txt.meta
  20. BIN
      Assets/Fonts/SquadaOne/SquadaOne-Regular.ttf
  21. 22
      Assets/Fonts/SquadaOne/SquadaOne-Regular.ttf.meta
  22. 9
      Assets/Photon.meta
  23. 7
      Assets/Photon/PhotonChat.meta
  24. 9
      Assets/Photon/PhotonChat/Code.meta
  25. 22
      Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs
  26. 12
      Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta
  27. 14
      Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs
  28. 12
      Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta
  29. 73
      Assets/Photon/PhotonChat/Code/ChatAppSettings.cs
  30. 11
      Assets/Photon/PhotonChat/Code/ChatAppSettings.cs.meta
  31. 193
      Assets/Photon/PhotonChat/Code/ChatChannel.cs
  32. 8
      Assets/Photon/PhotonChat/Code/ChatChannel.cs.meta
  33. 1828
      Assets/Photon/PhotonChat/Code/ChatClient.cs
  34. 8
      Assets/Photon/PhotonChat/Code/ChatClient.cs.meta
  35. 43
      Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs
  36. 8
      Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta
  37. 39
      Assets/Photon/PhotonChat/Code/ChatEventCode.cs
  38. 8
      Assets/Photon/PhotonChat/Code/ChatEventCode.cs.meta
  39. 38
      Assets/Photon/PhotonChat/Code/ChatOperationCode.cs
  40. 8
      Assets/Photon/PhotonChat/Code/ChatOperationCode.cs.meta
  41. 85
      Assets/Photon/PhotonChat/Code/ChatParameterCode.cs
  42. 8
      Assets/Photon/PhotonChat/Code/ChatParameterCode.cs.meta
  43. 465
      Assets/Photon/PhotonChat/Code/ChatPeer.cs
  44. 8
      Assets/Photon/PhotonChat/Code/ChatPeer.cs.meta
  45. 39
      Assets/Photon/PhotonChat/Code/ChatState.cs
  46. 8
      Assets/Photon/PhotonChat/Code/ChatState.cs.meta
  47. 35
      Assets/Photon/PhotonChat/Code/ChatUserStatus.cs
  48. 8
      Assets/Photon/PhotonChat/Code/ChatUserStatus.cs.meta
  49. 148
      Assets/Photon/PhotonChat/Code/IChatClientListener.cs
  50. 8
      Assets/Photon/PhotonChat/Code/IChatClientListener.cs.meta
  51. 12
      Assets/Photon/PhotonChat/Code/PhotonChat.asmdef
  52. 8
      Assets/Photon/PhotonChat/Code/PhotonChat.asmdef.meta
  53. 137
      Assets/Photon/PhotonChat/Code/changes-chat.txt
  54. 7
      Assets/Photon/PhotonChat/Code/changes-chat.txt.meta
  55. 9
      Assets/Photon/PhotonChat/Demos.meta
  56. 9
      Assets/Photon/PhotonChat/Demos/Common.meta
  57. 40
      Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs
  58. 12
      Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs.meta
  59. 24
      Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs
  60. 12
      Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs.meta
  61. 70
      Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs
  62. 12
      Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs.meta
  63. 86
      Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs
  64. 12
      Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs.meta
  65. 9
      Assets/Photon/PhotonChat/Demos/DemoChat.meta
  66. 30
      Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs
  67. 11
      Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs.meta
  68. 32
      Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs
  69. 10
      Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs.meta
  70. 54
      Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs
  71. 10
      Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs.meta
  72. 649
      Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs
  73. 10
      Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs.meta
  74. 6246
      Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity
  75. 6
      Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity.meta
  76. 84
      Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs
  77. 10
      Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs.meta
  78. 20
      Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs
  79. 10
      Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs.meta
  80. 55
      Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs
  81. 10
      Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs.meta
  82. 7
      Assets/Photon/PhotonLibs.meta
  83. 5
      Assets/Photon/PhotonLibs/Metro.meta
  84. BIN
      Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll
  85. 47
      Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll.meta
  86. BIN
      Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri
  87. 8
      Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri.meta
  88. BIN
      Assets/Photon/PhotonLibs/Photon3Unity3D.dll
  89. 38
      Assets/Photon/PhotonLibs/Photon3Unity3D.dll.meta
  90. 2766
      Assets/Photon/PhotonLibs/Photon3Unity3D.xml
  91. 9
      Assets/Photon/PhotonLibs/Photon3Unity3D.xml.meta
  92. 5
      Assets/Photon/PhotonLibs/WebSocket.meta
  93. 369
      Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs
  94. 8
      Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs.meta
  95. 188
      Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs
  96. 8
      Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs.meta
  97. 117
      Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib
  98. 21
      Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib.meta
  99. 3
      Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README
  100. 4
      Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README.meta
  101. Some files were not shown because too many files have changed in this diff Show More

155
.gitignore vendored

@ -0,0 +1,155 @@
# Created by https://www.toptal.com/developers/gitignore/api/unity,rider
# Edit at https://www.toptal.com/developers/gitignore?templates=unity,rider
### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Unity ###
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Recordings can get excessive in size
/[Rr]ecordings/
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
*.app
# Crashlytics generated file
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
# End of https://www.toptal.com/developers/gitignore/api/unity,rider

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/projectSettingsUpdater.xml
/.idea.Circuits.iml
/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5d757120c2679c94f95bbb8c06341f10
folderAsset: yes
timeCreated: 1436977288
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c32de72f872aad9448b3118fda0231fb
folderAsset: yes
timeCreated: 1436977288
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: cf1acff8cf98a440dba907e79fd30ebc
TextScriptImporter:
userData:
assetBundleName:

@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 87c316b602156405d92e616621658222
TrueTypeFontImporter:
serializedVersion: 3
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
fontNames: []
fallbackFontReferences:
- {fileID: 12800000, guid: b51a3e520f9164da198dc59c8acfccd6, type: 3}
- {fileID: 12800000, guid: 04a842e316b6f44bf8da702de26a8ed6, type: 3}
- {fileID: 12800000, guid: 01cd679a1b9ee48bf9c546f6ce2cb97e, type: 3}
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 04a842e316b6f44bf8da702de26a8ed6
TrueTypeFontImporter:
serializedVersion: 3
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
fontNames: []
fallbackFontReferences:
- {fileID: 12800000, guid: b51a3e520f9164da198dc59c8acfccd6, type: 3}
- {fileID: 12800000, guid: 87c316b602156405d92e616621658222, type: 3}
- {fileID: 12800000, guid: 01cd679a1b9ee48bf9c546f6ce2cb97e, type: 3}
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: b51a3e520f9164da198dc59c8acfccd6
TrueTypeFontImporter:
serializedVersion: 3
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
fontNames: []
fallbackFontReferences:
- {fileID: 12800000, guid: 04a842e316b6f44bf8da702de26a8ed6, type: 3}
- {fileID: 12800000, guid: 87c316b602156405d92e616621658222, type: 3}
- {fileID: 12800000, guid: 01cd679a1b9ee48bf9c546f6ce2cb97e, type: 3}
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 01cd679a1b9ee48bf9c546f6ce2cb97e
TrueTypeFontImporter:
serializedVersion: 3
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
fontNames: []
fallbackFontReferences:
- {fileID: 12800000, guid: b51a3e520f9164da198dc59c8acfccd6, type: 3}
- {fileID: 12800000, guid: 04a842e316b6f44bf8da702de26a8ed6, type: 3}
- {fileID: 12800000, guid: 87c316b602156405d92e616621658222, type: 3}
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 82ea81de659210540a956cf678d9d82d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,94 @@
Copyright (c) 2011, Admix Designs (http://www.admixdesigns.com/),
with Reserved Font Names "Squada" and "Squada One"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c814beb0f6654e447a30ddd7b5247957
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 4ee738dae2bd0e943a7cf60e34cf9563
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontName: Squada One
fontNames:
- Squada One
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 98951132346795f438babe7a3183da43
folderAsset: yes
timeCreated: 1523536679
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ea05e6479d592944d955c2a5e1a6d6f1
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: af83a98aaa4f7b64eb7fcec95ee7b1ed
folderAsset: yes
timeCreated: 1523525757
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,22 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChannelCreationOptions is a parameter used when subscribing to a public channel for the first time.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2018 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
public class ChannelCreationOptions
{
/// <summary>Default values of channel creation options.</summary>
public static ChannelCreationOptions Default = new ChannelCreationOptions();
/// <summary>Whether or not the channel to be created will allow client to keep a list of users.</summary>
public bool PublishSubscribers { get; set; }
/// <summary>Limit of the number of users subscribed to the channel to be created.</summary>
public int MaxSubscribers { get; set; }
#if CHAT_EXTENDED
public System.Collections.Generic.Dictionary<string, object> CustomProperties { get; set; }
#endif
}
}

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

@ -0,0 +1,14 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChannelWellKnownProperties contains the list of well-known channel properties.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2018 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
public class ChannelWellKnownProperties
{
public const byte MaxSubscribers = 255;
public const byte PublishSubscribers = 254;
}
}

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

@ -0,0 +1,73 @@
// -----------------------------------------------------------------------
// <copyright file="ChatAppSettings.cs" company="Exit Games GmbH">
// Chat API for Photon - Copyright (C) 2018 Exit Games GmbH
// </copyright>
// <summary>Settings for Photon Chat application and the server to connect to.</summary>
// <author>developer@photonengine.com</author>
// ----------------------------------------------------------------------------
#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
#define SUPPORTED_UNITY
#endif
namespace Photon.Chat
{
using System;
using ExitGames.Client.Photon;
#if SUPPORTED_UNITY
using UnityEngine.Serialization;
#endif
/// <summary>
/// Settings for Photon application(s) and the server to connect to.
/// </summary>
/// <remarks>
/// This is Serializable for Unity, so it can be included in ScriptableObject instances.
/// </remarks>
#if !NETFX_CORE || SUPPORTED_UNITY
[Serializable]
#endif
public class ChatAppSettings
{
/// <summary>AppId for the Chat Api.</summary>
#if SUPPORTED_UNITY
[FormerlySerializedAs("AppId")]
#endif
public string AppIdChat;
/// <summary>The AppVersion can be used to identify builds and will split the AppId distinct "Virtual AppIds" (important for the users to find each other).</summary>
public string AppVersion;
/// <summary>Can be set to any of the Photon Cloud's region names to directly connect to that region.</summary>
public string FixedRegion;
/// <summary>The address (hostname or IP) of the server to connect to.</summary>
public string Server;
/// <summary>If not null, this sets the port of the first Photon server to connect to (that will "forward" the client as needed).</summary>
public ushort Port;
/// <summary>The network level protocol to use.</summary>
public ConnectionProtocol Protocol = ConnectionProtocol.Udp;
/// <summary>Enables a fallback to another protocol in case a connect to the Name Server fails.</summary>
/// <remarks>See: LoadBalancingClient.EnableProtocolFallback.</remarks>
public bool EnableProtocolFallback = true;
/// <summary>Log level for the network lib.</summary>
public DebugLevel NetworkLogging = DebugLevel.ERROR;
/// <summary>If true, the default nameserver address for the Photon Cloud should be used.</summary>
public bool IsDefaultNameServer { get { return string.IsNullOrEmpty(this.Server); } }
/// <summary>Available to not immediately break compatibility.</summary>
[Obsolete("Use AppIdChat instead.")]
public string AppId
{
get { return this.AppIdChat; }
set { this.AppIdChat = value; }
}
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 87776a9b1f405644abcc38ecd70c37fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,193 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
#define SUPPORTED_UNITY
#endif
namespace Photon.Chat
{
using System.Collections.Generic;
using System.Text;
#if SUPPORTED_UNITY || NETFX_CORE
using Hashtable = ExitGames.Client.Photon.Hashtable;
using SupportClass = ExitGames.Client.Photon.SupportClass;
#endif
/// <summary>
/// A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.
/// </summary>
/// <remarks>
/// Contains messages and senders to use (read!) and display by your GUI.
/// Access these by:
/// ChatClient.PublicChannels
/// ChatClient.PrivateChannels
/// </remarks>
public class ChatChannel
{
/// <summary>Name of the channel (used to subscribe and unsubscribe).</summary>
public readonly string Name;
/// <summary>Senders of messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
public readonly List<string> Senders = new List<string>();
/// <summary>Messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
public readonly List<object> Messages = new List<object>();
/// <summary>If greater than 0, this channel will limit the number of messages, that it caches locally.</summary>
public int MessageLimit;
/// <summary>Unique channel ID.</summary>
public int ChannelID;
/// <summary>Is this a private 1:1 channel?</summary>
public bool IsPrivate { get; protected internal set; }
/// <summary>Count of messages this client still buffers/knows for this channel.</summary>
public int MessageCount { get { return this.Messages.Count; } }
/// <summary>
/// ID of the last message received.
/// </summary>
public int LastMsgId { get; protected set; }
private Dictionary<object, object> properties;
/// <summary>Whether or not this channel keeps track of the list of its subscribers.</summary>
public bool PublishSubscribers { get; protected set; }
/// <summary>Maximum number of channel subscribers. 0 means infinite.</summary>
public int MaxSubscribers { get; protected set; }
/// <summary>Subscribed users.</summary>
public readonly HashSet<string> Subscribers = new HashSet<string>();
/// <summary>Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe.</summary>
public ChatChannel(string name)
{
this.Name = name;
}
/// <summary>Used internally to add messages to this channel.</summary>
public void Add(string sender, object message, int msgId)
{
this.Senders.Add(sender);
this.Messages.Add(message);
this.LastMsgId = msgId;
this.TruncateMessages();
}
/// <summary>Used internally to add messages to this channel.</summary>
public void Add(string[] senders, object[] messages, int lastMsgId)
{
this.Senders.AddRange(senders);
this.Messages.AddRange(messages);
this.LastMsgId = lastMsgId;
this.TruncateMessages();
}
/// <summary>Reduces the number of locally cached messages in this channel to the MessageLimit (if set).</summary>
public void TruncateMessages()
{
if (this.MessageLimit <= 0 || this.Messages.Count <= this.MessageLimit)
{
return;
}
int excessCount = this.Messages.Count - this.MessageLimit;
this.Senders.RemoveRange(0, excessCount);
this.Messages.RemoveRange(0, excessCount);
}
/// <summary>Clear the local cache of messages currently stored. This frees memory but doesn't affect the server.</summary>
public void ClearMessages()
{
this.Senders.Clear();
this.Messages.Clear();
}
/// <summary>Provides a string-representation of all messages in this channel.</summary>
/// <returns>All known messages in format "Sender: Message", line by line.</returns>
public string ToStringMessages()
{
StringBuilder txt = new StringBuilder();
for (int i = 0; i < this.Messages.Count; i++)
{
txt.AppendLine(string.Format("{0}: {1}", this.Senders[i], this.Messages[i]));
}
return txt.ToString();
}
internal void ReadChannelProperties(Dictionary<object, object> newProperties)
{
if (newProperties != null && newProperties.Count > 0)
{
if (this.properties == null)
{
this.properties = new Dictionary<object, object>(newProperties.Count);
}
foreach (var pair in newProperties)
{
if (pair.Value == null)
{
this.properties.Remove(pair.Key);
}
else
{
this.properties[pair.Key] = pair.Value;
}
}
object temp;
if (this.properties.TryGetValue(ChannelWellKnownProperties.PublishSubscribers, out temp))
{
this.PublishSubscribers = (bool)temp;
}
if (this.properties.TryGetValue(ChannelWellKnownProperties.MaxSubscribers, out temp))
{
this.MaxSubscribers = (int)temp;
}
}
}
internal void AddSubscribers(string[] users)
{
if (users == null)
{
return;
}
for (int i = 0; i < users.Length; i++)
{
this.Subscribers.Add(users[i]);
}
}
#if CHAT_EXTENDED
internal void ReadUserProperties(string userId, Dictionary<object, object> changedProperties)
{
throw new System.NotImplementedException();
}
internal bool TryGetChannelProperty<T>(object propertyKey, out T propertyValue)
{
propertyValue = default(T);
object temp;
if (properties != null && properties.TryGetValue(propertyKey, out temp) && temp is T)
{
propertyValue = (T)temp;
return true;
}
return false;
}
public bool TryGetCustomChannelProperty<T>(string propertyKey, out T propertyValue)
{
return this.TryGetChannelProperty(propertyKey, out propertyValue);
}
#endif
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 35b2a4878e5e99e438c97fbe8dbbd863
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

File diff suppressed because it is too large Load Diff

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 692e391fa2a297c45b3d530aa85be610
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,43 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>Enumeration of causes for Disconnects (used in <see cref="ChatClient.DisconnectedCause"/>).</summary>
/// <remarks>Read the individual descriptions to find out what to do about this type of disconnect.</remarks>
public enum ChatDisconnectCause
{
/// <summary>No error was tracked.</summary>
None,
/// <summary>OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.</summary>
ExceptionOnConnect,
/// <summary>OnStatusChanged: The server disconnected this client from within the room's logic (the C# code).</summary>
DisconnectByServerLogic,
/// <summary>OnStatusChanged: The server disconnected this client for unknown reasons.</summary>
DisconnectByServerReasonUnknown,
/// <summary>OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgement from the client).</summary>
ServerTimeout,
/// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time.</summary>
ClientTimeout,
/// <summary>OnStatusChanged: Some internal exception caused the socket code to fail. Contact Exit Games.</summary>
Exception,
/// <summary>OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.</summary>
InvalidAuthentication,
/// <summary>OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.</summary>
MaxCcuReached,
/// <summary>OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or change region.</summary>
InvalidRegion,
/// <summary>OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.</summary>
OperationNotAllowedInCurrentState,
/// <summary>OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.</summary>
CustomAuthenticationFailed,
/// <summary>The authentication ticket should provide access to any Photon Cloud server without doing another authentication-service call. However, the ticket expired.</summary>
AuthenticationTicketExpired,
/// <summary>OnStatusChanged: The client disconnected from within the logic (the C# code).</summary>
DisconnectByClientLogic
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b90b85043f1857f43b94fd00edfc1ef1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>
/// Wraps up internally used constants in Photon Chat events. You don't have to use them directly usually.
/// </summary>
public class ChatEventCode
{
/// <summary>(0) Event code for messages published in public channels.</summary>
public const byte ChatMessages = 0;
/// <summary>(1) Not Used. </summary>
public const byte Users = 1;// List of users or List of changes for List of users
/// <summary>(2) Event code for messages published in private channels</summary>
public const byte PrivateMessage = 2;
/// <summary>(3) Not Used. </summary>
public const byte FriendsList = 3;
/// <summary>(4) Event code for status updates. </summary>
public const byte StatusUpdate = 4;
/// <summary>(5) Event code for subscription acks. </summary>
public const byte Subscribe = 5;
/// <summary>(6) Event code for unsubscribe acks. </summary>
public const byte Unsubscribe = 6;
/// <summary>(7) Event code for properties update. </summary>
public const byte PropertiesChanged = 7;
/// <summary>(8) Event code for new user subscription to a channel where <see cref="ChatChannel.PublishSubscribers"/> is enabled. </summary>
public const byte UserSubscribed = 8;
/// <summary>(9) Event code for when user unsubscribes from a channel where <see cref="ChatChannel.PublishSubscribers"/> is enabled. </summary>
public const byte UserUnsubscribed = 9;
/// <summary>(10) Event code for when the server sends an error to the client. </summary>
/// <remarks> This is currently only used by Chat WebHooks. </remarks>
public const byte ErrorInfo = 10;
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 188e4a680bce12d4cbad8d57a24f7d44
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,38 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>
/// Wraps up codes for operations used internally in Photon Chat. You don't have to use them directly usually.
/// </summary>
public class ChatOperationCode
{
/// <summary>(230) Operation Authenticate.</summary>
public const byte Authenticate = 230;
/// <summary>(0) Operation to subscribe to chat channels.</summary>
public const byte Subscribe = 0;
/// <summary>(1) Operation to unsubscribe from chat channels.</summary>
public const byte Unsubscribe = 1;
/// <summary>(2) Operation to publish a message in a chat channel.</summary>
public const byte Publish = 2;
/// <summary>(3) Operation to send a private message to some other user.</summary>
public const byte SendPrivate = 3;
/// <summary>(4) Not used yet.</summary>
public const byte ChannelHistory = 4;
/// <summary>(5) Set your (client's) status.</summary>
public const byte UpdateStatus = 5;
/// <summary>(6) Add friends the list of friends that should update you of their status.</summary>
public const byte AddFriends = 6;
/// <summary>(7) Remove friends from list of friends that should update you of their status.</summary>
public const byte RemoveFriends = 7;
/// <summary>(8) Operation to set properties of public chat channel or users in public chat channels.</summary>
public const byte SetProperties = 8;
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c90a2a73f3ce648409739c724d3e6cef
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,85 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>
/// Wraps up codes for parameters (in operations and events) used internally in Photon Chat. You don't have to use them directly usually.
/// </summary>
public class ChatParameterCode
{
/// <summary>(0) Array of chat channels.</summary>
public const byte Channels = 0;
/// <summary>(1) Name of a single chat channel.</summary>
public const byte Channel = 1;
/// <summary>(2) Array of chat messages.</summary>
public const byte Messages = 2;
/// <summary>(3) A single chat message.</summary>
public const byte Message = 3;
/// <summary>(4) Array of names of the users who sent the array of chat messages.</summary>
public const byte Senders = 4;
/// <summary>(5) Name of a the user who sent a chat message.</summary>
public const byte Sender = 5;
/// <summary>(6) Not used.</summary>
public const byte ChannelUserCount = 6;
/// <summary>(225) Name of user to send a (private) message to.</summary><remarks>The code is used in LoadBalancing and copied over here.</remarks>
public const byte UserId = 225;
/// <summary>(8) Id of a message.</summary>
public const byte MsgId = 8;
/// <summary>(9) Not used.</summary>
public const byte MsgIds = 9;
/// <summary>(221) Secret token to identify an authorized user.</summary><remarks>The code is used in LoadBalancing and copied over here.</remarks>
public const byte Secret = 221;
/// <summary>(15) Subscribe operation result parameter. A bool[] with result per channel.</summary>
public const byte SubscribeResults = 15;
/// <summary>(10) Status</summary>
public const byte Status = 10;
/// <summary>(11) Friends</summary>
public const byte Friends = 11;
/// <summary>(12) SkipMessage is used in SetOnlineStatus and if true, the message is not being broadcast.</summary>
public const byte SkipMessage = 12;
/// <summary>(14) Number of message to fetch from history. 0: no history. 1 and higher: number of messages in history. -1: all history.</summary>
public const byte HistoryLength = 14;
public const byte DebugMessage = 17;
/// <summary>(21) WebFlags object for changing behaviour of webhooks from client.</summary>
public const byte WebFlags = 21;
/// <summary>(22) WellKnown or custom properties of channel or user.</summary>
/// <remarks>
/// In event <see cref="ChatEventCode.Subscribe"/> it's always channel properties,
/// in event <see cref="ChatEventCode.UserSubscribed"/> it's always user properties,
/// in event <see cref="ChatEventCode.PropertiesChanged"/> it's channel properties unless <see cref="UserId"/> parameter value is not null
/// </remarks>
public const byte Properties = 22;
/// <summary>(23) Array of UserIds of users already subscribed to a channel.</summary>
/// <remarks>Used in Subscribe event when PublishSubscribers is enabled.
/// Does not include local user who just subscribed.
/// Maximum length is (<see cref="ChatChannel.MaxSubscribers"/> - 1).</remarks>
public const byte ChannelSubscribers = 23;
/// <summary>(24) Optional data sent in ErrorInfo event from Chat WebHooks. </summary>
public const byte DebugData = 24;
/// <summary>(25) Code for values to be used for "Check And Swap" (CAS) when changing properties.</summary>
public const byte ExpectedValues = 25;
/// <summary>(26) Code for broadcast parameter of <see cref="ChatOperationCode.SetProperties"/> method.</summary>
public const byte Broadcast = 26;
/// <summary>
/// WellKnown and custom user properties.
/// </summary>
/// <remarks>
/// Used only in event <see cref="ChatEventCode.Subscribe"/>
/// </remarks>
public const byte UserProperties = 28;
/// <summary>
/// Generated unique reusable room id
/// </summary>
public const byte UniqueRoomId = 29;
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d7a17b60c85fb30448492e397c58c7ce
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,465 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
#define SUPPORTED_UNITY
#endif
namespace Photon.Chat
{
using System;
using System.Diagnostics;
using System.Collections.Generic;
using ExitGames.Client.Photon;
#if SUPPORTED_UNITY || NETFX_CORE
using Hashtable = ExitGames.Client.Photon.Hashtable;
using SupportClass = ExitGames.Client.Photon.SupportClass;
#endif
/// <summary>
/// Provides basic operations of the Photon Chat server. This internal class is used by public ChatClient.
/// </summary>
public class ChatPeer : PhotonPeer
{
/// <summary>Name Server Host Name for Photon Cloud. Without port and without any prefix.</summary>
public string NameServerHost = "ns.photonengine.io";
/// <summary>Name Server port per protocol (the UDP port is different than TCP, etc).</summary>
private static readonly Dictionary<ConnectionProtocol, int> ProtocolToNameServerPort = new Dictionary<ConnectionProtocol, int>() { { ConnectionProtocol.Udp, 5058 }, { ConnectionProtocol.Tcp, 4533 }, { ConnectionProtocol.WebSocket, 9093 }, { ConnectionProtocol.WebSocketSecure, 19093 } }; //, { ConnectionProtocol.RHttp, 6063 } };
/// <summary>Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value.</summary>
public string NameServerAddress { get { return this.GetNameServerAddress(); } }
virtual internal bool IsProtocolSecure { get { return this.UsedProtocol == ConnectionProtocol.WebSocketSecure; } }
/// <summary> Chat Peer constructor. </summary>
/// <param name="listener">Chat listener implementation.</param>
/// <param name="protocol">Protocol to be used by the peer.</param>
public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
{
this.ConfigUnitySockets();
}
// Sets up the socket implementations to use, depending on platform
[System.Diagnostics.Conditional("SUPPORTED_UNITY")]
private void ConfigUnitySockets()
{
Type websocketType = null;
#if (UNITY_XBOXONE || UNITY_GAMECORE) && !UNITY_EDITOR
websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, Assembly-CSharp", false);
if (websocketType == null)
{
websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, Assembly-CSharp-firstpass", false);
}
if (websocketType == null)
{
websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, PhotonRealtime", false);
}
if (websocketType != null)
{
this.SocketImplementationConfig[ConnectionProtocol.Udp] = websocketType; // on Xbox, the native socket plugin supports UDP as well
}
#else
// to support WebGL export in Unity, we find and assign the SocketWebTcp class (if it's in the project).
// alternatively class SocketWebTcp might be in the Photon3Unity3D.dll
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, PhotonWebSocket", false);
if (websocketType == null)
{
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp-firstpass", false);
}
if (websocketType == null)
{
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp", false);
}
#endif
if (websocketType != null)
{
this.SocketImplementationConfig[ConnectionProtocol.WebSocket] = websocketType;
this.SocketImplementationConfig[ConnectionProtocol.WebSocketSecure] = websocketType;
}
#if NET_4_6 && (UNITY_EDITOR || !ENABLE_IL2CPP) && !NETFX_CORE
this.SocketImplementationConfig[ConnectionProtocol.Udp] = typeof(SocketUdpAsync);
this.SocketImplementationConfig[ConnectionProtocol.Tcp] = typeof(SocketTcpAsync);
#endif
}
/// <summary>If not zero, this is used for the name server port on connect. Independent of protocol (so this better matches). Set by ChatClient.ConnectUsingSettings.</summary>
/// <remarks>This is reset when the protocol fallback is used.</remarks>
public ushort NameServerPortOverride;
/// <summary>
/// Gets the NameServer Address (with prefix and port), based on the set protocol (this.UsedProtocol).
/// </summary>
/// <returns>NameServer Address (with prefix and port).</returns>
private string GetNameServerAddress()
{
var protocolPort = 0;
ProtocolToNameServerPort.TryGetValue(this.TransportProtocol, out protocolPort);
if (this.NameServerPortOverride != 0)
{
this.Listener.DebugReturn(DebugLevel.INFO, string.Format("Using NameServerPortInAppSettings as port for Name Server: {0}", this.NameServerPortOverride));
protocolPort = this.NameServerPortOverride;
}
switch (this.TransportProtocol)
{
case ConnectionProtocol.Udp:
case ConnectionProtocol.Tcp:
return string.Format("{0}:{1}", NameServerHost, protocolPort);
case ConnectionProtocol.WebSocket:
return string.Format("ws://{0}:{1}", NameServerHost, protocolPort);
case ConnectionProtocol.WebSocketSecure:
return string.Format("wss://{0}:{1}", NameServerHost, protocolPort);
default:
throw new ArgumentOutOfRangeException();
}
}
/// <summary> Connects to NameServer. </summary>
/// <returns>If the connection attempt could be sent.</returns>
public bool Connect()
{
if (this.DebugOut >= DebugLevel.INFO)
{
this.Listener.DebugReturn(DebugLevel.INFO, "Connecting to nameserver " + this.NameServerAddress);
}
return this.Connect(this.NameServerAddress, "NameServer");
}
/// <summary> Authenticates on NameServer. </summary>
/// <returns>If the authentication operation request could be sent.</returns>
public bool AuthenticateOnNameServer(string appId, string appVersion, string region, AuthenticationValues authValues)
{
if (this.DebugOut >= DebugLevel.INFO)
{
this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticate()");
}
var opParameters = new Dictionary<byte, object>();
opParameters[ParameterCode.AppVersion] = appVersion;
opParameters[ParameterCode.ApplicationId] = appId;
opParameters[ParameterCode.Region] = region;
if (authValues != null)
{
if (!string.IsNullOrEmpty(authValues.UserId))
{
opParameters[ParameterCode.UserId] = authValues.UserId;
}
if (authValues.AuthType != CustomAuthenticationType.None)
{
opParameters[ParameterCode.ClientAuthenticationType] = (byte) authValues.AuthType;
if (authValues.Token != null)
{
opParameters[ParameterCode.Secret] = authValues.Token;
}
else
{
if (!string.IsNullOrEmpty(authValues.AuthGetParameters))
{
opParameters[ParameterCode.ClientAuthenticationParams] = authValues.AuthGetParameters;
}
if (authValues.AuthPostData != null)
{
opParameters[ParameterCode.ClientAuthenticationData] = authValues.AuthPostData;
}
}
}
}
return this.SendOperation(ChatOperationCode.Authenticate, opParameters, new SendOptions() { Reliability = true, Encrypt = this.IsEncryptionAvailable });
}
}
/// <summary>
/// Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon.
/// </summary>
public enum CustomAuthenticationType : byte
{
/// <summary>Use a custom authentication service. Currently the only implemented option.</summary>
Custom = 0,
/// <summary>Authenticates users by their Steam Account. Set Steam's ticket as "ticket" via AddAuthParameter().</summary>
Steam = 1,
/// <summary>Authenticates users by their Facebook Account. Set Facebooks's tocken as "token" via AddAuthParameter().</summary>
Facebook = 2,
/// <summary>Authenticates users by their Oculus Account and token. Set Oculus' userid as "userid" and nonce as "nonce" via AddAuthParameter().</summary>
Oculus = 3,
/// <summary>Authenticates users by their PSN Account and token on PS4. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().</summary>
PlayStation4 = 4,
[Obsolete("Use PlayStation4 or PlayStation5 as needed")]
PlayStation = 4,
/// <summary>Authenticates users by their Xbox Account. Pass the XSTS token via SetAuthPostData().</summary>
Xbox = 5,
/// <summary>Authenticates users by their HTC Viveport Account. Set userToken as "userToken" via AddAuthParameter().</summary>
Viveport = 10,
/// <summary>Authenticates users by their NSA ID. Set token as "token" and appversion as "appversion" via AddAuthParameter(). The appversion is optional.</summary>
NintendoSwitch = 11,
/// <summary>Authenticates users by their PSN Account and token on PS5. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().</summary>
PlayStation5 = 12,
[Obsolete("Use PlayStation4 or PlayStation5 as needed")]
Playstation5 = 12,
/// <summary>Authenticates users with Epic Online Services (EOS). Set token as "token" and ownershipToken as "ownershipToken" via AddAuthParameter(). The ownershipToken is optional.</summary>
Epic = 13,
/// <summary>Authenticates users with Facebook Gaming api. Set token as "token" via AddAuthParameter().</summary>
FacebookGaming = 15,
/// <summary>Disables custom authentication. Same as not providing any AuthenticationValues for connect (more precisely for: OpAuthenticate).</summary>
None = byte.MaxValue
}
/// <summary>
/// Container for user authentication in Photon. Set AuthValues before you connect - all else is handled.
/// </summary>
/// <remarks>
/// On Photon, user authentication is optional but can be useful in many cases.
/// If you want to FindFriends, a unique ID per user is very practical.
///
/// There are basically three options for user authentication: None at all, the client sets some UserId
/// or you can use some account web-service to authenticate a user (and set the UserId server-side).
///
/// Custom Authentication lets you verify end-users by some kind of login or token. It sends those
/// values to Photon which will verify them before granting access or disconnecting the client.
///
/// The AuthValues are sent in OpAuthenticate when you connect, so they must be set before you connect.
/// If the AuthValues.UserId is null or empty when it's sent to the server, then the Photon Server assigns a UserId!
///
/// The Photon Cloud Dashboard will let you enable this feature and set important server values for it.
/// https://dashboard.photonengine.com
/// </remarks>
public class AuthenticationValues
{
/// <summary>See AuthType.</summary>
private CustomAuthenticationType authType = CustomAuthenticationType.None;
/// <summary>The type of authentication provider that should be used. Defaults to None (no auth whatsoever).</summary>
/// <remarks>Several auth providers are available and CustomAuthenticationType.Custom can be used if you build your own service.</remarks>
public CustomAuthenticationType AuthType
{
get { return authType; }
set { authType = value; }
}
/// <summary>This string must contain any (http get) parameters expected by the used authentication service. By default, username and token.</summary>
/// <remarks>
/// Maps to operation parameter 216.
/// Standard http get parameters are used here and passed on to the service that's defined in the server (Photon Cloud Dashboard).
/// </remarks>
public string AuthGetParameters { get; set; }
/// <summary>Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters).</summary>
/// <remarks>Maps to operation parameter 214.</remarks>
public object AuthPostData { get; private set; }
/// <summary>Internal <b>Photon token</b>. After initial authentication, Photon provides a token for this client, subsequently used as (cached) validation.</summary>
/// <remarks>Any token for custom authentication should be set via SetAuthPostData or AddAuthParameter.</remarks>
public object Token { get; protected internal set; }
/// <summary>The UserId should be a unique identifier per user. This is for finding friends, etc..</summary>
/// <remarks>See remarks of AuthValues for info about how this is set and used.</remarks>
public string UserId { get; set; }
/// <summary>Creates empty auth values without any info.</summary>
public AuthenticationValues()
{
}
/// <summary>Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.</summary>
/// <param name="userId">Some UserId to set in Photon.</param>
public AuthenticationValues(string userId)
{
this.UserId = userId;
}
/// <summary>Sets the data to be passed-on to the auth service via POST.</summary>
/// <remarks>AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.</remarks>
/// <param name="stringData">String data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.</param>
public virtual void SetAuthPostData(string stringData)
{
this.AuthPostData = (string.IsNullOrEmpty(stringData)) ? null : stringData;
}
/// <summary>Sets the data to be passed-on to the auth service via POST.</summary>
/// <remarks>AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.</remarks>
/// <param name="byteData">Binary token / auth-data to pass on.</param>
public virtual void SetAuthPostData(byte[] byteData)
{
this.AuthPostData = byteData;
}
/// <summary>Sets data to be passed-on to the auth service as Json (Content-Type: "application/json") via Post.</summary>
/// <remarks>AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.</remarks>
/// <param name="dictData">A authentication-data dictionary will be converted to Json and passed to the Auth webservice via HTTP Post.</param>
public virtual void SetAuthPostData(Dictionary<string, object> dictData)
{
this.AuthPostData = dictData;
}
/// <summary>Adds a key-value pair to the get-parameters used for Custom Auth (AuthGetParameters).</summary>
/// <remarks>This method does uri-encoding for you.</remarks>
/// <param name="key">Key for the value to set.</param>
/// <param name="value">Some value relevant for Custom Authentication.</param>
public virtual void AddAuthParameter(string key, string value)
{
string ampersand = string.IsNullOrEmpty(this.AuthGetParameters) ? "" : "&";
this.AuthGetParameters = string.Format("{0}{1}{2}={3}", this.AuthGetParameters, ampersand, System.Uri.EscapeDataString(key), System.Uri.EscapeDataString(value));
}
/// <summary>
/// Transform this object into string.
/// </summary>
/// <returns>string representation of this object.</returns>
public override string ToString()
{
return string.Format("AuthenticationValues Type: {3} UserId: {0}, GetParameters: {1} Token available: {2}", this.UserId, this.AuthGetParameters, this.Token != null, this.AuthType);
}
/// <summary>
/// Make a copy of the current object.
/// </summary>
/// <param name="copy">The object to be copied into.</param>
/// <returns>The copied object.</returns>
public AuthenticationValues CopyTo(AuthenticationValues copy)
{
copy.AuthType = this.AuthType;
copy.AuthGetParameters = this.AuthGetParameters;
copy.AuthPostData = this.AuthPostData;
copy.UserId = this.UserId;
return copy;
}
}
/// <summary>Class for constants. Codes for parameters of Operations and Events.</summary>
public class ParameterCode
{
/// <summary>(224) Your application's ID: a name on your own Photon or a GUID on the Photon Cloud</summary>
public const byte ApplicationId = 224;
/// <summary>(221) Internally used to establish encryption</summary>
public const byte Secret = 221;
/// <summary>(220) Version of your application</summary>
public const byte AppVersion = 220;
/// <summary>(217) This key's (byte) value defines the target custom authentication type/service the client connects with. Used in OpAuthenticate</summary>
public const byte ClientAuthenticationType = 217;
/// <summary>(216) This key's (string) value provides parameters sent to the custom authentication type/service the client connects with. Used in OpAuthenticate</summary>
public const byte ClientAuthenticationParams = 216;
/// <summary>(214) This key's (string or byte[]) value provides parameters sent to the custom authentication service setup in Photon Dashboard. Used in OpAuthenticate</summary>
public const byte ClientAuthenticationData = 214;
/// <summary>(210) Used for region values in OpAuth and OpGetRegions.</summary>
public const byte Region = 210;
/// <summary>(230) Address of a (game) server to use.</summary>
public const byte Address = 230;
/// <summary>(225) User's ID</summary>
public const byte UserId = 225;
}
/// <summary>
/// ErrorCode defines the default codes associated with Photon client/server communication.
/// </summary>
public class ErrorCode
{
/// <summary>(0) is always "OK", anything else an error or specific situation.</summary>
public const int Ok = 0;
// server - Photon low(er) level: <= 0
/// <summary>
/// (-3) Operation can't be executed yet (e.g. OpJoin can't be called before being authenticated, RaiseEvent cant be used before getting into a room).
/// </summary>
/// <remarks>
/// Before you call any operations on the Cloud servers, the automated client workflow must complete its authorization.
/// In PUN, wait until State is: JoinedLobby or ConnectedToMaster
/// </remarks>
public const int OperationNotAllowedInCurrentState = -3;
/// <summary>(-2) The operation you called is not implemented on the server (application) you connect to. Make sure you run the fitting applications.</summary>
public const int InvalidOperationCode = -2;
/// <summary>(-1) Something went wrong in the server. Try to reproduce and contact Exit Games.</summary>
public const int InternalServerError = -1;
// server - PhotonNetwork: 0x7FFF and down
// logic-level error codes start with short.max
/// <summary>(32767) Authentication failed. Possible cause: AppId is unknown to Photon (in cloud service).</summary>
public const int InvalidAuthentication = 0x7FFF;
/// <summary>(32766) GameId (name) already in use (can't create another). Change name.</summary>
public const int GameIdAlreadyExists = 0x7FFF - 1;
/// <summary>(32765) Game is full. This rarely happens when some player joined the room before your join completed.</summary>
public const int GameFull = 0x7FFF - 2;
/// <summary>(32764) Game is closed and can't be joined. Join another game.</summary>
public const int GameClosed = 0x7FFF - 3;
/// <summary>(32762) Not in use currently.</summary>
public const int ServerFull = 0x7FFF - 5;
/// <summary>(32761) Not in use currently.</summary>
public const int UserBlocked = 0x7FFF - 6;
/// <summary>(32760) Random matchmaking only succeeds if a room exists that is neither closed nor full. Repeat in a few seconds or create a new room.</summary>
public const int NoRandomMatchFound = 0x7FFF - 7;
/// <summary>(32758) Join can fail if the room (name) is not existing (anymore). This can happen when players leave while you join.</summary>
public const int GameDoesNotExist = 0x7FFF - 9;
/// <summary>(32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.</summary>
/// <remarks>
/// Unless you have a plan with "CCU Burst", clients might fail the authentication step during connect.
/// Affected client are unable to call operations. Please note that players who end a game and return
/// to the master server will disconnect and re-connect, which means that they just played and are rejected
/// in the next minute / re-connect.
/// This is a temporary measure. Once the CCU is below the limit, players will be able to connect an play again.
///
/// OpAuthorize is part of connection workflow but only on the Photon Cloud, this error can happen.
/// Self-hosted Photon servers with a CCU limited license won't let a client connect at all.
/// </remarks>
public const int MaxCcuReached = 0x7FFF - 10;
/// <summary>(32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.</summary>
/// <remarks>
/// Some subscription plans for the Photon Cloud are region-bound. Servers of other regions can't be used then.
/// Check your master server address and compare it with your Photon Cloud Dashboard's info.
/// https://cloud.photonengine.com/dashboard
///
/// OpAuthorize is part of connection workflow but only on the Photon Cloud, this error can happen.
/// Self-hosted Photon servers with a CCU limited license won't let a client connect at all.
/// </remarks>
public const int InvalidRegion = 0x7FFF - 11;
/// <summary>
/// (32755) Custom Authentication of the user failed due to setup reasons (see Cloud Dashboard) or the provided user data (like username or token). Check error message for details.
/// </summary>
public const int CustomAuthenticationFailed = 0x7FFF - 12;
/// <summary>(32753) The Authentication ticket expired. Usually, this is refreshed behind the scenes. Connect (and authorize) again.</summary>
public const int AuthenticationTicketExpired = 0x7FF1;
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3f712805dec728943a668b3bf19dc422
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>Possible states for a Chat Client.</summary>
public enum ChatState
{
/// <summary>Peer is created but not used yet.</summary>
Uninitialized,
/// <summary>Connecting to name server.</summary>
ConnectingToNameServer,
/// <summary>Connected to name server.</summary>
ConnectedToNameServer,
/// <summary>Authenticating on current server.</summary>
Authenticating,
/// <summary>Finished authentication on current server.</summary>
Authenticated,
/// <summary>Disconnecting from name server. This is usually a transition from name server to frontend server.</summary>
DisconnectingFromNameServer,
/// <summary>Connecting to frontend server.</summary>
ConnectingToFrontEnd,
/// <summary>Connected to frontend server.</summary>
ConnectedToFrontEnd,
/// <summary>Disconnecting from frontend server.</summary>
DisconnectingFromFrontEnd,
/// <summary>Currently not used.</summary>
QueuedComingFromFrontEnd,
/// <summary>The client disconnects (from any server).</summary>
Disconnecting,
/// <summary>The client is no longer connected (to any server).</summary>
Disconnected,
/// <summary>Client was unable to connect to Name Server and will attempt to connect with an alternative network protocol (TCP).</summary>
ConnectWithFallbackProtocol
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8f482d8c4fe7ade4cbb08eb4a2d83b39
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,35 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>Contains commonly used status values for SetOnlineStatus. You can define your own.</summary>
/// <remarks>
/// While "online" (value 2 and up), the status message will be sent to anyone who has you on his friend list.
///
/// Define custom online status values as you like with these rules:
/// 0: Means "offline". It will be used when you are not connected. In this status, there is no status message.
/// 1: Means "invisible" and is sent to friends as "offline". They see status 0, no message but you can chat.
/// 2: And any higher value will be treated as "online". Status can be set.
/// </remarks>
public static class ChatUserStatus
{
/// <summary>(0) Offline.</summary>
public const int Offline = 0;
/// <summary>(1) Be invisible to everyone. Sends no message.</summary>
public const int Invisible = 1;
/// <summary>(2) Online and available.</summary>
public const int Online = 2;
/// <summary>(3) Online but not available.</summary>
public const int Away = 3;
/// <summary>(4) Do not disturb.</summary>
public const int DND = 4;
/// <summary>(5) Looking For Game/Group. Could be used when you want to be invited or do matchmaking.</summary>
public const int LFG = 5;
/// <summary>(6) Could be used when in a room, playing.</summary>
public const int Playing = 6;
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7db67e7f5face2e42b6daafcaf4e6c82
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,148 @@
// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
using System.Collections.Generic;
using ExitGames.Client.Photon;
/// <summary>
/// Callback interface for Chat client side. Contains callback methods to notify your app about updates.
/// Must be provided to new ChatClient in constructor
/// </summary>
public interface IChatClientListener
{
/// <summary>
/// All debug output of the library will be reported through this method. Print it or put it in a
/// buffer to use it on-screen.
/// </summary>
/// <param name="level">DebugLevel (severity) of the message.</param>
/// <param name="message">Debug text. Print to System.Console or screen.</param>
void DebugReturn(DebugLevel level, string message);
/// <summary>
/// Disconnection happened.
/// </summary>
void OnDisconnected();
/// <summary>
/// Client is connected now.
/// </summary>
/// <remarks>
/// Clients have to be connected before they can send their state, subscribe to channels and send any messages.
/// </remarks>
void OnConnected();
/// <summary>The ChatClient's state changed. Usually, OnConnected and OnDisconnected are the callbacks to react to.</summary>
/// <param name="state">The new state.</param>
void OnChatStateChange(ChatState state);
/// <summary>
/// Notifies app that client got new messages from server
/// Number of senders is equal to number of messages in 'messages'. Sender with number '0' corresponds to message with
/// number '0', sender with number '1' corresponds to message with number '1' and so on
/// </summary>
/// <param name="channelName">channel from where messages came</param>
/// <param name="senders">list of users who sent messages</param>
/// <param name="messages">list of messages it self</param>
void OnGetMessages(string channelName, string[] senders, object[] messages);
/// <summary>
/// Notifies client about private message
/// </summary>
/// <param name="sender">user who sent this message</param>
/// <param name="message">message it self</param>
/// <param name="channelName">channelName for private messages (messages you sent yourself get added to a channel per target username)</param>
void OnPrivateMessage(string sender, object message, string channelName);
/// <summary>
/// Result of Subscribe operation. Returns subscription result for every requested channel name.
/// </summary>
/// <remarks>
/// If multiple channels sent in Subscribe operation, OnSubscribed may be called several times, each call with part of sent array or with single channel in "channels" parameter.
/// Calls order and order of channels in "channels" parameter may differ from order of channels in "channels" parameter of Subscribe operation.
/// </remarks>
/// <param name="channels">Array of channel names.</param>
/// <param name="results">Per channel result if subscribed.</param>
void OnSubscribed(string[] channels, bool[] results);
/// <summary>
/// Result of Unsubscribe operation. Returns for channel name if the channel is now unsubscribed.
/// </summary>
/// If multiple channels sent in Unsubscribe operation, OnUnsubscribed may be called several times, each call with part of sent array or with single channel in "channels" parameter.
/// Calls order and order of channels in "channels" parameter may differ from order of channels in "channels" parameter of Unsubscribe operation.
/// <param name="channels">Array of channel names that are no longer subscribed.</param>
void OnUnsubscribed(string[] channels);
/// <summary>
/// New status of another user (you get updates for users set in your friends list).
/// </summary>
/// <param name="user">Name of the user.</param>
/// <param name="status">New status of that user.</param>
/// <param name="gotMessage">True if the status contains a message you should cache locally. False: This status update does not include a message (keep any you have).</param>
/// <param name="message">Message that user set.</param>
void OnStatusUpdate(string user, int status, bool gotMessage, object message);
/// <summary>
/// A user has subscribed to a public chat channel
/// </summary>
/// <param name="channel">Name of the chat channel</param>
/// <param name="user">UserId of the user who subscribed</param>
void OnUserSubscribed(string channel, string user);
/// <summary>
/// A user has unsubscribed from a public chat channel
/// </summary>
/// <param name="channel">Name of the chat channel</param>
/// <param name="user">UserId of the user who unsubscribed</param>
void OnUserUnsubscribed(string channel, string user);
#if CHAT_EXTENDED
/// <summary>
/// Properties of a public channel has been changed
/// </summary>
/// <param name="channel">Channel name in which the properties have changed</param>
/// <param name="senderUserId">The UserID of the user who changed the properties</param>
/// <param name="properties">The properties that have changed</param>
void OnChannelPropertiesChanged(string channel, string senderUserId, Dictionary<object, object> properties);
/// <summary>
/// Properties of a user in a public channel has been changed
/// </summary>
/// <param name="channel">Channel name in which the properties have changed</param>
/// <param name="targetUserId">The UserID whom properties have changed</param>
/// <param name="senderUserId">The UserID of the user who changed the properties</param>
/// <param name="properties">The properties that have changed</param>
void OnUserPropertiesChanged(string channel, string targetUserId, string senderUserId, Dictionary<object, object> properties);
/// <summary>
/// The server uses error events to make the client aware of some issues.
/// </summary>
/// <remarks>
/// This is currently used only in Chat WebHooks.
/// </remarks>
/// <param name="channel">The name of the channel in which this error info has been received</param>
/// <param name="error">The text message of the error info</param>
/// <param name="data">Optional error data</param>
void OnErrorInfo(string channel, string error, object data);
#endif
#if SDK_V4
/// <summary>
/// Received a broadcast message
/// </summary>
/// <param name="channel">Name of the chat channel</param>
/// <param name="message">Message data</param>
void OnReceiveBroadcastMessage(string channel, byte[] message);
#endif
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bab7c8053b486e34aa0d4ca99dcbec80
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,12 @@
{
"name": "PhotonChat",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 08a110bd598f7604f9519c2d7e1fb3cc
timeCreated: 1537459565
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,137 @@
Photon Chat C# Client - Changelog
Exit Games GmbH - www.photonengine.com - forum.photonengine.com
Version 4.1.6.11 (22. November 2021)
Added: CustomAuthenticationType.Epic to authenticate via Epic Online Services (EOS).
Added: CustomAuthenticationType.FacebookGaming to authenticate via Facebook Gaming services.
Version 4.1.6.10 (21. October 2021 - rev6243)
Fixed: The ChatPeer.ConfigUnitySockets(), which used a surplus typeof() for Xbox configuration.
Version 4.1.6.6 (21. September 2021 - rev6204)
Changed: For Xbox, order of checked assemblies when getting Type SocketNativeSource. It's more likely to be in Assembly-CSharp.
Version 4.1.6.5 (24. August 2021 - rev6181)
Updated: The default name server host to "ns.photonengine.io". When using WSS on this, it expects TLS1.2 (Win 7 and old Unity versions may not support this).
Version 4.1.6.2 (17. June 2021)
Changed: The enumeration CustomAuthenticationType was changed to fix naming inconsistencies. Use PlayStation4 and PlayStation5 respectively. Old variants are available as obsolete.
Version 4.1.5.2 (12. March 2021)
ADDED: CustomAuthenticationType.Playstation5 (value 12).
Version 4.1.5.0 (03. March 2021)
Updated: ChatPeer ConfigUnitySockets() to the analog of the Realtime API.
Version 4.1.5.0 (3. February 2021)
Internal: AuthenticationValues.Token is now an object instead of a string (so some internal code changed). This enables the server to send a byte[], which is more effective than a string.
Version 4.1.4.6 (16. November 2020)
Added: ChatClient.PrivateChatHistoryLength field. If set before you connect, this can be used to limit the number of private messages when the server (re)subscribes the client to (still alive) a private chat channel.
Added: Protocol Fallback option for Chat. Analog to the Realtime API, Chat can now try another protocol, if the initial connect to the Name Server fails. After the timeout or when an error happened, UDP will fallback to TCP. TCP will fallback to UDP.
Added: EnableProtocolFallback in ChatClient and ChatAppSettings. When using ConnectUsingSettings, the ChatClient's value gets set and used.
Changed: Connect(appid, appversion, authValues) will only apply the authvalues parameter, if that's non-null.
Changed: ChatAppSettings field AppId is now AppIdChat (matching the value in Realtime API AppSettings). The old name is currently just obsolete.
Added: ChatAppSettings.Port to override the Name Server Port if needed. Note: Chat does not support "Alternative Ports" yet (ports pre-defined per server).
Added: ChatPeer.NameServerPortOverride value to replace/override the default per-protocol port value (by the one in the AppSettings, e.g.).
Version 4.1.4.5 (02. September 2020)
Added: Option for extended features: Channels may send a user list, channels and users can have custom properties and there are web-forwarding flags. Needs compile define CHAT_EXTENDED. This also adds new methods to the IChatClientListener.
Changed: AuthenticationValues has been refined, analog to the changes in the Realtime API.
Version 4.1.4.2 (8. May 2020 - rev5519)
Added: Broadcast receive and read channel using UniqueRoomID UniqueRoomID read from SubscribeChannel response
Version 4.1.2.20
Changed: ChatDisconnectCause enum and OnDisconnected callback usage updated to be in sync. with Realtime.
Added: ChatClient.ConnectUsingSettings(ChatAppSettings appSettings).
Added: more error logs when something fails internally.
Version 4.1.2.19 (12. November 2019 - rev5266)
Changed: ChatPeer now look for SocketNativeSource instead of SocketWebTcpNativeDynamic when the target platform is XB One. A new Xbox addon is coming up on our SDK page.
Version 4.1.2.16 (25. June 2019 - rev5168)
Added: ChatClient.TryGetPrivateChannelByUser.
Version 4.1.2.14 (6. May 2019 - rev5097)
Changed: Chat API changes are now listed in a separate changes file.
Version 4.1.2.13 (3. May 2019 - rev5086)
Fixed: Properly add local client's UserId to public channels' Subscribers list when applicable.
Version 4.1.2.11 (15. April 2019 - rev5043)
Added: Feature: PublishSubscribers. Per channel, you can now define if the server broadcasts users joining and leaving.
Fixed: proper way to handle Subscribe event when channel properties are returned.
Added: Viveport Auth Provider enum value.
Added: Switch-related workaround. Setting a Thread.Name was causing a crash in some exports on console. This affects Unity to Nintendo Switch exports.
Added: ChannelCreationOptions class to be used in the new Subscribe overload method.
Changed: Chat to use the same 1.8 serialization as Realtime/PUN. This also now matches the SocketWebTcp.SerializationProtocol default.
Version 4.1.2.9 (13. February 2019 - rev4985)
Added: Client API for Max Subscribers and Publish Subscribers features inside public channels.
Version 4.1.2.1 (31. July 2018 - rev4787)
Changed: Namespace from "ExitGames.Client.Photon.Chat" to "Photon.Chat".
Added: ConnectAndSetStatus method.
Version 4.1.1.17 (11. October 2017 - rev4465)
Fixed: Unity "6" compile define is now UNITY_2017.
Version 4.1.1.15 (17. July 2017 - rev4232)
Added: ChatClient.TransportProtocol as shortcut to the use PhotonPeer's TransportProtocol value. This enables setting the protocol easily while not connected.
Added: ChatClient.SocketImplementationConfig as shortcut to modify PhotonPeer's SocketImplementationConfig. This enables you to setup which IPhotonSocket implementation to use for which network protocol.
Changed: ChatPeer.ConfigUnitySockets() to try to find our websocket implementations in the assembly, making the SocketWebTcpCoroutine and SocketWebTcpThread classes optional.
Removed: Class "SocketWebTcp" is no longer found by ConfigUnitySockets().
Version 4.1.1.14 (5. July 2017 - rev4191)
Added: ChatClient can optionally run a thread to call SendOutgoingCommands in intervals. This makes sure the connection doesn't fail easily (e.g. when Unity is loading scenes, etc.). You still have to call Service to dispatch received messages.
Added: ChatClient.UseBackgroundWorkerForSending. Set this to true, to use the new background thread. Note: Do not use this in WebGL exports from Unity cause Threads are unavailable in them.
Version 4.1.1.2 (13. September 2016 - rev3652)
Changed: GetNameServerAddress() is the same in Chat and LoadBalancing APIs now.
Changed: ChatPeer now has ConfigUnitySockets(), which defines the SocketImplementationConfig. It's only used in Unity (using UNITY define).
Changed: ChatClient is not setting socket implementations anymore.
Added: Hashtable definition to use Photon's own implementation for Windows Store builds (NETFX_CORE). This must be used but it means you to use the same Hashtable definition in all builds (no matter if 8.1 or 10).
Added: Support for WebGL export in Unity.
Version 4.0.5.0 (3. December 2015 - rev3144)
Added: A MessageLimit field for ChatClient and ChatChannel to limit the number of messages the client keeps locally. It might be useful to limit memory usage in long running chats. Set ChatClient.MessageLimit to apply the limit to any channel subscribed afterwards or apply a limit individually.
Version 4.0.0.11 (28. October 2015 - rev3093)
Added: More sanity checks on operations (empty userId or secret, max friends).
Added: Special debug logging when the server returns an error for "Operation Unknown". In this case, it's highly likely that you don't use a Chat AppId.
Added: More helpful error logging.
Version 4.0.0.10 (14. July 2015 - rev2988)
Added: A Unity 4.6 demo with uGUI. It's missing a few features but should give you a good start to making your own.
Added: Unity/WebGL support (merged from PUN).
Added: Breaking! IChatClientListener.DebugReturn(). Photon lib and chat client log via this method (no logging to console by default).
Changed: ChatClient.CustomAuthenticationValues is now .AuthValues. You can use those values to identify a user, even if you don't setup an external, custom authentication service.
Changed: ChatClient.UserId no longer directly stores the id but puts it into AuthValues. This means, the UserId could also be set via setting AuthValues.
Changed: The API of AuthenticationValues. There is now the UserId and AddAuthParameter() replaces the less general SetAuthParameters() (which only set specific key/values).
Note: All users should have a UserId. You can set chatClient.UserId before you connect, or you can set the AuthenticationValues in Connect(..., authValues) to set a UserId.
Added: ChatChannel.ToStringMessages(), which gets all messages in a single string, line by line. The format is "Sender:Message".
Added: ChatClient.TryGetChannel() to find a channel only by name, no matter if public or private.
Version 4.0.0.7 (12. January 2015 - rev2763)
Internal: Changed code for UserID from 7 to 225. The latter is used in LoadBalancing, too, so we want to re-use the code here.
Version 4.0.0.1 (17. June 2014 - rev2663)
Changed: How the server responds to Subscribe and Unsubscribe. Events will now contain success/failure of those. This allows us to send the answer after calling a WebHook if needed and we can even send it to multiple clients (which authenticated with the same userID).
Changed: Handling of subscription responsed. This is done to allow web services to subscribe a client remotely and to be able to prevent joining some channel that a user should not join (the channel of some guild or another team, e.g.).
Changed: Debug loggging. In Unity we can't use Debug.Assert, etc. So we have to log more cleanly. This works in Editor and several platforms (but not all).
Changed: Folder for Chat API. It now begins with "Photon" which provides some context no matter where you copy the files. Easier to find in Unity projects.
Changed: Operation FriendList and method SendFriendList renamed to AddFriends
Added: Operation RemoveFriends and corresponding method in ChatClient.cs
Added: Console Demo has new command 'fr' to remove friends
Version 4.0.0.0 (23. May 2014 - rev2614)
Added: SendPrivateMessage() overload that has option to encrypt private messages. Public messages don't need encryption.
Removed: lastId and LastMessageIndex from channels. Those were impractical and should be removed from the API.
Changed: UserStatus class to ChatUserStatus.
Changed: Most classes are defined in their own file now.
Removed: Folders "Shared" and their subfolders. This gives a much better overview.
Added: Handling for event SubscribeResponse. This is not actually a response but gives you info about channels that got subscribed (e.g. when you re-login quickly or when a user is logged in in multiple clients).
Added: HandleSubscriptionResults() method to handle the event and proper responses.

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e5c3dda6f11fe7845989297c8a603dc2
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 801c62f7d03cb463ba20067deb330234
folderAsset: yes
timeCreated: 1537874612
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1aab6e4c105054f7e91af2cf027064d1
folderAsset: yes
timeCreated: 1538395282
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,40 @@
// --------------------------------------------------------------------------------------------------------------------
// <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 instantiated 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 OnEnable()
{
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
Debug.LogError("PUN Demos are not compatible with the New Input System, unless you enable \"Both\" in: Edit > Project Settings > Player > Active Input Handling. Pausing App.");
Debug.Break();
return;
#endif
EventSystem sceneEventSystem = FindObjectOfType<EventSystem>();
if (sceneEventSystem == null)
{
GameObject eventSystem = new GameObject("EventSystem");
eventSystem.AddComponent<EventSystem>();
eventSystem.AddComponent<StandaloneInputModule>();
}
}
}
}

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

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

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

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

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

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

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

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4e3a46219ebf94310a9f347733f88f31
folderAsset: yes
timeCreated: 1537874626
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,30 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using Photon.Realtime;
namespace Photon.Chat.Demo
{
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
};
}
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4fcf4818ecc9abf4e9b7e0c37af9b851
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,32 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Photon.Chat.Demo
{
public class ChannelSelector : MonoBehaviour, IPointerClickHandler
{
public string Channel;
public void SetChannel(string channel)
{
this.Channel = channel;
Text t = this.GetComponentInChildren<Text>();
t.text = this.Channel;
}
public void OnPointerClick(PointerEventData eventData)
{
ChatGui handler = FindObjectOfType<ChatGui>();
handler.ShowChannel(this.Channel);
}
}
}

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 48caa72710147fc4f9389b0b5ec6137d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,54 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
#if PHOTON_UNITY_NETWORKING
using UnityEngine.UI;
using Photon.Pun;
namespace Photon.Chat.Demo
{
/// <summary>
/// This is used in the Editor Splash to properly inform the developer about the chat AppId requirement.
/// </summary>
[ExecuteInEditMode]
public class ChatAppIdCheckerUI : MonoBehaviour
{
public Text Description;
public void Update()
{
if (string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat))
{
if (this.Description != null)
{
this.Description.text = "<Color=Red>WARNING:</Color>\nPlease setup a Chat AppId in the PhotonServerSettings file.";
}
}
else
{
if (this.Description != null)
{
this.Description.text = string.Empty;
}
}
}
}
}
#else
namespace Photon.Chat.Demo
{
public class ChatAppIdCheckerUI : MonoBehaviour
{
// empty class. if PUN is not present, we currently don't check Chat-AppId "presence".
}
}
#endif

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4eb1284704a754507acb17b07b888086
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,649 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Chat;
using Photon.Realtime;
using AuthenticationValues = Photon.Chat.AuthenticationValues;
#if PHOTON_UNITY_NETWORKING
using Photon.Pun;
#endif
namespace Photon.Chat.Demo
{
/// <summary>
/// This simple Chat UI demonstrate basics usages of the Chat Api
/// </summary>
/// <remarks>
/// The ChatClient basically lets you create any number of channels.
///
/// some friends are already set in the Chat demo "DemoChat-Scene", 'Joe', 'Jane' and 'Bob', simply log with them so that you can see the status changes in the Interface
///
/// Workflow:
/// Create ChatClient, Connect to a server with your AppID, Authenticate the user (apply a unique name,)
/// and subscribe to some channels.
/// Subscribe a channel before you publish to that channel!
///
///
/// Note:
/// Don't forget to call ChatClient.Service() on Update to keep the Chatclient operational.
/// </remarks>
public class ChatGui : MonoBehaviour, IChatClientListener
{
public string[] ChannelsToJoinOnConnect; // set in inspector. Demo channels to join automatically.
public string[] FriendsList;
public int HistoryLengthToFetch; // set in inspector. Up to a certain degree, previously sent messages can be fetched for context
public string UserName { get; set; }
private string selectedChannelName; // mainly used for GUI/input
public ChatClient chatClient;
#if !PHOTON_UNITY_NETWORKING
[SerializeField]
#endif
protected internal ChatAppSettings chatAppSettings;
public GameObject missingAppIdErrorPanel;
public GameObject ConnectingLabel;
public RectTransform ChatPanel; // set in inspector (to enable/disable panel)
public GameObject UserIdFormPanel;
public InputField InputFieldChat; // set in inspector
public Text CurrentChannelText; // set in inspector
public Toggle ChannelToggleToInstantiate; // set in inspector
public GameObject FriendListUiItemtoInstantiate;
private readonly Dictionary<string, Toggle> channelToggles = new Dictionary<string, Toggle>();
private readonly Dictionary<string,FriendItem> friendListItemLUT = new Dictionary<string, FriendItem>();
public bool ShowState = true;
public GameObject Title;
public Text StateText; // set in inspector
public Text UserIdText; // set in inspector
// private static string WelcomeText = "Welcome to chat. Type \\help to list commands.";
private static string HelpText = "\n -- HELP --\n" +
"To subscribe to channel(s) (channelnames are case sensitive) : \n" +
"\t<color=#E07B00>\\subscribe</color> <color=green><list of channelnames></color>\n" +
"\tor\n" +
"\t<color=#E07B00>\\s</color> <color=green><list of channelnames></color>\n" +
"\n" +
"To leave channel(s):\n" +
"\t<color=#E07B00>\\unsubscribe</color> <color=green><list of channelnames></color>\n" +
"\tor\n" +
"\t<color=#E07B00>\\u</color> <color=green><list of channelnames></color>\n" +
"\n" +
"To switch the active channel\n" +
"\t<color=#E07B00>\\join</color> <color=green><channelname></color>\n" +
"\tor\n" +
"\t<color=#E07B00>\\j</color> <color=green><channelname></color>\n" +
"\n" +
"To send a private message: (username are case sensitive)\n" +
"\t\\<color=#E07B00>msg</color> <color=green><username></color> <color=green><message></color>\n" +
"\n" +
"To change status:\n" +
"\t\\<color=#E07B00>state</color> <color=green><stateIndex></color> <color=green><message></color>\n" +
"<color=green>0</color> = Offline " +
"<color=green>1</color> = Invisible " +
"<color=green>2</color> = Online " +
"<color=green>3</color> = Away \n" +
"<color=green>4</color> = Do not disturb " +
"<color=green>5</color> = Looking For Group " +
"<color=green>6</color> = Playing" +
"\n\n" +
"To clear the current chat tab (private chats get closed):\n" +
"\t<color=#E07B00>\\clear</color>";
public void Start()
{
DontDestroyOnLoad(this.gameObject);
this.UserIdText.text = "";
this.StateText.text = "";
this.StateText.gameObject.SetActive(true);
this.UserIdText.gameObject.SetActive(true);
this.Title.SetActive(true);
this.ChatPanel.gameObject.SetActive(false);
this.ConnectingLabel.SetActive(false);
if (string.IsNullOrEmpty(this.UserName))
{
this.UserName = "user" + Environment.TickCount%99; //made-up username
}
#if PHOTON_UNITY_NETWORKING
this.chatAppSettings = PhotonNetwork.PhotonServerSettings.AppSettings.GetChatSettings();
#endif
bool appIdPresent = !string.IsNullOrEmpty(this.chatAppSettings.AppIdChat);
this.missingAppIdErrorPanel.SetActive(!appIdPresent);
this.UserIdFormPanel.gameObject.SetActive(appIdPresent);
if (!appIdPresent)
{
Debug.LogError("You need to set the chat app ID in the PhotonServerSettings file in order to continue.");
}
}
public void Connect()
{
this.UserIdFormPanel.gameObject.SetActive(false);
this.chatClient = new ChatClient(this);
#if !UNITY_WEBGL
this.chatClient.UseBackgroundWorkerForSending = true;
#endif
this.chatClient.AuthValues = new AuthenticationValues(this.UserName);
this.chatClient.ConnectUsingSettings(this.chatAppSettings);
this.ChannelToggleToInstantiate.gameObject.SetActive(false);
Debug.Log("Connecting as: " + this.UserName);
this.ConnectingLabel.SetActive(true);
}
/// <summary>To avoid that the Editor becomes unresponsive, disconnect all Photon connections in OnDestroy.</summary>
public void OnDestroy()
{
if (this.chatClient != null)
{
this.chatClient.Disconnect();
}
}
/// <summary>To avoid that the Editor becomes unresponsive, disconnect all Photon connections in OnApplicationQuit.</summary>
public void OnApplicationQuit()
{
if (this.chatClient != null)
{
this.chatClient.Disconnect();
}
}
public void Update()
{
if (this.chatClient != null)
{
this.chatClient.Service(); // make sure to call this regularly! it limits effort internally, so calling often is ok!
}
// check if we are missing context, which means we got kicked out to get back to the Photon Demo hub.
if ( this.StateText == null)
{
Destroy(this.gameObject);
return;
}
this.StateText.gameObject.SetActive(this.ShowState); // this could be handled more elegantly, but for the demo it's ok.
}
public void OnEnterSend()
{
if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
{
this.SendChatMessage(this.InputFieldChat.text);
this.InputFieldChat.text = "";
}
}
public void OnClickSend()
{
if (this.InputFieldChat != null)
{
this.SendChatMessage(this.InputFieldChat.text);
this.InputFieldChat.text = "";
}
}
public int TestLength = 2048;
private byte[] testBytes = new byte[2048];
private void SendChatMessage(string inputLine)
{
if (string.IsNullOrEmpty(inputLine))
{
return;
}
if ("test".Equals(inputLine))
{
if (this.TestLength != this.testBytes.Length)
{
this.testBytes = new byte[this.TestLength];
}
this.chatClient.SendPrivateMessage(this.chatClient.AuthValues.UserId, this.testBytes, true);
}
bool doingPrivateChat = this.chatClient.PrivateChannels.ContainsKey(this.selectedChannelName);
string privateChatTarget = string.Empty;
if (doingPrivateChat)
{
// the channel name for a private conversation is (on the client!!) always composed of both user's IDs: "this:remote"
// so the remote ID is simple to figure out
string[] splitNames = this.selectedChannelName.Split(new char[] { ':' });
privateChatTarget = splitNames[1];
}
//UnityEngine.Debug.Log("selectedChannelName: " + selectedChannelName + " doingPrivateChat: " + doingPrivateChat + " privateChatTarget: " + privateChatTarget);
if (inputLine[0].Equals('\\'))
{
string[] tokens = inputLine.Split(new char[] {' '}, 2);
if (tokens[0].Equals("\\help"))
{
this.PostHelpToCurrentChannel();
}
if (tokens[0].Equals("\\state"))
{
int newState = 0;
List<string> messages = new List<string>();
messages.Add ("i am state " + newState);
string[] subtokens = tokens[1].Split(new char[] {' ', ','});
if (subtokens.Length > 0)
{
newState = int.Parse(subtokens[0]);
}
if (subtokens.Length > 1)
{
messages.Add(subtokens[1]);
}
this.chatClient.SetOnlineStatus(newState,messages.ToArray()); // this is how you set your own state and (any) message
}
else if ((tokens[0].Equals("\\subscribe") || tokens[0].Equals("\\s")) && !string.IsNullOrEmpty(tokens[1]))
{
this.chatClient.Subscribe(tokens[1].Split(new char[] {' ', ','}));
}
else if ((tokens[0].Equals("\\unsubscribe") || tokens[0].Equals("\\u")) && !string.IsNullOrEmpty(tokens[1]))
{
this.chatClient.Unsubscribe(tokens[1].Split(new char[] {' ', ','}));
}
else if (tokens[0].Equals("\\clear"))
{
if (doingPrivateChat)
{
this.chatClient.PrivateChannels.Remove(this.selectedChannelName);
}
else
{
ChatChannel channel;
if (this.chatClient.TryGetChannel(this.selectedChannelName, doingPrivateChat, out channel))
{
channel.ClearMessages();
}
}
}
else if (tokens[0].Equals("\\msg") && !string.IsNullOrEmpty(tokens[1]))
{
string[] subtokens = tokens[1].Split(new char[] {' ', ','}, 2);
if (subtokens.Length < 2) return;
string targetUser = subtokens[0];
string message = subtokens[1];
this.chatClient.SendPrivateMessage(targetUser, message);
}
else if ((tokens[0].Equals("\\join") || tokens[0].Equals("\\j")) && !string.IsNullOrEmpty(tokens[1]))
{
string[] subtokens = tokens[1].Split(new char[] { ' ', ',' }, 2);
// If we are already subscribed to the channel we directly switch to it, otherwise we subscribe to it first and then switch to it implicitly
if (this.channelToggles.ContainsKey(subtokens[0]))
{
this.ShowChannel(subtokens[0]);
}
else
{
this.chatClient.Subscribe(new string[] { subtokens[0] });
}
}
else
{
Debug.Log("The command '" + tokens[0] + "' is invalid.");
}
}
else
{
if (doingPrivateChat)
{
this.chatClient.SendPrivateMessage(privateChatTarget, inputLine);
}
else
{
this.chatClient.PublishMessage(this.selectedChannelName, inputLine);
}
}
}
public void PostHelpToCurrentChannel()
{
this.CurrentChannelText.text += HelpText;
}
public void DebugReturn(ExitGames.Client.Photon.DebugLevel level, string message)
{
if (level == ExitGames.Client.Photon.DebugLevel.ERROR)
{
Debug.LogError(message);
}
else if (level == ExitGames.Client.Photon.DebugLevel.WARNING)
{
Debug.LogWarning(message);
}
else
{
Debug.Log(message);
}
}
public void OnConnected()
{
if (this.ChannelsToJoinOnConnect != null && this.ChannelsToJoinOnConnect.Length > 0)
{
this.chatClient.Subscribe(this.ChannelsToJoinOnConnect, this.HistoryLengthToFetch);
}
this.ConnectingLabel.SetActive(false);
this.UserIdText.text = "Connected as "+ this.UserName;
this.ChatPanel.gameObject.SetActive(true);
if (this.FriendsList!=null && this.FriendsList.Length>0)
{
this.chatClient.AddFriends(this.FriendsList); // Add some users to the server-list to get their status updates
// add to the UI as well
foreach(string _friend in this.FriendsList)
{
if (this.FriendListUiItemtoInstantiate != null && _friend!= this.UserName)
{
this.InstantiateFriendButton(_friend);
}
}
}
if (this.FriendListUiItemtoInstantiate != null)
{
this.FriendListUiItemtoInstantiate.SetActive(false);
}
this.chatClient.SetOnlineStatus(ChatUserStatus.Online); // You can set your online state (without a mesage).
}
public void OnDisconnected()
{
this.ConnectingLabel.SetActive(false);
}
public void OnChatStateChange(ChatState state)
{
// use OnConnected() and OnDisconnected()
// this method might become more useful in the future, when more complex states are being used.
this.StateText.text = state.ToString();
}
public void OnSubscribed(string[] channels, bool[] results)
{
// in this demo, we simply send a message into each channel. This is NOT a must have!
foreach (string channel in channels)
{
this.chatClient.PublishMessage(channel, "says 'hi'."); // you don't HAVE to send a msg on join but you could.
if (this.ChannelToggleToInstantiate != null)
{
this.InstantiateChannelButton(channel);
}
}
Debug.Log("OnSubscribed: " + string.Join(", ", channels));
/*
// select first subscribed channel in alphabetical order
if (this.chatClient.PublicChannels.Count > 0)
{
var l = new List<string>(this.chatClient.PublicChannels.Keys);
l.Sort();
string selected = l[0];
if (this.channelToggles.ContainsKey(selected))
{
ShowChannel(selected);
foreach (var c in this.channelToggles)
{
c.Value.isOn = false;
}
this.channelToggles[selected].isOn = true;
AddMessageToSelectedChannel(WelcomeText);
}
}
*/
// Switch to the first newly created channel
this.ShowChannel(channels[0]);
}
/// <inheritdoc />
public void OnSubscribed(string channel, string[] users, Dictionary<object, object> properties)
{
Debug.LogFormat("OnSubscribed: {0}, users.Count: {1} Channel-props: {2}.", channel, users.Length, properties.ToStringFull());
}
private void InstantiateChannelButton(string channelName)
{
if (this.channelToggles.ContainsKey(channelName))
{
Debug.Log("Skipping creation for an existing channel toggle.");
return;
}
Toggle cbtn = (Toggle)Instantiate(this.ChannelToggleToInstantiate);
cbtn.gameObject.SetActive(true);
cbtn.GetComponentInChildren<ChannelSelector>().SetChannel(channelName);
cbtn.transform.SetParent(this.ChannelToggleToInstantiate.transform.parent, false);
this.channelToggles.Add(channelName, cbtn);
}
private void InstantiateFriendButton(string friendId)
{
GameObject fbtn = (GameObject)Instantiate(this.FriendListUiItemtoInstantiate);
fbtn.gameObject.SetActive(true);
FriendItem _friendItem = fbtn.GetComponent<FriendItem>();
_friendItem.FriendId = friendId;
fbtn.transform.SetParent(this.FriendListUiItemtoInstantiate.transform.parent, false);
this.friendListItemLUT[friendId] = _friendItem;
}
public void OnUnsubscribed(string[] channels)
{
foreach (string channelName in channels)
{
if (this.channelToggles.ContainsKey(channelName))
{
Toggle t = this.channelToggles[channelName];
Destroy(t.gameObject);
this.channelToggles.Remove(channelName);
Debug.Log("Unsubscribed from channel '" + channelName + "'.");
// Showing another channel if the active channel is the one we unsubscribed from before
if (channelName == this.selectedChannelName && this.channelToggles.Count > 0)
{
IEnumerator<KeyValuePair<string, Toggle>> firstEntry = this.channelToggles.GetEnumerator();
firstEntry.MoveNext();
this.ShowChannel(firstEntry.Current.Key);
firstEntry.Current.Value.isOn = true;
}
}
else
{
Debug.Log("Can't unsubscribe from channel '" + channelName + "' because you are currently not subscribed to it.");
}
}
}
public void OnGetMessages(string channelName, string[] senders, object[] messages)
{
if (channelName.Equals(this.selectedChannelName))
{
// update text
this.ShowChannel(this.selectedChannelName);
}
}
public void OnPrivateMessage(string sender, object message, string channelName)
{
// as the ChatClient is buffering the messages for you, this GUI doesn't need to do anything here
// you also get messages that you sent yourself. in that case, the channelName is determinded by the target of your msg
this.InstantiateChannelButton(channelName);
byte[] msgBytes = message as byte[];
if (msgBytes != null)
{
Debug.Log("Message with byte[].Length: "+ msgBytes.Length);
}
if (this.selectedChannelName.Equals(channelName))
{
this.ShowChannel(channelName);
}
}
/// <summary>
/// New status of another user (you get updates for users set in your friends list).
/// </summary>
/// <param name="user">Name of the user.</param>
/// <param name="status">New status of that user.</param>
/// <param name="gotMessage">True if the status contains a message you should cache locally. False: This status update does not include a
/// message (keep any you have).</param>
/// <param name="message">Message that user set.</param>
public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
{
Debug.LogWarning("status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message));
if (this.friendListItemLUT.ContainsKey(user))
{
FriendItem _friendItem = this.friendListItemLUT[user];
if ( _friendItem!=null) _friendItem.OnFriendStatusUpdate(status,gotMessage,message);
}
}
public void OnUserSubscribed(string channel, string user)
{
Debug.LogFormat("OnUserSubscribed: channel=\"{0}\" userId=\"{1}\"", channel, user);
}
public void OnUserUnsubscribed(string channel, string user)
{
Debug.LogFormat("OnUserUnsubscribed: channel=\"{0}\" userId=\"{1}\"", channel, user);
}
/// <inheritdoc />
public void OnChannelPropertiesChanged(string channel, string userId, Dictionary<object, object> properties)
{
Debug.LogFormat("OnChannelPropertiesChanged: {0} by {1}. Props: {2}.", channel, userId, Extensions.ToStringFull(properties));
}
public void OnUserPropertiesChanged(string channel, string targetUserId, string senderUserId, Dictionary<object, object> properties)
{
Debug.LogFormat("OnUserPropertiesChanged: (channel:{0} user:{1}) by {2}. Props: {3}.", channel, targetUserId, senderUserId, Extensions.ToStringFull(properties));
}
/// <inheritdoc />
public void OnErrorInfo(string channel, string error, object data)
{
Debug.LogFormat("OnErrorInfo for channel {0}. Error: {1} Data: {2}", channel, error, data);
}
public void AddMessageToSelectedChannel(string msg)
{
ChatChannel channel = null;
bool found = this.chatClient.TryGetChannel(this.selectedChannelName, out channel);
if (!found)
{
Debug.Log("AddMessageToSelectedChannel failed to find channel: " + this.selectedChannelName);
return;
}
if (channel != null)
{
channel.Add("Bot", msg,0); //TODO: how to use msgID?
}
}
public void ShowChannel(string channelName)
{
if (string.IsNullOrEmpty(channelName))
{
return;
}
ChatChannel channel = null;
bool found = this.chatClient.TryGetChannel(channelName, out channel);
if (!found)
{
Debug.Log("ShowChannel failed to find channel: " + channelName);
return;
}
this.selectedChannelName = channelName;
this.CurrentChannelText.text = channel.ToStringMessages();
Debug.Log("ShowChannel: " + this.selectedChannelName);
foreach (KeyValuePair<string, Toggle> pair in this.channelToggles)
{
pair.Value.isOn = pair.Key == channelName ? true : false;
}
}
public void OpenDashboard()
{
Application.OpenURL("https://dashboard.photonengine.com");
}
}
}

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 02d148d0890b2d44dbdf7f1c1b39a499
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: ec07267f6a28fb044ac89845274e79af
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,84 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
namespace Photon.Chat.Demo
{
/// <summary>
/// Friend UI item used to represent the friend status as well as message.
/// It aims at showing how to share health for a friend that plays on a different room than you for example.
/// But of course the message can be anything and a lot more complex.
/// </summary>
public class FriendItem : MonoBehaviour
{
[HideInInspector]
public string FriendId
{
set { this.NameLabel.text = value; }
get { return this.NameLabel.text; }
}
public Text NameLabel;
public Text StatusLabel;
public Text Health;
public void Awake()
{
this.Health.text = string.Empty;
}
public void OnFriendStatusUpdate(int status, bool gotMessage, object message)
{
string _status;
switch (status)
{
case 1:
_status = "Invisible";
break;
case 2:
_status = "Online";
break;
case 3:
_status = "Away";
break;
case 4:
_status = "Do not disturb";
break;
case 5:
_status = "Looking For Game/Group";
break;
case 6:
_status = "Playing";
break;
default:
_status = "Offline";
break;
}
this.StatusLabel.text = _status;
if (gotMessage)
{
string _health = string.Empty;
if (message != null)
{
string[] _messages = message as string[];
if (_messages != null && _messages.Length >= 2)
{
_health = (string)_messages[1] + "%";
}
}
this.Health.text = _health;
}
}
}
}

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 660b16ba396d0465b98be14947420288
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,20 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
namespace Photon.Chat.Demo
{
public class IgnoreUiRaycastWhenInactive : MonoBehaviour, ICanvasRaycastFilter
{
public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
{
return this.gameObject.activeInHierarchy;
}
}
}

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4ba4c747f6975ea46bcc0a55ffe3bfe8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,55 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Exit Games GmbH"/>
// <summary>Demo code for Photon Chat in Unity.</summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
namespace Photon.Chat.Demo
{
[RequireComponent(typeof(ChatGui))]
public class NamePickGui : MonoBehaviour
{
private const string UserNamePlayerPref = "NamePickUserName";
public ChatGui chatNewComponent;
public InputField idInput;
public void Start()
{
this.chatNewComponent = FindObjectOfType<ChatGui>();
string prefsName = PlayerPrefs.GetString(UserNamePlayerPref);
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.StartChat();
}
}
public void StartChat()
{
ChatGui chatNewComponent = FindObjectOfType<ChatGui>();
chatNewComponent.UserName = this.idInput.text.Trim();
chatNewComponent.Connect();
this.enabled = false;
PlayerPrefs.SetString(UserNamePlayerPref, chatNewComponent.UserName);
}
}
}

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 696a5174ff5e707479b3540eb56d14b7
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ee1734b1a7bac244bb5f15ecd778b5f2
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 887ac71c799552346b6cf7654fb699cb
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 3b5a0a7dce46a13459199d174ad3db3f
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 1
settings: {}
- first:
'': WP8
second:
enabled: 1
settings:
CPU: AnyCPU
DontProcess: False
PlaceholderPath: Assets/Photon/PhotonLibs/Photon3Unity3D.dll
SDK: AnySDK
ScriptingBackend: DotNet
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 1
settings:
CPU: AnyCPU
DontProcess: false
PlaceholderPath: Assets/Photon/PhotonLibs/Photon3Unity3D.dll
SDK: AnySDK
ScriptingBackend: DotNet
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3439a9e4030efca45b6cc06240106c02
timeCreated: 1460035811
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,38 @@
fileFormatVersion: 2
guid: aadb37a20a33632429047acaef43658a
labels:
- ExitGames
- PUN
- Photon
- Networking
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8d4f08d435c4b6343969d8af249460ff
labels:
- ExitGames
- PUN
- Photon
- Networking
TextScriptImporter:
userData:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 2f243ce0406bd1c40a9ff5fc2d78d905
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,369 @@
#if UNITY_WEBGL || WEBSOCKET || ((UNITY_XBOXONE || UNITY_GAMECORE) && UNITY_EDITOR)
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SocketWebTcp.cs" company="Exit Games GmbH">
// Copyright (c) Exit Games GmbH. All rights reserved.
// </copyright>
// <summary>
// Internal class to encapsulate the network i/o functionality for the realtime library.
// </summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
namespace ExitGames.Client.Photon
{
using System;
using System.Collections;
using UnityEngine;
using SupportClassPun = ExitGames.Client.Photon.SupportClass;
#if !(UNITY_WEBGL || NETFX_CORE)
using System.Net;
using System.Net.Sockets;
using System.Threading;
#endif
/// <summary>
/// Yield Instruction to Wait for real seconds. Very important to keep connection working if Time.TimeScale is altered, we still want accurate network events
/// </summary>
public sealed class WaitForRealSeconds : CustomYieldInstruction
{
private readonly float _endTime;
public override bool keepWaiting
{
get { return this._endTime > Time.realtimeSinceStartup; }
}
public WaitForRealSeconds(float seconds)
{
this._endTime = Time.realtimeSinceStartup + seconds;
}
}
/// <summary>
/// Internal class to encapsulate the network i/o functionality for the realtime libary.
/// </summary>
public class SocketWebTcp : IPhotonSocket, IDisposable
{
private WebSocket sock;
private readonly object syncer = new object();
public SocketWebTcp(PeerBase npeer) : base(npeer)
{
this.ServerAddress = npeer.ServerAddress;
if (this.ReportDebugOfLevel(DebugLevel.INFO))
{
this.Listener.DebugReturn(DebugLevel.INFO, "new SocketWebTcp() for Unity. Server: " + this.ServerAddress);
}
//this.Protocol = ConnectionProtocol.WebSocket;
this.PollReceive = false;
}
public void Dispose()
{
this.State = PhotonSocketState.Disconnecting;
if (this.sock != null)
{
try
{
if (this.sock.Connected) this.sock.Close();
}
catch (Exception ex)
{
this.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Dispose(): " + ex);
}
}
this.sock = null;
this.State = PhotonSocketState.Disconnected;
}
GameObject websocketConnectionObject;
public override bool Connect()
{
//bool baseOk = base.Connect();
//if (!baseOk)
//{
// return false;
//}
this.State = PhotonSocketState.Connecting;
if (this.websocketConnectionObject != null)
{
UnityEngine.Object.Destroy(this.websocketConnectionObject);
}
this.websocketConnectionObject = new GameObject("websocketConnectionObject");
MonoBehaviour mb = this.websocketConnectionObject.AddComponent<MonoBehaviourExt>();
this.websocketConnectionObject.hideFlags = HideFlags.HideInHierarchy;
UnityEngine.Object.DontDestroyOnLoad(this.websocketConnectionObject);
#if UNITY_WEBGL || NETFX_CORE
this.sock = new WebSocket(new Uri(this.ConnectAddress), this.SerializationProtocol);
this.sock.Connect();
mb.StartCoroutine(this.ReceiveLoop());
#else
mb.StartCoroutine(this.DetectIpVersionAndConnect(mb));
#endif
return true;
}
#if !(UNITY_WEBGL || NETFX_CORE)
private bool ipVersionDetectDone;
private IEnumerator DetectIpVersionAndConnect(MonoBehaviour mb)
{
Uri uri = null;
try
{
uri = new Uri(this.ConnectAddress);
}
catch (Exception ex)
{
if (this.ReportDebugOfLevel(DebugLevel.ERROR))
{
this.Listener.DebugReturn(DebugLevel.ERROR, "Failed to create a URI from ConnectAddress (" + ConnectAddress + "). Exception: " + ex);
}
}
if (uri != null && uri.HostNameType == UriHostNameType.Dns)
{
ipVersionDetectDone = false;
ThreadPool.QueueUserWorkItem(this.DetectIpVersion, uri.Host);
while (!this.ipVersionDetectDone)
{
yield return new WaitForRealSeconds(0.1f);
}
}
if (this.AddressResolvedAsIpv6)
{
this.ConnectAddress += "&IPv6";
}
if (this.ReportDebugOfLevel(DebugLevel.INFO))
{
this.Listener.DebugReturn(DebugLevel.INFO, "DetectIpVersionAndConnect() AddressResolvedAsIpv6: " + this.AddressResolvedAsIpv6 + " ConnectAddress: " + ConnectAddress);
}
this.sock = new WebSocket(new Uri(this.ConnectAddress), this.SerializationProtocol);
this.sock.Connect();
mb.StartCoroutine(this.ReceiveLoop());
}
// state has to be the hostname string
private void DetectIpVersion(object state)
{
string host = state as string;
IPAddress[] ipAddresses;
try
{
ipAddresses = Dns.GetHostAddresses(host);
foreach (IPAddress ipAddress in ipAddresses)
{
if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
this.AddressResolvedAsIpv6 = true;
break;
}
}
}
catch (Exception ex)
{
this.Listener.DebugReturn(DebugLevel.INFO, "DetectIpVersionAndConnect (uri: " + host + "= thread failed: " + ex);
}
this.ipVersionDetectDone = true;
}
#endif
public override bool Disconnect()
{
if (this.ReportDebugOfLevel(DebugLevel.INFO))
{
this.Listener.DebugReturn(DebugLevel.INFO, "SocketWebTcp.Disconnect()");
}
this.State = PhotonSocketState.Disconnecting;
lock (this.syncer)
{
if (this.sock != null)
{
try
{
this.sock.Close();
}
catch (Exception ex)
{
this.Listener.DebugReturn(DebugLevel.ERROR, "Exception in Disconnect(): " + ex);
}
this.sock = null;
}
}
if (this.websocketConnectionObject != null)
{
UnityEngine.Object.Destroy(this.websocketConnectionObject);
}
this.State = PhotonSocketState.Disconnected;
return true;
}
/// <summary>
/// used by TPeer*
/// </summary>
public override PhotonSocketError Send(byte[] data, int length)
{
if (this.State != PhotonSocketState.Connected)
{
return PhotonSocketError.Skipped;
}
try
{
if (data.Length > length)
{
byte[] trimmedData = new byte[length];
Buffer.BlockCopy(data, 0, trimmedData, 0, length);
data = trimmedData;
}
if (this.ReportDebugOfLevel(DebugLevel.ALL))
{
this.Listener.DebugReturn(DebugLevel.ALL, "Sending: " + SupportClassPun.ByteArrayToString(data));
}
if (this.sock != null)
{
this.sock.Send(data);
}
}
catch (Exception e)
{
this.Listener.DebugReturn(DebugLevel.ERROR, "Cannot send to: " + this.ServerAddress + ". " + e.Message);
this.HandleException(StatusCode.Exception);
return PhotonSocketError.Exception;
}
return PhotonSocketError.Success;
}
public override PhotonSocketError Receive(out byte[] data)
{
data = null;
return PhotonSocketError.NoData;
}
internal const int ALL_HEADER_BYTES = 9;
internal const int TCP_HEADER_BYTES = 7;
internal const int MSG_HEADER_BYTES = 2;
public IEnumerator ReceiveLoop()
{
//this.Listener.DebugReturn(DebugLevel.INFO, "ReceiveLoop()");
if (this.sock != null)
{
while (this.sock != null && !this.sock.Connected && this.sock.Error == null)
{
yield return new WaitForRealSeconds(0.1f);
}
if (this.sock != null)
{
if (this.sock.Error != null)
{
this.Listener.DebugReturn(DebugLevel.ERROR, "Exiting receive thread. Server: " + this.ServerAddress + ":" + this.ServerPort + " Error: " + this.sock.Error);
this.HandleException(StatusCode.ExceptionOnConnect);
}
else
{
// connected
if (this.ReportDebugOfLevel(DebugLevel.ALL))
{
this.Listener.DebugReturn(DebugLevel.ALL, "Receiving by websocket. this.State: " + this.State);
}
this.State = PhotonSocketState.Connected;
this.peerBase.OnConnect();
while (this.State == PhotonSocketState.Connected)
{
if (this.sock != null)
{
if (this.sock.Error != null)
{
this.Listener.DebugReturn(DebugLevel.ERROR, "Exiting receive thread (inside loop). Server: " + this.ServerAddress + ":" + this.ServerPort + " Error: " + this.sock.Error);
this.HandleException(StatusCode.ExceptionOnReceive);
break;
}
else
{
byte[] inBuff = this.sock.Recv();
if (inBuff == null || inBuff.Length == 0)
{
// nothing received. wait a bit, try again
yield return new WaitForRealSeconds(0.02f);
continue;
}
if (this.ReportDebugOfLevel(DebugLevel.ALL))
{
this.Listener.DebugReturn(DebugLevel.ALL, "TCP << " + inBuff.Length + " = " + SupportClassPun.ByteArrayToString(inBuff));
}
if (inBuff.Length > 0)
{
try
{
this.HandleReceivedDatagram(inBuff, inBuff.Length, false);
}
catch (Exception e)
{
if (this.State != PhotonSocketState.Disconnecting && this.State != PhotonSocketState.Disconnected)
{
if (this.ReportDebugOfLevel(DebugLevel.ERROR))
{
this.EnqueueDebugReturn(DebugLevel.ERROR, "Receive issue. State: " + this.State + ". Server: '" + this.ServerAddress + "' Exception: " + e);
}
this.HandleException(StatusCode.ExceptionOnReceive);
}
}
}
}
}
}
}
}
}
this.Disconnect();
}
private class MonoBehaviourExt : MonoBehaviour { }
}
}
#endif

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ac953d6a57a9ea94e96ec689598995d5
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,188 @@
#if UNITY_WEBGL || WEBSOCKET || ((UNITY_XBOXONE || UNITY_GAMECORE) && UNITY_EDITOR)
// --------------------------------------------------------------------------------------------------------------------
// <summary>
// Provided originally by Unity to cover WebSocket support in WebGL and the Editor. Modified by Exit Games GmbH.
// </summary>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
namespace ExitGames.Client.Photon
{
using System;
using System.Text;
#if UNITY_WEBGL && !UNITY_EDITOR
using System.Runtime.InteropServices;
#else
using WebSocketSharp;
using System.Collections.Generic;
using System.Security.Authentication;
#endif
public class WebSocket
{
private Uri mUrl;
/// <summary>Photon uses this to agree on a serialization protocol. Either: GpBinaryV16 or GpBinaryV18. Based on enum SerializationProtocol.</summary>
private string protocols = "GpBinaryV16";
public WebSocket(Uri url, string serialization = null)
{
this.mUrl = url;
if (serialization != null)
{
this.protocols = serialization;
}
string protocol = mUrl.Scheme;
if (!protocol.Equals("ws") && !protocol.Equals("wss"))
throw new ArgumentException("Unsupported protocol: " + protocol);
}
public void SendString(string str)
{
Send(Encoding.UTF8.GetBytes (str));
}
public string RecvString()
{
byte[] retval = Recv();
if (retval == null)
return null;
return Encoding.UTF8.GetString (retval);
}
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
private static extern int SocketCreate (string url, string protocols);
[DllImport("__Internal")]
private static extern int SocketState (int socketInstance);
[DllImport("__Internal")]
private static extern void SocketSend (int socketInstance, byte[] ptr, int length);
[DllImport("__Internal")]
private static extern void SocketRecv (int socketInstance, byte[] ptr, int length);
[DllImport("__Internal")]
private static extern int SocketRecvLength (int socketInstance);
[DllImport("__Internal")]
private static extern void SocketClose (int socketInstance);
[DllImport("__Internal")]
private static extern int SocketError (int socketInstance, byte[] ptr, int length);
int m_NativeRef = 0;
public void Send(byte[] buffer)
{
SocketSend (m_NativeRef, buffer, buffer.Length);
}
public byte[] Recv()
{
int length = SocketRecvLength (m_NativeRef);
if (length == 0)
return null;
byte[] buffer = new byte[length];
SocketRecv (m_NativeRef, buffer, length);
return buffer;
}
public void Connect()
{
m_NativeRef = SocketCreate (mUrl.ToString(), this.protocols);
//while (SocketState(m_NativeRef) == 0)
// yield return 0;
}
public void Close()
{
SocketClose(m_NativeRef);
}
public bool Connected
{
get { return SocketState(m_NativeRef) != 0; }
}
public string Error
{
get {
const int bufsize = 1024;
byte[] buffer = new byte[bufsize];
int result = SocketError (m_NativeRef, buffer, bufsize);
if (result == 0)
return null;
return Encoding.UTF8.GetString (buffer);
}
}
#else
WebSocketSharp.WebSocket m_Socket;
Queue<byte[]> m_Messages = new Queue<byte[]>();
bool m_IsConnected = false;
string m_Error = null;
public void Connect()
{
m_Socket = new WebSocketSharp.WebSocket(mUrl.ToString(), new string[] { this.protocols });
m_Socket.SslConfiguration.EnabledSslProtocols = m_Socket.SslConfiguration.EnabledSslProtocols | (SslProtocols)(3072| 768);
m_Socket.OnMessage += (sender, e) => m_Messages.Enqueue(e.RawData);
m_Socket.OnOpen += (sender, e) => m_IsConnected = true;
//this.m_Socket.Log.Level = LogLevel.Debug;
//this.m_Socket.Log.Output += Output;
this.m_Socket.OnClose += SocketOnClose;
m_Socket.OnError += (sender, e) => m_Error = e.Message + (e.Exception == null ? "" : " / " + e.Exception);
m_Socket.ConnectAsync();
}
private void SocketOnClose(object sender, CloseEventArgs e)
{
//UnityEngine.Debug.Log(e.Code.ToString());
// this code is used for cases when the socket failed to get created (specifically used to detect "blocked by Windows firewall")
// for some reason this situation is not calling OnError
if (e.Code == 1006)
{
this.m_Error = e.Reason;
this.m_IsConnected = false;
}
}
public bool Connected { get { return m_IsConnected; } }// added by TS
public void Send(byte[] buffer)
{
m_Socket.Send(buffer);
}
public byte[] Recv()
{
if (m_Messages.Count == 0)
return null;
return m_Messages.Dequeue();
}
public void Close()
{
m_Socket.Close();
}
public string Error
{
get
{
return m_Error;
}
}
#endif
}
}
#endif

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b1bad04f7805f764dba77f0d4518e0f0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

@ -0,0 +1,117 @@
var LibraryWebSockets = {
$webSocketInstances: [],
SocketCreate: function(url, protocols)
{
var str = UTF8ToString(url);
var prot = UTF8ToString(protocols);
var socket = {
socket: new WebSocket(str, [prot]),
buffer: new Uint8Array(0),
error: null,
messages: []
}
socket.socket.binaryType = 'arraybuffer';
socket.socket.onmessage = function (e) {
// if (e.data instanceof Blob)
// {
// var reader = new FileReader();
// reader.addEventListener("loadend", function() {
// var array = new Uint8Array(reader.result);
// socket.messages.push(array);
// });
// reader.readAsArrayBuffer(e.data);
// }
if (e.data instanceof ArrayBuffer)
{
var array = new Uint8Array(e.data);
socket.messages.push(array);
}
};
socket.socket.onclose = function (e) {
if (e.code != 1000)
{
if (e.reason != null && e.reason.length > 0)
socket.error = e.reason;
else
{
switch (e.code)
{
case 1001:
socket.error = "Endpoint going away.";
break;
case 1002:
socket.error = "Protocol error.";
break;
case 1003:
socket.error = "Unsupported message.";
break;
case 1005:
socket.error = "No status.";
break;
case 1006:
socket.error = "Abnormal disconnection.";
break;
case 1009:
socket.error = "Data frame too large.";
break;
default:
socket.error = "Error "+e.code;
}
}
}
}
var instance = webSocketInstances.push(socket) - 1;
return instance;
},
SocketState: function (socketInstance)
{
var socket = webSocketInstances[socketInstance];
return socket.socket.readyState;
},
SocketError: function (socketInstance, ptr, bufsize)
{
var socket = webSocketInstances[socketInstance];
if (socket.error == null)
return 0;
var str = socket.error.slice(0, Math.max(0, bufsize - 1));
writeStringToMemory(str, ptr, false);
return 1;
},
SocketSend: function (socketInstance, ptr, length)
{
var socket = webSocketInstances[socketInstance];
socket.socket.send (HEAPU8.buffer.slice(ptr, ptr+length));
},
SocketRecvLength: function(socketInstance)
{
var socket = webSocketInstances[socketInstance];
if (socket.messages.length == 0)
return 0;
return socket.messages[0].length;
},
SocketRecv: function (socketInstance, ptr, length)
{
var socket = webSocketInstances[socketInstance];
if (socket.messages.length == 0)
return 0;
if (socket.messages[0].length > length)
return 0;
HEAPU8.set(socket.messages[0], ptr);
socket.messages = socket.messages.slice(1);
},
SocketClose: function (socketInstance)
{
var socket = webSocketInstances[socketInstance];
socket.socket.close();
}
};
autoAddDeps(LibraryWebSockets, '$webSocketInstances');
mergeInto(LibraryManager.library, LibraryWebSockets);

@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 04bb5f307f2e48b4fbaa6da865fd4091
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
WebGL:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,3 @@
websocket-sharp.dll built from https://github.com/sta/websocket-sharp.git, commit 869dfb09778de51081b0ae64bd2c3217cffe0699 on Aug 24, 2016.
websocket-sharp is provided under The MIT License as mentioned here: https://github.com/sta/websocket-sharp#license

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 3e262c2b04eaa8440987b50a91e86674
DefaultImporter:
userData:

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save