Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main menu #2

Merged
merged 8 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 82 additions & 7 deletions Config/DefaultGame.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,82 @@

[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=4C5E5CFA41A35A1F55DA489142C41F76

[StartupActions]
bAddPacks=True
InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent")


[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=4C5E5CFA41A35A1F55DA489142C41F76

[StartupActions]
bAddPacks=True
InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent")

[/Script/UnrealEd.ProjectPackagingSettings]
Build=IfProjectHasCode
BuildConfiguration=PPBC_Development
BuildTarget=
StagingDirectory=(Path="")
FullRebuild=False
ForDistribution=False
IncludeDebugFiles=False
BlueprintNativizationMethod=Disabled
bIncludeNativizedAssetsInProjectGeneration=False
bExcludeMonolithicEngineHeadersInNativizedCode=False
UsePakFile=True
bUseIoStore=False
bMakeBinaryConfig=False
bGenerateChunks=False
bGenerateNoChunks=False
bChunkHardReferencesOnly=False
bForceOneChunkPerFile=False
MaxChunkSize=0
bBuildHttpChunkInstallData=False
HttpChunkInstallDataDirectory=(Path="")
bCompressed=True
PakFileCompressionFormats=Oodle
bForceUseProjectCompressionFormatIgnoreHardwareOverride=False
PakFileAdditionalCompressionOptions=-compressionblocksize=256KB
PakFileCompressionMethod=Kraken
PakFileCompressionLevel_DebugDevelopment=3
PakFileCompressionLevel_TestShipping=5
PakFileCompressionLevel_Distribution=7
HttpChunkInstallDataVersion=
IncludePrerequisites=True
IncludeAppLocalPrerequisites=False
bShareMaterialShaderCode=True
bDeterministicShaderCodeOrder=False
bSharedMaterialNativeLibraries=True
ApplocalPrerequisitesDirectory=(Path="")
IncludeCrashReporter=False
InternationalizationPreset=English
-CulturesToStage=en
+CulturesToStage=en
LocalizationTargetCatchAllChunkId=0
bCookAll=False
bCookMapsOnly=False
bSkipEditorContent=False
bSkipMovies=False
-IniKeyBlacklist=KeyStorePassword
-IniKeyBlacklist=KeyPassword
-IniKeyBlacklist=rsa.privateexp
-IniKeyBlacklist=rsa.modulus
-IniKeyBlacklist=rsa.publicexp
-IniKeyBlacklist=aes.key
-IniKeyBlacklist=SigningPublicExponent
-IniKeyBlacklist=SigningModulus
-IniKeyBlacklist=SigningPrivateExponent
-IniKeyBlacklist=EncryptionKey
-IniKeyBlacklist=IniKeyBlacklist
-IniKeyBlacklist=IniSectionBlacklist
+IniKeyBlacklist=KeyStorePassword
+IniKeyBlacklist=KeyPassword
+IniKeyBlacklist=rsa.privateexp
+IniKeyBlacklist=rsa.modulus
+IniKeyBlacklist=rsa.publicexp
+IniKeyBlacklist=aes.key
+IniKeyBlacklist=SigningPublicExponent
+IniKeyBlacklist=SigningModulus
+IniKeyBlacklist=SigningPrivateExponent
+IniKeyBlacklist=EncryptionKey
+IniKeyBlacklist=IniKeyBlacklist
+IniKeyBlacklist=IniSectionBlacklist
+MapsToCook=(FilePath="/Game/StarterContent/Maps/Minimal_Default")
+MapsToCook=(FilePath="/Game/Levels/MainMenu")
+MapsToCook=(FilePath="/Game/Levels/YannTest")

87 changes: 87 additions & 0 deletions Config/DefaultInput.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[/Script/Engine.InputSettings]
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Touch",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
bAltEnterTogglesFullscreen=True
bF11TogglesFullscreen=True
bUseMouseForTouch=False
bEnableMouseSmoothing=True
bEnableFOVScaling=True
bCaptureMouseOnLaunch=True
bAlwaysShowTouchInterface=False
bShowConsoleOnFourFingerTap=True
bEnableGestureRecognizer=False
bUseAutocorrect=False
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
DefaultViewportMouseLockMode=LockOnCapture
FOVScale=0.011110
DoubleClickTime=0.200000
+ActionMappings=(ActionName="PauseAction",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=M)
+ActionMappings=(ActionName="PauseAction",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Escape)
DefaultPlayerInputClass=/Script/Engine.PlayerInput
DefaultInputComponentClass=/Script/Engine.InputComponent
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
-ConsoleKeys=Tilde
+ConsoleKeys=Tilde

Binary file modified Content/BP/BP_MyGameInstances.uasset
Binary file not shown.
Binary file added Content/BP/WBP_MainMenu.uasset
Binary file not shown.
Binary file modified Content/BP/WBP_MusicHUD.uasset
Binary file not shown.
Binary file modified Content/BP/WBP_RaceHUD.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Img/UI/MarioKartDS/8x/6859_a.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/Img/UI/MarioKartDS/src/6859.uasset
Binary file not shown.
Binary file added Content/Img/UI/MarioKartDS/src/6859_a.uasset
Binary file not shown.
Binary file added Content/Levels/MainMenu.umap
Binary file not shown.
5 changes: 5 additions & 0 deletions Source/KO_Racing/MyMainMenuUserWidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.


#include "MyMainMenuUserWidget.h"

17 changes: 17 additions & 0 deletions Source/KO_Racing/MyMainMenuUserWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "MyMainMenuUserWidget.generated.h"

/**
*
*/
UCLASS()
class KO_RACING_API UMyMainMenuUserWidget : public UUserWidget
{
GENERATED_BODY()

};
35 changes: 33 additions & 2 deletions Source/KO_Racing/MyRaceUserWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@

#include "MyRaceUserWidget.h"

#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"

void UMyRaceUserWidget::Init()
{
_speedTxt->ChangeValue(0);
_rankTxt->ChangeValue(0);
_lapTxt->ChangeValue(1);
SetLapMax(3);
_beforeStartTimerTxt->ChangeValue(3);
_pauseTxt->SetVisibility(ESlateVisibility::Hidden);
UGameplayStatics::GetPlayerController(GetWorld(), 0)->InputComponent->BindAction("PauseAction", IE_Pressed, this, &UMyRaceUserWidget::TogglePause).bExecuteWhenPaused = true;
}

void UMyRaceUserWidget::ChangeRankValue(float value)
{
_rankTxt->ChangeValue(value);
Expand All @@ -28,6 +41,7 @@ void UMyRaceUserWidget::ChangeSpeedValue(float value)
void UMyRaceUserWidget::StartTimer()
{
_timer = 0;
_beforeStart = 3;
_timerIsStarted = true;
}

Expand All @@ -51,8 +65,17 @@ void UMyRaceUserWidget::ResumeTimer()
void UMyRaceUserWidget::UpdateTimer(float deltaTime)
{
if (_timerIsStarted) {
_timer += deltaTime;
_timerTxt->SetText(FText::FromString(GenTimerFString(_timer)));
if (_beforeStart <= 0) {
_timer += deltaTime;
_timerTxt->SetText(FText::FromString(GenTimerFString(_timer)));
} else {
_beforeStart -= deltaTime;
_beforeStartTimerTxt->ChangeValue(_beforeStart + 1);
if (_beforeStart <= 0) {
_raceAsStarted = true;
_beforeStartTimerTxt->SetVisibility(ESlateVisibility::Hidden);
}
}
}
}

Expand All @@ -71,6 +94,14 @@ FString UMyRaceUserWidget::GenTimerFString(float time)
return FString(GenTimerString(time).c_str());
}

void UMyRaceUserWidget::TogglePause()
{
_isPaused = !_isPaused;
_pauseTxt->SetVisibility((_isPaused) ? ESlateVisibility::Visible : ESlateVisibility::Hidden);
(!_isPaused) ? ResumeTimer() : PauseTimer();
UGameplayStatics::SetGamePaused(GetWorld(), _isPaused);
}

std::string UMyRaceUserWidget::GenTimerString(float time)
{
int minute = time / 60;
Expand Down
17 changes: 15 additions & 2 deletions Source/KO_Racing/MyRaceUserWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class KO_RACING_API UMyRaceUserWidget : public UUserWidget
GENERATED_BODY()

public:
UFUNCTION(BlueprintCallable)
void Init();
UFUNCTION(BlueprintCallable)
void ChangeRankValue(float value);
UFUNCTION(BlueprintCallable)
Expand All @@ -44,6 +46,8 @@ class KO_RACING_API UMyRaceUserWidget : public UUserWidget
TArray<float> GetLapTime();
UFUNCTION(BlueprintCallable)
static FString GenTimerFString(float time);
UFUNCTION(BlueprintCallable)
void TogglePause();

// All my variables
UPROPERTY(Category = TextColorChanger, EditAnywhere, BlueprintReadWrite)
Expand All @@ -54,11 +58,20 @@ class KO_RACING_API UMyRaceUserWidget : public UUserWidget
UMyTextBlockColorChanger *_speedTxt;
UPROPERTY(Category = Text, EditAnywhere, BlueprintReadWrite)
UTextBlock *_timerTxt;
UPROPERTY(Category = TextColorChanger, EditAnywhere, BlueprintReadWrite)
UMyTextBlockColorChanger* _beforeStartTimerTxt;
UPROPERTY(Category = ForExternalUse, EditAnywhere, BlueprintReadWrite)
bool _raceAsStarted;
UPROPERTY(Category = ForExternalUse, EditAnywhere, BlueprintReadWrite)
bool _isPaused = false;
UPROPERTY(Category = Text, EditAnywhere, BlueprintReadWrite)
UTextBlock* _pauseTxt;
protected:
static std::string GenTimerString(float time);

float _timer;
bool _timerIsStarted;
float _timer = 0;
float _beforeStart = 3;
bool _timerIsStarted = false;
TArray<float> _lapTime;
float _lastLapTimer = 0;
};
77 changes: 77 additions & 0 deletions Source/KO_Racing/MySlidingButton.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Fill out your copyright notice in the Description page of Project Settings.


#include "MySlidingButton.h"

void UMySlidingButton::Init()
{
_startingX = RenderTransform.Translation.X;
_slidedX = _startingX - _maxOffset;
_timer = 0;
}

void UMySlidingButton::Tick(float deltaTime)
{
Move(deltaTime);
}

void UMySlidingButton::Move(float deltaTime)
{
if (IsHovered()) {
if (!_wasHovered) {
_timer = 0;
_wasHovered = true;
}
_timer += deltaTime;
if (_timer < _timeToTransition) {
FVector2D btnTxtPos = _btnTxt->RenderTransform.Translation;
FVector2D btnPos = RenderTransform.Translation;
float resX = (btnPos.X - _slidedX) * (_timer / _timeToTransition);
btnTxtPos.X += resX;
btnPos.X -= resX;
_btnTxt->SetRenderTranslation(btnTxtPos);
SetRenderTranslation(btnPos);
} else {
FVector2D btnTxtPos = _btnTxt->RenderTransform.Translation;
FVector2D btnPos = RenderTransform.Translation;
float resX = btnPos.X - _slidedX;
btnTxtPos.X += resX;
btnPos.X -= resX;
_btnTxt->SetRenderTranslation(btnTxtPos);
SetRenderTranslation(btnPos);
}
} else {
if (_wasHovered) {
_timer = 0;
_wasHovered = false;
}
_timer += deltaTime;
if (_timer < _timeToTransition) {
FVector2D btnTxtPos = _btnTxt->RenderTransform.Translation;
FVector2D btnPos = RenderTransform.Translation;
float resX = (_startingX - btnPos.X) * (_timer / _timeToTransition);
btnTxtPos.X -= resX;
btnPos.X += resX;
_btnTxt->SetRenderTranslation(btnTxtPos);
SetRenderTranslation(btnPos);
} else {
FVector2D btnTxtPos = _btnTxt->RenderTransform.Translation;
FVector2D btnPos = RenderTransform.Translation;
float resX = _startingX - btnPos.X;
btnTxtPos.X -= resX;
btnPos.X += resX;
_btnTxt->SetRenderTranslation(btnTxtPos);
SetRenderTranslation(btnPos);
}
}
}

void UMySlidingButton::LoadNextLevel()
{
GetWorld()->ServerTravel(_nextLevelPath);
}

void UMySlidingButton::QuitGame()
{
FGenericPlatformMisc::RequestExit(false);
}
Loading