Skip to content

Commit f0c4b3b

Browse files
committed
new check
1 parent 50e4826 commit f0c4b3b

File tree

2 files changed

+29
-63
lines changed

2 files changed

+29
-63
lines changed

UnityWebSocket/Assets/Scripts/Plugins/UnityWebSocket/Editor/WebSocketPlayerSettingCheck.cs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,41 @@ namespace UnityWebSocket.Editor
66
{
77
public class WebSocketPlayerSettingCheck
88
{
9+
#if UNITY_2018_1_OR_NEWER
10+
[MenuItem("UnityWebSocket/LinkerTarget/Wasm", false, 1)]
11+
private static void WebSocketSettingLinkerTargetWasm()
12+
{
13+
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Wasm;
14+
}
15+
16+
[MenuItem("UnityWebSocket/LinkerTarget/Wasm", true, 1)]
17+
private static bool WebSocketSettingLinkerTargetWasmValidate()
18+
{
19+
return false;
20+
}
21+
22+
[MenuItem("UnityWebSocket/LinkerTarget/Asm", false, 0)]
23+
private static void WebSocketSettingLinkerTargetAsm()
24+
{
25+
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Asm;
26+
}
27+
28+
[MenuItem("UnityWebSocket/LinkerTarget/Both", false, 2)]
29+
private static void WebSocketSettingLinkerTargetBoth()
30+
{
31+
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Both;
32+
}
33+
934
[InitializeOnLoadMethod]
1035
public static void OnInit()
1136
{
12-
#if UNITY_2018 || UNITY_2019
1337
if (PlayerSettings.WebGL.linkerTarget == WebGLLinkerTarget.Wasm)
1438
{
15-
if (EditorUtility.DisplayDialog("Warning", "On WebGL platform should change :\n" +
16-
"PlayerSettings -> WebGL -> linkerTarget \n" +
17-
"to [Both] or [asm.js] !!!", "Change", "Cancel"))
18-
{
19-
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Both;
20-
}
39+
EditorUtility.DisplayDialog("Warning"
40+
, "On WebGL platform should change via Menu:\nUnityWebSocket -> LinkerTarget -> Asm or Both"
41+
, "OK");
2142
}
22-
#endif
2343
}
44+
#endif
2445
}
2546
}

UnityWebSocket/Assets/Scripts/Plugins/UnityWebSocket/WebSocket.cs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
52

63
namespace UnityWebSocket
74
{
@@ -121,58 +118,6 @@ public void SendAsync(byte[] data, Action<bool> completed)
121118

122119
private WebSocketSharp.WebSocket m_rawSocket = null;
123120

124-
/// <summary>
125-
/// Initializes a new instance of the <see cref="WebSocket"/> class with
126-
/// <paramref name="url"/> and optionally <paramref name="protocols"/>.
127-
/// </summary>
128-
/// <param name="url">
129-
/// <para>
130-
/// A <see cref="string"/> that specifies the URL to which to connect.
131-
/// </para>
132-
/// <para>
133-
/// The scheme of the URL must be ws or wss.
134-
/// </para>
135-
/// <para>
136-
/// The new instance uses a secure connection if the scheme is wss.
137-
/// </para>
138-
/// </param>
139-
/// <param name="protocols">
140-
/// <para>
141-
/// An array of <see cref="string"/> that specifies the names of
142-
/// the subprotocols if necessary.
143-
/// </para>
144-
/// <para>
145-
/// Each value of the array must be a token defined in
146-
/// <see href="http://tools.ietf.org/html/rfc2616#section-2.2">
147-
/// RFC 2616</see>.
148-
/// </para>
149-
/// </param>
150-
/// <exception cref="ArgumentNullException">
151-
/// <paramref name="url"/> is <see langword="null"/>.
152-
/// </exception>
153-
/// <exception cref="ArgumentException">
154-
/// <para>
155-
/// <paramref name="url"/> is an empty string.
156-
/// </para>
157-
/// <para>
158-
/// -or-
159-
/// </para>
160-
/// <para>
161-
/// <paramref name="url"/> is an invalid WebSocket URL string.
162-
/// </para>
163-
/// <para>
164-
/// -or-
165-
/// </para>
166-
/// <para>
167-
/// <paramref name="protocols"/> contains a value that is not a token.
168-
/// </para>
169-
/// <para>
170-
/// -or-
171-
/// </para>
172-
/// <para>
173-
/// <paramref name="protocols"/> contains a value twice.
174-
/// </para>
175-
/// </exception>
176121
public WebSocket(string address)
177122
{
178123
m_rawSocket = new WebSocketSharp.WebSocket(address);

0 commit comments

Comments
 (0)