diff --git a/Binaries/Win64/UnrealEditor-MasharovDev.dll b/Binaries/Win64/UnrealEditor-MasharovDev.dll index 76a3e2f94..064f8e558 100644 Binary files a/Binaries/Win64/UnrealEditor-MasharovDev.dll and b/Binaries/Win64/UnrealEditor-MasharovDev.dll differ diff --git a/Binaries/Win64/UnrealEditor-MasharovDev.pdb b/Binaries/Win64/UnrealEditor-MasharovDev.pdb index 608d12f73..b3a7cb244 100644 Binary files a/Binaries/Win64/UnrealEditor-MasharovDev.pdb and b/Binaries/Win64/UnrealEditor-MasharovDev.pdb differ diff --git a/Content/Blueprints/Player/CM.uasset b/Content/Blueprints/Player/CM.uasset index 4ed9e1bee..894f175e1 100644 Binary files a/Content/Blueprints/Player/CM.uasset and b/Content/Blueprints/Player/CM.uasset differ diff --git a/Content/Blueprints/Player/GI.uasset b/Content/Blueprints/Player/GI.uasset index cc36ac9b4..dd4994b97 100644 Binary files a/Content/Blueprints/Player/GI.uasset and b/Content/Blueprints/Player/GI.uasset differ diff --git a/Content/Blueprints/Player/MathAndConvertFns.uasset b/Content/Blueprints/Player/MathAndConvertFns.uasset index 3a8d3b26f..76d4be825 100644 Binary files a/Content/Blueprints/Player/MathAndConvertFns.uasset and b/Content/Blueprints/Player/MathAndConvertFns.uasset differ diff --git a/Content/Blueprints/Player/MyPC.uasset b/Content/Blueprints/Player/MyPC.uasset index 373f5460a..8621edd57 100644 Binary files a/Content/Blueprints/Player/MyPC.uasset and b/Content/Blueprints/Player/MyPC.uasset differ diff --git a/Content/Blueprints/Player/MyPawn.uasset b/Content/Blueprints/Player/MyPawn.uasset index 33d64c8b1..37e57c3ca 100644 Binary files a/Content/Blueprints/Player/MyPawn.uasset and b/Content/Blueprints/Player/MyPawn.uasset differ diff --git a/Content/Blueprints/UI/Actors/HousePoint.uasset b/Content/Blueprints/UI/Actors/HousePoint.uasset index 1953bec1c..ff58c279f 100644 Binary files a/Content/Blueprints/UI/Actors/HousePoint.uasset and b/Content/Blueprints/UI/Actors/HousePoint.uasset differ diff --git a/Content/Blueprints/UI/Actors/parkingPoint.uasset b/Content/Blueprints/UI/Actors/parkingPoint.uasset index e8c40a8af..dc2f226ca 100644 Binary files a/Content/Blueprints/UI/Actors/parkingPoint.uasset and b/Content/Blueprints/UI/Actors/parkingPoint.uasset differ diff --git a/Content/Blueprints/UI/Others/tagsList.uasset b/Content/Blueprints/UI/Others/tagsList.uasset deleted file mode 100644 index d13543de1..000000000 Binary files a/Content/Blueprints/UI/Others/tagsList.uasset and /dev/null differ diff --git a/Content/Blueprints/UI/Others/tagsList1.uasset b/Content/Blueprints/UI/Others/tagsList1.uasset new file mode 100644 index 000000000..b88960f37 Binary files /dev/null and b/Content/Blueprints/UI/Others/tagsList1.uasset differ diff --git a/Content/Blueprints/UI/WBPS/KPWidget.uasset b/Content/Blueprints/UI/WBPS/KPWidget.uasset index 45613032c..6182190e5 100644 Binary files a/Content/Blueprints/UI/WBPS/KPWidget.uasset and b/Content/Blueprints/UI/WBPS/KPWidget.uasset differ diff --git a/Content/Blueprints/UI/WBPS/KPWidgetParking.uasset b/Content/Blueprints/UI/WBPS/KPWidgetParking.uasset index cd44598d7..3b086ff38 100644 Binary files a/Content/Blueprints/UI/WBPS/KPWidgetParking.uasset and b/Content/Blueprints/UI/WBPS/KPWidgetParking.uasset differ diff --git a/Content/Blueprints/UI/WBPS/Menu/flatInfoBig.uasset b/Content/Blueprints/UI/WBPS/Menu/flatInfoBig.uasset index 129018cf0..3f274b06d 100644 Binary files a/Content/Blueprints/UI/WBPS/Menu/flatInfoBig.uasset and b/Content/Blueprints/UI/WBPS/Menu/flatInfoBig.uasset differ diff --git a/Content/Blueprints/UI/WBPS/filter/Filter.uasset b/Content/Blueprints/UI/WBPS/filter/Filter.uasset index 0b12d5c00..c23230de2 100644 Binary files a/Content/Blueprints/UI/WBPS/filter/Filter.uasset and b/Content/Blueprints/UI/WBPS/filter/Filter.uasset differ diff --git a/Content/Blueprints/UI/WBPS/filter/FlatCard.uasset b/Content/Blueprints/UI/WBPS/filter/FlatCard.uasset index e95752b94..5375db121 100644 Binary files a/Content/Blueprints/UI/WBPS/filter/FlatCard.uasset and b/Content/Blueprints/UI/WBPS/filter/FlatCard.uasset differ diff --git a/Content/Blueprints/UI/WBPS/filter/FlatCardBig.uasset b/Content/Blueprints/UI/WBPS/filter/FlatCardBig.uasset index 42235c3fa..07ebc90b4 100644 Binary files a/Content/Blueprints/UI/WBPS/filter/FlatCardBig.uasset and b/Content/Blueprints/UI/WBPS/filter/FlatCardBig.uasset differ diff --git a/Content/Blueprints/UI/WBPS/flatPlan.uasset b/Content/Blueprints/UI/WBPS/flatPlan.uasset index 4291d8337..3baf02785 100644 Binary files a/Content/Blueprints/UI/WBPS/flatPlan.uasset and b/Content/Blueprints/UI/WBPS/flatPlan.uasset differ diff --git a/Content/Blueprints/Utils/overlapTester.uasset b/Content/Blueprints/Utils/overlapTester.uasset index e0407fc10..db490f509 100644 Binary files a/Content/Blueprints/Utils/overlapTester.uasset and b/Content/Blueprints/Utils/overlapTester.uasset differ diff --git a/Content/Blueprints/filterRRR.uasset b/Content/Blueprints/filterRRR.uasset index 4e2e67e36..7f3a98ef4 100644 Binary files a/Content/Blueprints/filterRRR.uasset and b/Content/Blueprints/filterRRR.uasset differ diff --git a/Content/Blueprints/world/BM_Elevator.uasset b/Content/Blueprints/world/BM_Elevator.uasset index 10c55a562..a3b7bfefe 100644 Binary files a/Content/Blueprints/world/BM_Elevator.uasset and b/Content/Blueprints/world/BM_Elevator.uasset differ diff --git a/Content/Maps/Interior/Parking/Parking_GP9.umap b/Content/Maps/Interior/Parking/Parking_GP9.umap index e4f876388..2b36aec2c 100644 Binary files a/Content/Maps/Interior/Parking/Parking_GP9.umap and b/Content/Maps/Interior/Parking/Parking_GP9.umap differ diff --git a/Content/Maps/crmTest.umap b/Content/Maps/crmTest.umap index b7e11107c..29cb2819c 100644 Binary files a/Content/Maps/crmTest.umap and b/Content/Maps/crmTest.umap differ diff --git a/Content/Maps/mainScene.umap b/Content/Maps/mainScene.umap index 455414476..9cfa0a509 100644 Binary files a/Content/Maps/mainScene.umap and b/Content/Maps/mainScene.umap differ diff --git a/Content/Maps/naviBake.umap b/Content/Maps/naviBake.umap index 0d049ee9e..3ff350f72 100644 Binary files a/Content/Maps/naviBake.umap and b/Content/Maps/naviBake.umap differ diff --git a/Source/MasharovDev/commands.h b/Source/MasharovDev/commands.h index ad7ade052..958cf32f7 100644 --- a/Source/MasharovDev/commands.h +++ b/Source/MasharovDev/commands.h @@ -24,6 +24,7 @@ struct TCommand * write(const char *buffer, size_t size) */ + template void sendCommand(CSocket &socket, const TCommand &command) { @@ -31,3 +32,5 @@ void sendCommand(CSocket &socket, const TCommand &command) } #pragma pack(pop) + + diff --git a/Source/MasharovDev/commands_model.h b/Source/MasharovDev/commands_model.h index d41bc0204..a9783cb41 100644 --- a/Source/MasharovDev/commands_model.h +++ b/Source/MasharovDev/commands_model.h @@ -2,6 +2,18 @@ #include "commands.h" +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include +#include +#include +#include + +#pragma comment(lib, "Ws2_32.lib") + #pragma pack(push,1) /* Для всех команд: @@ -20,10 +32,10 @@ * 3 - подсветка белым цветом */ -// Команда, предотвращающая переход в автоматический режим + // Команда, предотвращающая переход в автоматический режим #define CMD_NOP 0x00 -struct CMD_NOP_T: public TCommand +struct CMD_NOP_T : public TCommand { }; @@ -44,13 +56,13 @@ struct CMD_NOP_T: public TCommand #define OPT_COLOR_COUNT 3 #define CMD_GET_COLOR 0x01 -struct CMD_GET_COLOR_T: public TCommand +struct CMD_GET_COLOR_T : public TCommand { byte code; }; #define CMD_SET_COLOR 0x02 -struct CMD_SET_COLOR_T: public TCommand +struct CMD_SET_COLOR_T : public TCommand { byte code; byte r, g, b; @@ -59,7 +71,7 @@ struct CMD_SET_COLOR_T: public TCommand // Команда включения/выключения подсветки всего здания #define CMD_SET_BUILDING_STATE 0x03 -struct CMD_SET_BUILDING_STATE_T: public TCommand +struct CMD_SET_BUILDING_STATE_T : public TCommand { byte building; byte state; @@ -68,7 +80,7 @@ struct CMD_SET_BUILDING_STATE_T: public TCommand // Команда включения/выключения подсветки отдельной квартиры #define CMD_SET_ROOM_STATE 0x04 -struct CMD_SET_ROOM_STATE_T: public TCommand +struct CMD_SET_ROOM_STATE_T : public TCommand { byte building; byte strip; @@ -79,7 +91,7 @@ struct CMD_SET_ROOM_STATE_T: public TCommand // Команда включения/выключения подсветки всего этажа #define CMD_SET_FLOOR_STATE 0x05 -struct CMD_SET_FLOOR_STATE_T: public TCommand +struct CMD_SET_FLOOR_STATE_T : public TCommand { byte building; byte floor; @@ -89,7 +101,7 @@ struct CMD_SET_FLOOR_STATE_T: public TCommand // Команда установки подсветки всех квартир #define CMD_SET_ALL_STATE 0x06 -struct CMD_SET_ALL_STATE_T: public TCommand +struct CMD_SET_ALL_STATE_T : public TCommand { byte state; }; @@ -98,7 +110,7 @@ struct CMD_SET_ALL_STATE_T: public TCommand // millisec - время в миллисекундах #define CMD_SET_DOME_TIME 0x07 -struct CMD_SET_DOME_TIME_T: public TCommand +struct CMD_SET_DOME_TIME_T : public TCommand { word millisec; }; @@ -112,18 +124,53 @@ struct CMD_SET_DOME_TIME_T: public TCommand #define PART_OFFICE_LIGHT 0x08 #define CMD_SET_PART_MODE 0x08 -struct CMD_SET_PART_MODE_T: public TCommand +struct CMD_SET_PART_MODE_T : public TCommand { byte mode; byte part; }; -/* Пример отправки команды: - * - * DECLARE_CMD(CMD_SET_BUILDING_STATE, cmd); - * cmd.building = 1; - * cmd.state = 1; - * sendCommand(socket, cmd); - */ +//Пример отправки команды: +/*DECLARE_CMD(CMD_SET_BUILDING_STATE, cmd); +cmd.building = 1; +cmd.state = 1; +sendCommand(socket, cmd);*/ + + #pragma pack(pop) + + class CSocket { + char* ipAddr_; + u_short port_; + + public: + CSocket(char* ipAddr, u_short port) { + ipAddr_ = ipAddr; + port_ = port; + } + void write(const char* buffer, size_t size) { + int clientSocket = socket(AF_INET, SOCK_STREAM, 0); + if (clientSocket == -1) { + std::cerr << "Error creating socket" << std::endl; + return; + } + + struct sockaddr_in serverAddress; + serverAddress.sin_family = AF_INET; + serverAddress.sin_port = htons(port_); // Порт сервера + serverAddress.sin_addr.s_addr = inet_addr(ipAddr_); // IP адрес сервера + + if (connect(clientSocket, (struct sockaddr*)&serverAddress, sizeof(serverAddress)) == -1) { + std::cerr << "Error connecting to server" << std::endl; + return; + } + + if (send(clientSocket, buffer, size, 0) == -1) { + std::cerr << "Error sending message" << std::endl; + return; + } + + closesocket(clientSocket); + } + }; \ No newline at end of file diff --git a/Source/MasharovDev/cppGI.cpp b/Source/MasharovDev/cppGI.cpp index 7cbbcf723..c75dfe34d 100644 --- a/Source/MasharovDev/cppGI.cpp +++ b/Source/MasharovDev/cppGI.cpp @@ -4,10 +4,12 @@ #include "cppGI.h" #include "Kismet/GameplayStatics.h" #include "Misc/paths.h" +#include "commands_model.h" #include "Engine/levelstreamingdynamic.h" -/*for working tarray::Contains*/ +CSocket* soc; +/*for working tarray::Contains*/ bool operator==(const Fcppcoords& c1, const Fcppcoords& c2) { return c1.flat == c2.flat && c1.floor == c2.floor && @@ -94,6 +96,7 @@ void UcppGI::cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, return; } + void UcppGI::cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMinus2, bool fastEq, bool& flat_, bool& type_, bool& zone_, bool& house_, bool& section_, bool& floor_, bool& fullEq) { bool* outLvl[6] = { &flat_, &type_, &zone_, &house_, §ion_, &floor_ }; @@ -118,3 +121,74 @@ void UcppGI::cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMin } } + +void UcppGI::avoidAutoState() +{ + if (!soc)return; + + DECLARE_CMD(CMD_NOP, cmd); + sendCommand(*soc, cmd); +} + +void UcppGI::makeSocket(FString ip, int port) +{ + char* ipc=NULL; + wcstombs(ipc, *ip, ip.Len()); + soc = new CSocket(ipc, port); +} + +void UcppGI::setColor(uint8 code, FColor color) +{ + if (!soc)return; + + DECLARE_CMD(CMD_SET_COLOR, cmd); + cmd.code = code; + cmd.r = color.R, cmd.g=color.G, cmd.b=color.B; + sendCommand(*soc, cmd); + +} + +void UcppGI::setLight(int house, int floor, int strip, uint8 state) +{ + if (!soc)return; + + if (strip < 0) { + if (floor < 0) { + if (house < 0) { + DECLARE_CMD(CMD_SET_ALL_STATE, cmd); + cmd.state = state; + sendCommand(*soc, cmd); + return; + } + DECLARE_CMD(CMD_SET_BUILDING_STATE, cmd); + cmd.state = state; + cmd.building = house; + sendCommand(*soc, cmd); + return; + } + DECLARE_CMD(CMD_SET_FLOOR_STATE, cmd); + cmd.state = state; + cmd.building = house; + cmd.floor = floor; + sendCommand(*soc, cmd); + return; + } + DECLARE_CMD(CMD_SET_ROOM_STATE, cmd); + cmd.state = state; + cmd.building = house; + cmd.floor = floor; + cmd.strip = strip; + sendCommand(*soc, cmd); + +} + +void UcppGI::setPartState(uint8 part, uint8 state) +{ + if (!soc)return; + DECLARE_CMD(CMD_SET_PART_MODE, cmd); + cmd.mode = state; + cmd.part = part; + sendCommand(*soc, cmd); + + +} diff --git a/Source/MasharovDev/cppGI.h b/Source/MasharovDev/cppGI.h index f628c67b3..ff0a07c7f 100644 --- a/Source/MasharovDev/cppGI.h +++ b/Source/MasharovDev/cppGI.h @@ -7,7 +7,7 @@ #include "cppGI.generated.h" /** - * + * */ USTRUCT(BlueprintType) @@ -15,18 +15,18 @@ struct Fcppcoords { GENERATED_BODY() - UPROPERTY(BlueprintReadWrite, category = "default") - int32 flat = -1; UPROPERTY(BlueprintReadWrite, category = "default") - int32 type = 0; + int32 flat = -1; UPROPERTY(BlueprintReadWrite, category = "default") - int32 zone = 1; + int32 type = 0; UPROPERTY(BlueprintReadWrite, category = "default") - int32 house = -1; + int32 zone = 1; UPROPERTY(BlueprintReadWrite, category = "default") - int32 section = -1; + int32 house = -1; UPROPERTY(BlueprintReadWrite, category = "default") - int32 floor = -1; + int32 section = -1; + UPROPERTY(BlueprintReadWrite, category = "default") + int32 floor = -1; }; @@ -35,16 +35,16 @@ struct FcppLevelStruct { GENERATED_BODY() - UPROPERTY(BlueprintReadWrite) - Fcppcoords coords; UPROPERTY(BlueprintReadWrite) - bool dontUnload = false; + Fcppcoords coords; UPROPERTY(BlueprintReadWrite) - FString path; + bool dontUnload = false; UPROPERTY(BlueprintReadWrite) - float Z = 0; + FString path; UPROPERTY(BlueprintReadWrite) - int32 anotherLvl = -1; + float Z = 0; + UPROPERTY(BlueprintReadWrite) + int32 anotherLvl = -1; }; UCLASS() @@ -52,20 +52,55 @@ class MASHAROVDEV_API UcppGI : public UGameInstance { GENERATED_BODY() public: - UFUNCTION(blueprintcallable, category = "cppFuncLib") - static void cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMinus2, bool fastEq, bool& flat_, bool& type_, bool& zone_, bool& house_, bool& section_, bool& floor_, bool& fullEq); + UFUNCTION(blueprintcallable, category = "cppFuncLib") + static void cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMinus2, bool fastEq, bool& flat_, bool& type_, bool& zone_, bool& house_, bool& section_, bool& floor_, bool& fullEq); - - /*returns array of levels for binding and array of lvlstruct for loading*/ + + /*returns array of levels for binding and array of lvlstruct for loading*/ UFUNCTION(blueprintcallable, Category = "Level Loading", meta = (WorldContext = "WorldContextObject")) - void cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, uint8 currentState, TArray& Levelss); - + void cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, uint8 currentState, TArray& Levelss); + UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading", meta = (MultiLine = "true")) - TArray cpplevelLIst; + TArray cpplevelLIst; /** used if need to load some levels instantly. -2 of any coord is use current. */ UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Level Loading", meta = (MultiLine = "true")) - TArray cpplvlsForLoading; + TArray cpplvlsForLoading; UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Level Loading", meta = (MultiLine = "true")) - TArray cppdynamicLvls; + TArray cppdynamicLvls; + + UFUNCTION(blueprintcallable, Category = "maketConnection") + void avoidAutoState(); + UFUNCTION(blueprintcallable, Category = "maketConnection") + void makeSocket(FString ip, int port); + /*codes: + *0 - + *1 - (, ) + *2 - (, ) */ + UFUNCTION(blueprintcallable, Category = "maketConnection") + void setColor(uint8 code, FColor color); + /*assign -1 to set all, i.e. flat==-1 -> set whole floor, floor==-1 -> set whole house + states: + *0 ( ) + *1 ( ) + *2 ( ) + *3 ( )*/ + UFUNCTION(blueprintcallable, Category = "maketConnection") + void setLight(int house=-1, int floor=-1, int strip=-1, uint8 state=0); + /*assign -1 to set all, i.e. flat==-1 -> set whole floor, floor==-1 -> set whole house + * parts: + * 255 + * 0 + * 2 + * 4 + * 8 + * + states: + *0 + *1 , ( , , ) + *2 , ( )*/ + UFUNCTION(blueprintcallable, Category = "maketConnection") + + void setPartState(uint8 part, uint8 state); + };