Skip to content
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
235 changes: 231 additions & 4 deletions Assets/Samples/Playground/Scenes/Playground.unity
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ RectTransform:
- {fileID: 41042924}
- {fileID: 1810825303}
- {fileID: 1484174634}
- {fileID: 414252746}
m_Father: {fileID: 2079681527}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
Expand Down Expand Up @@ -647,6 +648,85 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: eeab45c0be5c343c68f0df33c440919c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &131549789
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 131549790}
- component: {fileID: 131549792}
- component: {fileID: 131549791}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &131549790
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 131549789}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 414252746}
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}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &131549791
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 131549789}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, 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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
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: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Get group
--- !u!222 &131549792
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 131549789}
m_CullTransparentMesh: 1
--- !u!1 &324014309
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1019,6 +1099,153 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 376592790}
m_CullTransparentMesh: 1
--- !u!1 &414252745
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 414252746}
- component: {fileID: 414252750}
- component: {fileID: 414252749}
- component: {fileID: 414252748}
- component: {fileID: 414252751}
m_Layer: 5
m_Name: Get group
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &414252746
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414252745}
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 131549790}
m_Father: {fileID: 13014977}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &414252748
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414252745}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
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_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, 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_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 414252749}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 414252751}
m_TargetAssemblyTypeName: GetGroup, Assembly-CSharp
m_MethodName: OnButtonClick
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
--- !u!114 &414252749
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414252745}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, 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
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &414252750
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414252745}
m_CullTransparentMesh: 1
--- !u!114 &414252751
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414252745}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3ac5ee86ce1ba48ca84820db7452e975, type: 3}
m_Name:
m_EditorClassIdentifier:
groupId:
--- !u!1 &496913033
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1476,7 +1703,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Set Health
m_Text: Set health
--- !u!222 &520760485
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3101,7 +3328,7 @@ GameObject:
- component: {fileID: 1484174636}
- component: {fileID: 1484174635}
m_Layer: 5
m_Name: Delete Prop
m_Name: Delete prop
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -3841,7 +4068,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Delete Health
m_Text: Delete health
--- !u!222 &1720564335
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3967,7 +4194,7 @@ GameObject:
- component: {fileID: 1810825305}
- component: {fileID: 1810825304}
m_Layer: 5
m_Name: Set Prop
m_Name: Set prop
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down
28 changes: 28 additions & 0 deletions Assets/Samples/Playground/Scripts/Players/GetGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using TaloGameServices;
using UnityEngine;

public class GetGroup : MonoBehaviour
{
public string groupId;

public async void OnButtonClick()
{
if (string.IsNullOrEmpty(groupId))
{
ResponseMessage.SetText("groupId not set on 'Get group' button");
}
else
{
try
{
var group = await Talo.PlayerGroups.Get(groupId);
ResponseMessage.SetText($"{group.name} has {group.count} player(s)");
}
catch (Exception e)
{
ResponseMessage.SetText(e.Message);
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Samples/Playground/Scripts/Players/GetGroup.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Packages/com.trytalo.talo/Runtime/APIs/PlayerGroupsAPI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Threading.Tasks;
using UnityEngine;

namespace TaloGameServices
{
public class PlayerGroupsAPI : BaseAPI
{
public PlayerGroupsAPI() : base("v1/player-groups") { }

public async Task<Group> Get(string groupId)
{
var uri = new Uri($"{baseUrl}/{groupId}");
var json = await Call(uri, "GET");

var res = JsonUtility.FromJson<PlayerGroupsGetResponse>(json);
return res.group;
}
}
}
11 changes: 11 additions & 0 deletions Packages/com.trytalo.talo/Runtime/APIs/PlayerGroupsAPI.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Packages/com.trytalo.talo/Runtime/Entities/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
[System.Serializable]
public class Group
{
public string id, name;
public string id;
public string name;
public string description;
public object[] rules;
public string ruleMode;
public bool membersVisible;
public int count;
public Player[] members;
public string updatedAt;
}

}
2 changes: 1 addition & 1 deletion Packages/com.trytalo.talo/Runtime/Entities/Group.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Packages/com.trytalo.talo/Runtime/Entities/GroupStub.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TaloGameServices
{
[System.Serializable]
public class GroupStub
{
public string id, name;
}
}
Loading