Skip to content

Commit 5927428

Browse files
committed
Folder Restructuring
1 parent 5e76d53 commit 5927428

File tree

640 files changed

+14824
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

640 files changed

+14824
-624
lines changed

Assets/LootLocker.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/LootLocker/Common/LootLockerConfig.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
using System;
1+
using LootLocker.Requests;
2+
using System;
23
using System.Collections;
34
using System.Collections.Generic;
45
using UnityEngine;
56

67
namespace LootLocker
78
{
9+
public class LocalPlayer : ILootLockerStageData
10+
{
11+
public string playerName, uniqueID;
12+
public LootLockerCharacter characterClass;
13+
14+
}
15+
816
public class LootLockerConfig : LootLockerGenericConfig
917
{
1018

Assets/LootLocker/Common/LootLockerEndPoints.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public class LootLockerEndPoints : ScriptableObject
4040

4141
//Character
4242
[Header("Character Endpoints")]
43+
public EndPointClass createCharacter;
44+
public EndPointClass listCharacterTypes;
4345
public EndPointClass characterLoadouts;
4446
public EndPointClass getOtherPlayersCharacterLoadouts;
4547
public EndPointClass updateCharacter;

Assets/LootLocker/Common/LootLockerGenericConfig.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ public class LootLockerGenericConfig : ScriptableObject
2020
public string deviceID = "defaultPlayerId";
2121
[HideInInspector]
2222
public string email, password;
23-
[HideInInspector]
24-
public string playerName;
25-
[HideInInspector]
26-
public string playerClass;
2723
public platformType platform;
2824
public environmentType environment;
2925
public enum environmentType { Development, Live }

Assets/LootLocker/Game/LootLockerSDKManager.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,25 @@ public static void SetProfilePublic(Action<LootLockerStandardResponse> onComplet
201201
#endregion
202202

203203
#region Character
204+
public static void CreateCharacter(string characterTypeId, string newCharacterName, bool isDefault, Action<LootLockerCharacterLoadoutResponse> onComplete)
205+
{
206+
if (!CheckInitialized()) return;
207+
208+
LootLockerCreateCharacterRequest data = new LootLockerCreateCharacterRequest();
209+
210+
data.name = newCharacterName;
211+
data.is_default = isDefault;
212+
data.character_type_id = characterTypeId;
213+
214+
LootLockerAPIManager.CreateCharacter(data,onComplete);
215+
}
216+
217+
public static void ListCharacterTypes(Action<LootLockerListCharacterTypesResponse> onComplete)
218+
{
219+
if (!CheckInitialized()) return;
220+
LootLockerAPIManager.ListCharacterTypes(onComplete);
221+
}
222+
204223
public static void GetCharacterLoadout(Action<LootLockerCharacterLoadoutResponse> onComplete)
205224
{
206225
if (!CheckInitialized()) return;

Assets/LootLocker/Game/Requests/CharacterRequest.cs

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ public LootLockerCommonAsset[] GetAssets()
3030
}
3131
}
3232

33+
34+
public class LootLockerListCharacterTypesResponse : LootLockerResponse
35+
{
36+
public bool success { get; set; }
37+
public LootLockerCharacter_Types[] character_types { get; set; }
38+
}
39+
40+
[Serializable]
41+
public class LootLockerCharacter_Types
42+
{
43+
public int id;
44+
public bool is_default;
45+
public string name;
46+
}
47+
48+
3349
public class LootLockerDefaultCharacterLoadout
3450
{
3551
public int variation_id { get; set; }
@@ -54,7 +70,13 @@ public class LootLockerUpdateCharacterRequest
5470
public string type { get; set; }
5571

5672
}
73+
public class LootLockerCreateCharacterRequest
74+
{
75+
public bool is_default { get; set; }
76+
public string name { get; set; }
77+
public string character_type_id { get; set; }
5778

79+
}
5880
public class LootLockerEquipByIDRequest
5981
{
6082
public int instance_id { get; set; }
@@ -71,20 +93,26 @@ public class LootLockerCharacterLoadoutResponse : LootLockerResponse
7193
{
7294
public bool success { get; set; }
7395
public LootLockerLootLockerLoadout[] loadouts { get; set; }
74-
}
7596

97+
public LootLockerCharacter GetCharacter(string name)
98+
{
99+
LootLockerCharacter lootLockerCharacter = loadouts.FirstOrDefault(x => x.character.name == name)?.character;
100+
return lootLockerCharacter;
101+
}
102+
}
103+
[Serializable]
76104
public class LootLockerLootLockerLoadout : ILootLockerStageData
77105
{
78106
public LootLockerCharacter character { get; set; }
79107
public LootLockerLoadouts[] loadout { get; set; }
80108
}
81-
109+
[Serializable]
82110
public class LootLockerCharacter
83111
{
84-
public int id { get; set; }
85-
public string type { get; set; }
86-
public string name { get; set; }
87-
public bool is_default { get; set; }
112+
public int id;
113+
public string type;
114+
public string name;
115+
public bool is_default;
88116
}
89117

90118
public class LootLockerCharacterAsset
@@ -98,6 +126,56 @@ namespace LootLocker
98126
{
99127
public partial class LootLockerAPIManager
100128
{
129+
public static void CreateCharacter(LootLockerCreateCharacterRequest data, Action<LootLockerCharacterLoadoutResponse> onComplete)
130+
{
131+
EndPointClass endPoint = LootLockerEndPoints.current.createCharacter;
132+
133+
string json = (data == null) ? "" : JsonConvert.SerializeObject(data);
134+
135+
string getVariable = endPoint.endPoint;
136+
137+
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, json, (serverResponse) =>
138+
{
139+
LootLockerCharacterLoadoutResponse response = new LootLockerCharacterLoadoutResponse();
140+
if (string.IsNullOrEmpty(serverResponse.Error))
141+
{
142+
response = JsonConvert.DeserializeObject<LootLockerCharacterLoadoutResponse>(serverResponse.text);
143+
response.text = serverResponse.text;
144+
onComplete?.Invoke(response);
145+
}
146+
else
147+
{
148+
response.message = serverResponse.message;
149+
response.Error = serverResponse.Error;
150+
onComplete?.Invoke(response);
151+
}
152+
}, true);
153+
}
154+
155+
public static void ListCharacterTypes(Action<LootLockerListCharacterTypesResponse> onComplete)
156+
{
157+
EndPointClass endPoint = LootLockerEndPoints.current.listCharacterTypes;
158+
159+
string getVariable = endPoint.endPoint;
160+
161+
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, null, (serverResponse) =>
162+
{
163+
LootLockerListCharacterTypesResponse response = new LootLockerListCharacterTypesResponse();
164+
if (string.IsNullOrEmpty(serverResponse.Error))
165+
{
166+
response = JsonConvert.DeserializeObject<LootLockerListCharacterTypesResponse>(serverResponse.text);
167+
response.text = serverResponse.text;
168+
onComplete?.Invoke(response);
169+
}
170+
else
171+
{
172+
response.message = serverResponse.message;
173+
response.Error = serverResponse.Error;
174+
onComplete?.Invoke(response);
175+
}
176+
}, true);
177+
}
178+
101179
public static void GetCharacterLoadout(Action<LootLockerCharacterLoadoutResponse> onComplete)
102180
{
103181
EndPointClass endPoint = LootLockerEndPoints.current.characterLoadouts;

Assets/LootLocker/Game/Resources/Config/LootLockerEndPoints.asset

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ MonoBehaviour:
7575
setProfilePublic:
7676
endPoint: v1/player/profile/public
7777
httpMethod: 1
78+
createCharacter:
79+
endPoint: v1/player/character
80+
httpMethod: 1
81+
listCharacterTypes:
82+
endPoint: v1/player/character/types
83+
httpMethod: 0
7884
characterLoadouts:
7985
endPoint: v1/player/character/loadout
8086
httpMethod: 0
File renamed without changes.

Assets/LootLockerSampleApp/Data.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: a30efcc3e00c617478458831a9fded94, type: 3}
13+
m_Name: PlayerData
14+
m_EditorClassIdentifier:
15+
_playerName:
16+
_playerId:
17+
_playerClass:
18+
_isDefaut: 0
19+
_currentCharacterName:
20+
playerStorageKeyNameToUse: easyPrefabLocalplayers

0 commit comments

Comments
 (0)