68 lines
2.3 KiB
C++
68 lines
2.3 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Engine/GameInstance.h"
|
|
#include "Sockets.h"
|
|
#include "TimerManager.h"
|
|
#include "Dom/JsonObject.h"
|
|
#include "MyGameInstance.generated.h"
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class MACHINIST_API UMyGameInstance : public UGameInstance
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
FSocket* MySocket;
|
|
FTimerHandle timer;
|
|
UPROPERTY(BlueprintReadOnly, Category = "Server responses")
|
|
FString LAstServResp;
|
|
UPROPERTY(BlueprintReadOnly, Category = "Server responses")
|
|
FString strjsonTest;
|
|
|
|
protected:
|
|
|
|
// map all commands
|
|
TMap<FString, int32> CommandMap;
|
|
// json object
|
|
TSharedPtr<FJsonObject> JsonObject;
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Data")
|
|
void CreateMapCommand();
|
|
UFUNCTION(BlueprintCallable, Category = "Data")
|
|
int32 getNumberFunction(FString Command);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void waggonvelocity(int32 id, float speed, int32 idspline, float offset);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void createwaggon(const FString& value, int32 id);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void teleportwaggon(int32 id, int32 idspline, float offset);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void destroywaggon(int32 id);
|
|
|
|
/*UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void connectwagon();
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void waggondoorstate(int32 idtrain, int32 doorleft, int32 doorright);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void setfaultwagon(int32 id, int32 index, bool on);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void lightstate(int32 id, int32 state);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void switchstate(int32 id, int32 state);*/
|
|
public:
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Status client")
|
|
void listening(int32 NumberStatus);
|
|
UFUNCTION(BlueprintCallable, Category = "Status client")
|
|
void SendStatus(int32 NumberStatus);
|
|
UFUNCTION(BlueprintCallable, Category = "Status client")
|
|
bool StartWorkingAtSocket();
|
|
};
|