@uepm/dependency-plugin 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DependencyPlugin.uplugin
CHANGED
|
@@ -20,17 +20,15 @@ public class DependencyPlugin : ModuleRules
|
|
|
20
20
|
new string[]
|
|
21
21
|
{
|
|
22
22
|
"Core",
|
|
23
|
-
"
|
|
23
|
+
"CoreUObject",
|
|
24
|
+
"Engine",
|
|
25
|
+
"ExamplePlugin" // Dependency on ExamplePlugin
|
|
24
26
|
}
|
|
25
27
|
);
|
|
26
28
|
|
|
27
29
|
PrivateDependencyModuleNames.AddRange(
|
|
28
30
|
new string[]
|
|
29
31
|
{
|
|
30
|
-
"CoreUObject",
|
|
31
|
-
"Engine",
|
|
32
|
-
"Slate",
|
|
33
|
-
"SlateCore",
|
|
34
32
|
}
|
|
35
33
|
);
|
|
36
34
|
|
|
@@ -1,39 +1,117 @@
|
|
|
1
1
|
#include "DependencyPlugin.h"
|
|
2
2
|
#include "ExamplePlugin.h"
|
|
3
|
+
#include "Engine/Engine.h"
|
|
4
|
+
#include "Math/UnrealMathUtility.h"
|
|
3
5
|
|
|
4
6
|
#define LOCTEXT_NAMESPACE "FDependencyPluginModule"
|
|
5
7
|
|
|
6
8
|
void FDependencyPluginModule::StartupModule()
|
|
7
9
|
{
|
|
8
|
-
// This code will execute after your module is loaded into memory
|
|
9
|
-
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin module has been loaded"));
|
|
10
|
+
// This code will execute after your module is loaded into memory
|
|
11
|
+
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin module has been loaded - depends on ExamplePlugin"));
|
|
10
12
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
+
// Verify that ExamplePlugin is available
|
|
14
|
+
if (FExamplePluginModule::IsAvailable())
|
|
15
|
+
{
|
|
16
|
+
UE_LOG(LogTemp, Log, TEXT("DependencyPlugin: ExamplePlugin dependency is available"));
|
|
17
|
+
|
|
18
|
+
// Demonstrate the integration
|
|
19
|
+
FDependencyPluginFeatures::DemonstratePluginIntegration();
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
{
|
|
23
|
+
UE_LOG(LogTemp, Error, TEXT("DependencyPlugin: ExamplePlugin dependency is NOT available!"));
|
|
24
|
+
}
|
|
13
25
|
}
|
|
14
26
|
|
|
15
27
|
void FDependencyPluginModule::ShutdownModule()
|
|
16
28
|
{
|
|
17
|
-
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
|
18
|
-
// we call this function before unloading the module.
|
|
19
29
|
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin module has been unloaded"));
|
|
20
30
|
}
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
// Enhanced feature implementations
|
|
33
|
+
FString FDependencyPluginFeatures::CreateColorfulStatusMessage(const FString& Status, int32 Value)
|
|
23
34
|
{
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
// Use ExamplePlugin utilities to create an enhanced message
|
|
36
|
+
FString FormattedNumber = FExamplePluginUtils::FormatNumberWithCommas(Value);
|
|
37
|
+
FString Greeting = FExamplePluginUtils::GetGreetingMessage(TEXT("System"));
|
|
38
|
+
|
|
39
|
+
return FString::Printf(TEXT("[%s] Status: %s | Value: %s"), *Greeting, *Status, *FormattedNumber);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
FVector FDependencyPluginFeatures::GetRandomSpawnLocation(const FVector& Center, float Radius)
|
|
43
|
+
{
|
|
44
|
+
// Generate random point in circle
|
|
45
|
+
float Angle = FMath::RandRange(0.0f, 2.0f * PI);
|
|
46
|
+
float Distance = FMath::RandRange(0.0f, Radius);
|
|
47
|
+
|
|
48
|
+
FVector RandomOffset(
|
|
49
|
+
FMath::Cos(Angle) * Distance,
|
|
50
|
+
FMath::Sin(Angle) * Distance,
|
|
51
|
+
0.0f
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
FVector SpawnLocation = Center + RandomOffset;
|
|
55
|
+
|
|
56
|
+
// Use ExamplePlugin to calculate and log the distance
|
|
57
|
+
float DistanceFromCenter = FExamplePluginUtils::CalculateDistance(Center, SpawnLocation);
|
|
58
|
+
UE_LOG(LogTemp, Log, TEXT("Generated spawn location at distance: %s"),
|
|
59
|
+
*FExamplePluginUtils::FormatNumberWithCommas(FMath::RoundToInt(DistanceFromCenter)));
|
|
60
|
+
|
|
61
|
+
return SpawnLocation;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
FString FDependencyPluginFeatures::GenerateSystemReport()
|
|
65
|
+
{
|
|
66
|
+
FString Report;
|
|
67
|
+
|
|
68
|
+
// Header with greeting
|
|
69
|
+
Report += FExamplePluginUtils::GetGreetingMessage(TEXT("System Administrator")) + TEXT("\n");
|
|
70
|
+
Report += TEXT("=== SYSTEM REPORT ===\n");
|
|
71
|
+
|
|
72
|
+
// Random statistics using ExamplePlugin formatting
|
|
73
|
+
int32 ActiveUsers = FMath::RandRange(1000, 50000);
|
|
74
|
+
int32 TotalConnections = FMath::RandRange(100000, 1000000);
|
|
75
|
+
int32 DataProcessed = FMath::RandRange(1000000, 10000000);
|
|
76
|
+
|
|
77
|
+
Report += FString::Printf(TEXT("Active Users: %s\n"),
|
|
78
|
+
*FExamplePluginUtils::FormatNumberWithCommas(ActiveUsers));
|
|
79
|
+
Report += FString::Printf(TEXT("Total Connections: %s\n"),
|
|
80
|
+
*FExamplePluginUtils::FormatNumberWithCommas(TotalConnections));
|
|
81
|
+
Report += FString::Printf(TEXT("Data Processed: %s bytes\n"),
|
|
82
|
+
*FExamplePluginUtils::FormatNumberWithCommas(DataProcessed));
|
|
83
|
+
|
|
84
|
+
// Random color for status
|
|
85
|
+
FLinearColor StatusColor = FExamplePluginUtils::GetRandomColor();
|
|
86
|
+
Report += FString::Printf(TEXT("Status Color: R=%.2f G=%.2f B=%.2f\n"),
|
|
87
|
+
StatusColor.R, StatusColor.G, StatusColor.B);
|
|
88
|
+
|
|
89
|
+
Report += TEXT("=== END REPORT ===");
|
|
90
|
+
|
|
91
|
+
return Report;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
void FDependencyPluginFeatures::DemonstratePluginIntegration()
|
|
95
|
+
{
|
|
96
|
+
UE_LOG(LogTemp, Warning, TEXT("=== DependencyPlugin Integration Demo ==="));
|
|
97
|
+
|
|
98
|
+
// Test 1: Colorful status message
|
|
99
|
+
FString StatusMsg = CreateColorfulStatusMessage(TEXT("OPERATIONAL"), 12345);
|
|
100
|
+
UE_LOG(LogTemp, Log, TEXT("Status Message: %s"), *StatusMsg);
|
|
101
|
+
|
|
102
|
+
// Test 2: Random spawn locations
|
|
103
|
+
FVector Center(0, 0, 0);
|
|
104
|
+
for (int32 i = 0; i < 3; i++)
|
|
34
105
|
{
|
|
35
|
-
|
|
106
|
+
FVector SpawnLoc = GetRandomSpawnLocation(Center, 1000.0f);
|
|
107
|
+
UE_LOG(LogTemp, Log, TEXT("Spawn Location %d: %s"), i + 1, *SpawnLoc.ToString());
|
|
36
108
|
}
|
|
109
|
+
|
|
110
|
+
// Test 3: System report
|
|
111
|
+
FString Report = GenerateSystemReport();
|
|
112
|
+
UE_LOG(LogTemp, Log, TEXT("System Report:\n%s"), *Report);
|
|
113
|
+
|
|
114
|
+
UE_LOG(LogTemp, Warning, TEXT("=== Integration Demo Complete ==="));
|
|
37
115
|
}
|
|
38
116
|
|
|
39
117
|
#undef LOCTEXT_NAMESPACE
|
|
@@ -3,15 +3,42 @@
|
|
|
3
3
|
#include "CoreMinimal.h"
|
|
4
4
|
#include "Modules/ModuleManager.h"
|
|
5
5
|
|
|
6
|
-
class FDependencyPluginModule : public IModuleInterface
|
|
6
|
+
class DEPENDENCYPLUGIN_API FDependencyPluginModule : public IModuleInterface
|
|
7
7
|
{
|
|
8
8
|
public:
|
|
9
9
|
|
|
10
10
|
/** IModuleInterface implementation */
|
|
11
11
|
virtual void StartupModule() override;
|
|
12
12
|
virtual void ShutdownModule() override;
|
|
13
|
+
|
|
14
|
+
/** Get the singleton instance of this module */
|
|
15
|
+
static FDependencyPluginModule& Get()
|
|
16
|
+
{
|
|
17
|
+
return FModuleManager::LoadModuleChecked<FDependencyPluginModule>("DependencyPlugin");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Check if this module is loaded and ready to use */
|
|
21
|
+
static bool IsAvailable()
|
|
22
|
+
{
|
|
23
|
+
return FModuleManager::Get().IsModuleLoaded("DependencyPlugin");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
13
26
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Enhanced functionality that builds on ExamplePlugin utilities
|
|
29
|
+
*/
|
|
30
|
+
class DEPENDENCYPLUGIN_API FDependencyPluginFeatures
|
|
31
|
+
{
|
|
32
|
+
public:
|
|
33
|
+
/** Create a colorful status message using ExamplePlugin utilities */
|
|
34
|
+
static FString CreateColorfulStatusMessage(const FString& Status, int32 Value);
|
|
35
|
+
|
|
36
|
+
/** Generate a random spawn location within bounds */
|
|
37
|
+
static FVector GetRandomSpawnLocation(const FVector& Center, float Radius);
|
|
38
|
+
|
|
39
|
+
/** Create a formatted report using multiple ExamplePlugin functions */
|
|
40
|
+
static FString GenerateSystemReport();
|
|
41
|
+
|
|
42
|
+
/** Demonstrate plugin dependency by calling ExamplePlugin functions */
|
|
43
|
+
static void DemonstratePluginIntegration();
|
|
17
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uepm/dependency-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Plugin demonstrating dependencies on other NPM plugins",
|
|
5
5
|
"main": "DependencyPlugin.uplugin",
|
|
6
6
|
"scripts": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"pluginName": "DependencyPlugin"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@uepm/example-plugin": "^1.0.
|
|
15
|
+
"@uepm/example-plugin": "^1.0.3"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"DependencyPlugin.uplugin",
|