parent
696b4d0073
commit
29fdfca9bb
|
@ -20,4 +20,15 @@ UI.ComboBox = function(spec)
|
||||||
return spec
|
return spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Spin: 一个能用两侧加减号调整某些数值的组件,见于奇谋等技能
|
||||||
|
-- 可以赋值的属性有:
|
||||||
|
-- * from: 最小值
|
||||||
|
-- * to: 最大值
|
||||||
|
-- * default: 默认值 默认为最小的
|
||||||
|
UI.Spin = function(spec)
|
||||||
|
assert(spec.from <= spec.to)
|
||||||
|
spec.type = "spin"
|
||||||
|
return spec
|
||||||
|
end
|
||||||
|
|
||||||
return UI
|
return UI
|
||||||
|
|
|
@ -71,14 +71,14 @@ local test_active = fk.CreateActiveSkill{
|
||||||
end,
|
end,
|
||||||
card_num = 2,
|
card_num = 2,
|
||||||
target_filter = function() return true end,
|
target_filter = function() return true end,
|
||||||
interaction = function()return UI.ComboBox {
|
interaction = function()return UI.Spin {
|
||||||
choices = Fk.package_names,
|
--choices = Fk.package_names,
|
||||||
|
from=2,to=8,
|
||||||
-- default = "guanyu",
|
-- default = "guanyu",
|
||||||
}end,
|
}end,
|
||||||
on_use = function(self, room, effect)
|
on_use = function(self, room, effect)
|
||||||
--room:doSuperLightBox("packages/test/qml/Test.qml")
|
--room:doSuperLightBox("packages/test/qml/Test.qml")
|
||||||
local from = room:getPlayerById(effect.from)
|
local from = room:getPlayerById(effect.from)
|
||||||
--print(self.interaction.data)
|
|
||||||
local to = room:getPlayerById(effect.tos[1])
|
local to = room:getPlayerById(effect.tos[1])
|
||||||
-- room:swapSeat(from, to)
|
-- room:swapSeat(from, to)
|
||||||
from:control(to)
|
from:control(to)
|
||||||
|
|
|
@ -489,6 +489,13 @@ Item {
|
||||||
skillInteraction.item.skill = skill_name;
|
skillInteraction.item.skill = skill_name;
|
||||||
skillInteraction.item.default_choice = data["default"];
|
skillInteraction.item.default_choice = data["default"];
|
||||||
skillInteraction.item.choices = data.choices;
|
skillInteraction.item.choices = data.choices;
|
||||||
|
skillInteraction.item.clicked();
|
||||||
|
break;
|
||||||
|
case "spin":
|
||||||
|
skillInteraction.source = "RoomElement/SkillInteraction/SkillSpin.qml";
|
||||||
|
skillInteraction.item.skill = skill_name;
|
||||||
|
skillInteraction.item.from = data.from;
|
||||||
|
skillInteraction.item.to = data.to;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
skillInteraction.source = "";
|
skillInteraction.source = "";
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
background: Rectangle { color: "#88EEEEEE" }
|
||||||
|
property int answer: value
|
||||||
|
property string skill
|
||||||
|
// from, to
|
||||||
|
|
||||||
|
onValueChanged: {
|
||||||
|
Backend.callLuaFunction(
|
||||||
|
"SetInteractionDataOfSkill",
|
||||||
|
[skill, JSON.stringify(answer)]
|
||||||
|
);
|
||||||
|
roomScene.dashboard.startPending(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue