leopard8352
2023-12-04 8871a733498c8d717714b83bb096b7738224541a
提交 | 用户 | 时间
8871a7 1 // Fill out your copyright notice in the Description page of Project Settings.
L 2
3 #pragma once
4
5 #include "CoreMinimal.h"
6 #include "Define/TapCDKeyResponse.h"
7 #include "Interfaces/IHttpRequest.h"
8 #include "UObject/Object.h"
9 #include "HttpTapCDKey.generated.h"
10
11
12 class IHttpResponse;
13 class IHttpRequest;
14
15 UCLASS(BlueprintType,Blueprintable)
16 class TAPTAP_API UHttpTapCDKey : public UObject
17 {
18     GENERATED_BODY()
19     
20 public:
21
22     DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FHttpTapCDKeyRequestSuccessEventHandle,
23         const FTapCDKeyResponse&,resp,
24         int32,errCode,
25         bool,isSuccess);
26     UPROPERTY(BlueprintAssignable)
27     FHttpTapCDKeyRequestSuccessEventHandle HttpTapCDKeyRequestSuccessEventHandle;
28
29     void OnProcessRequestComplete(
30         TSharedPtr<IHttpRequest, ESPMode::ThreadSafe> request,
31         TSharedPtr<IHttpResponse, ESPMode::ThreadSafe> response, bool arg) const;
32
33     /**
34      * @brief 请求taptap的cdkey,请求结束后会回调HttpTapCDKeyRequestSuccessEventHandle事件
35      * @param key 请求的cdkey
36      */
37     UFUNCTION(BlueprintCallable)
38     void StartRequest(
39         const FString& key);
40
41     /**
42      * @brief 生成时间戳(13位)
43      * @return 
44      */
45     UFUNCTION(BlueprintCallable)
46     int64 SpawnTimeStamp();
47
48     /**
49      * @brief 根据时间戳,ClientID和CharacterID获取taptapcdkey的签名
50      * @param timestamp 
51      * @return 
52      */
53     UFUNCTION(BlueprintPure,BlueprintNativeEvent)
54     FString GetSign(int64 timestamp) const;
55
56     UPROPERTY(EditAnywhere,BlueprintReadWrite)
57     FString ClientID;
58
59     /**
60      * @brief taptapCDKey参数 - CharacterID
61      */
62     UPROPERTY(EditAnywhere,BlueprintReadWrite)
63     FString CharacterID;
64
65     /**
66      * @brief taptapCDKey验证用的随机字符串
67      */
68     UPROPERTY(EditAnywhere,BlueprintReadWrite)
69     FString NonceStr = TEXT("Noces");
70
71     /**
72      * @brief 请求Timeout时间,秒.超过此时间后会返回失败
73      */
74     UPROPERTY(EditAnywhere,BlueprintReadWrite)
75     int32 TimeOut = 5;
76 };