diff --git a/FlightSimulation/Content/BluePrints/BP_PixStreamActor.uasset b/FlightSimulation/Content/BluePrints/BP_PixStreamActor.uasset index 46e108c..afb6449 100644 Binary files a/FlightSimulation/Content/BluePrints/BP_PixStreamActor.uasset and b/FlightSimulation/Content/BluePrints/BP_PixStreamActor.uasset differ diff --git a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/ActorUEJSComponent.cpp b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/ActorUEJSComponent.cpp index 5be0098..e12ccef 100644 --- a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/ActorUEJSComponent.cpp +++ b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/ActorUEJSComponent.cpp @@ -38,7 +38,11 @@ bool UActorUEJSComponent::JsMessageDispatch(const FString& message) OnJsMessageCallbackDelegate.Broadcast(result); } }); - return Scenario->Load(); + + const FString rwbs = jsonObject->GetStringField(TEXT("rwbs")); + const FString rq = jsonObject->GetStringField(TEXT("rq")); + const FString bc = jsonObject->GetStringField(TEXT("bc")); + return Scenario->LoadMissionData(rwbs, rq, bc); } else if (TEXT("LoadScenarioTask") == func) { @@ -52,7 +56,11 @@ bool UActorUEJSComponent::JsMessageDispatch(const FString& message) }); const FString year = jsonObject->GetStringField(TEXT("year")); - return Scenario->LoadRWBS(TCHAR_TO_UTF8(*year)); + if (year.IsEmpty()) + { + return false; + } + return Scenario->LoadRWBS(year); } else if (TEXT("SelectScenarioTask") == func) { auto Scenario = TDMScenario::Create(); @@ -65,6 +73,10 @@ bool UActorUEJSComponent::JsMessageDispatch(const FString& message) }); const FString task = jsonObject->GetStringField(TEXT("task")); + if (task.IsEmpty()) + { + return false; + } return Scenario->LoadBCSJ(task); } diff --git a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.cpp b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.cpp index eb263f7..06c4b21 100644 --- a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.cpp +++ b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.cpp @@ -12,11 +12,29 @@ #include "DMRunnable.h" #include "UEDMPlugin.h" -struct SQLData +struct BCData { int64 timestamp; int32 bc; - std::string yxr; + FString yxr; + int32 count; + FString jx; +}; + +struct HKBData +{ + FString bdid; + FString jx; //型号 + FString jh; //机号 + FString qc_dh; //编号 + FString zy; //阵营 + FString dwjc; //单位简称 + FString dwdm; //单位代码 + FString fxsj_ly; //数据来源 + FString hc_dm; //后舱代号 + FString hc_xm; //后舱姓名 + FString txbg_sk; //体系摧毁时刻 + FString rwlx; //执行任务 }; FString GBKToUTF8(const char* gbkStr) @@ -26,19 +44,19 @@ FString GBKToUTF8(const char* gbkStr) { return FString("Error in MultiByteToWideChar"); } - + std::vector wideStr(wideLen); MultiByteToWideChar(CP_ACP, 0, gbkStr, -1, wideStr.data(), wideLen); - + int utf8Len = WideCharToMultiByte(CP_UTF8, 0, wideStr.data(), -1, nullptr, 0, nullptr, nullptr); if (utf8Len == 0) { return FString("Error in WideCharToMultiByte"); } - + std::vector utf8Str(utf8Len); WideCharToMultiByte(CP_UTF8, 0, wideStr.data(), -1, utf8Str.data(), utf8Len, nullptr, nullptr); - + FString result = FString(UTF8_TO_TCHAR(utf8Str.data())); return result; } @@ -46,44 +64,46 @@ FString GBKToUTF8(const char* gbkStr) std::string UTF8ToGBK(const FString& str) { std::string utf8Str(TCHAR_TO_UTF8(*str)); - + int wideLen = MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), -1, nullptr, 0); if (wideLen == 0) { return "Error in MultiByteToWideChar"; } - + std::vector wideStr(wideLen); MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), -1, wideStr.data(), wideLen); - + int gbkLen = WideCharToMultiByte(CP_ACP, 0, wideStr.data(), -1, nullptr, 0, nullptr, nullptr); if (gbkLen == 0) { return "Error in WideCharToMultiByte"; } - + std::vector gbkStr(gbkLen); WideCharToMultiByte(CP_ACP, 0, wideStr.data(), -1, gbkStr.data(), gbkLen, nullptr, nullptr); - + return std::string(gbkStr.begin(), gbkStr.end()); } -TSharedPtr ConvertSQLDataToJson(const SQLData& data) +TSharedPtr ConvertSQLDataToJson(const BCData& data) { TSharedPtr JsonObject = MakeShareable(new FJsonObject()); JsonObject->SetNumberField("timestamp", data.timestamp); JsonObject->SetNumberField("bc", data.bc); - JsonObject->SetStringField("yxr", FString(data.yxr.c_str())); + JsonObject->SetStringField("yxr", data.yxr); + JsonObject->SetNumberField("count", data.count); + JsonObject->SetStringField("jx", data.jx); return JsonObject; } -FString ConvertSQLDataVectorToJson(const FString& response, const std::vector& dataVector) +FString ConvertSQLDataVectorToJson(const FString& response, const std::vector& dataVector) { TArray> JsonArray; - for (const SQLData& data : dataVector) + for (const BCData& data : dataVector) { TSharedPtr JsonObject = ConvertSQLDataToJson(data); JsonArray.Add(MakeShareable(new FJsonValueObject(JsonObject))); @@ -100,8 +120,6 @@ FString ConvertSQLDataVectorToJson(const FString& response, const std::vector& dataVector) { TArray> JsonArray; @@ -122,6 +140,51 @@ FString ConvertRWBSVectorToJson(const FString& response, const std::vector& dataVector) +{ + TArray> JsonArray; + + for (const HKBData& data : dataVector) + { + TSharedPtr JsonObject = MakeShareable(new FJsonObject()); + + JsonObject->SetStringField(TEXT("BDID"), data.bdid); + JsonObject->SetStringField(TEXT("型号"), data.jx); + JsonObject->SetStringField(TEXT("机号"), data.jh); + JsonObject->SetStringField(TEXT("编号"), data.qc_dh); + JsonObject->SetStringField(TEXT("阵营"), data.zy); + JsonObject->SetStringField(TEXT("单位简称"), data.dwjc); + JsonObject->SetStringField(TEXT("单位代码"), data.dwdm); + JsonObject->SetStringField(TEXT("数据来源"), data.fxsj_ly); + JsonObject->SetStringField(TEXT("后舱代号"), data.hc_dm); + JsonObject->SetStringField(TEXT("后舱姓名"), data.hc_xm); + JsonObject->SetStringField(TEXT("体系摧毁时刻"), data.txbg_sk); + JsonObject->SetStringField(TEXT("执行任务"), data.rwlx); + + FString leftString; + FString rightString; + bool is = data.txbg_sk.Split(" ", &leftString, &rightString); + if (is) + { + JsonObject->SetStringField(TEXT("体系摧毁文本信息"), rightString); + } + + JsonObject->SetStringField(TEXT("体系摧毁文本颜色"), FColor(255, 0, 0, 255).ToString()); + + JsonArray.Add(MakeShareable(new FJsonValueObject(JsonObject))); + } + + TSharedPtr RootObject = MakeShareable(new FJsonObject()); + RootObject->SetArrayField("data", JsonArray); + RootObject->SetStringField("type", response); + + FString JsonString; + TSharedRef> Writer = TJsonWriterFactory::Create(&JsonString); + FJsonSerializer::Serialize(RootObject.ToSharedRef(), Writer); + + return JsonString; +} + TDMScenario::TDMScenario() { } @@ -136,11 +199,10 @@ TSharedPtr TDMScenario::Create() return self; } -bool TDMScenario::LoadRWBS(const std::string& year) +bool TDMScenario::LoadRWBS(const FString& year) { - std::string sSQL = "select distinct RWBS from kzdk.rw_jbqk where to_char(ksrq, 'yyyy') = '" + year + "'"; - - UE_LOG(LogUEDMPlugin, Log, TEXT("SQL=%s"), UTF8_TO_TCHAR(sSQL.c_str())); + FString query = FString::Format(TEXT("select distinct RWBS from kzdk.rw_jbqk where to_char(ksrq, 'yyyy') ='{0}';"), { year }); + std::string sSQL = UTF8ToGBK(query); TSharedPtr sqlCommand = MakeShareable(new FSQLCommand); sqlCommand->Type = ESQLType::SELECT; @@ -184,14 +246,15 @@ bool TDMScenario::LoadRWBS(const std::string& year) } dmRunnable->ExcuteSQL(sqlCommand); return true; - } bool TDMScenario::LoadBCSJ(const FString& rwbs) { - FString query = FString::Format(TEXT("select RQ, BC, YXR from kzdk.RW_BCSJ where RWBS = '{0}' order by rq, bc asc;"), - { rwbs }); - std::string sSQL = UTF8ToGBK(query) ; + FString query = FString::Format(TEXT("select a.RQ,a.BC,a.YXR, " + "(select count(b.bdid) from kzdk.rw_fxjc b where b.rwbs = '{0}' and b.rq = a.rq and b.bc = a.bc), " + "(select LISTAGG(distinct c.jx, ',') from kzdk.rw_fxjc c where c.rwbs = '{0}' and c.rq = a.rq and c.bc = a.bc) " + "from kzdk.RW_BCSJ a where a.RWBS = '{0}' order by a.rq, a.bc asc; "), { rwbs }); + std::string sSQL = UTF8ToGBK(query); TSharedPtr sqlCommand = MakeShareable(new FSQLCommand); sqlCommand->Type = ESQLType::SELECT; @@ -201,91 +264,45 @@ bool TDMScenario::LoadBCSJ(const FString& rwbs) sdint8 out_c1 = 0; sdint4 out_c2 = 0; sdbyte out_c3[20] = { 0 }; + sdint4 out_c4 = 0; + sdbyte out_c5[128] = { 0 }; slength out_c1_ind = 0; slength out_c2_ind = 0; slength out_c3_ind = 0; + slength out_c4_ind = 0; + slength out_c5_ind = 0; dpi_bind_col(content, 1, DSQL_C_TIMESTAMP, &out_c1, sizeof(out_c1), &out_c1_ind); dpi_bind_col(content, 2, DSQL_C_SLONG, &out_c2, sizeof(out_c2), &out_c2_ind); dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind); + dpi_bind_col(content, 4, DSQL_C_SLONG, &out_c4, sizeof(out_c4), &out_c4_ind); + dpi_bind_col(content, 5, DSQL_C_NCHAR, &out_c5, sizeof(out_c5), &out_c5_ind); ulength row_num = 0; - std::vector tables; + std::vector tables; while (dpi_fetch(content, &row_num) != DSQL_NO_DATA) { - tables.push_back({ out_c1, out_c2, (char*)out_c3 }); + tables.push_back({ out_c1, out_c2, GBKToUTF8((const char*)out_c3), out_c4, GBKToUTF8((const char*)out_c5) }); UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3)); } - TSharedPtr Result = MakeShareable(new SelectResult(std::move(tables))); - return Result; - }; - - TSharedPtr self = AsShared(); - sqlCommand->OnQueryCompleted.BindLambda([self](TSharedPtr Result) - { - if (!Result) - { - UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed, Result is nullptr")); - } - SelectResult* sqlData = static_cast*>(Result.Get()); - if (!sqlData->succes) - { - UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed")); - return; - } - - FString jsonString = ConvertSQLDataVectorToJson(TEXT("SelectScenarioTaskResponse"), sqlData->table); - bool success = self->OnQueryCompleted.ExecuteIfBound(jsonString); - UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query OnQueryCompleted.ExecuteIfBound %d"), success); - }); - - auto dmRunnable = FUEDMPluginModule::GetDMRunnable(); - if (nullptr == dmRunnable) - { - UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query dm runnable is nullptr")); - } - dmRunnable->ExcuteSQL(sqlCommand); - return true; -} - -bool TDMScenario::Load() -{ - TSharedPtr sqlCommand = MakeShareable(new FSQLCommand); - sqlCommand->Type = ESQLType::SELECT; - sqlCommand->SQL = "select RQ,BC,YXR from kzdk.RW_BCSJ order by rq ,bc asc;"; - sqlCommand->select = [](void* content) - { - sdint8 out_c1 = 0; - sdint4 out_c2 = 0; - sdbyte out_c3[20] = { 0 }; - slength out_c1_ind = 0; - slength out_c2_ind = 0; - slength out_c3_ind = 0; - dpi_bind_col(content, 1, DSQL_C_TIMESTAMP, &out_c1, sizeof(out_c1), &out_c1_ind); - dpi_bind_col(content, 2, DSQL_C_SLONG, &out_c2, sizeof(out_c2), &out_c2_ind); - dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind); - ulength row_num = 0; - - std::vector tables; - while (dpi_fetch(content, &row_num) != DSQL_NO_DATA) - { - tables.push_back({ out_c1, out_c2, (char*)out_c3 }); - UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3)); - } - TSharedPtr Result = MakeShareable(new SelectResult(std::move(tables))); + TSharedPtr Result = MakeShareable(new SelectResult(std::move(tables))); return Result; }; TSharedPtr self = AsShared(); sqlCommand->OnQueryCompleted.BindLambda([self](TSharedPtr Result) { - SelectResult* sqlData = static_cast*>(Result.Get()); + if (!Result) + { + UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed, Result is nullptr")); + } + SelectResult* sqlData = static_cast*>(Result.Get()); if (!sqlData->succes) { - UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Load failed")); + UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::LoadBCSJ failed")); return; } - FString jsonString = ConvertSQLDataVectorToJson(TEXT("LoadScenarioResponse"), sqlData->table); + FString jsonString = ConvertSQLDataVectorToJson(TEXT("SelectScenarioTaskResponse"), sqlData->table); bool success = self->OnQueryCompleted.ExecuteIfBound(jsonString); UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query OnQueryCompleted.ExecuteIfBound %d"), success); }); @@ -299,7 +316,7 @@ bool TDMScenario::Load() return true; } -void TDMScenario::LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc) +bool TDMScenario::LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc) { UE_LOG(LogUEDMPlugin, Log, TEXT("LoadMissionData Begin")); @@ -308,20 +325,111 @@ void TDMScenario::LoadMissionData(const FString& rwbs, const FString& rq, const LoadDMMBData(rwbs, rq, bc); UE_LOG(LogUEDMPlugin, Log, TEXT("LoadMissionData End")); + + return true; } void TDMScenario::LoadHKBData(const FString& rwbs, const FString& rq, const FString& bc) { - std::string sSQL = "select bdid, jx, jh, qc_dh, zy, dwjc, dwdm, fxsj_ly, hc_dm, hc_xm, txbg_sk, RWLX from kzdk.RW_FXJC where RWBS = " + - std::string(TCHAR_TO_UTF8(*rwbs)) + " and RQ = to_date('" + - std::string(TCHAR_TO_UTF8(*rq)) + "', 'yyyy-mm-dd') and BC = " + std::string(TCHAR_TO_UTF8(*bc)); + FString query = FString::Format(TEXT("select bdid, jx, jh, qc_dh, zy, dwjc, dwdm, fxsj_ly, hc_dm, hc_xm, txbg_sk, RWLX from kzdk.RW_FXJC" + " where RWBS = '{0}' and RQ = to_date('{1}', 'yyyy-mm-dd') and BC = {2};"), { rwbs, rq, bc }); + std::string sSQL = UTF8ToGBK(query); + + TSharedPtr sqlCommand = MakeShareable(new FSQLCommand); + sqlCommand->Type = ESQLType::SELECT; + sqlCommand->SQL = sSQL; + sqlCommand->select = [](void* content) + { + sdbyte out_c1[40] = { 0 }; + sdbyte out_c2[30] = { 0 }; + sdbyte out_c3[50] = { 0 }; + sdbyte out_c4[20] = { 0 }; + sdbyte out_c5[200] = { 0 }; + sdbyte out_c6[200] = { 0 }; + sdbyte out_c7[200] = { 0 }; + sdbyte out_c8[20] = { 0 }; + sdbyte out_c9[20] = { 0 }; + sdbyte out_c10[30] = { 0 }; + dpi_timestamp_t out_c11; + sdbyte out_c12[20] = { 0 }; + slength out_c1_ind = 0; + slength out_c2_ind = 0; + slength out_c3_ind = 0; + slength out_c4_ind = 0; + slength out_c5_ind = 0; + slength out_c6_ind = 0; + slength out_c7_ind = 0; + slength out_c8_ind = 0; + slength out_c9_ind = 0; + slength out_c10_ind = 0; + slength out_c11_ind = 0; + slength out_c12_ind = 0; + dpi_bind_col(content, 1, DSQL_C_NCHAR, &out_c1, sizeof(out_c1), &out_c1_ind); + dpi_bind_col(content, 2, DSQL_C_NCHAR, &out_c2, sizeof(out_c2), &out_c2_ind); + dpi_bind_col(content, 3, DSQL_C_NCHAR, &out_c3, sizeof(out_c3), &out_c3_ind); + dpi_bind_col(content, 4, DSQL_C_NCHAR, &out_c4, sizeof(out_c4), &out_c4_ind); + dpi_bind_col(content, 5, DSQL_C_NCHAR, &out_c5, sizeof(out_c5), &out_c5_ind); + dpi_bind_col(content, 6, DSQL_C_NCHAR, &out_c6, sizeof(out_c6), &out_c6_ind); + dpi_bind_col(content, 7, DSQL_C_NCHAR, &out_c7, sizeof(out_c7), &out_c7_ind); + dpi_bind_col(content, 8, DSQL_C_NCHAR, &out_c8, sizeof(out_c8), &out_c8_ind); + dpi_bind_col(content, 9, DSQL_C_NCHAR, &out_c9, sizeof(out_c9), &out_c9_ind); + dpi_bind_col(content, 10, DSQL_C_NCHAR, &out_c10, sizeof(out_c10), &out_c10_ind); + dpi_bind_col(content, 11, DSQL_C_TIMESTAMP, &out_c11, sizeof(out_c11), &out_c11_ind); + dpi_bind_col(content, 12, DSQL_C_NCHAR, &out_c12, sizeof(out_c12), &out_c12_ind); + ulength row_num = 0; + + std::vector tables; + while (dpi_fetch(content, &row_num) != DSQL_NO_DATA) + { + + FString st = FString::Format(TEXT("{0}-{1}-{2} {3}:{4}:{5}"), { out_c11.year, out_c11.month, out_c11.day, out_c11.hour, out_c11.minute, out_c11.second }); + + tables.push_back({ GBKToUTF8((char*)out_c1), GBKToUTF8((char*)out_c2), GBKToUTF8((char*)out_c3), GBKToUTF8((char*)out_c4), + GBKToUTF8((char*)out_c5), GBKToUTF8((char*)out_c6), GBKToUTF8((char*)out_c7), GBKToUTF8((char*)out_c8), + GBKToUTF8((char*)out_c9), GBKToUTF8((char*)out_c10), st, GBKToUTF8((char*)out_c12) }); + UE_LOG(LogUEDMPlugin, Log, TEXT("RQ=%llu, BC=%d YXR=%s"), out_c1, out_c2, UTF8_TO_TCHAR((char*)out_c3)); + } + TSharedPtr Result = MakeShareable(new SelectResult(std::move(tables))); + return Result; + }; + + TSharedPtr self = AsShared(); + sqlCommand->OnQueryCompleted.BindLambda([self](TSharedPtr Result) + { + SelectResult* sqlData = static_cast*>(Result.Get()); + if (!sqlData->succes) + { + UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query failed")); + return; + } + + FString jsonString = ConvertHKBDataVectorToJson(TEXT("HKB-Base"), sqlData->table); + bool success = self->OnLoadCompleted.ExecuteIfBound(jsonString); + UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query OnLoadCompleted.ExecuteIfBound %d"), success); + }); + + auto dmRunnable = FUEDMPluginModule::GetDMRunnable(); + if (nullptr == dmRunnable) + { + UE_LOG(LogUEDMPlugin, Error, TEXT("TDMScenario::Query dm runnable is nullptr")); + } + dmRunnable->ExcuteSQL(sqlCommand); } bool TDMScenario::LoadKkwqsyList(const FString& bdid, const FString& qrxg, const FString& qcdh, const FString& zy) { - std::string sSQL = "select dx, fsbh, GJ_JL, GJ_FW, gj_sk, GJTS, DMZYSK, ZD_JSSK, gjxg_qrmb, dx, MZYXX, FS_JH from kzdk.rw_fxjc_wqsy where sjlx = '空空' and gjxg_qrxg = " + - std::string(TCHAR_TO_UTF8(*qrxg)) + " and bdid = " + - std::string(TCHAR_TO_UTF8(*bdid)); + //FString query = FString::Format(TEXT("select bdid, jx, jh, qc_dh, zy, dwjc, dwdm, fxsj_ly, hc_dm, hc_xm, txbg_sk, RWLX from kzdk.RW_FXJC" + // " where RWBS = '{0}' and RQ = to_date('{1}', 'yyyy-mm-dd') and BC = {2};"), { rwbs, rq, bc }); + //std::string sSQL = UTF8ToGBK(query); + + //TSharedPtr sqlCommand = MakeShareable(new FSQLCommand); + //sqlCommand->Type = ESQLType::SELECT; + //sqlCommand->SQL = sSQL; + //sqlCommand->select = [](void* content) + + // std::string sSQL = "select dx, fsbh, GJ_JL, GJ_FW, gj_sk, GJTS, DMZYSK, ZD_JSSK, gjxg_qrmb, dx, MZYXX, FS_JH from kzdk.rw_fxjc_wqsy where sjlx = '空空' and gjxg_qrxg = " + + // std::string(TCHAR_TO_UTF8(*qrxg)) + " and bdid = " + + // std::string(TCHAR_TO_UTF8(*bdid)); return true; } diff --git a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.h b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.h index e4390a8..7a2918c 100644 --- a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.h +++ b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/DMScenario.h @@ -3,9 +3,9 @@ #pragma once #include "CoreMinimal.h" -#include DECLARE_DELEGATE_OneParam(FOnSQLCompleted, FString); +DECLARE_DELEGATE_OneParam(FOnLoadCompleted, FString); /** * @@ -19,17 +19,16 @@ public: static TSharedPtr Create(); // 加载任务标识 - bool LoadRWBS(const std::string& year); + bool LoadRWBS(const FString& year); // 加载波次 bool LoadBCSJ(const FString& rwbs); - bool Load(); // 加载任务数据 //rwbs:任务标识 //rq:日期 //bc:波次 - void LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc); + bool LoadMissionData(const FString& rwbs, const FString& rq, const FString& bc); // 加载航空兵数据 void LoadHKBData(const FString& rwbs, const FString& rq, const FString& bc); @@ -49,4 +48,5 @@ public: public: FOnSQLCompleted OnQueryCompleted; + FOnLoadCompleted OnLoadCompleted; }; diff --git a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEDMPlugin.cpp b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEDMPlugin.cpp index 65d939a..ab45412 100644 --- a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEDMPlugin.cpp +++ b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEDMPlugin.cpp @@ -8,6 +8,8 @@ #include "DMRunnable.h" #include "DPI.h" +#include "DMScenario.h" + #define LOCTEXT_NAMESPACE "FUEDMPluginModule" DEFINE_LOG_CATEGORY(LogUEDMPlugin); @@ -18,6 +20,14 @@ void FUEDMPluginModule::StartupModule() { // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module dmRunnable_ = new FDMRunnable(); + + //auto Scenario = TDMScenario::Create(); + //Scenario->OnQueryCompleted.BindLambda([this](const FString& result) + // { + + // }); + + //Scenario->LoadRWBS("2019"); } void FUEDMPluginModule::ShutdownModule() diff --git a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEJSBlueprintFunctionLibrary.cpp b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEJSBlueprintFunctionLibrary.cpp index 74a872e..ca51b17 100644 --- a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEJSBlueprintFunctionLibrary.cpp +++ b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Private/UEJSBlueprintFunctionLibrary.cpp @@ -21,7 +21,7 @@ bool UUEJSBlueprintFunctionLibrary::JsMessageDispatch(const FString& message) if (TEXT("LoadTask") == func) { auto Scenario = TDMScenario::Create(); - Scenario->Load(); + //Scenario->Load(); } return true; diff --git a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Public/ActorUEJSComponent.h b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Public/ActorUEJSComponent.h index f1799da..9f9e972 100644 --- a/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Public/ActorUEJSComponent.h +++ b/FlightSimulation/Plugins/UEDMPlugin/Source/UEDMPlugin/Public/ActorUEJSComponent.h @@ -26,15 +26,11 @@ public: UPROPERTY(BlueprintAssignable) FJsMessageCallbackDelegate OnJsMessageCallbackDelegate; - - protected: // Called when the game starts virtual void BeginPlay() override; public: // Called every frame - virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; - - + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; };