Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Commit bbdd674

Browse files
https://api.playfab.com/releaseNotes/#190312
2 parents 3e3a6c4 + 93bd2d2 commit bbdd674

File tree

8 files changed

+113
-7
lines changed

8 files changed

+113
-7
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
**/*[Tt]estTitleData.json*
2+
13
/[Ll]ibrary/
24
/[Tt]emp/
35
/[Oo]bj/
@@ -23,8 +25,7 @@ ExportedObj/
2325
*.svd
2426
PlayFabUnitySdk.unitypackage
2527
PlayFabUnitySdk.unitypackage.meta
26-
PlayFabEditorPrefsSO.asset
27-
PlayFabEditorPrefsSO.asset.meta
28+
**/*PlayFabEditorPrefsSO.asset*
2829

2930

3031
# Unity3D generated meta files
-135 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*PlayFabEditorPrefsSO.asset*

Source/Assets/PlayFabEditorExtensions/Editor/Scripts/Panels/PlayFabEditorPackages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static void DrawPubSubPrivatePreviewWarning()
5353
GUILayout.Label(" PUBSUB IS IN PRIVATE PREVIEW.");
5454
GUILayout.EndHorizontal();
5555
GUILayout.BeginHorizontal();
56-
GUILayout.Label(" If you wish to try this feature out, Please contact [email protected] for access to the private github repo.");
56+
GUILayout.Label(" If you are a Professional or Enterprise tier customer and wish to try this feature out, Please contact [email protected] for more information.");
5757
GUILayout.EndHorizontal();
5858
GUILayout.BeginHorizontal();
5959
GUILayout.Label(" User MUST be currently signed into GitHub (with their default browser) to successfully install the unitypackage");

Source/Assets/PlayFabEditorExtensions/Editor/Scripts/PlayFabEditorSDK/PlayFabEditorHttp.cs

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@
55
using System.IO;
66
using PlayFab.PfEditor.Json;
77
using PlayFab.PfEditor.EditorModels;
8+
using UnityEngine.Networking;
89

910
namespace PlayFab.PfEditor
1011
{
1112
public class PlayFabEditorHttp : UnityEditor.Editor
1213
{
1314
internal static void MakeDownloadCall(string url, Action<string> resultCallback)
1415
{
16+
#if UNITY_2018_2_OR_NEWER
17+
UnityWebRequest www = UnityWebRequest.Get(url);
18+
PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnHttpReq, url, PlayFabEditorHelper.MSG_SPIN_BLOCK);
19+
EditorCoroutine.Start(PostDownload(www, (response) => { WriteResultFile(url, resultCallback, response); }, PlayFabEditorHelper.SharedErrorCallback), www);
20+
#else
1521
var www = new WWW(url);
1622
PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnHttpReq, url, PlayFabEditorHelper.MSG_SPIN_BLOCK);
1723
EditorCoroutine.Start(PostDownload(www, (response) => { WriteResultFile(url, resultCallback, response); }, PlayFabEditorHelper.SharedErrorCallback), www);
24+
#endif
1825
}
1926

2027
private static void WriteResultFile(string url, Action<string> resultCallback, byte[] response)
@@ -63,10 +70,34 @@ internal static void MakeApiCall<TRequestType, TResultType>(string api, string a
6370

6471
//Encode Payload
6572
var payload = System.Text.Encoding.UTF8.GetBytes(req.Trim());
73+
#if UNITY_2018_2_OR_NEWER
74+
var www = new UnityWebRequest(url)
75+
{
76+
uploadHandler = new UploadHandlerRaw(payload),
77+
downloadHandler = new DownloadHandlerBuffer(),
78+
method = "POST"
79+
};
80+
81+
foreach (var header in headers)
82+
{
83+
if (!string.IsNullOrEmpty(header.Key) && !string.IsNullOrEmpty(header.Value))
84+
{
85+
www.SetRequestHeader(header.Key, header.Value);
86+
}
87+
else
88+
{
89+
UnityEngine.Debug.LogWarning("Null header");
90+
}
91+
}
92+
93+
94+
PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnHttpReq, api, PlayFabEditorHelper.MSG_SPIN_BLOCK);
95+
EditorCoroutine.Start(Post(www, (response) => { OnWwwSuccess(api, resultCallback, errorCallback, response); }, (error) => { OnWwwError(errorCallback, error); }), www);
96+
#else
6697
var www = new WWW(url, payload, headers);
6798
PlayFabEditor.RaiseStateUpdate(PlayFabEditor.EdExStates.OnHttpReq, api, PlayFabEditorHelper.MSG_SPIN_BLOCK);
68-
6999
EditorCoroutine.Start(Post(www, (response) => { OnWwwSuccess(api, resultCallback, errorCallback, response); }, (error) => { OnWwwError(errorCallback, error); }), www);
100+
#endif
70101
}
71102

72103
private static void OnWwwSuccess<TResultType>(string api, Action<TResultType> resultCallback, Action<PlayFab.PfEditor.EditorModels.PlayFabError> errorCallback, string response) where TResultType : class
@@ -103,8 +134,13 @@ private static void OnWwwError(Action<PlayFab.PfEditor.EditorModels.PlayFabError
103134

104135
internal static void MakeGitHubApiCall(string url, Action<string> resultCallback)
105136
{
137+
#if UNITY_2018_2_OR_NEWER
138+
UnityWebRequest webReq = UnityWebRequest.Get(url);
139+
EditorCoroutine.Start(Post(webReq, (response) => { OnGitHubSuccess(resultCallback, response); }, PlayFabEditorHelper.SharedErrorCallback), webReq);
140+
#else
106141
var www = new WWW(url);
107142
EditorCoroutine.Start(Post(www, (response) => { OnGitHubSuccess(resultCallback, response); }, PlayFabEditorHelper.SharedErrorCallback), www);
143+
#endif
108144
}
109145

110146
private static void OnGitHubSuccess(Action<string> resultCallback, string response)
@@ -130,7 +166,43 @@ private static void OnGitHubSuccess(Action<string> resultCallback, string respon
130166
resultCallback(null);
131167
}
132168
}
169+
#if UNITY_2018_2_OR_NEWER
170+
private static IEnumerator Post(UnityWebRequest www, Action<string> callBack, Action<string> errorCallback)
171+
{
172+
if (www != null)
173+
{
174+
yield return www.SendWebRequest();
175+
176+
if (!string.IsNullOrEmpty(www.error))
177+
errorCallback(www.error);
178+
else
179+
callBack(www.downloadHandler.text);
180+
}
181+
else
182+
{
183+
UnityEngine.Debug.Log("UnityWebRequest was null");
184+
errorCallback("UnityWebRequest Object was null");
185+
}
186+
}
133187

188+
private static IEnumerator PostDownload(UnityWebRequest www, Action<byte[]> callBack, Action<string> errorCallback)
189+
{
190+
if (www != null)
191+
{
192+
yield return www.SendWebRequest();
193+
194+
if (!string.IsNullOrEmpty(www.error) || www.isHttpError)
195+
errorCallback(www.error);
196+
else
197+
callBack(www.downloadHandler.data);
198+
}
199+
else
200+
{
201+
UnityEngine.Debug.Log("UnityWebRequest was null");
202+
errorCallback("UnityWebRequest Object was null");
203+
}
204+
}
205+
#else
134206
private static IEnumerator Post(WWW www, Action<string> callBack, Action<string> errorCallback)
135207
{
136208
yield return www;
@@ -150,5 +222,6 @@ private static IEnumerator PostDownload(WWW www, Action<byte[]> callBack, Action
150222
else
151223
callBack(www.bytes);
152224
}
225+
#endif
153226
}
154227
}

Source/Assets/PlayFabEditorExtensions/Editor/Scripts/Utils/EditorCoroutine.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using UnityEditor;
55
using UnityEngine;
6+
using UnityEngine.Networking;
67

78
namespace PlayFab.PfEditor
89
{
@@ -30,6 +31,16 @@ public static EditorCoroutine Start(IEnumerator _routine)
3031
return coroutine;
3132
}
3233

34+
#if UNITY_2018_2_OR_NEWER
35+
public static EditorCoroutine Start(IEnumerator _routine, UnityWebRequest www)
36+
{
37+
var coroutine = new EditorCoroutine(_routine);
38+
coroutine.Id = Guid.NewGuid().ToString();
39+
coroutine._www = www;
40+
coroutine.Start();
41+
return coroutine;
42+
}
43+
#else
3344
public static EditorCoroutine Start(IEnumerator _routine, WWW www)
3445
{
3546
var coroutine = new EditorCoroutine(_routine);
@@ -38,10 +49,18 @@ public static EditorCoroutine Start(IEnumerator _routine, WWW www)
3849
coroutine.Start();
3950
return coroutine;
4051
}
52+
#endif
4153

4254

4355
readonly IEnumerator routine;
56+
57+
58+
#if UNITY_2018_2_OR_NEWER
59+
private UnityWebRequest _www;
60+
private bool _sent = false;
61+
#else
4462
private WWW _www;
63+
#endif
4564

4665
EditorCoroutine(IEnumerator _routine)
4766
{
@@ -67,7 +86,19 @@ void Update()
6786
{
6887
if (_www != null)
6988
{
70-
if (_www.isDone && !routine.MoveNext())
89+
if (!_sent)
90+
{
91+
try
92+
{
93+
routine.MoveNext();
94+
_sent = true;
95+
}
96+
catch (ArgumentNullException)
97+
{
98+
}
99+
}
100+
101+
if (routine.Current != null && _www.isDone && !routine.MoveNext())
71102
{
72103
Stop();
73104
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
namespace PlayFab.PfEditor { public static partial class PlayFabEditorHelper { public static string EDEX_VERSION = "2.58.181218"; } }
1+
namespace PlayFab.PfEditor { public static partial class PlayFabEditorHelper { public static string EDEX_VERSION = "2.63.190312"; } }

Source/Packages/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"com.unity.package-manager-ui": "1.9.11",
3+
"com.unity.package-manager-ui": "2.0.3",
44
"com.unity.modules.assetbundle": "1.0.0",
55
"com.unity.modules.ui": "1.0.0",
66
"com.unity.modules.uielements": "1.0.0",

0 commit comments

Comments
 (0)