commit
a004fcc2ef
@ -1,39 +1,308 @@
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QMetaEnum>
|
||||
#include <QFileInfo>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
#include "keymap.h"
|
||||
|
||||
KeyMap::KeyMap()
|
||||
QString KeyMap::s_keyMapPath = "";
|
||||
|
||||
KeyMap::KeyMap(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void KeyMap::loadKeyMapNode()
|
||||
KeyMap::~KeyMap()
|
||||
{
|
||||
KeyMapNode node;
|
||||
node.type = KMT_CLICK;
|
||||
node.click.keyNode.key = Qt::Key_J;
|
||||
node.click.keyNode.pos = QPointF(0.5f, 0.5f);
|
||||
node.click.quitMap = false;
|
||||
|
||||
m_keyMapNodes.push_back(node);
|
||||
}
|
||||
|
||||
KeyMap::KeyMapNode KeyMap::getKeyMapNode(int key)
|
||||
const QString& KeyMap::getKeyMapPath()
|
||||
{
|
||||
KeyMapNode retNode;
|
||||
bool find = false;
|
||||
for (auto& node : m_keyMapNodes) {
|
||||
switch (node.type) {
|
||||
case KMT_CLICK:
|
||||
if (node.click.keyNode.key == key) {
|
||||
retNode = node;
|
||||
find = true;
|
||||
if (s_keyMapPath.isEmpty()) {
|
||||
s_keyMapPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_KEYMAP_PATH"));
|
||||
QFileInfo fileInfo(s_keyMapPath);
|
||||
if (s_keyMapPath.isEmpty() || !fileInfo.isDir()) {
|
||||
s_keyMapPath = QCoreApplication::applicationDirPath() + "/keymap";
|
||||
}
|
||||
}
|
||||
return s_keyMapPath;
|
||||
}
|
||||
|
||||
void KeyMap::loadKeyMap(const QString &json)
|
||||
{
|
||||
QString errorString;
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument jsonDoc;
|
||||
QJsonObject rootObj;
|
||||
|
||||
QMetaEnum metaEnumKey = QMetaEnum::fromType<Qt::Key>();
|
||||
QMetaEnum metaEnumMouseButtons = QMetaEnum::fromType<Qt::MouseButtons>();
|
||||
QMetaEnum metaEnumKeyMapType = QMetaEnum::fromType<KeyMap::KeyMapType>();
|
||||
|
||||
jsonDoc = QJsonDocument::fromJson(json.toUtf8(), &jsonError);
|
||||
|
||||
if(jsonError.error != QJsonParseError::NoError)
|
||||
{
|
||||
errorString = QString("json error: %1").arg(jsonError.errorString());
|
||||
goto parseError;
|
||||
}
|
||||
|
||||
// switchKey
|
||||
rootObj = jsonDoc.object();
|
||||
if (rootObj.contains("switchKey") && rootObj.value("switchKey").isString()) {
|
||||
Qt::Key key = (Qt::Key)metaEnumKey.keyToValue(rootObj.value("switchKey").toString().toStdString().c_str());
|
||||
if (-1 == key) {
|
||||
errorString = QString("json error: switchKey invalid");
|
||||
goto parseError;
|
||||
}
|
||||
m_switchKey = key;
|
||||
} else {
|
||||
errorString = QString("json error: no find switchKey");
|
||||
goto parseError;
|
||||
}
|
||||
|
||||
// mouseMoveMap
|
||||
if (rootObj.contains("mouseMoveMap") && rootObj.value("mouseMoveMap").isObject()) {
|
||||
QJsonObject mouseMoveMap = rootObj.value("mouseMoveMap").toObject();
|
||||
if (mouseMoveMap.contains("speedRatio") && mouseMoveMap.value("speedRatio").isDouble()) {
|
||||
m_mouseMoveMap.speedRatio = mouseMoveMap.value("speedRatio").toInt();
|
||||
} else {
|
||||
errorString = QString("json error: mouseMoveMap on find speedRatio");
|
||||
goto parseError;
|
||||
}
|
||||
if (mouseMoveMap.contains("startPos") && mouseMoveMap.value("startPos").isObject()) {
|
||||
QJsonObject startPos = mouseMoveMap.value("startPos").toObject();
|
||||
if (startPos.contains("x") && startPos.value("x").isDouble()) {
|
||||
m_mouseMoveMap.startPos.setX(startPos.value("x").toDouble());
|
||||
}
|
||||
if (startPos.contains("y") && startPos.value("y").isDouble()) {
|
||||
m_mouseMoveMap.startPos.setY(startPos.value("y").toDouble());
|
||||
}
|
||||
} else {
|
||||
errorString = QString("json error: mouseMoveMap on find startPos");
|
||||
goto parseError;
|
||||
}
|
||||
}
|
||||
|
||||
// keyMapNodes
|
||||
if (rootObj.contains("keyMapNodes") && rootObj.value("keyMapNodes").isArray()) {
|
||||
QJsonArray keyMapNodes = rootObj.value("keyMapNodes").toArray();
|
||||
QJsonObject node;
|
||||
int size = keyMapNodes.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (!keyMapNodes.at(i).isObject()) {
|
||||
errorString = QString("json error: keyMapNodes node must be json object");
|
||||
goto parseError;
|
||||
}
|
||||
node = keyMapNodes.at(i).toObject();
|
||||
if (!node.contains("type") || !node.value("type").isString()) {
|
||||
errorString = QString("json error: keyMapNodes no find node type");
|
||||
goto parseError;
|
||||
}
|
||||
|
||||
KeyMap::KeyMapType type = (KeyMap::KeyMapType)metaEnumKeyMapType.keyToValue(node.value("type").toString().toStdString().c_str());
|
||||
switch (type) {
|
||||
case KeyMap::KMT_CLICK:
|
||||
{
|
||||
// safe check
|
||||
if (!node.contains("key") || !node.value("key").isString()
|
||||
|| !node.contains("pos") || !node.value("pos").isObject()
|
||||
|| !node.value("pos").toObject().contains("x") || !node.value("pos").toObject().value("x").isDouble()
|
||||
|| !node.value("pos").toObject().contains("y") || !node.value("pos").toObject().value("y").isDouble()
|
||||
|| !node.contains("switchMap") || !node.value("switchMap").isBool()
|
||||
) {
|
||||
qWarning() << "json error: keyMapNodes node format error";
|
||||
break;
|
||||
}
|
||||
|
||||
Qt::Key key = (Qt::Key)metaEnumKey.keyToValue(node.value("key").toString().toStdString().c_str());
|
||||
Qt::MouseButtons btn = (Qt::MouseButtons)metaEnumMouseButtons.keyToValue(node.value("key").toString().toStdString().c_str());
|
||||
if (-1 == key && -1 == btn) {
|
||||
qWarning() << "json error: keyMapNodes node invalid key: " << node.value("key").toString();
|
||||
break;
|
||||
}
|
||||
|
||||
KeyMapNode keyMapNode;
|
||||
keyMapNode.type = type;
|
||||
if (key != -1) {
|
||||
keyMapNode.click.keyNode.key = key;
|
||||
} else {
|
||||
keyMapNode.click.keyNode.key = btn;
|
||||
}
|
||||
keyMapNode.click.keyNode.pos = QPointF(node.value("pos").toObject().value("x").toDouble(),
|
||||
node.value("pos").toObject().value("y").toDouble());
|
||||
keyMapNode.click.switchMap = node.value("switchMap").toBool();
|
||||
m_keyMapNodes.push_back(keyMapNode);
|
||||
}
|
||||
break;
|
||||
case KeyMap::KMT_CLICK_TWICE:
|
||||
{
|
||||
// safe check
|
||||
if (!node.contains("key") || !node.value("key").isString()
|
||||
|| !node.contains("pos") || !node.value("pos").isObject()
|
||||
|| !node.value("pos").toObject().contains("x") || !node.value("pos").toObject().value("x").isDouble()
|
||||
|| !node.value("pos").toObject().contains("y") || !node.value("pos").toObject().value("y").isDouble()
|
||||
) {
|
||||
qWarning() << "json error: keyMapNodes node format error";
|
||||
break;
|
||||
}
|
||||
|
||||
Qt::Key key = (Qt::Key)metaEnumKey.keyToValue(node.value("key").toString().toStdString().c_str());
|
||||
Qt::MouseButtons btn = (Qt::MouseButtons)metaEnumMouseButtons.keyToValue(node.value("key").toString().toStdString().c_str());
|
||||
if (-1 == key && -1 == btn) {
|
||||
qWarning() << "json error: keyMapNodes node invalid key: " << node.value("key").toString();
|
||||
break;
|
||||
}
|
||||
|
||||
KeyMapNode keyMapNode;
|
||||
keyMapNode.type = type;
|
||||
if (key != -1) {
|
||||
keyMapNode.clickTwice.keyNode.key = key;
|
||||
} else {
|
||||
keyMapNode.clickTwice.keyNode.key = btn;
|
||||
}
|
||||
keyMapNode.clickTwice.keyNode.pos = QPointF(node.value("pos").toObject().value("x").toDouble(),
|
||||
node.value("pos").toObject().value("y").toDouble());
|
||||
m_keyMapNodes.push_back(keyMapNode);
|
||||
}
|
||||
break;
|
||||
case KeyMap::KMT_STEER_WHEEL:
|
||||
{
|
||||
// safe check
|
||||
if (!node.contains("leftKey") || !node.value("leftKey").isString()
|
||||
|| !node.contains("rightKey") || !node.value("rightKey").isString()
|
||||
|| !node.contains("upKey") || !node.value("upKey").isString()
|
||||
|| !node.contains("downKey") || !node.value("downKey").isString()
|
||||
|| !node.contains("leftOffset") || !node.value("leftOffset").isDouble()
|
||||
|| !node.contains("rightOffset") || !node.value("rightOffset").isDouble()
|
||||
|| !node.contains("upOffset") || !node.value("upOffset").isDouble()
|
||||
|| !node.contains("downOffset") || !node.value("downOffset").isDouble()
|
||||
|| !node.contains("centerPos") || !node.value("centerPos").isObject()
|
||||
|| !node.value("centerPos").toObject().contains("x") || !node.value("centerPos").toObject().value("x").isDouble()
|
||||
|| !node.value("centerPos").toObject().contains("y") || !node.value("centerPos").toObject().value("y").isDouble()
|
||||
) {
|
||||
qWarning() << "json error: keyMapNodes node format error";
|
||||
break;
|
||||
}
|
||||
|
||||
Qt::Key leftKey = (Qt::Key)metaEnumKey.keyToValue(node.value("leftKey").toString().toStdString().c_str());
|
||||
Qt::MouseButtons leftBtn = (Qt::MouseButtons)metaEnumMouseButtons.keyToValue(node.value("leftKey").toString().toStdString().c_str());
|
||||
Qt::Key rightKey = (Qt::Key)metaEnumKey.keyToValue(node.value("rightKey").toString().toStdString().c_str());
|
||||
Qt::MouseButtons rightBtn = (Qt::MouseButtons)metaEnumMouseButtons.keyToValue(node.value("rightKey").toString().toStdString().c_str());
|
||||
Qt::Key upKey = (Qt::Key)metaEnumKey.keyToValue(node.value("upKey").toString().toStdString().c_str());
|
||||
Qt::MouseButtons upBtn = (Qt::MouseButtons)metaEnumMouseButtons.keyToValue(node.value("upKey").toString().toStdString().c_str());
|
||||
Qt::Key downKey = (Qt::Key)metaEnumKey.keyToValue(node.value("downKey").toString().toStdString().c_str());
|
||||
Qt::MouseButtons downBtn = (Qt::MouseButtons)metaEnumMouseButtons.keyToValue(node.value("downKey").toString().toStdString().c_str());
|
||||
|
||||
if ((-1 == leftKey && -1 == leftBtn)
|
||||
|| (-1 == rightKey && -1 == rightBtn)
|
||||
|| (-1 == upKey && -1 == upBtn)
|
||||
|| (-1 == downKey && -1 == downBtn)
|
||||
) {
|
||||
qWarning() << "json error: keyMapNodes node invalid key: " << node.value("key").toString();
|
||||
break;
|
||||
}
|
||||
|
||||
KeyMapNode keyMapNode;
|
||||
keyMapNode.type = type;
|
||||
keyMapNode.steerWheel.leftKeyPressed = false;
|
||||
keyMapNode.steerWheel.rightKeyPressed = false;
|
||||
keyMapNode.steerWheel.upKeyPressed = false;
|
||||
keyMapNode.steerWheel.downKeyPressed = false;
|
||||
keyMapNode.steerWheel.pressKeysNum = 0;
|
||||
keyMapNode.steerWheel.firstPressKey = 0;
|
||||
|
||||
if (leftKey != -1) {
|
||||
keyMapNode.steerWheel.leftKey = leftKey;
|
||||
} else {
|
||||
keyMapNode.steerWheel.leftKey = leftBtn;
|
||||
}
|
||||
if (rightKey != -1) {
|
||||
keyMapNode.steerWheel.rightKey = rightKey;
|
||||
} else {
|
||||
keyMapNode.steerWheel.rightKey = rightBtn;
|
||||
}
|
||||
if (upKey != -1) {
|
||||
keyMapNode.steerWheel.upKey = upKey;
|
||||
} else {
|
||||
keyMapNode.steerWheel.upKey = upBtn;
|
||||
}
|
||||
if (downKey != -1) {
|
||||
keyMapNode.steerWheel.downKey = downKey;
|
||||
} else {
|
||||
keyMapNode.steerWheel.downKey = downBtn;
|
||||
}
|
||||
keyMapNode.steerWheel.leftOffset = node.value("leftOffset").toDouble();
|
||||
keyMapNode.steerWheel.rightOffset = node.value("rightOffset").toDouble();
|
||||
keyMapNode.steerWheel.upOffset = node.value("upOffset").toDouble();
|
||||
keyMapNode.steerWheel.downOffset = node.value("downOffset").toDouble();
|
||||
keyMapNode.steerWheel.centerPos = QPointF(node.value("centerPos").toObject().value("x").toDouble(),
|
||||
node.value("centerPos").toObject().value("y").toDouble());
|
||||
m_keyMapNodes.push_back(keyMapNode);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qWarning() << "json error: keyMapNodes invalid node type:" << node.value("type").toString();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
parseError:
|
||||
if (!errorString.isEmpty()) {
|
||||
qWarning() << errorString;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (find) {
|
||||
KeyMap::KeyMapNode& KeyMap::getKeyMapNode(int key)
|
||||
{
|
||||
for (auto& itemNode : m_keyMapNodes) {
|
||||
switch (itemNode.type) {
|
||||
case KMT_CLICK:
|
||||
if (itemNode.click.keyNode.key == key) {
|
||||
return itemNode;
|
||||
}
|
||||
break;
|
||||
case KMT_CLICK_TWICE:
|
||||
if (itemNode.clickTwice.keyNode.key == key) {
|
||||
return itemNode;
|
||||
}
|
||||
break;
|
||||
case KMT_STEER_WHEEL:
|
||||
if (itemNode.steerWheel.leftKey == key
|
||||
|| itemNode.steerWheel.rightKey == key
|
||||
|| itemNode.steerWheel.upKey == key
|
||||
|| itemNode.steerWheel.downKey == key
|
||||
) {
|
||||
return itemNode;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retNode;
|
||||
return m_invalidNode;
|
||||
}
|
||||
|
||||
int KeyMap::getSwitchKey()
|
||||
{
|
||||
return m_switchKey;
|
||||
}
|
||||
|
||||
KeyMap::MouseMoveMap KeyMap::getMouseMoveMap()
|
||||
{
|
||||
return m_mouseMoveMap;
|
||||
}
|
||||
|
||||
bool KeyMap::enableMouseMoveMap()
|
||||
{
|
||||
return !m_mouseMoveMap.startPos.isNull();
|
||||
}
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
@echo off
|
||||
set vcvarsall="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\"
|
||||
|
||||
:: 获取脚本绝对路径
|
||||
set script_path=%~dp0
|
||||
:: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录
|
||||
set old_cd=%cd%
|
||||
cd /d %~dp0
|
||||
|
||||
:: 启动参数声明
|
||||
set debug_mode="false"
|
||||
set cpu_mode=x86
|
||||
|
||||
echo=
|
||||
echo=
|
||||
echo ---------------------------------------------------------------
|
||||
echo 检查编译参数[debug/release x86/x64]
|
||||
echo ---------------------------------------------------------------
|
||||
|
||||
:: 编译参数检查 /i忽略大小写
|
||||
if /i "%1"=="debug" (
|
||||
set debug_mode="true"
|
||||
)
|
||||
if /i "%1"=="release" (
|
||||
set debug_mode="false"
|
||||
)
|
||||
|
||||
if /i "%2"=="x86" (
|
||||
set cpu_mode=x86
|
||||
)
|
||||
if /i "%2"=="x64" (
|
||||
set cpu_mode=x64
|
||||
)
|
||||
|
||||
:: 提示
|
||||
echo 当前编译模式为debug %debug_mode% %cpu_mode%
|
||||
|
||||
:: 环境变量设置
|
||||
if /i %cpu_mode% == x86 (
|
||||
set qt_msvc_path=%qt_msvc_path%msvc2017\bin
|
||||
) else (
|
||||
set qt_msvc_path=%qt_msvc_path%msvc2017_64\bin
|
||||
)
|
||||
|
||||
set build_path=%script_path%build
|
||||
set PATH=%qt_msvc_path%;%PATH%
|
||||
|
||||
:: 注册vc环境
|
||||
if /i %cpu_mode% == x86 (
|
||||
call %vcvarsall% %cpu_mode%
|
||||
) else (
|
||||
call %vcvarsall% %cpu_mode%
|
||||
)
|
||||
|
||||
if not %errorlevel%==0 (
|
||||
echo "vcvarsall not find"
|
||||
goto return
|
||||
)
|
||||
|
||||
echo=
|
||||
echo=
|
||||
echo ---------------------------------------------------------------
|
||||
echo 开始qmake编译
|
||||
echo ---------------------------------------------------------------
|
||||
|
||||
if exist %build_path% (
|
||||
rmdir /q /s %build_path%
|
||||
)
|
||||
md %build_path%
|
||||
cd %build_path%
|
||||
|
||||
set qmake_params=-spec win32-msvc
|
||||
|
||||
if /i %debug_mode% == "true" (
|
||||
set qmake_params=%qmake_params% "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||
) else (
|
||||
set qmake_params=%qmake_params% "CONFIG+=qtquickcompiler"
|
||||
)
|
||||
|
||||
:: qmake ../all.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||
qmake ../all.pro %qmake_params%
|
||||
|
||||
nmake
|
||||
|
||||
if not %errorlevel%==0 (
|
||||
echo "qmake build failed"
|
||||
goto return
|
||||
)
|
||||
|
||||
echo=
|
||||
echo=
|
||||
echo ---------------------------------------------------------------
|
||||
echo 完成!
|
||||
echo ---------------------------------------------------------------
|
||||
|
||||
:return
|
||||
cd %old_cd%
|
||||
@ -0,0 +1,255 @@
|
||||
{
|
||||
"switchKey": "Key_QuoteLeft",
|
||||
"mouseMoveMap": {
|
||||
"startPos": {
|
||||
"x": 0.57,
|
||||
"y": 0.26
|
||||
},
|
||||
"speedRatio": 10
|
||||
},
|
||||
"keyMapNodes": [{
|
||||
"comment": "方向盘",
|
||||
"type": "KMT_STEER_WHEEL",
|
||||
"centerPos": {
|
||||
"x": 0.16,
|
||||
"y": 0.75
|
||||
},
|
||||
"leftOffset": 0.1,
|
||||
"rightOffset": 0.1,
|
||||
"upOffset": 0.27,
|
||||
"downOffset": 0.2,
|
||||
"leftKey": "Key_A",
|
||||
"rightKey": "Key_D",
|
||||
"upKey": "Key_W",
|
||||
"downKey": "Key_S"
|
||||
},
|
||||
{
|
||||
"comment": "左探头",
|
||||
"type": "KMT_CLICK_TWICE",
|
||||
"key": "Key_Q",
|
||||
"pos": {
|
||||
"x": 0.12,
|
||||
"y": 0.35
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "右探头",
|
||||
"type": "KMT_CLICK_TWICE",
|
||||
"key": "Key_E",
|
||||
"pos": {
|
||||
"x": 0.2,
|
||||
"y": 0.35
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "跳",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_Space",
|
||||
"pos": {
|
||||
"x": 0.96,
|
||||
"y": 0.7
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "地图",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_M",
|
||||
"pos": {
|
||||
"x": 0.98,
|
||||
"y": 0.03
|
||||
},
|
||||
"switchMap": true
|
||||
},
|
||||
{
|
||||
"comment": "背包",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_Tab",
|
||||
"pos": {
|
||||
"x": 0.06,
|
||||
"y": 0.9
|
||||
},
|
||||
"switchMap": true
|
||||
},
|
||||
{
|
||||
"comment": "趴",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_Z",
|
||||
"pos": {
|
||||
"x": 0.95,
|
||||
"y": 0.9
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "蹲",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_C",
|
||||
"pos": {
|
||||
"x": 0.86,
|
||||
"y": 0.92
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "换弹",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_R",
|
||||
"pos": {
|
||||
"x": 0.795,
|
||||
"y": 0.93
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "小眼睛",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_Alt",
|
||||
"pos": {
|
||||
"x": 0.8,
|
||||
"y": 0.31
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "捡东西1",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_F",
|
||||
"pos": {
|
||||
"x": 0.7,
|
||||
"y": 0.34
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "捡东西2",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_G",
|
||||
"pos": {
|
||||
"x": 0.7,
|
||||
"y": 0.44
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "捡东西3",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_H",
|
||||
"pos": {
|
||||
"x": 0.7,
|
||||
"y": 0.54
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "换枪1",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_1",
|
||||
"pos": {
|
||||
"x": 0.45,
|
||||
"y": 0.9
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "换枪2",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_2",
|
||||
"pos": {
|
||||
"x": 0.55,
|
||||
"y": 0.9
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "手雷",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_3",
|
||||
"pos": {
|
||||
"x": 0.67,
|
||||
"y": 0.92
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "快速打药",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_4",
|
||||
"pos": {
|
||||
"x": 0.33,
|
||||
"y": 0.95
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "下车",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_S",
|
||||
"pos": {
|
||||
"x": 0.92,
|
||||
"y": 0.4
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "救人",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_6",
|
||||
"pos": {
|
||||
"x": 0.49,
|
||||
"y": 0.63
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "车加速",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_Shift",
|
||||
"pos": {
|
||||
"x": 0.82,
|
||||
"y": 0.8
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "开关门",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_X",
|
||||
"pos": {
|
||||
"x": 0.7,
|
||||
"y": 0.7
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "舔包",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "Key_T",
|
||||
"pos": {
|
||||
"x": 0.72,
|
||||
"y": 0.26
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "开枪",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "LeftButton",
|
||||
"pos": {
|
||||
"x": 0.86,
|
||||
"y": 0.72
|
||||
},
|
||||
"switchMap": false
|
||||
},
|
||||
{
|
||||
"comment": "开镜",
|
||||
"type": "KMT_CLICK",
|
||||
"key": "RightButton",
|
||||
"pos": {
|
||||
"x": 0.96,
|
||||
"y": 0.52
|
||||
},
|
||||
"switchMap": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
@echo off
|
||||
set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\"
|
||||
|
||||
:: 获取脚本绝对路径
|
||||
set script_path=%~dp0
|
||||
:: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录
|
||||
set old_cd=%cd%
|
||||
cd /d %~dp0
|
||||
|
||||
:: 启动参数声明
|
||||
set cpu_mode=x86
|
||||
if /i "%1"=="x86" (
|
||||
set cpu_mode=x86
|
||||
)
|
||||
if /i "%1"=="x64" (
|
||||
set cpu_mode=x64
|
||||
)
|
||||
|
||||
:: 环境变量设置
|
||||
|
||||
set adb_path=%script_path%third_party\adb\win\*.*
|
||||
set jar_path=%script_path%third_party\scrcpy-server.jar
|
||||
set keymap_path=%script_path%keymap
|
||||
|
||||
if /i %cpu_mode% == x86 (
|
||||
set publish_path=%script_path%QtScrcpy-win32\
|
||||
set release_path=%script_path%output\win\release
|
||||
set qt_msvc_path=%qt_msvc_path%msvc2017\bin
|
||||
) else (
|
||||
set publish_path=%script_path%QtScrcpy-win64\
|
||||
set release_path=%script_path%output\win-x64\release
|
||||
set qt_msvc_path=%qt_msvc_path%msvc2017_64\bin
|
||||
)
|
||||
set PATH=%qt_msvc_path%;%PATH%
|
||||
|
||||
if exist %publish_path% (
|
||||
rmdir /s/q %publish_path%
|
||||
)
|
||||
|
||||
:: 复制要发布的包
|
||||
xcopy %release_path% %publish_path% /E /Y
|
||||
xcopy %adb_path% %publish_path% /Y
|
||||
xcopy %jar_path% %publish_path% /Y
|
||||
xcopy %keymap_path% %publish_path%keymap\ /E /Y
|
||||
|
||||
:: 添加qt依赖包
|
||||
windeployqt %publish_path%\QtScrcpy.exe
|
||||
|
||||
:: 删除多余qt依赖包
|
||||
rmdir /s/q %publish_path%\iconengines
|
||||
rmdir /s/q %publish_path%\imageformats
|
||||
rmdir /s/q %publish_path%\translations
|
||||
if /i %cpu_mode% == x86 (
|
||||
del %publish_path%\vc_redist.x86.exe
|
||||
) else (
|
||||
del %publish_path%\vc_redist.x64.exe
|
||||
)
|
||||
|
||||
echo=
|
||||
echo=
|
||||
echo ---------------------------------------------------------------
|
||||
echo 完成!
|
||||
echo ---------------------------------------------------------------
|
||||
|
||||
:return
|
||||
cd %old_cd%
|
||||
Loading…
Reference in new issue