Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.27.0 #87

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
549 changes: 43 additions & 506 deletions Assets/Samples/Playground/Scenes/Playground.unity

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Assets/Samples/Playground/Scripts/Events/TrackEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public async void OnButtonClick()

private async Task Track()
{
if (string.IsNullOrEmpty(eventName))
{
ResponseMessage.SetText("eventName not set on TrackEventButton");
return;
}

try
{
await Talo.Events.Track(eventName, props.Select((prop) => (prop.key, prop.value)).ToArray());
Expand Down
43 changes: 0 additions & 43 deletions Assets/Samples/Playground/Scripts/Events/TrackLevelUpEvent.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Samples/Playground/Scripts/Events/TrackLevelUpEvent.cs.meta

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private async Task FetchCategories()
else
{
var mapped = categories.Select((c) => $"{c.name} ({c.internalName})");
ResponseMessage.SetText($"Categories: " + string.Join(',', mapped));
ResponseMessage.SetText($"Categories: " + string.Join(", ", mapped));
}
}
}
21 changes: 18 additions & 3 deletions Assets/Samples/Playground/Scripts/Feedback/SendFeedback.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
using UnityEngine;
using TaloGameServices;
using System;

public class SendFeedback : MonoBehaviour
{
public string internalName, feedbackComment;
public string categoryInternalName, feedbackComment;

public async void OnButtonClick()
{
await Talo.Feedback.Send(internalName, feedbackComment);
ResponseMessage.SetText($"Feedback sent for {internalName}: {feedbackComment}");
if (string.IsNullOrEmpty(categoryInternalName) || string.IsNullOrEmpty(feedbackComment))
{
ResponseMessage.SetText("categoryInternalName or feedbackComment not set on SendFeedbackButton");
return;
}

try
{
await Talo.Feedback.Send(categoryInternalName, feedbackComment);
ResponseMessage.SetText($"Feedback sent for {categoryInternalName}: {feedbackComment}");
}
catch (Exception err)
{
ResponseMessage.SetText(err.Message);
throw err;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

public class GetLeaderboardEntries : MonoBehaviour
{
public string internalName;
public int page;
public string leaderboardInternalName;
public int page = 0;

public async void OnButtonClick()
{
Expand All @@ -16,10 +16,16 @@ public async void OnButtonClick()

private async Task FetchEntries()
{
if (string.IsNullOrEmpty(leaderboardInternalName))
{
ResponseMessage.SetText("leaderboardInternalName not set on GetLeaderboardEntriesButton");
return;
}

try
{
int score = UnityEngine.Random.Range(0, 10000);
LeaderboardEntriesResponse res = await Talo.Leaderboards.GetEntries(internalName, page);
LeaderboardEntriesResponse res = await Talo.Leaderboards.GetEntries(leaderboardInternalName, page);
LeaderboardEntry[] entries = res.entries;

if (entries.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class PostLeaderboardEntry : MonoBehaviour
{
public string internalName;
public string leaderboardInternalName;

public async void OnButtonClick()
{
Expand All @@ -14,10 +14,16 @@ public async void OnButtonClick()

private async Task PostEntry()
{
if (string.IsNullOrEmpty(leaderboardInternalName))
{
ResponseMessage.SetText("leaderboardInternalName not set on AddEntryButton");
return;
}

try
{
int score = UnityEngine.Random.Range(0, 10000);
(LeaderboardEntry entry, bool updated) = await Talo.Leaderboards.AddEntry(internalName, score);
(LeaderboardEntry entry, bool updated) = await Talo.Leaderboards.AddEntry(leaderboardInternalName, score);

ResponseMessage.SetText($"Entry with score {score} added, position is {entry.position}, it was {(updated ? "" : "not")} updated");
}
Expand Down
19 changes: 0 additions & 19 deletions Assets/Samples/Playground/Scripts/Players/DeleteHealthProp.cs

This file was deleted.

34 changes: 34 additions & 0 deletions Assets/Samples/Playground/Scripts/Players/DeleteProp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using UnityEngine;
using TaloGameServices;
using System.Threading.Tasks;
using System;

public class DeleteHealthProp : MonoBehaviour
{
public string key;

public async void OnButtonClick()
{
await DeleteProp();
}

private async Task DeleteProp()
{
if (string.IsNullOrEmpty(key))
{
ResponseMessage.SetText("key not set on DeletePropButton");
return;
}

try
{
await Talo.CurrentPlayer.DeleteProp(key);
ResponseMessage.SetText($"{key} deleted");
}
catch (Exception err)
{
ResponseMessage.SetText(err.Message);
throw err;
}
}
}
21 changes: 10 additions & 11 deletions Assets/Samples/Playground/Scripts/Players/GetGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@ public async void OnButtonClick()
{
if (string.IsNullOrEmpty(groupId))
{
ResponseMessage.SetText("groupId not set on 'Get group' button");
ResponseMessage.SetText("groupId not set on GetGroupButton");
return;
}
else

try
{
var group = await Talo.PlayerGroups.Get(groupId);
ResponseMessage.SetText($"{group.name} has {group.count} player(s)");
}
catch (Exception e)
{
try
{
var group = await Talo.PlayerGroups.Get(groupId);
ResponseMessage.SetText($"{group.name} has {group.count} player(s)");
}
catch (Exception e)
{
ResponseMessage.SetText(e.Message);
}
ResponseMessage.SetText(e.Message);
}
}
}
8 changes: 7 additions & 1 deletion Assets/Samples/Playground/Scripts/Players/IdentifyPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public async void OnButtonClick()

private async Task Identify()
{
if (string.IsNullOrEmpty(service) || string.IsNullOrEmpty(identifier))
{
ResponseMessage.SetText("service or identifier not set on IdentifyButton");
return;
}

try
{
await Talo.Players.Identify(service, identifier);
Expand All @@ -37,7 +43,7 @@ private void OnIdentified(Player player)
if (panel != null)
{
ResponseMessage.SetText("Identified!");
panel.GetComponent<Image>().color = new Color(135 / 255f, 1f, 135 / 255f);
panel.GetComponent<Image>().color = new Color(120 / 255f, 230 / 255f, 160 / 255f);
}
}
}
21 changes: 0 additions & 21 deletions Assets/Samples/Playground/Scripts/Players/SetHealthProp.cs

This file was deleted.

33 changes: 33 additions & 0 deletions Assets/Samples/Playground/Scripts/Players/SetProp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using UnityEngine;
using TaloGameServices;
using System.Threading.Tasks;

public class SetProp : MonoBehaviour
{
public string key, value;

public async void OnButtonClick()
{
await UpdateProp();
}

private async Task UpdateProp()
{
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value))
{
ResponseMessage.SetText("key or value not set on SetPropButton");
return;
}

try
{
await Talo.CurrentPlayer.SetProp(key, value);
ResponseMessage.SetText($"{key} set to {value}");
}
catch (System.Exception err)
{
ResponseMessage.SetText(err.Message);
throw err;
}
}
}
6 changes: 6 additions & 0 deletions Assets/Samples/Playground/Scripts/Stats/TrackStat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ public void OnButtonClick()

private async void Track()
{
if (string.IsNullOrEmpty(statInternalName))
{
ResponseMessage.SetText("statInternalName not set on TrackStatButton");
return;
}

try
{
await Talo.Stats.Track(statInternalName, change);
Expand Down
4 changes: 2 additions & 2 deletions Packages/com.trytalo.talo/Runtime/APIs/FeedbackAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public async Task<FeedbackCategory[]> GetCategories()
return res.feedbackCategories;
}

public async Task Send(string internalName, string comment)
public async Task Send(string categoryInternalName, string comment)
{
Talo.IdentityCheck();

var uri = new Uri($"{baseUrl}/categories/{internalName}");
var uri = new Uri($"{baseUrl}/categories/{categoryInternalName}");
var content = JsonUtility.ToJson(new FeedbackPostRequest { comment = comment });

await Call(uri, "POST", content);
Expand Down
2 changes: 1 addition & 1 deletion Packages/com.trytalo.talo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.trytalo.talo",
"version": "0.26.0",
"version": "0.27.0",
"displayName": "Talo Game Services",
"description": "Talo (https://trytalo.com) is an open-source game backend with services designed to help you build games faster. You can currently:\n\n- Identify and authenticate players\n- Store persistent data across players\n- Track events (levelling up, finding loot, etc)\n- Display high scores with leaderboards\n- Store and load player saves\n- Load game config options and flags from the cloud\n- Get feedback directly from your players",
"unity": "2022.3",
Expand Down