92 lines
3.3 KiB
C++
92 lines
3.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 "CPPGameInstance.generated.h"
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class TEM2_API UCPPGameInstance : public UGameInstance
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
FSocket* MySocket;
|
|
FTimerHandle timer;
|
|
UPROPERTY(BlueprintReadOnly,Category="Server responses")
|
|
FString LAstServResp;
|
|
UPROPERTY(BlueprintReadOnly, Category = "Server responses")
|
|
FString strjsonTest;
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Server responses")
|
|
FString adress;
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Server responses")
|
|
int32 port;
|
|
|
|
|
|
|
|
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 connectwagon(int32 ideven, int32 idodd);
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void cnctwagon(int32 ideven, int32 idodd);
|
|
//UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Command server")
|
|
//void testWgn(int32 id,int32 idd);
|
|
|
|
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Command server")
|
|
void destroywaggon(int32 id);
|
|
|
|
public:
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Status client")
|
|
void listening(int32 NumberStatus, FString command);
|
|
UFUNCTION(BlueprintCallable, Category = "Status client")
|
|
void SendStatus(int32 NumberStatus, FString command);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Status client")
|
|
bool StartWorkingAtSocket();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "LoadTxt"))
|
|
static bool LoadTxt(FString FileNameA, FString& SaveTextA);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "LoadTxtFull"))
|
|
static bool SaveTxtFull(FString SaveText, FString FullFileName);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "SaveTxtFull"))
|
|
static bool LoadTxtFull(FString FullFileName, FString & SaveText);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "SaveTxt"))
|
|
static bool SaveTxt(FString SaveTextB, FString FileNameB);
|
|
UFUNCTION(BlueprintCallable, Category = "Custom")
|
|
static void SetWinPos(int posX, int posY);
|
|
UFUNCTION(BlueprintCallable, Category = "Custom")
|
|
static void SetWinSize(int sizeX, int sizeY);
|
|
UFUNCTION(BlueprintCallable, Category = "Custom",meta=(ToolTip="execute this app again with argument"))
|
|
static void runSelf(FString argument);
|
|
UFUNCTION(BlueprintCallable,BlueprintPure, Category = "Custom", meta = (ToolTip = "get net name of this machine"))
|
|
FString getPCname();
|
|
};
|