Skip to content

Commit 287e410

Browse files
committed
UPuerTSSubsystem && PuerTSActor
1 parent f0ce893 commit 287e410

5 files changed

Lines changed: 121 additions & 0 deletions

File tree

27.5 KB
Binary file not shown.
9.61 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Fill out your copyright notice in the Description page of Project Settings.
2+
3+
4+
#include "PuerTS/PuerTSSubsystem.h"
5+
6+
UPuerTSSubsystem::UPuerTSSubsystem()
7+
{
8+
static ConstructorHelpers::FClassFinder<AActor> Blueprint(TEXT("/Game/Blueprints/TypeScript/PuerTSActor"));
9+
10+
Class = Blueprint.Class;
11+
}
12+
13+
void UPuerTSSubsystem::Test_Implementation(const int32 InLoop)
14+
{
15+
Super::Test_Implementation(InLoop);
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Fill out your copyright notice in the Description page of Project Settings.
2+
3+
#pragma once
4+
5+
#include "CoreMinimal.h"
6+
#include "TestCase/TestSubsystem.h"
7+
#include "PuerTSSubsystem.generated.h"
8+
9+
/**
10+
*
11+
*/
12+
UCLASS()
13+
class SCRIPTPLUGINCOMPARE_API UPuerTSSubsystem : public UTestSubsystem
14+
{
15+
GENERATED_BODY()
16+
17+
public:
18+
UPuerTSSubsystem();
19+
20+
public:
21+
virtual void Test_Implementation(int32 InLoop) override;
22+
};

TypeScript/PuerTSActor.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { $ref } from 'puerts';
2+
import * as UE from 'ue'
3+
4+
class PuerTSActor extends UE.Actor {
5+
ReceiveBeginPlay(): void {
6+
var PuerTSSubsystem = UE.SubsystemBlueprintLibrary.GetGameInstanceSubsystem(this, UE.PuerTSSubsystem.StaticClass()) as UE.PuerTSSubsystem;
7+
8+
this.Loop = PuerTSSubsystem.Loop;
9+
10+
this.StartTest();
11+
12+
this.ProcessTest();
13+
14+
this.EndTest();
15+
}
16+
17+
private StartTest(): void {
18+
this.Data = [];
19+
}
20+
21+
private TestSelf(): void {
22+
23+
}
24+
25+
private TestCpp(): void {
26+
27+
}
28+
29+
private TestBP(): void {
30+
31+
}
32+
33+
private ProcessTest(): void {
34+
this.TestSelf();
35+
36+
this.TestCpp();
37+
38+
this.TestBP();
39+
}
40+
41+
private EndTest(): void {
42+
var Value = "";
43+
44+
Value += "Name, Time\n";
45+
46+
var Now = UE.KismetMathLibrary.Now();
47+
48+
var Year = $ref(0);
49+
50+
var Month = $ref(0);
51+
52+
var Day = $ref(0);
53+
54+
var Hour = $ref(0);
55+
56+
var Minute = $ref(0);
57+
58+
var Second = $ref(0);
59+
60+
var Millisecond = $ref(0);
61+
62+
UE.KismetMathLibrary.BreakDateTime(Now, Year, Month, Day, Hour, Minute, Second, Millisecond);
63+
64+
this.Data.forEach(Element => {
65+
Value += Element[0] + ", " + Element[1] + "\n";
66+
});
67+
68+
var Platform = UE.TestCaseBlueprintFunctionLibrary.GetPlatform();
69+
70+
var BuildConfiguration = UE.TestCaseBlueprintFunctionLibrary.GetBuildConfiguration();
71+
72+
var File = `PuerTS-${Platform}-${BuildConfiguration}-${this.Loop}-${Year}-${Month}-${Day}-${Hour}-${Minute}-${Second}-${Millisecond}.csv`;
73+
74+
UE.TestCaseBlueprintFunctionLibrary.SaveStringToFile(File, Value);
75+
}
76+
77+
private Data: [String, number][];
78+
79+
private Loop: number;
80+
81+
}
82+
83+
export default PuerTSActor;

0 commit comments

Comments
 (0)