Skip to content

Commit ea0a9ae

Browse files
committed
💻 Adjustments to get Windows 10 app working
1 parent 3ebcfd9 commit ea0a9ae

File tree

8 files changed

+56
-40
lines changed

8 files changed

+56
-40
lines changed

Assets/AppServices/model/base/DataModel.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ namespace Unity3dAzure.AppServices
66
{
77
[Serializable]
88
[CLSCompliant(false)]
9-
public abstract class DataModel : IDataModel
9+
public class DataModel : IDataModel
1010
{
11-
public string id { get; internal set; }
11+
public string id { get; set; }
1212

1313
// system properties
1414
[JsonIgnore] public DateTime createdAt { get; private set; }
@@ -29,11 +29,6 @@ public string GetId()
2929
return id;
3030
}
3131

32-
public void SetId(string id)
33-
{
34-
this.id = id;
35-
}
36-
3732
public override string ToString ()
3833
{
3934
return string.Format ("id:{0}, createdAt:{1}, updatedAt:{2}, version:{3}, deleted:{4}, index:{5}", id, createdAt, updatedAt, version, deleted, GetIndex());

Assets/AppServices/table/MobileServiceTable.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,32 @@ public override string ToString()
6363

6464
public void Update<T>(T item, Action<IRestResponse<T>> callback = null) where T : new()
6565
{
66-
// NB: Using Refelection to get 'id' property. Alternatively a DataModel Interface could be used to detect 'id' property
67-
if( Model.HasProperty(item, "id") )
66+
string id = null;
67+
// Check if model uses the 'IDataModel' Interface to get id property, otherwise try Refelection (using 'Model' helper).
68+
IDataModel model = item as IDataModel;
69+
if (model != null)
6870
{
69-
var x = Model.GetProperty(item, "id"); //item.GetType().GetProperty("id");
70-
string id = x.GetValue(item, null) as string;
71-
string uri = URI_TABLES + _name + "/" + id;
72-
ZumoRequest request = new ZumoRequest(_client, uri, Method.PATCH);
73-
Debug.Log( "Update Request Uri: " + uri );
74-
request.AddBody(item);
75-
_client.ExecuteAsync<T>(request, callback);
71+
id = model.GetId();
72+
}
73+
else if ( Model.HasProperty(item, "id") )
74+
{
75+
var x = Model.GetProperty(item, "id");
76+
id = x.GetValue(item, null) as string;
7677
}
7778
else
7879
{
79-
Debug.LogError("Unable to get 'id' property");
80+
Debug.LogError("Unable to get 'id' data model property");
81+
}
82+
if (string.IsNullOrEmpty(id))
83+
{
84+
Debug.LogError("Error 'id' value is missing");
85+
return;
8086
}
87+
string uri = URI_TABLES + _name + "/" + id;
88+
ZumoRequest request = new ZumoRequest(_client, uri, Method.PATCH);
89+
Debug.Log("Update Request Uri: " + uri);
90+
request.AddBody(item);
91+
_client.ExecuteAsync<T>(request, callback);
8192
}
8293

8394
public void Delete<T>(string id, Action<IRestResponse<T>> callback = null) where T : new()

Assets/Prefabs/ModalAlertPrefab.prefab

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ GameObject:
142142
- 224: {fileID: 224000011202324464}
143143
- 114: {fileID: 114000014265073946}
144144
m_Layer: 5
145-
m_Name: Actions
145+
m_Name: ButtonActions
146146
m_TagString: Untagged
147147
m_Icon: {fileID: 0}
148148
m_NavMeshLayer: 0
@@ -157,7 +157,7 @@ GameObject:
157157
m_Component:
158158
- 224: {fileID: 224000011961785600}
159159
m_Layer: 5
160-
m_Name: Alert
160+
m_Name: ModalAlertContainer
161161
m_TagString: Untagged
162162
m_Icon: {fileID: 0}
163163
m_NavMeshLayer: 0

Assets/Scenes/HighscoresDemo.unity

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ RectTransform:
25292529
m_RootOrder: 0
25302530
m_AnchorMin: {x: 0, y: 1}
25312531
m_AnchorMax: {x: 1, y: 1}
2532-
m_AnchoredPosition: {x: 0, y: 0.000030517578}
2532+
m_AnchoredPosition: {x: 0, y: -0.000030517578}
25332533
m_SizeDelta: {x: 0, y: 460}
25342534
m_Pivot: {x: 0, y: 1}
25352535
--- !u!114 &986425711
@@ -3015,7 +3015,7 @@ MonoBehaviour:
30153015
m_TargetGraphic: {fileID: 1803301959}
30163016
m_HandleRect: {fileID: 1803301958}
30173017
m_Direction: 2
3018-
m_Value: 0
3018+
m_Value: 1
30193019
m_Size: 1
30203020
m_NumberOfSteps: 0
30213021
m_OnValueChanged:
@@ -3254,7 +3254,7 @@ MonoBehaviour:
32543254
m_HandleRect: {fileID: 1064423869}
32553255
m_Direction: 0
32563256
m_Value: 0
3257-
m_Size: 0.9999999
3257+
m_Size: 1
32583258
m_NumberOfSteps: 0
32593259
m_OnValueChanged:
32603260
m_PersistentCalls:
@@ -4243,6 +4243,7 @@ MonoBehaviour:
42434243
m_Name:
42444244
m_EditorClassIdentifier:
42454245
_appUrl: YOUR_APP_URL
4246+
_facebookAccessToken:
42464247
_tableView: {fileID: 371080080}
42474248
_cellPrefab: {fileID: 784713177}
42484249
_modalAlert: {fileID: 1389452106}

Assets/Scenes/InventoryDemo.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ RectTransform:
23812381
m_RootOrder: 0
23822382
m_AnchorMin: {x: 0, y: 1}
23832383
m_AnchorMax: {x: 1, y: 1}
2384-
m_AnchoredPosition: {x: 0, y: 460.00003}
2384+
m_AnchoredPosition: {x: 0, y: 459.99997}
23852385
m_SizeDelta: {x: 0, y: 460}
23862386
m_Pivot: {x: 0, y: 1}
23872387
--- !u!114 &986425711
@@ -3166,7 +3166,7 @@ MonoBehaviour:
31663166
m_HandleRect: {fileID: 1064423869}
31673167
m_Direction: 0
31683168
m_Value: 0
3169-
m_Size: 0.9999999
3169+
m_Size: 1
31703170
m_NumberOfSteps: 0
31713171
m_OnValueChanged:
31723172
m_PersistentCalls:

Assets/Scripts/HighscoresDemo.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ public class HighscoresDemo : MonoBehaviour, ITableViewDataSource
2222
[SerializeField]
2323
private string _appUrl = "PASTE_YOUR_APP_URL";
2424

25-
// Go to https://developers.facebook.com/tools/accesstoken/ to generate a new access "User Token"
26-
private string _facebookAccessToken;
25+
// Go to https://developers.facebook.com/tools/accesstoken/ to generate a new access "User Token"
26+
[Header("User Authentication")]
27+
[SerializeField]
28+
private string _facebookAccessToken = "";
2729

28-
// App Service Rest Client
29-
private MobileServiceClient _client;
30+
// App Service Rest Client
31+
private MobileServiceClient _client;
3032

3133
// App Service Table defined using a DataModel
3234
private MobileServiceTable<Highscore> _table;
@@ -61,7 +63,14 @@ void Start ()
6163
// set TSTableView delegate
6264
_tableView.dataSource = this;
6365

64-
UpdateUI();
66+
// setup token using Unity Inspector value
67+
if (!String.IsNullOrEmpty(_facebookAccessToken))
68+
{
69+
InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent<InputField>();
70+
inputToken.text = _facebookAccessToken;
71+
}
72+
73+
UpdateUI();
6574
}
6675

6776
// Update is called once per frame
@@ -75,7 +84,7 @@ void Update ()
7584
}
7685
// Display new score details
7786
if (_score != null) {
78-
Debug.Log ("Show score");
87+
Debug.Log ("Show score:" + _score.ToString());
7988
DisplayScore (_score);
8089
_score = null;
8190
}
@@ -218,7 +227,7 @@ public void GetAllHighscores()
218227

219228
public void GetTopHighscores()
220229
{
221-
DateTime today = DateTime.Today;
230+
DateTime today = DateTime.Today.AddDays(-1);
222231
string day = today.ToString("s");
223232
string filter = string.Format("createdAt gt '{0}Z'", day); //string.Format("score gt {0}", 999);
224233
Debug.Log ("filter:" + filter);

ProjectSettings/GraphicsSettings.asset

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ GraphicsSettings:
4444
useReflectionProbeBoxProjection: 0
4545
useReflectionProbeBlending: 0
4646
m_ShaderSettings_Tier2:
47-
useCascadedShadowMaps: 0
48-
standardShaderQuality: 1
49-
useReflectionProbeBoxProjection: 0
50-
useReflectionProbeBlending: 0
47+
useCascadedShadowMaps: 1
48+
standardShaderQuality: 2
49+
useReflectionProbeBoxProjection: 1
50+
useReflectionProbeBlending: 1
5151
m_ShaderSettings_Tier3:
52-
useCascadedShadowMaps: 0
53-
standardShaderQuality: 1
54-
useReflectionProbeBoxProjection: 0
55-
useReflectionProbeBlending: 0
52+
useCascadedShadowMaps: 1
53+
standardShaderQuality: 2
54+
useReflectionProbeBoxProjection: 1
55+
useReflectionProbeBlending: 1
5656
m_BuildTargetShaderSettings: []
5757
m_LightmapStripping: 0
5858
m_FogStripping: 0

ProjectSettings/ProjectSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ PlayerSettings:
348348
metroCertificatePassword:
349349
metroCertificateSubject: DefaultCompany
350350
metroCertificateIssuer: DefaultCompany
351-
metroCertificateNotAfter: 00b8c2822724d301
351+
metroCertificateNotAfter: 005b50d72d25d301
352352
metroApplicationDescription: MobileServicesDemo
353353
wsaImages: {}
354354
metroTileShortName:

0 commit comments

Comments
 (0)