From b2d9cd82b12826699758eac33d9385f7c27b7005 Mon Sep 17 00:00:00 2001 From: David Douglas Date: Wed, 1 Nov 2017 10:09:45 -0700 Subject: [PATCH] Dependencies and Submodules (#41) :octocat: submodules --- .gitmodules | 6 + .vscode/settings.json | 56 +++ Assets/AppServices/LICENSE | 22 -- Assets/AppServices/README.md | 108 ----- .../MobileServiceAuthenticationProvider.cs | 11 - .../client/IAzureMobileServiceClient.cs | 36 -- .../AppServices/client/MobileServiceClient.cs | 127 ------ Assets/AppServices/helpers/DataHelper.cs | 20 - Assets/AppServices/helpers/JsonHelper.cs | 107 ----- Assets/AppServices/helpers/Model.cs | 38 -- Assets/AppServices/http/IRestResponse.cs | 21 - Assets/AppServices/http/Method.cs | 13 - Assets/AppServices/http/RestRequest.cs | 172 -------- Assets/AppServices/http/RestResponse.cs | 88 ----- Assets/AppServices/http/ZumoRequest.cs | 33 -- Assets/AppServices/model/AccessToken.cs | 21 - Assets/AppServices/model/MobileServiceUser.cs | 11 - Assets/AppServices/model/ResponseError.cs | 10 - Assets/AppServices/model/User.cs | 10 - Assets/AppServices/model/base/DataModel.cs | 81 ---- Assets/AppServices/model/base/IDataModel.cs | 7 - .../model/nested/INestedResults.cs | 20 - .../AppServices/model/nested/NestedResults.cs | 35 -- .../table/IAzureMobileServiceTable.cs | 45 --- .../AppServices/table/MobileServiceTable.cs | 121 ------ Assets/AppServices/table/query/CustomQuery.cs | 110 ------ Assets/Dependencies/AppServices | 1 + Assets/Dependencies/RESTClient | 1 + .../TSTableView/ITableViewDataSource.cs | 0 .../TSTableView/ITableViewDataSource.cs.meta | 0 Assets/{ => Dependencies}/TSTableView/LICENSE | 0 .../TSTableView/LICENSE.meta | 0 .../{ => Dependencies}/TSTableView/README.md | 0 .../TSTableView/README.md.meta | 0 .../TSTableView/TableView.cs | 0 .../TSTableView/TableView.cs.meta | 0 .../TSTableView/TableViewCell.cs | 0 .../TSTableView/TableViewCell.cs.meta | 0 Assets/Scenes/HighscoresDemo.unity | 373 +++--------------- Assets/Scenes/InventoryDemo.unity | 365 ++--------------- Assets/Scripts/DataModels/Highscore.cs | 2 +- Assets/Scripts/DataModels/Inventory.cs | 2 +- Assets/Scripts/HighscoresDemo.cs | 76 ++-- Assets/Scripts/InventoryDemo.cs | 61 +-- ProjectSettings/ProjectSettings.asset | 188 +++++++-- ProjectSettings/ProjectVersion.txt | 2 +- README.md | 14 +- 47 files changed, 412 insertions(+), 2002 deletions(-) create mode 100644 .gitmodules create mode 100644 .vscode/settings.json delete mode 100644 Assets/AppServices/LICENSE delete mode 100644 Assets/AppServices/README.md delete mode 100644 Assets/AppServices/authentication/MobileServiceAuthenticationProvider.cs delete mode 100644 Assets/AppServices/client/IAzureMobileServiceClient.cs delete mode 100644 Assets/AppServices/client/MobileServiceClient.cs delete mode 100644 Assets/AppServices/helpers/DataHelper.cs delete mode 100644 Assets/AppServices/helpers/JsonHelper.cs delete mode 100644 Assets/AppServices/helpers/Model.cs delete mode 100644 Assets/AppServices/http/IRestResponse.cs delete mode 100644 Assets/AppServices/http/Method.cs delete mode 100644 Assets/AppServices/http/RestRequest.cs delete mode 100644 Assets/AppServices/http/RestResponse.cs delete mode 100644 Assets/AppServices/http/ZumoRequest.cs delete mode 100644 Assets/AppServices/model/AccessToken.cs delete mode 100644 Assets/AppServices/model/MobileServiceUser.cs delete mode 100644 Assets/AppServices/model/ResponseError.cs delete mode 100644 Assets/AppServices/model/User.cs delete mode 100644 Assets/AppServices/model/base/DataModel.cs delete mode 100644 Assets/AppServices/model/base/IDataModel.cs delete mode 100644 Assets/AppServices/model/nested/INestedResults.cs delete mode 100644 Assets/AppServices/model/nested/NestedResults.cs delete mode 100644 Assets/AppServices/table/IAzureMobileServiceTable.cs delete mode 100644 Assets/AppServices/table/MobileServiceTable.cs delete mode 100644 Assets/AppServices/table/query/CustomQuery.cs create mode 160000 Assets/Dependencies/AppServices create mode 160000 Assets/Dependencies/RESTClient rename Assets/{ => Dependencies}/TSTableView/ITableViewDataSource.cs (100%) rename Assets/{ => Dependencies}/TSTableView/ITableViewDataSource.cs.meta (100%) rename Assets/{ => Dependencies}/TSTableView/LICENSE (100%) rename Assets/{ => Dependencies}/TSTableView/LICENSE.meta (100%) rename Assets/{ => Dependencies}/TSTableView/README.md (100%) rename Assets/{ => Dependencies}/TSTableView/README.md.meta (100%) rename Assets/{ => Dependencies}/TSTableView/TableView.cs (100%) rename Assets/{ => Dependencies}/TSTableView/TableView.cs.meta (100%) rename Assets/{ => Dependencies}/TSTableView/TableViewCell.cs (100%) rename Assets/{ => Dependencies}/TSTableView/TableViewCell.cs.meta (100%) diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fd6f607 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "Assets/Dependencies/AppServices"] + path = Assets/Dependencies/AppServices + url = https://github.com/Unity3dAzure/AppServices +[submodule "Assets/Dependencies/RESTClient"] + path = Assets/Dependencies/RESTClient + url = https://github.com/Unity3dAzure/RESTClient diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4edd970 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,56 @@ +{ + "files.exclude": + { + "**/.DS_Store":true, + "**/.git":true, + "**/.gitignore":true, + "**/.gitmodules":true, + "**/*.booproj":true, + "**/*.pidb":true, + "**/*.suo":true, + "**/*.user":true, + "**/*.userprefs":true, + "**/*.unityproj":true, + "**/*.dll":true, + "**/*.exe":true, + "**/*.pdf":true, + "**/*.mid":true, + "**/*.midi":true, + "**/*.wav":true, + "**/*.gif":true, + "**/*.ico":true, + "**/*.jpg":true, + "**/*.jpeg":true, + "**/*.png":true, + "**/*.psd":true, + "**/*.tga":true, + "**/*.tif":true, + "**/*.tiff":true, + "**/*.3ds":true, + "**/*.3DS":true, + "**/*.fbx":true, + "**/*.FBX":true, + "**/*.lxo":true, + "**/*.LXO":true, + "**/*.ma":true, + "**/*.MA":true, + "**/*.obj":true, + "**/*.OBJ":true, + "**/*.asset":true, + "**/*.cubemap":true, + "**/*.flare":true, + "**/*.mat":true, + "**/*.meta":true, + "**/*.prefab":true, + "**/*.unity":true, + "build/":true, + "Build/":true, + "Library/":true, + "library/":true, + "obj/":true, + "Obj/":true, + "ProjectSettings/":true, + "temp/":true, + "Temp/":true + } +} \ No newline at end of file diff --git a/Assets/AppServices/LICENSE b/Assets/AppServices/LICENSE deleted file mode 100644 index 5530bd4..0000000 --- a/Assets/AppServices/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Unity3dAzure - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/Assets/AppServices/README.md b/Assets/AppServices/README.md deleted file mode 100644 index 387b2ef..0000000 --- a/Assets/AppServices/README.md +++ /dev/null @@ -1,108 +0,0 @@ -# Azure App Services for Unity3d -For game developers looking to use Azure App Services (previously Mobile Services) in their Unity project. This App Services REST API library for Unity is quite similar in structure to the Azure Mobile Services SDK so if you've used that before you should feel relatively at home. - -## Prerequisites -Requires Unity v5.3 or greater as [UnityWebRequest](https://docs.unity3d.com/Manual/UnityWebRequest.html) and [JsonUtility](https://docs.unity3d.com/ScriptReference/JsonUtility.html) features are used. Unity will be extending platform support for UnityWebRequest so keep Unity up to date if you need to support these additional platforms. - -## How to setup App Services with a new Unity project -1. [Download AppServices](https://github.com/Unity3dAzure/AppServices/archive/master.zip) - * Copy 'AppServices' into project `Assets` folder. -2. Create an Azure App Service [Mobile App](https://portal.azure.com) - * Create a Table (using Easy Tables) for app data. - -## Azure App Services Demos for Unity 5 -Try the [Azure App Services Demos](https://github.com/Unity3dAzure/AppServicesDemo) project for Unity v5.4.x on Mac / Windows. (The demo project has got everything already bundled in and does not require any additional assets to work. Just wire it up with your [Azure App Service](https://portal.azure.com) and run it right inside the Unity Editor.) -For detailed instructions read my developer blog on [how to setup Azure App Services and Unity demo project](http://www.deadlyfingers.net/azure/azure-app-services-for-unity3d/). - -## Supported Features -### MobileServiceClient -API | Description ---- | ----------- -Login | Client-directed login using access token. -InvokeApi | Invoke custom API (Easy API) using GET, POST, PUT, PATCH or DELETE - -### MobileServiceTable -API | Description ---- | ----------- -Insert | Create a new item. -Read | Get a list of items. -Update | Update an item’s data using id property. -Delete | Delete an item using id property. -Query | Get a list of results using a custom query. -Lookup | Get an item’s data using id property. - -### [MobileServiceClient Interface](https://github.com/Unity3dAzure/AppServices/blob/master/client/IAzureMobileServiceClient.cs) - Login(MobileServiceAuthenticationProvider provider, string token, Action> callback = null); - InvokeApi(string apiName, Action> callback = null) where T : new(); - InvokeApi(string apiName, Method httpMethod, Action> callback = null) where T : new(); - InvokeApi(string apiName, Method httpMethod, T body, Action> callback = null) where T : new(); - -### [MobileServiceTable Interface](https://github.com/Unity3dAzure/AppServices/blob/master/table/IAzureMobileServiceTable.cs) - Insert(T item, Action> callback = null) where T : new(); - Read(Action> callback = null) where T : new(); - Update(T item, Action> callback = null) where T : new(); - Delete(string id, Action> callback = null) where T : new(); - Query(CustomQuery query, Action> callback = null) where T : new(); - Query(CustomQuery query, Action> callback = null) where T : INestedResults, new(); - Lookup(string id, Action> callback = null) where T : new(); - -## Sample usage -``` -using UnityEngine; -using System; -using System.Net; -using System.Collections.Generic; -using Unity3dAzure.AppServices; - -``` - -``` -private MobileServiceClient _client; -private MobileServiceTable _table; -``` - -``` -void Start () { - _client = new MobileServiceClient(appUrl); // <- add your app url here. - _table = _client.GetTable("TodoItem"); -} -``` -``` -private void ReadItems() { - StartCoroutine( _table.Read(OnReadItemsCompleted) ); -} - -private void OnReadItemsCompleted(IRestResponse response) { - if (!response.IsError) { - Debug.Log ("OnReadCompleted: " + response.Url + " data: " + response.Content); - TodoItem[] items = response.Data; - Debug.Log ( "Todo items count: " + items.Count); - } else { - Debug.LogWarning ("Read Error Status:" + response.StatusCode + " Url: " + response.Url); - } -} -``` - -## Known issues -* There is an issue with [PATCH on Android using UnityWebRequest with Azure App Services](http://answers.unity3d.com/questions/1230067/trying-to-use-patch-on-a-unitywebrequest-on-androi.html). Android won't recognize the "PATCH" http method currently required to update an item in App Services. One workaround is to enable the `X-HTTP-Method-Override` header. Here's the quick fix for App Services running node backend: - 1. Install the "method-override" package. - ``` - npm install method-override --save - ``` - 2. In 'app.js' file insert: - ``` - var methodOverride = require('method-override'); - // after the line "var app = express();" add - app.use(methodOverride('X-HTTP-Method-Override')); - ``` - -This will enable PATCH requests to be sent on Android. - -## Supported platforms -Will work on all the platforms [UnityWebRequest](https://docs.unity3d.com/Manual/UnityWebRequest.html) supports including: -* Unity Editor and Standalone players -* iOS -* Android -* Windows - -Questions or tweet #Azure #GameDev [@deadlyfingers](https://twitter.com/deadlyfingers) diff --git a/Assets/AppServices/authentication/MobileServiceAuthenticationProvider.cs b/Assets/AppServices/authentication/MobileServiceAuthenticationProvider.cs deleted file mode 100644 index ede255a..0000000 --- a/Assets/AppServices/authentication/MobileServiceAuthenticationProvider.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Unity3dAzure.AppServices -{ - public enum MobileServiceAuthenticationProvider - { - MicrosoftAccount = 0, - Google = 1, - Twitter = 2, - Facebook = 3, - WindowsAzureActiveDirectory = 4 - } -} \ No newline at end of file diff --git a/Assets/AppServices/client/IAzureMobileServiceClient.cs b/Assets/AppServices/client/IAzureMobileServiceClient.cs deleted file mode 100644 index 6d0de2b..0000000 --- a/Assets/AppServices/client/IAzureMobileServiceClient.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections; - -namespace Unity3dAzure.AppServices -{ - public interface IAzureMobileServiceClient - { - MobileServiceTable GetTable (string tableName) where E : class; - - /// - /// Client-directed login (sdk) for single sign on - /// https://msdn.microsoft.com/en-us/library/azure/jj710106.aspx - /// - IEnumerator Login (MobileServiceAuthenticationProvider provider, string token, Action> callback = null); - - /// - /// TODO: Service-directed login (webview) - /// - //void Login(MobileServiceAuthenticationProvider provider); - - /// - /// Invokes a custom API using GET HTTP method - /// - IEnumerator InvokeApi (string apiName, Action> callback = null) where T : new(); - - /// - /// Invokes a custom API for HTTP Methods: GET, POST, PUT, PATCH, DELETE - /// - IEnumerator InvokeApi (string apiName, Method httpMethod, Action> callback = null) where T : new(); - - /// - /// Invokes a custom API with body object - /// - IEnumerator InvokeApi (string apiName, Method httpMethod, T body, Action> callback = null) where T : new(); - } -} \ No newline at end of file diff --git a/Assets/AppServices/client/MobileServiceClient.cs b/Assets/AppServices/client/MobileServiceClient.cs deleted file mode 100644 index 7bdf401..0000000 --- a/Assets/AppServices/client/MobileServiceClient.cs +++ /dev/null @@ -1,127 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; -using System.Text.RegularExpressions; - - -#if !NETFX_CORE || UNITY_ANDROID -using System.Net; -using System.Security.Cryptography.X509Certificates; -using System.Net.Security; -#endif - -namespace Unity3dAzure.AppServices -{ - public class MobileServiceClient : IAzureMobileServiceClient - { - public string AppUrl { get; private set; } - - public MobileServiceUser User { get; set; } - - public const string URI_API = "api/"; - - /// - /// Creates a new RestClient using Azure App Service's Application Url - /// - public MobileServiceClient (string appUrl) - { - AppUrl = HttpsUri (appUrl); - Debug.Log ("App Url: " + AppUrl); - - // required for running in Windows and Android - #if !NETFX_CORE || UNITY_ANDROID - Debug.Log ("ServerCertificateValidation"); - ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCallback; - #endif - } - - public override string ToString () - { - return this.AppUrl; - } - - public MobileServiceTable GetTable (string tableName) where E : class - { - return new MobileServiceTable (tableName, this); - } - - /// - /// Client-directed single sign on (POST with access token) - /// - public IEnumerator Login (MobileServiceAuthenticationProvider provider, string token, Action> callback = null) - { - string p = provider.ToString ().ToLower (); - string url = string.Format ("{0}/.auth/login/{1}", AppUrl, p); - Debug.Log ("Login Request Url: " + url + " access token: " + token); - ZumoRequest request = new ZumoRequest (this, url, Method.POST); - request.AddBodyAccessToken (token); - yield return request.request.Send (); - request.ParseJson (callback); - } - - /// - /// TODO: Service login (using GET via webview) - /// - /* - public void Login(MobileServiceAuthenticationProvider provider) - { - Debug.Log("TODO"); - } - //*/ - - /// - /// GET custom API - /// - public IEnumerator InvokeApi (string apiName, Action> callback = null) where T : new() - { - return InvokeApi (apiName, Method.GET, callback); - } - - /// - /// Invokes custom API for HTTP Methods: GET, POST, PUT, PATCH, DELETE - /// - public IEnumerator InvokeApi (string apiName, Method httpMethod, Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}", AppUrl, URI_API, apiName); - Debug.Log (httpMethod.ToString () + " custom API Request Url: " + url); - ZumoRequest request = new ZumoRequest (this, url, httpMethod); - yield return request.request.Send (); - request.ParseJson (callback); - } - - /// - /// Invokes custom API with body - /// - public IEnumerator InvokeApi (string apiName, Method httpMethod, T body, Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}", AppUrl, URI_API, apiName); - Debug.Log (httpMethod.ToString () + " custom API Request Url: " + url); - ZumoRequest request = new ZumoRequest (this, url, httpMethod); - request.AddBody (body); - yield return request.request.Send (); - request.ParseJson (callback); - } - - /// - /// When you copy the URL from the Azure Portal it is 'http' by default, but it needs to be 'https' for post - /// - private static string HttpsUri (string appUrl) - { - return Regex.Replace (appUrl, "(?si)^http://", "https://").TrimEnd ('/'); - } - - #if !NETFX_CORE || UNITY_ANDROID - private bool RemoteCertificateValidationCallback (System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) - { - // Check the certificate to see if it was issued from Azure - if (certificate.Subject.Contains ("azurewebsites.net")) { - return true; - } else { - return false; - } - } - #endif - - } -} diff --git a/Assets/AppServices/helpers/DataHelper.cs b/Assets/AppServices/helpers/DataHelper.cs deleted file mode 100644 index d546cc6..0000000 --- a/Assets/AppServices/helpers/DataHelper.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Text; - -namespace Unity3dAzure.AppServices -{ - public class DataHelper - { - - public static byte[] ToUTF8Bytes (string utf8String) - { - return Encoding.UTF8.GetBytes (utf8String); - } - - public static string ToUTF8String (byte[] bytes) - { - return Encoding.UTF8.GetString (bytes); - } - - } -} \ No newline at end of file diff --git a/Assets/AppServices/helpers/JsonHelper.cs b/Assets/AppServices/helpers/JsonHelper.cs deleted file mode 100644 index 4f3d564..0000000 --- a/Assets/AppServices/helpers/JsonHelper.cs +++ /dev/null @@ -1,107 +0,0 @@ -#pragma warning disable 0649 // ignores warning: array "is never assigned to, and will always have its default value 'null'" -using UnityEngine; -using System; -using System.Text.RegularExpressions; -#if NETFX_CORE -using Windows.Data.Json; -using System.Collections.Generic; -using System.Linq; -#endif - -namespace Unity3dAzure.AppServices -{ - /// - /// Wrapper work-around for json array described on https://forum.unity3d.com/threads/how-to-load-an-array-with-jsonutility.375735/ - /// - [Serializable] - internal class Wrapper - { - public T[] array; - } - - public class JsonHelper - { - /// - /// Work-around to parse json array - /// - public static T[] FromJsonArray(string json) - { - // Work-around for JsonUtility array serialization issues in Windows Store Apps. -#if NETFX_CORE - JsonArray jsonArray = new JsonArray(); - if (JsonArray.TryParse(json, out jsonArray)) - { - return GetArray(jsonArray); - } - Debug.LogWarning("Failed to parse json array of type:" + typeof(T).ToString() ); - return default(T[]); -#endif - string newJson = "{\"array\":" + json + "}"; - Wrapper wrapper = new Wrapper(); - try - { - wrapper = JsonUtility.FromJson>(newJson); - } - catch (Exception e) - { - Debug.LogWarning("Failed to parse json array of type:" + typeof(T).ToString() + " Exception message: " + e.Message); - return default(T[]); - } - return wrapper.array; - } - - public static N FromJsonNestedArray(string json, string namedArray) where N : INestedResults, new() - { -#if NETFX_CORE - JsonObject jsonObject = new JsonObject(); - if (JsonObject.TryParse(json, out jsonObject)) - { - JsonArray jsonArray = jsonObject.GetNamedArray(namedArray); - T[] array = GetArray(jsonArray); - N nestedResults = new N(); //NestedResults nestedResults = new NestedResults(array); - nestedResults.SetArray(array); - - string namedCount = nestedResults.GetCountField(); - uint count = Convert.ToUInt32( jsonObject.GetNamedNumber(namedCount) ); - nestedResults.SetCount(count); - - return nestedResults; - } else { - Debug.LogWarning("Failed to parse json nested array of type:" + typeof(T).ToString()); - return default(N); - } -#endif - N results = JsonUtility.FromJson(json); // NestedResults nestedResults = JsonUtility.FromJson(json); - return results; - } - -#if NETFX_CORE - private static T[] GetArray(JsonArray array) - { - List list = new List(); - foreach (var x in array) - { - try - { - T item = JsonUtility.FromJson(x.ToString()); - list.Add(item); - } - catch (Exception e) - { - Debug.LogWarning("Failed to parse json of type:" + typeof(T).ToString() + " Exception message: " + e.Message + " json:'" + x.ToString() + "'"); - } - } - return list.ToArray(); - } -#endif - - /// - /// Workaround to only exclude Data Model's read only system properties being returned as json object. Unfortunately there is no JsonUtil attribute to do this as [NonSerialized] will just ignore the properties completely (both in and out). - /// - public static string ToJsonExcludingSystemProperties(object obj) - { - string jsonString = JsonUtility.ToJson(obj); - return Regex.Replace(jsonString, "(?i)(\\\"id\\\":\\\"\\\",)?(\\\"createdAt\\\":\\\"[0-9TZ:.-]*\\\",)?(\\\"updatedAt\\\":\\\"[0-9TZ:.-]*\\\",)?(\\\"version\\\":\\\"[A-Z0-9=]*\\\",)?(\\\"deleted\\\":(true|false),)?(\\\"ROW_NUMBER\\\":\\\"[0-9]*\\\",)?", ""); - } - } -} \ No newline at end of file diff --git a/Assets/AppServices/helpers/Model.cs b/Assets/AppServices/helpers/Model.cs deleted file mode 100644 index eef4235..0000000 --- a/Assets/AppServices/helpers/Model.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Reflection; - -namespace Unity3dAzure.AppServices -{ - /// - /// Helper methods to check and get object properties - /// - public class Model - { - public static bool HasProperty (object obj, string propertyName) - { - return GetProperty (obj, propertyName) != null; - } - - public static PropertyInfo GetProperty (object obj, string propertyName) - { - #if NETFX_CORE - return obj.GetType().GetTypeInfo().GetDeclaredProperty(propertyName); // GetProperty for UWP - #else - return obj.GetType ().GetProperty (propertyName); - #endif - } - - public static bool HasField (object obj, string fieldName) - { - return GetField (obj, fieldName) != null; - } - - public static FieldInfo GetField (object obj, string fieldName) - { - #if NETFX_CORE - return obj.GetType().GetTypeInfo().GetDeclaredField(fieldName); // GetField for UWP - #else - return obj.GetType ().GetField (fieldName); - #endif - } - } -} \ No newline at end of file diff --git a/Assets/AppServices/http/IRestResponse.cs b/Assets/AppServices/http/IRestResponse.cs deleted file mode 100644 index d7da69d..0000000 --- a/Assets/AppServices/http/IRestResponse.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Net; - -namespace Unity3dAzure.AppServices -{ - public interface IRestResponse - { - bool IsError { get; } - - string ErrorMessage { get; } - - string Url { get; } - - HttpStatusCode StatusCode { get; } - - string Content { get; } - - T Data { get; } - } -} - diff --git a/Assets/AppServices/http/Method.cs b/Assets/AppServices/http/Method.cs deleted file mode 100644 index b2d5e6f..0000000 --- a/Assets/AppServices/http/Method.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Unity3dAzure.AppServices -{ - public enum Method - { - GET, - POST, - PATCH, - DELETE - } -} \ No newline at end of file diff --git a/Assets/AppServices/http/RestRequest.cs b/Assets/AppServices/http/RestRequest.cs deleted file mode 100644 index c7af339..0000000 --- a/Assets/AppServices/http/RestRequest.cs +++ /dev/null @@ -1,172 +0,0 @@ -using UnityEngine; -using UnityEngine.Networking; -using System; -using System.Net; - -namespace Unity3dAzure.AppServices -{ - public abstract class RestRequest : IDisposable - { - public UnityWebRequest request { get; private set; } - - public RestRequest (string url, Method method) - { - request = new UnityWebRequest (url, method.ToString ()); - request.downloadHandler = new DownloadHandlerBuffer (); - } - - public void AddHeader (string key, string value) - { - request.SetRequestHeader (key, value); - } - - public void AddBody (byte[] bytes, string contentType) - { - if (request.uploadHandler != null) { - Debug.LogWarning ("Request body can only be set once"); - return; - } - request.uploadHandler = new UploadHandlerRaw (bytes); - request.uploadHandler.contentType = contentType; - } - - public virtual void AddBody (T data, string contentType = "application/json; charset=utf-8") - { - string jsonString = JsonUtility.ToJson (data); - byte[] bytes = DataHelper.ToUTF8Bytes (jsonString); - this.AddBody (bytes, contentType); - } - - #region Response and json object parsing - - private RestResult GetRestResult() - { - HttpStatusCode statusCode = (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), request.responseCode.ToString()); - RestResult result = new RestResult(statusCode); - - if (result.IsError) - { - result.ErrorMessage = "Response failed with status: " + statusCode.ToString(); - return result; - } - - if (string.IsNullOrEmpty(request.downloadHandler.text)) - { - result.IsError = true; - result.ErrorMessage = "Response has empty body"; - return result; - } - - return result; - } - - /// - /// Shared method to return response result whether an object or array of objects - /// - private RestResult TryParseJsonArray () - { - RestResult result = GetRestResult(); - // try parse an array of objects - try - { - result.AnArrayOfObjects = JsonHelper.FromJsonArray(request.downloadHandler.text); - } - catch (Exception e) - { - result.IsError = true; - result.ErrorMessage = "Failed to parse an array of objects of type: " + typeof(T).ToString() + " Exception message: " + e.Message; - } - return result; - } - - private RestResult TryParseJson() - { - RestResult result = GetRestResult(); - // try parse an object - try - { - result.AnObject = JsonUtility.FromJson(request.downloadHandler.text); - } - catch (Exception e) - { - result.IsError = true; - result.ErrorMessage = "Failed to parse object of type: " + typeof(T).ToString() + " Exception message: " + e.Message; - } - return result; - } - - /// - /// Parses object with T data = JsonUtil.FromJson, then callback RestResponse - /// - public void ParseJson (Action> callback = null) - { - RestResult result = TryParseJson (); - - if (result.IsError) { - Debug.LogWarning ("Response error status:" + result.StatusCode + " code:" + request.responseCode + " error:" + result.ErrorMessage + " request url:" + request.url); - callback (new RestResponse (result.ErrorMessage, result.StatusCode, request.url, request.downloadHandler.text)); - } else { - callback (new RestResponse (result.StatusCode, request.url, request.downloadHandler.text, result.AnObject)); - } - this.Dispose(); - } - - /// - /// Parses array of objects with T[] data = JsonHelper.GetJsonArray, then callback RestResponse - /// - public void ParseJsonArray (Action> callback = null) - { - RestResult result = TryParseJsonArray (); - - if (result.IsError) { - Debug.LogWarning ("Response error status:" + result.StatusCode + " code:" + request.responseCode + " error:" + result.ErrorMessage + " request url:" + request.url); - callback (new RestResponse (result.ErrorMessage, result.StatusCode, request.url, request.downloadHandler.text)); - } else { - callback (new RestResponse (result.StatusCode, request.url, request.downloadHandler.text, result.AnArrayOfObjects)); - } - this.Dispose(); - } - - // *WSA - private RestResult TryParseJsonNestedArray(string namedArray) where N : INestedResults, new() - { - RestResult result = GetRestResult(); - // try parse an object - try - { - result.AnObject = JsonHelper.FromJsonNestedArray(request.downloadHandler.text, namedArray); //JsonUtility.FromJson(request.downloadHandler.text); - } - catch (Exception e) - { - result.IsError = true; - result.ErrorMessage = "Failed to parse object of type: " + typeof(N).ToString() + " Exception message: " + e.Message; - } - return result; - } - - // Work-around for nested array - public void ParseJsonNestedArray(string namedArray, Action> callback = null) where N : INestedResults, new() - { - RestResult result = TryParseJsonNestedArray(namedArray); - - if (result.IsError) - { - Debug.LogWarning("Response error status:" + result.StatusCode + " code:" + request.responseCode + " error:" + result.ErrorMessage + " request url:" + request.url); - callback(new RestResponse(result.ErrorMessage, result.StatusCode, request.url, request.downloadHandler.text)); - } - else - { - callback(new RestResponse(result.StatusCode, request.url, request.downloadHandler.text, result.AnObject)); - } - this.Dispose(); - } - - public void Dispose() - { - request.Dispose(); // request completed, clean-up resources - } - - #endregion - - } -} diff --git a/Assets/AppServices/http/RestResponse.cs b/Assets/AppServices/http/RestResponse.cs deleted file mode 100644 index 989532b..0000000 --- a/Assets/AppServices/http/RestResponse.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System.Net; - -namespace Unity3dAzure.AppServices -{ - public abstract class Response - { - public bool IsError { get; set; } - - public string ErrorMessage { get; set; } - - public string Url { get; set; } - - public HttpStatusCode StatusCode { get; set; } - - public string Content { get; set; } - - protected Response (HttpStatusCode statusCode) - { - this.StatusCode = statusCode; - this.IsError = !((int)statusCode >= 200 && (int)statusCode < 300); - } - - // success - protected Response (HttpStatusCode statusCode, string url, string text) - { - this.IsError = false; - this.Url = url; - this.ErrorMessage = null; - this.StatusCode = statusCode; - this.Content = text; - } - - // failure - protected Response (string error, HttpStatusCode statusCode, string url, string text) - { - this.IsError = true; - this.Url = url; - this.ErrorMessage = error; - this.StatusCode = statusCode; - this.Content = text; - } - } - - public sealed class RestResponse : Response - { - // success - public RestResponse (HttpStatusCode statusCode, string url, string text) : base (statusCode, url, text) - { - } - - // failure - public RestResponse (string error, HttpStatusCode statusCode, string url, string text) : base (error, statusCode, url, text) - { - } - } - - public sealed class RestResponse : Response, IRestResponse - { - public T Data { get; set; } - - // success - public RestResponse (HttpStatusCode statusCode, string url, string text, T data) : base (statusCode, url, text) - { - this.Data = data; - } - - // failure - public RestResponse (string error, HttpStatusCode statusCode, string url, string text) : base (error, statusCode, url, text) - { - } - } - - /// - /// Parsed JSON result could either be an object or an array of objects - /// - internal sealed class RestResult : Response - { - public T AnObject { get; set; } - - public T[] AnArrayOfObjects { get; set; } - - public RestResult (HttpStatusCode statusCode) : base (statusCode) - { - } - } - -} - diff --git a/Assets/AppServices/http/ZumoRequest.cs b/Assets/AppServices/http/ZumoRequest.cs deleted file mode 100644 index 6409817..0000000 --- a/Assets/AppServices/http/ZumoRequest.cs +++ /dev/null @@ -1,33 +0,0 @@ -using UnityEngine; - -namespace Unity3dAzure.AppServices -{ - public sealed class ZumoRequest : RestRequest - { - public ZumoRequest (MobileServiceClient client, string url, Method httpMethod) : base (url, httpMethod) - { - this.AddHeader ("ZUMO-API-VERSION", "2.0.0"); - this.AddHeader ("Accept", "application/json"); - this.AddHeader ("Content-Type", "application/json; charset=utf-8"); - - if (client.User != null && !string.IsNullOrEmpty (client.User.authenticationToken)) { - this.AddHeader ("X-ZUMO-AUTH", client.User.authenticationToken); - Debug.Log ("Auth UserId:" + client.User.user.userId); - } - } - - public void AddBodyAccessToken (string token) - { - AccessToken accessToken = new AccessToken (token); - this.AddBody (accessToken); - } - - public override void AddBody (T data, string contentType = "application/json; charset=utf-8") - { - string jsonString = JsonHelper.ToJsonExcludingSystemProperties (data); // strip App Services System Properties - byte[] bytes = DataHelper.ToUTF8Bytes (jsonString); - this.AddBody (bytes, contentType); - } - - } -} diff --git a/Assets/AppServices/model/AccessToken.cs b/Assets/AppServices/model/AccessToken.cs deleted file mode 100644 index 411e5d6..0000000 --- a/Assets/AppServices/model/AccessToken.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Unity3dAzure.AppServices -{ - [Serializable] - public class AccessToken - { - public string access_token; - - /// - /// Facebook, Google, AAD access_token request - /// - public AccessToken (string accessTokenValue) - { - access_token = accessTokenValue; - } - - // Must have a public parameterless contructor in order to use it as paramter 'T' in the generic type or method RestRequest.AddBody - //public AccessToken() {} - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/MobileServiceUser.cs b/Assets/AppServices/model/MobileServiceUser.cs deleted file mode 100644 index a473009..0000000 --- a/Assets/AppServices/model/MobileServiceUser.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Unity3dAzure.AppServices -{ - [Serializable] - public class MobileServiceUser - { - public string authenticationToken; - public User user; - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/ResponseError.cs b/Assets/AppServices/model/ResponseError.cs deleted file mode 100644 index f0ba15b..0000000 --- a/Assets/AppServices/model/ResponseError.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Unity3dAzure.AppServices -{ - [Serializable] - public class ResponseError - { - public string error; - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/User.cs b/Assets/AppServices/model/User.cs deleted file mode 100644 index 479c714..0000000 --- a/Assets/AppServices/model/User.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Unity3dAzure.AppServices -{ - [Serializable] - public class User - { - public string userId; - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/base/DataModel.cs b/Assets/AppServices/model/base/DataModel.cs deleted file mode 100644 index 7f9b82e..0000000 --- a/Assets/AppServices/model/base/DataModel.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using UnityEngine; - -namespace Unity3dAzure.AppServices -{ - [Serializable] - public class DataModel : IDataModel - { - [SerializeField] - public string id; - - public string GetId () - { - return id; - } - - public void SetId (string id) - { - this.id = id; - } - - // System Properties (read only) - [SerializeField] - private string createdAt; - private DateTime? _createdAt; - - public DateTime? CreatedAt () - { - if (_createdAt == null) { - _createdAt = Convert.ToDateTime (createdAt); - } - return _createdAt; - } - - [SerializeField] - private string updatedAt; - private DateTime? _updatedAt; - - public DateTime? UpdatedAt () - { - if (_updatedAt == null) { - _updatedAt = Convert.ToDateTime (updatedAt); - } - return _updatedAt; - } - - [SerializeField] - private string version; - - public string Version () - { - return version; - } - - [SerializeField] - private bool deleted; - - public bool Deleted () - { - return deleted; - } - - [SerializeField] - private string ROW_NUMBER; - - public uint RowNumber () - { - return Convert.ToUInt32 (ROW_NUMBER, 10); - } - - public override string ToString () - { - return JsonUtility.ToJson (this); - } - - public string ToJSON () - { - return JsonHelper.ToJsonExcludingSystemProperties (this); - } - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/base/IDataModel.cs b/Assets/AppServices/model/base/IDataModel.cs deleted file mode 100644 index dbd9c02..0000000 --- a/Assets/AppServices/model/base/IDataModel.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Unity3dAzure.AppServices -{ - public interface IDataModel - { - string GetId (); - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/nested/INestedResults.cs b/Assets/AppServices/model/nested/INestedResults.cs deleted file mode 100644 index 413f49b..0000000 --- a/Assets/AppServices/model/nested/INestedResults.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Unity3dAzure.AppServices -{ - /// - /// Interface to support table Query with `$inlinecount=allpages` - /// - public interface INestedResults - { - } - - public interface INestedResults - { - // work-around for WSA - string GetArrayField(); - string GetCountField(); - - void SetArray(T[] array); - void SetCount(uint count); - - } -} \ No newline at end of file diff --git a/Assets/AppServices/model/nested/NestedResults.cs b/Assets/AppServices/model/nested/NestedResults.cs deleted file mode 100644 index 4db78c1..0000000 --- a/Assets/AppServices/model/nested/NestedResults.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -namespace Unity3dAzure.AppServices -{ - /// - /// Wrap your data model with this object to call the table Query with `$inlinecount=allpages` param. - /// - [Serializable] - public sealed class NestedResults : INestedResults - { - public uint count; - public T[] results; - - // WSA work-around - public void SetArray(T[] array) - { - this.results = array; - } - - public void SetCount(uint count) - { - this.count = count; - } - - public string GetArrayField() - { - return "results"; - } - - public string GetCountField() - { - return "count"; - } - } -} \ No newline at end of file diff --git a/Assets/AppServices/table/IAzureMobileServiceTable.cs b/Assets/AppServices/table/IAzureMobileServiceTable.cs deleted file mode 100644 index f3b70a7..0000000 --- a/Assets/AppServices/table/IAzureMobileServiceTable.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections; - -namespace Unity3dAzure.AppServices -{ - public interface IAzureMobileServiceTable - { - /// - /// Create a new item. - /// - IEnumerator Insert (T item, Action> callback = null) where T : new(); - - /// - /// Get a list of items. - /// - IEnumerator Read (Action> callback = null) where T : new(); - - /// - /// Update an item's data using id property. - /// - IEnumerator Update (T item, Action> callback = null) where T : new(); - - /// - /// Delete an item using id property. - /// - IEnumerator Delete (string id, Action> callback = null) where T : new(); - - /// - /// Get a list of results using a custom query. - /// More info about custom queries here: - /// https://msdn.microsoft.com/en-us/library/azure/jj677199.aspx - /// - IEnumerator Query (CustomQuery query, Action> callback = null) where T : new(); - - /// - /// Returns a 'count' and nested list of 'results' (appends `$inlinecount=allpages` parameter to the query) - /// - IEnumerator Query(CustomQuery query, Action>> callback = null) where T : new(); - - /// - /// Get an item's data using id property. - /// - IEnumerator Lookup (string id, Action> callback = null) where T : new(); - } -} \ No newline at end of file diff --git a/Assets/AppServices/table/MobileServiceTable.cs b/Assets/AppServices/table/MobileServiceTable.cs deleted file mode 100644 index c5232e2..0000000 --- a/Assets/AppServices/table/MobileServiceTable.cs +++ /dev/null @@ -1,121 +0,0 @@ -using UnityEngine; -using System.Collections; -using System; - -namespace Unity3dAzure.AppServices -{ - public class MobileServiceTable : IAzureMobileServiceTable - { - private MobileServiceClient _client; - private string _name; - - public const string URI_TABLES = "tables/"; - - public MobileServiceTable (string tableName, MobileServiceClient client) - { - _client = client; - _name = tableName; // NB: The table name could be infered from the Table's DataModel using typeof(E).Name; but passing Table name as a string allows for the case when the Classname is not the same as the Table name. - } - - public override string ToString () - { - return _name; - } - - public IEnumerator Insert (T item, Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}", _client.AppUrl, URI_TABLES, _name); - ZumoRequest request = new ZumoRequest (_client, url, Method.POST); - Debug.Log ("Insert Request: " + url); - request.AddBody (item); - yield return request.request.Send (); - request.ParseJson (callback); - } - - public IEnumerator Read (Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}", _client.AppUrl, URI_TABLES, _name); - ZumoRequest request = new ZumoRequest (_client, url, Method.GET); - Debug.Log ("Read Request: " + url); - yield return request.request.Send (); - request.ParseJsonArray (callback); - } - - public IEnumerator Query (CustomQuery query, Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}{3}", _client.AppUrl, URI_TABLES, _name, query); - ZumoRequest request = new ZumoRequest (_client, url, Method.GET); - Debug.Log ("Query Request: " + url + " Query:" + query); - yield return request.request.Send (); - request.ParseJsonArray (callback); - } - /* - public IEnumerator Query (CustomQuery query, Action> callback = null) where N : INestedResults where T : new() - { - string queryString = query.ToString (); - string q = queryString.Length > 0 ? "&" : "?"; - queryString += string.Format ("{0}$inlinecount=allpages", q); - string url = string.Format ("{0}/{1}{2}{3}", _client.AppUrl, URI_TABLES, _name, queryString); - Debug.Log ("Query Request: " + url + " Paginated Query:" + query); - ZumoRequest request = new ZumoRequest (_client, url, Method.GET); - yield return request.request.Send (); - request.TryParseJsonNestedArray ("results", callback); - } - */ - public IEnumerator Query(CustomQuery query, Action>> callback = null) where T : new() - { - string queryString = query.ToString(); - string q = queryString.Length > 0 ? "&" : "?"; - queryString += string.Format("{0}$inlinecount=allpages", q); - string url = string.Format("{0}/{1}{2}{3}", _client.AppUrl, URI_TABLES, _name, queryString); - Debug.Log("Query Request: " + url + " Paginated Query:" + query); - ZumoRequest request = new ZumoRequest(_client, url, Method.GET); - yield return request.request.Send(); - request.ParseJsonNestedArray>("results", callback); - } - - public IEnumerator Update (T item, Action> callback = null) where T : new() - { - string id = null; - // Check if model uses the 'IDataModel' Interface to get id property, otherwise try Refelection (using 'Model' helper). - IDataModel model = item as IDataModel; - if (model != null) { - id = model.GetId (); - } else if (Model.HasField (item, "id")) { - var x = Model.GetField (item, "id"); - id = x.GetValue (item) as string; - } else { - Debug.LogError ("Unable to get 'id' data model property"); - } - if (string.IsNullOrEmpty (id)) { - Debug.LogError ("Error 'id' value is missing"); - yield return null; - } - string url = string.Format ("{0}/{1}{2}/{3}", _client.AppUrl, URI_TABLES, _name, id); - ZumoRequest request = new ZumoRequest (_client, url, Method.PATCH); - request.AddBody (item); - Debug.Log ("Update Request Url: " + url + " patch:" + item); - yield return request.request.Send (); - request.ParseJson (callback); - } - - public IEnumerator Delete (string id, Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}/{3}", _client.AppUrl, URI_TABLES, _name, id); - ZumoRequest request = new ZumoRequest (_client, url, Method.DELETE); - Debug.Log ("Delete Request Url: " + url); - yield return request.request.Send (); - request.ParseJson (callback); - } - - public IEnumerator Lookup (string id, Action> callback = null) where T : new() - { - string url = string.Format ("{0}/{1}{2}/{3}", _client.AppUrl, URI_TABLES, _name, id); - ZumoRequest request = new ZumoRequest (_client, url, Method.GET); - Debug.Log ("Lookup Request Url: " + url); - yield return request.request.Send (); - request.ParseJson (callback); - } - - } -} \ No newline at end of file diff --git a/Assets/AppServices/table/query/CustomQuery.cs b/Assets/AppServices/table/query/CustomQuery.cs deleted file mode 100644 index e1bf8cd..0000000 --- a/Assets/AppServices/table/query/CustomQuery.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Text; -using UnityEngine; - -/// -/// Implemention of Query records operation https://msdn.microsoft.com/en-us/library/azure/jj677199.aspx -/// There is a maximum of 50 records returned in a query - use top and skip params to return additional pages of results. -/// NB: `$inlinecount` (which returns count of all items without paging applied) is not set here as it changes the data model shape and the way the REST decode callback works makes it non-trival to decode. -/// Rather the '$inlinecount=allpages' param is automatically set when using the table's Query method and wrapping your data model with the NestedResults object wrapper. -/// -namespace Unity3dAzure.AppServices -{ - [Flags] - public enum MobileServiceSystemProperty - { - nil = 0x0, - createdAt = 0x1, - updatedAt = 0x2, - version = 0x4, - deleted = 0x8 - } - - public class CustomQuery - { - // query option parameters defined by the Open Data Protocol (OData) - public string Filter; - public string OrderBy; - public uint Top; - public uint Skip; - public string Select; - // other params - public MobileServiceSystemProperty SystemProperties; - public bool IncludeDeleted; - - public CustomQuery (string filter = "", string orderBy = null, uint top = 0, uint skip = 0, string select = null, MobileServiceSystemProperty systemProperties = MobileServiceSystemProperty.nil, bool includeDeleted = false) - { - this.Filter = filter; // return only rows that satisfy the specified filter predicate - this.OrderBy = orderBy; // sort column by one or more columns: order can be specified in 'desc' or 'asc' order ('asc' is default) - this.Top = top; // return the top n entities for any query - this.Skip = skip; // the n of records to skip (used for paging results) - this.Select = select; // defines new projection of data by specifying the columns - this.SystemProperties = systemProperties; // list of system properties to be included in the response - this.IncludeDeleted = includeDeleted; // if table has soft delete enabled then deleted records will be included in the results - } - - public static CustomQuery CreateWithOrderBy (string orderBy) - { - return new CustomQuery ("", orderBy); - } - - public override string ToString () - { - string queryString = ""; - string q = "?"; - if (!string.IsNullOrEmpty (this.Filter)) { - queryString += string.Format ("{0}$filter=({1})", q, this.Filter); - q = "&"; - } - if (!string.IsNullOrEmpty (this.OrderBy)) { - queryString += string.Format ("{0}$orderby={1}", q, this.OrderBy); - q = "&"; - } - if (this.Top > 0) { - queryString += string.Format ("{0}$top={1}", q, this.Top.ToString ()); - q = "&"; - } - if (this.Skip > 0) { - queryString += string.Format ("{0}$skip={1}", q, this.Skip.ToString ()); - q = "&"; - } - if (!string.IsNullOrEmpty (this.Select)) { - queryString += string.Format ("{0}$select={1}", q, this.Select); - q = "&"; - } - if (this.SystemProperties != MobileServiceSystemProperty.nil) { - // NB: setting __systemproperties param doesn't seem to do anything different as these properties are all included by default, but we can append values to the 'select' param. - if (!string.IsNullOrEmpty (this.Select)) { - queryString += string.Format (",{0}", SystemPropertiesValues (this.SystemProperties)); - } - queryString += string.Format ("{0}__systemproperties={1}", q, SystemPropertiesValues (this.SystemProperties)); - q = "&"; - } - if (this.IncludeDeleted) { - queryString += string.Format ("{0}__includeDeleted=true", q); - } - return EscapeURL (queryString); - } - - private string EscapeURL (string query) - { - string q = WWW.EscapeURL (query); - StringBuilder sb = new StringBuilder (q); - sb.Replace ("+", "%20"); // NB: replace space with '%20' instead of '+' - // keep query params: ?&=$ - sb.Replace ("%3f", "?"); - sb.Replace ("%26", "&"); - sb.Replace ("%3d", "="); - sb.Replace ("%24", "$"); - return sb.ToString (); - } - - private string SystemPropertiesValues (MobileServiceSystemProperty systemProperties) - { - if (systemProperties == MobileServiceSystemProperty.nil) { - return ""; - } - return systemProperties.ToString ().Replace (" ", ""); // remove spaces from string - } - } -} \ No newline at end of file diff --git a/Assets/Dependencies/AppServices b/Assets/Dependencies/AppServices new file mode 160000 index 0000000..09d09fc --- /dev/null +++ b/Assets/Dependencies/AppServices @@ -0,0 +1 @@ +Subproject commit 09d09fc0ac91ab542c4418ad874fd0643aff45e4 diff --git a/Assets/Dependencies/RESTClient b/Assets/Dependencies/RESTClient new file mode 160000 index 0000000..e3ef7be --- /dev/null +++ b/Assets/Dependencies/RESTClient @@ -0,0 +1 @@ +Subproject commit e3ef7bea94062607daebd48b8cdf7d7a84d83242 diff --git a/Assets/TSTableView/ITableViewDataSource.cs b/Assets/Dependencies/TSTableView/ITableViewDataSource.cs similarity index 100% rename from Assets/TSTableView/ITableViewDataSource.cs rename to Assets/Dependencies/TSTableView/ITableViewDataSource.cs diff --git a/Assets/TSTableView/ITableViewDataSource.cs.meta b/Assets/Dependencies/TSTableView/ITableViewDataSource.cs.meta similarity index 100% rename from Assets/TSTableView/ITableViewDataSource.cs.meta rename to Assets/Dependencies/TSTableView/ITableViewDataSource.cs.meta diff --git a/Assets/TSTableView/LICENSE b/Assets/Dependencies/TSTableView/LICENSE similarity index 100% rename from Assets/TSTableView/LICENSE rename to Assets/Dependencies/TSTableView/LICENSE diff --git a/Assets/TSTableView/LICENSE.meta b/Assets/Dependencies/TSTableView/LICENSE.meta similarity index 100% rename from Assets/TSTableView/LICENSE.meta rename to Assets/Dependencies/TSTableView/LICENSE.meta diff --git a/Assets/TSTableView/README.md b/Assets/Dependencies/TSTableView/README.md similarity index 100% rename from Assets/TSTableView/README.md rename to Assets/Dependencies/TSTableView/README.md diff --git a/Assets/TSTableView/README.md.meta b/Assets/Dependencies/TSTableView/README.md.meta similarity index 100% rename from Assets/TSTableView/README.md.meta rename to Assets/Dependencies/TSTableView/README.md.meta diff --git a/Assets/TSTableView/TableView.cs b/Assets/Dependencies/TSTableView/TableView.cs similarity index 100% rename from Assets/TSTableView/TableView.cs rename to Assets/Dependencies/TSTableView/TableView.cs diff --git a/Assets/TSTableView/TableView.cs.meta b/Assets/Dependencies/TSTableView/TableView.cs.meta similarity index 100% rename from Assets/TSTableView/TableView.cs.meta rename to Assets/Dependencies/TSTableView/TableView.cs.meta diff --git a/Assets/TSTableView/TableViewCell.cs b/Assets/Dependencies/TSTableView/TableViewCell.cs similarity index 100% rename from Assets/TSTableView/TableViewCell.cs rename to Assets/Dependencies/TSTableView/TableViewCell.cs diff --git a/Assets/TSTableView/TableViewCell.cs.meta b/Assets/Dependencies/TSTableView/TableViewCell.cs.meta similarity index 100% rename from Assets/TSTableView/TableViewCell.cs.meta rename to Assets/Dependencies/TSTableView/TableViewCell.cs.meta diff --git a/Assets/Scenes/HighscoresDemo.unity b/Assets/Scenes/HighscoresDemo.unity index 22bd96b..98cbebf 100644 --- a/Assets/Scenes/HighscoresDemo.unity +++ b/Assets/Scenes/HighscoresDemo.unity @@ -13,7 +13,7 @@ OcclusionCullingSettings: --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 8 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 @@ -25,6 +25,7 @@ RenderSettings: m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 @@ -41,7 +42,7 @@ RenderSettings: --- !u!157 &4 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 11 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 @@ -53,7 +54,7 @@ LightmapSettings: m_EnableBakedLightmaps: 0 m_EnableRealtimeLightmaps: 0 m_LightmapEditorSettings: - serializedVersion: 4 + serializedVersion: 9 m_Resolution: 2 m_BakeResolution: 40 m_TextureWidth: 1024 @@ -66,13 +67,27 @@ LightmapSettings: m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 - m_DirectLightInLightProbes: 1 m_FinalGather: 0 m_FinalGatherFiltering: 1 m_FinalGatherRayCount: 1024 m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 + m_UseShadowmask: 0 --- !u!196 &5 NavMeshSettings: serializedVersion: 2 @@ -89,6 +104,8 @@ NavMeshSettings: minRegionArea: 2 manualCellSize: 0 cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 accuratePlacement: 0 m_NavMeshData: {fileID: 0} --- !u!1 &18042273 @@ -161,6 +178,8 @@ Camera: m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 @@ -329,7 +348,7 @@ RectTransform: m_Children: - {fileID: 1331628561} m_Father: {fileID: 845385617} - m_RootOrder: 7 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -785,7 +804,7 @@ RectTransform: - {fileID: 33461465} - {fileID: 71988874} m_Father: {fileID: 845385617} - m_RootOrder: 9 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -916,7 +935,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 845385617} - m_RootOrder: 6 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -993,7 +1012,7 @@ RectTransform: - {fileID: 203810728} - {fileID: 1568931516} m_Father: {fileID: 845385617} - m_RootOrder: 3 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -1352,7 +1371,7 @@ Canvas: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 443289796} m_Enabled: 1 - serializedVersion: 2 + serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} m_PlaneDistance: 100 @@ -1361,6 +1380,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -1752,80 +1772,6 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 692528756} ---- !u!1 &752853304 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 752853305} - - component: {fileID: 752853307} - - component: {fileID: 752853306} - m_Layer: 5 - m_Name: Text - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &752853305 -RectTransform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 752853304} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1658579221} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.5} - m_SizeDelta: {x: -20, y: -13} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &752853306 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 752853304} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_RaycastTarget: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 3 - m_AlignByGeometry: 0 - m_RichText: 0 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: ---- !u!222 &752853307 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 752853304} --- !u!1001 &784713176 Prefab: m_ObjectHideFlags: 0 @@ -1982,7 +1928,6 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 1658579221} - {fileID: 1844851414} - {fileID: 1884803336} - {fileID: 303178542} @@ -2029,7 +1974,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 845385617} - m_RootOrder: 4 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -2307,80 +2252,6 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 947988035} ---- !u!1 &948764532 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 948764533} - - component: {fileID: 948764535} - - component: {fileID: 948764534} - m_Layer: 5 - m_Name: Placeholder - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &948764533 -RectTransform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 948764532} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1658579221} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.5} - m_SizeDelta: {x: -20, y: -13} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &948764534 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 948764532} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} - m_RaycastTarget: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 2 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 3 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: Facebook Access Token ---- !u!222 &948764535 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 948764532} --- !u!1 &977069929 GameObject: m_ObjectHideFlags: 0 @@ -2846,7 +2717,7 @@ RectTransform: - {fileID: 1046828124} - {fileID: 947988036} m_Father: {fileID: 845385617} - m_RootOrder: 10 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -2905,7 +2776,7 @@ RectTransform: - {fileID: 1746703252} - {fileID: 1939317900} m_Father: {fileID: 845385617} - m_RootOrder: 8 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -3336,7 +3207,7 @@ RectTransform: - {fileID: 404303306} - {fileID: 1987250336} m_Father: {fileID: 845385617} - m_RootOrder: 5 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -4203,7 +4074,7 @@ MonoBehaviour: m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 0 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: @@ -4223,7 +4094,7 @@ GameObject: - component: {fileID: 1578968901} - component: {fileID: 1578968902} m_Layer: 0 - m_Name: AppServicesController + m_Name: AppServices Controller m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -4253,167 +4124,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9dcdeb5277262475c858002ec725ae70, type: 3} m_Name: m_EditorClassIdentifier: - _appUrl: YOUR_APP_URL - _facebookAccessToken: + _appUrl: PASTE_YOUR_APP_URL + _facebookUserToken: + _twitterAccessToken: + _twitterTokenSecret: _tableView: {fileID: 371080080} _cellPrefab: {fileID: 784713177} _modalAlert: {fileID: 1389452106} ---- !u!1 &1658579220 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1658579221} - - component: {fileID: 1658579224} - - component: {fileID: 1658579223} - - component: {fileID: 1658579222} - m_Layer: 5 - m_Name: FacebookAccessToken - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1658579221 -RectTransform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 948764533} - - {fileID: 752853305} - m_Father: {fileID: 845385617} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 160, y: -10} - m_SizeDelta: {x: 300, y: 50} - m_Pivot: {x: 0.5, y: 1} ---- !u!114 &1658579222 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 1658579223} - m_TextComponent: {fileID: 752853306} - m_Placeholder: {fileID: 948764534} - m_ContentType: 0 - m_InputType: 0 - m_AsteriskChar: 42 - m_KeyboardType: 0 - m_LineType: 0 - m_HideMobileInput: 0 - m_CharacterValidation: 0 - m_CharacterLimit: 0 - m_OnEndEdit: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1578968900} - m_MethodName: - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null - m_OnValueChanged: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1578968902} - m_MethodName: TextChanged - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null - m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_CustomCaretColor: 0 - m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} - m_Text: - m_CaretBlinkRate: 0.85 - m_CaretWidth: 1 - m_ReadOnly: 0 ---- !u!114 &1658579223 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 ---- !u!222 &1658579224 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} --- !u!1 &1690919451 GameObject: m_ObjectHideFlags: 0 @@ -4782,12 +4499,12 @@ RectTransform: m_Children: - {fileID: 1690919452} m_Father: {fileID: 845385617} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 105, y: -10} - m_SizeDelta: {x: -230, y: 50} + m_AnchoredPosition: {x: 0, y: -10} + m_SizeDelta: {x: -20, y: 50} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1844851415 MonoBehaviour: @@ -4902,7 +4619,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 845385617} - m_RootOrder: 2 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -5145,7 +4862,7 @@ MonoBehaviour: m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 0 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: diff --git a/Assets/Scenes/InventoryDemo.unity b/Assets/Scenes/InventoryDemo.unity index 4eb89e0..c02019d 100644 --- a/Assets/Scenes/InventoryDemo.unity +++ b/Assets/Scenes/InventoryDemo.unity @@ -13,7 +13,7 @@ OcclusionCullingSettings: --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 8 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 @@ -25,6 +25,7 @@ RenderSettings: m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 @@ -41,7 +42,7 @@ RenderSettings: --- !u!157 &4 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 11 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 @@ -53,7 +54,7 @@ LightmapSettings: m_EnableBakedLightmaps: 0 m_EnableRealtimeLightmaps: 0 m_LightmapEditorSettings: - serializedVersion: 4 + serializedVersion: 9 m_Resolution: 2 m_BakeResolution: 40 m_TextureWidth: 1024 @@ -66,13 +67,27 @@ LightmapSettings: m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 - m_DirectLightInLightProbes: 1 m_FinalGather: 0 m_FinalGatherFiltering: 1 m_FinalGatherRayCount: 1024 m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 + m_UseShadowmask: 0 --- !u!196 &5 NavMeshSettings: serializedVersion: 2 @@ -89,6 +104,8 @@ NavMeshSettings: minRegionArea: 2 manualCellSize: 0 cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 accuratePlacement: 0 m_NavMeshData: {fileID: 0} --- !u!1 &12083091 @@ -295,6 +312,8 @@ Camera: m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 @@ -1174,7 +1193,7 @@ Canvas: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 443289796} m_Enabled: 1 - serializedVersion: 2 + serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} m_PlaneDistance: 100 @@ -1183,6 +1202,7 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -1734,7 +1754,7 @@ MonoBehaviour: m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 0 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: @@ -1788,80 +1808,6 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 730256638} ---- !u!1 &752853304 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 752853305} - - component: {fileID: 752853307} - - component: {fileID: 752853306} - m_Layer: 5 - m_Name: Text - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &752853305 -RectTransform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 752853304} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1658579221} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.5} - m_SizeDelta: {x: -20, y: -13} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &752853306 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 752853304} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_RaycastTarget: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 3 - m_AlignByGeometry: 0 - m_RichText: 0 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: ---- !u!222 &752853307 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 752853304} --- !u!1 &755099042 GameObject: m_ObjectHideFlags: 0 @@ -1894,7 +1840,7 @@ RectTransform: - {fileID: 299636562} - {fileID: 1215274727} m_Father: {fileID: 845385617} - m_RootOrder: 2 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2084,7 +2030,6 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 1658579221} - {fileID: 1844851414} - {fileID: 755099043} m_Father: {fileID: 2092316045} @@ -2277,80 +2222,6 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 902180333} ---- !u!1 &948764532 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 948764533} - - component: {fileID: 948764535} - - component: {fileID: 948764534} - m_Layer: 5 - m_Name: Placeholder - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &948764533 -RectTransform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 948764532} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1658579221} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.5} - m_SizeDelta: {x: -20, y: -13} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &948764534 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 948764532} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} - m_RaycastTarget: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 2 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 3 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: Facebook Access Token ---- !u!222 &948764535 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 948764532} --- !u!1 &986425709 GameObject: m_ObjectHideFlags: 0 @@ -2382,7 +2253,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.46767014} + m_AnchoredPosition: {x: 0, y: 0.45404664} m_SizeDelta: {x: 0, y: 460} m_Pivot: {x: 0, y: 1} --- !u!114 &986425711 @@ -3055,7 +2926,7 @@ MonoBehaviour: m_HandleRect: {fileID: 1803301958} m_Direction: 2 m_Value: 0 - m_Size: 0.85024214 + m_Size: 0.85130763 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -3537,7 +3408,7 @@ MonoBehaviour: m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 0 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: @@ -3826,7 +3697,7 @@ MonoBehaviour: m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 0 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: @@ -3846,7 +3717,7 @@ GameObject: - component: {fileID: 1578968901} - component: {fileID: 1578968902} m_Layer: 0 - m_Name: AppServicesController + m_Name: AppServices Controller m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -3876,167 +3747,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6cbf7b4bb150744d19a51e4387ac47fa, type: 3} m_Name: m_EditorClassIdentifier: - _appUrl: YOUR_APP_URL - _facebookAccessToken: + _appUrl: PASTE_YOUR_APP_URL + _facebookUserToken: + _twitterAccessToken: + _twitterTokenSecret: _tableView: {fileID: 371080080} _cellPrefab: {fileID: 1760964638} _modalAlert: {fileID: 824055199} ---- !u!1 &1658579220 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1658579221} - - component: {fileID: 1658579224} - - component: {fileID: 1658579223} - - component: {fileID: 1658579222} - m_Layer: 5 - m_Name: FacebookAccessToken - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1658579221 -RectTransform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 948764533} - - {fileID: 752853305} - m_Father: {fileID: 845385617} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 160, y: -10} - m_SizeDelta: {x: 300, y: 50} - m_Pivot: {x: 0.5, y: 1} ---- !u!114 &1658579222 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 1658579223} - m_TextComponent: {fileID: 752853306} - m_Placeholder: {fileID: 948764534} - m_ContentType: 0 - m_InputType: 0 - m_AsteriskChar: 42 - m_KeyboardType: 0 - m_LineType: 0 - m_HideMobileInput: 0 - m_CharacterValidation: 0 - m_CharacterLimit: 0 - m_OnEndEdit: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1578968900} - m_MethodName: - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null - m_OnValueChanged: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1578968902} - m_MethodName: TextChanged - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, - Culture=neutral, PublicKeyToken=null - m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_CustomCaretColor: 0 - m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} - m_Text: - m_CaretBlinkRate: 0.85 - m_CaretWidth: 1 - m_ReadOnly: 0 ---- !u!114 &1658579223 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, - Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 ---- !u!222 &1658579224 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1658579220} --- !u!1001 &1662000092 Prefab: m_ObjectHideFlags: 0 @@ -4559,12 +4276,12 @@ RectTransform: m_Children: - {fileID: 1690919452} m_Father: {fileID: 845385617} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 105, y: -10} - m_SizeDelta: {x: -230, y: 50} + m_AnchoredPosition: {x: 0, y: -10} + m_SizeDelta: {x: -20, y: 50} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1844851415 MonoBehaviour: @@ -4789,7 +4506,7 @@ MonoBehaviour: m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 0 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: diff --git a/Assets/Scripts/DataModels/Highscore.cs b/Assets/Scripts/DataModels/Highscore.cs index a577e99..29f5742 100644 --- a/Assets/Scripts/DataModels/Highscore.cs +++ b/Assets/Scripts/DataModels/Highscore.cs @@ -1,5 +1,5 @@ using System; -using Unity3dAzure.AppServices; +using Azure.AppServices; [Serializable] public class Highscore : DataModel diff --git a/Assets/Scripts/DataModels/Inventory.cs b/Assets/Scripts/DataModels/Inventory.cs index 122bf7f..7cca141 100644 --- a/Assets/Scripts/DataModels/Inventory.cs +++ b/Assets/Scripts/DataModels/Inventory.cs @@ -1,5 +1,5 @@ using System; -using Unity3dAzure.AppServices; +using Azure.AppServices; [Serializable] public class Inventory : DataModel diff --git a/Assets/Scripts/HighscoresDemo.cs b/Assets/Scripts/HighscoresDemo.cs index 6ea83fb..0a8fbf0 100644 --- a/Assets/Scripts/HighscoresDemo.cs +++ b/Assets/Scripts/HighscoresDemo.cs @@ -1,8 +1,9 @@ -using UnityEngine; +using Azure.AppServices; +using RESTClient; +using UnityEngine; using System; using System.Net; using System.Collections.Generic; -using Unity3dAzure.AppServices; using UnityEngine.UI; using Tacticsoft; using Prefabs; @@ -20,16 +21,27 @@ public class HighscoresDemo : MonoBehaviour, ITableViewDataSource [SerializeField] private string _appUrl = "PASTE_YOUR_APP_URL"; - // Go to https://developers.facebook.com/tools/accesstoken/ to generate a new access "User Token" [Header ("User Authentication")] + // Client-side login requires auth token from identity provider. + // NB: Remember to update Azure App Service authentication provider with your app key and secret and SAVE changes! + + // Facebook - go to https://developers.facebook.com/tools/accesstoken/ to generate a "User Token". + [Header ("Facebook")] + [SerializeField] + private string _facebookUserToken = ""; + + // Twitter auth - go to https://apps.twitter.com/ and select "Keys and Access Tokens" to generate a access "Access Token" and "Access Token Secret". + [Header ("Twitter")] [SerializeField] - private string _facebookAccessToken = ""; + private string _twitterAccessToken = ""; + [SerializeField] + private string _twitterTokenSecret = ""; // App Service Rest Client - private MobileServiceClient _client; + private AppServiceClient _client; // App Service Table defined using a DataModel - private MobileServiceTable _table; + private AppServiceTable _table; // List of highscores (leaderboard) private List _scores = new List (); @@ -66,7 +78,7 @@ public class HighscoresDemo : MonoBehaviour, ITableViewDataSource void Start () { // Create App Service client - _client = new MobileServiceClient (_appUrl); + _client = new AppServiceClient (_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable ("Highscores"); @@ -74,12 +86,6 @@ void Start () // set TSTableView delegate _tableView.dataSource = this; - // setup token using Unity Inspector value - if (!String.IsNullOrEmpty (_facebookAccessToken)) { - InputField inputToken = GameObject.Find ("FacebookAccessToken").GetComponent (); - inputToken.text = _facebookAccessToken; - } - UpdateUI (); } @@ -110,16 +116,24 @@ void Update () public void Login () { - StartCoroutine (_client.Login (MobileServiceAuthenticationProvider.Facebook, _facebookAccessToken, OnLoginCompleted)); + if (!string.IsNullOrEmpty(_facebookUserToken)) + { + StartCoroutine (_client.LoginWithFacebook (_facebookUserToken, OnLoginCompleted)); + return; + } + if (!string.IsNullOrEmpty(_twitterAccessToken) && !string.IsNullOrEmpty(_twitterTokenSecret)) + { + StartCoroutine (_client.LoginWithTwitter (_twitterAccessToken, _twitterTokenSecret, OnLoginCompleted)); + return; + } + Debug.LogWarning("Login requires Facebook or Twitter access tokens"); } - private void OnLoginCompleted (IRestResponse response) + private void OnLoginCompleted (IRestResponse response) { Debug.Log ("OnLoginCompleted: " + response.Content + " Url:" + response.Url); if (!response.IsError && response.StatusCode == HttpStatusCode.OK) { - MobileServiceUser mobileServiceUser = response.Data; - _client.User = mobileServiceUser; Debug.Log ("Authorized UserId: " + _client.User.user.userId); } else { Debug.LogWarning ("Authorization Error: " + response.StatusCode); @@ -224,7 +238,8 @@ public void GetAllHighscores () private void GetPageHighscores () { - CustomQuery query = new CustomQuery ("", "score desc", _noPageResults, _skip, "id,username,score"); + var orderBy = new OrderBy("score", SortDirection.desc); + TableQuery query = new TableQuery ("", _noPageResults, _skip, "id,username,score", TableSystemProperty.nil, false, orderBy); StartCoroutine (_table.Query (query, OnReadNestedResultsCompleted)); } @@ -233,10 +248,13 @@ public void GetTopHighscores () ResetList (); DateTime today = DateTime.Today; string day = today.ToString ("s"); - string filter = string.Format ("createdAt gt '{0}Z'", day); - Debug.Log ("filter:" + filter); - string orderBy = "score desc"; - CustomQuery query = new CustomQuery (filter, orderBy, 10); + string filterPredicate = string.Format ("createdAt gt '{0}Z'", day); + Debug.Log ("filter:" + filterPredicate); + var orderBy = new OrderBy("score", SortDirection.desc); + //TableQuery query = new TableQuery (filterPredicate, 10, 0, null, TableSystemProperty.nil, false, orderBy); + TableQuery query = TableQuery.CreateWithOrderBy(orderBy); + query.Top = 10; + query.Filter = filterPredicate; Query (query); } @@ -244,13 +262,14 @@ public void GetUsernameHighscore () { ResetList (); Highscore score = GetScore (); - string filter = string.Format ("username eq '{0}'", score.username); - string orderBy = "score desc"; - CustomQuery query = new CustomQuery (filter, orderBy); + string filterPredicate = string.Format ("username eq '{0}'", score.username); + var orderBy = new OrderBy("score", SortDirection.desc); + TableQuery query = TableQuery.CreateWithOrderBy(orderBy); + query.Filter = filterPredicate; Query (query); } - private void Query (CustomQuery query) + private void Query (TableQuery query) { StartCoroutine (_table.Query (query, OnReadCompleted)); } @@ -409,11 +428,6 @@ public void TextChanged () /// private void UpdateUI () { - // Activate login button if Facebook Access Token is entered - Button login = GameObject.Find ("Login").GetComponent