@uepm/example-plugin 1.0.1 → 1.0.2

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "FileVersion": 3,
3
3
  "Version": 1,
4
- "VersionName": "1.0.0",
4
+ "VersionName": "1.0.1",
5
5
  "FriendlyName": "Example Plugin",
6
6
  "Description": "An example Unreal Engine plugin demonstrating NPM distribution pattern",
7
7
  "Category": "Other",
@@ -1,11 +1,13 @@
1
1
  #include "ExamplePlugin.h"
2
+ #include "Engine/Engine.h"
3
+ #include "Math/UnrealMathUtility.h"
2
4
 
3
5
  #define LOCTEXT_NAMESPACE "FExamplePluginModule"
4
6
 
5
7
  void FExamplePluginModule::StartupModule()
6
8
  {
7
9
  // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
8
- UE_LOG(LogTemp, Warning, TEXT("ExamplePlugin module has been loaded"));
10
+ UE_LOG(LogTemp, Warning, TEXT("ExamplePlugin module has been loaded - providing utility functions"));
9
11
  }
10
12
 
11
13
  void FExamplePluginModule::ShutdownModule()
@@ -15,6 +17,49 @@ void FExamplePluginModule::ShutdownModule()
15
17
  UE_LOG(LogTemp, Warning, TEXT("ExamplePlugin module has been unloaded"));
16
18
  }
17
19
 
20
+ // Utility function implementations
21
+ FLinearColor FExamplePluginUtils::GetRandomColor()
22
+ {
23
+ return FLinearColor(
24
+ FMath::RandRange(0.0f, 1.0f),
25
+ FMath::RandRange(0.0f, 1.0f),
26
+ FMath::RandRange(0.0f, 1.0f),
27
+ 1.0f
28
+ );
29
+ }
30
+
31
+ FString FExamplePluginUtils::FormatNumberWithCommas(int32 Number)
32
+ {
33
+ FString NumberString = FString::FromInt(Number);
34
+ FString Result;
35
+
36
+ int32 Count = 0;
37
+ for (int32 i = NumberString.Len() - 1; i >= 0; i--)
38
+ {
39
+ if (Count > 0 && Count % 3 == 0)
40
+ {
41
+ Result = TEXT(",") + Result;
42
+ }
43
+ Result = NumberString[i] + Result;
44
+ Count++;
45
+ }
46
+
47
+ return Result;
48
+ }
49
+
50
+ FString FExamplePluginUtils::GetGreetingMessage(const FString& Name)
51
+ {
52
+ FDateTime Now = FDateTime::Now();
53
+ FString TimeString = Now.ToString(TEXT("%H:%M:%S"));
54
+
55
+ return FString::Printf(TEXT("Hello %s! The current time is %s"), *Name, *TimeString);
56
+ }
57
+
58
+ float FExamplePluginUtils::CalculateDistance(const FVector& A, const FVector& B)
59
+ {
60
+ return FVector::Dist(A, B);
61
+ }
62
+
18
63
  #undef LOCTEXT_NAMESPACE
19
64
 
20
65
  IMPLEMENT_MODULE(FExamplePluginModule, ExamplePlugin)
@@ -3,11 +3,42 @@
3
3
  #include "CoreMinimal.h"
4
4
  #include "Modules/ModuleManager.h"
5
5
 
6
- class FExamplePluginModule : public IModuleInterface
6
+ class EXAMPLEPLUGIN_API FExamplePluginModule : 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 FExamplePluginModule& Get()
16
+ {
17
+ return FModuleManager::LoadModuleChecked<FExamplePluginModule>("ExamplePlugin");
18
+ }
19
+
20
+ /** Check if this module is loaded and ready to use */
21
+ static bool IsAvailable()
22
+ {
23
+ return FModuleManager::Get().IsModuleLoaded("ExamplePlugin");
24
+ }
25
+ };
26
+
27
+ /**
28
+ * Utility class providing helper functions for other plugins
29
+ */
30
+ class EXAMPLEPLUGIN_API FExamplePluginUtils
31
+ {
32
+ public:
33
+ /** Generate a random color */
34
+ static FLinearColor GetRandomColor();
35
+
36
+ /** Format a number with commas for display */
37
+ static FString FormatNumberWithCommas(int32 Number);
38
+
39
+ /** Get a greeting message with the current time */
40
+ static FString GetGreetingMessage(const FString& Name = TEXT("World"));
41
+
42
+ /** Calculate distance between two vectors */
43
+ static float CalculateDistance(const FVector& A, const FVector& B);
13
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uepm/example-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Example Unreal Engine plugin distributed via NPM",
5
5
  "main": "ExamplePlugin.uplugin",
6
6
  "scripts": {