@openfairygui/cli 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +372 -98
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -140,7 +140,7 @@ function createTransform(name, fn) {
|
|
|
140
140
|
Object.defineProperty(fn, "name", { value: name });
|
|
141
141
|
return fn;
|
|
142
142
|
}
|
|
143
|
-
function parseTextureSetMode(value) {
|
|
143
|
+
function parseTextureSetMode(value, maxAtlasIndex = 10) {
|
|
144
144
|
const raw = value?.trim() ?? "";
|
|
145
145
|
if (!raw) return {
|
|
146
146
|
kind: "auto",
|
|
@@ -163,7 +163,7 @@ function parseTextureSetMode(value) {
|
|
|
163
163
|
};
|
|
164
164
|
if (/^\d+$/.test(raw)) {
|
|
165
165
|
const pageIndex = Number(raw);
|
|
166
|
-
if (pageIndex >= 0 && pageIndex <=
|
|
166
|
+
if (pageIndex >= 0 && pageIndex <= maxAtlasIndex) return {
|
|
167
167
|
kind: "page",
|
|
168
168
|
raw,
|
|
169
169
|
pageIndex
|
|
@@ -773,6 +773,14 @@ var Property = class extends GraphNode {
|
|
|
773
773
|
if (Array.isArray(value)) value = value.slice();
|
|
774
774
|
return super.set(attribute, value);
|
|
775
775
|
}
|
|
776
|
+
/** @hidden */
|
|
777
|
+
getExtendedLiteral(attribute) {
|
|
778
|
+
return super.get(attribute);
|
|
779
|
+
}
|
|
780
|
+
/** @hidden */
|
|
781
|
+
setExtendedLiteral(attribute, value) {
|
|
782
|
+
return super.set(attribute, value.slice());
|
|
783
|
+
}
|
|
776
784
|
getName() {
|
|
777
785
|
return this.get("name");
|
|
778
786
|
}
|
|
@@ -864,7 +872,7 @@ var ExtensibleProperty = class extends Property {
|
|
|
864
872
|
};
|
|
865
873
|
//#endregion
|
|
866
874
|
//#region ../core/src/constants.ts
|
|
867
|
-
const VERSION = `v0.2.
|
|
875
|
+
const VERSION = `v0.2.6`;
|
|
868
876
|
/** Binary package file magic number: "FGUI" as uint32. */
|
|
869
877
|
const FGUI_MAGIC = 1179080009;
|
|
870
878
|
/** Null string index in the binary string table. */
|
|
@@ -880,6 +888,7 @@ let PropertyType = /* @__PURE__ */ function(PropertyType) {
|
|
|
880
888
|
PropertyType["SOUND_RESOURCE"] = "SoundResource";
|
|
881
889
|
PropertyType["FONT_RESOURCE"] = "FontResource";
|
|
882
890
|
PropertyType["MOVIE_CLIP_RESOURCE"] = "MovieClipResource";
|
|
891
|
+
PropertyType["SWF_RESOURCE"] = "SwfResource";
|
|
883
892
|
PropertyType["SPINE_RESOURCE"] = "SpineResource";
|
|
884
893
|
PropertyType["DRAGON_BONES_RESOURCE"] = "DragonBonesResource";
|
|
885
894
|
PropertyType["COMPONENT"] = "Component";
|
|
@@ -1522,10 +1531,10 @@ var ImageResource = class extends ExtensibleProperty {
|
|
|
1522
1531
|
return this.set("branchItemIds", [...ids]);
|
|
1523
1532
|
}
|
|
1524
1533
|
getHighResolutionItemIds() {
|
|
1525
|
-
return [...this.
|
|
1534
|
+
return [...this.getExtendedLiteral("highResolutionItemIds")];
|
|
1526
1535
|
}
|
|
1527
1536
|
setHighResolutionItemIds(ids) {
|
|
1528
|
-
return this.
|
|
1537
|
+
return this.setExtendedLiteral("highResolutionItemIds", ids);
|
|
1529
1538
|
}
|
|
1530
1539
|
getWidth() {
|
|
1531
1540
|
return this.get("width");
|
|
@@ -1998,10 +2007,10 @@ var MovieClipResource = class extends ExtensibleProperty {
|
|
|
1998
2007
|
return this.set("branchItemIds", [...ids]);
|
|
1999
2008
|
}
|
|
2000
2009
|
getHighResolutionItemIds() {
|
|
2001
|
-
return [...this.
|
|
2010
|
+
return [...this.getExtendedLiteral("highResolutionItemIds")];
|
|
2002
2011
|
}
|
|
2003
2012
|
setHighResolutionItemIds(ids) {
|
|
2004
|
-
return this.
|
|
2013
|
+
return this.setExtendedLiteral("highResolutionItemIds", ids);
|
|
2005
2014
|
}
|
|
2006
2015
|
getFileName() {
|
|
2007
2016
|
return this.get("fileName");
|
|
@@ -2081,6 +2090,74 @@ var MovieClipResource = class extends ExtensibleProperty {
|
|
|
2081
2090
|
}
|
|
2082
2091
|
};
|
|
2083
2092
|
//#endregion
|
|
2093
|
+
//#region ../core/src/properties/swf-resource.ts
|
|
2094
|
+
/** A SWF resource within a FairyGUI package. */
|
|
2095
|
+
var SwfResource = class extends ExtensibleProperty {
|
|
2096
|
+
init() {
|
|
2097
|
+
this.propertyType = PropertyType.SWF_RESOURCE;
|
|
2098
|
+
}
|
|
2099
|
+
getDefaults() {
|
|
2100
|
+
return Object.assign(super.getDefaults(), {
|
|
2101
|
+
id: "",
|
|
2102
|
+
path: "",
|
|
2103
|
+
branch: "",
|
|
2104
|
+
branchItemIds: [],
|
|
2105
|
+
file: "",
|
|
2106
|
+
exported: false,
|
|
2107
|
+
favorite: false,
|
|
2108
|
+
resourceData: null
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
getId() {
|
|
2112
|
+
return this.get("id");
|
|
2113
|
+
}
|
|
2114
|
+
setId(id) {
|
|
2115
|
+
return this.set("id", id);
|
|
2116
|
+
}
|
|
2117
|
+
getPath() {
|
|
2118
|
+
return this.get("path");
|
|
2119
|
+
}
|
|
2120
|
+
setPath(path) {
|
|
2121
|
+
return this.set("path", path);
|
|
2122
|
+
}
|
|
2123
|
+
getBranch() {
|
|
2124
|
+
return this.get("branch");
|
|
2125
|
+
}
|
|
2126
|
+
setBranch(branch) {
|
|
2127
|
+
return this.set("branch", branch);
|
|
2128
|
+
}
|
|
2129
|
+
getBranchItemIds() {
|
|
2130
|
+
return [...this.get("branchItemIds")];
|
|
2131
|
+
}
|
|
2132
|
+
setBranchItemIds(ids) {
|
|
2133
|
+
return this.set("branchItemIds", [...ids]);
|
|
2134
|
+
}
|
|
2135
|
+
getFile() {
|
|
2136
|
+
return this.get("file");
|
|
2137
|
+
}
|
|
2138
|
+
setFile(file) {
|
|
2139
|
+
return this.set("file", file);
|
|
2140
|
+
}
|
|
2141
|
+
getExported() {
|
|
2142
|
+
return this.get("exported");
|
|
2143
|
+
}
|
|
2144
|
+
setExported(value) {
|
|
2145
|
+
return this.set("exported", value);
|
|
2146
|
+
}
|
|
2147
|
+
getFavorite() {
|
|
2148
|
+
return this.get("favorite");
|
|
2149
|
+
}
|
|
2150
|
+
setFavorite(value) {
|
|
2151
|
+
return this.set("favorite", value);
|
|
2152
|
+
}
|
|
2153
|
+
getSourceData() {
|
|
2154
|
+
return this.getRef("resourceData");
|
|
2155
|
+
}
|
|
2156
|
+
setSourceData(buffer) {
|
|
2157
|
+
return this.setRef("resourceData", buffer);
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
//#endregion
|
|
2084
2161
|
//#region ../core/src/properties/skeleton-resource-base.ts
|
|
2085
2162
|
/**
|
|
2086
2163
|
* Shared base for skeleton-style package resources.
|
|
@@ -2287,6 +2364,7 @@ var Component = class extends ExtensibleProperty {
|
|
|
2287
2364
|
idNum: 0,
|
|
2288
2365
|
initName: "",
|
|
2289
2366
|
remark: "",
|
|
2367
|
+
customExtensionId: "",
|
|
2290
2368
|
extensionType: "",
|
|
2291
2369
|
buttonMode: 0,
|
|
2292
2370
|
sound: "",
|
|
@@ -2609,6 +2687,12 @@ var Component = class extends ExtensibleProperty {
|
|
|
2609
2687
|
setRemark(v) {
|
|
2610
2688
|
return this.set("remark", v);
|
|
2611
2689
|
}
|
|
2690
|
+
getCustomExtensionId() {
|
|
2691
|
+
return this.get("customExtensionId");
|
|
2692
|
+
}
|
|
2693
|
+
setCustomExtensionId(v) {
|
|
2694
|
+
return this.set("customExtensionId", v);
|
|
2695
|
+
}
|
|
2612
2696
|
getExtensionType() {
|
|
2613
2697
|
return this.get("extensionType");
|
|
2614
2698
|
}
|
|
@@ -4364,6 +4448,7 @@ var GLoader = class extends GObject {
|
|
|
4364
4448
|
shrinkOnly: false,
|
|
4365
4449
|
autoSize: false,
|
|
4366
4450
|
useResize: false,
|
|
4451
|
+
showErrorSign: false,
|
|
4367
4452
|
align: 0,
|
|
4368
4453
|
vAlign: 0,
|
|
4369
4454
|
frame: 0,
|
|
@@ -4501,6 +4586,12 @@ var GLoader = class extends GObject {
|
|
|
4501
4586
|
setUseResize(v) {
|
|
4502
4587
|
return this.set("useResize", v);
|
|
4503
4588
|
}
|
|
4589
|
+
getShowErrorSign() {
|
|
4590
|
+
return this.get("showErrorSign");
|
|
4591
|
+
}
|
|
4592
|
+
setShowErrorSign(v) {
|
|
4593
|
+
return this.set("showErrorSign", v);
|
|
4594
|
+
}
|
|
4504
4595
|
getAlign() {
|
|
4505
4596
|
return this.get("align");
|
|
4506
4597
|
}
|
|
@@ -5321,6 +5412,9 @@ var GComponent = class extends GObject {
|
|
|
5321
5412
|
};
|
|
5322
5413
|
//#endregion
|
|
5323
5414
|
//#region ../core/src/properties/g-list.ts
|
|
5415
|
+
function getDefaultListAutoResizeItem(layout) {
|
|
5416
|
+
return layout === ListLayoutType.SingleColumn || layout === ListLayoutType.SingleRow;
|
|
5417
|
+
}
|
|
5324
5418
|
function firstString(value) {
|
|
5325
5419
|
if (Array.isArray(value)) return String(value[0] ?? "");
|
|
5326
5420
|
return String(value ?? "");
|
|
@@ -5353,7 +5447,7 @@ var GListBase = class extends GObject {
|
|
|
5353
5447
|
columnCount: 0,
|
|
5354
5448
|
selectionMode: ListSelectionMode.Single,
|
|
5355
5449
|
defaultItem: "",
|
|
5356
|
-
autoResizeItem:
|
|
5450
|
+
autoResizeItem: getDefaultListAutoResizeItem(ListLayoutType.SingleColumn),
|
|
5357
5451
|
childrenRenderOrder: 0,
|
|
5358
5452
|
apexIndex: 0,
|
|
5359
5453
|
src: "",
|
|
@@ -6603,7 +6697,10 @@ var ControllerPage = class extends Property {
|
|
|
6603
6697
|
this.propertyType = PropertyType.CONTROLLER_PAGE;
|
|
6604
6698
|
}
|
|
6605
6699
|
getDefaults() {
|
|
6606
|
-
return Object.assign(super.getDefaults(), {
|
|
6700
|
+
return Object.assign(super.getDefaults(), {
|
|
6701
|
+
id: "",
|
|
6702
|
+
remark: ""
|
|
6703
|
+
});
|
|
6607
6704
|
}
|
|
6608
6705
|
getId() {
|
|
6609
6706
|
return this.get("id");
|
|
@@ -6611,6 +6708,12 @@ var ControllerPage = class extends Property {
|
|
|
6611
6708
|
setId(id) {
|
|
6612
6709
|
return this.set("id", id);
|
|
6613
6710
|
}
|
|
6711
|
+
getRemark() {
|
|
6712
|
+
return this.get("remark");
|
|
6713
|
+
}
|
|
6714
|
+
setRemark(remark) {
|
|
6715
|
+
return this.set("remark", remark);
|
|
6716
|
+
}
|
|
6614
6717
|
};
|
|
6615
6718
|
//#endregion
|
|
6616
6719
|
//#region ../core/src/properties/controller-action.ts
|
|
@@ -16200,6 +16303,9 @@ var Document = class Document {
|
|
|
16200
16303
|
createMovieClipResource(name = "") {
|
|
16201
16304
|
return new MovieClipResource(this._graph, name);
|
|
16202
16305
|
}
|
|
16306
|
+
createSwfResource(name = "") {
|
|
16307
|
+
return new SwfResource(this._graph, name);
|
|
16308
|
+
}
|
|
16203
16309
|
createSpineResource(name = "") {
|
|
16204
16310
|
return new SpineResource(this._graph, name);
|
|
16205
16311
|
}
|
|
@@ -16455,6 +16561,7 @@ const ROOT_COMPONENT_PANEL_ATTRS = {
|
|
|
16455
16561
|
bgColorEnabled: { canonical: "bgColorEnabled" },
|
|
16456
16562
|
idnum: { canonical: "idnum" },
|
|
16457
16563
|
initName: { canonical: "initName" },
|
|
16564
|
+
customExtention: { canonical: "customExtention" },
|
|
16458
16565
|
pageController: { canonical: "pageController" },
|
|
16459
16566
|
showSound: { canonical: "showSound" },
|
|
16460
16567
|
hideSound: { canonical: "hideSound" }
|
|
@@ -16507,6 +16614,7 @@ const LOADER_PANEL_ATTRS = {
|
|
|
16507
16614
|
shrinkOnly: { canonical: "shrinkOnly" },
|
|
16508
16615
|
autoSize: { canonical: "autoSize" },
|
|
16509
16616
|
useResize: { canonical: "useResize" },
|
|
16617
|
+
errorSign: { canonical: "errorSign" },
|
|
16510
16618
|
color: { canonical: "color" },
|
|
16511
16619
|
playing: { canonical: "playing" },
|
|
16512
16620
|
frame: { canonical: "frame" },
|
|
@@ -16734,6 +16842,10 @@ const CONTROLLER_ACTION_ATTRS = {
|
|
|
16734
16842
|
controller: { canonical: "controller" },
|
|
16735
16843
|
targetPage: { canonical: "targetPage" }
|
|
16736
16844
|
};
|
|
16845
|
+
const CONTROLLER_REMARK_ATTRS = {
|
|
16846
|
+
page: { canonical: "page" },
|
|
16847
|
+
value: { canonical: "value" }
|
|
16848
|
+
};
|
|
16737
16849
|
const TRANSITION_ATTRS = {
|
|
16738
16850
|
name: { canonical: "name" },
|
|
16739
16851
|
autoPlay: { canonical: "autoPlay" },
|
|
@@ -16743,7 +16855,7 @@ const TRANSITION_ATTRS = {
|
|
|
16743
16855
|
},
|
|
16744
16856
|
autoPlayDelay: { canonical: "autoPlayDelay" },
|
|
16745
16857
|
options: { canonical: "options" },
|
|
16746
|
-
fps: { canonical: "
|
|
16858
|
+
fps: { canonical: "frameRate" }
|
|
16747
16859
|
};
|
|
16748
16860
|
const TRANSITION_ITEM_ATTRS = {
|
|
16749
16861
|
time: { canonical: "time" },
|
|
@@ -16799,6 +16911,7 @@ const CUSTOM_PROPERTY_NODE = defineNode(CUSTOM_PROPERTY_ATTRS);
|
|
|
16799
16911
|
const PROPERTY_OVERRIDE_NODE = defineNode(PROPERTY_OVERRIDE_ATTRS);
|
|
16800
16912
|
const GEAR_NODE = defineNode(GEAR_ATTRS);
|
|
16801
16913
|
const CONTROLLER_ACTION_NODE = defineNode(CONTROLLER_ACTION_ATTRS);
|
|
16914
|
+
const CONTROLLER_REMARK_NODE = defineNode(CONTROLLER_REMARK_ATTRS);
|
|
16802
16915
|
const TRANSITION_ITEM_NODE = defineNode(TRANSITION_ITEM_ATTRS);
|
|
16803
16916
|
const LIST_ITEM_NODE = defineNode(LIST_ITEM_ATTRS, { property: PROPERTY_OVERRIDE_NODE });
|
|
16804
16917
|
const COMBOBOX_ITEM_NODE = defineNode(COMBOBOX_ITEM_ATTRS);
|
|
@@ -16823,7 +16936,10 @@ const WITH_GROUP_GEAR_CHILDREN = {
|
|
|
16823
16936
|
gearIcon: GEAR_NODE,
|
|
16824
16937
|
gearDisplay2: GEAR_NODE
|
|
16825
16938
|
};
|
|
16826
|
-
const WITH_CONTROLLER_ACTION_CHILDREN = {
|
|
16939
|
+
const WITH_CONTROLLER_ACTION_CHILDREN = {
|
|
16940
|
+
action: CONTROLLER_ACTION_NODE,
|
|
16941
|
+
remark: CONTROLLER_REMARK_NODE
|
|
16942
|
+
};
|
|
16827
16943
|
const WITH_TRANSITION_ITEM_CHILDREN = { item: TRANSITION_ITEM_NODE };
|
|
16828
16944
|
const WITH_LIST_ITEM_CHILDREN = { item: LIST_ITEM_NODE };
|
|
16829
16945
|
const COMBOBOX_EXTENSION_NODE = defineNode(mergeAttrs(COMBOBOX_EXTENSION_ATTRS), mergeChildren({ item: COMBOBOX_ITEM_NODE }));
|
|
@@ -17836,6 +17952,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
17836
17952
|
if (loaderAutoSize !== void 0) g.setAutoSize?.(parseBool(loaderAutoSize));
|
|
17837
17953
|
const useResize = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.useResize);
|
|
17838
17954
|
if (useResize !== void 0) g.setUseResize?.(parseBool(useResize));
|
|
17955
|
+
const errorSign = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.errorSign);
|
|
17956
|
+
if (errorSign !== void 0) g.setShowErrorSign(parseBool(errorSign));
|
|
17839
17957
|
const clearOnPublish = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.clearOnPublish);
|
|
17840
17958
|
if (clearOnPublish !== void 0) g.setClearOnPublish?.(parseBool(clearOnPublish));
|
|
17841
17959
|
const loaderColor = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color);
|
|
@@ -18141,7 +18259,7 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
18141
18259
|
if (resolvedLayout === 4 && lineItemCount2 !== void 0) g.setLineCount?.(parseInt2(lineItemCount2));
|
|
18142
18260
|
}
|
|
18143
18261
|
const autoResizeItem = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem);
|
|
18144
|
-
|
|
18262
|
+
g.setAutoResizeItem?.(autoResizeItem === void 0 ? getDefaultListAutoResizeItem(g.getLayout?.() ?? 0) : parseBool(autoResizeItem));
|
|
18145
18263
|
const childrenRenderOrder = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder);
|
|
18146
18264
|
if (childrenRenderOrder) g.setChildrenRenderOrder?.({
|
|
18147
18265
|
ascent: 0,
|
|
@@ -18499,6 +18617,13 @@ function parseButtonMode(value) {
|
|
|
18499
18617
|
const parsed = Number(normalized);
|
|
18500
18618
|
return map[normalized] ?? (Number.isFinite(parsed) ? parsed : 0);
|
|
18501
18619
|
}
|
|
18620
|
+
function parseButtonDownEffect(value) {
|
|
18621
|
+
return {
|
|
18622
|
+
none: 0,
|
|
18623
|
+
dark: 1,
|
|
18624
|
+
scale: 2
|
|
18625
|
+
}[String(value ?? "").trim().toLowerCase()] ?? 0;
|
|
18626
|
+
}
|
|
18502
18627
|
function parseTitleType(value) {
|
|
18503
18628
|
if (typeof value === "number") return value;
|
|
18504
18629
|
const normalized = String(value ?? "").trim().toLowerCase();
|
|
@@ -18594,6 +18719,8 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18594
18719
|
if (initName !== void 0) comp.setInitName?.(initName);
|
|
18595
18720
|
const remark = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark);
|
|
18596
18721
|
if (remark !== void 0) comp.setRemark?.(remark);
|
|
18722
|
+
const customExtensionId = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.customExtention);
|
|
18723
|
+
if (customExtensionId !== void 0) comp.setCustomExtensionId?.(customExtensionId);
|
|
18597
18724
|
const pageController = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController);
|
|
18598
18725
|
if (pageController !== void 0) comp.setPageController?.(pageController);
|
|
18599
18726
|
const showSound = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.showSound);
|
|
@@ -18670,7 +18797,7 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18670
18797
|
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.mode) !== void 0) comp.setButtonMode?.(parseButtonMode(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.mode)));
|
|
18671
18798
|
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.sound) !== void 0) comp.setSound?.(String(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.sound)));
|
|
18672
18799
|
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale) !== void 0) comp.setSoundVolumeScale?.(parseFloat2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale), 100) / 100);
|
|
18673
|
-
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect) !== void 0) comp.setDownEffect?.(
|
|
18800
|
+
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect) !== void 0) comp.setDownEffect?.(parseButtonDownEffect(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect)));
|
|
18674
18801
|
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffectValue) !== void 0) comp.setDownEffectValue?.(parseFloat2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffectValue), .8));
|
|
18675
18802
|
break;
|
|
18676
18803
|
case "ComboBox":
|
|
@@ -18701,7 +18828,7 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18701
18828
|
}
|
|
18702
18829
|
const customPropertyChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
18703
18830
|
const customProperties = customPropertyChildName ? ensureArray(compNode[customPropertyChildName]) : [];
|
|
18704
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
18831
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
18705
18832
|
comp.setCustomProperties(customProperties.flatMap((value) => {
|
|
18706
18833
|
const property = getXmlNode$1(value);
|
|
18707
18834
|
const propertyId = property ? parseInt2(readXmlAttr(property, customPropertyProtocol?.attrs.propertyId), -1) : -1;
|
|
@@ -18727,6 +18854,15 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18727
18854
|
p.setId(page.id);
|
|
18728
18855
|
ctrl.addPage(p);
|
|
18729
18856
|
}
|
|
18857
|
+
const controllerRemarkChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.controller, "remark");
|
|
18858
|
+
const controllerRemarkProtocol = PROJECT_XML_PROTOCOL.controller.children.remark;
|
|
18859
|
+
const remarks = controllerRemarkChildName ? ensureArray(ctrlDef[controllerRemarkChildName]) : [];
|
|
18860
|
+
for (const remarkDef of remarks) {
|
|
18861
|
+
const pageIndex = parseInt2(readXmlAttr(remarkDef, controllerRemarkProtocol.attrs.page), -1);
|
|
18862
|
+
const page = ctrl.listPages()[pageIndex];
|
|
18863
|
+
if (!page) continue;
|
|
18864
|
+
page.setRemark(readXmlAttr(remarkDef, controllerRemarkProtocol.attrs.value) ?? "");
|
|
18865
|
+
}
|
|
18730
18866
|
const controllerActionChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.controller, "action");
|
|
18731
18867
|
const actions = controllerActionChildName ? ensureArray(ctrlDef[controllerActionChildName]) : [];
|
|
18732
18868
|
for (let actionIndex = 0; actionIndex < actions.length; actionIndex += 1) {
|
|
@@ -19211,6 +19347,7 @@ var ProjectReader = class {
|
|
|
19211
19347
|
case "MovieClipResource": return resource.getFileName();
|
|
19212
19348
|
case "SoundResource":
|
|
19213
19349
|
case "MiscResource":
|
|
19350
|
+
case "SwfResource":
|
|
19214
19351
|
case "SpineResource":
|
|
19215
19352
|
case "DragonBonesResource": return resource.getFile();
|
|
19216
19353
|
default: return "";
|
|
@@ -19306,6 +19443,18 @@ var ProjectReader = class {
|
|
|
19306
19443
|
ctx.registerResource(pkg.getId(), id, res);
|
|
19307
19444
|
return res;
|
|
19308
19445
|
}
|
|
19446
|
+
case "swf": {
|
|
19447
|
+
const res = doc.createSwfResource(name.replace(/\.swf$/i, ""));
|
|
19448
|
+
res.setId(id);
|
|
19449
|
+
res.setPath(path);
|
|
19450
|
+
res.setBranch(branchName);
|
|
19451
|
+
res.setFile(name);
|
|
19452
|
+
res.setExported(exported);
|
|
19453
|
+
res.setFavorite(favorite);
|
|
19454
|
+
pkg.addResource(res);
|
|
19455
|
+
ctx.registerResource(pkg.getId(), id, res);
|
|
19456
|
+
return res;
|
|
19457
|
+
}
|
|
19309
19458
|
case "font": {
|
|
19310
19459
|
const res = doc.createFontResource(name.replace(/\.\w+$/, ""));
|
|
19311
19460
|
res.setId(id);
|
|
@@ -19768,6 +19917,13 @@ function formatButtonMode(mode) {
|
|
|
19768
19917
|
2: "Radio"
|
|
19769
19918
|
}[mode] ?? "Common";
|
|
19770
19919
|
}
|
|
19920
|
+
function formatButtonDownEffect(effect) {
|
|
19921
|
+
return [
|
|
19922
|
+
"none",
|
|
19923
|
+
"dark",
|
|
19924
|
+
"scale"
|
|
19925
|
+
][effect] ?? "none";
|
|
19926
|
+
}
|
|
19771
19927
|
function formatTitleType(titleType) {
|
|
19772
19928
|
return {
|
|
19773
19929
|
0: "percent",
|
|
@@ -20030,6 +20186,7 @@ function serializeChild(obj) {
|
|
|
20030
20186
|
if (typedObj.getShrinkOnly?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.shrinkOnly, "1");
|
|
20031
20187
|
if (typedObj.getAutoSize?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.autoSize, "1");
|
|
20032
20188
|
if (typedObj.getUseResize?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.useResize, "1");
|
|
20189
|
+
if (typedObj.getShowErrorSign?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.errorSign, "true");
|
|
20033
20190
|
const loaderColor = typedObj.getColor?.();
|
|
20034
20191
|
if (loaderColor && !isDefaultWhiteColor(loaderColor)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color, loaderColor);
|
|
20035
20192
|
if (typedObj.getFilter?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.filter, typedObj.getFilter?.());
|
|
@@ -20227,7 +20384,8 @@ function serializeChild(obj) {
|
|
|
20227
20384
|
if ((layout === 2 || layout === 4) && columnCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(columnCount));
|
|
20228
20385
|
else if (layout === 3 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(lineCount));
|
|
20229
20386
|
if (layout === 4 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount2, String(lineCount));
|
|
20230
|
-
|
|
20387
|
+
const autoResizeItem = typedObj.getAutoResizeItem?.() ?? true;
|
|
20388
|
+
if (autoResizeItem !== getDefaultListAutoResizeItem(layout ?? 0)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem, String(autoResizeItem));
|
|
20231
20389
|
const childrenRenderOrder = typedObj.getChildrenRenderOrder?.() ?? 0;
|
|
20232
20390
|
if (childrenRenderOrder !== 0) {
|
|
20233
20391
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder, {
|
|
@@ -20576,6 +20734,8 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20576
20734
|
if (initName) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.initName, initName);
|
|
20577
20735
|
const remark = typedComp.getRemark?.();
|
|
20578
20736
|
if (remark) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark, remark);
|
|
20737
|
+
const customExtensionId = typedComp.getCustomExtensionId?.();
|
|
20738
|
+
if (customExtensionId) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.customExtention, customExtensionId);
|
|
20579
20739
|
const pageController = typedComp.getPageController?.();
|
|
20580
20740
|
if (pageController) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController, pageController);
|
|
20581
20741
|
const showSound = typedComp.getAddedToStageSound?.();
|
|
@@ -20638,7 +20798,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20638
20798
|
}
|
|
20639
20799
|
const customProperties = typedComp.getCustomProperties?.() ?? [];
|
|
20640
20800
|
const customPropertyChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
20641
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
20801
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
20642
20802
|
if (customProperties.length > 0 && customPropertyChildName) compNode[customPropertyChildName] = customProperties.map((property) => {
|
|
20643
20803
|
const attrs = {};
|
|
20644
20804
|
writeXmlAttr(attrs, customPropertyProtocol?.attrs.target, property.target);
|
|
@@ -20656,7 +20816,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20656
20816
|
if ((typedComp.getSoundVolumeScale?.() ?? 1) !== 1) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(Math.round((typedComp.getSoundVolumeScale?.() ?? 1) * 100)));
|
|
20657
20817
|
const downEffect = typedComp.getDownEffect?.() ?? 0;
|
|
20658
20818
|
if (downEffect !== 0) {
|
|
20659
|
-
writeXmlAttr(extAttrs, extSpecs.downEffect,
|
|
20819
|
+
writeXmlAttr(extAttrs, extSpecs.downEffect, formatButtonDownEffect(downEffect));
|
|
20660
20820
|
writeXmlAttr(extAttrs, extSpecs.downEffectValue, formatButtonDownEffectValue(typedComp.getDownEffectValue?.() ?? .8));
|
|
20661
20821
|
}
|
|
20662
20822
|
break;
|
|
@@ -20697,7 +20857,8 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20697
20857
|
await fs.writeFile(targetPath, builder.build(xmlObj));
|
|
20698
20858
|
}
|
|
20699
20859
|
function serializeController(ctrl) {
|
|
20700
|
-
const
|
|
20860
|
+
const pages = ctrl.listPages();
|
|
20861
|
+
const pagesStr = pages.map((p) => `${p.getId()},${p.getName()}`).join(",");
|
|
20701
20862
|
const attrs = {};
|
|
20702
20863
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.name, ctrl.getName());
|
|
20703
20864
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.pages, pagesStr);
|
|
@@ -20707,6 +20868,16 @@ function serializeController(ctrl) {
|
|
|
20707
20868
|
if (ctrl.getExported()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.exported, "true");
|
|
20708
20869
|
if (ctrl.getHomePageType() !== "default") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.homePageType, ctrl.getHomePageType());
|
|
20709
20870
|
if (ctrl.getHomePageType() === "specific" || ctrl.getHomePageType() === "variable") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.homePage, ctrl.getHomePage());
|
|
20871
|
+
const remarkProtocol = PROJECT_XML_PROTOCOL.controller.children.remark;
|
|
20872
|
+
const remarks = pages.flatMap((page, pageIndex) => {
|
|
20873
|
+
if (!page.getRemark()) return [];
|
|
20874
|
+
const remarkAttrs = {};
|
|
20875
|
+
writeXmlAttr(remarkAttrs, remarkProtocol.attrs.page, String(pageIndex));
|
|
20876
|
+
writeXmlAttr(remarkAttrs, remarkProtocol.attrs.value, page.getRemark());
|
|
20877
|
+
return [remarkAttrs];
|
|
20878
|
+
});
|
|
20879
|
+
const remarkChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.controller, "remark");
|
|
20880
|
+
if (remarks.length > 0 && remarkChildName) attrs[remarkChildName] = remarks;
|
|
20710
20881
|
const actions = ctrl.listActions().map((action) => serializeControllerAction(action));
|
|
20711
20882
|
const actionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.controller, "action");
|
|
20712
20883
|
if (actions.length > 0 && actionChildName) attrs[actionChildName] = actions;
|
|
@@ -21238,6 +21409,7 @@ var ProjectWriter = class {
|
|
|
21238
21409
|
SoundResource: "sound",
|
|
21239
21410
|
FontResource: "font",
|
|
21240
21411
|
MovieClipResource: "movieclip",
|
|
21412
|
+
SwfResource: "swf",
|
|
21241
21413
|
SpineResource: "spine",
|
|
21242
21414
|
DragonBonesResource: "dragonbones"
|
|
21243
21415
|
}[propertyType] ?? null;
|
|
@@ -21250,7 +21422,7 @@ var ProjectWriter = class {
|
|
|
21250
21422
|
const fileName = res.getFileName?.() ?? "";
|
|
21251
21423
|
if (fileName) return fileName;
|
|
21252
21424
|
}
|
|
21253
|
-
if (type === "SoundResource" || type === "MiscResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
21425
|
+
if (type === "SoundResource" || type === "MiscResource" || type === "SwfResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
21254
21426
|
const fileName = res.getFile?.() ?? "";
|
|
21255
21427
|
if (fileName) return fileName;
|
|
21256
21428
|
}
|
|
@@ -21884,6 +22056,10 @@ function decodeChildBlock4ComponentLike(resource, child, childBuf) {
|
|
|
21884
22056
|
const controller = resource.listControllers()[pageControllerIndex];
|
|
21885
22057
|
if (controller && "setPageController" in child && typeof child.setPageController === "function") child.setPageController(controller.getName());
|
|
21886
22058
|
}
|
|
22059
|
+
if (childBuf.version >= 2 && remainingBytes(childBuf) >= 2) {
|
|
22060
|
+
const propertyOverrides = decodePropertyOverrides(childBuf);
|
|
22061
|
+
if ("setPropertyOverrides" in child && typeof child.setPropertyOverrides === "function") child.setPropertyOverrides(propertyOverrides);
|
|
22062
|
+
}
|
|
21887
22063
|
}
|
|
21888
22064
|
function decodeChildBlock4TextInput(child, childBuf) {
|
|
21889
22065
|
if (!childBuf.seek(0, 4) || remainingBytes(childBuf) < 10) return;
|
|
@@ -21914,20 +22090,26 @@ function decodeListScrollPane(child, childBuf) {
|
|
|
21914
22090
|
]);
|
|
21915
22091
|
listLike.setVtScrollBarRes(childBuf.readS() ?? "").setHzScrollBarRes(childBuf.readS() ?? "").setHeaderRes(childBuf.readS() ?? "").setFooterRes(childBuf.readS() ?? "");
|
|
21916
22092
|
}
|
|
22093
|
+
function decodePropertyOverrides(buf) {
|
|
22094
|
+
const count = buf.getInt16();
|
|
22095
|
+
const properties = [];
|
|
22096
|
+
for (let index = 0; index < count && remainingBytes(buf) >= 6; index += 1) properties.push({
|
|
22097
|
+
target: buf.readS() ?? "",
|
|
22098
|
+
propertyId: buf.getInt16(),
|
|
22099
|
+
value: buf.readS() ?? ""
|
|
22100
|
+
});
|
|
22101
|
+
return properties;
|
|
22102
|
+
}
|
|
21917
22103
|
function decodeListItemOverrides(buf, version) {
|
|
21918
|
-
if (remainingBytes(buf) < 2) return
|
|
22104
|
+
if (remainingBytes(buf) < 2) return {};
|
|
21919
22105
|
const controllerOverrideCount = buf.getInt16();
|
|
21920
22106
|
const controllerParts = [];
|
|
21921
22107
|
for (let index = 0; index < controllerOverrideCount && remainingBytes(buf) >= 4; index += 1) controllerParts.push(buf.readS() ?? "", buf.readS() ?? "");
|
|
21922
|
-
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
buf.readS();
|
|
21928
|
-
}
|
|
21929
|
-
}
|
|
21930
|
-
return controllerParts.length > 0 ? controllerParts.join(",") : null;
|
|
22108
|
+
const propertyOverrides = version >= 2 && remainingBytes(buf) >= 2 ? decodePropertyOverrides(buf) : [];
|
|
22109
|
+
return {
|
|
22110
|
+
...controllerParts.length > 0 ? { controllers: controllerParts.join(",") } : {},
|
|
22111
|
+
...propertyOverrides.length > 0 ? { propertyOverrides } : {}
|
|
22112
|
+
};
|
|
21931
22113
|
}
|
|
21932
22114
|
function decodeListItems(child, childBuf) {
|
|
21933
22115
|
if (!childBuf.seek(0, 8) || remainingBytes(childBuf) < 4) return;
|
|
@@ -21956,10 +22138,9 @@ function decodeListItems(child, childBuf) {
|
|
|
21956
22138
|
level,
|
|
21957
22139
|
isFolder
|
|
21958
22140
|
};
|
|
21959
|
-
|
|
21960
|
-
items.push(controllers === null ? item : {
|
|
22141
|
+
items.push({
|
|
21961
22142
|
...item,
|
|
21962
|
-
|
|
22143
|
+
...decodeListItemOverrides(childBuf, childBuf.version)
|
|
21963
22144
|
});
|
|
21964
22145
|
childBuf.pos = nextPos;
|
|
21965
22146
|
}
|
|
@@ -22022,7 +22203,7 @@ function decodeChildBlock5(child, childBuf) {
|
|
|
22022
22203
|
if (remainingBytes(childBuf) < 15) return;
|
|
22023
22204
|
const loader = child;
|
|
22024
22205
|
loader.setUrl(childBuf.readS() ?? "").setAlign(childBuf.getUint8()).setVAlign(childBuf.getUint8()).setFill(childBuf.getUint8()).setShrinkOnly(childBuf.readBool()).setAutoSize(childBuf.readBool());
|
|
22025
|
-
childBuf.readBool();
|
|
22206
|
+
loader.setShowErrorSign(childBuf.readBool());
|
|
22026
22207
|
loader.setPlaying(childBuf.readBool()).setFrame(childBuf.getInt32());
|
|
22027
22208
|
if (childBuf.readBool()) loader.setColor(readColorValue(childBuf, false));
|
|
22028
22209
|
loader.setFillMethod(childBuf.getUint8());
|
|
@@ -22572,13 +22753,13 @@ var BinaryReader = class {
|
|
|
22572
22753
|
if (scaleOpt === 1) {
|
|
22573
22754
|
const x = buf.getInt32(), y = buf.getInt32();
|
|
22574
22755
|
const w = buf.getInt32(), h = buf.getInt32();
|
|
22575
|
-
buf.getInt32();
|
|
22756
|
+
const tileGridIndice = buf.getInt32();
|
|
22576
22757
|
res.setScaleOption(1).setScale9Grid([
|
|
22577
22758
|
x,
|
|
22578
22759
|
y,
|
|
22579
22760
|
w,
|
|
22580
22761
|
h
|
|
22581
|
-
]);
|
|
22762
|
+
]).setTileGridIndice(tileGridIndice);
|
|
22582
22763
|
} else if (scaleOpt === 2) res.setScaleOption(2);
|
|
22583
22764
|
res.setSmoothing(buf.readBool());
|
|
22584
22765
|
pkg.addResource(res);
|
|
@@ -22616,6 +22797,17 @@ var BinaryReader = class {
|
|
|
22616
22797
|
createdResource = res;
|
|
22617
22798
|
break;
|
|
22618
22799
|
}
|
|
22800
|
+
case BinItemType$1.Swf: {
|
|
22801
|
+
const res = doc.createSwfResource(itemName);
|
|
22802
|
+
res.setId(itemId).setPath(itemPath).setFile(itemFile).setExported(exported);
|
|
22803
|
+
res.setExtras({
|
|
22804
|
+
...res.getExtras(),
|
|
22805
|
+
_publishedFile: itemFile
|
|
22806
|
+
});
|
|
22807
|
+
pkg.addResource(res);
|
|
22808
|
+
createdResource = res;
|
|
22809
|
+
break;
|
|
22810
|
+
}
|
|
22619
22811
|
case BinItemType$1.Component: {
|
|
22620
22812
|
const res = doc.createComponent(itemName);
|
|
22621
22813
|
res.setId(itemId).setPath(itemPath).setExported(exported).setSize(width, height);
|
|
@@ -23870,7 +24062,7 @@ function _writeDisplayList(buf, comp, _doc, pkg, version) {
|
|
|
23870
24062
|
const isTextInput = childType === "GTextInput";
|
|
23871
24063
|
if (isCompOrList) {
|
|
23872
24064
|
cb4 = buf.pos - childIndexPos;
|
|
23873
|
-
_writeChildBlock4Component(buf, child, comp, pkg);
|
|
24065
|
+
_writeChildBlock4Component(buf, child, comp, pkg, version);
|
|
23874
24066
|
} else if (isTextInput) {
|
|
23875
24067
|
cb4 = buf.pos - childIndexPos;
|
|
23876
24068
|
_writeChildBlock4TextInput(buf, child);
|
|
@@ -24018,13 +24210,13 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
24018
24210
|
buf.writeInt16(child.getMainGridIndex?.() ?? -1);
|
|
24019
24211
|
break;
|
|
24020
24212
|
case "GLoader": {
|
|
24021
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
24213
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
24022
24214
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
24023
24215
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
24024
24216
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
24025
24217
|
buf.writeBool(child.getShrinkOnly?.() ?? false);
|
|
24026
24218
|
buf.writeBool(_boolVal(child.getAutoSize?.(), false));
|
|
24027
|
-
buf.writeBool(false);
|
|
24219
|
+
buf.writeBool(child.getShowErrorSign?.() ?? false);
|
|
24028
24220
|
buf.writeBool(child.getPlaying?.() ?? true);
|
|
24029
24221
|
buf.writeInt32(child.getFrame?.() ?? 0);
|
|
24030
24222
|
const loaderColor = child.getColor?.() ?? null;
|
|
@@ -24043,7 +24235,7 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
24043
24235
|
break;
|
|
24044
24236
|
}
|
|
24045
24237
|
case "GLoader3D": {
|
|
24046
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
24238
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
24047
24239
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
24048
24240
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
24049
24241
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
@@ -24123,7 +24315,7 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
|
|
|
24123
24315
|
case "GTextField":
|
|
24124
24316
|
case "GRichTextField":
|
|
24125
24317
|
case "GTextInput":
|
|
24126
|
-
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getText?.() ?? null), true);
|
|
24318
|
+
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getAutoClearText?.() ? null : child.getText?.() ?? null), true);
|
|
24127
24319
|
break;
|
|
24128
24320
|
case "GButton": {
|
|
24129
24321
|
buf.writeUint8(12);
|
|
@@ -24278,7 +24470,7 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
24278
24470
|
break;
|
|
24279
24471
|
}
|
|
24280
24472
|
case "ComboBox": {
|
|
24281
|
-
const comboItems = child.getInstanceComboItems?.() ?? [];
|
|
24473
|
+
const comboItems = child.getInstanceAutoClearItems?.() ? [] : child.getInstanceComboItems?.() ?? [];
|
|
24282
24474
|
buf.writeInt16(comboItems.length);
|
|
24283
24475
|
for (const item of comboItems) {
|
|
24284
24476
|
const itemStart = buf.pos;
|
|
@@ -24339,7 +24531,7 @@ function _writeScrollPane(buf, child, pkg) {
|
|
|
24339
24531
|
function _writeListItems(buf, child, pkg, version) {
|
|
24340
24532
|
buf.writeS(remapLocalUiUrl(pkg, child.getDefaultItem?.() ?? null));
|
|
24341
24533
|
const isTree = child.propertyType === "GTree";
|
|
24342
|
-
const listItems = child.getListItems?.() ?? [];
|
|
24534
|
+
const listItems = child.getAutoClearItems?.() ? [] : child.getListItems?.() ?? [];
|
|
24343
24535
|
buf.writeInt16(listItems.length);
|
|
24344
24536
|
for (const [index, item] of listItems.entries()) {
|
|
24345
24537
|
const itemStart = buf.pos;
|
|
@@ -24369,7 +24561,7 @@ function _writeListItems(buf, child, pkg, version) {
|
|
|
24369
24561
|
buf.pos = controllerCountPos;
|
|
24370
24562
|
buf.writeInt16(controllerCount);
|
|
24371
24563
|
buf.pos = controllerEnd;
|
|
24372
|
-
if (version >= 2) buf.
|
|
24564
|
+
if (version >= 2) _writePropertyOverrides(buf, item.propertyOverrides ?? []);
|
|
24373
24565
|
const itemEnd = buf.pos;
|
|
24374
24566
|
const saved = buf.pos;
|
|
24375
24567
|
buf.pos = itemStart;
|
|
@@ -24381,7 +24573,7 @@ function _writeTreeSettings(buf, child) {
|
|
|
24381
24573
|
buf.writeInt32(child.getIndent?.() ?? 0);
|
|
24382
24574
|
buf.writeUint8(child.getClickToExpand?.() ?? 0);
|
|
24383
24575
|
}
|
|
24384
|
-
function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
24576
|
+
function _writeChildBlock4Component(buf, child, comp, _pkg, version) {
|
|
24385
24577
|
const pageCtrlName = child.getPageController?.() ?? null;
|
|
24386
24578
|
if (pageCtrlName) {
|
|
24387
24579
|
const ctrlIdx = comp.listControllers().findIndex((c) => c.getName() === pageCtrlName);
|
|
@@ -24403,7 +24595,15 @@ function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
|
24403
24595
|
buf.writeInt16(count);
|
|
24404
24596
|
buf.pos = saved;
|
|
24405
24597
|
} else buf.writeInt16(0);
|
|
24406
|
-
buf.
|
|
24598
|
+
if (version >= 2) _writePropertyOverrides(buf, child.getPropertyOverrides?.() ?? []);
|
|
24599
|
+
}
|
|
24600
|
+
function _writePropertyOverrides(buf, overrides) {
|
|
24601
|
+
buf.writeInt16(overrides.length);
|
|
24602
|
+
for (const property of overrides) {
|
|
24603
|
+
buf.writeS(property.target);
|
|
24604
|
+
buf.writeInt16(property.propertyId);
|
|
24605
|
+
buf.writeSEx(property.value, true);
|
|
24606
|
+
}
|
|
24407
24607
|
}
|
|
24408
24608
|
function _writeChildBlock4TextInput(buf, child) {
|
|
24409
24609
|
buf.writeSEx(child.getPromptText?.() ?? child.getPrompt?.() ?? null);
|
|
@@ -24468,6 +24668,7 @@ const BinItemType = {
|
|
|
24468
24668
|
Component: 3,
|
|
24469
24669
|
Atlas: 4,
|
|
24470
24670
|
Font: 5,
|
|
24671
|
+
Swf: 6,
|
|
24471
24672
|
Misc: 7,
|
|
24472
24673
|
Unknown: 8,
|
|
24473
24674
|
Spine: 9,
|
|
@@ -24485,6 +24686,7 @@ const EDITOR_TYPE_STRING = {
|
|
|
24485
24686
|
SoundResource: "sound",
|
|
24486
24687
|
Component: "component",
|
|
24487
24688
|
FontResource: "font",
|
|
24689
|
+
SwfResource: "swf",
|
|
24488
24690
|
SpineResource: "spine",
|
|
24489
24691
|
DragonBonesResource: "dragonbones"
|
|
24490
24692
|
};
|
|
@@ -24633,7 +24835,7 @@ var BinaryWriter = class {
|
|
|
24633
24835
|
data.writeInt32(grid[1]);
|
|
24634
24836
|
data.writeInt32(grid[2]);
|
|
24635
24837
|
data.writeInt32(grid[3]);
|
|
24636
|
-
data.writeInt32(
|
|
24838
|
+
data.writeInt32(res.getTileGridIndice());
|
|
24637
24839
|
}
|
|
24638
24840
|
data.writeBool(res.getSmoothing());
|
|
24639
24841
|
break;
|
|
@@ -24687,6 +24889,16 @@ var BinaryWriter = class {
|
|
|
24687
24889
|
data.writeInt32(0);
|
|
24688
24890
|
data.writeInt32(0);
|
|
24689
24891
|
break;
|
|
24892
|
+
case "SwfResource":
|
|
24893
|
+
data.writeUint8(BinItemType.Swf);
|
|
24894
|
+
data.writeS(getPublishedItemId$1(res));
|
|
24895
|
+
data.writeS(res.getName());
|
|
24896
|
+
data.writeS(res.getPath());
|
|
24897
|
+
data.writeS(getPublishedFileName(res));
|
|
24898
|
+
data.writeBool(res.getExported());
|
|
24899
|
+
data.writeInt32(0);
|
|
24900
|
+
data.writeInt32(0);
|
|
24901
|
+
break;
|
|
24690
24902
|
case "Component": {
|
|
24691
24903
|
data.writeUint8(BinItemType.Component);
|
|
24692
24904
|
data.writeS(getPublishedItemId$1(res));
|
|
@@ -24830,13 +25042,15 @@ var BinaryWriter = class {
|
|
|
24830
25042
|
const oh = sp.originalHeight ?? 0;
|
|
24831
25043
|
const isPackageItemSprite = packageItemIds.has(sp.itemId);
|
|
24832
25044
|
const isZeroSizedDirectOutput = isPackageItemSprite && sp.w === 0 && sp.h === 0;
|
|
24833
|
-
const
|
|
25045
|
+
const originalWidth = ow || (sp.rotated ? sp.h : sp.w);
|
|
25046
|
+
const originalHeight = oh || (sp.rotated ? sp.w : sp.h);
|
|
25047
|
+
const hasOriginal = isPackageItemSprite && sp.rotated || ox !== 0 || oy !== 0 || originalWidth !== (sp.rotated ? sp.h : sp.w) || originalHeight !== (sp.rotated ? sp.w : sp.h) || isZeroSizedDirectOutput;
|
|
24834
25048
|
data.writeBool(hasOriginal);
|
|
24835
25049
|
if (hasOriginal) {
|
|
24836
25050
|
data.writeInt32(ox);
|
|
24837
25051
|
data.writeInt32(oy);
|
|
24838
|
-
data.writeInt32(
|
|
24839
|
-
data.writeInt32(
|
|
25052
|
+
data.writeInt32(originalWidth);
|
|
25053
|
+
data.writeInt32(originalHeight);
|
|
24840
25054
|
}
|
|
24841
25055
|
}
|
|
24842
25056
|
const spriteNextPos = data.pos;
|
|
@@ -25179,9 +25393,9 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
25179
25393
|
const sourcePackageId = child.getPackageId?.()?.trim();
|
|
25180
25394
|
if (sourcePackageId && sourcePackageId !== ownerPackageId) target.packageIds.add(sourcePackageId);
|
|
25181
25395
|
addFontReferences(target, ownerPackageId, child.getFont?.());
|
|
25182
|
-
addTextReferences(target, ownerPackageId, child.getText?.());
|
|
25396
|
+
if (!child.getAutoClearText?.()) addTextReferences(target, ownerPackageId, child.getText?.());
|
|
25183
25397
|
for (const reference of [
|
|
25184
|
-
child.getUrl?.(),
|
|
25398
|
+
child.getClearOnPublish?.() ? void 0 : child.getUrl?.(),
|
|
25185
25399
|
child.getDefaultItem?.(),
|
|
25186
25400
|
child.getIcon?.(),
|
|
25187
25401
|
child.getSelectedIcon?.(),
|
|
@@ -25195,11 +25409,14 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
25195
25409
|
child.getHeaderRes?.(),
|
|
25196
25410
|
child.getFooterRes?.()
|
|
25197
25411
|
]) addUiReference(target, ownerPackageId, reference);
|
|
25198
|
-
for (const item of child.getInstanceComboItems?.() ?? []) addUiReference(target, ownerPackageId, item.icon);
|
|
25199
|
-
for (const item of child.getListItems?.() ?? []) {
|
|
25412
|
+
for (const item of child.getInstanceAutoClearItems?.() ? [] : child.getInstanceComboItems?.() ?? []) addUiReference(target, ownerPackageId, item.icon);
|
|
25413
|
+
for (const item of child.getAutoClearItems?.() ? [] : child.getListItems?.() ?? []) {
|
|
25200
25414
|
addUiReference(target, ownerPackageId, item.icon);
|
|
25415
|
+
addUiReference(target, ownerPackageId, item.selectedIcon);
|
|
25201
25416
|
addUiReference(target, ownerPackageId, item.url);
|
|
25417
|
+
addUnknownReferences(target, ownerPackageId, item.propertyOverrides?.map((property) => property.value));
|
|
25202
25418
|
}
|
|
25419
|
+
addUnknownReferences(target, ownerPackageId, child.getPropertyOverrides?.().map((property) => property.value));
|
|
25203
25420
|
for (const gear of child.listGears?.() ?? []) {
|
|
25204
25421
|
addUnknownReferences(target, ownerPackageId, gear.getValues?.());
|
|
25205
25422
|
addUnknownReferences(target, ownerPackageId, gear.getDefaultValue?.());
|
|
@@ -25229,7 +25446,8 @@ function collectPackageResourceReferences(pkg) {
|
|
|
25229
25446
|
localResourceIds: /* @__PURE__ */ new Set(),
|
|
25230
25447
|
packageIds: /* @__PURE__ */ new Set()
|
|
25231
25448
|
};
|
|
25232
|
-
|
|
25449
|
+
const excludedResourceIds = new Set(pkg.getSourceAtlasSettings().excludedResourceIds);
|
|
25450
|
+
for (const resource of pkg.listResources()) if (resource.propertyType === "Component" && !excludedResourceIds.has(resource.getId())) collectComponentReferences(references, pkg.getId(), resource);
|
|
25233
25451
|
return references;
|
|
25234
25452
|
}
|
|
25235
25453
|
//#endregion
|
|
@@ -25256,6 +25474,9 @@ function isFontResource(resource) {
|
|
|
25256
25474
|
function isSoundResource(resource) {
|
|
25257
25475
|
return resource.propertyType === "SoundResource";
|
|
25258
25476
|
}
|
|
25477
|
+
function isSwfResource(resource) {
|
|
25478
|
+
return resource.propertyType === "SwfResource";
|
|
25479
|
+
}
|
|
25259
25480
|
function isSpineResource(resource) {
|
|
25260
25481
|
return resource.propertyType === "SpineResource";
|
|
25261
25482
|
}
|
|
@@ -25297,10 +25518,12 @@ function extname(fileName) {
|
|
|
25297
25518
|
return normalized.slice(lastDot);
|
|
25298
25519
|
}
|
|
25299
25520
|
function resolvePublishedMiscFileName(resource, projectType) {
|
|
25300
|
-
const
|
|
25301
|
-
if (projectType
|
|
25302
|
-
|
|
25303
|
-
|
|
25521
|
+
const fileName = `${getPublishedId(resource)}${extname(resource.getFile())}`;
|
|
25522
|
+
if (projectType === UNITY_PROJECT_TYPE$1 && fileName.toLowerCase().endsWith(".atlas")) return `${fileName}.txt`;
|
|
25523
|
+
return fileName;
|
|
25524
|
+
}
|
|
25525
|
+
function resolvePublishedSwfFileName(resource) {
|
|
25526
|
+
return `${getPublishedId(resource)}${extname(resource.getFile()) || ".swf"}`;
|
|
25304
25527
|
}
|
|
25305
25528
|
function resolvePublishedSkeletonFileName(resource, projectType) {
|
|
25306
25529
|
if (projectType === UNITY_PROJECT_TYPE$1 && isSpineResource(resource) && resource.getFile().toLowerCase().endsWith(".skel")) return `${resource.getFile()}.bytes`;
|
|
@@ -25367,16 +25590,16 @@ function trimTrailingMissingHighResolutionIds(ids) {
|
|
|
25367
25590
|
while (ids.length > 0 && !ids[ids.length - 1]) ids.pop();
|
|
25368
25591
|
return ids;
|
|
25369
25592
|
}
|
|
25370
|
-
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution) {
|
|
25593
|
+
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution, excludedResourceIds) {
|
|
25371
25594
|
const result = /* @__PURE__ */ new Map();
|
|
25372
25595
|
if (includeHighResolution <= 0) return result;
|
|
25373
25596
|
const highResolutionResourceByKey = /* @__PURE__ */ new Map();
|
|
25374
25597
|
for (const resource of resources) {
|
|
25375
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
25598
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
25376
25599
|
highResolutionResourceByKey.set(buildHighResolutionResourceKey(resource), resource);
|
|
25377
25600
|
}
|
|
25378
25601
|
for (const resource of resources) {
|
|
25379
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
25602
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
25380
25603
|
if (!publishedResourceIds.has(resource.getId())) continue;
|
|
25381
25604
|
if (isHighResolutionVariantName(resource.getName())) continue;
|
|
25382
25605
|
const ids = [];
|
|
@@ -25401,6 +25624,7 @@ function collectHighResolutionItemIds(resources, publishedResourceIds, includeHi
|
|
|
25401
25624
|
}
|
|
25402
25625
|
function collectPackagePublishContext(pkg, options) {
|
|
25403
25626
|
const resources = pkg.listResources();
|
|
25627
|
+
const excludedResourceIds = new Set(pkg.getSourceAtlasSettings().excludedResourceIds);
|
|
25404
25628
|
const resourceMap = new Map(resources.map((resource) => [resource.getId(), resource]));
|
|
25405
25629
|
const referencedIds = collectPackageResourceReferences(pkg).localResourceIds;
|
|
25406
25630
|
const pixelHitTestImageIds = /* @__PURE__ */ new Set();
|
|
@@ -25412,10 +25636,15 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25412
25636
|
while (changed) {
|
|
25413
25637
|
changed = false;
|
|
25414
25638
|
for (const resourceId of [...exportedResourceIds]) {
|
|
25639
|
+
if (excludedResourceIds.has(resourceId)) {
|
|
25640
|
+
exportedResourceIds.delete(resourceId);
|
|
25641
|
+
changed = true;
|
|
25642
|
+
continue;
|
|
25643
|
+
}
|
|
25415
25644
|
const resource = resourcesById.get(resourceId);
|
|
25416
25645
|
if (!resource || !isSkeletonResource(resource)) continue;
|
|
25417
25646
|
for (const requiredId of resource.getRequireIds()) {
|
|
25418
|
-
if (!requiredId || exportedResourceIds.has(requiredId)) continue;
|
|
25647
|
+
if (!requiredId || excludedResourceIds.has(requiredId) || exportedResourceIds.has(requiredId)) continue;
|
|
25419
25648
|
exportedResourceIds.add(requiredId);
|
|
25420
25649
|
changed = true;
|
|
25421
25650
|
}
|
|
@@ -25423,7 +25652,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25423
25652
|
}
|
|
25424
25653
|
return exportedResourceIds;
|
|
25425
25654
|
};
|
|
25426
|
-
for (const atlas of pkg.listAtlases()) for (const sprite of atlas.listSprites()) spriteItemIds.add(sprite.getItemId());
|
|
25655
|
+
for (const atlas of pkg.listAtlases()) for (const sprite of atlas.listSprites()) if (!excludedResourceIds.has(sprite.getItemId())) spriteItemIds.add(sprite.getItemId());
|
|
25427
25656
|
for (const resource of resources) {
|
|
25428
25657
|
if (!isComponentResource(resource)) continue;
|
|
25429
25658
|
const component = resource;
|
|
@@ -25432,7 +25661,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25432
25661
|
const hitTest = component.getHitTest?.()?.trim();
|
|
25433
25662
|
if (hitTest && !hitTest.includes(",")) {
|
|
25434
25663
|
const sourceId = childMap.get(hitTest)?.getSrc?.();
|
|
25435
|
-
if (sourceId) {
|
|
25664
|
+
if (sourceId && !excludedResourceIds.has(sourceId)) {
|
|
25436
25665
|
const sourceResource = resourceMap.get(sourceId);
|
|
25437
25666
|
if (sourceResource && isImageResource(sourceResource)) pixelHitTestImageIds.add(sourceId);
|
|
25438
25667
|
}
|
|
@@ -25441,7 +25670,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25441
25670
|
const publishedResourceIds = new Set(spriteItemIds);
|
|
25442
25671
|
for (const resource of resources) {
|
|
25443
25672
|
const resourceId = resource.getId();
|
|
25444
|
-
if (!resourceId) continue;
|
|
25673
|
+
if (!resourceId || excludedResourceIds.has(resourceId)) continue;
|
|
25445
25674
|
if (isComponentResource(resource)) {
|
|
25446
25675
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
25447
25676
|
continue;
|
|
@@ -25465,7 +25694,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25465
25694
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
25466
25695
|
}
|
|
25467
25696
|
for (const resourceId of collectExportedResourceIds(resources, publishedResourceIds)) publishedResourceIds.add(resourceId);
|
|
25468
|
-
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution);
|
|
25697
|
+
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution, excludedResourceIds);
|
|
25469
25698
|
if (!options.includeBranches) {
|
|
25470
25699
|
const mainByKey = /* @__PURE__ */ new Map();
|
|
25471
25700
|
const activeBranchByKey = /* @__PURE__ */ new Map();
|
|
@@ -25593,6 +25822,10 @@ async function annotatePackagePublishArtifacts(pkg, basePath, encoder, options)
|
|
|
25593
25822
|
setPublishedFileExtra(resource, resolvePublishedMiscFileName(resource, options.projectType));
|
|
25594
25823
|
continue;
|
|
25595
25824
|
}
|
|
25825
|
+
if (isSwfResource(resource)) {
|
|
25826
|
+
setPublishedFileExtra(resource, resolvePublishedSwfFileName(resource));
|
|
25827
|
+
continue;
|
|
25828
|
+
}
|
|
25596
25829
|
if (isSkeletonResource(resource)) setPublishedFileExtra(resource, resolvePublishedSkeletonFileName(resource, options.projectType));
|
|
25597
25830
|
}
|
|
25598
25831
|
}
|
|
@@ -26851,7 +27084,7 @@ function packAtlasPages(inputs, options, forceSinglePage, sizeOverrides) {
|
|
|
26851
27084
|
});
|
|
26852
27085
|
return new MaxRectsPackerCompat({
|
|
26853
27086
|
pot: sizeOverrides?.powerOfTwo ?? options.powerOfTwo,
|
|
26854
|
-
mof: sizeOverrides?.multipleOfFour ??
|
|
27087
|
+
mof: sizeOverrides?.multipleOfFour ?? options.multipleOfFour,
|
|
26855
27088
|
padding: options.padding,
|
|
26856
27089
|
rotation: options.allowRotation,
|
|
26857
27090
|
minWidth: 16,
|
|
@@ -26951,7 +27184,7 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
26951
27184
|
}
|
|
26952
27185
|
}
|
|
26953
27186
|
const outputFile = `${options.outputPath}/${atlasFileName}`;
|
|
26954
|
-
|
|
27187
|
+
const atlasPipeline = encoder({ create: {
|
|
26955
27188
|
width: page.width,
|
|
26956
27189
|
height: page.height,
|
|
26957
27190
|
channels: 4,
|
|
@@ -26961,7 +27194,13 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
26961
27194
|
b: 0,
|
|
26962
27195
|
alpha: 0
|
|
26963
27196
|
}
|
|
26964
|
-
} }).composite(compositeInputs)
|
|
27197
|
+
} }).composite(compositeInputs);
|
|
27198
|
+
if (options.extractAlpha) {
|
|
27199
|
+
const atlasBuffer = await atlasPipeline.png().toBuffer();
|
|
27200
|
+
await encoder(atlasBuffer).removeAlpha().png().toFile(outputFile);
|
|
27201
|
+
const alphaBuffer = await encoder(atlasBuffer).extractChannel("alpha").png().toBuffer();
|
|
27202
|
+
await encoder(alphaBuffer).joinChannel([alphaBuffer, alphaBuffer]).png().toFile(`${options.outputPath}/${insertFileNameSuffix(atlasFileName, "!a")}`);
|
|
27203
|
+
} else await atlasPipeline.toFile(outputFile);
|
|
26965
27204
|
logger.info(`atlas: Generated ${atlasFileName} (${page.width}x${page.height}, ${page.outputRects.length} sprites)`);
|
|
26966
27205
|
}
|
|
26967
27206
|
function inputToCompatRect(input, index) {
|
|
@@ -27011,6 +27250,9 @@ function resolveDirectOutputAtlasSize(width, height, options) {
|
|
|
27011
27250
|
if (options.powerOfTwo) {
|
|
27012
27251
|
resolvedWidth = nextPow2(resolvedWidth);
|
|
27013
27252
|
resolvedHeight = nextPow2(resolvedHeight);
|
|
27253
|
+
} else if (options.multipleOfFour) {
|
|
27254
|
+
resolvedWidth = roundUpToMultiple(resolvedWidth, 4);
|
|
27255
|
+
resolvedHeight = roundUpToMultiple(resolvedHeight, 4);
|
|
27014
27256
|
}
|
|
27015
27257
|
return {
|
|
27016
27258
|
width: resolvedWidth,
|
|
@@ -27125,9 +27367,8 @@ function sortResourcesByOrder(resources, orderMap, inputOrderMap) {
|
|
|
27125
27367
|
});
|
|
27126
27368
|
return ordered;
|
|
27127
27369
|
}
|
|
27128
|
-
function getResourceTextureSetMode(resource) {
|
|
27129
|
-
|
|
27130
|
-
return parseTextureSetMode(resource.getTextureSetMode?.());
|
|
27370
|
+
function getResourceTextureSetMode(resource, maxAtlasIndex) {
|
|
27371
|
+
return parseTextureSetMode(resource.getTextureSetMode?.(), maxAtlasIndex);
|
|
27131
27372
|
}
|
|
27132
27373
|
function groupStandaloneInputs(doc, inputs, options) {
|
|
27133
27374
|
const autoInputs = [];
|
|
@@ -27146,7 +27387,7 @@ function groupStandaloneInputs(doc, inputs, options) {
|
|
|
27146
27387
|
for (const input of inputs) {
|
|
27147
27388
|
const branchName = getInputBranchName(input);
|
|
27148
27389
|
const branchOrdinal = branchOrdinalByName.get(branchName) ?? 0;
|
|
27149
|
-
const mode = getResourceTextureSetMode(input.resource);
|
|
27390
|
+
const mode = getResourceTextureSetMode(input.resource, options.maxAtlasIndex ?? 10);
|
|
27150
27391
|
if (mode.kind === "standalone") {
|
|
27151
27392
|
const key = `${branchName}\u0000${getPublishedItemId(input.resource)}`;
|
|
27152
27393
|
const existing = standaloneGroups.get(key);
|
|
@@ -27190,6 +27431,8 @@ const ATLAS_DEFAULTS = {
|
|
|
27190
27431
|
allowRotation: true,
|
|
27191
27432
|
padding: 1,
|
|
27192
27433
|
powerOfTwo: false,
|
|
27434
|
+
maxAtlasIndex: 10,
|
|
27435
|
+
multipleOfFour: false,
|
|
27193
27436
|
square: false,
|
|
27194
27437
|
multiPage: true,
|
|
27195
27438
|
trimImage: false,
|
|
@@ -27273,7 +27516,7 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
27273
27516
|
const refChild = child;
|
|
27274
27517
|
await addResource(resourceMap.get(refChild.getSrc?.() ?? ""));
|
|
27275
27518
|
for (const ref of [
|
|
27276
|
-
refChild.getUrl?.(),
|
|
27519
|
+
refChild.getClearOnPublish?.() ? void 0 : refChild.getUrl?.(),
|
|
27277
27520
|
refChild.getDefaultItem?.(),
|
|
27278
27521
|
refChild.getIcon?.(),
|
|
27279
27522
|
refChild.getSelectedIcon?.(),
|
|
@@ -27287,11 +27530,14 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
27287
27530
|
refChild.getInstanceIcon?.(),
|
|
27288
27531
|
refChild.getInstanceSelectedIcon?.()
|
|
27289
27532
|
]) await addResourceByLocalUiUrl(ref);
|
|
27290
|
-
for (const item of refChild.getInstanceComboItems?.() ?? []) await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
27291
|
-
for (const item of refChild.getListItems?.() ?? []) {
|
|
27533
|
+
for (const item of refChild.getInstanceAutoClearItems?.() ? [] : refChild.getInstanceComboItems?.() ?? []) await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
27534
|
+
for (const item of refChild.getAutoClearItems?.() ? [] : refChild.getListItems?.() ?? []) {
|
|
27292
27535
|
await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
27536
|
+
await addResourceByLocalUiUrl(item.selectedIcon ?? void 0);
|
|
27293
27537
|
await addResourceByLocalUiUrl(item.url ?? void 0);
|
|
27538
|
+
for (const property of item.propertyOverrides ?? []) await addResourceByLocalUiUrl(property.value);
|
|
27294
27539
|
}
|
|
27540
|
+
for (const property of refChild.getPropertyOverrides?.() ?? []) await addResourceByLocalUiUrl(property.value);
|
|
27295
27541
|
for (const gear of refChild.listGears?.() ?? []) await addGearIconResources(gear);
|
|
27296
27542
|
}
|
|
27297
27543
|
for (const ref of [
|
|
@@ -27542,23 +27788,32 @@ const FGUI_TYPESCRIPT_RUNTIME_TYPES = new Set([
|
|
|
27542
27788
|
"GTree",
|
|
27543
27789
|
"Transition"
|
|
27544
27790
|
]);
|
|
27545
|
-
const
|
|
27791
|
+
const LAYABOX_TYPESCRIPT_VARIANT = {
|
|
27546
27792
|
binderMethod: "setExtension",
|
|
27547
|
-
runtimeNamespace: "fgui"
|
|
27793
|
+
runtimeNamespace: "fgui",
|
|
27794
|
+
runtimeImport: ""
|
|
27795
|
+
};
|
|
27796
|
+
const COCOS_CREATOR_TYPESCRIPT_VARIANT = {
|
|
27797
|
+
...LAYABOX_TYPESCRIPT_VARIANT,
|
|
27798
|
+
runtimeImport: "import * as fgui from \"fairygui-cc\";"
|
|
27548
27799
|
};
|
|
27549
27800
|
async function publishCodeGeneration(doc, options) {
|
|
27550
27801
|
const logger = doc.getLogger();
|
|
27551
27802
|
const settings = resolveCodeGenerationSettings(doc);
|
|
27552
27803
|
if (!settings.allowGenCode) return;
|
|
27553
|
-
const plugins = options.plugins
|
|
27804
|
+
const plugins = options.plugins ?? [];
|
|
27554
27805
|
if (plugins.length > 0) {
|
|
27555
27806
|
let handled = false;
|
|
27556
|
-
for (const plugin of plugins)
|
|
27557
|
-
|
|
27558
|
-
|
|
27559
|
-
|
|
27560
|
-
|
|
27561
|
-
|
|
27807
|
+
for (const plugin of plugins) {
|
|
27808
|
+
const genCode = plugin.plugin.genCode;
|
|
27809
|
+
if (!genCode) continue;
|
|
27810
|
+
try {
|
|
27811
|
+
await genCode(doc, settings, options);
|
|
27812
|
+
handled = true;
|
|
27813
|
+
logger.info(`publish: Generated code using plugin "${plugin.name}"`);
|
|
27814
|
+
} catch (error) {
|
|
27815
|
+
logger.warn(`publish: Code generation plugin "${plugin.name}" failed: ${formatPluginError(error)}`);
|
|
27816
|
+
}
|
|
27562
27817
|
}
|
|
27563
27818
|
if (handled) return;
|
|
27564
27819
|
}
|
|
@@ -27622,8 +27877,9 @@ function supportsCodeGenerationLane(doc, codeType) {
|
|
|
27622
27877
|
}
|
|
27623
27878
|
function resolveFguiTypescriptVariant(doc) {
|
|
27624
27879
|
const projectType = doc.getRoot().getProjectType();
|
|
27625
|
-
if (projectType
|
|
27626
|
-
return
|
|
27880
|
+
if (projectType === ProjectType.LayaBox) return LAYABOX_TYPESCRIPT_VARIANT;
|
|
27881
|
+
if (projectType === ProjectType.CocosCreator) return COCOS_CREATOR_TYPESCRIPT_VARIANT;
|
|
27882
|
+
return null;
|
|
27627
27883
|
}
|
|
27628
27884
|
async function generateUnityCode(doc, pkg, plan, fs) {
|
|
27629
27885
|
const packageDir = fs.join(plan.outputDir, plan.packageFolderName);
|
|
@@ -27806,7 +28062,8 @@ function renderFguiTypescriptComponentClass(classInfo, plan, variant) {
|
|
|
27806
28062
|
}
|
|
27807
28063
|
function renderFguiTypescriptBinder(classes, plan, variant) {
|
|
27808
28064
|
const bindLines = classes.map((classInfo) => `\t\t${variant.runtimeNamespace}.UIObjectFactory.${variant.binderMethod}(${classInfo.encodedClassName}.URL, ${classInfo.encodedClassName});`).join("\n");
|
|
27809
|
-
const
|
|
28065
|
+
const classImports = classes.map((classInfo) => `import ${classInfo.encodedClassName} from "./${classInfo.encodedClassName}";`).join("\n");
|
|
28066
|
+
const importLines = [variant.runtimeImport, classImports].filter(Boolean).join("\n");
|
|
27810
28067
|
return renderTemplate(FGUI_TYPESCRIPT_BINDER_TEMPLATE, {
|
|
27811
28068
|
binderClassName: plan.binderClassName,
|
|
27812
28069
|
bindLines: bindLines ? `${bindLines}\n` : "",
|
|
@@ -27870,6 +28127,7 @@ function normalizeTypeName(value) {
|
|
|
27870
28127
|
}
|
|
27871
28128
|
function collectFguiTypescriptImports(classInfo, variant) {
|
|
27872
28129
|
const imports = /* @__PURE__ */ new Set();
|
|
28130
|
+
if (variant.runtimeImport) imports.add(variant.runtimeImport);
|
|
27873
28131
|
for (const member of classInfo.members) {
|
|
27874
28132
|
if (member.ignored) continue;
|
|
27875
28133
|
const translated = translateFguiTypescriptType(member.type, variant);
|
|
@@ -28843,23 +29101,24 @@ async function exportPackageExternalResources(pkg, outputDir, basePath, fs, read
|
|
|
28843
29101
|
if (exportedResourceIds.size === 0) return;
|
|
28844
29102
|
if (!basePath || !readFileRaw) {
|
|
28845
29103
|
if (pkg.listResources().some((resource) => {
|
|
28846
|
-
return (isMiscResource(resource) || isSkeletonResource(resource)) && exportedResourceIds.has(resource.getId()) || skeletonDependencyImageIds.has(resource.getId());
|
|
29104
|
+
return (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource)) && exportedResourceIds.has(resource.getId()) || skeletonDependencyImageIds.has(resource.getId());
|
|
28847
29105
|
})) throw new Error(`publish: External resources in package "${pkg.getName()}" require basePath and readFileRaw for output.`);
|
|
28848
29106
|
return;
|
|
28849
29107
|
}
|
|
28850
29108
|
for (const resource of pkg.listResources()) {
|
|
28851
29109
|
const resourceId = resource.getId();
|
|
28852
|
-
const
|
|
29110
|
+
const isExternal = exportedResourceIds.has(resourceId) && (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource));
|
|
28853
29111
|
const isSkeletonImageDependency = skeletonDependencyImageIds.has(resourceId) && isImageResource(resource);
|
|
28854
|
-
if (!
|
|
29112
|
+
if (!isExternal && !isSkeletonImageDependency) continue;
|
|
28855
29113
|
let sourcePath;
|
|
28856
29114
|
let targetName;
|
|
28857
29115
|
if (isSkeletonImageDependency) {
|
|
28858
29116
|
sourcePath = resolveImagePath(resource, pkg, basePath);
|
|
28859
29117
|
targetName = resolveImageFileName(resource);
|
|
28860
|
-
} else if (isMiscResource(resource) || isSkeletonResource(resource)) {
|
|
29118
|
+
} else if (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource)) {
|
|
28861
29119
|
sourcePath = resolveGenericResourcePath(resource, pkg, basePath);
|
|
28862
|
-
|
|
29120
|
+
const publishedFile = (resource.getExtras() ?? {})._publishedFile ?? resource.getFile();
|
|
29121
|
+
targetName = isMiscResource(resource) || isSwfResource(resource) ? `${pkg.getPublishName() || pkg.getName()}_${publishedFile}` : publishedFile;
|
|
28863
29122
|
} else continue;
|
|
28864
29123
|
const targetPath = fs.join(outputDir, targetName);
|
|
28865
29124
|
try {
|
|
@@ -28902,14 +29161,17 @@ function resolvePublishOptions(doc, overrides = {}) {
|
|
|
28902
29161
|
const projectType = overrides.targetProjectType ?? root.getProjectType();
|
|
28903
29162
|
const explicitLayaboxTarget = overrides.targetProjectType === ProjectType.LayaBox;
|
|
28904
29163
|
const fileExtension = overrides.fileExtension ?? (explicitLayaboxTarget ? "fui" : resolveDefaultPublishFileExtension(projectType, publishSettings));
|
|
28905
|
-
|
|
28906
|
-
if (
|
|
29164
|
+
const runtimeRejectsCompression = projectType === UNITY_PROJECT_TYPE || projectType === COCOS_CREATOR_PROJECT_TYPE;
|
|
29165
|
+
if (runtimeRejectsCompression && overrides.compressed === true) throw new Error("publish: The selected target runtime does not support compressed package data.");
|
|
29166
|
+
const compressed = runtimeRejectsCompression ? false : overrides.compressed ?? publishSettings.compressDesc ?? false;
|
|
28907
29167
|
const atlasOptions = {
|
|
28908
29168
|
maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
|
|
28909
29169
|
fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
|
|
28910
29170
|
allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
|
|
28911
29171
|
padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
|
|
28912
29172
|
powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
|
|
29173
|
+
maxAtlasIndex: overrides.atlas?.maxAtlasIndex ?? 10,
|
|
29174
|
+
multipleOfFour: overrides.atlas?.multipleOfFour ?? atlasSetting.sizeOption === "mof",
|
|
28913
29175
|
square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
|
|
28914
29176
|
multiPage: overrides.atlas?.multiPage ?? atlasSetting.paging ?? true,
|
|
28915
29177
|
trimImage: overrides.atlas?.trimImage ?? atlasSetting.trimImage ?? false,
|
|
@@ -29029,6 +29291,19 @@ function publish(options) {
|
|
|
29029
29291
|
}
|
|
29030
29292
|
}
|
|
29031
29293
|
const publishName = pkg.getPublishName() || pkg.getName();
|
|
29294
|
+
const sourceAtlas = pkg.getSourceAtlasSettings();
|
|
29295
|
+
const usePackageAtlas = !sourceAtlas.useGlobal;
|
|
29296
|
+
const atlas = {
|
|
29297
|
+
...config.atlas,
|
|
29298
|
+
maxSize: options.atlas?.maxSize ?? (usePackageAtlas ? sourceAtlas.maxSize : config.atlas.maxSize),
|
|
29299
|
+
allowRotation: config.projectType === ProjectType.LayaBox ? false : options.atlas?.allowRotation ?? (usePackageAtlas ? sourceAtlas.allowRotation : config.atlas.allowRotation),
|
|
29300
|
+
powerOfTwo: options.atlas?.powerOfTwo ?? (usePackageAtlas ? sourceAtlas.sizeOption === "pot" : config.atlas.powerOfTwo),
|
|
29301
|
+
maxAtlasIndex: options.atlas?.maxAtlasIndex ?? sourceAtlas.maxIndex,
|
|
29302
|
+
multipleOfFour: options.atlas?.multipleOfFour ?? (usePackageAtlas ? sourceAtlas.sizeOption === "mof" : config.atlas.multipleOfFour),
|
|
29303
|
+
square: options.atlas?.square ?? (usePackageAtlas ? sourceAtlas.forceSquare : config.atlas.square),
|
|
29304
|
+
multiPage: options.atlas?.multiPage ?? (usePackageAtlas ? sourceAtlas.paging : config.atlas.multiPage),
|
|
29305
|
+
extractAlpha: config.projectType === ProjectType.Unity && (options.atlas?.extractAlpha ?? (usePackageAtlas || sourceAtlas.extractAlpha ? sourceAtlas.extractAlpha : config.atlas.extractAlpha))
|
|
29306
|
+
};
|
|
29032
29307
|
return {
|
|
29033
29308
|
pkg,
|
|
29034
29309
|
outputDir,
|
|
@@ -29040,7 +29315,7 @@ function publish(options) {
|
|
|
29040
29315
|
activeBranch: config.activeBranch,
|
|
29041
29316
|
includeHighResolution: config.includeHighResolution,
|
|
29042
29317
|
separatedAtlasForBranch: config.separatedAtlasForBranch,
|
|
29043
|
-
atlas
|
|
29318
|
+
atlas
|
|
29044
29319
|
};
|
|
29045
29320
|
};
|
|
29046
29321
|
const createNoopPublishFs = () => ({
|
|
@@ -29060,7 +29335,6 @@ function publish(options) {
|
|
|
29060
29335
|
const atlasRuntimeOptions = resolvePublishAtlasRuntimeOptions(plan.fileExtension);
|
|
29061
29336
|
await atlas({
|
|
29062
29337
|
...plan.atlas,
|
|
29063
|
-
...options.atlas ?? {},
|
|
29064
29338
|
separatedAtlasForBranch: plan.separatedAtlasForBranch,
|
|
29065
29339
|
encoder: options.encoder,
|
|
29066
29340
|
basePath: options.basePath,
|
|
@@ -29626,7 +29900,7 @@ function registerRestoreCommand(program) {
|
|
|
29626
29900
|
//#region src/utils/package-version.ts
|
|
29627
29901
|
const require$1 = createRequire(import.meta.url);
|
|
29628
29902
|
function getInjectedPackageVersion() {
|
|
29629
|
-
const version = "0.2.
|
|
29903
|
+
const version = "0.2.6";
|
|
29630
29904
|
return typeof version === "string" && true ? version : null;
|
|
29631
29905
|
}
|
|
29632
29906
|
function readPackageVersion() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfairygui/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "FairyGUI Headless Authoring SDK — command-line interface.",
|
|
5
5
|
"author": "OpenFairyGUI Contributors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"restore"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@openfairygui/
|
|
37
|
-
"@openfairygui/
|
|
36
|
+
"@openfairygui/core": "0.2.6",
|
|
37
|
+
"@openfairygui/functions": "0.2.6"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"commander": "^14.0.2",
|
|
41
41
|
"jiti": "^2.7.0",
|
|
42
|
-
"@openfairygui/backend": "0.2.
|
|
42
|
+
"@openfairygui/backend": "0.2.6"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
45
|
"sharp": ">=0.33.0"
|