@openfairygui/cli 0.2.4 → 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 +453 -103
- 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: "",
|
|
@@ -6526,6 +6620,10 @@ var Controller = class extends ExtensibleProperty {
|
|
|
6526
6620
|
return Object.assign(super.getDefaults(), {
|
|
6527
6621
|
selectedIndex: 0,
|
|
6528
6622
|
autoRadioGroupDepth: false,
|
|
6623
|
+
alias: "",
|
|
6624
|
+
exported: false,
|
|
6625
|
+
homePageType: "default",
|
|
6626
|
+
homePage: "",
|
|
6529
6627
|
pages: new RefList(),
|
|
6530
6628
|
actions: new RefList()
|
|
6531
6629
|
});
|
|
@@ -6542,6 +6640,30 @@ var Controller = class extends ExtensibleProperty {
|
|
|
6542
6640
|
setAutoRadioGroupDepth(v) {
|
|
6543
6641
|
return this.set("autoRadioGroupDepth", v);
|
|
6544
6642
|
}
|
|
6643
|
+
getAlias() {
|
|
6644
|
+
return this.get("alias");
|
|
6645
|
+
}
|
|
6646
|
+
setAlias(v) {
|
|
6647
|
+
return this.set("alias", v);
|
|
6648
|
+
}
|
|
6649
|
+
getExported() {
|
|
6650
|
+
return this.get("exported");
|
|
6651
|
+
}
|
|
6652
|
+
setExported(v) {
|
|
6653
|
+
return this.set("exported", v);
|
|
6654
|
+
}
|
|
6655
|
+
getHomePageType() {
|
|
6656
|
+
return this.get("homePageType");
|
|
6657
|
+
}
|
|
6658
|
+
setHomePageType(v) {
|
|
6659
|
+
return this.set("homePageType", v);
|
|
6660
|
+
}
|
|
6661
|
+
getHomePage() {
|
|
6662
|
+
return this.get("homePage");
|
|
6663
|
+
}
|
|
6664
|
+
setHomePage(v) {
|
|
6665
|
+
return this.set("homePage", v);
|
|
6666
|
+
}
|
|
6545
6667
|
addPage(page) {
|
|
6546
6668
|
return this.addRef("pages", page);
|
|
6547
6669
|
}
|
|
@@ -6575,7 +6697,10 @@ var ControllerPage = class extends Property {
|
|
|
6575
6697
|
this.propertyType = PropertyType.CONTROLLER_PAGE;
|
|
6576
6698
|
}
|
|
6577
6699
|
getDefaults() {
|
|
6578
|
-
return Object.assign(super.getDefaults(), {
|
|
6700
|
+
return Object.assign(super.getDefaults(), {
|
|
6701
|
+
id: "",
|
|
6702
|
+
remark: ""
|
|
6703
|
+
});
|
|
6579
6704
|
}
|
|
6580
6705
|
getId() {
|
|
6581
6706
|
return this.get("id");
|
|
@@ -6583,6 +6708,12 @@ var ControllerPage = class extends Property {
|
|
|
6583
6708
|
setId(id) {
|
|
6584
6709
|
return this.set("id", id);
|
|
6585
6710
|
}
|
|
6711
|
+
getRemark() {
|
|
6712
|
+
return this.get("remark");
|
|
6713
|
+
}
|
|
6714
|
+
setRemark(remark) {
|
|
6715
|
+
return this.set("remark", remark);
|
|
6716
|
+
}
|
|
6586
6717
|
};
|
|
6587
6718
|
//#endregion
|
|
6588
6719
|
//#region ../core/src/properties/controller-action.ts
|
|
@@ -16172,6 +16303,9 @@ var Document = class Document {
|
|
|
16172
16303
|
createMovieClipResource(name = "") {
|
|
16173
16304
|
return new MovieClipResource(this._graph, name);
|
|
16174
16305
|
}
|
|
16306
|
+
createSwfResource(name = "") {
|
|
16307
|
+
return new SwfResource(this._graph, name);
|
|
16308
|
+
}
|
|
16175
16309
|
createSpineResource(name = "") {
|
|
16176
16310
|
return new SpineResource(this._graph, name);
|
|
16177
16311
|
}
|
|
@@ -16427,6 +16561,7 @@ const ROOT_COMPONENT_PANEL_ATTRS = {
|
|
|
16427
16561
|
bgColorEnabled: { canonical: "bgColorEnabled" },
|
|
16428
16562
|
idnum: { canonical: "idnum" },
|
|
16429
16563
|
initName: { canonical: "initName" },
|
|
16564
|
+
customExtention: { canonical: "customExtention" },
|
|
16430
16565
|
pageController: { canonical: "pageController" },
|
|
16431
16566
|
showSound: { canonical: "showSound" },
|
|
16432
16567
|
hideSound: { canonical: "hideSound" }
|
|
@@ -16479,6 +16614,7 @@ const LOADER_PANEL_ATTRS = {
|
|
|
16479
16614
|
shrinkOnly: { canonical: "shrinkOnly" },
|
|
16480
16615
|
autoSize: { canonical: "autoSize" },
|
|
16481
16616
|
useResize: { canonical: "useResize" },
|
|
16617
|
+
errorSign: { canonical: "errorSign" },
|
|
16482
16618
|
color: { canonical: "color" },
|
|
16483
16619
|
playing: { canonical: "playing" },
|
|
16484
16620
|
frame: { canonical: "frame" },
|
|
@@ -16687,7 +16823,12 @@ const GEAR_ATTRS = {
|
|
|
16687
16823
|
const CONTROLLER_ATTRS = {
|
|
16688
16824
|
name: { canonical: "name" },
|
|
16689
16825
|
pages: { canonical: "pages" },
|
|
16690
|
-
selected: { canonical: "selected" }
|
|
16826
|
+
selected: { canonical: "selected" },
|
|
16827
|
+
alias: { canonical: "alias" },
|
|
16828
|
+
autoRadioGroupDepth: { canonical: "autoRadioGroupDepth" },
|
|
16829
|
+
exported: { canonical: "exported" },
|
|
16830
|
+
homePageType: { canonical: "homePageType" },
|
|
16831
|
+
homePage: { canonical: "homePage" }
|
|
16691
16832
|
};
|
|
16692
16833
|
const CONTROLLER_ACTION_ATTRS = {
|
|
16693
16834
|
type: { canonical: "type" },
|
|
@@ -16701,6 +16842,10 @@ const CONTROLLER_ACTION_ATTRS = {
|
|
|
16701
16842
|
controller: { canonical: "controller" },
|
|
16702
16843
|
targetPage: { canonical: "targetPage" }
|
|
16703
16844
|
};
|
|
16845
|
+
const CONTROLLER_REMARK_ATTRS = {
|
|
16846
|
+
page: { canonical: "page" },
|
|
16847
|
+
value: { canonical: "value" }
|
|
16848
|
+
};
|
|
16704
16849
|
const TRANSITION_ATTRS = {
|
|
16705
16850
|
name: { canonical: "name" },
|
|
16706
16851
|
autoPlay: { canonical: "autoPlay" },
|
|
@@ -16710,7 +16855,7 @@ const TRANSITION_ATTRS = {
|
|
|
16710
16855
|
},
|
|
16711
16856
|
autoPlayDelay: { canonical: "autoPlayDelay" },
|
|
16712
16857
|
options: { canonical: "options" },
|
|
16713
|
-
fps: { canonical: "
|
|
16858
|
+
fps: { canonical: "frameRate" }
|
|
16714
16859
|
};
|
|
16715
16860
|
const TRANSITION_ITEM_ATTRS = {
|
|
16716
16861
|
time: { canonical: "time" },
|
|
@@ -16766,6 +16911,7 @@ const CUSTOM_PROPERTY_NODE = defineNode(CUSTOM_PROPERTY_ATTRS);
|
|
|
16766
16911
|
const PROPERTY_OVERRIDE_NODE = defineNode(PROPERTY_OVERRIDE_ATTRS);
|
|
16767
16912
|
const GEAR_NODE = defineNode(GEAR_ATTRS);
|
|
16768
16913
|
const CONTROLLER_ACTION_NODE = defineNode(CONTROLLER_ACTION_ATTRS);
|
|
16914
|
+
const CONTROLLER_REMARK_NODE = defineNode(CONTROLLER_REMARK_ATTRS);
|
|
16769
16915
|
const TRANSITION_ITEM_NODE = defineNode(TRANSITION_ITEM_ATTRS);
|
|
16770
16916
|
const LIST_ITEM_NODE = defineNode(LIST_ITEM_ATTRS, { property: PROPERTY_OVERRIDE_NODE });
|
|
16771
16917
|
const COMBOBOX_ITEM_NODE = defineNode(COMBOBOX_ITEM_ATTRS);
|
|
@@ -16790,7 +16936,10 @@ const WITH_GROUP_GEAR_CHILDREN = {
|
|
|
16790
16936
|
gearIcon: GEAR_NODE,
|
|
16791
16937
|
gearDisplay2: GEAR_NODE
|
|
16792
16938
|
};
|
|
16793
|
-
const WITH_CONTROLLER_ACTION_CHILDREN = {
|
|
16939
|
+
const WITH_CONTROLLER_ACTION_CHILDREN = {
|
|
16940
|
+
action: CONTROLLER_ACTION_NODE,
|
|
16941
|
+
remark: CONTROLLER_REMARK_NODE
|
|
16942
|
+
};
|
|
16794
16943
|
const WITH_TRANSITION_ITEM_CHILDREN = { item: TRANSITION_ITEM_NODE };
|
|
16795
16944
|
const WITH_LIST_ITEM_CHILDREN = { item: LIST_ITEM_NODE };
|
|
16796
16945
|
const COMBOBOX_EXTENSION_NODE = defineNode(mergeAttrs(COMBOBOX_EXTENSION_ATTRS), mergeChildren({ item: COMBOBOX_ITEM_NODE }));
|
|
@@ -17803,6 +17952,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
17803
17952
|
if (loaderAutoSize !== void 0) g.setAutoSize?.(parseBool(loaderAutoSize));
|
|
17804
17953
|
const useResize = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.useResize);
|
|
17805
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));
|
|
17806
17957
|
const clearOnPublish = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.clearOnPublish);
|
|
17807
17958
|
if (clearOnPublish !== void 0) g.setClearOnPublish?.(parseBool(clearOnPublish));
|
|
17808
17959
|
const loaderColor = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color);
|
|
@@ -18108,7 +18259,7 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
18108
18259
|
if (resolvedLayout === 4 && lineItemCount2 !== void 0) g.setLineCount?.(parseInt2(lineItemCount2));
|
|
18109
18260
|
}
|
|
18110
18261
|
const autoResizeItem = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem);
|
|
18111
|
-
|
|
18262
|
+
g.setAutoResizeItem?.(autoResizeItem === void 0 ? getDefaultListAutoResizeItem(g.getLayout?.() ?? 0) : parseBool(autoResizeItem));
|
|
18112
18263
|
const childrenRenderOrder = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder);
|
|
18113
18264
|
if (childrenRenderOrder) g.setChildrenRenderOrder?.({
|
|
18114
18265
|
ascent: 0,
|
|
@@ -18355,6 +18506,12 @@ const EXTENSION_TYPE_MAP = {
|
|
|
18355
18506
|
Slider: "GSlider",
|
|
18356
18507
|
ScrollBar: "GScrollBar"
|
|
18357
18508
|
};
|
|
18509
|
+
const CONTROLLER_HOME_PAGE_TYPES = new Set([
|
|
18510
|
+
"default",
|
|
18511
|
+
"specific",
|
|
18512
|
+
"branch",
|
|
18513
|
+
"variable"
|
|
18514
|
+
]);
|
|
18358
18515
|
const EXTENSION_PROTOCOL_MAP$1 = {
|
|
18359
18516
|
Button: PROJECT_XML_PROTOCOL.buttonExtension,
|
|
18360
18517
|
Label: PROJECT_XML_PROTOCOL.labelExtension,
|
|
@@ -18460,6 +18617,13 @@ function parseButtonMode(value) {
|
|
|
18460
18617
|
const parsed = Number(normalized);
|
|
18461
18618
|
return map[normalized] ?? (Number.isFinite(parsed) ? parsed : 0);
|
|
18462
18619
|
}
|
|
18620
|
+
function parseButtonDownEffect(value) {
|
|
18621
|
+
return {
|
|
18622
|
+
none: 0,
|
|
18623
|
+
dark: 1,
|
|
18624
|
+
scale: 2
|
|
18625
|
+
}[String(value ?? "").trim().toLowerCase()] ?? 0;
|
|
18626
|
+
}
|
|
18463
18627
|
function parseTitleType(value) {
|
|
18464
18628
|
if (typeof value === "number") return value;
|
|
18465
18629
|
const normalized = String(value ?? "").trim().toLowerCase();
|
|
@@ -18555,6 +18719,8 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18555
18719
|
if (initName !== void 0) comp.setInitName?.(initName);
|
|
18556
18720
|
const remark = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark);
|
|
18557
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);
|
|
18558
18724
|
const pageController = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController);
|
|
18559
18725
|
if (pageController !== void 0) comp.setPageController?.(pageController);
|
|
18560
18726
|
const showSound = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.showSound);
|
|
@@ -18631,7 +18797,7 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18631
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)));
|
|
18632
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)));
|
|
18633
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);
|
|
18634
|
-
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)));
|
|
18635
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));
|
|
18636
18802
|
break;
|
|
18637
18803
|
case "ComboBox":
|
|
@@ -18662,7 +18828,7 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18662
18828
|
}
|
|
18663
18829
|
const customPropertyChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
18664
18830
|
const customProperties = customPropertyChildName ? ensureArray(compNode[customPropertyChildName]) : [];
|
|
18665
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
18831
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
18666
18832
|
comp.setCustomProperties(customProperties.flatMap((value) => {
|
|
18667
18833
|
const property = getXmlNode$1(value);
|
|
18668
18834
|
const propertyId = property ? parseInt2(readXmlAttr(property, customPropertyProtocol?.attrs.propertyId), -1) : -1;
|
|
@@ -18679,13 +18845,24 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
18679
18845
|
const ctrlName = readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.name) ?? "";
|
|
18680
18846
|
const ctrl = doc.createController(ctrlName);
|
|
18681
18847
|
const selected = readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.selected);
|
|
18682
|
-
|
|
18848
|
+
const homePageType = readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.homePageType) ?? "default";
|
|
18849
|
+
if (!CONTROLLER_HOME_PAGE_TYPES.has(homePageType)) throw new Error(`Controller "${ctrlName}" has unsupported homePageType "${homePageType}".`);
|
|
18850
|
+
ctrl.setSelectedIndex(parseInt2(selected)).setAlias(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.alias) ?? "").setAutoRadioGroupDepth(parseBool(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.autoRadioGroupDepth))).setExported(parseBool(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.exported))).setHomePageType(homePageType).setHomePage(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.homePage) ?? "");
|
|
18683
18851
|
const pages = parseControllerPages(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.pages) ?? "");
|
|
18684
18852
|
for (const page of pages) {
|
|
18685
18853
|
const p = doc.createControllerPage(page.name);
|
|
18686
18854
|
p.setId(page.id);
|
|
18687
18855
|
ctrl.addPage(p);
|
|
18688
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
|
+
}
|
|
18689
18866
|
const controllerActionChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.controller, "action");
|
|
18690
18867
|
const actions = controllerActionChildName ? ensureArray(ctrlDef[controllerActionChildName]) : [];
|
|
18691
18868
|
for (let actionIndex = 0; actionIndex < actions.length; actionIndex += 1) {
|
|
@@ -19170,6 +19347,7 @@ var ProjectReader = class {
|
|
|
19170
19347
|
case "MovieClipResource": return resource.getFileName();
|
|
19171
19348
|
case "SoundResource":
|
|
19172
19349
|
case "MiscResource":
|
|
19350
|
+
case "SwfResource":
|
|
19173
19351
|
case "SpineResource":
|
|
19174
19352
|
case "DragonBonesResource": return resource.getFile();
|
|
19175
19353
|
default: return "";
|
|
@@ -19265,6 +19443,18 @@ var ProjectReader = class {
|
|
|
19265
19443
|
ctx.registerResource(pkg.getId(), id, res);
|
|
19266
19444
|
return res;
|
|
19267
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
|
+
}
|
|
19268
19458
|
case "font": {
|
|
19269
19459
|
const res = doc.createFontResource(name.replace(/\.\w+$/, ""));
|
|
19270
19460
|
res.setId(id);
|
|
@@ -19727,6 +19917,13 @@ function formatButtonMode(mode) {
|
|
|
19727
19917
|
2: "Radio"
|
|
19728
19918
|
}[mode] ?? "Common";
|
|
19729
19919
|
}
|
|
19920
|
+
function formatButtonDownEffect(effect) {
|
|
19921
|
+
return [
|
|
19922
|
+
"none",
|
|
19923
|
+
"dark",
|
|
19924
|
+
"scale"
|
|
19925
|
+
][effect] ?? "none";
|
|
19926
|
+
}
|
|
19730
19927
|
function formatTitleType(titleType) {
|
|
19731
19928
|
return {
|
|
19732
19929
|
0: "percent",
|
|
@@ -19989,6 +20186,7 @@ function serializeChild(obj) {
|
|
|
19989
20186
|
if (typedObj.getShrinkOnly?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.shrinkOnly, "1");
|
|
19990
20187
|
if (typedObj.getAutoSize?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.autoSize, "1");
|
|
19991
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");
|
|
19992
20190
|
const loaderColor = typedObj.getColor?.();
|
|
19993
20191
|
if (loaderColor && !isDefaultWhiteColor(loaderColor)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color, loaderColor);
|
|
19994
20192
|
if (typedObj.getFilter?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.filter, typedObj.getFilter?.());
|
|
@@ -20186,7 +20384,8 @@ function serializeChild(obj) {
|
|
|
20186
20384
|
if ((layout === 2 || layout === 4) && columnCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(columnCount));
|
|
20187
20385
|
else if (layout === 3 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(lineCount));
|
|
20188
20386
|
if (layout === 4 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount2, String(lineCount));
|
|
20189
|
-
|
|
20387
|
+
const autoResizeItem = typedObj.getAutoResizeItem?.() ?? true;
|
|
20388
|
+
if (autoResizeItem !== getDefaultListAutoResizeItem(layout ?? 0)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem, String(autoResizeItem));
|
|
20190
20389
|
const childrenRenderOrder = typedObj.getChildrenRenderOrder?.() ?? 0;
|
|
20191
20390
|
if (childrenRenderOrder !== 0) {
|
|
20192
20391
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder, {
|
|
@@ -20535,6 +20734,8 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20535
20734
|
if (initName) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.initName, initName);
|
|
20536
20735
|
const remark = typedComp.getRemark?.();
|
|
20537
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);
|
|
20538
20739
|
const pageController = typedComp.getPageController?.();
|
|
20539
20740
|
if (pageController) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController, pageController);
|
|
20540
20741
|
const showSound = typedComp.getAddedToStageSound?.();
|
|
@@ -20597,7 +20798,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20597
20798
|
}
|
|
20598
20799
|
const customProperties = typedComp.getCustomProperties?.() ?? [];
|
|
20599
20800
|
const customPropertyChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
20600
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
20801
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
20601
20802
|
if (customProperties.length > 0 && customPropertyChildName) compNode[customPropertyChildName] = customProperties.map((property) => {
|
|
20602
20803
|
const attrs = {};
|
|
20603
20804
|
writeXmlAttr(attrs, customPropertyProtocol?.attrs.target, property.target);
|
|
@@ -20615,7 +20816,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20615
20816
|
if ((typedComp.getSoundVolumeScale?.() ?? 1) !== 1) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(Math.round((typedComp.getSoundVolumeScale?.() ?? 1) * 100)));
|
|
20616
20817
|
const downEffect = typedComp.getDownEffect?.() ?? 0;
|
|
20617
20818
|
if (downEffect !== 0) {
|
|
20618
|
-
writeXmlAttr(extAttrs, extSpecs.downEffect,
|
|
20819
|
+
writeXmlAttr(extAttrs, extSpecs.downEffect, formatButtonDownEffect(downEffect));
|
|
20619
20820
|
writeXmlAttr(extAttrs, extSpecs.downEffectValue, formatButtonDownEffectValue(typedComp.getDownEffectValue?.() ?? .8));
|
|
20620
20821
|
}
|
|
20621
20822
|
break;
|
|
@@ -20656,11 +20857,27 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
20656
20857
|
await fs.writeFile(targetPath, builder.build(xmlObj));
|
|
20657
20858
|
}
|
|
20658
20859
|
function serializeController(ctrl) {
|
|
20659
|
-
const
|
|
20860
|
+
const pages = ctrl.listPages();
|
|
20861
|
+
const pagesStr = pages.map((p) => `${p.getId()},${p.getName()}`).join(",");
|
|
20660
20862
|
const attrs = {};
|
|
20661
20863
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.name, ctrl.getName());
|
|
20662
20864
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.pages, pagesStr);
|
|
20663
20865
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.selected, String(ctrl.getSelectedIndex()));
|
|
20866
|
+
if (ctrl.getAlias()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.alias, ctrl.getAlias());
|
|
20867
|
+
if (ctrl.getAutoRadioGroupDepth()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.autoRadioGroupDepth, "true");
|
|
20868
|
+
if (ctrl.getExported()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.exported, "true");
|
|
20869
|
+
if (ctrl.getHomePageType() !== "default") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.homePageType, ctrl.getHomePageType());
|
|
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;
|
|
20664
20881
|
const actions = ctrl.listActions().map((action) => serializeControllerAction(action));
|
|
20665
20882
|
const actionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.controller, "action");
|
|
20666
20883
|
if (actions.length > 0 && actionChildName) attrs[actionChildName] = actions;
|
|
@@ -21192,6 +21409,7 @@ var ProjectWriter = class {
|
|
|
21192
21409
|
SoundResource: "sound",
|
|
21193
21410
|
FontResource: "font",
|
|
21194
21411
|
MovieClipResource: "movieclip",
|
|
21412
|
+
SwfResource: "swf",
|
|
21195
21413
|
SpineResource: "spine",
|
|
21196
21414
|
DragonBonesResource: "dragonbones"
|
|
21197
21415
|
}[propertyType] ?? null;
|
|
@@ -21204,7 +21422,7 @@ var ProjectWriter = class {
|
|
|
21204
21422
|
const fileName = res.getFileName?.() ?? "";
|
|
21205
21423
|
if (fileName) return fileName;
|
|
21206
21424
|
}
|
|
21207
|
-
if (type === "SoundResource" || type === "MiscResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
21425
|
+
if (type === "SoundResource" || type === "MiscResource" || type === "SwfResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
21208
21426
|
const fileName = res.getFile?.() ?? "";
|
|
21209
21427
|
if (fileName) return fileName;
|
|
21210
21428
|
}
|
|
@@ -21451,21 +21669,31 @@ function decodeComponentControllers(doc, resource, buf) {
|
|
|
21451
21669
|
controller.addPage(page);
|
|
21452
21670
|
}
|
|
21453
21671
|
let homePageIndex = 0;
|
|
21672
|
+
let homePageType = controller.getHomePageType();
|
|
21673
|
+
let homePage = "";
|
|
21454
21674
|
if (controllerBuf.version >= 2 && remainingBytes(controllerBuf) >= 1) switch (controllerBuf.getUint8()) {
|
|
21455
21675
|
case 1:
|
|
21456
|
-
|
|
21676
|
+
homePageType = "specific";
|
|
21677
|
+
if (remainingBytes(controllerBuf) >= 2) {
|
|
21678
|
+
homePageIndex = controllerBuf.getInt16();
|
|
21679
|
+
homePage = controller.listPages()[homePageIndex]?.getId() ?? "";
|
|
21680
|
+
}
|
|
21457
21681
|
break;
|
|
21458
21682
|
case 2:
|
|
21683
|
+
homePageType = "branch";
|
|
21459
21684
|
homePageIndex = 0;
|
|
21460
21685
|
break;
|
|
21461
21686
|
case 3:
|
|
21462
|
-
|
|
21687
|
+
homePageType = "variable";
|
|
21688
|
+
if (remainingBytes(controllerBuf) >= 2) homePage = controllerBuf.readS() ?? "";
|
|
21463
21689
|
homePageIndex = 0;
|
|
21464
21690
|
break;
|
|
21465
21691
|
default:
|
|
21692
|
+
homePageType = "default";
|
|
21466
21693
|
homePageIndex = 0;
|
|
21467
21694
|
break;
|
|
21468
21695
|
}
|
|
21696
|
+
controller.setHomePageType(homePageType).setHomePage(homePage);
|
|
21469
21697
|
if (controller.listPages().length > 0) {
|
|
21470
21698
|
const maxIndex = controller.listPages().length - 1;
|
|
21471
21699
|
controller.setSelectedIndex(Math.min(Math.max(homePageIndex, 0), maxIndex));
|
|
@@ -21828,6 +22056,10 @@ function decodeChildBlock4ComponentLike(resource, child, childBuf) {
|
|
|
21828
22056
|
const controller = resource.listControllers()[pageControllerIndex];
|
|
21829
22057
|
if (controller && "setPageController" in child && typeof child.setPageController === "function") child.setPageController(controller.getName());
|
|
21830
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
|
+
}
|
|
21831
22063
|
}
|
|
21832
22064
|
function decodeChildBlock4TextInput(child, childBuf) {
|
|
21833
22065
|
if (!childBuf.seek(0, 4) || remainingBytes(childBuf) < 10) return;
|
|
@@ -21858,20 +22090,26 @@ function decodeListScrollPane(child, childBuf) {
|
|
|
21858
22090
|
]);
|
|
21859
22091
|
listLike.setVtScrollBarRes(childBuf.readS() ?? "").setHzScrollBarRes(childBuf.readS() ?? "").setHeaderRes(childBuf.readS() ?? "").setFooterRes(childBuf.readS() ?? "");
|
|
21860
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
|
+
}
|
|
21861
22103
|
function decodeListItemOverrides(buf, version) {
|
|
21862
|
-
if (remainingBytes(buf) < 2) return
|
|
22104
|
+
if (remainingBytes(buf) < 2) return {};
|
|
21863
22105
|
const controllerOverrideCount = buf.getInt16();
|
|
21864
22106
|
const controllerParts = [];
|
|
21865
22107
|
for (let index = 0; index < controllerOverrideCount && remainingBytes(buf) >= 4; index += 1) controllerParts.push(buf.readS() ?? "", buf.readS() ?? "");
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
buf.readS();
|
|
21872
|
-
}
|
|
21873
|
-
}
|
|
21874
|
-
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
|
+
};
|
|
21875
22113
|
}
|
|
21876
22114
|
function decodeListItems(child, childBuf) {
|
|
21877
22115
|
if (!childBuf.seek(0, 8) || remainingBytes(childBuf) < 4) return;
|
|
@@ -21900,10 +22138,9 @@ function decodeListItems(child, childBuf) {
|
|
|
21900
22138
|
level,
|
|
21901
22139
|
isFolder
|
|
21902
22140
|
};
|
|
21903
|
-
|
|
21904
|
-
items.push(controllers === null ? item : {
|
|
22141
|
+
items.push({
|
|
21905
22142
|
...item,
|
|
21906
|
-
|
|
22143
|
+
...decodeListItemOverrides(childBuf, childBuf.version)
|
|
21907
22144
|
});
|
|
21908
22145
|
childBuf.pos = nextPos;
|
|
21909
22146
|
}
|
|
@@ -21966,7 +22203,7 @@ function decodeChildBlock5(child, childBuf) {
|
|
|
21966
22203
|
if (remainingBytes(childBuf) < 15) return;
|
|
21967
22204
|
const loader = child;
|
|
21968
22205
|
loader.setUrl(childBuf.readS() ?? "").setAlign(childBuf.getUint8()).setVAlign(childBuf.getUint8()).setFill(childBuf.getUint8()).setShrinkOnly(childBuf.readBool()).setAutoSize(childBuf.readBool());
|
|
21969
|
-
childBuf.readBool();
|
|
22206
|
+
loader.setShowErrorSign(childBuf.readBool());
|
|
21970
22207
|
loader.setPlaying(childBuf.readBool()).setFrame(childBuf.getInt32());
|
|
21971
22208
|
if (childBuf.readBool()) loader.setColor(readColorValue(childBuf, false));
|
|
21972
22209
|
loader.setFillMethod(childBuf.getUint8());
|
|
@@ -22516,13 +22753,13 @@ var BinaryReader = class {
|
|
|
22516
22753
|
if (scaleOpt === 1) {
|
|
22517
22754
|
const x = buf.getInt32(), y = buf.getInt32();
|
|
22518
22755
|
const w = buf.getInt32(), h = buf.getInt32();
|
|
22519
|
-
buf.getInt32();
|
|
22756
|
+
const tileGridIndice = buf.getInt32();
|
|
22520
22757
|
res.setScaleOption(1).setScale9Grid([
|
|
22521
22758
|
x,
|
|
22522
22759
|
y,
|
|
22523
22760
|
w,
|
|
22524
22761
|
h
|
|
22525
|
-
]);
|
|
22762
|
+
]).setTileGridIndice(tileGridIndice);
|
|
22526
22763
|
} else if (scaleOpt === 2) res.setScaleOption(2);
|
|
22527
22764
|
res.setSmoothing(buf.readBool());
|
|
22528
22765
|
pkg.addResource(res);
|
|
@@ -22560,6 +22797,17 @@ var BinaryReader = class {
|
|
|
22560
22797
|
createdResource = res;
|
|
22561
22798
|
break;
|
|
22562
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
|
+
}
|
|
22563
22811
|
case BinItemType$1.Component: {
|
|
22564
22812
|
const res = doc.createComponent(itemName);
|
|
22565
22813
|
res.setId(itemId).setPath(itemPath).setExported(exported).setSize(width, height);
|
|
@@ -23093,7 +23341,27 @@ function _writeControllers(buf, comp) {
|
|
|
23093
23341
|
buf.writeSEx(page.getId?.() ?? "", false, false);
|
|
23094
23342
|
buf.writeSEx(page.getName?.() ?? "", false, false);
|
|
23095
23343
|
}
|
|
23096
|
-
|
|
23344
|
+
switch (ctrl.getHomePageType()) {
|
|
23345
|
+
case "default":
|
|
23346
|
+
buf.writeUint8(0);
|
|
23347
|
+
break;
|
|
23348
|
+
case "specific": {
|
|
23349
|
+
const homePageIndex = pages.findIndex((page) => page.getId() === ctrl.getHomePage());
|
|
23350
|
+
if (homePageIndex < 0) throw new Error(`Controller "${ctrl.getName()}" references unknown home page id "${ctrl.getHomePage()}".`);
|
|
23351
|
+
buf.writeUint8(1);
|
|
23352
|
+
buf.writeInt16(homePageIndex);
|
|
23353
|
+
break;
|
|
23354
|
+
}
|
|
23355
|
+
case "branch":
|
|
23356
|
+
buf.writeUint8(2);
|
|
23357
|
+
break;
|
|
23358
|
+
case "variable":
|
|
23359
|
+
if (!ctrl.getHomePage()) throw new Error(`Controller "${ctrl.getName()}" requires a custom property key.`);
|
|
23360
|
+
buf.writeUint8(3);
|
|
23361
|
+
buf.writeS(ctrl.getHomePage());
|
|
23362
|
+
break;
|
|
23363
|
+
default: throw new Error(`Controller "${ctrl.getName()}" has unsupported home page type.`);
|
|
23364
|
+
}
|
|
23097
23365
|
const cb2 = buf.pos - ctrlIndexPos;
|
|
23098
23366
|
const actions = ctrl.listActions?.() ?? [];
|
|
23099
23367
|
buf.writeInt16(actions.length);
|
|
@@ -23794,7 +24062,7 @@ function _writeDisplayList(buf, comp, _doc, pkg, version) {
|
|
|
23794
24062
|
const isTextInput = childType === "GTextInput";
|
|
23795
24063
|
if (isCompOrList) {
|
|
23796
24064
|
cb4 = buf.pos - childIndexPos;
|
|
23797
|
-
_writeChildBlock4Component(buf, child, comp, pkg);
|
|
24065
|
+
_writeChildBlock4Component(buf, child, comp, pkg, version);
|
|
23798
24066
|
} else if (isTextInput) {
|
|
23799
24067
|
cb4 = buf.pos - childIndexPos;
|
|
23800
24068
|
_writeChildBlock4TextInput(buf, child);
|
|
@@ -23942,13 +24210,13 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
23942
24210
|
buf.writeInt16(child.getMainGridIndex?.() ?? -1);
|
|
23943
24211
|
break;
|
|
23944
24212
|
case "GLoader": {
|
|
23945
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
24213
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
23946
24214
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
23947
24215
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
23948
24216
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
23949
24217
|
buf.writeBool(child.getShrinkOnly?.() ?? false);
|
|
23950
24218
|
buf.writeBool(_boolVal(child.getAutoSize?.(), false));
|
|
23951
|
-
buf.writeBool(false);
|
|
24219
|
+
buf.writeBool(child.getShowErrorSign?.() ?? false);
|
|
23952
24220
|
buf.writeBool(child.getPlaying?.() ?? true);
|
|
23953
24221
|
buf.writeInt32(child.getFrame?.() ?? 0);
|
|
23954
24222
|
const loaderColor = child.getColor?.() ?? null;
|
|
@@ -23967,7 +24235,7 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
23967
24235
|
break;
|
|
23968
24236
|
}
|
|
23969
24237
|
case "GLoader3D": {
|
|
23970
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
24238
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
23971
24239
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
23972
24240
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
23973
24241
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
@@ -24047,7 +24315,7 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
|
|
|
24047
24315
|
case "GTextField":
|
|
24048
24316
|
case "GRichTextField":
|
|
24049
24317
|
case "GTextInput":
|
|
24050
|
-
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getText?.() ?? null), true);
|
|
24318
|
+
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getAutoClearText?.() ? null : child.getText?.() ?? null), true);
|
|
24051
24319
|
break;
|
|
24052
24320
|
case "GButton": {
|
|
24053
24321
|
buf.writeUint8(12);
|
|
@@ -24202,7 +24470,7 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
24202
24470
|
break;
|
|
24203
24471
|
}
|
|
24204
24472
|
case "ComboBox": {
|
|
24205
|
-
const comboItems = child.getInstanceComboItems?.() ?? [];
|
|
24473
|
+
const comboItems = child.getInstanceAutoClearItems?.() ? [] : child.getInstanceComboItems?.() ?? [];
|
|
24206
24474
|
buf.writeInt16(comboItems.length);
|
|
24207
24475
|
for (const item of comboItems) {
|
|
24208
24476
|
const itemStart = buf.pos;
|
|
@@ -24263,7 +24531,7 @@ function _writeScrollPane(buf, child, pkg) {
|
|
|
24263
24531
|
function _writeListItems(buf, child, pkg, version) {
|
|
24264
24532
|
buf.writeS(remapLocalUiUrl(pkg, child.getDefaultItem?.() ?? null));
|
|
24265
24533
|
const isTree = child.propertyType === "GTree";
|
|
24266
|
-
const listItems = child.getListItems?.() ?? [];
|
|
24534
|
+
const listItems = child.getAutoClearItems?.() ? [] : child.getListItems?.() ?? [];
|
|
24267
24535
|
buf.writeInt16(listItems.length);
|
|
24268
24536
|
for (const [index, item] of listItems.entries()) {
|
|
24269
24537
|
const itemStart = buf.pos;
|
|
@@ -24293,7 +24561,7 @@ function _writeListItems(buf, child, pkg, version) {
|
|
|
24293
24561
|
buf.pos = controllerCountPos;
|
|
24294
24562
|
buf.writeInt16(controllerCount);
|
|
24295
24563
|
buf.pos = controllerEnd;
|
|
24296
|
-
if (version >= 2) buf.
|
|
24564
|
+
if (version >= 2) _writePropertyOverrides(buf, item.propertyOverrides ?? []);
|
|
24297
24565
|
const itemEnd = buf.pos;
|
|
24298
24566
|
const saved = buf.pos;
|
|
24299
24567
|
buf.pos = itemStart;
|
|
@@ -24305,7 +24573,7 @@ function _writeTreeSettings(buf, child) {
|
|
|
24305
24573
|
buf.writeInt32(child.getIndent?.() ?? 0);
|
|
24306
24574
|
buf.writeUint8(child.getClickToExpand?.() ?? 0);
|
|
24307
24575
|
}
|
|
24308
|
-
function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
24576
|
+
function _writeChildBlock4Component(buf, child, comp, _pkg, version) {
|
|
24309
24577
|
const pageCtrlName = child.getPageController?.() ?? null;
|
|
24310
24578
|
if (pageCtrlName) {
|
|
24311
24579
|
const ctrlIdx = comp.listControllers().findIndex((c) => c.getName() === pageCtrlName);
|
|
@@ -24327,7 +24595,15 @@ function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
|
24327
24595
|
buf.writeInt16(count);
|
|
24328
24596
|
buf.pos = saved;
|
|
24329
24597
|
} else buf.writeInt16(0);
|
|
24330
|
-
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
|
+
}
|
|
24331
24607
|
}
|
|
24332
24608
|
function _writeChildBlock4TextInput(buf, child) {
|
|
24333
24609
|
buf.writeSEx(child.getPromptText?.() ?? child.getPrompt?.() ?? null);
|
|
@@ -24392,6 +24668,7 @@ const BinItemType = {
|
|
|
24392
24668
|
Component: 3,
|
|
24393
24669
|
Atlas: 4,
|
|
24394
24670
|
Font: 5,
|
|
24671
|
+
Swf: 6,
|
|
24395
24672
|
Misc: 7,
|
|
24396
24673
|
Unknown: 8,
|
|
24397
24674
|
Spine: 9,
|
|
@@ -24409,6 +24686,7 @@ const EDITOR_TYPE_STRING = {
|
|
|
24409
24686
|
SoundResource: "sound",
|
|
24410
24687
|
Component: "component",
|
|
24411
24688
|
FontResource: "font",
|
|
24689
|
+
SwfResource: "swf",
|
|
24412
24690
|
SpineResource: "spine",
|
|
24413
24691
|
DragonBonesResource: "dragonbones"
|
|
24414
24692
|
};
|
|
@@ -24557,7 +24835,7 @@ var BinaryWriter = class {
|
|
|
24557
24835
|
data.writeInt32(grid[1]);
|
|
24558
24836
|
data.writeInt32(grid[2]);
|
|
24559
24837
|
data.writeInt32(grid[3]);
|
|
24560
|
-
data.writeInt32(
|
|
24838
|
+
data.writeInt32(res.getTileGridIndice());
|
|
24561
24839
|
}
|
|
24562
24840
|
data.writeBool(res.getSmoothing());
|
|
24563
24841
|
break;
|
|
@@ -24611,6 +24889,16 @@ var BinaryWriter = class {
|
|
|
24611
24889
|
data.writeInt32(0);
|
|
24612
24890
|
data.writeInt32(0);
|
|
24613
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;
|
|
24614
24902
|
case "Component": {
|
|
24615
24903
|
data.writeUint8(BinItemType.Component);
|
|
24616
24904
|
data.writeS(getPublishedItemId$1(res));
|
|
@@ -24754,13 +25042,15 @@ var BinaryWriter = class {
|
|
|
24754
25042
|
const oh = sp.originalHeight ?? 0;
|
|
24755
25043
|
const isPackageItemSprite = packageItemIds.has(sp.itemId);
|
|
24756
25044
|
const isZeroSizedDirectOutput = isPackageItemSprite && sp.w === 0 && sp.h === 0;
|
|
24757
|
-
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;
|
|
24758
25048
|
data.writeBool(hasOriginal);
|
|
24759
25049
|
if (hasOriginal) {
|
|
24760
25050
|
data.writeInt32(ox);
|
|
24761
25051
|
data.writeInt32(oy);
|
|
24762
|
-
data.writeInt32(
|
|
24763
|
-
data.writeInt32(
|
|
25052
|
+
data.writeInt32(originalWidth);
|
|
25053
|
+
data.writeInt32(originalHeight);
|
|
24764
25054
|
}
|
|
24765
25055
|
}
|
|
24766
25056
|
const spriteNextPos = data.pos;
|
|
@@ -25103,9 +25393,9 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
25103
25393
|
const sourcePackageId = child.getPackageId?.()?.trim();
|
|
25104
25394
|
if (sourcePackageId && sourcePackageId !== ownerPackageId) target.packageIds.add(sourcePackageId);
|
|
25105
25395
|
addFontReferences(target, ownerPackageId, child.getFont?.());
|
|
25106
|
-
addTextReferences(target, ownerPackageId, child.getText?.());
|
|
25396
|
+
if (!child.getAutoClearText?.()) addTextReferences(target, ownerPackageId, child.getText?.());
|
|
25107
25397
|
for (const reference of [
|
|
25108
|
-
child.getUrl?.(),
|
|
25398
|
+
child.getClearOnPublish?.() ? void 0 : child.getUrl?.(),
|
|
25109
25399
|
child.getDefaultItem?.(),
|
|
25110
25400
|
child.getIcon?.(),
|
|
25111
25401
|
child.getSelectedIcon?.(),
|
|
@@ -25119,11 +25409,14 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
25119
25409
|
child.getHeaderRes?.(),
|
|
25120
25410
|
child.getFooterRes?.()
|
|
25121
25411
|
]) addUiReference(target, ownerPackageId, reference);
|
|
25122
|
-
for (const item of child.getInstanceComboItems?.() ?? []) addUiReference(target, ownerPackageId, item.icon);
|
|
25123
|
-
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?.() ?? []) {
|
|
25124
25414
|
addUiReference(target, ownerPackageId, item.icon);
|
|
25415
|
+
addUiReference(target, ownerPackageId, item.selectedIcon);
|
|
25125
25416
|
addUiReference(target, ownerPackageId, item.url);
|
|
25417
|
+
addUnknownReferences(target, ownerPackageId, item.propertyOverrides?.map((property) => property.value));
|
|
25126
25418
|
}
|
|
25419
|
+
addUnknownReferences(target, ownerPackageId, child.getPropertyOverrides?.().map((property) => property.value));
|
|
25127
25420
|
for (const gear of child.listGears?.() ?? []) {
|
|
25128
25421
|
addUnknownReferences(target, ownerPackageId, gear.getValues?.());
|
|
25129
25422
|
addUnknownReferences(target, ownerPackageId, gear.getDefaultValue?.());
|
|
@@ -25153,7 +25446,8 @@ function collectPackageResourceReferences(pkg) {
|
|
|
25153
25446
|
localResourceIds: /* @__PURE__ */ new Set(),
|
|
25154
25447
|
packageIds: /* @__PURE__ */ new Set()
|
|
25155
25448
|
};
|
|
25156
|
-
|
|
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);
|
|
25157
25451
|
return references;
|
|
25158
25452
|
}
|
|
25159
25453
|
//#endregion
|
|
@@ -25180,6 +25474,9 @@ function isFontResource(resource) {
|
|
|
25180
25474
|
function isSoundResource(resource) {
|
|
25181
25475
|
return resource.propertyType === "SoundResource";
|
|
25182
25476
|
}
|
|
25477
|
+
function isSwfResource(resource) {
|
|
25478
|
+
return resource.propertyType === "SwfResource";
|
|
25479
|
+
}
|
|
25183
25480
|
function isSpineResource(resource) {
|
|
25184
25481
|
return resource.propertyType === "SpineResource";
|
|
25185
25482
|
}
|
|
@@ -25221,10 +25518,12 @@ function extname(fileName) {
|
|
|
25221
25518
|
return normalized.slice(lastDot);
|
|
25222
25519
|
}
|
|
25223
25520
|
function resolvePublishedMiscFileName(resource, projectType) {
|
|
25224
|
-
const
|
|
25225
|
-
if (projectType
|
|
25226
|
-
|
|
25227
|
-
|
|
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"}`;
|
|
25228
25527
|
}
|
|
25229
25528
|
function resolvePublishedSkeletonFileName(resource, projectType) {
|
|
25230
25529
|
if (projectType === UNITY_PROJECT_TYPE$1 && isSpineResource(resource) && resource.getFile().toLowerCase().endsWith(".skel")) return `${resource.getFile()}.bytes`;
|
|
@@ -25291,16 +25590,16 @@ function trimTrailingMissingHighResolutionIds(ids) {
|
|
|
25291
25590
|
while (ids.length > 0 && !ids[ids.length - 1]) ids.pop();
|
|
25292
25591
|
return ids;
|
|
25293
25592
|
}
|
|
25294
|
-
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution) {
|
|
25593
|
+
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution, excludedResourceIds) {
|
|
25295
25594
|
const result = /* @__PURE__ */ new Map();
|
|
25296
25595
|
if (includeHighResolution <= 0) return result;
|
|
25297
25596
|
const highResolutionResourceByKey = /* @__PURE__ */ new Map();
|
|
25298
25597
|
for (const resource of resources) {
|
|
25299
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
25598
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
25300
25599
|
highResolutionResourceByKey.set(buildHighResolutionResourceKey(resource), resource);
|
|
25301
25600
|
}
|
|
25302
25601
|
for (const resource of resources) {
|
|
25303
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
25602
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
25304
25603
|
if (!publishedResourceIds.has(resource.getId())) continue;
|
|
25305
25604
|
if (isHighResolutionVariantName(resource.getName())) continue;
|
|
25306
25605
|
const ids = [];
|
|
@@ -25325,6 +25624,7 @@ function collectHighResolutionItemIds(resources, publishedResourceIds, includeHi
|
|
|
25325
25624
|
}
|
|
25326
25625
|
function collectPackagePublishContext(pkg, options) {
|
|
25327
25626
|
const resources = pkg.listResources();
|
|
25627
|
+
const excludedResourceIds = new Set(pkg.getSourceAtlasSettings().excludedResourceIds);
|
|
25328
25628
|
const resourceMap = new Map(resources.map((resource) => [resource.getId(), resource]));
|
|
25329
25629
|
const referencedIds = collectPackageResourceReferences(pkg).localResourceIds;
|
|
25330
25630
|
const pixelHitTestImageIds = /* @__PURE__ */ new Set();
|
|
@@ -25336,10 +25636,15 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25336
25636
|
while (changed) {
|
|
25337
25637
|
changed = false;
|
|
25338
25638
|
for (const resourceId of [...exportedResourceIds]) {
|
|
25639
|
+
if (excludedResourceIds.has(resourceId)) {
|
|
25640
|
+
exportedResourceIds.delete(resourceId);
|
|
25641
|
+
changed = true;
|
|
25642
|
+
continue;
|
|
25643
|
+
}
|
|
25339
25644
|
const resource = resourcesById.get(resourceId);
|
|
25340
25645
|
if (!resource || !isSkeletonResource(resource)) continue;
|
|
25341
25646
|
for (const requiredId of resource.getRequireIds()) {
|
|
25342
|
-
if (!requiredId || exportedResourceIds.has(requiredId)) continue;
|
|
25647
|
+
if (!requiredId || excludedResourceIds.has(requiredId) || exportedResourceIds.has(requiredId)) continue;
|
|
25343
25648
|
exportedResourceIds.add(requiredId);
|
|
25344
25649
|
changed = true;
|
|
25345
25650
|
}
|
|
@@ -25347,7 +25652,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25347
25652
|
}
|
|
25348
25653
|
return exportedResourceIds;
|
|
25349
25654
|
};
|
|
25350
|
-
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());
|
|
25351
25656
|
for (const resource of resources) {
|
|
25352
25657
|
if (!isComponentResource(resource)) continue;
|
|
25353
25658
|
const component = resource;
|
|
@@ -25356,7 +25661,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25356
25661
|
const hitTest = component.getHitTest?.()?.trim();
|
|
25357
25662
|
if (hitTest && !hitTest.includes(",")) {
|
|
25358
25663
|
const sourceId = childMap.get(hitTest)?.getSrc?.();
|
|
25359
|
-
if (sourceId) {
|
|
25664
|
+
if (sourceId && !excludedResourceIds.has(sourceId)) {
|
|
25360
25665
|
const sourceResource = resourceMap.get(sourceId);
|
|
25361
25666
|
if (sourceResource && isImageResource(sourceResource)) pixelHitTestImageIds.add(sourceId);
|
|
25362
25667
|
}
|
|
@@ -25365,7 +25670,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25365
25670
|
const publishedResourceIds = new Set(spriteItemIds);
|
|
25366
25671
|
for (const resource of resources) {
|
|
25367
25672
|
const resourceId = resource.getId();
|
|
25368
|
-
if (!resourceId) continue;
|
|
25673
|
+
if (!resourceId || excludedResourceIds.has(resourceId)) continue;
|
|
25369
25674
|
if (isComponentResource(resource)) {
|
|
25370
25675
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
25371
25676
|
continue;
|
|
@@ -25389,7 +25694,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
25389
25694
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
25390
25695
|
}
|
|
25391
25696
|
for (const resourceId of collectExportedResourceIds(resources, publishedResourceIds)) publishedResourceIds.add(resourceId);
|
|
25392
|
-
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution);
|
|
25697
|
+
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution, excludedResourceIds);
|
|
25393
25698
|
if (!options.includeBranches) {
|
|
25394
25699
|
const mainByKey = /* @__PURE__ */ new Map();
|
|
25395
25700
|
const activeBranchByKey = /* @__PURE__ */ new Map();
|
|
@@ -25517,6 +25822,10 @@ async function annotatePackagePublishArtifacts(pkg, basePath, encoder, options)
|
|
|
25517
25822
|
setPublishedFileExtra(resource, resolvePublishedMiscFileName(resource, options.projectType));
|
|
25518
25823
|
continue;
|
|
25519
25824
|
}
|
|
25825
|
+
if (isSwfResource(resource)) {
|
|
25826
|
+
setPublishedFileExtra(resource, resolvePublishedSwfFileName(resource));
|
|
25827
|
+
continue;
|
|
25828
|
+
}
|
|
25520
25829
|
if (isSkeletonResource(resource)) setPublishedFileExtra(resource, resolvePublishedSkeletonFileName(resource, options.projectType));
|
|
25521
25830
|
}
|
|
25522
25831
|
}
|
|
@@ -26775,7 +27084,7 @@ function packAtlasPages(inputs, options, forceSinglePage, sizeOverrides) {
|
|
|
26775
27084
|
});
|
|
26776
27085
|
return new MaxRectsPackerCompat({
|
|
26777
27086
|
pot: sizeOverrides?.powerOfTwo ?? options.powerOfTwo,
|
|
26778
|
-
mof: sizeOverrides?.multipleOfFour ??
|
|
27087
|
+
mof: sizeOverrides?.multipleOfFour ?? options.multipleOfFour,
|
|
26779
27088
|
padding: options.padding,
|
|
26780
27089
|
rotation: options.allowRotation,
|
|
26781
27090
|
minWidth: 16,
|
|
@@ -26875,7 +27184,7 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
26875
27184
|
}
|
|
26876
27185
|
}
|
|
26877
27186
|
const outputFile = `${options.outputPath}/${atlasFileName}`;
|
|
26878
|
-
|
|
27187
|
+
const atlasPipeline = encoder({ create: {
|
|
26879
27188
|
width: page.width,
|
|
26880
27189
|
height: page.height,
|
|
26881
27190
|
channels: 4,
|
|
@@ -26885,7 +27194,13 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
26885
27194
|
b: 0,
|
|
26886
27195
|
alpha: 0
|
|
26887
27196
|
}
|
|
26888
|
-
} }).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);
|
|
26889
27204
|
logger.info(`atlas: Generated ${atlasFileName} (${page.width}x${page.height}, ${page.outputRects.length} sprites)`);
|
|
26890
27205
|
}
|
|
26891
27206
|
function inputToCompatRect(input, index) {
|
|
@@ -26935,6 +27250,9 @@ function resolveDirectOutputAtlasSize(width, height, options) {
|
|
|
26935
27250
|
if (options.powerOfTwo) {
|
|
26936
27251
|
resolvedWidth = nextPow2(resolvedWidth);
|
|
26937
27252
|
resolvedHeight = nextPow2(resolvedHeight);
|
|
27253
|
+
} else if (options.multipleOfFour) {
|
|
27254
|
+
resolvedWidth = roundUpToMultiple(resolvedWidth, 4);
|
|
27255
|
+
resolvedHeight = roundUpToMultiple(resolvedHeight, 4);
|
|
26938
27256
|
}
|
|
26939
27257
|
return {
|
|
26940
27258
|
width: resolvedWidth,
|
|
@@ -27049,9 +27367,8 @@ function sortResourcesByOrder(resources, orderMap, inputOrderMap) {
|
|
|
27049
27367
|
});
|
|
27050
27368
|
return ordered;
|
|
27051
27369
|
}
|
|
27052
|
-
function getResourceTextureSetMode(resource) {
|
|
27053
|
-
|
|
27054
|
-
return parseTextureSetMode(resource.getTextureSetMode?.());
|
|
27370
|
+
function getResourceTextureSetMode(resource, maxAtlasIndex) {
|
|
27371
|
+
return parseTextureSetMode(resource.getTextureSetMode?.(), maxAtlasIndex);
|
|
27055
27372
|
}
|
|
27056
27373
|
function groupStandaloneInputs(doc, inputs, options) {
|
|
27057
27374
|
const autoInputs = [];
|
|
@@ -27070,7 +27387,7 @@ function groupStandaloneInputs(doc, inputs, options) {
|
|
|
27070
27387
|
for (const input of inputs) {
|
|
27071
27388
|
const branchName = getInputBranchName(input);
|
|
27072
27389
|
const branchOrdinal = branchOrdinalByName.get(branchName) ?? 0;
|
|
27073
|
-
const mode = getResourceTextureSetMode(input.resource);
|
|
27390
|
+
const mode = getResourceTextureSetMode(input.resource, options.maxAtlasIndex ?? 10);
|
|
27074
27391
|
if (mode.kind === "standalone") {
|
|
27075
27392
|
const key = `${branchName}\u0000${getPublishedItemId(input.resource)}`;
|
|
27076
27393
|
const existing = standaloneGroups.get(key);
|
|
@@ -27114,6 +27431,8 @@ const ATLAS_DEFAULTS = {
|
|
|
27114
27431
|
allowRotation: true,
|
|
27115
27432
|
padding: 1,
|
|
27116
27433
|
powerOfTwo: false,
|
|
27434
|
+
maxAtlasIndex: 10,
|
|
27435
|
+
multipleOfFour: false,
|
|
27117
27436
|
square: false,
|
|
27118
27437
|
multiPage: true,
|
|
27119
27438
|
trimImage: false,
|
|
@@ -27197,7 +27516,7 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
27197
27516
|
const refChild = child;
|
|
27198
27517
|
await addResource(resourceMap.get(refChild.getSrc?.() ?? ""));
|
|
27199
27518
|
for (const ref of [
|
|
27200
|
-
refChild.getUrl?.(),
|
|
27519
|
+
refChild.getClearOnPublish?.() ? void 0 : refChild.getUrl?.(),
|
|
27201
27520
|
refChild.getDefaultItem?.(),
|
|
27202
27521
|
refChild.getIcon?.(),
|
|
27203
27522
|
refChild.getSelectedIcon?.(),
|
|
@@ -27211,11 +27530,14 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
27211
27530
|
refChild.getInstanceIcon?.(),
|
|
27212
27531
|
refChild.getInstanceSelectedIcon?.()
|
|
27213
27532
|
]) await addResourceByLocalUiUrl(ref);
|
|
27214
|
-
for (const item of refChild.getInstanceComboItems?.() ?? []) await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
27215
|
-
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?.() ?? []) {
|
|
27216
27535
|
await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
27536
|
+
await addResourceByLocalUiUrl(item.selectedIcon ?? void 0);
|
|
27217
27537
|
await addResourceByLocalUiUrl(item.url ?? void 0);
|
|
27538
|
+
for (const property of item.propertyOverrides ?? []) await addResourceByLocalUiUrl(property.value);
|
|
27218
27539
|
}
|
|
27540
|
+
for (const property of refChild.getPropertyOverrides?.() ?? []) await addResourceByLocalUiUrl(property.value);
|
|
27219
27541
|
for (const gear of refChild.listGears?.() ?? []) await addGearIconResources(gear);
|
|
27220
27542
|
}
|
|
27221
27543
|
for (const ref of [
|
|
@@ -27466,23 +27788,32 @@ const FGUI_TYPESCRIPT_RUNTIME_TYPES = new Set([
|
|
|
27466
27788
|
"GTree",
|
|
27467
27789
|
"Transition"
|
|
27468
27790
|
]);
|
|
27469
|
-
const
|
|
27791
|
+
const LAYABOX_TYPESCRIPT_VARIANT = {
|
|
27470
27792
|
binderMethod: "setExtension",
|
|
27471
|
-
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\";"
|
|
27472
27799
|
};
|
|
27473
27800
|
async function publishCodeGeneration(doc, options) {
|
|
27474
27801
|
const logger = doc.getLogger();
|
|
27475
27802
|
const settings = resolveCodeGenerationSettings(doc);
|
|
27476
27803
|
if (!settings.allowGenCode) return;
|
|
27477
|
-
const plugins = options.plugins
|
|
27804
|
+
const plugins = options.plugins ?? [];
|
|
27478
27805
|
if (plugins.length > 0) {
|
|
27479
27806
|
let handled = false;
|
|
27480
|
-
for (const plugin of plugins)
|
|
27481
|
-
|
|
27482
|
-
|
|
27483
|
-
|
|
27484
|
-
|
|
27485
|
-
|
|
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
|
+
}
|
|
27486
27817
|
}
|
|
27487
27818
|
if (handled) return;
|
|
27488
27819
|
}
|
|
@@ -27546,8 +27877,9 @@ function supportsCodeGenerationLane(doc, codeType) {
|
|
|
27546
27877
|
}
|
|
27547
27878
|
function resolveFguiTypescriptVariant(doc) {
|
|
27548
27879
|
const projectType = doc.getRoot().getProjectType();
|
|
27549
|
-
if (projectType
|
|
27550
|
-
return
|
|
27880
|
+
if (projectType === ProjectType.LayaBox) return LAYABOX_TYPESCRIPT_VARIANT;
|
|
27881
|
+
if (projectType === ProjectType.CocosCreator) return COCOS_CREATOR_TYPESCRIPT_VARIANT;
|
|
27882
|
+
return null;
|
|
27551
27883
|
}
|
|
27552
27884
|
async function generateUnityCode(doc, pkg, plan, fs) {
|
|
27553
27885
|
const packageDir = fs.join(plan.outputDir, plan.packageFolderName);
|
|
@@ -27730,7 +28062,8 @@ function renderFguiTypescriptComponentClass(classInfo, plan, variant) {
|
|
|
27730
28062
|
}
|
|
27731
28063
|
function renderFguiTypescriptBinder(classes, plan, variant) {
|
|
27732
28064
|
const bindLines = classes.map((classInfo) => `\t\t${variant.runtimeNamespace}.UIObjectFactory.${variant.binderMethod}(${classInfo.encodedClassName}.URL, ${classInfo.encodedClassName});`).join("\n");
|
|
27733
|
-
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");
|
|
27734
28067
|
return renderTemplate(FGUI_TYPESCRIPT_BINDER_TEMPLATE, {
|
|
27735
28068
|
binderClassName: plan.binderClassName,
|
|
27736
28069
|
bindLines: bindLines ? `${bindLines}\n` : "",
|
|
@@ -27794,6 +28127,7 @@ function normalizeTypeName(value) {
|
|
|
27794
28127
|
}
|
|
27795
28128
|
function collectFguiTypescriptImports(classInfo, variant) {
|
|
27796
28129
|
const imports = /* @__PURE__ */ new Set();
|
|
28130
|
+
if (variant.runtimeImport) imports.add(variant.runtimeImport);
|
|
27797
28131
|
for (const member of classInfo.members) {
|
|
27798
28132
|
if (member.ignored) continue;
|
|
27799
28133
|
const translated = translateFguiTypescriptType(member.type, variant);
|
|
@@ -28767,23 +29101,24 @@ async function exportPackageExternalResources(pkg, outputDir, basePath, fs, read
|
|
|
28767
29101
|
if (exportedResourceIds.size === 0) return;
|
|
28768
29102
|
if (!basePath || !readFileRaw) {
|
|
28769
29103
|
if (pkg.listResources().some((resource) => {
|
|
28770
|
-
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());
|
|
28771
29105
|
})) throw new Error(`publish: External resources in package "${pkg.getName()}" require basePath and readFileRaw for output.`);
|
|
28772
29106
|
return;
|
|
28773
29107
|
}
|
|
28774
29108
|
for (const resource of pkg.listResources()) {
|
|
28775
29109
|
const resourceId = resource.getId();
|
|
28776
|
-
const
|
|
29110
|
+
const isExternal = exportedResourceIds.has(resourceId) && (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource));
|
|
28777
29111
|
const isSkeletonImageDependency = skeletonDependencyImageIds.has(resourceId) && isImageResource(resource);
|
|
28778
|
-
if (!
|
|
29112
|
+
if (!isExternal && !isSkeletonImageDependency) continue;
|
|
28779
29113
|
let sourcePath;
|
|
28780
29114
|
let targetName;
|
|
28781
29115
|
if (isSkeletonImageDependency) {
|
|
28782
29116
|
sourcePath = resolveImagePath(resource, pkg, basePath);
|
|
28783
29117
|
targetName = resolveImageFileName(resource);
|
|
28784
|
-
} else if (isMiscResource(resource) || isSkeletonResource(resource)) {
|
|
29118
|
+
} else if (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource)) {
|
|
28785
29119
|
sourcePath = resolveGenericResourcePath(resource, pkg, basePath);
|
|
28786
|
-
|
|
29120
|
+
const publishedFile = (resource.getExtras() ?? {})._publishedFile ?? resource.getFile();
|
|
29121
|
+
targetName = isMiscResource(resource) || isSwfResource(resource) ? `${pkg.getPublishName() || pkg.getName()}_${publishedFile}` : publishedFile;
|
|
28787
29122
|
} else continue;
|
|
28788
29123
|
const targetPath = fs.join(outputDir, targetName);
|
|
28789
29124
|
try {
|
|
@@ -28826,14 +29161,17 @@ function resolvePublishOptions(doc, overrides = {}) {
|
|
|
28826
29161
|
const projectType = overrides.targetProjectType ?? root.getProjectType();
|
|
28827
29162
|
const explicitLayaboxTarget = overrides.targetProjectType === ProjectType.LayaBox;
|
|
28828
29163
|
const fileExtension = overrides.fileExtension ?? (explicitLayaboxTarget ? "fui" : resolveDefaultPublishFileExtension(projectType, publishSettings));
|
|
28829
|
-
|
|
28830
|
-
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;
|
|
28831
29167
|
const atlasOptions = {
|
|
28832
29168
|
maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
|
|
28833
29169
|
fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
|
|
28834
29170
|
allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
|
|
28835
29171
|
padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
|
|
28836
29172
|
powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
|
|
29173
|
+
maxAtlasIndex: overrides.atlas?.maxAtlasIndex ?? 10,
|
|
29174
|
+
multipleOfFour: overrides.atlas?.multipleOfFour ?? atlasSetting.sizeOption === "mof",
|
|
28837
29175
|
square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
|
|
28838
29176
|
multiPage: overrides.atlas?.multiPage ?? atlasSetting.paging ?? true,
|
|
28839
29177
|
trimImage: overrides.atlas?.trimImage ?? atlasSetting.trimImage ?? false,
|
|
@@ -28953,6 +29291,19 @@ function publish(options) {
|
|
|
28953
29291
|
}
|
|
28954
29292
|
}
|
|
28955
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
|
+
};
|
|
28956
29307
|
return {
|
|
28957
29308
|
pkg,
|
|
28958
29309
|
outputDir,
|
|
@@ -28964,7 +29315,7 @@ function publish(options) {
|
|
|
28964
29315
|
activeBranch: config.activeBranch,
|
|
28965
29316
|
includeHighResolution: config.includeHighResolution,
|
|
28966
29317
|
separatedAtlasForBranch: config.separatedAtlasForBranch,
|
|
28967
|
-
atlas
|
|
29318
|
+
atlas
|
|
28968
29319
|
};
|
|
28969
29320
|
};
|
|
28970
29321
|
const createNoopPublishFs = () => ({
|
|
@@ -28984,7 +29335,6 @@ function publish(options) {
|
|
|
28984
29335
|
const atlasRuntimeOptions = resolvePublishAtlasRuntimeOptions(plan.fileExtension);
|
|
28985
29336
|
await atlas({
|
|
28986
29337
|
...plan.atlas,
|
|
28987
|
-
...options.atlas ?? {},
|
|
28988
29338
|
separatedAtlasForBranch: plan.separatedAtlasForBranch,
|
|
28989
29339
|
encoder: options.encoder,
|
|
28990
29340
|
basePath: options.basePath,
|
|
@@ -29550,7 +29900,7 @@ function registerRestoreCommand(program) {
|
|
|
29550
29900
|
//#region src/utils/package-version.ts
|
|
29551
29901
|
const require$1 = createRequire(import.meta.url);
|
|
29552
29902
|
function getInjectedPackageVersion() {
|
|
29553
|
-
const version = "0.2.
|
|
29903
|
+
const version = "0.2.6";
|
|
29554
29904
|
return typeof version === "string" && true ? version : null;
|
|
29555
29905
|
}
|
|
29556
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/core": "0.2.
|
|
37
|
-
"@openfairygui/functions": "0.2.
|
|
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"
|