diff --git a/test/STL.h b/test/STL.h index e300286..76382a7 100644 --- a/test/STL.h +++ b/test/STL.h @@ -33,13 +33,22 @@ static std::map>BoolArr_STL; -//构造 抽奖 类型容器 + +static std::mapaod; +static std::mapbod; +static std::mapcod; +static std::mapdod; + + +ifdenf DRAGONBOX_SWITCH +//抽奖 类型结构体 struct Dargonresult { int ItemIndex; int ItemNum; int ItemGrade; }; +//龙盒结构体 struct DargonMap { int LuckyValue; @@ -47,14 +56,11 @@ struct DargonMap int sync; int box_num; }; +//龙盒状态Map static std::mapDargonState_STL; +//龙盒模式Map static std::mapDargonModel_STL; - -static std::mapaod; -static std::mapbod; -static std::mapcod; -static std::mapdod; - +ifndef class STL { diff --git a/test/squirrel.cpp b/test/squirrel.cpp index 2884c8f..857f928 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -268,6 +268,25 @@ int squirrel::SendPackDWord(uint32_t v) SQPushInt(v, 1); return 1; } +//发包wchar_t* (转了char*) +int squirrel::SendPackWChar(uint32_t v) +{ + wchar_t* n1; + + SQGetString(v, 2, &n1); + std::wcout << u8"字符串值为:" << n1 << std::endl; + + //wchar_t* 转 char* + int size = wcslen(n1); + char* fname = (char*)new char[size]; + DNFTOOL::UnicodeToAnsi(n1, fname, size); + fname[size] = '\0'; + std::cout << u8"字符串值为:" << fname << std::endl; + _SendPacksChar(*_SendClass, 0, fname, strlen(fname)); + + SQPushInt(v, 1); + return 1; +} //发包 int squirrel::SendPack(uint32_t v) { @@ -1065,6 +1084,7 @@ void squirrel::R_Register_Nut() RegisterNutApi(L"L_sq_SendPackByte", squirrel::SendPackByte);//包数据Byte RegisterNutApi(L"L_sq_SendPackWord", squirrel::SendPackWord);//包数据Word RegisterNutApi(L"L_sq_SendPackDWord", squirrel::SendPackDWord);//包数据DWord + RegisterNutApi(L"L_sq_SendPackWChar", squirrel::SendPackWChar);//包数据DWord RegisterNutApi(L"L_sq_SendPack", squirrel::SendPack);//发包 RegisterNutApi(L"L_sq_GivePlayerItem", squirrel::GivePlayerItem);//给用户物品 RegisterNutApi(L"L_sq_GivePlayerEqu", squirrel::GivePlayerEqu);//给用户装备 diff --git a/test/squirrel.h b/test/squirrel.h index 6e31429..dfefd5d 100644 --- a/test/squirrel.h +++ b/test/squirrel.h @@ -172,6 +172,7 @@ public:// static int SendPackByte(uint32_t v);//发包Byte static int SendPackWord(uint32_t v);//发包Word static int SendPackDWord(uint32_t v);//发包DWord + static int SendPackWChar(uint32_t v);//发包char* static int SendPack(uint32_t v);//发包 static int GivePlayerItem(uint32_t v);//发物品给玩家