@zhongguo168a/yxeditor-common 0.0.139 → 0.0.143
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/index.d.ts +23 -3
- package/dist/index.esm.js +44 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as cc from 'cc';
|
|
2
|
-
import { HorizontalTextAlignment, VerticalTextAlignment, Scheduler, Prefab, Node, Component, ISchedulable, AssetManager, Asset, Camera, Canvas,
|
|
2
|
+
import { HorizontalTextAlignment, VerticalTextAlignment, Scheduler, Prefab, Node, Component, ISchedulable, AssetManager, Asset, Vec2, Texture2D, SpriteAtlas, Camera, Canvas, Vec3, Vec4, Widget, UITransform, math } from 'cc';
|
|
3
3
|
|
|
4
4
|
interface IError {
|
|
5
5
|
isCancel(): boolean;
|
|
@@ -1352,7 +1352,7 @@ declare class ViewModel extends EventDispatcher {
|
|
|
1352
1352
|
/**
|
|
1353
1353
|
* 等待打开完成指令
|
|
1354
1354
|
*/
|
|
1355
|
-
waitOpenComplete(...params: any): Promise<
|
|
1355
|
+
waitOpenComplete(...params: any): Promise<any>;
|
|
1356
1356
|
protected openComplete(): void;
|
|
1357
1357
|
waitCloseComplete(): void;
|
|
1358
1358
|
closeComplete(): void;
|
|
@@ -1647,6 +1647,26 @@ declare class AssetLoader extends Dispatcher {
|
|
|
1647
1647
|
protected _failList: List<LoaderItem>;
|
|
1648
1648
|
}
|
|
1649
1649
|
|
|
1650
|
+
/**
|
|
1651
|
+
* 自动生成等距图集的frame描述表。
|
|
1652
|
+
* 用于减少创建atlas文件的过程。
|
|
1653
|
+
*
|
|
1654
|
+
* @param atlasSize 图集的像素尺寸
|
|
1655
|
+
* @param gridSize 每格的像素尺寸
|
|
1656
|
+
* @param keyFormat 名称格式化字符串,例如 "%d.png" 或 "tile_%d.png"
|
|
1657
|
+
* @param maxCount 可选,限制生成数量
|
|
1658
|
+
* @returns atlas数据对象
|
|
1659
|
+
*/
|
|
1660
|
+
declare function create等距图集(atlasSize: Vec2, gridSize: Vec2, keyFormat?: string, maxCount?: number): Record<string, any>;
|
|
1661
|
+
/**
|
|
1662
|
+
*
|
|
1663
|
+
* @param name 图集的名称
|
|
1664
|
+
* @param plist plist格式的json文件内容
|
|
1665
|
+
* @param texture
|
|
1666
|
+
* @returns
|
|
1667
|
+
*/
|
|
1668
|
+
declare function parseAtlas(plist: any, texture: Texture2D): SpriteAtlas;
|
|
1669
|
+
|
|
1650
1670
|
declare enum LogLevel {
|
|
1651
1671
|
DEBUG = 0,
|
|
1652
1672
|
INFO = 1,
|
|
@@ -2195,5 +2215,5 @@ declare class WidgetUtil {
|
|
|
2195
2215
|
}
|
|
2196
2216
|
declare var widgetutil: WidgetUtil;
|
|
2197
2217
|
|
|
2198
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewModel, ViewModelComponent, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parsePlist, pathutil, randutil, resutil, routeViews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
2218
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewModel, ViewModelComponent, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeViews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
2199
2219
|
export type { CreatorFunction, DisposeFunction, IController, IError, IEventDispatcher, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
|
package/dist/index.esm.js
CHANGED
|
@@ -4489,7 +4489,10 @@ class ViewModel extends EventDispatcher {
|
|
|
4489
4489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4490
4490
|
this._waitOpenComplete = true;
|
|
4491
4491
|
for (const element of params) {
|
|
4492
|
-
yield element();
|
|
4492
|
+
let err = yield element();
|
|
4493
|
+
if (err) {
|
|
4494
|
+
return err;
|
|
4495
|
+
}
|
|
4493
4496
|
if (this.state == ViewState.Closed || this.state == ViewState.Closeing) {
|
|
4494
4497
|
return;
|
|
4495
4498
|
}
|
|
@@ -4937,6 +4940,45 @@ class XAssetManager {
|
|
|
4937
4940
|
}
|
|
4938
4941
|
let assetx = new XAssetManager();
|
|
4939
4942
|
|
|
4943
|
+
/**
|
|
4944
|
+
* 自动生成等距图集的frame描述表。
|
|
4945
|
+
* 用于减少创建atlas文件的过程。
|
|
4946
|
+
*
|
|
4947
|
+
* @param atlasSize 图集的像素尺寸
|
|
4948
|
+
* @param gridSize 每格的像素尺寸
|
|
4949
|
+
* @param keyFormat 名称格式化字符串,例如 "%d.png" 或 "tile_%d.png"
|
|
4950
|
+
* @param maxCount 可选,限制生成数量
|
|
4951
|
+
* @returns atlas数据对象
|
|
4952
|
+
*/
|
|
4953
|
+
function create等距图集(atlasSize, gridSize, keyFormat = "%d.png", maxCount) {
|
|
4954
|
+
const cols = Math.floor(atlasSize.x / gridSize.x);
|
|
4955
|
+
const rows = Math.floor(atlasSize.y / gridSize.y);
|
|
4956
|
+
const total = maxCount !== null && maxCount !== void 0 ? maxCount : cols * rows;
|
|
4957
|
+
const frames = {};
|
|
4958
|
+
let index = 0;
|
|
4959
|
+
for (let y = 0; y < rows; y++) {
|
|
4960
|
+
for (let x = 0; x < cols; x++) {
|
|
4961
|
+
if (index >= total)
|
|
4962
|
+
break;
|
|
4963
|
+
const key = keyFormat.replace("%d", (index + 1).toString());
|
|
4964
|
+
const frame = {
|
|
4965
|
+
frame: {
|
|
4966
|
+
x: x * gridSize.x,
|
|
4967
|
+
y: y * gridSize.y,
|
|
4968
|
+
w: gridSize.x,
|
|
4969
|
+
h: gridSize.y
|
|
4970
|
+
},
|
|
4971
|
+
rotated: false,
|
|
4972
|
+
trimmed: false,
|
|
4973
|
+
sourceSize: { w: gridSize.x, h: gridSize.y },
|
|
4974
|
+
spriteSourceSize: { x: 0, y: 0, w: gridSize.x, h: gridSize.y }
|
|
4975
|
+
};
|
|
4976
|
+
frames[key] = frame;
|
|
4977
|
+
index++;
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
return frames;
|
|
4981
|
+
}
|
|
4940
4982
|
/**
|
|
4941
4983
|
*
|
|
4942
4984
|
* @param name 图集的名称
|
|
@@ -6970,5 +7012,5 @@ class WidgetUtil {
|
|
|
6970
7012
|
}
|
|
6971
7013
|
var widgetutil = new WidgetUtil();
|
|
6972
7014
|
|
|
6973
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewModel, ViewModelComponent, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parsePlist, pathutil, randutil, resutil, routeViews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
7015
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewModel, ViewModelComponent, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeViews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
6974
7016
|
//# sourceMappingURL=index.esm.js.map
|