mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
选择目标提示 (#366)
This commit is contained in:
parent
e8aacf1888
commit
7b66e304ff
|
@ -619,11 +619,15 @@ function processPrompt(prompt) {
|
|||
if (raw.match("%src"))
|
||||
raw = raw.replace(/%src/g, getPlayerStr(src));
|
||||
if (raw.match("%dest"))
|
||||
raw = raw.replace(/%dest/g, getPlayerStr(dest));
|
||||
if (raw.match("%arg2"))
|
||||
raw = raw.replace(/%arg2/g, luatr(data[4]));
|
||||
if (raw.match("%arg"))
|
||||
raw = raw.replace(/%arg/g, luatr(data[3]));
|
||||
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
|
||||
|
||||
if (data.length > 3) {
|
||||
for (let i = data.length - 1; i > 3; i--) {
|
||||
raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), luatr(data[i]));
|
||||
}
|
||||
|
||||
raw = raw.replace(new RegExp("%arg", "g"), luatr(data[3]));
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
|
@ -727,6 +731,15 @@ function enableTargets(card) {
|
|||
const ret = lcall("CanUseCardToTarget", card, id, selected_targets,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
photo.selectable = ret;
|
||||
|
||||
let tipText = lcall("GetUseCardTargetTip", card, id, selected_targets,
|
||||
ret, JSON.stringify(roomScene.extra_data));
|
||||
if (tipText) {
|
||||
photo.targetTip = tipText;
|
||||
} else {
|
||||
photo.targetTip = [];
|
||||
}
|
||||
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
const included = roomScene.extra_data.include_targets;
|
||||
|
@ -771,6 +784,7 @@ function enableTargets(card) {
|
|||
}
|
||||
} else {
|
||||
all_photos.forEach(photo => {
|
||||
photo.targetTip = [];
|
||||
photo.state = "normal";
|
||||
photo.selected = false;
|
||||
});
|
||||
|
@ -839,10 +853,19 @@ function updateSelectedTargets(playerid, selected) {
|
|||
}
|
||||
|
||||
all_photos.forEach(photo => {
|
||||
if (photo.selected) return;
|
||||
const id = photo.playerid;
|
||||
const ret = lcall("CanUseCardToTarget", card, id, selected_targets,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
|
||||
let tipText = lcall("GetUseCardTargetTip", card, id, selected_targets,
|
||||
ret, JSON.stringify(roomScene.extra_data));
|
||||
if (tipText) {
|
||||
photo.targetTip = tipText;
|
||||
} else {
|
||||
photo.targetTip = [];
|
||||
}
|
||||
|
||||
if (photo.selected) return;
|
||||
photo.selectable = ret;
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
|
@ -892,6 +915,7 @@ function updateSelectedTargets(playerid, selected) {
|
|||
}
|
||||
} else {
|
||||
all_photos.forEach(photo => {
|
||||
photo.targetTip = [];
|
||||
photo.state = "normal";
|
||||
photo.selected = false;
|
||||
});
|
||||
|
|
|
@ -58,6 +58,8 @@ Item {
|
|||
|
||||
property bool playing: false
|
||||
property bool surrendered: false
|
||||
|
||||
property var targetTip: []
|
||||
onPlayingChanged: {
|
||||
if (playing) {
|
||||
animPlaying.start();
|
||||
|
@ -749,6 +751,53 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.centerIn: parent
|
||||
spacing: 5
|
||||
|
||||
Repeater {
|
||||
model: root.targetTip
|
||||
|
||||
Item {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
width: 30
|
||||
|
||||
GlowText {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.type === "normal"
|
||||
text: Util.processPrompt(modelData.content)
|
||||
font.family: fontLibian.name
|
||||
color: "#F7F589"
|
||||
font.pixelSize: 30
|
||||
font.bold: true
|
||||
glow.color: "black"
|
||||
glow.spread: 0.3
|
||||
glow.radius: 5
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WrapAnywhere
|
||||
width: 30
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.type === "warning"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 24
|
||||
opacity: 0.9
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
lineHeight: 24
|
||||
lineHeightMode: Text.FixedHeight
|
||||
color: "#EAC28A"
|
||||
width: 24
|
||||
wrapMode: Text.WrapAnywhere
|
||||
style: Text.Outline
|
||||
styleColor: "#83231F"
|
||||
text: Util.processPrompt(modelData.content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onGeneralChanged: {
|
||||
if (!roomScene.isStarted) return;
|
||||
const text = luatr(general);
|
||||
|
|
14
Fk/util.js
14
Fk/util.js
|
@ -34,11 +34,15 @@ function processPrompt(prompt) {
|
|||
if (raw.match("%src"))
|
||||
raw = raw.replace(/%src/g, getPlayerStr(src));
|
||||
if (raw.match("%dest"))
|
||||
raw = raw.replace(/%dest/g, getPlayerStr(dest));
|
||||
if (raw.match("%arg2"))
|
||||
raw = raw.replace(/%arg2/g, luatr(data[4]));
|
||||
if (raw.match("%arg"))
|
||||
raw = raw.replace(/%arg/g, luatr(data[3]));
|
||||
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
|
||||
|
||||
if (data.length > 3) {
|
||||
for (let i = 4; i < data.length; i++) {
|
||||
raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), data[i]);
|
||||
}
|
||||
|
||||
raw = raw.replace(new RegExp("%arg", "g"), data[3]);
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user