PageRenderTime 58ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/Project - Playfab Tutorial/Assets/PlayFabEditorExtensions/Editor/Scripts/PlayFabEditorSDK/PlayFabEditorModels.cs

https://gitlab.com/4t0m1c/playfab-tutorials
C# | 463 lines | 427 code | 36 blank | 0 comment | 14 complexity | 21154c2e49f139bcc67ccbda69b6477a MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace PlayFab.PfEditor.EditorModels
  5. {
  6. public class RegisterAccountRequest
  7. {
  8. public string Email;
  9. public string Password;
  10. public string StudioName;
  11. public string DeveloperToolProductName;
  12. public string DeveloperToolProductVersion;
  13. }
  14. public class RegisterAccountResult
  15. {
  16. public string DeveloperClientToken;
  17. }
  18. public class LoginRequest
  19. {
  20. public string Email;
  21. public string Password;
  22. public string TwoFactorAuth;
  23. public string DeveloperToolProductName;
  24. public string DeveloperToolProductVersion;
  25. }
  26. public class LoginResult
  27. {
  28. public string DeveloperClientToken;
  29. }
  30. public class LogoutRequest
  31. {
  32. public string DeveloperClientToken;
  33. }
  34. public class LogoutResult
  35. {
  36. }
  37. public class GetStudiosRequest
  38. {
  39. public string DeveloperClientToken;
  40. }
  41. public class GetStudiosResult
  42. {
  43. public Studio[] Studios;
  44. }
  45. public class CreateTitleRequest
  46. {
  47. public string DeveloperClientToken;
  48. public string Name;
  49. public string StudioId;
  50. }
  51. public class CreateTitleResult
  52. {
  53. public Title Title;
  54. }
  55. public class Title
  56. {
  57. public string Id;
  58. public string Name;
  59. public string SecretKey;
  60. public string GameManagerUrl;
  61. }
  62. public class Studio
  63. {
  64. public static Studio OVERRIDE = new Studio { Id = "", Name = PlayFabEditorHelper.STUDIO_OVERRIDE, Titles = null };
  65. public string Id;
  66. public string Name;
  67. public Title[] Titles;
  68. public Title GetTitle(string titleId)
  69. {
  70. if (Titles == null)
  71. return null;
  72. for (var i = 0; i < Titles.Length; i++)
  73. if (Titles[i].Id == titleId)
  74. return Titles[i];
  75. return null;
  76. }
  77. public string GetTitleSecretKey(string titleId)
  78. {
  79. var title = GetTitle(titleId);
  80. return title == null ? "" : title.SecretKey;
  81. }
  82. }
  83. public class GetTitleDataRequest
  84. {
  85. public List<string> Keys;
  86. }
  87. public class GetTitleDataResult
  88. {
  89. public Dictionary<string, string> Data;
  90. }
  91. public class SetTitleDataRequest
  92. {
  93. public string Key;
  94. public string Value;
  95. }
  96. public class SetTitleDataResult
  97. {
  98. }
  99. public class CloudScriptFile
  100. {
  101. public string Filename;
  102. public string FileContents;
  103. }
  104. public class UpdateCloudScriptRequest
  105. {
  106. public List<CloudScriptFile> Files;
  107. public bool Publish;
  108. public string DeveloperPlayFabId;
  109. }
  110. public class UpdateCloudScriptResult
  111. {
  112. public int Version;
  113. public int Revision;
  114. }
  115. public class GetCloudScriptRevisionRequest
  116. {
  117. public int? Version;
  118. public int? Revision;
  119. }
  120. public class GetCloudScriptRevisionResult
  121. {
  122. public int Version;
  123. public int Revision;
  124. public System.DateTime CreatedAt;
  125. public List<CloudScriptFile> Files;
  126. public bool IsPublished;
  127. }
  128. public class PlayFabError
  129. {
  130. public int HttpCode;
  131. public string HttpStatus;
  132. public PlayFabErrorCode Error;
  133. public string ErrorMessage;
  134. public Dictionary<string, List<string>> ErrorDetails;
  135. public object CustomData;
  136. [ThreadStatic]
  137. private static StringBuilder _tempSb;
  138. public string GenerateErrorReport()
  139. {
  140. if (_tempSb == null)
  141. _tempSb = new StringBuilder();
  142. _tempSb.Length = 0;
  143. _tempSb.Append(ErrorMessage);
  144. if (ErrorDetails != null)
  145. foreach (var pair in ErrorDetails)
  146. foreach (var msg in pair.Value)
  147. _tempSb.Append("\n").Append(pair.Key).Append(": ").Append(msg);
  148. return _tempSb.ToString();
  149. }
  150. }
  151. public class HttpResponseObject
  152. {
  153. public int code;
  154. public string status;
  155. public object data;
  156. }
  157. public enum PlayFabErrorCode
  158. {
  159. Unknown = 1,
  160. Success = 0,
  161. InvalidParams = 1000,
  162. AccountNotFound = 1001,
  163. AccountBanned = 1002,
  164. InvalidUsernameOrPassword = 1003,
  165. InvalidTitleId = 1004,
  166. InvalidEmailAddress = 1005,
  167. EmailAddressNotAvailable = 1006,
  168. InvalidUsername = 1007,
  169. InvalidPassword = 1008,
  170. UsernameNotAvailable = 1009,
  171. InvalidSteamTicket = 1010,
  172. AccountAlreadyLinked = 1011,
  173. LinkedAccountAlreadyClaimed = 1012,
  174. InvalidFacebookToken = 1013,
  175. AccountNotLinked = 1014,
  176. FailedByPaymentProvider = 1015,
  177. CouponCodeNotFound = 1016,
  178. InvalidContainerItem = 1017,
  179. ContainerNotOwned = 1018,
  180. KeyNotOwned = 1019,
  181. InvalidItemIdInTable = 1020,
  182. InvalidReceipt = 1021,
  183. ReceiptAlreadyUsed = 1022,
  184. ReceiptCancelled = 1023,
  185. GameNotFound = 1024,
  186. GameModeNotFound = 1025,
  187. InvalidGoogleToken = 1026,
  188. UserIsNotPartOfDeveloper = 1027,
  189. InvalidTitleForDeveloper = 1028,
  190. TitleNameConflicts = 1029,
  191. UserisNotValid = 1030,
  192. ValueAlreadyExists = 1031,
  193. BuildNotFound = 1032,
  194. PlayerNotInGame = 1033,
  195. InvalidTicket = 1034,
  196. InvalidDeveloper = 1035,
  197. InvalidOrderInfo = 1036,
  198. RegistrationIncomplete = 1037,
  199. InvalidPlatform = 1038,
  200. UnknownError = 1039,
  201. SteamApplicationNotOwned = 1040,
  202. WrongSteamAccount = 1041,
  203. TitleNotActivated = 1042,
  204. RegistrationSessionNotFound = 1043,
  205. NoSuchMod = 1044,
  206. FileNotFound = 1045,
  207. DuplicateEmail = 1046,
  208. ItemNotFound = 1047,
  209. ItemNotOwned = 1048,
  210. ItemNotRecycleable = 1049,
  211. ItemNotAffordable = 1050,
  212. InvalidVirtualCurrency = 1051,
  213. WrongVirtualCurrency = 1052,
  214. WrongPrice = 1053,
  215. NonPositiveValue = 1054,
  216. InvalidRegion = 1055,
  217. RegionAtCapacity = 1056,
  218. ServerFailedToStart = 1057,
  219. NameNotAvailable = 1058,
  220. InsufficientFunds = 1059,
  221. InvalidDeviceID = 1060,
  222. InvalidPushNotificationToken = 1061,
  223. NoRemainingUses = 1062,
  224. InvalidPaymentProvider = 1063,
  225. PurchaseInitializationFailure = 1064,
  226. DuplicateUsername = 1065,
  227. InvalidBuyerInfo = 1066,
  228. NoGameModeParamsSet = 1067,
  229. BodyTooLarge = 1068,
  230. ReservedWordInBody = 1069,
  231. InvalidTypeInBody = 1070,
  232. InvalidRequest = 1071,
  233. ReservedEventName = 1072,
  234. InvalidUserStatistics = 1073,
  235. NotAuthenticated = 1074,
  236. StreamAlreadyExists = 1075,
  237. ErrorCreatingStream = 1076,
  238. StreamNotFound = 1077,
  239. InvalidAccount = 1078,
  240. PurchaseDoesNotExist = 1080,
  241. InvalidPurchaseTransactionStatus = 1081,
  242. APINotEnabledForGameClientAccess = 1082,
  243. NoPushNotificationARNForTitle = 1083,
  244. BuildAlreadyExists = 1084,
  245. BuildPackageDoesNotExist = 1085,
  246. CustomAnalyticsEventsNotEnabledForTitle = 1087,
  247. InvalidSharedGroupId = 1088,
  248. NotAuthorized = 1089,
  249. MissingTitleGoogleProperties = 1090,
  250. InvalidItemProperties = 1091,
  251. InvalidPSNAuthCode = 1092,
  252. InvalidItemId = 1093,
  253. PushNotEnabledForAccount = 1094,
  254. PushServiceError = 1095,
  255. ReceiptDoesNotContainInAppItems = 1096,
  256. ReceiptContainsMultipleInAppItems = 1097,
  257. InvalidBundleID = 1098,
  258. JavascriptException = 1099,
  259. InvalidSessionTicket = 1100,
  260. UnableToConnectToDatabase = 1101,
  261. InternalServerError = 1110,
  262. InvalidReportDate = 1111,
  263. ReportNotAvailable = 1112,
  264. DatabaseThroughputExceeded = 1113,
  265. InvalidLobbyId = 1114,
  266. InvalidGameTicket = 1115,
  267. ExpiredGameTicket = 1116,
  268. GameTicketDoesNotMatchLobby = 1117,
  269. LinkedDeviceAlreadyClaimed = 1118,
  270. DeviceAlreadyLinked = 1119,
  271. DeviceNotLinked = 1120,
  272. PartialFailure = 1121,
  273. PublisherNotSet = 1122,
  274. ServiceUnavailable = 1123,
  275. VersionNotFound = 1124,
  276. RevisionNotFound = 1125,
  277. InvalidPublisherId = 1126,
  278. DownstreamServiceUnavailable = 1127,
  279. APINotIncludedInTitleUsageTier = 1128,
  280. DAULimitExceeded = 1129,
  281. APIRequestLimitExceeded = 1130,
  282. InvalidAPIEndpoint = 1131,
  283. BuildNotAvailable = 1132,
  284. ConcurrentEditError = 1133,
  285. ContentNotFound = 1134,
  286. CharacterNotFound = 1135,
  287. CloudScriptNotFound = 1136,
  288. ContentQuotaExceeded = 1137,
  289. InvalidCharacterStatistics = 1138,
  290. PhotonNotEnabledForTitle = 1139,
  291. PhotonApplicationNotFound = 1140,
  292. PhotonApplicationNotAssociatedWithTitle = 1141,
  293. InvalidEmailOrPassword = 1142,
  294. FacebookAPIError = 1143,
  295. InvalidContentType = 1144,
  296. KeyLengthExceeded = 1145,
  297. DataLengthExceeded = 1146,
  298. TooManyKeys = 1147,
  299. FreeTierCannotHaveVirtualCurrency = 1148,
  300. MissingAmazonSharedKey = 1149,
  301. AmazonValidationError = 1150,
  302. InvalidPSNIssuerId = 1151,
  303. PSNInaccessible = 1152,
  304. ExpiredAuthToken = 1153,
  305. FailedToGetEntitlements = 1154,
  306. FailedToConsumeEntitlement = 1155,
  307. TradeAcceptingUserNotAllowed = 1156,
  308. TradeInventoryItemIsAssignedToCharacter = 1157,
  309. TradeInventoryItemIsBundle = 1158,
  310. TradeStatusNotValidForCancelling = 1159,
  311. TradeStatusNotValidForAccepting = 1160,
  312. TradeDoesNotExist = 1161,
  313. TradeCancelled = 1162,
  314. TradeAlreadyFilled = 1163,
  315. TradeWaitForStatusTimeout = 1164,
  316. TradeInventoryItemExpired = 1165,
  317. TradeMissingOfferedAndAcceptedItems = 1166,
  318. TradeAcceptedItemIsBundle = 1167,
  319. TradeAcceptedItemIsStackable = 1168,
  320. TradeInventoryItemInvalidStatus = 1169,
  321. TradeAcceptedCatalogItemInvalid = 1170,
  322. TradeAllowedUsersInvalid = 1171,
  323. TradeInventoryItemDoesNotExist = 1172,
  324. TradeInventoryItemIsConsumed = 1173,
  325. TradeInventoryItemIsStackable = 1174,
  326. TradeAcceptedItemsMismatch = 1175,
  327. InvalidKongregateToken = 1176,
  328. FeatureNotConfiguredForTitle = 1177,
  329. NoMatchingCatalogItemForReceipt = 1178,
  330. InvalidCurrencyCode = 1179,
  331. NoRealMoneyPriceForCatalogItem = 1180,
  332. TradeInventoryItemIsNotTradable = 1181,
  333. TradeAcceptedCatalogItemIsNotTradable = 1182,
  334. UsersAlreadyFriends = 1183,
  335. LinkedIdentifierAlreadyClaimed = 1184,
  336. CustomIdNotLinked = 1185,
  337. TotalDataSizeExceeded = 1186,
  338. DeleteKeyConflict = 1187,
  339. InvalidXboxLiveToken = 1188,
  340. ExpiredXboxLiveToken = 1189,
  341. ResettableStatisticVersionRequired = 1190,
  342. NotAuthorizedByTitle = 1191,
  343. NoPartnerEnabled = 1192,
  344. InvalidPartnerResponse = 1193,
  345. APINotEnabledForGameServerAccess = 1194,
  346. StatisticNotFound = 1195,
  347. StatisticNameConflict = 1196,
  348. StatisticVersionClosedForWrites = 1197,
  349. StatisticVersionInvalid = 1198,
  350. APIClientRequestRateLimitExceeded = 1199,
  351. InvalidJSONContent = 1200,
  352. InvalidDropTable = 1201,
  353. StatisticVersionAlreadyIncrementedForScheduledInterval = 1202,
  354. StatisticCountLimitExceeded = 1203,
  355. StatisticVersionIncrementRateExceeded = 1204,
  356. ContainerKeyInvalid = 1205,
  357. CloudScriptExecutionTimeLimitExceeded = 1206,
  358. NoWritePermissionsForEvent = 1207,
  359. CloudScriptFunctionArgumentSizeExceeded = 1208,
  360. CloudScriptAPIRequestCountExceeded = 1209,
  361. CloudScriptAPIRequestError = 1210,
  362. CloudScriptHTTPRequestError = 1211,
  363. InsufficientGuildRole = 1212,
  364. GuildNotFound = 1213,
  365. OverLimit = 1214,
  366. EventNotFound = 1215,
  367. InvalidEventField = 1216,
  368. InvalidEventName = 1217,
  369. CatalogNotConfigured = 1218,
  370. OperationNotSupportedForPlatform = 1219,
  371. SegmentNotFound = 1220,
  372. StoreNotFound = 1221,
  373. InvalidStatisticName = 1222,
  374. TitleNotQualifiedForLimit = 1223,
  375. InvalidServiceLimitLevel = 1224,
  376. ServiceLimitLevelInTransition = 1225,
  377. CouponAlreadyRedeemed = 1226,
  378. GameServerBuildSizeLimitExceeded = 1227,
  379. GameServerBuildCountLimitExceeded = 1228,
  380. VirtualCurrencyCountLimitExceeded = 1229,
  381. VirtualCurrencyCodeExists = 1230,
  382. TitleNewsItemCountLimitExceeded = 1231,
  383. InvalidTwitchToken = 1232,
  384. TwitchResponseError = 1233,
  385. ProfaneDisplayName = 1234,
  386. TwoFactorAuthenticationTokenRequired = 1246
  387. }
  388. #region Misc UI Models
  389. public class StudioDisplaySet
  390. {
  391. public PlayFab.PfEditor.EditorModels.Studio Studio;
  392. public bool isCollapsed = true;
  393. public Dictionary<string, TitleDisplaySet> titleFoldOutStates = new Dictionary<string, TitleDisplaySet>();
  394. }
  395. public class TitleDisplaySet
  396. {
  397. public PlayFab.PfEditor.EditorModels.Title Title;
  398. public bool isCollapsed = true;
  399. }
  400. public class KvpItem
  401. {
  402. public string Key;
  403. public string Value;
  404. public string _prvKey;
  405. public string _prvValue;
  406. public bool isDirty;
  407. public KvpItem(string k, string v)
  408. {
  409. Key = k;
  410. Value = v;
  411. _prvKey = k;
  412. _prvValue = v;
  413. }
  414. public void CleanItem()
  415. {
  416. _prvKey = Key;
  417. _prvValue = Value;
  418. isDirty = false;
  419. }
  420. public void DataEditedCheck()
  421. {
  422. if (Key != _prvKey || Value != _prvValue)
  423. isDirty = true;
  424. }
  425. }
  426. #endregion
  427. }