AkWaapiJsonManager.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. /*=============================================================================
  16. UAkWaapiCalls.h
  17. =============================================================================*/
  18. #pragma once
  19. #include "AkInclude.h"
  20. #include "Kismet/BlueprintFunctionLibrary.h"
  21. #include "AkWaapiUri.h"
  22. #include "Dom/JsonObject.h"
  23. #include "AkWaapiUtils.h"
  24. #include "Serialization/JsonWriter.h"
  25. #include "Serialization/JsonSerializer.h"
  26. #include "AkWaapiBlueprints/AkWaapiFieldNames.h"
  27. #include "AkWaapiJsonManager.generated.h"
  28. USTRUCT(BlueprintType)
  29. struct AKAUDIO_API FAKWaapiJsonObject
  30. {
  31. GENERATED_BODY()
  32. FAKWaapiJsonObject()
  33. {
  34. WaapiJsonObj = MakeShareable(new FJsonObject());
  35. }
  36. TSharedPtr<FJsonObject> WaapiJsonObj;
  37. };
  38. UCLASS()
  39. class AKAUDIO_API UAkWaapiJsonManager : public UBlueprintFunctionLibrary
  40. {
  41. GENERATED_BODY()
  42. public:
  43. UAkWaapiJsonManager(const class FObjectInitializer& ObjectInitializer);
  44. /** Add a String field named FieldName with value of FieldValue */
  45. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  46. static FAKWaapiJsonObject SetStringField(const FAkWaapiFieldNames& FieldName, const FString& FieldValue, FAKWaapiJsonObject target);
  47. /** Set a boolean field named FieldName and value of FieldValue */
  48. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  49. static FAKWaapiJsonObject SetBoolField(const FAkWaapiFieldNames& FieldName, bool FieldValue, FAKWaapiJsonObject target);
  50. /** Add a field named FieldName with Number as FieldValue */
  51. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  52. static FAKWaapiJsonObject SetNumberField(const FAkWaapiFieldNames& FieldName, float FieldValue, FAKWaapiJsonObject target);
  53. /** Set an ObjectField named FieldName and value of FieldValue */
  54. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  55. static FAKWaapiJsonObject SetObjectField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject FieldValue, FAKWaapiJsonObject target);
  56. /** Add an array of String field named FieldName with value of FieldStringValues */
  57. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  58. static FAKWaapiJsonObject SetArrayStringFields(const FAkWaapiFieldNames& FieldName, const TArray< FString >& FieldStringValues, FAKWaapiJsonObject target);
  59. /** Set an array of ObjectField named FieldName and value of FieldObjectValues */
  60. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  61. static FAKWaapiJsonObject SetArrayObjectFields(const FAkWaapiFieldNames& FieldName, const TArray< FAKWaapiJsonObject >& FieldObjectValues, FAKWaapiJsonObject target);
  62. /** Get the field named FieldName as a string. */
  63. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  64. static FString GetStringField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject target);
  65. /** Gets the field with the specified name as a boolean. */
  66. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  67. static bool GetBoolField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject target);
  68. /** Gets the field with the specified name as a number. */
  69. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  70. static float GetNumberField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject target);
  71. /** Gets a numeric field and casts to an int32 */
  72. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  73. static int32 GetIntegerField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject target);
  74. /** Gets the field with the specified name as a Json object. */
  75. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  76. static FAKWaapiJsonObject GetObjectField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject target);
  77. /** Get the field named FieldName as an array. */
  78. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WaapiJsonManager")
  79. static const TArray<FAKWaapiJsonObject > GetArrayField(const FAkWaapiFieldNames& FieldName, FAKWaapiJsonObject target);
  80. /** Converts an AKWaapiJsonObject value to a string */
  81. UFUNCTION(BlueprintPure, meta = (DisplayName = "ToString (FAKWaapiJsonObject)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Utilities|String")
  82. static FString Conv_FAKWaapiJsonObjectToString(FAKWaapiJsonObject INAKWaapiJsonObject);
  83. /** Converts an AKWaapiJsonObject value to a localizable text */
  84. UFUNCTION(BlueprintPure, meta = (DisplayName = "ToText (FAKWaapiJsonObject)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Utilities|Text")
  85. static FText Conv_FAKWaapiJsonObjectToText(FAKWaapiJsonObject INAKWaapiJsonObject);
  86. };