From 72d5a33d1453189a14cf2decaf0d8500d9a9a222 Mon Sep 17 00:00:00 2001 From: harryphone Date: Thu, 12 Jan 2023 15:02:57 +0800 Subject: [PATCH] feat: 3.16.5.1 --- AntiAddiction/Config/Game.ini | 4 ++++ .../LeanCloud/Private/Android/Java/LeanCloudUE.java | 11 +++++++++-- LeanCloud/Source/LeanCloud/Private/Android/LCJNI.cpp | 11 ++++++++++- LeanCloud/Source/LeanCloud/Private/LCUser.cpp | 2 +- LeanCloud/Source/LeanCloud/Public/LCUser.h | 2 +- TapBootstrap/Source/TapBootstrap/Private/TDSUser.cpp | 6 +++--- TapBootstrap/Source/TapBootstrap/Public/TDSUser.h | 6 +++--- TapCommon/Config/Game.ini | 5 +++++ TapCommon/Source/TapCommon/Private/android/TapJNI.cpp | 11 ++++++++++- TapCommon/Source/TapCommon/TapCommon.Build.cs | 2 +- TapCommon/Source/TapCommon/Tools/TUHelper.cpp | 8 ++++++++ TapLogin/Config/Game.ini | 3 +++ TapSupport/Config/Game.ini | 3 +++ TapSupport/Source/TapSupport/TapSupport.Build.cs | 2 +- 14 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 AntiAddiction/Config/Game.ini create mode 100644 TapCommon/Config/Game.ini create mode 100644 TapLogin/Config/Game.ini create mode 100644 TapSupport/Config/Game.ini diff --git a/AntiAddiction/Config/Game.ini b/AntiAddiction/Config/Game.ini new file mode 100644 index 0000000..f379719 --- /dev/null +++ b/AntiAddiction/Config/Game.ini @@ -0,0 +1,4 @@ +[/Script/UnrealEd.ProjectPackagingSettings] ++DirectoriesToAlwaysCook=(Path="/AntiAddiction") ++DirectoriesToAlwaysCook=(Path="/AntiAddiction/Images") ++DirectoriesToAlwaysCook=(Path="/AntiAddiction/Styles") \ No newline at end of file diff --git a/LeanCloud/Source/LeanCloud/Private/Android/Java/LeanCloudUE.java b/LeanCloud/Source/LeanCloud/Private/Android/Java/LeanCloudUE.java index 37e21d0..2272ab0 100644 --- a/LeanCloud/Source/LeanCloud/Private/Android/Java/LeanCloudUE.java +++ b/LeanCloud/Source/LeanCloud/Private/Android/Java/LeanCloudUE.java @@ -3,10 +3,17 @@ import cn.leancloud.LeanCloud; import android.app.Activity; - +import android.os.Handler; +import android.os.Looper; public class LeanCloudUE { public static void initialize(final Activity activity, String clientID, String clientToken, String serverURL) { - LeanCloud.initialize(activity, clientID, clientToken, serverURL); + Handler mainHandler = new Handler(Looper.getMainLooper()); + mainHandler.post(new Runnable() { + @Override + public void run() { + LeanCloud.initialize(activity, clientID, clientToken, serverURL); + } + }); } } \ No newline at end of file diff --git a/LeanCloud/Source/LeanCloud/Private/Android/LCJNI.cpp b/LeanCloud/Source/LeanCloud/Private/Android/LCJNI.cpp index 9c093da..b34b5a7 100644 --- a/LeanCloud/Source/LeanCloud/Private/Android/LCJNI.cpp +++ b/LeanCloud/Source/LeanCloud/Private/Android/LCJNI.cpp @@ -14,7 +14,16 @@ namespace LCJNI { } Class JNI::FindClass(const char* name) const { - jclass Class = FAndroidApplication::FindJavaClass(name); + FString Name = FString(UTF8_TO_TCHAR(name)); + jclass Class = NULL; + if (Name.Find(TEXT("java/")) != INDEX_NONE) { + LCDebuger::DisplayLog("Env->FindClass: " + Name); + Class = Env->FindClass(name); + } else { + LCDebuger::DisplayLog("FAndroidApplication::FindJavaClass: " + Name); + Class = FAndroidApplication::FindJavaClass(name); + } + if (Class == NULL) { LCDebuger::ErrorLog(FString::Printf(TEXT("LCJNI Class: %s not found"), UTF8_TO_TCHAR(name))); } diff --git a/LeanCloud/Source/LeanCloud/Private/LCUser.cpp b/LeanCloud/Source/LeanCloud/Private/LCUser.cpp index 8b0f9e1..b1c85e9 100644 --- a/LeanCloud/Source/LeanCloud/Private/LCUser.cpp +++ b/LeanCloud/Source/LeanCloud/Private/LCUser.cpp @@ -47,7 +47,7 @@ bool FLCUser::IsMobilePhoneVerified() const { return LCJsonHelper::GetBoolField(ServerData, KeyMobilePhoneVerified); } -bool FLCUser::isAuthenticated() const { +bool FLCUser::IsAuthenticated() const { return !GetSessionToken().IsEmpty(); } diff --git a/LeanCloud/Source/LeanCloud/Public/LCUser.h b/LeanCloud/Source/LeanCloud/Public/LCUser.h index c8e011f..38d720f 100644 --- a/LeanCloud/Source/LeanCloud/Public/LCUser.h +++ b/LeanCloud/Source/LeanCloud/Public/LCUser.h @@ -12,7 +12,7 @@ struct LEANCLOUD_API FLCUser: public FLCObject { FString GetSessionToken() const; bool IsAnonymous() const; bool IsMobilePhoneVerified() const; - bool isAuthenticated() const; + bool IsAuthenticated() const; protected: static FString KeyUserName; diff --git a/TapBootstrap/Source/TapBootstrap/Private/TDSUser.cpp b/TapBootstrap/Source/TapBootstrap/Private/TDSUser.cpp index 2234351..08327be 100644 --- a/TapBootstrap/Source/TapBootstrap/Private/TDSUser.cpp +++ b/TapBootstrap/Source/TapBootstrap/Private/TDSUser.cpp @@ -14,15 +14,15 @@ FTDSUser::FTDSUser(TSharedPtr InServerData) { } -FString FTDSUser::GetAvatar() { +FString FTDSUser::GetAvatar() const { return TUJsonHelper::GetStringField(ServerData, KeyAvatar); } -FString FTDSUser::GetNickName() { +FString FTDSUser::GetNickName() const { return TUJsonHelper::GetStringField(ServerData, KeyNickName); } -FString FTDSUser::GetShortID() { +FString FTDSUser::GetShortID() const { return TUJsonHelper::GetStringField(ServerData, KeyShortID); } diff --git a/TapBootstrap/Source/TapBootstrap/Public/TDSUser.h b/TapBootstrap/Source/TapBootstrap/Public/TDSUser.h index 53b7e88..928deea 100644 --- a/TapBootstrap/Source/TapBootstrap/Public/TDSUser.h +++ b/TapBootstrap/Source/TapBootstrap/Public/TDSUser.h @@ -26,9 +26,9 @@ struct TAPBOOTSTRAP_API FTDSUser: public FLCUser FTDSUser(TSharedPtr InServerData = nullptr); - FString GetAvatar(); - FString GetNickName(); - FString GetShortID(); + FString GetAvatar() const; + FString GetNickName() const; + FString GetShortID() const; /** * Return last login user from cached memory or load from local storage diff --git a/TapCommon/Config/Game.ini b/TapCommon/Config/Game.ini new file mode 100644 index 0000000..7e41276 --- /dev/null +++ b/TapCommon/Config/Game.ini @@ -0,0 +1,5 @@ +[/Script/UnrealEd.ProjectPackagingSettings] ++DirectoriesToAlwaysCook=(Path="/TapCommon") ++DirectoriesToAlwaysCook=(Path="/TapCommon/Image") ++DirectoriesToAlwaysCook=(Path="/TapCommon/Sarabun") ++DirectoriesToAlwaysCook=(Path="/TapCommon/Styles") \ No newline at end of file diff --git a/TapCommon/Source/TapCommon/Private/android/TapJNI.cpp b/TapCommon/Source/TapCommon/Private/android/TapJNI.cpp index bc48e7b..6ef0f28 100644 --- a/TapCommon/Source/TapCommon/Private/android/TapJNI.cpp +++ b/TapCommon/Source/TapCommon/Private/android/TapJNI.cpp @@ -14,7 +14,16 @@ namespace TapJNI { } Class JNI::FindClass(const char* name) const { - jclass Class = FAndroidApplication::FindJavaClass(name); + FString Name = FString(UTF8_TO_TCHAR(name)); + jclass Class = NULL; + if (Name.Find(TEXT("java/")) != INDEX_NONE) { + TUDebuger::DisplayLog("Env->FindClass: " + Name); + Class = Env->FindClass(name); + } else { + TUDebuger::DisplayLog("FAndroidApplication::FindJavaClass: " + Name); + Class = FAndroidApplication::FindJavaClass(name); + } + if (Class == NULL) { TUDebuger::ErrorLog(FString::Printf(TEXT("LCJNI Class: %s not found"), UTF8_TO_TCHAR(name))); } diff --git a/TapCommon/Source/TapCommon/TapCommon.Build.cs b/TapCommon/Source/TapCommon/TapCommon.Build.cs index 28843bf..6c9408e 100644 --- a/TapCommon/Source/TapCommon/TapCommon.Build.cs +++ b/TapCommon/Source/TapCommon/TapCommon.Build.cs @@ -78,7 +78,7 @@ public TapCommon(ReadOnlyTargetRules Target) : base(Target) "SlateCore", "UMG", "Json", - "Http", + "HTTP", "JsonUtilities" } ); diff --git a/TapCommon/Source/TapCommon/Tools/TUHelper.cpp b/TapCommon/Source/TapCommon/Tools/TUHelper.cpp index 0ce5223..4224caf 100644 --- a/TapCommon/Source/TapCommon/Tools/TUHelper.cpp +++ b/TapCommon/Source/TapCommon/Tools/TUHelper.cpp @@ -156,9 +156,17 @@ UTexture2D* TUHelper::GenerateQrCode(const FString& string) } } UTexture2D* texture = UTexture2D::CreateTransient(size, size, EPixelFormat::PF_B8G8R8A8); +#if ENGINE_MAJOR_VERSION >= 5 + void* data = texture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE); +#else void* data = texture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); +#endif FMemory::Memcpy(data, pixels.GetData(), size * size * 4); +#if ENGINE_MAJOR_VERSION >= 5 + texture->GetPlatformData()->Mips[0].BulkData.Unlock(); +#else texture->PlatformData->Mips[0].BulkData.Unlock(); +#endif texture->UpdateResource(); texture->Filter = TextureFilter::TF_Nearest; return texture; diff --git a/TapLogin/Config/Game.ini b/TapLogin/Config/Game.ini new file mode 100644 index 0000000..75fc6c6 --- /dev/null +++ b/TapLogin/Config/Game.ini @@ -0,0 +1,3 @@ +[/Script/UnrealEd.ProjectPackagingSettings] ++DirectoriesToAlwaysCook=(Path="/TapLogin") ++DirectoriesToAlwaysCook=(Path="/TapLogin/Image") diff --git a/TapSupport/Config/Game.ini b/TapSupport/Config/Game.ini new file mode 100644 index 0000000..0650ab8 --- /dev/null +++ b/TapSupport/Config/Game.ini @@ -0,0 +1,3 @@ +[/Script/UnrealEd.ProjectPackagingSettings] ++DirectoriesToAlwaysCook=(Path="/TapSupport") ++DirectoriesToAlwaysCook=(Path="/TapSupport/Image") diff --git a/TapSupport/Source/TapSupport/TapSupport.Build.cs b/TapSupport/Source/TapSupport/TapSupport.Build.cs index 2481fdb..3d0dfc7 100644 --- a/TapSupport/Source/TapSupport/TapSupport.Build.cs +++ b/TapSupport/Source/TapSupport/TapSupport.Build.cs @@ -32,7 +32,7 @@ public TapSupport(ReadOnlyTargetRules Target) : base(Target) "Json", "JsonUtilities", "UMG", - "Http", + "HTTP", "TapCommon" // ... add other public dependencies that you statically link with here ... }