Add category for expression list in skin editor.

This commit is contained in:
2023-03-15 15:36:45 +08:00
parent 93fa2f2d7e
commit b64f85aaa2
2 changed files with 38 additions and 13 deletions

View File

@@ -63,12 +63,26 @@ body {
padding: 0 4px; padding: 0 4px;
margin: 1px; margin: 1px;
cursor: pointer; cursor: pointer;
break-before: avoid;
} }
.t-li:hover { .t-li:hover {
background-color: lightblue; background-color: lightblue;
} }
.t-li-cat {
padding: 0 4px;
margin: 1px;
border-bottom: solid 1px dimgray;
color: dimgray;
font-size: small;
}
.t-li-cat-2 {
border-bottom-style: dashed;
font-size: x-small;
}
input { input {
border: none; border: none;
font-family: sans-serif; font-family: sans-serif;
@@ -286,6 +300,10 @@ input {
.t-li:hover { .t-li:hover {
background-color: darkblue; background-color: darkblue;
} }
.t-li-cat {
border-bottom-color: lightgray;
color: lightgray;
}
input { input {
background-color: black; background-color: black;
color: white; color: white;

View File

@@ -39,7 +39,6 @@ var statementlists = {
"statement.comp": ["input.comp"], "statement.comp": ["input.comp"],
"statement.define": ["input.ident", "exp"], "statement.define": ["input.ident", "exp"],
"statement.exp.cast.vector2number": ["exp.vector"], "statement.exp.cast.vector2number": ["exp.vector"],
"statement.exp.cast.number2vector": ["exp.number"],
"statement.exp.const.w": [], "statement.exp.const.w": [],
"statement.exp.const.h": [], "statement.exp.const.h": [],
"statement.exp.const.inf": [], "statement.exp.const.inf": [],
@@ -115,14 +114,14 @@ var explists = {
], ],
"exp.number": [ "exp.number": [
"statement.exp.literal.number", "statement.exp.cast.vector2number", "statement.exp.literal.number", "statement.exp.cast.vector2number",
"statement.exp.const.w", "statement.exp.const.h", "statement.exp.const.inf", "statement.exp.const.true", "statement.exp.const.false", "-exp.const", "statement.exp.const.w", "statement.exp.const.h", "statement.exp.const.inf", "statement.exp.const.true", "statement.exp.const.false",
"statement.exp.op.add", "statement.exp.op.sub", "statement.exp.op.mul", "statement.exp.op.div", "statement.exp.op.mod", "-exp.op", "statement.exp.op.add", "statement.exp.op.sub", "statement.exp.op.mul", "statement.exp.op.div", "statement.exp.op.mod",
"statement.exp.op.add1", "statement.exp.op.sub1", "statement.exp.op.not", "-", "statement.exp.op.add1", "statement.exp.op.sub1", "statement.exp.op.not",
"statement.exp.op.at", "statement.exp.op.lt", "statement.exp.op.eq", "statement.exp.op.gt", "-", "statement.exp.op.at", "statement.exp.op.lt", "statement.exp.op.eq", "statement.exp.op.gt",
"statement.exp.func.interval", "statement.exp.func.is", "-exp.func", "statement.exp.func.interval", "statement.exp.func.is",
"statement.exp.func.int", "statement.exp.func.clamp", "statement.exp.func.min", "statement.exp.func.max", "statement.exp.func.abs", "-exp.func.ctx", "statement.exp.func.int", "statement.exp.func.clamp", "statement.exp.func.min", "statement.exp.func.max", "statement.exp.func.abs",
"statement.exp.func.cubic_bezier", "statement.exp.func.ease", "statement.exp.func.ease_in", "statement.exp.func.ease_out", "statement.exp.func.ease_in_out", "-exp.func.anim", "statement.exp.func.cubic_bezier", "statement.exp.func.ease", "statement.exp.func.ease_in", "statement.exp.func.ease_out", "statement.exp.func.ease_in_out",
"statement.exp.func.attack_timing", "statement.exp.func.enter_timing", "statement.exp.func.release_timing", "statement.exp.func.leave_timing", "statement.exp.func.contact_timing", "-exp.func.judge", "statement.exp.func.attack_timing", "statement.exp.func.enter_timing", "statement.exp.func.release_timing", "statement.exp.func.leave_timing", "statement.exp.func.contact_timing",
"#exp.any" "#exp.any"
], ],
"exp.string": [ "exp.string": [
@@ -311,16 +310,24 @@ function generateAddExpList(event, item) {
event.stopPropagation(); event.stopPropagation();
if (clist) clist.remove(); if (clist) clist.remove();
var ul = $("<ul></ul>").addClass("t-list t-exp-list"); var ul = $("<ul></ul>").addClass("t-list t-exp-list");
(function addExpRecursive(it) { (function addExpRecursive(it, depth) {
if (depth > 0) {
ul.append($("<li></li>").addClass("t-li-cat t-li-cat-" + depth.toString()).text(msg("list.category." + it)));
}
var items = explists[it]; var items = explists[it];
for (var i in items) { for (var i in items) {
var item = items[i]; var item = items[i];
if (item[0] == "#") if (item[0] == "#") {
addExpRecursive(item.substring(1)); if (depth == 0) addExpRecursive(item.substring(1), 1);
}
else if (item == "-")
ul.append($("<li></li>").addClass("t-li-br"));
else if (item[0] == "-")
ul.append($("<li></li>").addClass("t-li-cat t-li-cat-" + (depth + 1).toString()).text(msg("list.category." + item.substring(1))));
else else
ul.append($("<li></li>").addClass("t-li").attr("key", item).text(msg("list." + item)).on("click", null, item, onAddItemClick)); ul.append($("<li></li>").addClass("t-li").attr("key", item).text(msg("list." + item)).on("click", null, item, onAddItemClick));
} }
})(item); })(item, 0);
popup(event, ul); popup(event, ul);
} }