mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
parent
696b4d0073
commit
29fdfca9bb
|
@ -20,4 +20,15 @@ UI.ComboBox = function(spec)
|
|||
return spec
|
||||
end
|
||||
|
||||
-- Spin: 一个能用两侧加减号调整某些数值的组件,见于奇谋等技能
|
||||
-- 可以赋值的属性有:
|
||||
-- * from: 最小值
|
||||
-- * to: 最大值
|
||||
-- * default: 默认值 默认为最小的
|
||||
UI.Spin = function(spec)
|
||||
assert(spec.from <= spec.to)
|
||||
spec.type = "spin"
|
||||
return spec
|
||||
end
|
||||
|
||||
return UI
|
||||
|
|
|
@ -71,14 +71,14 @@ local test_active = fk.CreateActiveSkill{
|
|||
end,
|
||||
card_num = 2,
|
||||
target_filter = function() return true end,
|
||||
interaction = function()return UI.ComboBox {
|
||||
choices = Fk.package_names,
|
||||
interaction = function()return UI.Spin {
|
||||
--choices = Fk.package_names,
|
||||
from=2,to=8,
|
||||
-- default = "guanyu",
|
||||
}end,
|
||||
on_use = function(self, room, effect)
|
||||
--room:doSuperLightBox("packages/test/qml/Test.qml")
|
||||
local from = room:getPlayerById(effect.from)
|
||||
--print(self.interaction.data)
|
||||
local to = room:getPlayerById(effect.tos[1])
|
||||
-- room:swapSeat(from, to)
|
||||
from:control(to)
|
||||
|
|
|
@ -489,6 +489,13 @@ Item {
|
|||
skillInteraction.item.skill = skill_name;
|
||||
skillInteraction.item.default_choice = data["default"];
|
||||
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;
|
||||
default:
|
||||
skillInteraction.source = "";
|
||||
|
|
21
qml/Pages/RoomElement/SkillInteraction/SkillSpin.qml
Normal file
21
qml/Pages/RoomElement/SkillInteraction/SkillSpin.qml
Normal file
|
@ -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
Block a user