System.register("chunks:///main.js", ['./schema-659cd440.js', 'cc'], function (exports, module) { var _applyDecoratedDescriptor, _inheritsLoose, _initializerDefineProperty, _assertThisInitialized, _createClass, _createForOfIteratorHelperLoose, _asyncToGenerator, _regeneratorRuntime, _extends, Tables, TbGGlobalEnum, cclegacy, _decorator, Node, Color, Canvas, UITransform, instantiate, Label, RichText, Toggle, Button, director, Component, isValid, js, EventHandler, EventTarget, Enum, CCClass, game, JsonAsset, System, error, PhysicsSystem2D, CCObject, sp, assetManager, CCBoolean, CCInteger, BlockInputEvents, Sprite, color, v3, tween, Widget, resources, Prefab, Asset, v2, sys, SpriteFrame, Camera, UIRenderer, Vec2, bezier, rect, size, ProgressBar, NodeEventType, ScrollView, UIOpacity, EditBox, lerp; return { setters: [function (module) { _applyDecoratedDescriptor = module._; _inheritsLoose = module.a; _initializerDefineProperty = module.b; _assertThisInitialized = module.c; _createClass = module.d; _createForOfIteratorHelperLoose = module.e; _asyncToGenerator = module.f; _regeneratorRuntime = module.g; _extends = module.h; Tables = module.T; TbGGlobalEnum = module.i; }, function (module) { cclegacy = module.cclegacy; _decorator = module._decorator; Node = module.Node; Color = module.Color; Canvas = module.Canvas; UITransform = module.UITransform; instantiate = module.instantiate; Label = module.Label; RichText = module.RichText; Toggle = module.Toggle; Button = module.Button; director = module.director; Component = module.Component; isValid = module.isValid; js = module.js; EventHandler = module.EventHandler; EventTarget = module.EventTarget; Enum = module.Enum; CCClass = module.CCClass; game = module.game; JsonAsset = module.JsonAsset; System = module.System; error = module.error; PhysicsSystem2D = module.PhysicsSystem2D; CCObject = module.CCObject; sp = module.sp; assetManager = module.assetManager; CCBoolean = module.CCBoolean; CCInteger = module.CCInteger; BlockInputEvents = module.BlockInputEvents; Sprite = module.Sprite; color = module.color; v3 = module.v3; tween = module.tween; Widget = module.Widget; resources = module.resources; Prefab = module.Prefab; Asset = module.Asset; v2 = module.v2; sys = module.sys; SpriteFrame = module.SpriteFrame; Camera = module.Camera; UIRenderer = module.UIRenderer; Vec2 = module.Vec2; bezier = module.bezier; rect = module.rect; size = module.size; ProgressBar = module.ProgressBar; NodeEventType = module.NodeEventType; ScrollView = module.ScrollView; UIOpacity = module.UIOpacity; EditBox = module.EditBox; lerp = module.lerp; }], execute: function () { var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3; cclegacy._RF.push({}, "b2bd1+njXxJxaFY3ymm06WU", "debug-view-runtime-control", undefined); var ccclass = _decorator.ccclass, property = _decorator.property; var DebugViewRuntimeControl = (_dec = ccclass('internal.DebugViewRuntimeControl'), _dec2 = property(Node), _dec3 = property(Node), _dec4 = property(Node), _dec(_class = (_class2 = /*#__PURE__*/function (_Component) { _inheritsLoose(DebugViewRuntimeControl, _Component); function DebugViewRuntimeControl() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "compositeModeToggle", _descriptor, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "singleModeToggle", _descriptor2, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "EnableAllCompositeModeButton", _descriptor3, _assertThisInitialized(_this)); _this._single = 0; _this.strSingle = ['No Single Debug', 'Vertex Color', 'Vertex Normal', 'Vertex Tangent', 'World Position', 'Vertex Mirror', 'Face Side', 'UV0', 'UV1', 'UV Lightmap', 'Project Depth', 'Linear Depth', 'Fragment Normal', 'Fragment Tangent', 'Fragment Binormal', 'Base Color', 'Diffuse Color', 'Specular Color', 'Transparency', 'Metallic', 'Roughness', 'Specular Intensity', 'IOR', 'Direct Diffuse', 'Direct Specular', 'Direct All', 'Env Diffuse', 'Env Specular', 'Env All', 'Emissive', 'Light Map', 'Shadow', 'AO', 'Fresnel', 'Direct Transmit Diffuse', 'Direct Transmit Specular', 'Env Transmit Diffuse', 'Env Transmit Specular', 'Transmit All', 'Direct Internal Specular', 'Env Internal Specular', 'Internal All', 'Fog']; _this.strComposite = ['Direct Diffuse', 'Direct Specular', 'Env Diffuse', 'Env Specular', 'Emissive', 'Light Map', 'Shadow', 'AO', 'Normal Map', 'Fog', 'Tone Mapping', 'Gamma Correction', 'Fresnel', 'Transmit Diffuse', 'Transmit Specular', 'Internal Specular', 'TT']; _this.strMisc = ['CSM Layer Coloration', 'Lighting With Albedo']; _this.compositeModeToggleList = []; _this.singleModeToggleList = []; _this.miscModeToggleList = []; _this.textComponentList = []; _this.labelComponentList = []; _this.textContentList = []; _this.hideButtonLabel = void 0; _this._currentColorIndex = 0; _this.strColor = ['', '', '', '', '']; _this.color = [Color.WHITE, Color.BLACK, Color.RED, Color.GREEN, Color.BLUE]; return _this; } var _proto = DebugViewRuntimeControl.prototype; _proto.start = function start() { // get canvas resolution var canvas = this.node.parent.getComponent(Canvas); if (!canvas) { console.error('debug-view-runtime-control should be child of Canvas'); return; } var uiTransform = this.node.parent.getComponent(UITransform); var halfScreenWidth = uiTransform.width * 0.5; var halfScreenHeight = uiTransform.height * 0.5; var x = -halfScreenWidth + halfScreenWidth * 0.1, y = halfScreenHeight - halfScreenHeight * 0.1; var width = 200, height = 20; // new nodes var miscNode = this.node.getChildByName('MiscMode'); var buttonNode = instantiate(miscNode); buttonNode.parent = this.node; buttonNode.name = 'Buttons'; var titleNode = instantiate(miscNode); titleNode.parent = this.node; titleNode.name = 'Titles'; // title for (var i = 0; i < 2; i++) { var newLabel = instantiate(this.EnableAllCompositeModeButton.getChildByName('Label')); newLabel.setPosition(x + (i > 0 ? 50 + width * 2 : 150), y, 0.0); newLabel.setScale(0.75, 0.75, 0.75); newLabel.parent = titleNode; var _labelComponent = newLabel.getComponent(Label); _labelComponent.string = i ? '----------Composite Mode----------' : '----------Single Mode----------'; _labelComponent.color = Color.WHITE; _labelComponent.overflow = 0; this.labelComponentList[this.labelComponentList.length] = _labelComponent; } y -= height; // single var currentRow = 0; for (var _i = 0; _i < this.strSingle.length; _i++, currentRow++) { if (_i === this.strSingle.length >> 1) { x += width; currentRow = 0; } var newNode = _i ? instantiate(this.singleModeToggle) : this.singleModeToggle; newNode.setPosition(x, y - height * currentRow, 0.0); newNode.setScale(0.5, 0.5, 0.5); newNode.parent = this.singleModeToggle.parent; var textComponent = newNode.getComponentInChildren(RichText); textComponent.string = this.strSingle[_i]; this.textComponentList[this.textComponentList.length] = textComponent; this.textContentList[this.textContentList.length] = textComponent.string; newNode.on(Toggle.EventType.TOGGLE, this.toggleSingleMode, this); this.singleModeToggleList[_i] = newNode; } x += width; // buttons this.EnableAllCompositeModeButton.setPosition(x + 15, y, 0.0); this.EnableAllCompositeModeButton.setScale(0.5, 0.5, 0.5); this.EnableAllCompositeModeButton.on(Button.EventType.CLICK, this.enableAllCompositeMode, this); this.EnableAllCompositeModeButton.parent = buttonNode; var labelComponent = this.EnableAllCompositeModeButton.getComponentInChildren(Label); this.labelComponentList[this.labelComponentList.length] = labelComponent; var changeColorButton = instantiate(this.EnableAllCompositeModeButton); changeColorButton.setPosition(x + 90, y, 0.0); changeColorButton.setScale(0.5, 0.5, 0.5); changeColorButton.on(Button.EventType.CLICK, this.changeTextColor, this); changeColorButton.parent = buttonNode; labelComponent = changeColorButton.getComponentInChildren(Label); labelComponent.string = 'TextColor'; this.labelComponentList[this.labelComponentList.length] = labelComponent; var HideButton = instantiate(this.EnableAllCompositeModeButton); HideButton.setPosition(x + 200, y, 0.0); HideButton.setScale(0.5, 0.5, 0.5); HideButton.on(Button.EventType.CLICK, this.hideUI, this); HideButton.parent = this.node.parent; labelComponent = HideButton.getComponentInChildren(Label); labelComponent.string = 'Hide UI'; this.labelComponentList[this.labelComponentList.length] = labelComponent; this.hideButtonLabel = labelComponent; // misc y -= 40; for (var _i2 = 0; _i2 < this.strMisc.length; _i2++) { var _newNode = instantiate(this.compositeModeToggle); _newNode.setPosition(x, y - height * _i2, 0.0); _newNode.setScale(0.5, 0.5, 0.5); _newNode.parent = miscNode; var _textComponent = _newNode.getComponentInChildren(RichText); _textComponent.string = this.strMisc[_i2]; this.textComponentList[this.textComponentList.length] = _textComponent; this.textContentList[this.textContentList.length] = _textComponent.string; var toggleComponent = _newNode.getComponent(Toggle); toggleComponent.isChecked = _i2 ? true : false; _newNode.on(Toggle.EventType.TOGGLE, _i2 ? this.toggleLightingWithAlbedo : this.toggleCSMColoration, this); this.miscModeToggleList[_i2] = _newNode; } // composite y -= 150; for (var _i3 = 0; _i3 < this.strComposite.length; _i3++) { var _newNode2 = _i3 ? instantiate(this.compositeModeToggle) : this.compositeModeToggle; _newNode2.setPosition(x, y - height * _i3, 0.0); _newNode2.setScale(0.5, 0.5, 0.5); _newNode2.parent = this.compositeModeToggle.parent; var _textComponent2 = _newNode2.getComponentInChildren(RichText); _textComponent2.string = this.strComposite[_i3]; this.textComponentList[this.textComponentList.length] = _textComponent2; this.textContentList[this.textContentList.length] = _textComponent2.string; _newNode2.on(Toggle.EventType.TOGGLE, this.toggleCompositeMode, this); this.compositeModeToggleList[_i3] = _newNode2; } }; _proto.isTextMatched = function isTextMatched(textUI, textDescription) { var tempText = new String(textUI); var findIndex = tempText.search('>'); if (findIndex === -1) { return textUI === textDescription; } else { tempText = tempText.substr(findIndex + 1); tempText = tempText.substr(0, tempText.search('<')); return tempText === textDescription; } }; _proto.toggleSingleMode = function toggleSingleMode(toggle) { var debugView = director.root.debugView; var textComponent = toggle.getComponentInChildren(RichText); for (var i = 0; i < this.strSingle.length; i++) { if (this.isTextMatched(textComponent.string, this.strSingle[i])) { debugView.singleMode = i; } } }; _proto.toggleCompositeMode = function toggleCompositeMode(toggle) { var debugView = director.root.debugView; var textComponent = toggle.getComponentInChildren(RichText); for (var i = 0; i < this.strComposite.length; i++) { if (this.isTextMatched(textComponent.string, this.strComposite[i])) { debugView.enableCompositeMode(i, toggle.isChecked); } } }; _proto.toggleLightingWithAlbedo = function toggleLightingWithAlbedo(toggle) { var debugView = director.root.debugView; debugView.lightingWithAlbedo = toggle.isChecked; }; _proto.toggleCSMColoration = function toggleCSMColoration(toggle) { var debugView = director.root.debugView; debugView.csmLayerColoration = toggle.isChecked; }; _proto.enableAllCompositeMode = function enableAllCompositeMode(button) { var debugView = director.root.debugView; debugView.enableAllCompositeMode(true); for (var i = 0; i < this.compositeModeToggleList.length; i++) { var _toggleComponent = this.compositeModeToggleList[i].getComponent(Toggle); _toggleComponent.isChecked = true; } var toggleComponent = this.miscModeToggleList[0].getComponent(Toggle); toggleComponent.isChecked = false; debugView.csmLayerColoration = false; toggleComponent = this.miscModeToggleList[1].getComponent(Toggle); toggleComponent.isChecked = true; debugView.lightingWithAlbedo = true; }; _proto.hideUI = function hideUI(button) { var titleNode = this.node.getChildByName('Titles'); var activeValue = !titleNode.active; this.singleModeToggleList[0].parent.active = activeValue; this.miscModeToggleList[0].parent.active = activeValue; this.compositeModeToggleList[0].parent.active = activeValue; this.EnableAllCompositeModeButton.parent.active = activeValue; titleNode.active = activeValue; this.hideButtonLabel.string = activeValue ? 'Hide UI' : 'Show UI'; }; _proto.changeTextColor = function changeTextColor(button) { this._currentColorIndex++; if (this._currentColorIndex >= this.strColor.length) { this._currentColorIndex = 0; } for (var i = 0; i < this.textComponentList.length; i++) { this.textComponentList[i].string = this.strColor[this._currentColorIndex] + this.textContentList[i] + ''; } for (var _i4 = 0; _i4 < this.labelComponentList.length; _i4++) { this.labelComponentList[_i4].color = this.color[this._currentColorIndex]; } }; _proto.onLoad = function onLoad() {}; _proto.update = function update(deltaTime) {}; return DebugViewRuntimeControl; }(Component), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "compositeModeToggle", [_dec2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "singleModeToggle", [_dec3], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "EnableAllCompositeModeButton", [_dec4], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class2)) || _class); cclegacy._RF.pop(); cclegacy._RF.push({}, "37b5dGw2dRA+oN4mt8o31yV", "logger", undefined); var logger = { log: console.log.bind(console, "[LOG]"), warn: console.warn.bind(console, "[WARN]"), error: console.error.bind(console, "[ERROR]"), debug: console.debug.bind(console, "[DEBUG]") }; cclegacy._RF.pop(); cclegacy._RF.push({}, "8944dzqBeNNa7bSbmlbD8cX", "behavior-event-handler", undefined); var BehaviorEventHandler = /*#__PURE__*/function (_EventHandler) { _inheritsLoose(BehaviorEventHandler, _EventHandler); function BehaviorEventHandler() { return _EventHandler.apply(this, arguments) || this; } var _proto = BehaviorEventHandler.prototype; _proto.invoke = function invoke() { for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) { params[_key] = arguments[_key]; } var target = this.target; if (!isValid(target)) { return; } //@ts-ignore this._genCompIdIfNeeded(); var compType = js._getClassById(this._componentId); if (!compType) { logger.warn("invalid component type!"); return; } var comp = target.getComponent(compType); if (!isValid(comp)) { logger.warn("invalid component type!"); return; } var handler = comp[this.handler]; if (typeof handler !== 'function') { return; } if (this.customEventData != null && this.customEventData !== '') { params = params.slice(); params.push(this.customEventData); } var res = handler.apply(comp, params); return res; }; return BehaviorEventHandler; }(EventHandler); cclegacy._RF.pop(); cclegacy._RF.push({}, "321f5CYkz9N+ILA1mMOpOne", "behavior-event-target", undefined); var BehaviorEventTarget = /*#__PURE__*/function () { function BehaviorEventTarget() { this.eventTarget = new EventTarget(); } var _proto = BehaviorEventTarget.prototype; _proto.on = function on(key, callback, target, once) { return this.eventTarget.on("" + key, callback, target, once); }; _proto.once = function once(key, callback, target) { return this.eventTarget.once("" + key, callback, target); }; _proto.off = function off(key, callback, target) { this.eventTarget.off("" + key, callback, target); }; _proto.targetOff = function targetOff(typeOrTarget) { this.eventTarget.targetOff(typeOrTarget); }; _proto.emit = function emit(key) { //@ts-ignore var list = this.eventTarget._callbackTable && this.eventTarget._callbackTable[key]; var arg0 = arguments.length <= 1 ? undefined : arguments[1]; var arg1 = arguments.length <= 2 ? undefined : arguments[2]; if (list) { var rootInvoker = !list.isInvoking; list.isInvoking = true; var infos = list.callbackInfos; for (var i = 0, len = infos.length; i < len; ++i) { var info = infos[i]; if (info) { var callback = info.callback; var target = info.target; // Pre off once callbacks to avoid influence on logic in callback if (info.once) { this.eventTarget.off("" + key, callback, target); } // Lazy check validity of callback target, // if target is CCObject and is no longer valid, then remove the callback info directly if (!info.check()) { this.eventTarget.off("" + key, callback, target); } else if (target) { var result = callback.call(target, arg0, arg1); if (typeof arg1 != "undefined") { arg1 = result; } } else { var _result = callback(arg0, arg1); if (typeof arg1 != "undefined") { arg1 = _result; } } } } if (rootInvoker) { list.isInvoking = false; if (list.containCanceled) { list.purgeCanceled(); } } } return arg1; }; return BehaviorEventTarget; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "350f34LjONEe4Bsh3TtuUL0", "behavior-event-delegate", undefined); var BehaviorEventDelegate = /*#__PURE__*/function (_BehaviorEventTarget) { _inheritsLoose(BehaviorEventDelegate, _BehaviorEventTarget); function BehaviorEventDelegate(btNode, events, context) { var _this; _this = _BehaviorEventTarget.call(this) || this; _this._btNode = null; _this._events = null; _this._context = null; _this._onEnterHandler = null; _this._onExitHandler = null; _this._onEnableHandler = null; _this._onDisableHandler = null; _this._onUpdateHandler = null; if (!btNode || !events || !context) return _assertThisInitialized(_this); _this._btNode = btNode; _this._events = events; _this._context = context; _this._onEnterHandler = _this.createHandler(events.onEnter); _this._onExitHandler = _this.createHandler(events.onExit); _this._onUpdateHandler = _this.createHandler(events.onUpdate); _this._onEnableHandler = _this.createHandler(events.onEnable); _this._onDisableHandler = _this.createHandler(events.onDisable); return _this; } var _proto = BehaviorEventDelegate.prototype; _proto.createHandler = function createHandler(event) { var _event$node; if (!event || !((_event$node = event.node) != null && _event$node.path)) return null; var target = this._context.getTargetByPath(event.node.path); if (!target) { logger.warn("getTargetByPath error: path =", event.node.path); return null; } var component = target.getComponent(event.component.name); if (!component) { logger.warn("cann't find component by name = " + event.component.name); return null; } var handler = new BehaviorEventHandler(); handler.target = target; handler.component = event.component.name; handler.handler = event.method; handler.customEventData = event.data; return handler; }; _proto.onEnter = function onEnter() { var _this$_onEnterHandler; (_this$_onEnterHandler = this._onEnterHandler) == null ? void 0 : _this$_onEnterHandler.emit([this._btNode]); this.emit("onEnter", this._btNode); }; _proto.onEnable = function onEnable() { var _this$_onEnableHandle; (_this$_onEnableHandle = this._onEnableHandler) == null ? void 0 : _this$_onEnableHandle.emit([this._btNode]); this.emit("onEnable", this._btNode); }; _proto.onUpdate = function onUpdate(status) { if (this._onUpdateHandler) { status = this._onUpdateHandler.invoke(this._btNode, status); } status = this.emit("onUpdate", this._btNode, status); return status; }; _proto.onDisable = function onDisable() { var _this$_onDisableHandl; (_this$_onDisableHandl = this._onDisableHandler) == null ? void 0 : _this$_onDisableHandl.emit([this._btNode]); this.emit("onDisable", this._btNode); }; _proto.onExit = function onExit() { var _this$_onExitHandler; (_this$_onExitHandler = this._onExitHandler) == null ? void 0 : _this$_onExitHandler.emit([this._btNode]); this.emit("onExit", this._btNode); }; return BehaviorEventDelegate; }(BehaviorEventTarget); cclegacy._RF.pop(); cclegacy._RF.push({}, "8fed9E3uKNFf59dFBWzHpf9", "behavior-status", undefined); /* * @Author: OreoWang * @Email: ihc523@163.com * @Date: 2022-03-22 21:48:12 * @LastEditors: OreoWang * @LastEditTime: 2022-04-19 11:29:22 * @Description: */ var BehaviorStatus = /*#__PURE__*/function (BehaviorStatus) { BehaviorStatus[BehaviorStatus["None"] = 0] = "None"; BehaviorStatus[BehaviorStatus["Success"] = 1] = "Success"; BehaviorStatus[BehaviorStatus["Failure"] = 2] = "Failure"; BehaviorStatus[BehaviorStatus["Running"] = 3] = "Running"; BehaviorStatus[BehaviorStatus["Abort"] = 4] = "Abort"; BehaviorStatus[BehaviorStatus["Interrupting"] = 5] = "Interrupting"; return BehaviorStatus; }({}); cclegacy._RF.pop(); cclegacy._RF.push({}, "561acKJzndDgIHFTIxljzJ3", "behavior-node", undefined); var BehaviorNode = /*#__PURE__*/function () { function BehaviorNode(parent, nodeInfo, context) { this.$context = null; this.delegate = null; this.status = BehaviorStatus.None; /** 父节点 */ this._parent = null; this._nodeInfo = null; this._nodeConfig = null; this._isEnabled = false; this._mapStageKey = new Map(); this._logEnabled = true; this.$context = context; this._parent = parent; this._nodeInfo = nodeInfo; /** element */ if (!nodeInfo.config.label) { this._nodeConfig = nodeInfo.config; } else { this._nodeConfig = nodeInfo.config.label; } if (!this._nodeConfig.tag) { this._nodeConfig.tag = "TAG" + this._nodeConfig.order; } this.delegate = new BehaviorEventDelegate(this, this.nodeConfig.events, context); } var _proto = BehaviorNode.prototype; _proto.deserialize = function deserialize() { this.$context.onDeserialize(this); }; _proto.load = function load() { this.logLifeStatus("load"); }; _proto.destroy = function destroy() { this.delegate = null; this.logLifeStatus("destroy"); }; _proto.enter = function enter() { this.logLifeStatus("enter"); this.delegate.onEnter(); }; _proto.exit = function exit() { this.logLifeStatus("exit"); this.delegate.onExit(); }; _proto.enable = function enable() { if (this._isEnabled) { return; } this._isEnabled = true; this.delegate.onEnable(); this.logLifeStatus("enable"); }; _proto.disable = function disable() { if (!this._isEnabled) { return; } this._isEnabled = false; this.delegate.onDisable(); this.logLifeStatus("disable"); }; _proto.update = function update(status) { return this.onUpdate(status); }; _proto.execute = function execute(status) { return this.onExecute(status); }; _proto.onUpdate = function onUpdate(status) { status = this.delegate.onUpdate(status); this.logLifeStatus("update", status); return status; }; _proto.onExecute = function onExecute(status) { this.logLifeStatus("execute", status); return status; }; _proto.reset = function reset() { this.status = BehaviorStatus.None; }; _proto.getStageKey = function getStageKey(stage) { var key = this._mapStageKey.get(stage); if (!key) { key = "log" + stage.substring(0, 1).toUpperCase() + stage.substring(1); this._mapStageKey.set(stage, key); } return key; }; _proto.clearStageKey = function clearStageKey() { this._mapStageKey.clear(); }; _proto.getLogSymbol = function getLogSymbol() { return "node --"; }; _proto.getLogPrefix = function getLogPrefix() { return "bt-" + this.getLogSymbol() + " "; }; _proto.isLogEnabled = function isLogEnabled(stage) { var key = this.getStageKey(stage); return this.$context.isLogEnabled(key) && this._logEnabled; }; /** * 设置节点是否可以打印log * @param enabled * @param withChildren 是否同时设置子节点 */ _proto.setLogEnabled = function setLogEnabled(enabled, withChildren) { this._logEnabled = enabled; } /** * 生命周期各阶段执行状态日志输出(内部调用) * @param stage * @param status */ ; _proto.logLifeStatus = function logLifeStatus(stage, status) { if (typeof status == 'undefined') { status = this.status; } if (this.isLogEnabled(stage)) { this.$context.onHandleTreeLog(this.getLogPrefix() + " [" + this.nodeConfig.order + "]-[" + stage + "] [" + this.nodeConfig.title + "] " + BehaviorStatus[status] + " " + this.getAppendedLog(stage, status)); } } /** * 生命周期各阶段执行状态附加日志(子类按需要重写) * @param stage * @param status * @returns */ ; _proto.getAppendedLog = function getAppendedLog(stage, status) { return ''; } /** * 生命周期各阶段信息日志输出(可在外部按需要调用) * @param stage * @param info */ ; _proto.logLifeInfo = function logLifeInfo(stage, info) { if (this.isLogEnabled(stage)) { this.$context.onHandleTreeLog(this.getLogPrefix() + " [" + this.nodeConfig.order + "]-[" + stage + "] [" + this.nodeConfig.title + "] : info = " + info + " "); } }; _createClass(BehaviorNode, [{ key: "parent", get: function get() { return this._parent; } }, { key: "nodeInfo", get: function get() { return this._nodeInfo; } }, { key: "nodeConfig", get: function get() { return this._nodeConfig; } }, { key: "nodeType", get: function get() { return this.nodeInfo.type; } }, { key: "nodeTag", get: function get() { return this.nodeConfig.tag; } }, { key: "nodeOrder", get: function get() { return this.nodeConfig.order; } }, { key: "nodeTitle", get: function get() { return this.nodeConfig.title; } }]); return BehaviorNode; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "598daak/ABKr4ZMjXNx1U7L", "behavior-tree-utils", undefined); function getTargetByPath(node, path) { if (!path) { return null; } return node.getChildByPath(path); } function deserializeNode(parent, info, context, isElement) { if (isElement === void 0) { isElement = false; } var config; if (isElement) { config = info.config; } else { config = info.config.label; } var cls = js._getClassById(config.uuid); if (!cls) { return null; } var instance = new cls(parent, info, context); var properties = config.properties; for (var key in properties) { var property = properties[key]; if (typeof instance[key] == 'undefined') { if (property.TYPE == "bt.SharedDynamic") { if (property.path) { instance[key] = context.getTargetByPath(property.path); } else { instance[key] = property["default"]; } } } else if (!property.TYPE) { instance[key] = property["default"]; } else if (property.TYPE == "cc.Enum") { instance[key] = Number(property["default"]); } else if (property.TYPE == "cc.Node") { if (property.path) { instance[key] = context.getTargetByPath(property.path); } } else { if (property.TYPE.startsWith("bt.Shared")) { if (property.TYPE == "bt.SharedDynamic") { if (property.path) { instance[key] = context.getTargetByPath(property.path); } else { instance[key] = property["default"]; } } else { var variable = context.blackboard.getVariable(property["default"]); instance[key] = variable; } // console.warn("SharedVariable: ", instance[key]); } } if (typeof instance[key] == "undefined" || instance[key] == null) { logger.warn("Behavior [" + instance.nodeConfig.order + "]-[deserialize] [" + instance.nodeConfig.title + "]: key=" + key + ", value=" + instance[key]); } } instance.deserialize(); instance.load(); return instance; } cclegacy._RF.pop(); cclegacy._RF.push({}, "d187f0y0otP66VEvQnR2vCS", "behavior-node-entity", undefined); var BehaviorEntity = /*#__PURE__*/function (_BehaviorNode) { _inheritsLoose(BehaviorEntity, _BehaviorNode); function BehaviorEntity(parent, nodeInfo, context) { var _this; _this = _BehaviorNode.call(this, parent, nodeInfo, context) || this; _this.interrupters = new Set(); _this.decorators = []; _this.services = []; _this.children = []; return _this; } var _proto = BehaviorEntity.prototype; _proto.getLogSymbol = function getLogSymbol() { return "enti *-"; }; _proto.setLogEnabled = function setLogEnabled(enabled, withChildren) { if (withChildren === void 0) { withChildren = false; } _BehaviorNode.prototype.setLogEnabled.call(this, enabled, withChildren); this.decorators.forEach(function (v) { v.setLogEnabled(enabled, withChildren); }); this.services.forEach(function (v) { v.setLogEnabled(enabled, withChildren); }); if (withChildren) { this.children.forEach(function (v) { v.setLogEnabled(enabled, withChildren); }); } }; _proto.deserialize = function deserialize() { var $context = this.$context, nodeInfo = this.nodeInfo; if (nodeInfo.children) { for (var _iterator = _createForOfIteratorHelperLoose(nodeInfo.children), _step; !(_step = _iterator()).done;) { var child = _step.value; var options = child.config.label; if (options.uuid) { var instance = deserializeNode(this, child, $context); if (instance) { this.children.push(instance); } else { logger.error("Can't find class by uuid: ", options.uuid); } } else { logger.error("Can't find class uuid: ", options); } } } if (nodeInfo.elements) { for (var _iterator2 = _createForOfIteratorHelperLoose(nodeInfo.elements), _step2; !(_step2 = _iterator2()).done;) { var elem = _step2.value; var _options = elem.config; if (_options.uuid) { var _instance = deserializeNode(this, elem, $context, true); if (_instance) { if (elem.type === 'decorator') { this.decorators.push(_instance); } else if (elem.type === 'service') { this.services.push(_instance); } } else { logger.error("Can't find class by uuid: ", _options.uuid); } } } } _BehaviorNode.prototype.deserialize.call(this); }; _proto.destroy = function destroy() { for (var _iterator3 = _createForOfIteratorHelperLoose(this.decorators), _step3; !(_step3 = _iterator3()).done;) { var dec = _step3.value; dec.destroy(); } for (var _iterator4 = _createForOfIteratorHelperLoose(this.services), _step4; !(_step4 = _iterator4()).done;) { var ser = _step4.value; ser.destroy(); } for (var _iterator5 = _createForOfIteratorHelperLoose(this.children), _step5; !(_step5 = _iterator5()).done;) { var child = _step5.value; child.destroy(); } this.decorators.length = 0; this.services.length = 0; this.children.length = 0; this.clearInterrupter(); _BehaviorNode.prototype.destroy.call(this); }; _proto.reset = function reset() { for (var _iterator6 = _createForOfIteratorHelperLoose(this.decorators), _step6; !(_step6 = _iterator6()).done;) { var dec = _step6.value; dec.reset(); } for (var _iterator7 = _createForOfIteratorHelperLoose(this.services), _step7; !(_step7 = _iterator7()).done;) { var ser = _step7.value; ser.reset(); } for (var _iterator8 = _createForOfIteratorHelperLoose(this.children), _step8; !(_step8 = _iterator8()).done;) { var child = _step8.value; child.reset(); } _BehaviorNode.prototype.reset.call(this); }; _proto.disable = function disable() { if (this.status == BehaviorStatus.Running) { this.status = BehaviorStatus.Abort; } _BehaviorNode.prototype.disable.call(this); }; _proto.abort = function abort() { if (this.status == BehaviorStatus.Running) { this.disable(); } else { this.status = BehaviorStatus.Abort; } return this.onAbort(this.status); }; _proto.onAbort = function onAbort(status) { this.logLifeStatus("abort", status); return status; }; _proto.interrupt = function interrupt() { this.onInterrupt(this.status); return null; }; _proto.onInterrupt = function onInterrupt(status) { this.logLifeStatus("interrupt", status); return status; }; _proto.addInterrupter = function addInterrupter(node) { if (!this.interrupters.has(node)) { this.interrupters.add(node); } }; _proto.removeInterrupter = function removeInterrupter(node) { if (this.interrupters.has(node)) { this.interrupters["delete"](node); } }; _proto.clearInterrupter = function clearInterrupter() { this.interrupters.clear(); } /** * 节点执行逻辑。顺序为: * @describe 条件装饰器执行成功时: * @describe execute => condition(get result success) -> service -> self -> decorator => return * @describe 条件装饰器执行失败时: * @describe execute => condition(get result fail) => return * @param status * @returns */ ; _proto.execute = function execute(status) { if (typeof status == 'undefined') { status = this.status == BehaviorStatus.Running ? BehaviorStatus.Running : BehaviorStatus.None; } //如果当前节点是以打断其它节点的方式执行的,说明当前节点已经满足执行条件,这里不需要再执行条件判断了 if (status == BehaviorStatus.Interrupting) ;else { status = this.executeCondition(status); //如果节点执行条件不成功 if (status != BehaviorStatus.Success) { if (this.status == BehaviorStatus.Running) { this.status = status; this.disable(); } else { this.status = status; } return this.status; } } this.enter(); if (this.status != BehaviorStatus.Running) { this.enable(); } this.executeServices(status); this.status = status = this.update(status); this.logLifeStatus("execute"); this.status = status = this.executeDecorator(status); if (status == BehaviorStatus.Running) ;else { if (status == BehaviorStatus.Failure) ; this.disable(); } this.exit(); return this.status; } /** * 前置条件装饰器 * @description 主要用于判断当前节点是否可执行,比如可实现类似 ConditionalInverter.ts 中条件反转逻辑 * @param status * @returns */ ; _proto.executeCondition = function executeCondition(status) { var array = this.decorators; if (array.length > 0) { //装饰器的执行顺序都是从最后一个开始往上执行的 for (var index = array.length - 1; index >= 0; index--) { var element = array[index]; if (!element.isInterrupter && element.isCondition) { //将上一个 status 作为参数传入 //该参数使用比较灵活,视具体的 element.execute 方法实现而定 //比如可实现类似 ConditionalInverter 条件反转逻辑 status = element.executeDecorator(status); } } } else { //当节点没有挂载前置条件装饰器时,节点必然是可执行的 status = BehaviorStatus.Success; } return status; } /** * 后置结果装饰器 * @description 主要用于修改节点执行结果,比如可实现类似 Inverter.ts 中结果反转逻辑 * @param status * @returns */ ; _proto.executeDecorator = function executeDecorator(status) { var array = this.decorators; //装饰器的执行顺序都是从最后一个开始往上执行的 for (var index = array.length - 1; index >= 0; index--) { var element = array[index]; if (!element.isInterrupter && !element.isCondition) { //将上一个 status 作为参数传入 //该参数使用比较灵活,视具体的 element.execute 方法实现而定 //比如可实现类似 Inverter 结果反转逻辑 status = element.executeDecorator(status); } } return status; } /** * 节点服务,每次 tick 周期都会执行 * @param status */ ; _proto.executeServices = function executeServices(status) { var array = this.services; for (var index = array.length - 1; index >= 0; index--) { var element = array[index]; element.update(status); } }; _proto.checkCondition = function checkCondition(status) { return this.executeCondition(status); }; _createClass(BehaviorEntity, [{ key: "parent", get: function get() { return this._parent; } }, { key: "nodeInfo", get: function get() { return this._nodeInfo; } }, { key: "nodeConfig", get: function get() { return this._nodeConfig; } }]); return BehaviorEntity; }(BehaviorNode); cclegacy._RF.pop(); cclegacy._RF.push({}, "fc7c1rKdnpPDrBExoUlF1Ix", "behavior-composite", undefined); var BehaviorComposite = /*#__PURE__*/function (_BehaviorEntity) { _inheritsLoose(BehaviorComposite, _BehaviorEntity); function BehaviorComposite(parent, config, context) { var _this; _this = _BehaviorEntity.call(this, parent, config, context) || this; _this.isComposite = true; _this.lastRunning = -1; _this.isComposite = true; _this.lastRunning = -1; // 上一次running的索引 return _this; } var _proto = BehaviorComposite.prototype; _proto.getLogSymbol = function getLogSymbol() { return "comp --"; }; _proto.abort = function abort() { if (this.lastRunning != -1) { var child = this.children[this.lastRunning]; this.lastRunning = -1; if (child) { child.abort(); } } return _BehaviorEntity.prototype.abort.call(this); }; _proto.reset = function reset() { _BehaviorEntity.prototype.reset.call(this); this.lastRunning = -1; }; _proto.disable = function disable() { if (this.lastRunning != -1) { var child = this.children[this.lastRunning]; if (child) { child.status = this.status; child.disable(); } } _BehaviorEntity.prototype.disable.call(this); this.lastRunning = -1; }; return BehaviorComposite; }(BehaviorEntity); cclegacy._RF.pop(); cclegacy._RF.push({}, "bfa1fnFY/pJ0LgS+JRadAPW", "behavior-node-element", undefined); var BehaviorElement = /*#__PURE__*/function (_BehaviorNode) { _inheritsLoose(BehaviorElement, _BehaviorNode); function BehaviorElement(parent, nodeInfo, context) { var _this; _this = _BehaviorNode.call(this, parent, nodeInfo, context) || this; /** element(附属节点) 元素的拥有者 */ _this.owner = null; _this.isCondition = false; _this.isInterrupter = false; _this._parent = parent.parent; _this.owner = parent; return _this; } var _proto = BehaviorElement.prototype; _proto.getLogSymbol = function getLogSymbol() { return "elem &-"; }; _proto.execute = function execute(status) { status = this.update(status); this.status = status = _BehaviorNode.prototype.execute.call(this, status); return status; }; _proto.executeDecorator = function executeDecorator(status) { if (status == BehaviorStatus.None) { //装饰器默认都返回 Failure ,需要 execute 处理 status = BehaviorStatus.Failure; } this.enter(); this.enable(); status = this.execute(status); this.disable(); this.exit(); return status; }; _proto.executeInterrupt = function executeInterrupt(parent, child) { return BehaviorStatus.Failure; }; _createClass(BehaviorElement, [{ key: "parent", get: function get() { return this._parent; } }, { key: "nodeInfo", get: function get() { return this._nodeInfo; } }, { key: "nodeConfig", get: function get() { return this._nodeConfig; } }]); return BehaviorElement; }(BehaviorNode); cclegacy._RF.pop(); cclegacy._RF.push({}, "b1634+KPlZCK5vjGPuoU/tn", "behavior-decorator", undefined); var BehaviorDecorator = /*#__PURE__*/function (_BehaviorElement) { _inheritsLoose(BehaviorDecorator, _BehaviorElement); function BehaviorDecorator() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BehaviorElement.call.apply(_BehaviorElement, [this].concat(args)) || this; _this.isCondition = false; return _this; } var _proto = BehaviorDecorator.prototype; _proto.getLogSymbol = function getLogSymbol() { return "deco &@"; }; return BehaviorDecorator; }(BehaviorElement); cclegacy._RF.pop(); cclegacy._RF.push({}, "c3b96to9KJIQpOHVON0RIIK", "behavior-conditional", undefined); var BehaviorConditional = /*#__PURE__*/function (_BehaviorDecorator) { _inheritsLoose(BehaviorConditional, _BehaviorDecorator); function BehaviorConditional() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BehaviorDecorator.call.apply(_BehaviorDecorator, [this].concat(args)) || this; _this.isCondition = true; return _this; } var _proto = BehaviorConditional.prototype; _proto.getLogSymbol = function getLogSymbol() { return "cond &?"; }; return BehaviorConditional; }(BehaviorDecorator); cclegacy._RF.pop(); cclegacy._RF.push({}, "b3dc9cALvRJ77bQF13bnHSq", "utils", undefined); cclegacy._RF.pop(); cclegacy._RF.push({}, "87489uw7WxIWLzQjS3xbEnz", "behavior-event-declaration", undefined); cclegacy._RF.pop(); cclegacy._RF.push({}, "db4c2Jq5ZFCn4XOQx2mAUkz", "behavior-node-interface", undefined); /* * @Author: OreoWang * @Email: ihc523@163.com * @Date: 2022-04-11 10:03:31 * @LastEditors: OreoWang * @LastEditTime: 2022-04-19 10:17:33 * @Description: */ cclegacy._RF.pop(); cclegacy._RF.push({}, "32365qfSvpB75sCQ9KTMEPJ", "behavior-selector", undefined); var BehaviorSelector = /*#__PURE__*/function (_BehaviorComposite) { _inheritsLoose(BehaviorSelector, _BehaviorComposite); function BehaviorSelector() { return _BehaviorComposite.apply(this, arguments) || this; } var _proto = BehaviorSelector.prototype; _proto.getLogSymbol = function getLogSymbol() { return "sele *?"; }; _proto.update = function update(status) { var entity = this.interrupt(); // 执行子节点 var start = this.lastRunning >= 0 ? this.lastRunning : 0; this.lastRunning = -1; for (var i = start; i < this.children.length; i++) { var child = this.children[i]; if (entity && child == entity) { status = child.execute(BehaviorStatus.Interrupting); } else { status = child.execute(); } if (status === BehaviorStatus.Success) { break; } else if (status === BehaviorStatus.Running) { this.lastRunning = i; break; } else { continue; } } return _BehaviorComposite.prototype.update.call(this, status); }; _proto.interrupt = function interrupt() { var start = this.lastRunning >= 0 ? this.lastRunning : 0; // 执行子节点中断评估 if (this.interrupters.size > 0 && start > 0) { for (var i = 0; i < start; i++) { var child = this.children[i]; for (var _iterator = _createForOfIteratorHelperLoose(this.interrupters), _step; !(_step = _iterator()).done;) { var element = _step.value; if (element.owner == this || element.owner == child) { var status = element.executeInterrupt(this, child); if (status == BehaviorStatus.Success) { this.abort(); this.lastRunning = i; return child; } break; } } } } return null; }; return BehaviorSelector; }(BehaviorComposite); cclegacy._RF.pop(); cclegacy._RF.push({}, "59a0ckxD3NHC5bvEydtFVXP", "behavior-sequence", undefined); var BehaviorSequence = /*#__PURE__*/function (_BehaviorComposite) { _inheritsLoose(BehaviorSequence, _BehaviorComposite); function BehaviorSequence() { return _BehaviorComposite.apply(this, arguments) || this; } var _proto = BehaviorSequence.prototype; _proto.getLogSymbol = function getLogSymbol() { return "sequ *>"; }; _proto.update = function update(status) { var entity = this.interrupt(); // 执行子节点 var start = this.lastRunning >= 0 ? this.lastRunning : 0; this.lastRunning = -1; for (var i = start; i < this.children.length; i++) { var child = this.children[i]; if (entity && child == entity) { status = child.execute(BehaviorStatus.Interrupting); } else { status = child.execute(); } if (status === BehaviorStatus.Success) { continue; } else if (status === BehaviorStatus.Running) { this.lastRunning = i; } break; } return _BehaviorComposite.prototype.update.call(this, status); }; _proto.interrupt = function interrupt() { var start = this.lastRunning >= 0 ? this.lastRunning : 0; // 执行子节点中断评估 if (this.interrupters.size > 0 && start > 0) { for (var i = 0; i < start; i++) { var child = this.children[i]; for (var _iterator = _createForOfIteratorHelperLoose(this.interrupters), _step; !(_step = _iterator()).done;) { var element = _step.value; if (element.owner == this || element.owner == child) { var status = element.executeInterrupt(this, child); if (status == BehaviorStatus.Success) { this.abort(); this.lastRunning = i; return child; } break; } } } } return null; }; return BehaviorSequence; }(BehaviorComposite); cclegacy._RF.pop(); cclegacy._RF.push({}, "725ccmzywxHH61AYdRrNPR8", "behavior-parallel", undefined); var BehaviorParallel = /*#__PURE__*/function (_BehaviorComposite) { _inheritsLoose(BehaviorParallel, _BehaviorComposite); function BehaviorParallel(parent, config, context) { var _this; _this = _BehaviorComposite.call(this, parent, config, context) || this; //0 全部成功 -1 全部失败 XXX 指定数目 _this.threshold = null; _this._cacheStatus = []; _this._cacheStatus = []; // children执行状态Cache return _this; } var _proto = BehaviorParallel.prototype; _proto.getLogSymbol = function getLogSymbol() { return "para *="; }; _proto.update = function update(status) { var entity = this.interrupt(); var threshold = this.threshold && typeof this.threshold.value == 'number' ? this.threshold.value : 0; if (threshold == 0 || threshold > this.children.length) { threshold = this.children.length; } else if (threshold < 0) { threshold = 0; } // 执行子节点 var success = 0; var running = 0; for (var i = 0; i < this.children.length; i++) { if (this._cacheStatus[i] == null || this._cacheStatus[i] === BehaviorStatus.Running) { status = this.children[i].execute(); this._cacheStatus[i] = status; if (status === BehaviorStatus.Running) { running++; } } if (this._cacheStatus[i] === BehaviorStatus.Success) { success++; } } if (running === 0) { status = success === threshold ? BehaviorStatus.Success : BehaviorStatus.Failure; } else { status = BehaviorStatus.Running; } return _BehaviorComposite.prototype.update.call(this, status); }; _proto.interrupt = function interrupt() { var running = this._cacheStatus.filter(function (status) { return status == BehaviorStatus.Running; }); // 执行子节点中断评估 if (this.interrupters.size > 0 && running.length > 0) { for (var i = 0; i < this.children.length; i++) { var child = this.children[i]; if (child.status != BehaviorStatus.Running) { for (var _iterator = _createForOfIteratorHelperLoose(this.interrupters), _step; !(_step = _iterator()).done;) { var element = _step.value; var status = element.executeInterrupt(this, child); if (status == BehaviorStatus.Success) { this.abort(); // Sequence 序列节点,需要从 0 开始重新执行 // this.lastRunning = i; return child; } } } } } return null; }; _proto.abort = function abort() { if (this._cacheStatus.length > 0) { for (var index = 0; index < this._cacheStatus.length; index++) { var status = this._cacheStatus[index]; if (status == BehaviorStatus.Running) { this._cacheStatus[index] = BehaviorStatus.None; this.children[index].abort(); } } this._cacheStatus.length = 0; } return _BehaviorComposite.prototype.abort.call(this); }; _proto.reset = function reset() { _BehaviorComposite.prototype.reset.call(this); this._cacheStatus.length = 0; }; return BehaviorParallel; }(BehaviorComposite); cclegacy._RF.pop(); cclegacy._RF.push({}, "d33b7DahC1GAJkKGM7y7wV7", "behavior-service", undefined); var BehaviorService = /*#__PURE__*/function (_BehaviorElement) { _inheritsLoose(BehaviorService, _BehaviorElement); function BehaviorService() { return _BehaviorElement.apply(this, arguments) || this; } var _proto = BehaviorService.prototype; _proto.getLogSymbol = function getLogSymbol() { return "serv &$"; }; _proto.execute = function execute(status) { status = _BehaviorElement.prototype.execute.call(this, status); status = this.update(status); return status; }; return BehaviorService; }(BehaviorElement); cclegacy._RF.pop(); cclegacy._RF.push({}, "a226aAMoitM67DLVGDh9F5z", "behavior-task", undefined); var BehaviorTask = /*#__PURE__*/function (_BehaviorEntity) { _inheritsLoose(BehaviorTask, _BehaviorEntity); function BehaviorTask() { return _BehaviorEntity.apply(this, arguments) || this; } var _proto = BehaviorTask.prototype; _proto.getLogSymbol = function getLogSymbol() { return "task **"; }; _proto.update = function update(status) { //任务的默认实现直接返回 Failure,所以,在编辑器中使用 Task 节点时,必须指定 onUpdate Delegate status = BehaviorStatus.Failure; return _BehaviorEntity.prototype.update.call(this, status); }; return BehaviorTask; }(BehaviorEntity); cclegacy._RF.pop(); cclegacy._RF.push({}, "effa6ManatGXYSPAP9u5VPm", "behavior-tree-interface", undefined); cclegacy._RF.pop(); cclegacy._RF.push({}, "1cc92DWh91DaZ5/gyQo0OKu", "blackboard-declaration", undefined); var ENotifyObserver = Enum({ OnValueChange: "OnValueChange", //当黑板键的 value 值发生改变时 OnResultChange: "OnResultChange" //当黑板键的 value 值与 keyQuery 指定的比较 }); var EAbortType = Enum({ None: 0, Self: -1, //中断自身分支 LowerPriority: -1, //中断低优先级的兄弟分支 Both: -1 //以上两者 }); var EQueryKey = Enum({ IsEqualTo: 0, //黑板键的值是否与指定值相等 IsNotEqualTo: -1, IsSet: -1, //黑板键是否已指定 IsNotSet: -1 }); cclegacy._RF.pop(); cclegacy._RF.push({}, "95e19cn//tIRo3IxyglgCxw", "blackboard", undefined); var logger$1 = console; var Blackboard = /*#__PURE__*/function (_EventTarget) { _inheritsLoose(Blackboard, _EventTarget); /** * * @param data Object 必须是对象类型 */ function Blackboard(context, data) { var _this; _this = _EventTarget.call(this) || this; /** 运行时用户自定义数据(主要用于当前行为树运行时数据共享) */ _this.userData = new Map(); _this.context = null; /** 编辑器内导出的共享变量 */ _this.variables = null; /** 编辑器内导出的共享变量原始数据 */ _this.data = null; _this.init(context, data); return _this; } var _proto = Blackboard.prototype; _proto.destroy = function destroy() { this.clearUserData(); }; _proto.init = function init(context, data) { this.context = context; this.data = data; var array = data == null ? void 0 : data.variables; if (!array) return; this.variables = {}; for (var index = 0; index < array.length; index++) { var element = array[index]; var property = element.value; if (!(property != null && property.TYPE)) { logger$1.error("invalid type: ", element); continue; } if (!property.TYPE.startsWith("bt.Shared")) { logger$1.error("invalid type: ", element); continue; } var SharedClass = js.getClassByName(property.TYPE); if (SharedClass) { var shared = new SharedClass(this, element.name); if (property.TYPE == "bt.SharedNode") { if (property.path) { var node = context.getTargetByPath(property.path); shared.value = node; } } else { shared.value = property["default"]; } this.variables[element.name] = shared; } else { logger$1.error("getClassByName error: ", element); } } } /** * 获取黑板共享变量 * @param key * @returns */ ; _proto.getVariable = function getVariable(key) { return this.variables[key]; } /** * 设置共享变量的值 * variable.value = value * @param key * @param value * @returns */ ; _proto.setVariableValue = function setVariableValue(key, value) { var variable = this.getVariable(key); if (!variable) { logger$1.error('getVariable error: ', key); return; } variable.value = value; } /** * 获取用户自定义数据 * (主要用于当前行为树运行时数据共享) * @param key * @returns */ ; _proto.getUserData = function getUserData(key) { var value = this.userData.get(key); return value; } /** * 设置用户自定义数据 * (主要用于当前行为树运行时数据共享) * @param key * @param value */ ; _proto.setUserData = function setUserData(key, value) { this.userData.set(key, value); } /** * 清空用户自定义数据 */ ; _proto.clearUserData = function clearUserData() { this.userData.clear(); } /** * 获取全局静态数据 * (主要用于不同行为树间运行时数据共享) * @param key * @returns */ ; Blackboard.getGlobalData = function getGlobalData(key) { var value = Blackboard.globalData.get(key); return value; } /** * 设置全局静态数据 * (主要用于不同行为树间运行时数据共享) * @param key * @param value */ ; Blackboard.setGlobalData = function setGlobalData(key, value) { Blackboard.globalData.set(key, value); } /** * 清空全局静态数据 */ ; Blackboard.clearGlobalData = function clearGlobalData() { Blackboard.globalData.clear(); }; return Blackboard; }(EventTarget); /** 运行时全局静态数据(主要用于不同行为树间运行时数据共享) */ Blackboard.globalData = new Map(); cclegacy._RF.pop(); cclegacy._RF.push({}, "58b35orH25PP4LLmCV+MBD2", "shared-variable", undefined); var SharedVariable = /*#__PURE__*/function () { function SharedVariable(blackboard, name, value) { this.name = ""; this.original = void 0; this._value = void 0; this.blackboard = null; this.blackboard = blackboard; this.name = name; if (typeof value != 'undefined') { this.value = value; } } var _proto = SharedVariable.prototype; _proto.getValue = function getValue() { return this._value; }; _proto.setValue = function setValue(v) { var _this$blackboard; var oldValue = this._value; this._value = v; if (typeof this.original == 'undefined' || this.original == null) { this.original = v; } (_this$blackboard = this.blackboard) == null ? void 0 : _this$blackboard.emit(ENotifyObserver.OnValueChange, this, oldValue); }; _proto.reset = function reset() { this.value = this.original; }; _proto.toString = function toString() { return "" + this.value; }; _createClass(SharedVariable, [{ key: "value", get: function get() { return this.getValue(); }, set: function set(v) { this.setValue(v); } }]); return SharedVariable; }(); var SharedDynamic = function SharedDynamic() {}; cclegacy._RF.pop(); cclegacy._RF.push({}, "25976bKN55PnZEWYSjHLNFM", "shared-array", undefined); cclegacy._RF.pop(); var _dec$1, _class$1; cclegacy._RF.push({}, "bd58fP6ZdhF54nwzSGsS9It", "shared-boolean", undefined); var ccclass$1 = _decorator.ccclass; var SharedBoolean = (_dec$1 = ccclass$1("bt.SharedBoolean"), _dec$1(_class$1 = /*#__PURE__*/function (_SharedVariable) { _inheritsLoose(SharedBoolean, _SharedVariable); function SharedBoolean() { return _SharedVariable.apply(this, arguments) || this; } _createClass(SharedBoolean, [{ key: "value", get: function get() { return this.getValue(); }, set: function set(v) { this.setValue(v); } }]); return SharedBoolean; }(SharedVariable)) || _class$1); cclegacy._RF.pop(); cclegacy._RF.push({}, "26f03Cv4M9NEY02tvVyaFMW", "shared-custom", undefined); cclegacy._RF.pop(); var _dec$2, _class$2; cclegacy._RF.push({}, "15057KvK3JE3objFh0DjTT8", "shared-node", undefined); var ccclass$2 = _decorator.ccclass; var SharedNode = (_dec$2 = ccclass$2("bt.SharedNode"), _dec$2(_class$2 = /*#__PURE__*/function (_SharedVariable) { _inheritsLoose(SharedNode, _SharedVariable); function SharedNode() { return _SharedVariable.apply(this, arguments) || this; } _createClass(SharedNode, [{ key: "value", get: function get() { return this.getValue(); }, set: function set(v) { this.setValue(v); } }]); return SharedNode; }(SharedVariable)) || _class$2); cclegacy._RF.pop(); var _dec$3, _class$3; cclegacy._RF.push({}, "affcexAdSJPkqj/VgDzFAUX", "shared-number", undefined); var ccclass$3 = _decorator.ccclass; var SharedNumber = (_dec$3 = ccclass$3("bt.SharedNumber"), _dec$3(_class$3 = /*#__PURE__*/function (_SharedVariable) { _inheritsLoose(SharedNumber, _SharedVariable); function SharedNumber() { return _SharedVariable.apply(this, arguments) || this; } _createClass(SharedNumber, [{ key: "value", get: function get() { return this.getValue(); }, set: function set(v) { this.setValue(v); } }]); return SharedNumber; }(SharedVariable)) || _class$3); cclegacy._RF.pop(); var _dec$4, _class$4; cclegacy._RF.push({}, "a5dd5r6IwZOA6RWiqcq8wRW", "shared-string", undefined); var ccclass$4 = _decorator.ccclass; var SharedString = (_dec$4 = ccclass$4("bt.SharedString"), _dec$4(_class$4 = /*#__PURE__*/function (_SharedVariable) { _inheritsLoose(SharedString, _SharedVariable); function SharedString() { return _SharedVariable.apply(this, arguments) || this; } _createClass(SharedString, [{ key: "value", get: function get() { return this.getValue(); }, set: function set(v) { this.setValue(v); } }]); return SharedString; }(SharedVariable)) || _class$4); cclegacy._RF.pop(); cclegacy._RF.push({}, "3eb5dim9SdATqOrRxxDMaNE", "preprocess-class", undefined); //@ts-ignore var legacyCC = window.cc; function _wrapOptions(isGetset, _default, type) { var res = isGetset ? { _short: true } : { _short: true, "default": _default }; if (type) { res.type = type; } return res; } var PrimitiveType = /*#__PURE__*/function () { function PrimitiveType(name, defaultValue) { this.name = void 0; this["default"] = void 0; this.name = name; this["default"] = defaultValue; } var _proto = PrimitiveType.prototype; _proto.toString = function toString() { return this.name; }; return PrimitiveType; }(); function getFullFormOfProperty(options, isGetset) { var isLiteral = options && options.constructor === Object; if (!isLiteral) { if (Array.isArray(options) && options.length > 0) { return _wrapOptions(isGetset, [], options); } else if (typeof options === 'function') { var type = options; return _wrapOptions(isGetset, js.isChildClassOf(type, legacyCC.ValueType) ? new type() : null, type); } else if (options instanceof PrimitiveType) { return _wrapOptions(isGetset, options["default"]); } else { return _wrapOptions(isGetset, options); } } return null; } cclegacy._RF.pop(); cclegacy._RF.push({}, "69d4cf3GO1EUqdPUNbbQMV/", "tools", undefined); /** * @packageDocumentation * @module decorator */ // import { DEV } from 'internal:constants'; // import { CCClass } from '../class'; // import { error } from '../../platform/debug'; // import { js } from '../../utils/js'; /** * @en * The signature compatible with both TypeScript legacy decorator and Babel legacy decorator. * The `descriptor` argument will only appear in Babel case. * @zh * 该签名同时兼容 TypeScript legacy 装饰器以及 Babel legacy 装饰器。 * `descriptor` 参数只会在 Babel 情况下出现。 */ /** * @en * A class(or property) decorator which does nothing. * @zh * 一个什么也不做的类(或属性)装饰器。 */ var emptyDecorator = function emptyDecorator() {}; /** * @en * A function which ignore all arguments and return the `emptyDecorator`. * @zh * 一个忽略所有参数并且返回 `emptyDecorator` 的函数。 */ var emptyDecoratorFn = function emptyDecoratorFn() { return emptyDecorator; }; /** * @en * Make a smart class decorator which can properly handle the following form decorator syntax: * - `@x` * - `@x(arg0)` * * and forward both the decorated class and the `arg0` (in first form, `arg0` is forward as `undefined`) to * `decorate`. * @zh * 创建一个智能类装饰器,它能正确地处理以下形式的装饰器语法: * - `@x` * - `@x(arg0)` * * 并且,将被装饰的类和 `arg0`(若是第一种形式,`arg0` 就是 `undefined`)一起转发给 `decorate`。 * @param decorate */ function makeSmartClassDecorator(decorate) { return proxyFn; function proxyFn(target) { if (typeof target === 'function') { // If no parameter specified return decorate(target); } else { return function (constructor) { return decorate(constructor, target); }; } } } // caches for class construction var CACHE_KEY = '__ccclassCache__'; function getClassCache(ctor, decoratorName) { return getSubDict(ctor, CACHE_KEY); } function getSubDict(obj, key) { return obj[key] || (obj[key] = {}); } cclegacy._RF.pop(); cclegacy._RF.push({}, "1aabe9fggxCH6/CGCKiwuwr", "btclass", undefined); //@ts-ignore var legacyCC$1 = window.cc; /** * @en Declare a standard class as a CCClass, please refer to the [document](https://docs.cocos.com/creator3d/manual/zh/scripting/ccclass.html) * @zh 将标准写法的类声明为 CC 类,具体用法请参阅[类型定义](https://docs.cocos.com/creator3d/manual/zh/scripting/ccclass.html)。 * @param name - The class name used for serialization. * @example * ```ts * import { _decorator, Component } from 'cc'; * const {ccclass} = _decorator; * * // define a CCClass, omit the name * @ccclass * class NewScript extends Component { * // ... * } * * // define a CCClass with a name * @ccclass('LoginData') * class LoginData { * // ... * } * ``` */ var ccclass$5 = makeSmartClassDecorator(function (constructor, name) { var base = js.getSuper(constructor); // console.log("base: ---------> ", constructor.name, base.name); if (base === Object) { base = null; } var proto = { name: name, "extends": base, ctor: constructor }; var cache = constructor[CACHE_KEY]; if (cache) { var decoratedProto = cache.proto; if (decoratedProto) { // decoratedProto.properties = createProperties(ctor, decoratedProto.properties); js.mixin(proto, decoratedProto); } constructor[CACHE_KEY] = undefined; } var res = CCClass(proto); var frame = legacyCC$1._RF.peek(); if (!frame || frame.cls != constructor) { console.warn("invalid btclass: ", constructor.name); return; } js._setClassId(frame.uuid, res); return res; }); /** * @zh 向编辑器注册生命周期委托。例如 @delegate(['onUpdate', 'onEnable'])。 * @param events: TArrayDelegateEvents * @example * @bt.ccclass * @bt.delegate(['onUpdate', 'onEnable']) * class NewTask extends bt.Task { * // ... * } */ var delegate = emptyDecoratorFn; cclegacy._RF.pop(); cclegacy._RF.push({}, "82f578gnCdKxaATFwR4pCJU", "property", undefined); /** * @zh CCClass 属性选项。 * @en CCClass property options */ /** * @en Declare as a CCClass property with options * @zh 声明属性为 CCClass 属性。 * @param options property options */ /** * @en Declare as a CCClass property with the property type * @zh 标注属性为 cc 属性。
* 等价于`@property({type})`。 * @param type A {{ccclass}} type or a {{ValueType}} */ /** * @en Declare as a CCClass property * @zh 标注属性为 cc 属性。
* 等价于`@property()`。 */ function property$1(target, propertyKey, descriptor) { var options = null; function normalized(target, propertyKey, descriptor) { var cache = getClassCache(target.constructor); if (cache) { var ccclassProto = getSubDict(cache, 'proto'); var properties = getSubDict(ccclassProto, 'properties'); genProperty(target.constructor, properties, propertyKey, options, descriptor, cache); } } if (target === undefined) { // @property() => LegacyPropertyDecorator return property$1({ type: undefined }); } else if (typeof propertyKey === 'undefined') { // @property(options) => LegacyPropertyDescriptor // @property(type) => LegacyPropertyDescriptor options = target; return normalized; } else { // @property normalized(target, propertyKey, descriptor); } } function getDefaultFromInitializer(initializer) { var value; try { value = initializer(); } catch (e) { // just lazy initialize by CCClass return initializer; } if (typeof value !== 'object' || value === null) { // string boolean number function undefined null return value; } else { // The default attribute will not be used in ES6 constructor actually, // so we don't need to simplify into `{}` or `[]` or vec2 completely. return initializer; } } function extractActualDefaultValues(ctor) { var dummyObj; try { dummyObj = new ctor(); } catch (e) { return {}; } return dummyObj; } function genProperty(ctor, properties, propertyKey, options, descriptor, cache) { var fullOptions; var isGetset = descriptor && (descriptor.get || descriptor.set); if (options) { fullOptions = getFullFormOfProperty(options, isGetset); } var existsPropertyRecord = properties[propertyKey]; var propertyRecord = js.mixin(existsPropertyRecord || {}, fullOptions || options || {}); if (isGetset) { if (descriptor.get) { propertyRecord.get = descriptor.get; } if (descriptor.set) { propertyRecord.set = descriptor.set; } } else { if (descriptor) { // In case of Babel, if an initializer is given for class field. // That initializer is passed to `descriptor.initializer`. // babel if (descriptor.initializer) { propertyRecord["default"] = getDefaultFromInitializer(descriptor.initializer); } } else { // In case of TypeScript, we can not directly capture the initializer. // We have to be hacking to extract the value. var actualDefaultValues = cache["default"] || (cache["default"] = extractActualDefaultValues(ctor)); if (actualDefaultValues.hasOwnProperty(propertyKey)) { propertyRecord["default"] = actualDefaultValues[propertyKey]; } } } properties[propertyKey] = propertyRecord; // console.log("property: ", js.getClassName(ctor), propertyKey, propertyRecord); } cclegacy._RF.pop(); cclegacy._RF.push({}, "3cf28uQHLlEw6vk4w9KA679", "main", undefined); cclegacy._RF.pop(); var _dec$5, _dec2$1, _class$5, _class2$1, _descriptor$1; cclegacy._RF.push({}, "9c55eEnAU5MQ6P8rjZaM2YO", "Parallel", undefined); var Parallel = (_dec$5 = ccclass$5('bt.Parallel'), _dec2$1 = property$1({ type: SharedNumber, tooltip: "0 全部成功 -1 全部失败 XXX 指定数目" }), _dec$5(_class$5 = (_class2$1 = /*#__PURE__*/function (_bt$BehaviorParallel) { _inheritsLoose(Parallel, _bt$BehaviorParallel); function Parallel() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorParallel.call.apply(_bt$BehaviorParallel, [this].concat(args)) || this; //0 全部成功 -1 全部失败 XXX 指定数目 _initializerDefineProperty(_this, "threshold", _descriptor$1, _assertThisInitialized(_this)); return _this; } return Parallel; }(BehaviorParallel), _descriptor$1 = _applyDecoratedDescriptor(_class2$1.prototype, "threshold", [_dec2$1], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _class2$1)) || _class$5); cclegacy._RF.pop(); var _dec$6, _class$6; cclegacy._RF.push({}, "8a33895bcRHv7EVmZOdpDNK", "Selector", undefined); var Selector = (_dec$6 = ccclass$5('bt.Selector'), _dec$6(_class$6 = /*#__PURE__*/function (_bt$BehaviorSelector) { _inheritsLoose(Selector, _bt$BehaviorSelector); function Selector() { return _bt$BehaviorSelector.apply(this, arguments) || this; } return Selector; }(BehaviorSelector)) || _class$6); cclegacy._RF.pop(); var _dec$7, _class$7; cclegacy._RF.push({}, "7c895CfOwBCgKYk2gJEdRCX", "Sequence", undefined); var Sequence = (_dec$7 = ccclass$5('bt.Sequence'), _dec$7(_class$7 = /*#__PURE__*/function (_bt$BehaviorSequence) { _inheritsLoose(Sequence, _bt$BehaviorSequence); function Sequence() { return _bt$BehaviorSequence.apply(this, arguments) || this; } return Sequence; }(BehaviorSequence)) || _class$7); cclegacy._RF.pop(); var _dec$8, _dec2$2, _class$8; cclegacy._RF.push({}, "4d930L3FnhCv71nra+1BGRk", "Conditional", undefined); // const { Behavior } = Node; var Conditional = (_dec$8 = ccclass$5('bt.Conditional'), _dec2$2 = delegate(), _dec$8(_class$8 = _dec2$2(_class$8 = /*#__PURE__*/function (_bt$BehaviorCondition) { _inheritsLoose(Conditional, _bt$BehaviorCondition); function Conditional() { return _bt$BehaviorCondition.apply(this, arguments) || this; } var _proto = Conditional.prototype; _proto.execute = function execute(status) { return _bt$BehaviorCondition.prototype.execute.call(this, status); }; return Conditional; }(BehaviorConditional)) || _class$8) || _class$8); cclegacy._RF.pop(); var _dec$9, _dec2$3, _class$9; cclegacy._RF.push({}, "337ccG8GiZNvZRj2auHv58h", "Decorator", undefined); // const { Behavior } = Node; var Decorator = (_dec$9 = ccclass$5('bt.Decorator'), _dec2$3 = delegate(), _dec$9(_class$9 = _dec2$3(_class$9 = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(Decorator, _bt$BehaviorDecorator); function Decorator() { return _bt$BehaviorDecorator.apply(this, arguments) || this; } var _proto = Decorator.prototype; _proto.execute = function execute(status) { return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return Decorator; }(BehaviorDecorator)) || _class$9) || _class$9); cclegacy._RF.pop(); var _dec$a, _class$a; cclegacy._RF.push({}, "0c445cwFwlFJIy1bJtPqjcb", "ForceFailure", undefined); // const { Behavior } = Node; var ForceFailure = (_dec$a = ccclass$5('bt.ForceFailure'), _dec$a(_class$a = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(ForceFailure, _bt$BehaviorDecorator); function ForceFailure() { return _bt$BehaviorDecorator.apply(this, arguments) || this; } var _proto = ForceFailure.prototype; _proto.execute = function execute(status) { status = BehaviorStatus.Failure; return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return ForceFailure; }(BehaviorDecorator)) || _class$a); cclegacy._RF.pop(); var _dec$b, _dec2$4, _dec3$1, _dec4$1, _dec5, _dec6, _class$b, _class2$2, _descriptor$2, _descriptor2$1, _descriptor3$1, _descriptor4, _descriptor5; cclegacy._RF.push({}, "84cc7xNzHpN+6XMX/fg4L5x", "ForceInterrupter", undefined); var ForceInterrupter = (_dec$b = ccclass$5('bt.ForceInterrupter'), _dec2$4 = property$1({ type: ENotifyObserver, tooltip: "触发时机(比较结果改变时/黑板键的值改变时)" }), _dec3$1 = property$1({ type: EAbortType, tooltip: "中断类型(Self:中断自身分支;LowerPriority:中断低优先级的兄弟分支)" }), _dec4$1 = property$1({ type: EQueryKey, tooltip: "比较方式" }), _dec5 = property$1({ type: SharedDynamic, tooltip: "用于与 {{target}} 对应黑板键的值进行比较" }), _dec6 = property$1({ type: SharedVariable, tooltip: "指定黑板键" }), _dec$b(_class$b = (_class2$2 = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(ForceInterrupter, _bt$BehaviorDecorator); function ForceInterrupter() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorDecorator.call.apply(_bt$BehaviorDecorator, [this].concat(args)) || this; _initializerDefineProperty(_this, "notifyType", _descriptor$2, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "abortType", _descriptor2$1, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "keyQuery", _descriptor3$1, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "targetValue", _descriptor4, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "target", _descriptor5, _assertThisInitialized(_this)); _this._isSet = false; _this._isEqual = false; return _this; } var _proto = ForceInterrupter.prototype; _proto.load = function load() { var _this$target, _this$target2; _bt$BehaviorDecorator.prototype.load.call(this); this.$context.blackboard.on(ENotifyObserver.OnValueChange, this.onValueChange, this); this._isSet = typeof ((_this$target = this.target) == null ? void 0 : _this$target.value) != 'undefined' ? true : false; this._isEqual = ((_this$target2 = this.target) == null ? void 0 : _this$target2.value) == this.targetValue ? true : false; }; _proto.destroy = function destroy() { this.$context.blackboard.targetOff(this); this.reset(); _bt$BehaviorDecorator.prototype.destroy.call(this); }; _proto.reset = function reset() { this._isSet = false; this._isEqual = false; }; _proto.onValueChange = function onValueChange(shared, oldValue) { if (this.abortType === EAbortType.None || !this.target) { return; } if (this.target.name != shared.name) { return; } //值改变时触发 if (this.notifyType == ENotifyObserver.OnValueChange) { if (this.target.value == oldValue) { return; } } //结果改变时触发 else if (this.notifyType == ENotifyObserver.OnResultChange) { var isSet = typeof (shared == null ? void 0 : shared.value) != 'undefined' ? true : false; if (this.keyQuery == EQueryKey.IsSet && isSet) { if (this._isSet == isSet) { return; } } else if (this.keyQuery == EQueryKey.IsNotSet && !isSet) { if (this._isSet == isSet) { return; } } this._isSet = isSet; var isEqual = (shared == null ? void 0 : shared.value) == this.targetValue ? true : false; if (this.keyQuery == EQueryKey.IsEqualTo && isEqual) { if (this._isEqual == isEqual) { return; } } else if (this.keyQuery == EQueryKey.IsNotEqualTo && !isEqual) { if (this._isEqual == isEqual) { return; } } this._isEqual = isEqual; } if (this.abortType == EAbortType.LowerPriority || this.abortType == EAbortType.Both) { this.parent.abort(); } if (this.abortType == EAbortType.Self || this.abortType == EAbortType.Both) { this.owner.abort(); } }; _proto.execute = function execute(status) { return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return ForceInterrupter; }(BehaviorDecorator), (_descriptor$2 = _applyDecoratedDescriptor(_class2$2.prototype, "notifyType", [_dec2$4], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ENotifyObserver.OnValueChange; } }), _descriptor2$1 = _applyDecoratedDescriptor(_class2$2.prototype, "abortType", [_dec3$1], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return EAbortType.None; } }), _descriptor3$1 = _applyDecoratedDescriptor(_class2$2.prototype, "keyQuery", [_dec4$1], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return EQueryKey.IsEqualTo; } }), _descriptor4 = _applyDecoratedDescriptor(_class2$2.prototype, "targetValue", [_dec5], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return undefined; } }), _descriptor5 = _applyDecoratedDescriptor(_class2$2.prototype, "target", [_dec6], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class2$2)) || _class$b); cclegacy._RF.pop(); var _dec$c, _class$c; cclegacy._RF.push({}, "ef4acEffpdO1IBYSHuf4GgQ", "ForceSuccessful", undefined); // const { Behavior } = Node; var ForceSuccessful = (_dec$c = ccclass$5('bt.ForceSuccessful'), _dec$c(_class$c = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(ForceSuccessful, _bt$BehaviorDecorator); function ForceSuccessful() { return _bt$BehaviorDecorator.apply(this, arguments) || this; } var _proto = ForceSuccessful.prototype; _proto.execute = function execute(status) { status = BehaviorStatus.Success; return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return ForceSuccessful; }(BehaviorDecorator)) || _class$c); cclegacy._RF.pop(); var _dec$d, _dec2$5, _class$d, _class2$3, _descriptor$3; cclegacy._RF.push({}, "b7632MgaNFI7po3/OStKHXa", "Interrupter", undefined); var Interrupter = (_dec$d = ccclass$5('bt.Interrupter'), _dec2$5 = property$1({ type: EAbortType, tooltip: "中断类型(Self:中断自身分支;LowerPriority:中断低优先级的兄弟分支)" }), _dec$d(_class$d = (_class2$3 = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(Interrupter, _bt$BehaviorDecorator); function Interrupter() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorDecorator.call.apply(_bt$BehaviorDecorator, [this].concat(args)) || this; _this.isInterrupter = true; _initializerDefineProperty(_this, "abortType", _descriptor$3, _assertThisInitialized(_this)); return _this; } var _proto = Interrupter.prototype; _proto.getLogSymbol = function getLogSymbol() { return "inte &!"; }; _proto.load = function load() { _bt$BehaviorDecorator.prototype.load.call(this); if (this.abortType == EAbortType.LowerPriority || this.abortType == EAbortType.Both) { this.parent.addInterrupter(this); } if (this.abortType == EAbortType.Self || this.abortType == EAbortType.Both) { this.owner.addInterrupter(this); } }; _proto.destroy = function destroy() { _bt$BehaviorDecorator.prototype.destroy.call(this); }; _proto.execute = function execute(status) { return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; _proto.executeInterrupt = function executeInterrupt(parent, child) { this.enter(); this.enable(); var status = BehaviorStatus.Failure; if (this.owner == parent || this.owner == child) { status = child.checkCondition(status); } this.execute(status); this.disable(); this.exit(); return status; }; return Interrupter; }(BehaviorDecorator), _descriptor$3 = _applyDecoratedDescriptor(_class2$3.prototype, "abortType", [_dec2$5], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return EAbortType.None; } }), _class2$3)) || _class$d); cclegacy._RF.pop(); var _dec$e, _class$e; cclegacy._RF.push({}, "1c7eeM24ORNuLjT/Wv26orE", "Inverter", undefined); // const { Behavior } = Node; var Inverter = (_dec$e = ccclass$5('bt.Inverter'), _dec$e(_class$e = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(Inverter, _bt$BehaviorDecorator); function Inverter() { return _bt$BehaviorDecorator.apply(this, arguments) || this; } var _proto = Inverter.prototype; _proto.execute = function execute(status) { if (status == BehaviorStatus.Success) { status = BehaviorStatus.Failure; } else if (status == BehaviorStatus.Failure) { status = BehaviorStatus.Success; } return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return Inverter; }(BehaviorDecorator)) || _class$e); cclegacy._RF.pop(); var _dec$f, _dec2$6, _class$f, _class2$4, _descriptor$4; cclegacy._RF.push({}, "6ad35yq9I9K2IS8pb4WAfWp", "Repeater", undefined); // const { Behavior } = Node; var Repeater = (_dec$f = ccclass$5('bt.Repeater'), _dec2$6 = property$1({ tooltip: "Repeat times / 重复次数" }), _dec$f(_class$f = (_class2$4 = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(Repeater, _bt$BehaviorDecorator); function Repeater() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorDecorator.call.apply(_bt$BehaviorDecorator, [this].concat(args)) || this; _initializerDefineProperty(_this, "times", _descriptor$4, _assertThisInitialized(_this)); _this.current = 0; return _this; } var _proto = Repeater.prototype; _proto.reset = function reset() { _bt$BehaviorDecorator.prototype.reset.call(this); this.current = 0; }; _proto.execute = function execute(status) { if (!this.checkValid(status)) { //运行中的任务强行返回 Success if (status == BehaviorStatus.Running) { status = BehaviorStatus.Success; } } else { status = BehaviorStatus.Running; } return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; _proto.checkValid = function checkValid(status) { //默认值为0,表示无限重复 if (this.times == 0) { return true; } this.current++; if (this.times > this.current) { return true; } else { return false; } }; _proto.getAppendedLog = function getAppendedLog(stage, status) { if (stage == 'execute') { return "[ Repeat times: " + this.current + " / " + this.times + " ]"; } return ''; }; return Repeater; }(BehaviorDecorator), _descriptor$4 = _applyDecoratedDescriptor(_class2$4.prototype, "times", [_dec2$6], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), _class2$4)) || _class$f); cclegacy._RF.pop(); var _dec$g, _dec2$7, _class$g; cclegacy._RF.push({}, "c1106os1qVMUp8XmuX12d+2", "Service", undefined); var Service = (_dec$g = ccclass$5('bt.Service'), _dec2$7 = delegate(), _dec$g(_class$g = _dec2$7(_class$g = /*#__PURE__*/function (_bt$BehaviorService) { _inheritsLoose(Service, _bt$BehaviorService); function Service() { return _bt$BehaviorService.apply(this, arguments) || this; } return Service; }(BehaviorService)) || _class$g) || _class$g); cclegacy._RF.pop(); var _dec$h, _class$h; cclegacy._RF.push({}, "1c46dvoGYRMwIvpHqM2pAfV", "Idle", undefined); var Idle = (_dec$h = ccclass$5('bt.Idle'), _dec$h(_class$h = /*#__PURE__*/function (_bt$BehaviorTask) { _inheritsLoose(Idle, _bt$BehaviorTask); function Idle() { return _bt$BehaviorTask.apply(this, arguments) || this; } var _proto = Idle.prototype; _proto.update = function update(status) { status = BehaviorStatus.Running; return this.onUpdate(status); }; return Idle; }(BehaviorTask)) || _class$h); cclegacy._RF.pop(); var _dec$i, _dec2$8, _dec3$2, _class$i, _class2$5, _descriptor$5; cclegacy._RF.push({}, "116019tPZREe7GOBui/GuKW", "Log", undefined); var Log = (_dec$i = ccclass$5('bt.Log'), _dec2$8 = delegate(), _dec3$2 = property$1({ type: SharedString }), _dec$i(_class$i = _dec2$8(_class$i = (_class2$5 = /*#__PURE__*/function (_bt$BehaviorTask) { _inheritsLoose(Log, _bt$BehaviorTask); function Log() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorTask.call.apply(_bt$BehaviorTask, [this].concat(args)) || this; _initializerDefineProperty(_this, "message", _descriptor$5, _assertThisInitialized(_this)); return _this; } var _proto = Log.prototype; _proto.update = function update(status) { if (this.message) { logger.log("[" + this.nodeConfig.title + "]-[" + this.nodeConfig.order + "] : message = [" + this.message.value + "]"); } status = BehaviorStatus.Success; return this.onUpdate(status); }; return Log; }(BehaviorTask), _descriptor$5 = _applyDecoratedDescriptor(_class2$5.prototype, "message", [_dec3$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _class2$5)) || _class$i) || _class$i); cclegacy._RF.pop(); var _dec$j, _dec2$9, _class$j; cclegacy._RF.push({}, "917dc/B4bBArq1QrBFaQ6gk", "Task", undefined); var Task = (_dec$j = ccclass$5('bt.Task'), _dec2$9 = delegate(), _dec$j(_class$j = _dec2$9(_class$j = /*#__PURE__*/function (_bt$BehaviorTask) { _inheritsLoose(Task, _bt$BehaviorTask); function Task() { return _bt$BehaviorTask.apply(this, arguments) || this; } return Task; }(BehaviorTask)) || _class$j) || _class$j); cclegacy._RF.pop(); var _dec$k, _dec2$a, _class$k, _class2$6, _descriptor$6; cclegacy._RF.push({}, "d6ba0cCO4hGyr03nOM9B5Vq", "Wait", undefined); var Wait = (_dec$k = ccclass$5('bt.Wait'), _dec2$a = property$1({ type: SharedNumber }), _dec$k(_class$k = (_class2$6 = /*#__PURE__*/function (_bt$BehaviorTask) { _inheritsLoose(Wait, _bt$BehaviorTask); function Wait() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorTask.call.apply(_bt$BehaviorTask, [this].concat(args)) || this; _initializerDefineProperty(_this, "duration", _descriptor$6, _assertThisInitialized(_this)); _this._intervel = 0; return _this; } var _proto = Wait.prototype; _proto.update = function update(status) { status = BehaviorStatus.Running; if (this.duration.original > 0) { var duration = this.duration.value; this._intervel += this.$context.deltaTime; if (this._intervel - duration >= 0) { status = BehaviorStatus.Success; this._intervel = 0; } } return this.onUpdate(status); }; return Wait; }(BehaviorTask), _descriptor$6 = _applyDecoratedDescriptor(_class2$6.prototype, "duration", [_dec2$a], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _class2$6)) || _class$k); cclegacy._RF.pop(); cclegacy._RF.push({}, "b439eVj61hCYammYdFmJ95R", "main", undefined); cclegacy._RF.pop(); var _dec$l, _class$l; cclegacy._RF.push({}, "57329UxP9VOAa8MciTPhIOm", "BehaviorButton", undefined); var ccclass$6 = _decorator.ccclass, disallowMultiple = _decorator.disallowMultiple; var BehaviorButton = (_dec$l = ccclass$6("BehaviorButton"), _dec$l(_class$l = disallowMultiple(_class$l = /*#__PURE__*/function (_Component) { _inheritsLoose(BehaviorButton, _Component); function BehaviorButton() { return _Component.apply(this, arguments) || this; } return BehaviorButton; }(Component)) || _class$l) || _class$l); cclegacy._RF.pop(); var _dec$m, _dec2$b, _dec3$3, _dec4$2, _class$m, _class2$7, _descriptor$7, _descriptor2$2, _descriptor3$2, _descriptor4$1, _descriptor5$1, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10; cclegacy._RF.push({}, "0047b40TAlFJaaH5Cj5qbAP", "BehaviorLogOptions", undefined); var ccclass$7 = _decorator.ccclass, property$2 = _decorator.property, requireComponent = _decorator.requireComponent, disallowMultiple$1 = _decorator.disallowMultiple; var DefaultLogOptions = { logAbort: true, logInterrupt: true, logExecute: true, logUpdate: false, logEnter: false, logExit: false, logEnable: false, logDisable: false, logLoad: false, logDestroy: false }; var BehaviorLogOptions = (_dec$m = ccclass$7("BehaviorLogOptions"), _dec2$b = requireComponent(BehaviorButton), _dec3$3 = property$2({ tooltip: "当任务被中止时是否打印日志" }), _dec4$2 = property$2({ tooltip: "当中断产生时是否打印日志" }), _dec$m(_class$m = _dec2$b(_class$m = disallowMultiple$1(_class$m = (_class2$7 = /*#__PURE__*/function (_Component) { _inheritsLoose(BehaviorLogOptions, _Component); function BehaviorLogOptions() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "logAbort", _descriptor$7, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logInterrupt", _descriptor2$2, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logExecute", _descriptor3$2, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logUpdate", _descriptor4$1, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logLoad", _descriptor5$1, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logDestroy", _descriptor6, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logEnter", _descriptor7, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logExit", _descriptor8, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logEnable", _descriptor9, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logDisable", _descriptor10, _assertThisInitialized(_this)); return _this; } return BehaviorLogOptions; }(Component), (_descriptor$7 = _applyDecoratedDescriptor(_class2$7.prototype, "logAbort", [_dec3$3], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor2$2 = _applyDecoratedDescriptor(_class2$7.prototype, "logInterrupt", [_dec4$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor3$2 = _applyDecoratedDescriptor(_class2$7.prototype, "logExecute", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor4$1 = _applyDecoratedDescriptor(_class2$7.prototype, "logUpdate", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor5$1 = _applyDecoratedDescriptor(_class2$7.prototype, "logLoad", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor6 = _applyDecoratedDescriptor(_class2$7.prototype, "logDestroy", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor7 = _applyDecoratedDescriptor(_class2$7.prototype, "logEnter", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor8 = _applyDecoratedDescriptor(_class2$7.prototype, "logExit", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor9 = _applyDecoratedDescriptor(_class2$7.prototype, "logEnable", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor10 = _applyDecoratedDescriptor(_class2$7.prototype, "logDisable", [property$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } })), _class2$7)) || _class$m) || _class$m) || _class$m); cclegacy._RF.pop(); cclegacy._RF.push({}, "aadd8eJap1D2qpqCKlsIqzq", "BehaviorManager", undefined); var logger$2 = console; var BehaviorManager = /*#__PURE__*/function () { BehaviorManager.getInstance = function getInstance() { if (!BehaviorManager._instance) { BehaviorManager._instance = new BehaviorManager(); } return BehaviorManager._instance; }; BehaviorManager.deleteInstance = function deleteInstance() { BehaviorManager._instance = null; }; function BehaviorManager() { /** 运行 */ this.running = new Set(); /** 挂起 */ this.suspend = new Set(); /** * 行为树统一帧率 * 默认为 cc.game.frameRate */ this.frameRate = 0; /** 期望帧率对应的每帧时间(以 s 为单位) */ this.frameTime = 0; /** 每帧时间增量 */ this.deltaTime = 0; // this.duration = 0 // this.ticks = 0 this.setFrameRate(Number(game.frameRate)); } var _proto = BehaviorManager.prototype; _proto.getFrameRate = function getFrameRate() { return this.frameRate; } /** * 设置行为树执行帧率,但真正的FPS还取决于 cc.game.frameRate * 注意:行为树的帧率不会比 cc.game.frameRate 大 * @param frameRate */ ; _proto.setFrameRate = function setFrameRate(frameRate) { var _this = this; var gRate = Number(game.frameRate); if (frameRate <= 0 || frameRate > gRate) { logger$2.warn("Invalid frame rate!"); frameRate = gRate; } if (this.frameRate != frameRate) { this.frameRate = frameRate; this.frameTime = 1000 / this.frameRate / 1000 - 0.0001; this.running.forEach(function (context) { if (context.getFrameRate() > _this.frameRate) { context.setFrameRate(_this.frameRate); } }); this.suspend.forEach(function (context) { if (context.getFrameRate() > _this.frameRate) { context.setFrameRate(_this.frameRate); } }); } } /** * 将行为树添加到 running 集合中 * @param context */ ; _proto.runBehavior = function runBehavior(context) { this.resumeBehavior(context); } /** * 将行为树添加到集合中 * @description context.startWhenEnabled 为 true 时,行为树添加到 running 集合,否则添加到 suspend 集合 * @param context */ ; _proto.addBehavior = function addBehavior(context) { if (context.startWhenEnabled) { this.resumeBehavior(context); } else { this.pauseBehavior(context); } }; _proto.removeBehavior = function removeBehavior(context) { if (this.running.has(context)) { this.running["delete"](context); } if (this.suspend.has(context)) { this.suspend["delete"](context); } }; _proto.pauseBehavior = function pauseBehavior(context) { if (!this.suspend.has(context)) { context.onPause(); this.suspend.add(context); } if (this.running.has(context)) { this.running["delete"](context); } }; _proto.resumeBehavior = function resumeBehavior(context) { if (!this.running.has(context)) { context.onResume(); this.running.add(context); } if (this.suspend.has(context)) { this.suspend["delete"](context); } }; _proto.stopBehavior = function stopBehavior(context) { if (this.running.has(context)) { context.onStop(); this.running["delete"](context); } if (!this.suspend.has(context)) { this.suspend.add(context); } } /** * 更新状态 * @param {*} delta 上一次tick时间间隔 */ ; _proto.tick = function tick(delta) { var _this2 = this; // this.duration += delta // this.ticks += 1 this.running.forEach(function (context) { var status = context.onTick(delta); if (status != BehaviorStatus.Running) { if (context.restartWhenComplete) { context.onRestart(); } else { context.onFinished(); _this2.stopBehavior(context); } } }); }; _proto.update = function update(delta) { this.deltaTime += delta; if (this.deltaTime < this.frameTime) { return; } this.tick(delta); this.deltaTime -= this.frameTime; }; _proto.onEnable = function onEnable() { var _this3 = this; this.suspend.forEach(function (context) { if (context.isSuspended) { _this3.resumeBehavior(context); } }); }; _proto.onDisable = function onDisable() { var _this4 = this; this.running.forEach(function (context) { if (context.pauseWhenDisabled) { _this4.pauseBehavior(context); } }); }; return BehaviorManager; }(); // /** 行为树持续时间(是每帧时间增量叠加后的时间总和) */ // private duration = 0; // /** 行为树 tick 次数 */ // private ticks = 0; BehaviorManager._instance = null; cclegacy._RF.pop(); var _dec$n, _dec2$c, _dec3$4, _dec4$3, _dec5$1, _dec6$1, _dec7, _dec8, _dec9, _class$n, _class2$8, _descriptor$8, _descriptor2$3, _descriptor3$3, _descriptor4$2, _descriptor5$2, _descriptor6$1, _descriptor7$1; cclegacy._RF.push({}, "e021fzRX91CZbfisWd9maoE", "BehaviorTree", undefined); var ccclass$8 = _decorator.ccclass, property$3 = _decorator.property, requireComponent$1 = _decorator.requireComponent, disallowMultiple$2 = _decorator.disallowMultiple; var BehaviorTree = (_dec$n = ccclass$8("BehaviorTree"), _dec2$c = requireComponent$1(BehaviorLogOptions), _dec3$4 = property$3({ type: JsonAsset, tooltip: "绑定行为树编辑器数据资源" }), _dec4$3 = property$3({ tooltip: "\u8BBE\u7F6E\u5F53\u524D\u884C\u4E3A\u6811\u6267\u884C\u5E27\u7387\uFF0C\u4E3A 0 \u8868\u793A\u4E0E BehaviorManager.frameRate \u4FDD\u6301\u4E00\u81F4\u3002\n \u5982\u9700\u7EDF\u4E00\u8BBE\u7F6E\u5E27\u7387\uFF0C\u53EF\u4EE5\u4F7F\u7528 BehaviorManager.getInstance().setFrameRate(rate)\u3002\n \u6CE8\u610F\uFF1A\u884C\u4E3A\u6811\u7684\u5E27\u7387\u4E0D\u4F1A\u6BD4 cc.game.frameRate \u5927", min: 0, step: 1 }), _dec5$1 = property$3({ tooltip: "节点激活时开始运行" }), _dec6$1 = property$3({ tooltip: "节点禁用时暂停运行" }), _dec7 = property$3({ tooltip: "当一次行为树全部结束时,重新开始执行该行为树" }), _dec8 = property$3({ tooltip: "当重新开始执行行为树时,重置各节点数据" }), _dec9 = property$3({ tooltip: "当行为树状态变动时输出日志" }), _dec$n(_class$n = _dec2$c(_class$n = disallowMultiple$2(_class$n = (_class2$8 = /*#__PURE__*/function (_Component) { _inheritsLoose(BehaviorTree, _Component); function BehaviorTree() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "jsonAsset", _descriptor$8, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "frameRate", _descriptor2$3, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "startWhenEnabled", _descriptor3$3, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "pauseWhenDisabled", _descriptor4$2, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "restartWhenComplete", _descriptor5$2, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "resetValuesOnRestart", _descriptor6$1, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "logTaskChanges", _descriptor7$1, _assertThisInitialized(_this)); /** * 行为树事件委托对象 * 事件类型详见: IBehaviorTreeEventInterface */ _this.delegate = new BehaviorEventTarget(); /** 行为树执行日志粒度控制 */ _this.logOptions = null; /** 行为树持续时间(是每帧时间增量叠加后的时间总和) */ _this.duration = 0; /** 行为树 tick 总次数 */ _this.ticks = 0; _this.tickLoggers = []; _this.lastLoggers = []; /** 所有节点(包括组合节点、任务节点、装饰器等所有节点) */ _this.allNodes = []; /** 所有任务节点(key为该节点在行为树编辑器中对应的序号) */ _this.allTasks = []; /** 行为树使用的黑板变量 */ _this.blackboard = null; /** 行为树当前状态 */ _this.status = BehaviorStatus.None; /** 行为树是否已挂起 */ _this.isSuspended = false; /** 行为树是否已执行结束 */ _this.isCompleted = false; _this._inited = false; // protected _utils: BehaviorTreeUtils = null; _this._root = null; /** 期望帧率对应的每帧时间(以 s 为单位) */ _this.frameTime = 0; _this._isLogTaskChanged = false; return _this; } var _proto = BehaviorTree.prototype; _proto.onLoad = function onLoad() { var _this$jsonAsset; if (!((_this$jsonAsset = this.jsonAsset) != null && _this$jsonAsset.json)) return; this.reuse(); }; _proto.onDestroy = function onDestroy() { this.unuse(); }; _proto.unuse = function unuse() { if (!this._inited) { return; } this._inited = false; this.status = BehaviorStatus.None; this.duration = 0; this.ticks = 0; this.allNodes.length = 0; this.allTasks.length = 0; this.tickLoggers.length = 0; this.lastLoggers.length = 0; this.isSuspended = false; this.isCompleted = false; if (this._root) { this._root.destroy(); this._root = null; } if (this.blackboard) { this.blackboard.destroy(); this.blackboard = null; } this._manager.removeBehavior(this); }; _proto.reuse = function reuse() { this.loadJsonAsset(this.jsonAsset); }; _proto.loadJsonAsset = function loadJsonAsset(jsonAsset) { if (!jsonAsset || !jsonAsset.json) return; if (this._inited) return; this._inited = true; this.setFrameRate(this.frameRate); this.jsonAsset = jsonAsset; this.logOptions = this.getComponent(BehaviorLogOptions); if (!this.logOptions) { this.logOptions = this.addComponent(BehaviorLogOptions); for (var key in DefaultLogOptions) { this.logOptions[key] = !!DefaultLogOptions[key]; } } var jsonObect = jsonAsset.json; var json = jsonObect; this.blackboard = new Blackboard(this, json.blackboard); if (this.loadTree(json)) { this._manager.addBehavior(this); } }; _proto.loadTree = function loadTree(tree) { var _tree$root$config; if (!(tree != null && tree.root)) { logger.error('load failed -- tree is invalid'); return false; } this._root = null; this.allNodes.length = 0; this.allTasks.length = 0; this.tickLoggers.length = 0; this.lastLoggers.length = 0; var successs = false; this.delegate.emit("onDeserializeBefore"); // 创建根节点 var options = ((_tree$root$config = tree.root.config) == null ? void 0 : _tree$root$config.label) || {}; if (options.uuid) { var instance = deserializeNode(null, tree.root, this); if (instance) { this._root = instance; successs = true; } else { logger.error("Can't find class by uuid: ", options.uuid); } } this.delegate.emit("onDeserializeAfter"); return successs; }; _proto.getFrameRate = function getFrameRate() { return this.frameRate; } /** * 设置当前行为树执行帧率,但真正的FPS还取决于 BehaviorManager.frameRate 和 cc.game.frameRate * 如需统一设置帧率,可以使用 BehaviorManager.getInstance().setFrameRate(rate) * 注意:行为树的帧率不会比 cc.game.frameRate 大 * @param frameRate */ ; _proto.setFrameRate = function setFrameRate(frameRate) { var mRate = this._manager.getFrameRate(); if (frameRate <= 0 || frameRate > mRate) { if (frameRate != 0) { logger.warn("Invalid frame rate! tree.frameRate=" + frameRate + ", manage.frameRate=" + mRate + ", game.frameRate=" + game.frameRate); } frameRate = mRate; } this.frameRate = frameRate; this.frameTime = 1000 / this.frameRate / 1000 - 0.0001; }; /** * 行为树反序列化每个节点回调 * @param node */ _proto.onDeserialize = function onDeserialize(node) { this.allNodes.push(node); if (node instanceof Task) { this.allTasks.push(node); } this.delegate.emit("onDeserialize", node); } /** * 行为树根节点 * @returns */ ; _proto.getRoot = function getRoot() { return this._root; } /** * 根据指定的 tag 获取某个任务 * @param tag string * @returns */ ; _proto.getTask = function getTask(tag) { var node = this.allTasks.find(function (v) { return v.nodeConfig.tag == tag; }); return node; } /** * 根据任务在行为树中的序号获取某个任务 * @param order number * @returns */ ; _proto.getTaskByOrder = function getTaskByOrder(order) { var node = this.allTasks.find(function (v) { return v.nodeConfig.order == order; }); return node; } /** 行为树组件被附加到的 cc.Node 节点 */ ; _proto.getTargetRoot = function getTargetRoot() { return this.node; } /** * 根据子节点路径获取 cc.Node 节点 * @param path * @returns */ ; _proto.getTargetByPath = function getTargetByPath$1(path) { return getTargetByPath(this.node, path); } /** 某个类型的 log 是否启用 */ ; _proto.isLogEnabled = function isLogEnabled(key) { return this.logOptions[key]; }; _proto.onHandleTreeLog = function onHandleTreeLog(msg) { if (this.logTaskChanges) { if (!this._isLogTaskChanged) { var length = this.tickLoggers.length; if (this.lastLoggers.length > length) { var temp = this.lastLoggers[length]; if (temp != msg) { this._isLogTaskChanged = true; } } else { this._isLogTaskChanged = true; } } this.tickLoggers.push(msg); } }; _proto.onTick = function onTick(delta) { if (!this._root) { logger.error('tick failed -- root is null'); return BehaviorStatus.None; } this.duration += delta; this.ticks += 1; this.tickLoggers.length = 0; this._isLogTaskChanged = false; this.status = this._root.execute(); if (this._isLogTaskChanged) { var msg = "[ BehaviorTree - <" + this._root.nodeTitle + "> onTick(" + this.ticks + ") : status = " + BehaviorStatus[this.status] + " ]\n" + this.tickLoggers.join("\n"); logger.log(msg); this.lastLoggers = this.tickLoggers; this.tickLoggers = []; } // this.deltaTime -= this.frameTime; return this.status; }; _proto.onFinished = function onFinished() { this.isCompleted = true; }; _proto.onRestart = function onRestart() { this.isCompleted = false; if (this.resetValuesOnRestart) { this._root.reset(); } }; _proto.onPause = function onPause() { this.isSuspended = true; }; _proto.onResume = function onResume() { this.isSuspended = false; }; _proto.onStop = function onStop() { this.isSuspended = false; this.isCompleted = false; }; _createClass(BehaviorTree, [{ key: "_manager", get: function get() { return BehaviorManager.getInstance(); } }]); return BehaviorTree; }(Component), (_descriptor$8 = _applyDecoratedDescriptor(_class2$8.prototype, "jsonAsset", [_dec3$4], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$3 = _applyDecoratedDescriptor(_class2$8.prototype, "frameRate", [_dec4$3], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0; } }), _descriptor3$3 = _applyDecoratedDescriptor(_class2$8.prototype, "startWhenEnabled", [_dec5$1], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return true; } }), _descriptor4$2 = _applyDecoratedDescriptor(_class2$8.prototype, "pauseWhenDisabled", [_dec6$1], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor5$2 = _applyDecoratedDescriptor(_class2$8.prototype, "restartWhenComplete", [_dec7], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor6$1 = _applyDecoratedDescriptor(_class2$8.prototype, "resetValuesOnRestart", [_dec8], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor7$1 = _applyDecoratedDescriptor(_class2$8.prototype, "logTaskChanges", [_dec9], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } })), _class2$8)) || _class$n) || _class$n) || _class$n); cclegacy._RF.pop(); cclegacy._RF.push({}, "289827SzWpFd6nyoZKNqVpp", "main", undefined); cclegacy._RF.pop(); cclegacy._RF.push({}, "1a427kpLlNJc46kVxCHG6S5", "SystemBase", undefined); var SystemBase = function SystemBase() {}; cclegacy._RF.pop(); cclegacy._RF.push({}, "0beb7MgnGZItpD4yr/b2HOm", "JNetParam", undefined); //网络核心参数 var JNetParam = /*#__PURE__*/function () { function JNetParam(id, hId) { //请求处理 Id (用来找到处理方法) this.hId = void 0; //请求Id (请求标识) this.id = void 0; //请求参数 this.data = void 0; this["byte"] = void 0; this.id = id; this.hId = hId; } JNetParam.Build = function Build(id, hId) { return new JNetParam(id, hId); }; var _proto = JNetParam.prototype; _proto.setData = function setData(data) { this.data = data; return this; }; _proto.setByte = function setByte(_byte) { this["byte"] = _byte; return this; }; return JNetParam; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "f7219bazhRC4KivZvdVA0+v", "Singleton", undefined); var Singleton = /*#__PURE__*/function () { function Singleton() {} Singleton.getIns = function getIns() { if (!this.instance) { this.instance = new this(); this.instance.init(); } return this.instance; }; Singleton.destroyIns = function destroyIns() { if (this.instance) { this.instance.destroy(); } this.instance = null; }; var _proto = Singleton.prototype; _proto.destroy = function destroy() {}; _proto.init = function init() {}; return Singleton; }(); cclegacy._RF.pop(); var CjsLoader = /*#__PURE__*/function () { function CjsLoader() { this._registry = {}; this._moduleCache = {}; } /** * Defines a CommonJS module. * @param id Module ID. * @param factory The factory. * @param resolveMap An object or a function returning object which records the module specifier resolve result. * The later is called as "deferred resolve map" and would be invocated right before CommonJS code execution. */ var _proto = CjsLoader.prototype; _proto.define = function define(id, factory, resolveMap) { this._registry[id] = { factory: factory, resolveMap: resolveMap }; } /** * Requires a CommonJS module. * @param id Module ID. * @returns The module's `module.exports`. */ ; _proto.require = function require(id) { return this._require(id); }; _proto.throwInvalidWrapper = function throwInvalidWrapper(requestTarget, from) { throw new Error("Module '" + requestTarget + "' imported from '" + from + "' is expected be an ESM-wrapped CommonJS module but it doesn't."); }; _proto._require = function _require(id, parent) { var cachedModule = this._moduleCache[id]; if (cachedModule) { return cachedModule.exports; } var module = { id: id, exports: {} }; this._moduleCache[id] = module; this._tryModuleLoad(module, id); return module.exports; }; _proto._resolve = function _resolve(specifier, parent) { return this._resolveFromInfos(specifier, parent) || this._throwUnresolved(specifier, parent); }; _proto._resolveFromInfos = function _resolveFromInfos(specifier, parent) { var _cjsInfos$parent$reso, _cjsInfos$parent; if (specifier in cjsInfos) { return specifier; } if (!parent) { return; } return (_cjsInfos$parent$reso = (_cjsInfos$parent = cjsInfos[parent]) == null ? void 0 : _cjsInfos$parent.resolveCache[specifier]) != null ? _cjsInfos$parent$reso : undefined; }; _proto._tryModuleLoad = function _tryModuleLoad(module, id) { var threw = true; try { this._load(module, id); threw = false; } finally { if (threw) { delete this._moduleCache[id]; } } }; _proto._load = function _load(module, id) { var _this$_loadWrapper = this._loadWrapper(id), factory = _this$_loadWrapper.factory, resolveMap = _this$_loadWrapper.resolveMap; var vendorRequire = this._createRequire(module); var require = resolveMap ? this._createRequireWithResolveMap(typeof resolveMap === 'function' ? resolveMap() : resolveMap, vendorRequire) : vendorRequire; factory(module.exports, require, module); }; _proto._loadWrapper = function _loadWrapper(id) { if (id in this._registry) { return this._registry[id]; } else { return this._loadHostProvidedModules(id); } }; _proto._loadHostProvidedModules = function _loadHostProvidedModules(id) { return { factory: function factory(_exports, _require, module) { if (typeof require === 'undefined') { throw new Error("Current environment does not provide a require() for requiring '" + id + "'."); } try { module.exports = require(id); } catch (err) { throw new Error("Exception thrown when calling host defined require('" + id + "').", { cause: err }); } } }; }; _proto._createRequire = function _createRequire(module) { var _this = this; return function (specifier) { return _this._require(specifier, module); }; }; _proto._createRequireWithResolveMap = function _createRequireWithResolveMap(requireMap, originalRequire) { return function (specifier) { var resolved = requireMap[specifier]; if (resolved) { return originalRequire(resolved); } else { throw new Error('Unresolved specifier ' + specifier); } }; }; _proto._throwUnresolved = function _throwUnresolved(specifier, parentUrl) { throw new Error("Unable to resolve " + specifier + " from " + parent + "."); }; return CjsLoader; }(); var loader = new CjsLoader(); var __cjsMetaURL = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/aspromise/index.js'; loader.define(__cjsMetaURL, function (exports, require, module, __filename, __dirname) { module.exports = asPromise; /** * Callback as used by {@link util.asPromise}. * @typedef asPromiseCallback * @type {function} * @param {Error|null} error Error, if any * @param {...*} params Additional arguments * @returns {undefined} */ /** * Returns a promise from a node-style callback function. * @memberof util * @param {asPromiseCallback} fn Function to call * @param {*} ctx Function context * @param {...*} params Function arguments * @returns {Promise<*>} Promisified function */ function asPromise(fn, ctx /*, varargs */ ) { var params = new Array(arguments.length - 1), offset = 0, index = 2, pending = true; while (index < arguments.length) params[offset++] = arguments[index++]; return new Promise(function executor(resolve, reject) { params[offset] = function callback(err /*, varargs */ ) { if (pending) { pending = false; if (err) reject(err);else { var params = new Array(arguments.length - 1), offset = 0; while (offset < params.length) params[offset++] = arguments[offset]; resolve.apply(null, params); } } }; try { fn.apply(ctx || null, params); } catch (err) { if (pending) { pending = false; reject(err); } } }); } // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$1 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/base64/index.js'; loader.define(__cjsMetaURL$1, function (exports, require, module, __filename, __dirname) { /** * A minimal base64 implementation for number arrays. * @memberof util * @namespace */ var base64 = exports; /** * Calculates the byte length of a base64 encoded string. * @param {string} string Base64 encoded string * @returns {number} Byte length */ base64.length = function length(string) { var p = string.length; if (!p) return 0; var n = 0; while (--p % 4 > 1 && string.charAt(p) === "=") ++n; return Math.ceil(string.length * 3) / 4 - n; }; // Base64 encoding table var b64 = new Array(64); // Base64 decoding table var s64 = new Array(123); // 65..90, 97..122, 48..57, 43, 47 for (var i = 0; i < 64;) s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; /** * Encodes a buffer to a base64 encoded string. * @param {Uint8Array} buffer Source buffer * @param {number} start Source start * @param {number} end Source end * @returns {string} Base64 encoded string */ base64.encode = function encode(buffer, start, end) { var parts = null, chunk = []; var i = 0, // output index j = 0, // goto index t; // temporary while (start < end) { var b = buffer[start++]; switch (j) { case 0: chunk[i++] = b64[b >> 2]; t = (b & 3) << 4; j = 1; break; case 1: chunk[i++] = b64[t | b >> 4]; t = (b & 15) << 2; j = 2; break; case 2: chunk[i++] = b64[t | b >> 6]; chunk[i++] = b64[b & 63]; j = 0; break; } if (i > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i = 0; } } if (j) { chunk[i++] = b64[t]; chunk[i++] = 61; if (j === 1) chunk[i++] = 61; } if (parts) { if (i) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i)); }; var invalidEncoding = "invalid encoding"; /** * Decodes a base64 encoded string to a buffer. * @param {string} string Source string * @param {Uint8Array} buffer Destination buffer * @param {number} offset Destination offset * @returns {number} Number of bytes written * @throws {Error} If encoding is invalid */ base64.decode = function decode(string, buffer, offset) { var start = offset; var j = 0, // goto index t; // temporary for (var i = 0; i < string.length;) { var c = string.charCodeAt(i++); if (c === 61 && j > 1) break; if ((c = s64[c]) === undefined) throw Error(invalidEncoding); switch (j) { case 0: t = c; j = 1; break; case 1: buffer[offset++] = t << 2 | (c & 48) >> 4; t = c; j = 2; break; case 2: buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; t = c; j = 3; break; case 3: buffer[offset++] = (t & 3) << 6 | c; j = 0; break; } } if (j === 1) throw Error(invalidEncoding); return offset - start; }; /** * Tests if the specified string appears to be base64 encoded. * @param {string} string String to test * @returns {boolean} `true` if probably base64 encoded, otherwise false */ base64.test = function test(string) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); }; // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$2 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/eventemitter/index.js'; loader.define(__cjsMetaURL$2, function (exports, require, module, __filename, __dirname) { module.exports = EventEmitter; /** * Constructs a new event emitter instance. * @classdesc A minimal event emitter. * @memberof util * @constructor */ function EventEmitter() { /** * Registered listeners. * @type {Object.} * @private */ this._listeners = {}; } /** * Registers an event listener. * @param {string} evt Event name * @param {function} fn Listener * @param {*} [ctx] Listener context * @returns {util.EventEmitter} `this` */ EventEmitter.prototype.on = function on(evt, fn, ctx) { (this._listeners[evt] || (this._listeners[evt] = [])).push({ fn: fn, ctx: ctx || this }); return this; }; /** * Removes an event listener or any matching listeners if arguments are omitted. * @param {string} [evt] Event name. Removes all listeners if omitted. * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. * @returns {util.EventEmitter} `this` */ EventEmitter.prototype.off = function off(evt, fn) { if (evt === undefined) this._listeners = {};else { if (fn === undefined) this._listeners[evt] = [];else { var listeners = this._listeners[evt]; for (var i = 0; i < listeners.length;) if (listeners[i].fn === fn) listeners.splice(i, 1);else ++i; } } return this; }; /** * Emits an event by calling its listeners with the specified arguments. * @param {string} evt Event name * @param {...*} args Arguments * @returns {util.EventEmitter} `this` */ EventEmitter.prototype.emit = function emit(evt) { var listeners = this._listeners[evt]; if (listeners) { var args = [], i = 1; for (; i < arguments.length;) args.push(arguments[i++]); for (i = 0; i < listeners.length;) listeners[i].fn.apply(listeners[i++].ctx, args); } return this; }; // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$3 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/float/index.js'; loader.define(__cjsMetaURL$3, function (exports, require, module, __filename, __dirname) { module.exports = factory(factory); /** * Reads / writes floats / doubles from / to buffers. * @name util.float * @namespace */ /** * Writes a 32 bit float to a buffer using little endian byte order. * @name util.float.writeFloatLE * @function * @param {number} val Value to write * @param {Uint8Array} buf Target buffer * @param {number} pos Target buffer offset * @returns {undefined} */ /** * Writes a 32 bit float to a buffer using big endian byte order. * @name util.float.writeFloatBE * @function * @param {number} val Value to write * @param {Uint8Array} buf Target buffer * @param {number} pos Target buffer offset * @returns {undefined} */ /** * Reads a 32 bit float from a buffer using little endian byte order. * @name util.float.readFloatLE * @function * @param {Uint8Array} buf Source buffer * @param {number} pos Source buffer offset * @returns {number} Value read */ /** * Reads a 32 bit float from a buffer using big endian byte order. * @name util.float.readFloatBE * @function * @param {Uint8Array} buf Source buffer * @param {number} pos Source buffer offset * @returns {number} Value read */ /** * Writes a 64 bit double to a buffer using little endian byte order. * @name util.float.writeDoubleLE * @function * @param {number} val Value to write * @param {Uint8Array} buf Target buffer * @param {number} pos Target buffer offset * @returns {undefined} */ /** * Writes a 64 bit double to a buffer using big endian byte order. * @name util.float.writeDoubleBE * @function * @param {number} val Value to write * @param {Uint8Array} buf Target buffer * @param {number} pos Target buffer offset * @returns {undefined} */ /** * Reads a 64 bit double from a buffer using little endian byte order. * @name util.float.readDoubleLE * @function * @param {Uint8Array} buf Source buffer * @param {number} pos Source buffer offset * @returns {number} Value read */ /** * Reads a 64 bit double from a buffer using big endian byte order. * @name util.float.readDoubleBE * @function * @param {Uint8Array} buf Source buffer * @param {number} pos Source buffer offset * @returns {number} Value read */ // Factory function for the purpose of node-based testing in modified global environments function factory(exports) { // float: typed array if (typeof Float32Array !== "undefined") (function () { var f32 = new Float32Array([-0]), f8b = new Uint8Array(f32.buffer), le = f8b[3] === 128; function writeFloat_f32_cpy(val, buf, pos) { f32[0] = val; buf[pos] = f8b[0]; buf[pos + 1] = f8b[1]; buf[pos + 2] = f8b[2]; buf[pos + 3] = f8b[3]; } function writeFloat_f32_rev(val, buf, pos) { f32[0] = val; buf[pos] = f8b[3]; buf[pos + 1] = f8b[2]; buf[pos + 2] = f8b[1]; buf[pos + 3] = f8b[0]; } /* istanbul ignore next */ exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; /* istanbul ignore next */ exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; function readFloat_f32_cpy(buf, pos) { f8b[0] = buf[pos]; f8b[1] = buf[pos + 1]; f8b[2] = buf[pos + 2]; f8b[3] = buf[pos + 3]; return f32[0]; } function readFloat_f32_rev(buf, pos) { f8b[3] = buf[pos]; f8b[2] = buf[pos + 1]; f8b[1] = buf[pos + 2]; f8b[0] = buf[pos + 3]; return f32[0]; } /* istanbul ignore next */ exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; /* istanbul ignore next */ exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; // float: ieee754 })();else (function () { function writeFloat_ieee754(writeUint, val, buf, pos) { var sign = val < 0 ? 1 : 0; if (sign) val = -val; if (val === 0) writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);else if (isNaN(val)) writeUint(2143289344, buf, pos);else if (val > 3.4028234663852886e+38) // +-Infinity writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);else if (val < 1.1754943508222875e-38) // denormal writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);else { var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); } } exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); function readFloat_ieee754(readUint, buf, pos) { var uint = readUint(buf, pos), sign = (uint >> 31) * 2 + 1, exponent = uint >>> 23 & 255, mantissa = uint & 8388607; return exponent === 255 ? mantissa ? NaN : sign * Infinity : exponent === 0 // denormal ? sign * 1.401298464324817e-45 * mantissa : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); } exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); })(); // double: typed array if (typeof Float64Array !== "undefined") (function () { var f64 = new Float64Array([-0]), f8b = new Uint8Array(f64.buffer), le = f8b[7] === 128; function writeDouble_f64_cpy(val, buf, pos) { f64[0] = val; buf[pos] = f8b[0]; buf[pos + 1] = f8b[1]; buf[pos + 2] = f8b[2]; buf[pos + 3] = f8b[3]; buf[pos + 4] = f8b[4]; buf[pos + 5] = f8b[5]; buf[pos + 6] = f8b[6]; buf[pos + 7] = f8b[7]; } function writeDouble_f64_rev(val, buf, pos) { f64[0] = val; buf[pos] = f8b[7]; buf[pos + 1] = f8b[6]; buf[pos + 2] = f8b[5]; buf[pos + 3] = f8b[4]; buf[pos + 4] = f8b[3]; buf[pos + 5] = f8b[2]; buf[pos + 6] = f8b[1]; buf[pos + 7] = f8b[0]; } /* istanbul ignore next */ exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; /* istanbul ignore next */ exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; function readDouble_f64_cpy(buf, pos) { f8b[0] = buf[pos]; f8b[1] = buf[pos + 1]; f8b[2] = buf[pos + 2]; f8b[3] = buf[pos + 3]; f8b[4] = buf[pos + 4]; f8b[5] = buf[pos + 5]; f8b[6] = buf[pos + 6]; f8b[7] = buf[pos + 7]; return f64[0]; } function readDouble_f64_rev(buf, pos) { f8b[7] = buf[pos]; f8b[6] = buf[pos + 1]; f8b[5] = buf[pos + 2]; f8b[4] = buf[pos + 3]; f8b[3] = buf[pos + 4]; f8b[2] = buf[pos + 5]; f8b[1] = buf[pos + 6]; f8b[0] = buf[pos + 7]; return f64[0]; } /* istanbul ignore next */ exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; /* istanbul ignore next */ exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; // double: ieee754 })();else (function () { function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { var sign = val < 0 ? 1 : 0; if (sign) val = -val; if (val === 0) { writeUint(0, buf, pos + off0); writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); } else if (isNaN(val)) { writeUint(0, buf, pos + off0); writeUint(2146959360, buf, pos + off1); } else if (val > 1.7976931348623157e+308) { // +-Infinity writeUint(0, buf, pos + off0); writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); } else { var mantissa; if (val < 2.2250738585072014e-308) { // denormal mantissa = val / 5e-324; writeUint(mantissa >>> 0, buf, pos + off0); writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); } else { var exponent = Math.floor(Math.log(val) / Math.LN2); if (exponent === 1024) exponent = 1023; mantissa = val * Math.pow(2, -exponent); writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); } } } exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); function readDouble_ieee754(readUint, off0, off1, buf, pos) { var lo = readUint(buf, pos + off0), hi = readUint(buf, pos + off1); var sign = (hi >> 31) * 2 + 1, exponent = hi >>> 20 & 2047, mantissa = 4294967296 * (hi & 1048575) + lo; return exponent === 2047 ? mantissa ? NaN : sign * Infinity : exponent === 0 // denormal ? sign * 5e-324 * mantissa : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); } exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); })(); return exports; } // uint helpers function writeUintLE(val, buf, pos) { buf[pos] = val & 255; buf[pos + 1] = val >>> 8 & 255; buf[pos + 2] = val >>> 16 & 255; buf[pos + 3] = val >>> 24; } function writeUintBE(val, buf, pos) { buf[pos] = val >>> 24; buf[pos + 1] = val >>> 16 & 255; buf[pos + 2] = val >>> 8 & 255; buf[pos + 3] = val & 255; } function readUintLE(buf, pos) { return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0; } function readUintBE(buf, pos) { return (buf[pos] << 24 | buf[pos + 1] << 16 | buf[pos + 2] << 8 | buf[pos + 3]) >>> 0; } // #endregion ORIGINAL CODE module.exports; module.exports.writeFloatLE; module.exports.writeFloatBE; module.exports.readFloatLE; module.exports.readFloatBE; module.exports.writeDoubleLE; module.exports.writeDoubleBE; module.exports.readDoubleLE; module.exports.readDoubleBE; }, {}); var __cjsMetaURL$4 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/inquire/index.js'; loader.define(__cjsMetaURL$4, function (exports, require, module, __filename, __dirname) { module.exports = inquire; /** * Requires a module only if available. * @memberof util * @param {string} moduleName Module to require * @returns {?Object} Required module if available and not empty, otherwise `null` */ function inquire(moduleName) { try { var mod = eval("quire".replace(/^/, "re"))(moduleName); // eslint-disable-line no-eval if (mod && (mod.length || Object.keys(mod).length)) return mod; } catch (e) {} // eslint-disable-line no-empty return null; } // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$5 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/utf8/index.js'; loader.define(__cjsMetaURL$5, function (exports, require, module, __filename, __dirname) { /** * A minimal UTF8 implementation for number arrays. * @memberof util * @namespace */ var utf8 = exports; /** * Calculates the UTF8 byte length of a string. * @param {string} string String * @returns {number} Byte length */ utf8.length = function utf8_length(string) { var len = 0, c = 0; for (var i = 0; i < string.length; ++i) { c = string.charCodeAt(i); if (c < 128) len += 1;else if (c < 2048) len += 2;else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { ++i; len += 4; } else len += 3; } return len; }; /** * Reads UTF8 bytes as a string. * @param {Uint8Array} buffer Source buffer * @param {number} start Source start * @param {number} end Source end * @returns {string} String read */ utf8.read = function utf8_read(buffer, start, end) { var len = end - start; if (len < 1) return ""; var parts = null, chunk = [], i = 0, // char offset t; // temporary while (start < end) { t = buffer[start++]; if (t < 128) chunk[i++] = t;else if (t > 191 && t < 224) chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;else if (t > 239 && t < 365) { t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; chunk[i++] = 0xD800 + (t >> 10); chunk[i++] = 0xDC00 + (t & 1023); } else chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; if (i > 8191) { (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); i = 0; } } if (parts) { if (i) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); return parts.join(""); } return String.fromCharCode.apply(String, chunk.slice(0, i)); }; /** * Writes a string as UTF8 bytes. * @param {string} string Source string * @param {Uint8Array} buffer Destination buffer * @param {number} offset Destination offset * @returns {number} Bytes written */ utf8.write = function utf8_write(string, buffer, offset) { var start = offset, c1, // character 1 c2; // character 2 for (var i = 0; i < string.length; ++i) { c1 = string.charCodeAt(i); if (c1 < 128) { buffer[offset++] = c1; } else if (c1 < 2048) { buffer[offset++] = c1 >> 6 | 192; buffer[offset++] = c1 & 63 | 128; } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); ++i; buffer[offset++] = c1 >> 18 | 240; buffer[offset++] = c1 >> 12 & 63 | 128; buffer[offset++] = c1 >> 6 & 63 | 128; buffer[offset++] = c1 & 63 | 128; } else { buffer[offset++] = c1 >> 12 | 224; buffer[offset++] = c1 >> 6 & 63 | 128; buffer[offset++] = c1 & 63 | 128; } } return offset - start; }; // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$6 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/@protobufjs/pool/index.js'; loader.define(__cjsMetaURL$6, function (exports, require, module, __filename, __dirname) { module.exports = pool; /** * An allocator as used by {@link util.pool}. * @typedef PoolAllocator * @type {function} * @param {number} size Buffer size * @returns {Uint8Array} Buffer */ /** * A slicer as used by {@link util.pool}. * @typedef PoolSlicer * @type {function} * @param {number} start Start offset * @param {number} end End offset * @returns {Uint8Array} Buffer slice * @this {Uint8Array} */ /** * A general purpose buffer pool. * @memberof util * @function * @param {PoolAllocator} alloc Allocator * @param {PoolSlicer} slice Slicer * @param {number} [size=8192] Slab size * @returns {PoolAllocator} Pooled allocator */ function pool(alloc, slice, size) { var SIZE = size || 8192; var MAX = SIZE >>> 1; var slab = null; var offset = SIZE; return function pool_alloc(size) { if (size < 1 || size > MAX) return alloc(size); if (offset + size > SIZE) { slab = alloc(SIZE); offset = 0; } var buf = slice.call(slab, offset, offset += size); if (offset & 7) // align to 32 bit offset = (offset | 7) + 1; return buf; }; } // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$7 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/util/longbits.js'; loader.define(__cjsMetaURL$7, function (exports, require, module, __filename, __dirname) { module.exports = LongBits; var util = require("../util/minimal"); /** * Constructs new long bits. * @classdesc Helper class for working with the low and high bits of a 64 bit value. * @memberof util * @constructor * @param {number} lo Low 32 bits, unsigned * @param {number} hi High 32 bits, unsigned */ function LongBits(lo, hi) { // note that the casts below are theoretically unnecessary as of today, but older statically // generated converter code might still call the ctor with signed 32bits. kept for compat. /** * Low bits. * @type {number} */ this.lo = lo >>> 0; /** * High bits. * @type {number} */ this.hi = hi >>> 0; } /** * Zero bits. * @memberof util.LongBits * @type {util.LongBits} */ var zero = LongBits.zero = new LongBits(0, 0); zero.toNumber = function () { return 0; }; zero.zzEncode = zero.zzDecode = function () { return this; }; zero.length = function () { return 1; }; /** * Zero hash. * @memberof util.LongBits * @type {string} */ var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; /** * Constructs new long bits from the specified number. * @param {number} value Value * @returns {util.LongBits} Instance */ LongBits.fromNumber = function fromNumber(value) { if (value === 0) return zero; var sign = value < 0; if (sign) value = -value; var lo = value >>> 0, hi = (value - lo) / 4294967296 >>> 0; if (sign) { hi = ~hi >>> 0; lo = ~lo >>> 0; if (++lo > 4294967295) { lo = 0; if (++hi > 4294967295) hi = 0; } } return new LongBits(lo, hi); }; /** * Constructs new long bits from a number, long or string. * @param {Long|number|string} value Value * @returns {util.LongBits} Instance */ LongBits.from = function from(value) { if (typeof value === "number") return LongBits.fromNumber(value); if (util.isString(value)) { /* istanbul ignore else */ if (util.Long) value = util.Long.fromString(value);else return LongBits.fromNumber(parseInt(value, 10)); } return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; }; /** * Converts this long bits to a possibly unsafe JavaScript number. * @param {boolean} [unsigned=false] Whether unsigned or not * @returns {number} Possibly unsafe number */ LongBits.prototype.toNumber = function toNumber(unsigned) { if (!unsigned && this.hi >>> 31) { var lo = ~this.lo + 1 >>> 0, hi = ~this.hi >>> 0; if (!lo) hi = hi + 1 >>> 0; return -(lo + hi * 4294967296); } return this.lo + this.hi * 4294967296; }; /** * Converts this long bits to a long. * @param {boolean} [unsigned=false] Whether unsigned or not * @returns {Long} Long */ LongBits.prototype.toLong = function toLong(unsigned) { return util.Long ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) /* istanbul ignore next */ : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; }; var charCodeAt = String.prototype.charCodeAt; /** * Constructs new long bits from the specified 8 characters long hash. * @param {string} hash Hash * @returns {util.LongBits} Bits */ LongBits.fromHash = function fromHash(hash) { if (hash === zeroHash) return zero; return new LongBits((charCodeAt.call(hash, 0) | charCodeAt.call(hash, 1) << 8 | charCodeAt.call(hash, 2) << 16 | charCodeAt.call(hash, 3) << 24) >>> 0, (charCodeAt.call(hash, 4) | charCodeAt.call(hash, 5) << 8 | charCodeAt.call(hash, 6) << 16 | charCodeAt.call(hash, 7) << 24) >>> 0); }; /** * Converts this long bits to a 8 characters long hash. * @returns {string} Hash */ LongBits.prototype.toHash = function toHash() { return String.fromCharCode(this.lo & 255, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, this.hi & 255, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24); }; /** * Zig-zag encodes this long bits. * @returns {util.LongBits} `this` */ LongBits.prototype.zzEncode = function zzEncode() { var mask = this.hi >> 31; this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; this.lo = (this.lo << 1 ^ mask) >>> 0; return this; }; /** * Zig-zag decodes this long bits. * @returns {util.LongBits} `this` */ LongBits.prototype.zzDecode = function zzDecode() { var mask = -(this.lo & 1); this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; this.hi = (this.hi >>> 1 ^ mask) >>> 0; return this; }; /** * Calculates the length of this longbits when encoded as a varint. * @returns {number} Length */ LongBits.prototype.length = function length() { var part0 = this.lo, part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, part2 = this.hi >>> 24; return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10; }; // #endregion ORIGINAL CODE module.exports; }, function () { return { '../util/minimal': __cjsMetaURL$8 }; }); var __cjsMetaURL$8 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/util/minimal.js'; loader.define(__cjsMetaURL$8, function (exports, require, module, __filename, __dirname) { var util = exports; // used to return a Promise where callback is omitted util.asPromise = require("@protobufjs/aspromise"); // converts to / from base64 encoded strings util.base64 = require("@protobufjs/base64"); // base class of rpc.Service util.EventEmitter = require("@protobufjs/eventemitter"); // float handling accross browsers util["float"] = require("@protobufjs/float"); // requires modules optionally and hides the call from bundlers util.inquire = require("@protobufjs/inquire"); // converts to / from utf8 encoded strings util.utf8 = require("@protobufjs/utf8"); // provides a node-like buffer pool in the browser util.pool = require("@protobufjs/pool"); // utility to work with the low and high bits of a 64 bit value util.LongBits = require("./longbits"); /** * Whether running within node or not. * @memberof util * @type {boolean} */ util.isNode = Boolean(typeof global !== "undefined" && global && global.process && global.process.versions && global.process.versions.node); /** * Global object reference. * @memberof util * @type {Object} */ util.global = util.isNode && global || typeof window !== "undefined" && window || typeof self !== "undefined" && self || this; // eslint-disable-line no-invalid-this /** * An immuable empty array. * @memberof util * @type {Array.<*>} * @const */ util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes /** * An immutable empty object. * @type {Object} * @const */ util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes /** * Tests if the specified value is an integer. * @function * @param {*} value Value to test * @returns {boolean} `true` if the value is an integer */ util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; }; /** * Tests if the specified value is a string. * @param {*} value Value to test * @returns {boolean} `true` if the value is a string */ util.isString = function isString(value) { return typeof value === "string" || value instanceof String; }; /** * Tests if the specified value is a non-null object. * @param {*} value Value to test * @returns {boolean} `true` if the value is a non-null object */ util.isObject = function isObject(value) { return value && typeof value === "object"; }; /** * Checks if a property on a message is considered to be present. * This is an alias of {@link util.isSet}. * @function * @param {Object} obj Plain object or message instance * @param {string} prop Property name * @returns {boolean} `true` if considered to be present, otherwise `false` */ util.isset = /** * Checks if a property on a message is considered to be present. * @param {Object} obj Plain object or message instance * @param {string} prop Property name * @returns {boolean} `true` if considered to be present, otherwise `false` */ util.isSet = function isSet(obj, prop) { var value = obj[prop]; if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; return false; }; /** * Any compatible Buffer instance. * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. * @interface Buffer * @extends Uint8Array */ /** * Node's Buffer class if available. * @type {Constructor} */ util.Buffer = function () { try { var Buffer = util.inquire("buffer").Buffer; // refuse to use non-node buffers if not explicitly assigned (perf reasons): return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; } catch (e) { /* istanbul ignore next */ return null; } }(); // Internal alias of or polyfull for Buffer.from. util._Buffer_from = null; // Internal alias of or polyfill for Buffer.allocUnsafe. util._Buffer_allocUnsafe = null; /** * Creates a new buffer of whatever type supported by the environment. * @param {number|number[]} [sizeOrArray=0] Buffer size or number array * @returns {Uint8Array|Buffer} Buffer */ util.newBuffer = function newBuffer(sizeOrArray) { /* istanbul ignore next */ return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray); }; /** * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. * @type {Constructor} */ util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; /** * Any compatible Long instance. * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. * @interface Long * @property {number} low Low bits * @property {number} high High bits * @property {boolean} unsigned Whether unsigned or not */ /** * Long.js's Long class if available. * @type {Constructor} */ util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long || /* istanbul ignore next */ util.global.Long || util.inquire("long"); /** * Regular expression used to verify 2 bit (`bool`) map keys. * @type {RegExp} * @const */ util.key2Re = /^true|false|0|1$/; /** * Regular expression used to verify 32 bit (`int32` etc.) map keys. * @type {RegExp} * @const */ util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; /** * Regular expression used to verify 64 bit (`int64` etc.) map keys. * @type {RegExp} * @const */ util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; /** * Converts a number or long to an 8 characters long hash string. * @param {Long|number} value Value to convert * @returns {string} Hash */ util.longToHash = function longToHash(value) { return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash; }; /** * Converts an 8 characters long hash string to a long or number. * @param {string} hash Hash * @param {boolean} [unsigned=false] Whether unsigned or not * @returns {Long|number} Original value */ util.longFromHash = function longFromHash(hash, unsigned) { var bits = util.LongBits.fromHash(hash); if (util.Long) return util.Long.fromBits(bits.lo, bits.hi, unsigned); return bits.toNumber(Boolean(unsigned)); }; /** * Merges the properties of the source object into the destination object. * @memberof util * @param {Object.} dst Destination object * @param {Object.} src Source object * @param {boolean} [ifNotSet=false] Merges only if the key is not already set * @returns {Object.} Destination object */ function merge(dst, src, ifNotSet) { // used by converters for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) if (dst[keys[i]] === undefined || !ifNotSet) dst[keys[i]] = src[keys[i]]; return dst; } util.merge = merge; /** * Converts the first character of a string to lower case. * @param {string} str String to convert * @returns {string} Converted string */ util.lcFirst = function lcFirst(str) { return str.charAt(0).toLowerCase() + str.substring(1); }; /** * Creates a custom error constructor. * @memberof util * @param {string} name Error name * @returns {Constructor} Custom error constructor */ function newError(name) { function CustomError(message, properties) { if (!(this instanceof CustomError)) return new CustomError(message, properties); // Error.call(this, message); // ^ just returns a new error instance because the ctor can be called as a function Object.defineProperty(this, "message", { get: function get() { return message; } }); /* istanbul ignore next */ if (Error.captureStackTrace) // node Error.captureStackTrace(this, CustomError);else Object.defineProperty(this, "stack", { value: new Error().stack || "" }); if (properties) merge(this, properties); } CustomError.prototype = Object.create(Error.prototype, { constructor: { value: CustomError, writable: true, enumerable: false, configurable: true }, name: { get: function get() { return name; }, set: undefined, enumerable: false, // configurable: false would accurately preserve the behavior of // the original, but I'm guessing that was not intentional. // For an actual error subclass, this property would // be configurable. configurable: true }, toString: { value: function value() { return this.name + ": " + this.message; }, writable: true, enumerable: false, configurable: true } }); return CustomError; } util.newError = newError; /** * Constructs a new protocol error. * @classdesc Error subclass indicating a protocol specifc error. * @memberof util * @extends Error * @template T extends Message * @constructor * @param {string} message Error message * @param {Object.} [properties] Additional properties * @example * try { * MyMessage.decode(someBuffer); // throws if required fields are missing * } catch (e) { * if (e instanceof ProtocolError && e.instance) * console.log("decoded so far: " + JSON.stringify(e.instance)); * } */ util.ProtocolError = newError("ProtocolError"); /** * So far decoded message instance. * @name util.ProtocolError#instance * @type {Message} */ /** * A OneOf getter as returned by {@link util.oneOfGetter}. * @typedef OneOfGetter * @type {function} * @returns {string|undefined} Set field name, if any */ /** * Builds a getter for a oneof's present field name. * @param {string[]} fieldNames Field names * @returns {OneOfGetter} Unbound getter */ util.oneOfGetter = function getOneOf(fieldNames) { var fieldMap = {}; for (var i = 0; i < fieldNames.length; ++i) fieldMap[fieldNames[i]] = 1; /** * @returns {string|undefined} Set field name, if any * @this Object * @ignore */ return function () { // eslint-disable-line consistent-return for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) return keys[i]; }; }; /** * A OneOf setter as returned by {@link util.oneOfSetter}. * @typedef OneOfSetter * @type {function} * @param {string|undefined} value Field name * @returns {undefined} */ /** * Builds a setter for a oneof's present field name. * @param {string[]} fieldNames Field names * @returns {OneOfSetter} Unbound setter */ util.oneOfSetter = function setOneOf(fieldNames) { /** * @param {string} name Field name * @returns {undefined} * @this Object * @ignore */ return function (name) { for (var i = 0; i < fieldNames.length; ++i) if (fieldNames[i] !== name) delete this[fieldNames[i]]; }; }; /** * Default conversion options used for {@link Message#toJSON} implementations. * * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: * * - Longs become strings * - Enums become string keys * - Bytes become base64 encoded strings * - (Sub-)Messages become plain objects * - Maps become plain objects with all string keys * - Repeated fields become arrays * - NaN and Infinity for float and double fields become strings * * @type {IConversionOptions} * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json */ util.toJSONOptions = { longs: String, enums: String, bytes: String, json: true }; // Sets up buffer utility according to the environment (called in index-minimal) util._configure = function () { var Buffer = util.Buffer; /* istanbul ignore if */ if (!Buffer) { util._Buffer_from = util._Buffer_allocUnsafe = null; return; } // because node 4.x buffers are incompatible & immutable // see: https://github.com/dcodeIO/protobuf.js/pull/665 util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || /* istanbul ignore next */ function Buffer_from(value, encoding) { return new Buffer(value, encoding); }; util._Buffer_allocUnsafe = Buffer.allocUnsafe || /* istanbul ignore next */ function Buffer_allocUnsafe(size) { return new Buffer(size); }; }; // #endregion ORIGINAL CODE module.exports; }, function () { return { '@protobufjs/aspromise': __cjsMetaURL, '@protobufjs/base64': __cjsMetaURL$1, '@protobufjs/eventemitter': __cjsMetaURL$2, '@protobufjs/float': __cjsMetaURL$3, '@protobufjs/inquire': __cjsMetaURL$4, '@protobufjs/utf8': __cjsMetaURL$5, '@protobufjs/pool': __cjsMetaURL$6, './longbits': __cjsMetaURL$7 }; }); var __cjsMetaURL$9 = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/writer.js'; loader.define(__cjsMetaURL$9, function (exports, require, module, __filename, __dirname) { module.exports = Writer; var util = require("./util/minimal"); var BufferWriter; // cyclic var LongBits = util.LongBits, base64 = util.base64, utf8 = util.utf8; /** * Constructs a new writer operation instance. * @classdesc Scheduled writer operation. * @constructor * @param {function(*, Uint8Array, number)} fn Function to call * @param {number} len Value byte length * @param {*} val Value to write * @ignore */ function Op(fn, len, val) { /** * Function to call. * @type {function(Uint8Array, number, *)} */ this.fn = fn; /** * Value byte length. * @type {number} */ this.len = len; /** * Next operation. * @type {Writer.Op|undefined} */ this.next = undefined; /** * Value to write. * @type {*} */ this.val = val; // type varies } /* istanbul ignore next */ function noop() {} // eslint-disable-line no-empty-function /** * Constructs a new writer state instance. * @classdesc Copied writer state. * @memberof Writer * @constructor * @param {Writer} writer Writer to copy state from * @ignore */ function State(writer) { /** * Current head. * @type {Writer.Op} */ this.head = writer.head; /** * Current tail. * @type {Writer.Op} */ this.tail = writer.tail; /** * Current buffer length. * @type {number} */ this.len = writer.len; /** * Next state. * @type {State|null} */ this.next = writer.states; } /** * Constructs a new writer instance. * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. * @constructor */ function Writer() { /** * Current length. * @type {number} */ this.len = 0; /** * Operations head. * @type {Object} */ this.head = new Op(noop, 0, 0); /** * Operations tail * @type {Object} */ this.tail = this.head; /** * Linked forked states. * @type {Object|null} */ this.states = null; // When a value is written, the writer calculates its byte length and puts it into a linked // list of operations to perform when finish() is called. This both allows us to allocate // buffers of the exact required size and reduces the amount of work we have to do compared // to first calculating over objects and then encoding over objects. In our case, the encoding // part is just a linked list walk calling operations with already prepared values. } var create = function create() { return util.Buffer ? function create_buffer_setup() { return (Writer.create = function create_buffer() { return new BufferWriter(); })(); } /* istanbul ignore next */ : function create_array() { return new Writer(); }; }; /** * Creates a new writer. * @function * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} */ Writer.create = create(); /** * Allocates a buffer of the specified size. * @param {number} size Buffer size * @returns {Uint8Array} Buffer */ Writer.alloc = function alloc(size) { return new util.Array(size); }; // Use Uint8Array buffer pool in the browser, just like node does with buffers /* istanbul ignore else */ if (util.Array !== Array) Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); /** * Pushes a new operation to the queue. * @param {function(Uint8Array, number, *)} fn Function to call * @param {number} len Value byte length * @param {number} val Value to write * @returns {Writer} `this` * @private */ Writer.prototype._push = function push(fn, len, val) { this.tail = this.tail.next = new Op(fn, len, val); this.len += len; return this; }; function writeByte(val, buf, pos) { buf[pos] = val & 255; } function writeVarint32(val, buf, pos) { while (val > 127) { buf[pos++] = val & 127 | 128; val >>>= 7; } buf[pos] = val; } /** * Constructs a new varint writer operation instance. * @classdesc Scheduled varint writer operation. * @extends Op * @constructor * @param {number} len Value byte length * @param {number} val Value to write * @ignore */ function VarintOp(len, val) { this.len = len; this.next = undefined; this.val = val; } VarintOp.prototype = Object.create(Op.prototype); VarintOp.prototype.fn = writeVarint32; /** * Writes an unsigned 32 bit value as a varint. * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype.uint32 = function write_uint32(value) { // here, the call to this.push has been inlined and a varint specific Op subclass is used. // uint32 is by far the most frequently used operation and benefits significantly from this. this.len += (this.tail = this.tail.next = new VarintOp((value = value >>> 0) < 128 ? 1 : value < 16384 ? 2 : value < 2097152 ? 3 : value < 268435456 ? 4 : 5, value)).len; return this; }; /** * Writes a signed 32 bit value as a varint. * @function * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype.int32 = function write_int32(value) { return value < 0 ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec : this.uint32(value); }; /** * Writes a 32 bit value as a varint, zig-zag encoded. * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype.sint32 = function write_sint32(value) { return this.uint32((value << 1 ^ value >> 31) >>> 0); }; function writeVarint64(val, buf, pos) { while (val.hi) { buf[pos++] = val.lo & 127 | 128; val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; val.hi >>>= 7; } while (val.lo > 127) { buf[pos++] = val.lo & 127 | 128; val.lo = val.lo >>> 7; } buf[pos++] = val.lo; } /** * Writes an unsigned 64 bit value as a varint. * @param {Long|number|string} value Value to write * @returns {Writer} `this` * @throws {TypeError} If `value` is a string and no long library is present. */ Writer.prototype.uint64 = function write_uint64(value) { var bits = LongBits.from(value); return this._push(writeVarint64, bits.length(), bits); }; /** * Writes a signed 64 bit value as a varint. * @function * @param {Long|number|string} value Value to write * @returns {Writer} `this` * @throws {TypeError} If `value` is a string and no long library is present. */ Writer.prototype.int64 = Writer.prototype.uint64; /** * Writes a signed 64 bit value as a varint, zig-zag encoded. * @param {Long|number|string} value Value to write * @returns {Writer} `this` * @throws {TypeError} If `value` is a string and no long library is present. */ Writer.prototype.sint64 = function write_sint64(value) { var bits = LongBits.from(value).zzEncode(); return this._push(writeVarint64, bits.length(), bits); }; /** * Writes a boolish value as a varint. * @param {boolean} value Value to write * @returns {Writer} `this` */ Writer.prototype.bool = function write_bool(value) { return this._push(writeByte, 1, value ? 1 : 0); }; function writeFixed32(val, buf, pos) { buf[pos] = val & 255; buf[pos + 1] = val >>> 8 & 255; buf[pos + 2] = val >>> 16 & 255; buf[pos + 3] = val >>> 24; } /** * Writes an unsigned 32 bit value as fixed 32 bits. * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype.fixed32 = function write_fixed32(value) { return this._push(writeFixed32, 4, value >>> 0); }; /** * Writes a signed 32 bit value as fixed 32 bits. * @function * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype.sfixed32 = Writer.prototype.fixed32; /** * Writes an unsigned 64 bit value as fixed 64 bits. * @param {Long|number|string} value Value to write * @returns {Writer} `this` * @throws {TypeError} If `value` is a string and no long library is present. */ Writer.prototype.fixed64 = function write_fixed64(value) { var bits = LongBits.from(value); return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); }; /** * Writes a signed 64 bit value as fixed 64 bits. * @function * @param {Long|number|string} value Value to write * @returns {Writer} `this` * @throws {TypeError} If `value` is a string and no long library is present. */ Writer.prototype.sfixed64 = Writer.prototype.fixed64; /** * Writes a float (32 bit). * @function * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype["float"] = function write_float(value) { return this._push(util["float"].writeFloatLE, 4, value); }; /** * Writes a double (64 bit float). * @function * @param {number} value Value to write * @returns {Writer} `this` */ Writer.prototype["double"] = function write_double(value) { return this._push(util["float"].writeDoubleLE, 8, value); }; var writeBytes = util.Array.prototype.set ? function writeBytes_set(val, buf, pos) { buf.set(val, pos); // also works for plain array values } /* istanbul ignore next */ : function writeBytes_for(val, buf, pos) { for (var i = 0; i < val.length; ++i) buf[pos + i] = val[i]; }; /** * Writes a sequence of bytes. * @param {Uint8Array|string} value Buffer or base64 encoded string to write * @returns {Writer} `this` */ Writer.prototype.bytes = function write_bytes(value) { var len = value.length >>> 0; if (!len) return this._push(writeByte, 1, 0); if (util.isString(value)) { var buf = Writer.alloc(len = base64.length(value)); base64.decode(value, buf, 0); value = buf; } return this.uint32(len)._push(writeBytes, len, value); }; /** * Writes a string. * @param {string} value Value to write * @returns {Writer} `this` */ Writer.prototype.string = function write_string(value) { var len = utf8.length(value); return len ? this.uint32(len)._push(utf8.write, len, value) : this._push(writeByte, 1, 0); }; /** * Forks this writer's state by pushing it to a stack. * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. * @returns {Writer} `this` */ Writer.prototype.fork = function fork() { this.states = new State(this); this.head = this.tail = new Op(noop, 0, 0); this.len = 0; return this; }; /** * Resets this instance to the last state. * @returns {Writer} `this` */ Writer.prototype.reset = function reset() { if (this.states) { this.head = this.states.head; this.tail = this.states.tail; this.len = this.states.len; this.states = this.states.next; } else { this.head = this.tail = new Op(noop, 0, 0); this.len = 0; } return this; }; /** * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. * @returns {Writer} `this` */ Writer.prototype.ldelim = function ldelim() { var head = this.head, tail = this.tail, len = this.len; this.reset().uint32(len); if (len) { this.tail.next = head.next; // skip noop this.tail = tail; this.len += len; } return this; }; /** * Finishes the write operation. * @returns {Uint8Array} Finished buffer */ Writer.prototype.finish = function finish() { var head = this.head.next, // skip noop buf = this.constructor.alloc(this.len), pos = 0; while (head) { head.fn(head.val, buf, pos); pos += head.len; head = head.next; } // this.head = this.tail = null; return buf; }; Writer._configure = function (BufferWriter_) { BufferWriter = BufferWriter_; Writer.create = create(); BufferWriter._configure(); }; // #endregion ORIGINAL CODE module.exports; }, function () { return { './util/minimal': __cjsMetaURL$8 }; }); var __cjsMetaURL$a = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/writer_buffer.js'; loader.define(__cjsMetaURL$a, function (exports, require, module, __filename, __dirname) { module.exports = BufferWriter; // extends Writer var Writer = require("./writer"); (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; var util = require("./util/minimal"); /** * Constructs a new buffer writer instance. * @classdesc Wire format writer using node buffers. * @extends Writer * @constructor */ function BufferWriter() { Writer.call(this); } BufferWriter._configure = function () { /** * Allocates a buffer of the specified size. * @function * @param {number} size Buffer size * @returns {Buffer} Buffer */ BufferWriter.alloc = util._Buffer_allocUnsafe; BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" ? function writeBytesBuffer_set(val, buf, pos) { buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) // also works for plain array values } /* istanbul ignore next */ : function writeBytesBuffer_copy(val, buf, pos) { if (val.copy) // Buffer values val.copy(buf, pos, 0, val.length);else for (var i = 0; i < val.length;) // plain array values buf[pos++] = val[i++]; }; }; /** * @override */ BufferWriter.prototype.bytes = function write_bytes_buffer(value) { if (util.isString(value)) value = util._Buffer_from(value, "base64"); var len = value.length >>> 0; this.uint32(len); if (len) this._push(BufferWriter.writeBytesBuffer, len, value); return this; }; function writeStringBuffer(val, buf, pos) { if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) util.utf8.write(val, buf, pos);else if (buf.utf8Write) buf.utf8Write(val, pos);else buf.write(val, pos); } /** * @override */ BufferWriter.prototype.string = function write_string_buffer(value) { var len = util.Buffer.byteLength(value); this.uint32(len); if (len) this._push(writeStringBuffer, len, value); return this; }; /** * Finishes the write operation. * @name BufferWriter#finish * @function * @returns {Buffer} Finished buffer */ BufferWriter._configure(); // #endregion ORIGINAL CODE module.exports; }, function () { return { './writer': __cjsMetaURL$9, './util/minimal': __cjsMetaURL$8 }; }); var __cjsMetaURL$b = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/reader.js'; loader.define(__cjsMetaURL$b, function (exports, require, module, __filename, __dirname) { module.exports = Reader; var util = require("./util/minimal"); var BufferReader; // cyclic var LongBits = util.LongBits, utf8 = util.utf8; /* istanbul ignore next */ function indexOutOfRange(reader, writeLength) { return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); } /** * Constructs a new reader instance using the specified buffer. * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. * @constructor * @param {Uint8Array} buffer Buffer to read from */ function Reader(buffer) { /** * Read buffer. * @type {Uint8Array} */ this.buf = buffer; /** * Read buffer position. * @type {number} */ this.pos = 0; /** * Read buffer length. * @type {number} */ this.len = buffer.length; } var create_array = typeof Uint8Array !== "undefined" ? function create_typed_array(buffer) { if (buffer instanceof Uint8Array || Array.isArray(buffer)) return new Reader(buffer); throw Error("illegal buffer"); } /* istanbul ignore next */ : function create_array(buffer) { if (Array.isArray(buffer)) return new Reader(buffer); throw Error("illegal buffer"); }; var create = function create() { return util.Buffer ? function create_buffer_setup(buffer) { return (Reader.create = function create_buffer(buffer) { return util.Buffer.isBuffer(buffer) ? new BufferReader(buffer) /* istanbul ignore next */ : create_array(buffer); })(buffer); } /* istanbul ignore next */ : create_array; }; /** * Creates a new reader using the specified buffer. * @function * @param {Uint8Array|Buffer} buffer Buffer to read from * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} * @throws {Error} If `buffer` is not a valid buffer */ Reader.create = create(); Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; /** * Reads a varint as an unsigned 32 bit value. * @function * @returns {number} Value read */ Reader.prototype.uint32 = function read_uint32_setup() { var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) return function read_uint32() { value = (this.buf[this.pos] & 127) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; /* istanbul ignore if */ if ((this.pos += 5) > this.len) { this.pos = this.len; throw indexOutOfRange(this, 10); } return value; }; }(); /** * Reads a varint as a signed 32 bit value. * @returns {number} Value read */ Reader.prototype.int32 = function read_int32() { return this.uint32() | 0; }; /** * Reads a zig-zag encoded varint as a signed 32 bit value. * @returns {number} Value read */ Reader.prototype.sint32 = function read_sint32() { var value = this.uint32(); return value >>> 1 ^ -(value & 1) | 0; }; /* eslint-disable no-invalid-this */ function readLongVarint() { // tends to deopt with local vars for octet etc. var bits = new LongBits(0, 0); var i = 0; if (this.len - this.pos > 4) { // fast route (lo) for (; i < 4; ++i) { // 1st..4th bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } // 5th bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; if (this.buf[this.pos++] < 128) return bits; i = 0; } else { for (; i < 3; ++i) { /* istanbul ignore if */ if (this.pos >= this.len) throw indexOutOfRange(this); // 1st..3th bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; if (this.buf[this.pos++] < 128) return bits; } // 4th bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; return bits; } if (this.len - this.pos > 4) { // fast route (hi) for (; i < 5; ++i) { // 6th..10th bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } else { for (; i < 5; ++i) { /* istanbul ignore if */ if (this.pos >= this.len) throw indexOutOfRange(this); // 6th..10th bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; if (this.buf[this.pos++] < 128) return bits; } } /* istanbul ignore next */ throw Error("invalid varint encoding"); } /* eslint-enable no-invalid-this */ /** * Reads a varint as a signed 64 bit value. * @name Reader#int64 * @function * @returns {Long} Value read */ /** * Reads a varint as an unsigned 64 bit value. * @name Reader#uint64 * @function * @returns {Long} Value read */ /** * Reads a zig-zag encoded varint as a signed 64 bit value. * @name Reader#sint64 * @function * @returns {Long} Value read */ /** * Reads a varint as a boolean. * @returns {boolean} Value read */ Reader.prototype.bool = function read_bool() { return this.uint32() !== 0; }; function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` return (buf[end - 4] | buf[end - 3] << 8 | buf[end - 2] << 16 | buf[end - 1] << 24) >>> 0; } /** * Reads fixed 32 bits as an unsigned 32 bit integer. * @returns {number} Value read */ Reader.prototype.fixed32 = function read_fixed32() { /* istanbul ignore if */ if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4); }; /** * Reads fixed 32 bits as a signed 32 bit integer. * @returns {number} Value read */ Reader.prototype.sfixed32 = function read_sfixed32() { /* istanbul ignore if */ if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); return readFixed32_end(this.buf, this.pos += 4) | 0; }; /* eslint-disable no-invalid-this */ function readFixed64() /* this: Reader */ { /* istanbul ignore if */ if (this.pos + 8 > this.len) throw indexOutOfRange(this, 8); return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); } /* eslint-enable no-invalid-this */ /** * Reads fixed 64 bits. * @name Reader#fixed64 * @function * @returns {Long} Value read */ /** * Reads zig-zag encoded fixed 64 bits. * @name Reader#sfixed64 * @function * @returns {Long} Value read */ /** * Reads a float (32 bit) as a number. * @function * @returns {number} Value read */ Reader.prototype["float"] = function read_float() { /* istanbul ignore if */ if (this.pos + 4 > this.len) throw indexOutOfRange(this, 4); var value = util["float"].readFloatLE(this.buf, this.pos); this.pos += 4; return value; }; /** * Reads a double (64 bit float) as a number. * @function * @returns {number} Value read */ Reader.prototype["double"] = function read_double() { /* istanbul ignore if */ if (this.pos + 8 > this.len) throw indexOutOfRange(this, 4); var value = util["float"].readDoubleLE(this.buf, this.pos); this.pos += 8; return value; }; /** * Reads a sequence of bytes preceeded by its length as a varint. * @returns {Uint8Array} Value read */ Reader.prototype.bytes = function read_bytes() { var length = this.uint32(), start = this.pos, end = this.pos + length; /* istanbul ignore if */ if (end > this.len) throw indexOutOfRange(this, length); this.pos += length; if (Array.isArray(this.buf)) // plain array return this.buf.slice(start, end); if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1 var nativeBuffer = util.Buffer; return nativeBuffer ? nativeBuffer.alloc(0) : new this.buf.constructor(0); } return this._slice.call(this.buf, start, end); }; /** * Reads a string preceeded by its byte length as a varint. * @returns {string} Value read */ Reader.prototype.string = function read_string() { var bytes = this.bytes(); return utf8.read(bytes, 0, bytes.length); }; /** * Skips the specified number of bytes if specified, otherwise skips a varint. * @param {number} [length] Length if known, otherwise a varint is assumed * @returns {Reader} `this` */ Reader.prototype.skip = function skip(length) { if (typeof length === "number") { /* istanbul ignore if */ if (this.pos + length > this.len) throw indexOutOfRange(this, length); this.pos += length; } else { do { /* istanbul ignore if */ if (this.pos >= this.len) throw indexOutOfRange(this); } while (this.buf[this.pos++] & 128); } return this; }; /** * Skips the next element of the specified wire type. * @param {number} wireType Wire type received * @returns {Reader} `this` */ Reader.prototype.skipType = function (wireType) { switch (wireType) { case 0: this.skip(); break; case 1: this.skip(8); break; case 2: this.skip(this.uint32()); break; case 3: while ((wireType = this.uint32() & 7) !== 4) { this.skipType(wireType); } break; case 5: this.skip(4); break; /* istanbul ignore next */ default: throw Error("invalid wire type " + wireType + " at offset " + this.pos); } return this; }; Reader._configure = function (BufferReader_) { BufferReader = BufferReader_; Reader.create = create(); BufferReader._configure(); var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; util.merge(Reader.prototype, { int64: function read_int64() { return readLongVarint.call(this)[fn](false); }, uint64: function read_uint64() { return readLongVarint.call(this)[fn](true); }, sint64: function read_sint64() { return readLongVarint.call(this).zzDecode()[fn](false); }, fixed64: function read_fixed64() { return readFixed64.call(this)[fn](true); }, sfixed64: function read_sfixed64() { return readFixed64.call(this)[fn](false); } }); }; // #endregion ORIGINAL CODE module.exports; }, function () { return { './util/minimal': __cjsMetaURL$8 }; }); var __cjsMetaURL$c = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/reader_buffer.js'; loader.define(__cjsMetaURL$c, function (exports, require, module, __filename, __dirname) { module.exports = BufferReader; // extends Reader var Reader = require("./reader"); (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; var util = require("./util/minimal"); /** * Constructs a new buffer reader instance. * @classdesc Wire format reader using node buffers. * @extends Reader * @constructor * @param {Buffer} buffer Buffer to read from */ function BufferReader(buffer) { Reader.call(this, buffer); /** * Read buffer. * @name BufferReader#buf * @type {Buffer} */ } BufferReader._configure = function () { /* istanbul ignore else */ if (util.Buffer) BufferReader.prototype._slice = util.Buffer.prototype.slice; }; /** * @override */ BufferReader.prototype.string = function read_string_buffer() { var len = this.uint32(); // modifies pos return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); }; /** * Reads a sequence of bytes preceeded by its length as a varint. * @name BufferReader#bytes * @function * @returns {Buffer} Value read */ BufferReader._configure(); // #endregion ORIGINAL CODE module.exports; }, function () { return { './reader': __cjsMetaURL$b, './util/minimal': __cjsMetaURL$8 }; }); var __cjsMetaURL$d = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/rpc/service.js'; loader.define(__cjsMetaURL$d, function (exports, require, module, __filename, __dirname) { module.exports = Service; var util = require("../util/minimal"); // Extends EventEmitter (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; /** * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. * * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. * @typedef rpc.ServiceMethodCallback * @template TRes extends Message * @type {function} * @param {Error|null} error Error, if any * @param {TRes} [response] Response message * @returns {undefined} */ /** * A service method part of a {@link rpc.Service} as created by {@link Service.create}. * @typedef rpc.ServiceMethod * @template TReq extends Message * @template TRes extends Message * @type {function} * @param {TReq|Properties} request Request message or plain object * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` */ /** * Constructs a new RPC service instance. * @classdesc An RPC service as returned by {@link Service#create}. * @exports rpc.Service * @extends util.EventEmitter * @constructor * @param {RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ function Service(rpcImpl, requestDelimited, responseDelimited) { if (typeof rpcImpl !== "function") throw TypeError("rpcImpl must be a function"); util.EventEmitter.call(this); /** * RPC implementation. Becomes `null` once the service is ended. * @type {RPCImpl|null} */ this.rpcImpl = rpcImpl; /** * Whether requests are length-delimited. * @type {boolean} */ this.requestDelimited = Boolean(requestDelimited); /** * Whether responses are length-delimited. * @type {boolean} */ this.responseDelimited = Boolean(responseDelimited); } /** * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. * @param {Method|rpc.ServiceMethod} method Reflected or static method * @param {Constructor} requestCtor Request constructor * @param {Constructor} responseCtor Response constructor * @param {TReq|Properties} request Request message or plain object * @param {rpc.ServiceMethodCallback} callback Service callback * @returns {undefined} * @template TReq extends Message * @template TRes extends Message */ Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { if (!request) throw TypeError("request must be specified"); var self = this; if (!callback) return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); if (!self.rpcImpl) { setTimeout(function () { callback(Error("already ended")); }, 0); return undefined; } try { return self.rpcImpl(method, requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), function rpcCallback(err, response) { if (err) { self.emit("error", err, method); return callback(err); } if (response === null) { self.end( /* endedByRPC */ true); return undefined; } if (!(response instanceof responseCtor)) { try { response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); } catch (err) { self.emit("error", err, method); return callback(err); } } self.emit("data", response, method); return callback(null, response); }); } catch (err) { self.emit("error", err, method); setTimeout(function () { callback(err); }, 0); return undefined; } }; /** * Ends this service and emits the `end` event. * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. * @returns {rpc.Service} `this` */ Service.prototype.end = function end(endedByRPC) { if (this.rpcImpl) { if (!endedByRPC) // signal end to rpcImpl this.rpcImpl(null, null, null); this.rpcImpl = null; this.emit("end").off(); } return this; }; // #endregion ORIGINAL CODE module.exports; }, function () { return { '../util/minimal': __cjsMetaURL$8 }; }); var __cjsMetaURL$e = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/rpc.js'; loader.define(__cjsMetaURL$e, function (exports, require, module, __filename, __dirname) { /** * Streaming RPC helpers. * @namespace */ var rpc = exports; /** * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. * @typedef RPCImpl * @type {function} * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called * @param {Uint8Array} requestData Request data * @param {RPCImplCallback} callback Callback function * @returns {undefined} * @example * function rpcImpl(method, requestData, callback) { * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code * throw Error("no such method"); * asynchronouslyObtainAResponse(requestData, function(err, responseData) { * callback(err, responseData); * }); * } */ /** * Node-style callback as used by {@link RPCImpl}. * @typedef RPCImplCallback * @type {function} * @param {Error|null} error Error, if any, otherwise `null` * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error * @returns {undefined} */ rpc.Service = require("./rpc/service"); // #endregion ORIGINAL CODE module.exports; }, function () { return { './rpc/service': __cjsMetaURL$d }; }); var __cjsMetaURL$f = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/roots.js'; loader.define(__cjsMetaURL$f, function (exports, require, module, __filename, __dirname) { module.exports = {}; /** * Named roots. * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). * Can also be used manually to make roots available across modules. * @name roots * @type {Object.} * @example * // pbjs -r myroot -o compiled.js ... * * // in another module: * require("./compiled.js"); * * // in any subsequent module: * var root = protobuf.roots["myroot"]; */ // #endregion ORIGINAL CODE module.exports; }, {}); var __cjsMetaURL$g = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/src/index-minimal.js'; loader.define(__cjsMetaURL$g, function (exports, require, module, __filename, __dirname) { var protobuf = exports; /** * Build type, one of `"full"`, `"light"` or `"minimal"`. * @name build * @type {string} * @const */ protobuf.build = "minimal"; // Serialization protobuf.Writer = require("./writer"); protobuf.BufferWriter = require("./writer_buffer"); protobuf.Reader = require("./reader"); protobuf.BufferReader = require("./reader_buffer"); // Utility protobuf.util = require("./util/minimal"); protobuf.rpc = require("./rpc"); protobuf.roots = require("./roots"); protobuf.configure = configure; /* istanbul ignore next */ /** * Reconfigures the library according to the environment. * @returns {undefined} */ function configure() { protobuf.util._configure(); protobuf.Writer._configure(protobuf.BufferWriter); protobuf.Reader._configure(protobuf.BufferReader); } // Set up buffer utility according to the environment configure(); // #endregion ORIGINAL CODE module.exports; }, function () { return { './writer': __cjsMetaURL$9, './writer_buffer': __cjsMetaURL$a, './reader': __cjsMetaURL$b, './reader_buffer': __cjsMetaURL$c, './util/minimal': __cjsMetaURL$8, './rpc': __cjsMetaURL$e, './roots': __cjsMetaURL$f }; }); var __cjsMetaURL$h = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/node_modules/protobufjs/minimal.js'; loader.define(__cjsMetaURL$h, function (exports, require, module, __filename, __dirname) { module.exports = require("./src/index-minimal"); // #endregion ORIGINAL CODE module.exports; }, function () { return { './src/index-minimal': __cjsMetaURL$g }; }); var _cjsExports; var __cjsMetaURL$i = 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/assets/ngame/message/proto.js'; loader.define(__cjsMetaURL$i, function (exports, require, module, __filename, __dirname) { var $protobuf = require("protobufjs/minimal.js"); // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); $root.GOnHookPet = function () { /** * Properties of a GOnHookPet. * @exports IGOnHookPet * @interface IGOnHookPet * @property {string|null} [key] GOnHookPet key * @property {number|null} [petTbId] GOnHookPet petTbId */ /** * Constructs a new GOnHookPet. * @exports GOnHookPet * @classdesc Represents a GOnHookPet. * @implements IGOnHookPet * @constructor * @param {IGOnHookPet=} [properties] Properties to set */ function GOnHookPet(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GOnHookPet key. * @member {string} key * @memberof GOnHookPet * @instance */ GOnHookPet.prototype.key = ""; /** * GOnHookPet petTbId. * @member {number} petTbId * @memberof GOnHookPet * @instance */ GOnHookPet.prototype.petTbId = 0; /** * Creates a new GOnHookPet instance using the specified properties. * @function create * @memberof GOnHookPet * @static * @param {IGOnHookPet=} [properties] Properties to set * @returns {GOnHookPet} GOnHookPet instance */ GOnHookPet.create = function create(properties) { return new GOnHookPet(properties); }; /** * Encodes the specified GOnHookPet message. Does not implicitly {@link GOnHookPet.verify|verify} messages. * @function encode * @memberof GOnHookPet * @static * @param {IGOnHookPet} message GOnHookPet message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GOnHookPet.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.key != null && Object.hasOwnProperty.call(message, "key")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.key); if (message.petTbId != null && Object.hasOwnProperty.call(message, "petTbId")) writer.uint32( /* id 2, wireType 0 =*/ 16).int32(message.petTbId); return writer; }; /** * Encodes the specified GOnHookPet message, length delimited. Does not implicitly {@link GOnHookPet.verify|verify} messages. * @function encodeDelimited * @memberof GOnHookPet * @static * @param {IGOnHookPet} message GOnHookPet message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GOnHookPet.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GOnHookPet message from the specified reader or buffer. * @function decode * @memberof GOnHookPet * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GOnHookPet} GOnHookPet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GOnHookPet.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GOnHookPet(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.key = reader.string(); break; } case 2: { message.petTbId = reader.int32(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GOnHookPet message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GOnHookPet * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GOnHookPet} GOnHookPet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GOnHookPet.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GOnHookPet message. * @function verify * @memberof GOnHookPet * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GOnHookPet.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.key != null && message.hasOwnProperty("key")) if (!$util.isString(message.key)) return "key: string expected"; if (message.petTbId != null && message.hasOwnProperty("petTbId")) if (!$util.isInteger(message.petTbId)) return "petTbId: integer expected"; return null; }; /** * Creates a GOnHookPet message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GOnHookPet * @static * @param {Object.} object Plain object * @returns {GOnHookPet} GOnHookPet */ GOnHookPet.fromObject = function fromObject(object) { if (object instanceof $root.GOnHookPet) return object; var message = new $root.GOnHookPet(); if (object.key != null) message.key = String(object.key); if (object.petTbId != null) message.petTbId = object.petTbId | 0; return message; }; /** * Creates a plain object from a GOnHookPet message. Also converts values to other types if specified. * @function toObject * @memberof GOnHookPet * @static * @param {GOnHookPet} message GOnHookPet * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ GOnHookPet.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.key = ""; object.petTbId = 0; } if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; if (message.petTbId != null && message.hasOwnProperty("petTbId")) object.petTbId = message.petTbId; return object; }; /** * Converts this GOnHookPet to JSON. * @function toJSON * @memberof GOnHookPet * @instance * @returns {Object.} JSON object */ GOnHookPet.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for GOnHookPet * @function getTypeUrl * @memberof GOnHookPet * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ GOnHookPet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/GOnHookPet"; }; return GOnHookPet; }(); $root.GOnHookPets = function () { /** * Properties of a GOnHookPets. * @exports IGOnHookPets * @interface IGOnHookPets * @property {Array.|null} [pets] GOnHookPets pets */ /** * Constructs a new GOnHookPets. * @exports GOnHookPets * @classdesc Represents a GOnHookPets. * @implements IGOnHookPets * @constructor * @param {IGOnHookPets=} [properties] Properties to set */ function GOnHookPets(properties) { this.pets = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GOnHookPets pets. * @member {Array.} pets * @memberof GOnHookPets * @instance */ GOnHookPets.prototype.pets = $util.emptyArray; /** * Creates a new GOnHookPets instance using the specified properties. * @function create * @memberof GOnHookPets * @static * @param {IGOnHookPets=} [properties] Properties to set * @returns {GOnHookPets} GOnHookPets instance */ GOnHookPets.create = function create(properties) { return new GOnHookPets(properties); }; /** * Encodes the specified GOnHookPets message. Does not implicitly {@link GOnHookPets.verify|verify} messages. * @function encode * @memberof GOnHookPets * @static * @param {IGOnHookPets} message GOnHookPets message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GOnHookPets.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.pets != null && message.pets.length) for (var i = 0; i < message.pets.length; ++i) $root.GOnHookPet.encode(message.pets[i], writer.uint32( /* id 1, wireType 2 =*/ 10).fork()).ldelim(); return writer; }; /** * Encodes the specified GOnHookPets message, length delimited. Does not implicitly {@link GOnHookPets.verify|verify} messages. * @function encodeDelimited * @memberof GOnHookPets * @static * @param {IGOnHookPets} message GOnHookPets message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GOnHookPets.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GOnHookPets message from the specified reader or buffer. * @function decode * @memberof GOnHookPets * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GOnHookPets} GOnHookPets * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GOnHookPets.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GOnHookPets(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.pets && message.pets.length)) message.pets = []; message.pets.push($root.GOnHookPet.decode(reader, reader.uint32())); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GOnHookPets message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GOnHookPets * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GOnHookPets} GOnHookPets * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GOnHookPets.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GOnHookPets message. * @function verify * @memberof GOnHookPets * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GOnHookPets.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.pets != null && message.hasOwnProperty("pets")) { if (!Array.isArray(message.pets)) return "pets: array expected"; for (var i = 0; i < message.pets.length; ++i) { var error = $root.GOnHookPet.verify(message.pets[i]); if (error) return "pets." + error; } } return null; }; /** * Creates a GOnHookPets message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GOnHookPets * @static * @param {Object.} object Plain object * @returns {GOnHookPets} GOnHookPets */ GOnHookPets.fromObject = function fromObject(object) { if (object instanceof $root.GOnHookPets) return object; var message = new $root.GOnHookPets(); if (object.pets) { if (!Array.isArray(object.pets)) throw TypeError(".GOnHookPets.pets: array expected"); message.pets = []; for (var i = 0; i < object.pets.length; ++i) { if (typeof object.pets[i] !== "object") throw TypeError(".GOnHookPets.pets: object expected"); message.pets[i] = $root.GOnHookPet.fromObject(object.pets[i]); } } return message; }; /** * Creates a plain object from a GOnHookPets message. Also converts values to other types if specified. * @function toObject * @memberof GOnHookPets * @static * @param {GOnHookPets} message GOnHookPets * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ GOnHookPets.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.pets = []; if (message.pets && message.pets.length) { object.pets = []; for (var j = 0; j < message.pets.length; ++j) object.pets[j] = $root.GOnHookPet.toObject(message.pets[j], options); } return object; }; /** * Converts this GOnHookPets to JSON. * @function toJSON * @memberof GOnHookPets * @instance * @returns {Object.} JSON object */ GOnHookPets.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for GOnHookPets * @function getTypeUrl * @memberof GOnHookPets * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ GOnHookPets.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/GOnHookPets"; }; return GOnHookPets; }(); $root.GPVPStart = function () { /** * Properties of a GPVPStart. * @exports IGPVPStart * @interface IGPVPStart * @property {string|null} [leftTactical] GPVPStart leftTactical * @property {Object.|null} [leftPets] GPVPStart leftPets * @property {string|null} [rightTactical] GPVPStart rightTactical * @property {Object.|null} [rightPets] GPVPStart rightPets */ /** * Constructs a new GPVPStart. * @exports GPVPStart * @classdesc Represents a GPVPStart. * @implements IGPVPStart * @constructor * @param {IGPVPStart=} [properties] Properties to set */ function GPVPStart(properties) { this.leftPets = {}; this.rightPets = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GPVPStart leftTactical. * @member {string} leftTactical * @memberof GPVPStart * @instance */ GPVPStart.prototype.leftTactical = ""; /** * GPVPStart leftPets. * @member {Object.} leftPets * @memberof GPVPStart * @instance */ GPVPStart.prototype.leftPets = $util.emptyObject; /** * GPVPStart rightTactical. * @member {string} rightTactical * @memberof GPVPStart * @instance */ GPVPStart.prototype.rightTactical = ""; /** * GPVPStart rightPets. * @member {Object.} rightPets * @memberof GPVPStart * @instance */ GPVPStart.prototype.rightPets = $util.emptyObject; /** * Creates a new GPVPStart instance using the specified properties. * @function create * @memberof GPVPStart * @static * @param {IGPVPStart=} [properties] Properties to set * @returns {GPVPStart} GPVPStart instance */ GPVPStart.create = function create(properties) { return new GPVPStart(properties); }; /** * Encodes the specified GPVPStart message. Does not implicitly {@link GPVPStart.verify|verify} messages. * @function encode * @memberof GPVPStart * @static * @param {IGPVPStart} message GPVPStart message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GPVPStart.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.leftTactical != null && Object.hasOwnProperty.call(message, "leftTactical")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.leftTactical); if (message.leftPets != null && Object.hasOwnProperty.call(message, "leftPets")) for (var keys = Object.keys(message.leftPets), i = 0; i < keys.length; ++i) writer.uint32( /* id 2, wireType 2 =*/ 18).fork().uint32( /* id 1, wireType 0 =*/ 8).int64(keys[i]).uint32( /* id 2, wireType 2 =*/ 18).string(message.leftPets[keys[i]]).ldelim(); if (message.rightTactical != null && Object.hasOwnProperty.call(message, "rightTactical")) writer.uint32( /* id 3, wireType 2 =*/ 26).string(message.rightTactical); if (message.rightPets != null && Object.hasOwnProperty.call(message, "rightPets")) for (var keys = Object.keys(message.rightPets), i = 0; i < keys.length; ++i) writer.uint32( /* id 4, wireType 2 =*/ 34).fork().uint32( /* id 1, wireType 0 =*/ 8).int64(keys[i]).uint32( /* id 2, wireType 2 =*/ 18).string(message.rightPets[keys[i]]).ldelim(); return writer; }; /** * Encodes the specified GPVPStart message, length delimited. Does not implicitly {@link GPVPStart.verify|verify} messages. * @function encodeDelimited * @memberof GPVPStart * @static * @param {IGPVPStart} message GPVPStart message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GPVPStart.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GPVPStart message from the specified reader or buffer. * @function decode * @memberof GPVPStart * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GPVPStart} GPVPStart * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GPVPStart.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GPVPStart(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.leftTactical = reader.string(); break; } case 2: { if (message.leftPets === $util.emptyObject) message.leftPets = {}; var end2 = reader.uint32() + reader.pos; key = 0; value = ""; while (reader.pos < end2) { var tag2 = reader.uint32(); switch (tag2 >>> 3) { case 1: key = reader.int64(); break; case 2: value = reader.string(); break; default: reader.skipType(tag2 & 7); break; } } message.leftPets[typeof key === "object" ? $util.longToHash(key) : key] = value; break; } case 3: { message.rightTactical = reader.string(); break; } case 4: { if (message.rightPets === $util.emptyObject) message.rightPets = {}; var end2 = reader.uint32() + reader.pos; key = 0; value = ""; while (reader.pos < end2) { var tag2 = reader.uint32(); switch (tag2 >>> 3) { case 1: key = reader.int64(); break; case 2: value = reader.string(); break; default: reader.skipType(tag2 & 7); break; } } message.rightPets[typeof key === "object" ? $util.longToHash(key) : key] = value; break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GPVPStart message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GPVPStart * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GPVPStart} GPVPStart * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GPVPStart.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GPVPStart message. * @function verify * @memberof GPVPStart * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GPVPStart.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.leftTactical != null && message.hasOwnProperty("leftTactical")) if (!$util.isString(message.leftTactical)) return "leftTactical: string expected"; if (message.leftPets != null && message.hasOwnProperty("leftPets")) { if (!$util.isObject(message.leftPets)) return "leftPets: object expected"; var key = Object.keys(message.leftPets); for (var i = 0; i < key.length; ++i) { if (!$util.key64Re.test(key[i])) return "leftPets: integer|Long key{k:int64} expected"; if (!$util.isString(message.leftPets[key[i]])) return "leftPets: string{k:int64} expected"; } } if (message.rightTactical != null && message.hasOwnProperty("rightTactical")) if (!$util.isString(message.rightTactical)) return "rightTactical: string expected"; if (message.rightPets != null && message.hasOwnProperty("rightPets")) { if (!$util.isObject(message.rightPets)) return "rightPets: object expected"; var key = Object.keys(message.rightPets); for (var i = 0; i < key.length; ++i) { if (!$util.key64Re.test(key[i])) return "rightPets: integer|Long key{k:int64} expected"; if (!$util.isString(message.rightPets[key[i]])) return "rightPets: string{k:int64} expected"; } } return null; }; /** * Creates a GPVPStart message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GPVPStart * @static * @param {Object.} object Plain object * @returns {GPVPStart} GPVPStart */ GPVPStart.fromObject = function fromObject(object) { if (object instanceof $root.GPVPStart) return object; var message = new $root.GPVPStart(); if (object.leftTactical != null) message.leftTactical = String(object.leftTactical); if (object.leftPets) { if (typeof object.leftPets !== "object") throw TypeError(".GPVPStart.leftPets: object expected"); message.leftPets = {}; for (var keys = Object.keys(object.leftPets), i = 0; i < keys.length; ++i) message.leftPets[keys[i]] = String(object.leftPets[keys[i]]); } if (object.rightTactical != null) message.rightTactical = String(object.rightTactical); if (object.rightPets) { if (typeof object.rightPets !== "object") throw TypeError(".GPVPStart.rightPets: object expected"); message.rightPets = {}; for (var keys = Object.keys(object.rightPets), i = 0; i < keys.length; ++i) message.rightPets[keys[i]] = String(object.rightPets[keys[i]]); } return message; }; /** * Creates a plain object from a GPVPStart message. Also converts values to other types if specified. * @function toObject * @memberof GPVPStart * @static * @param {GPVPStart} message GPVPStart * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ GPVPStart.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.objects || options.defaults) { object.leftPets = {}; object.rightPets = {}; } if (options.defaults) { object.leftTactical = ""; object.rightTactical = ""; } if (message.leftTactical != null && message.hasOwnProperty("leftTactical")) object.leftTactical = message.leftTactical; var keys2; if (message.leftPets && (keys2 = Object.keys(message.leftPets)).length) { object.leftPets = {}; for (var j = 0; j < keys2.length; ++j) object.leftPets[keys2[j]] = message.leftPets[keys2[j]]; } if (message.rightTactical != null && message.hasOwnProperty("rightTactical")) object.rightTactical = message.rightTactical; if (message.rightPets && (keys2 = Object.keys(message.rightPets)).length) { object.rightPets = {}; for (var j = 0; j < keys2.length; ++j) object.rightPets[keys2[j]] = message.rightPets[keys2[j]]; } return object; }; /** * Converts this GPVPStart to JSON. * @function toJSON * @memberof GPVPStart * @instance * @returns {Object.} JSON object */ GPVPStart.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for GPVPStart * @function getTypeUrl * @memberof GPVPStart * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ GPVPStart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/GPVPStart"; }; return GPVPStart; }(); $root.GPVPText = function () { /** * Properties of a GPVPText. * @exports IGPVPText * @interface IGPVPText * @property {string|null} [text] GPVPText text */ /** * Constructs a new GPVPText. * @exports GPVPText * @classdesc Represents a GPVPText. * @implements IGPVPText * @constructor * @param {IGPVPText=} [properties] Properties to set */ function GPVPText(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GPVPText text. * @member {string} text * @memberof GPVPText * @instance */ GPVPText.prototype.text = ""; /** * Creates a new GPVPText instance using the specified properties. * @function create * @memberof GPVPText * @static * @param {IGPVPText=} [properties] Properties to set * @returns {GPVPText} GPVPText instance */ GPVPText.create = function create(properties) { return new GPVPText(properties); }; /** * Encodes the specified GPVPText message. Does not implicitly {@link GPVPText.verify|verify} messages. * @function encode * @memberof GPVPText * @static * @param {IGPVPText} message GPVPText message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GPVPText.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.text != null && Object.hasOwnProperty.call(message, "text")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.text); return writer; }; /** * Encodes the specified GPVPText message, length delimited. Does not implicitly {@link GPVPText.verify|verify} messages. * @function encodeDelimited * @memberof GPVPText * @static * @param {IGPVPText} message GPVPText message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GPVPText.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GPVPText message from the specified reader or buffer. * @function decode * @memberof GPVPText * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GPVPText} GPVPText * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GPVPText.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GPVPText(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.text = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GPVPText message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GPVPText * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GPVPText} GPVPText * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GPVPText.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GPVPText message. * @function verify * @memberof GPVPText * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GPVPText.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.text != null && message.hasOwnProperty("text")) if (!$util.isString(message.text)) return "text: string expected"; return null; }; /** * Creates a GPVPText message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GPVPText * @static * @param {Object.} object Plain object * @returns {GPVPText} GPVPText */ GPVPText.fromObject = function fromObject(object) { if (object instanceof $root.GPVPText) return object; var message = new $root.GPVPText(); if (object.text != null) message.text = String(object.text); return message; }; /** * Creates a plain object from a GPVPText message. Also converts values to other types if specified. * @function toObject * @memberof GPVPText * @static * @param {GPVPText} message GPVPText * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ GPVPText.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.text = ""; if (message.text != null && message.hasOwnProperty("text")) object.text = message.text; return object; }; /** * Converts this GPVPText to JSON. * @function toJSON * @memberof GPVPText * @instance * @returns {Object.} JSON object */ GPVPText.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for GPVPText * @function getTypeUrl * @memberof GPVPText * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ GPVPText.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/GPVPText"; }; return GPVPText; }(); $root.GUIChatMessage = function () { /** * Properties of a GUIChatMessage. * @exports IGUIChatMessage * @interface IGUIChatMessage * @property {string|null} [message] GUIChatMessage message */ /** * Constructs a new GUIChatMessage. * @exports GUIChatMessage * @classdesc Represents a GUIChatMessage. * @implements IGUIChatMessage * @constructor * @param {IGUIChatMessage=} [properties] Properties to set */ function GUIChatMessage(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GUIChatMessage message. * @member {string} message * @memberof GUIChatMessage * @instance */ GUIChatMessage.prototype.message = ""; /** * Creates a new GUIChatMessage instance using the specified properties. * @function create * @memberof GUIChatMessage * @static * @param {IGUIChatMessage=} [properties] Properties to set * @returns {GUIChatMessage} GUIChatMessage instance */ GUIChatMessage.create = function create(properties) { return new GUIChatMessage(properties); }; /** * Encodes the specified GUIChatMessage message. Does not implicitly {@link GUIChatMessage.verify|verify} messages. * @function encode * @memberof GUIChatMessage * @static * @param {IGUIChatMessage} message GUIChatMessage message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GUIChatMessage.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.message != null && Object.hasOwnProperty.call(message, "message")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.message); return writer; }; /** * Encodes the specified GUIChatMessage message, length delimited. Does not implicitly {@link GUIChatMessage.verify|verify} messages. * @function encodeDelimited * @memberof GUIChatMessage * @static * @param {IGUIChatMessage} message GUIChatMessage message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GUIChatMessage.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GUIChatMessage message from the specified reader or buffer. * @function decode * @memberof GUIChatMessage * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GUIChatMessage} GUIChatMessage * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GUIChatMessage.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GUIChatMessage(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.message = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GUIChatMessage message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GUIChatMessage * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GUIChatMessage} GUIChatMessage * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GUIChatMessage.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GUIChatMessage message. * @function verify * @memberof GUIChatMessage * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GUIChatMessage.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.message != null && message.hasOwnProperty("message")) if (!$util.isString(message.message)) return "message: string expected"; return null; }; /** * Creates a GUIChatMessage message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GUIChatMessage * @static * @param {Object.} object Plain object * @returns {GUIChatMessage} GUIChatMessage */ GUIChatMessage.fromObject = function fromObject(object) { if (object instanceof $root.GUIChatMessage) return object; var message = new $root.GUIChatMessage(); if (object.message != null) message.message = String(object.message); return message; }; /** * Creates a plain object from a GUIChatMessage message. Also converts values to other types if specified. * @function toObject * @memberof GUIChatMessage * @static * @param {GUIChatMessage} message GUIChatMessage * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ GUIChatMessage.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.message = ""; if (message.message != null && message.hasOwnProperty("message")) object.message = message.message; return object; }; /** * Converts this GUIChatMessage to JSON. * @function toJSON * @memberof GUIChatMessage * @instance * @returns {Object.} JSON object */ GUIChatMessage.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for GUIChatMessage * @function getTypeUrl * @memberof GUIChatMessage * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ GUIChatMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/GUIChatMessage"; }; return GUIChatMessage; }(); $root.JNFrameInput = function () { /** * Properties of a JNFrameInput. * @exports IJNFrameInput * @interface IJNFrameInput * @property {number|null} [nId] JNFrameInput nId * @property {Uint8Array|null} [input] JNFrameInput input */ /** * Constructs a new JNFrameInput. * @exports JNFrameInput * @classdesc Represents a JNFrameInput. * @implements IJNFrameInput * @constructor * @param {IJNFrameInput=} [properties] Properties to set */ function JNFrameInput(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * JNFrameInput nId. * @member {number} nId * @memberof JNFrameInput * @instance */ JNFrameInput.prototype.nId = 0; /** * JNFrameInput input. * @member {Uint8Array|null|undefined} input * @memberof JNFrameInput * @instance */ JNFrameInput.prototype.input = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * JNFrameInput _input. * @member {"input"|undefined} _input * @memberof JNFrameInput * @instance */ Object.defineProperty(JNFrameInput.prototype, "_input", { get: $util.oneOfGetter($oneOfFields = ["input"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new JNFrameInput instance using the specified properties. * @function create * @memberof JNFrameInput * @static * @param {IJNFrameInput=} [properties] Properties to set * @returns {JNFrameInput} JNFrameInput instance */ JNFrameInput.create = function create(properties) { return new JNFrameInput(properties); }; /** * Encodes the specified JNFrameInput message. Does not implicitly {@link JNFrameInput.verify|verify} messages. * @function encode * @memberof JNFrameInput * @static * @param {IJNFrameInput} message JNFrameInput message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInput.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.nId != null && Object.hasOwnProperty.call(message, "nId")) writer.uint32( /* id 1, wireType 0 =*/ 8).int32(message.nId); if (message.input != null && Object.hasOwnProperty.call(message, "input")) writer.uint32( /* id 2, wireType 2 =*/ 18).bytes(message.input); return writer; }; /** * Encodes the specified JNFrameInput message, length delimited. Does not implicitly {@link JNFrameInput.verify|verify} messages. * @function encodeDelimited * @memberof JNFrameInput * @static * @param {IJNFrameInput} message JNFrameInput message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInput.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a JNFrameInput message from the specified reader or buffer. * @function decode * @memberof JNFrameInput * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {JNFrameInput} JNFrameInput * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInput.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.JNFrameInput(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.nId = reader.int32(); break; } case 2: { message.input = reader.bytes(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a JNFrameInput message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof JNFrameInput * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {JNFrameInput} JNFrameInput * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInput.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a JNFrameInput message. * @function verify * @memberof JNFrameInput * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ JNFrameInput.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.nId != null && message.hasOwnProperty("nId")) if (!$util.isInteger(message.nId)) return "nId: integer expected"; if (message.input != null && message.hasOwnProperty("input")) { if (!(message.input && typeof message.input.length === "number" || $util.isString(message.input))) return "input: buffer expected"; } return null; }; /** * Creates a JNFrameInput message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof JNFrameInput * @static * @param {Object.} object Plain object * @returns {JNFrameInput} JNFrameInput */ JNFrameInput.fromObject = function fromObject(object) { if (object instanceof $root.JNFrameInput) return object; var message = new $root.JNFrameInput(); if (object.nId != null) message.nId = object.nId | 0; if (object.input != null) if (typeof object.input === "string") $util.base64.decode(object.input, message.input = $util.newBuffer($util.base64.length(object.input)), 0);else if (object.input.length >= 0) message.input = object.input; return message; }; /** * Creates a plain object from a JNFrameInput message. Also converts values to other types if specified. * @function toObject * @memberof JNFrameInput * @static * @param {JNFrameInput} message JNFrameInput * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ JNFrameInput.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.nId = 0; if (message.nId != null && message.hasOwnProperty("nId")) object.nId = message.nId; if (message.input != null && message.hasOwnProperty("input")) { object.input = options.bytes === String ? $util.base64.encode(message.input, 0, message.input.length) : options.bytes === Array ? Array.prototype.slice.call(message.input) : message.input; if (options.oneofs) object._input = "input"; } return object; }; /** * Converts this JNFrameInput to JSON. * @function toJSON * @memberof JNFrameInput * @instance * @returns {Object.} JSON object */ JNFrameInput.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for JNFrameInput * @function getTypeUrl * @memberof JNFrameInput * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ JNFrameInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/JNFrameInput"; }; return JNFrameInput; }(); $root.JNFrameInputs = function () { /** * Properties of a JNFrameInputs. * @exports IJNFrameInputs * @interface IJNFrameInputs * @property {Array.|null} [inputs] JNFrameInputs inputs */ /** * Constructs a new JNFrameInputs. * @exports JNFrameInputs * @classdesc Represents a JNFrameInputs. * @implements IJNFrameInputs * @constructor * @param {IJNFrameInputs=} [properties] Properties to set */ function JNFrameInputs(properties) { this.inputs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * JNFrameInputs inputs. * @member {Array.} inputs * @memberof JNFrameInputs * @instance */ JNFrameInputs.prototype.inputs = $util.emptyArray; /** * Creates a new JNFrameInputs instance using the specified properties. * @function create * @memberof JNFrameInputs * @static * @param {IJNFrameInputs=} [properties] Properties to set * @returns {JNFrameInputs} JNFrameInputs instance */ JNFrameInputs.create = function create(properties) { return new JNFrameInputs(properties); }; /** * Encodes the specified JNFrameInputs message. Does not implicitly {@link JNFrameInputs.verify|verify} messages. * @function encode * @memberof JNFrameInputs * @static * @param {IJNFrameInputs} message JNFrameInputs message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInputs.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.inputs != null && message.inputs.length) for (var i = 0; i < message.inputs.length; ++i) $root.JNFrameInput.encode(message.inputs[i], writer.uint32( /* id 1, wireType 2 =*/ 10).fork()).ldelim(); return writer; }; /** * Encodes the specified JNFrameInputs message, length delimited. Does not implicitly {@link JNFrameInputs.verify|verify} messages. * @function encodeDelimited * @memberof JNFrameInputs * @static * @param {IJNFrameInputs} message JNFrameInputs message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInputs.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a JNFrameInputs message from the specified reader or buffer. * @function decode * @memberof JNFrameInputs * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {JNFrameInputs} JNFrameInputs * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInputs.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.JNFrameInputs(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.inputs && message.inputs.length)) message.inputs = []; message.inputs.push($root.JNFrameInput.decode(reader, reader.uint32())); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a JNFrameInputs message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof JNFrameInputs * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {JNFrameInputs} JNFrameInputs * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInputs.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a JNFrameInputs message. * @function verify * @memberof JNFrameInputs * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ JNFrameInputs.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.inputs != null && message.hasOwnProperty("inputs")) { if (!Array.isArray(message.inputs)) return "inputs: array expected"; for (var i = 0; i < message.inputs.length; ++i) { var error = $root.JNFrameInput.verify(message.inputs[i]); if (error) return "inputs." + error; } } return null; }; /** * Creates a JNFrameInputs message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof JNFrameInputs * @static * @param {Object.} object Plain object * @returns {JNFrameInputs} JNFrameInputs */ JNFrameInputs.fromObject = function fromObject(object) { if (object instanceof $root.JNFrameInputs) return object; var message = new $root.JNFrameInputs(); if (object.inputs) { if (!Array.isArray(object.inputs)) throw TypeError(".JNFrameInputs.inputs: array expected"); message.inputs = []; for (var i = 0; i < object.inputs.length; ++i) { if (typeof object.inputs[i] !== "object") throw TypeError(".JNFrameInputs.inputs: object expected"); message.inputs[i] = $root.JNFrameInput.fromObject(object.inputs[i]); } } return message; }; /** * Creates a plain object from a JNFrameInputs message. Also converts values to other types if specified. * @function toObject * @memberof JNFrameInputs * @static * @param {JNFrameInputs} message JNFrameInputs * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ JNFrameInputs.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.inputs = []; if (message.inputs && message.inputs.length) { object.inputs = []; for (var j = 0; j < message.inputs.length; ++j) object.inputs[j] = $root.JNFrameInput.toObject(message.inputs[j], options); } return object; }; /** * Converts this JNFrameInputs to JSON. * @function toJSON * @memberof JNFrameInputs * @instance * @returns {Object.} JSON object */ JNFrameInputs.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for JNFrameInputs * @function getTypeUrl * @memberof JNFrameInputs * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ JNFrameInputs.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/JNFrameInputs"; }; return JNFrameInputs; }(); $root.JNFrameInfo = function () { /** * Properties of a JNFrameInfo. * @exports IJNFrameInfo * @interface IJNFrameInfo * @property {number|null} [index] JNFrameInfo index * @property {Array.|null} [messages] JNFrameInfo messages */ /** * Constructs a new JNFrameInfo. * @exports JNFrameInfo * @classdesc Represents a JNFrameInfo. * @implements IJNFrameInfo * @constructor * @param {IJNFrameInfo=} [properties] Properties to set */ function JNFrameInfo(properties) { this.messages = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * JNFrameInfo index. * @member {number} index * @memberof JNFrameInfo * @instance */ JNFrameInfo.prototype.index = 0; /** * JNFrameInfo messages. * @member {Array.} messages * @memberof JNFrameInfo * @instance */ JNFrameInfo.prototype.messages = $util.emptyArray; /** * Creates a new JNFrameInfo instance using the specified properties. * @function create * @memberof JNFrameInfo * @static * @param {IJNFrameInfo=} [properties] Properties to set * @returns {JNFrameInfo} JNFrameInfo instance */ JNFrameInfo.create = function create(properties) { return new JNFrameInfo(properties); }; /** * Encodes the specified JNFrameInfo message. Does not implicitly {@link JNFrameInfo.verify|verify} messages. * @function encode * @memberof JNFrameInfo * @static * @param {IJNFrameInfo} message JNFrameInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.index != null && Object.hasOwnProperty.call(message, "index")) writer.uint32( /* id 1, wireType 0 =*/ 8).int32(message.index); if (message.messages != null && message.messages.length) for (var i = 0; i < message.messages.length; ++i) $root.JNFrameInput.encode(message.messages[i], writer.uint32( /* id 2, wireType 2 =*/ 18).fork()).ldelim(); return writer; }; /** * Encodes the specified JNFrameInfo message, length delimited. Does not implicitly {@link JNFrameInfo.verify|verify} messages. * @function encodeDelimited * @memberof JNFrameInfo * @static * @param {IJNFrameInfo} message JNFrameInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a JNFrameInfo message from the specified reader or buffer. * @function decode * @memberof JNFrameInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {JNFrameInfo} JNFrameInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.JNFrameInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.index = reader.int32(); break; } case 2: { if (!(message.messages && message.messages.length)) message.messages = []; message.messages.push($root.JNFrameInput.decode(reader, reader.uint32())); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a JNFrameInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof JNFrameInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {JNFrameInfo} JNFrameInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a JNFrameInfo message. * @function verify * @memberof JNFrameInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ JNFrameInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.index != null && message.hasOwnProperty("index")) if (!$util.isInteger(message.index)) return "index: integer expected"; if (message.messages != null && message.hasOwnProperty("messages")) { if (!Array.isArray(message.messages)) return "messages: array expected"; for (var i = 0; i < message.messages.length; ++i) { var error = $root.JNFrameInput.verify(message.messages[i]); if (error) return "messages." + error; } } return null; }; /** * Creates a JNFrameInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof JNFrameInfo * @static * @param {Object.} object Plain object * @returns {JNFrameInfo} JNFrameInfo */ JNFrameInfo.fromObject = function fromObject(object) { if (object instanceof $root.JNFrameInfo) return object; var message = new $root.JNFrameInfo(); if (object.index != null) message.index = object.index | 0; if (object.messages) { if (!Array.isArray(object.messages)) throw TypeError(".JNFrameInfo.messages: array expected"); message.messages = []; for (var i = 0; i < object.messages.length; ++i) { if (typeof object.messages[i] !== "object") throw TypeError(".JNFrameInfo.messages: object expected"); message.messages[i] = $root.JNFrameInput.fromObject(object.messages[i]); } } return message; }; /** * Creates a plain object from a JNFrameInfo message. Also converts values to other types if specified. * @function toObject * @memberof JNFrameInfo * @static * @param {JNFrameInfo} message JNFrameInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ JNFrameInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.messages = []; if (options.defaults) object.index = 0; if (message.index != null && message.hasOwnProperty("index")) object.index = message.index; if (message.messages && message.messages.length) { object.messages = []; for (var j = 0; j < message.messages.length; ++j) object.messages[j] = $root.JNFrameInput.toObject(message.messages[j], options); } return object; }; /** * Converts this JNFrameInfo to JSON. * @function toJSON * @memberof JNFrameInfo * @instance * @returns {Object.} JSON object */ JNFrameInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for JNFrameInfo * @function getTypeUrl * @memberof JNFrameInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ JNFrameInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/JNFrameInfo"; }; return JNFrameInfo; }(); $root.JNFrameInfos = function () { /** * Properties of a JNFrameInfos. * @exports IJNFrameInfos * @interface IJNFrameInfos * @property {Array.|null} [frames] JNFrameInfos frames */ /** * Constructs a new JNFrameInfos. * @exports JNFrameInfos * @classdesc Represents a JNFrameInfos. * @implements IJNFrameInfos * @constructor * @param {IJNFrameInfos=} [properties] Properties to set */ function JNFrameInfos(properties) { this.frames = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * JNFrameInfos frames. * @member {Array.} frames * @memberof JNFrameInfos * @instance */ JNFrameInfos.prototype.frames = $util.emptyArray; /** * Creates a new JNFrameInfos instance using the specified properties. * @function create * @memberof JNFrameInfos * @static * @param {IJNFrameInfos=} [properties] Properties to set * @returns {JNFrameInfos} JNFrameInfos instance */ JNFrameInfos.create = function create(properties) { return new JNFrameInfos(properties); }; /** * Encodes the specified JNFrameInfos message. Does not implicitly {@link JNFrameInfos.verify|verify} messages. * @function encode * @memberof JNFrameInfos * @static * @param {IJNFrameInfos} message JNFrameInfos message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInfos.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.frames != null && message.frames.length) for (var i = 0; i < message.frames.length; ++i) $root.JNFrameInfo.encode(message.frames[i], writer.uint32( /* id 1, wireType 2 =*/ 10).fork()).ldelim(); return writer; }; /** * Encodes the specified JNFrameInfos message, length delimited. Does not implicitly {@link JNFrameInfos.verify|verify} messages. * @function encodeDelimited * @memberof JNFrameInfos * @static * @param {IJNFrameInfos} message JNFrameInfos message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNFrameInfos.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a JNFrameInfos message from the specified reader or buffer. * @function decode * @memberof JNFrameInfos * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {JNFrameInfos} JNFrameInfos * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInfos.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.JNFrameInfos(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.frames && message.frames.length)) message.frames = []; message.frames.push($root.JNFrameInfo.decode(reader, reader.uint32())); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a JNFrameInfos message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof JNFrameInfos * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {JNFrameInfos} JNFrameInfos * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNFrameInfos.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a JNFrameInfos message. * @function verify * @memberof JNFrameInfos * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ JNFrameInfos.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.frames != null && message.hasOwnProperty("frames")) { if (!Array.isArray(message.frames)) return "frames: array expected"; for (var i = 0; i < message.frames.length; ++i) { var error = $root.JNFrameInfo.verify(message.frames[i]); if (error) return "frames." + error; } } return null; }; /** * Creates a JNFrameInfos message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof JNFrameInfos * @static * @param {Object.} object Plain object * @returns {JNFrameInfos} JNFrameInfos */ JNFrameInfos.fromObject = function fromObject(object) { if (object instanceof $root.JNFrameInfos) return object; var message = new $root.JNFrameInfos(); if (object.frames) { if (!Array.isArray(object.frames)) throw TypeError(".JNFrameInfos.frames: array expected"); message.frames = []; for (var i = 0; i < object.frames.length; ++i) { if (typeof object.frames[i] !== "object") throw TypeError(".JNFrameInfos.frames: object expected"); message.frames[i] = $root.JNFrameInfo.fromObject(object.frames[i]); } } return message; }; /** * Creates a plain object from a JNFrameInfos message. Also converts values to other types if specified. * @function toObject * @memberof JNFrameInfos * @static * @param {JNFrameInfos} message JNFrameInfos * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ JNFrameInfos.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.frames = []; if (message.frames && message.frames.length) { object.frames = []; for (var j = 0; j < message.frames.length; ++j) object.frames[j] = $root.JNFrameInfo.toObject(message.frames[j], options); } return object; }; /** * Converts this JNFrameInfos to JSON. * @function toJSON * @memberof JNFrameInfos * @instance * @returns {Object.} JSON object */ JNFrameInfos.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for JNFrameInfos * @function getTypeUrl * @memberof JNFrameInfos * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ JNFrameInfos.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/JNFrameInfos"; }; return JNFrameInfos; }(); $root.JNInput = function () { /** * Properties of a JNInput. * @exports IJNInput * @interface IJNInput * @property {string|null} [message] JNInput message */ /** * Constructs a new JNInput. * @exports JNInput * @classdesc Represents a JNInput. * @implements IJNInput * @constructor * @param {IJNInput=} [properties] Properties to set */ function JNInput(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * JNInput message. * @member {string|null|undefined} message * @memberof JNInput * @instance */ JNInput.prototype.message = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * JNInput _message. * @member {"message"|undefined} _message * @memberof JNInput * @instance */ Object.defineProperty(JNInput.prototype, "_message", { get: $util.oneOfGetter($oneOfFields = ["message"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new JNInput instance using the specified properties. * @function create * @memberof JNInput * @static * @param {IJNInput=} [properties] Properties to set * @returns {JNInput} JNInput instance */ JNInput.create = function create(properties) { return new JNInput(properties); }; /** * Encodes the specified JNInput message. Does not implicitly {@link JNInput.verify|verify} messages. * @function encode * @memberof JNInput * @static * @param {IJNInput} message JNInput message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNInput.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.message != null && Object.hasOwnProperty.call(message, "message")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.message); return writer; }; /** * Encodes the specified JNInput message, length delimited. Does not implicitly {@link JNInput.verify|verify} messages. * @function encodeDelimited * @memberof JNInput * @static * @param {IJNInput} message JNInput message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ JNInput.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a JNInput message from the specified reader or buffer. * @function decode * @memberof JNInput * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {JNInput} JNInput * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNInput.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.JNInput(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.message = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a JNInput message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof JNInput * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {JNInput} JNInput * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ JNInput.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a JNInput message. * @function verify * @memberof JNInput * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ JNInput.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.message != null && message.hasOwnProperty("message")) { if (!$util.isString(message.message)) return "message: string expected"; } return null; }; /** * Creates a JNInput message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof JNInput * @static * @param {Object.} object Plain object * @returns {JNInput} JNInput */ JNInput.fromObject = function fromObject(object) { if (object instanceof $root.JNInput) return object; var message = new $root.JNInput(); if (object.message != null) message.message = String(object.message); return message; }; /** * Creates a plain object from a JNInput message. Also converts values to other types if specified. * @function toObject * @memberof JNInput * @static * @param {JNInput} message JNInput * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ JNInput.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.message != null && message.hasOwnProperty("message")) { object.message = message.message; if (options.oneofs) object._message = "message"; } return object; }; /** * Converts this JNInput to JSON. * @function toJSON * @memberof JNInput * @instance * @returns {Object.} JSON object */ JNInput.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for JNInput * @function getTypeUrl * @memberof JNInput * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ JNInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/JNInput"; }; return JNInput; }(); $root.NActionDemo = function () { /** * Properties of a NActionDemo. * @exports INActionDemo * @interface INActionDemo * @property {string|null} [message] NActionDemo message */ /** * Constructs a new NActionDemo. * @exports NActionDemo * @classdesc Represents a NActionDemo. * @implements INActionDemo * @constructor * @param {INActionDemo=} [properties] Properties to set */ function NActionDemo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * NActionDemo message. * @member {string|null|undefined} message * @memberof NActionDemo * @instance */ NActionDemo.prototype.message = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * NActionDemo _message. * @member {"message"|undefined} _message * @memberof NActionDemo * @instance */ Object.defineProperty(NActionDemo.prototype, "_message", { get: $util.oneOfGetter($oneOfFields = ["message"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new NActionDemo instance using the specified properties. * @function create * @memberof NActionDemo * @static * @param {INActionDemo=} [properties] Properties to set * @returns {NActionDemo} NActionDemo instance */ NActionDemo.create = function create(properties) { return new NActionDemo(properties); }; /** * Encodes the specified NActionDemo message. Does not implicitly {@link NActionDemo.verify|verify} messages. * @function encode * @memberof NActionDemo * @static * @param {INActionDemo} message NActionDemo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ NActionDemo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.message != null && Object.hasOwnProperty.call(message, "message")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.message); return writer; }; /** * Encodes the specified NActionDemo message, length delimited. Does not implicitly {@link NActionDemo.verify|verify} messages. * @function encodeDelimited * @memberof NActionDemo * @static * @param {INActionDemo} message NActionDemo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ NActionDemo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a NActionDemo message from the specified reader or buffer. * @function decode * @memberof NActionDemo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {NActionDemo} NActionDemo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NActionDemo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.NActionDemo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.message = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a NActionDemo message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof NActionDemo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {NActionDemo} NActionDemo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NActionDemo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a NActionDemo message. * @function verify * @memberof NActionDemo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ NActionDemo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.message != null && message.hasOwnProperty("message")) { if (!$util.isString(message.message)) return "message: string expected"; } return null; }; /** * Creates a NActionDemo message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof NActionDemo * @static * @param {Object.} object Plain object * @returns {NActionDemo} NActionDemo */ NActionDemo.fromObject = function fromObject(object) { if (object instanceof $root.NActionDemo) return object; var message = new $root.NActionDemo(); if (object.message != null) message.message = String(object.message); return message; }; /** * Creates a plain object from a NActionDemo message. Also converts values to other types if specified. * @function toObject * @memberof NActionDemo * @static * @param {NActionDemo} message NActionDemo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ NActionDemo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.message != null && message.hasOwnProperty("message")) { object.message = message.message; if (options.oneofs) object._message = "message"; } return object; }; /** * Converts this NActionDemo to JSON. * @function toJSON * @memberof NActionDemo * @instance * @returns {Object.} JSON object */ NActionDemo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for NActionDemo * @function getTypeUrl * @memberof NActionDemo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ NActionDemo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/NActionDemo"; }; return NActionDemo; }(); $root.NActionDemo2 = function () { /** * Properties of a NActionDemo2. * @exports INActionDemo2 * @interface INActionDemo2 * @property {string|null} [message] NActionDemo2 message */ /** * Constructs a new NActionDemo2. * @exports NActionDemo2 * @classdesc Represents a NActionDemo2. * @implements INActionDemo2 * @constructor * @param {INActionDemo2=} [properties] Properties to set */ function NActionDemo2(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * NActionDemo2 message. * @member {string|null|undefined} message * @memberof NActionDemo2 * @instance */ NActionDemo2.prototype.message = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * NActionDemo2 _message. * @member {"message"|undefined} _message * @memberof NActionDemo2 * @instance */ Object.defineProperty(NActionDemo2.prototype, "_message", { get: $util.oneOfGetter($oneOfFields = ["message"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new NActionDemo2 instance using the specified properties. * @function create * @memberof NActionDemo2 * @static * @param {INActionDemo2=} [properties] Properties to set * @returns {NActionDemo2} NActionDemo2 instance */ NActionDemo2.create = function create(properties) { return new NActionDemo2(properties); }; /** * Encodes the specified NActionDemo2 message. Does not implicitly {@link NActionDemo2.verify|verify} messages. * @function encode * @memberof NActionDemo2 * @static * @param {INActionDemo2} message NActionDemo2 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ NActionDemo2.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.message != null && Object.hasOwnProperty.call(message, "message")) writer.uint32( /* id 1, wireType 2 =*/ 10).string(message.message); return writer; }; /** * Encodes the specified NActionDemo2 message, length delimited. Does not implicitly {@link NActionDemo2.verify|verify} messages. * @function encodeDelimited * @memberof NActionDemo2 * @static * @param {INActionDemo2} message NActionDemo2 message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ NActionDemo2.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a NActionDemo2 message from the specified reader or buffer. * @function decode * @memberof NActionDemo2 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {NActionDemo2} NActionDemo2 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NActionDemo2.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.NActionDemo2(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.message = reader.string(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a NActionDemo2 message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof NActionDemo2 * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {NActionDemo2} NActionDemo2 * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NActionDemo2.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a NActionDemo2 message. * @function verify * @memberof NActionDemo2 * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ NActionDemo2.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.message != null && message.hasOwnProperty("message")) { if (!$util.isString(message.message)) return "message: string expected"; } return null; }; /** * Creates a NActionDemo2 message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof NActionDemo2 * @static * @param {Object.} object Plain object * @returns {NActionDemo2} NActionDemo2 */ NActionDemo2.fromObject = function fromObject(object) { if (object instanceof $root.NActionDemo2) return object; var message = new $root.NActionDemo2(); if (object.message != null) message.message = String(object.message); return message; }; /** * Creates a plain object from a NActionDemo2 message. Also converts values to other types if specified. * @function toObject * @memberof NActionDemo2 * @static * @param {NActionDemo2} message NActionDemo2 * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ NActionDemo2.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.message != null && message.hasOwnProperty("message")) { object.message = message.message; if (options.oneofs) object._message = "message"; } return object; }; /** * Converts this NActionDemo2 to JSON. * @function toJSON * @memberof NActionDemo2 * @instance * @returns {Object.} JSON object */ NActionDemo2.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for NActionDemo2 * @function getTypeUrl * @memberof NActionDemo2 * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ NActionDemo2.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/NActionDemo2"; }; return NActionDemo2; }(); module.exports = $root; // #endregion ORIGINAL CODE _cjsExports = module.exports; }, function () { return { 'protobufjs/minimal.js': __cjsMetaURL$h }; }); // I am the facade module who provides access to the CommonJS module './proto.js'~ if (!__cjsMetaURL$i) { loader.throwInvalidWrapper('./proto.js', 'file:///D:/myproject/JisolGame/JisolGameCocos/extensions/ngame/assets/ngame/message/proto.mjs?cjs=&original=.js'); } loader.require(__cjsMetaURL$i); cclegacy._RF.push({}, "76819YCVqJHsqMBzTfl7gkG", "NGameMessage", undefined); var NGameMessage = /*#__PURE__*/function (_Singleton) { _inheritsLoose(NGameMessage, _Singleton); function NGameMessage() { return _Singleton.apply(this, arguments) || this; } var _proto = NGameMessage.prototype; //通过类名获取类 _proto.getType = function getType(name) { return _cjsExports[name]; }; _proto.DataToByte4 = function DataToByte4(type, data) { if (!data) { return new Uint8Array(0); } return this.getType(type).encode(data).finish(); }; _proto.Byte4ToData = function Byte4ToData(type, data) { return this.getType(type).decode(data); }; return NGameMessage; }(Singleton); cclegacy._RF.pop(); cclegacy._RF.push({}, "4cc38D1sJBB6bH41sF00uMK", "ToUtil", undefined); var ToUtil = /*#__PURE__*/function () { function ToUtil() {} ToUtil.IntToByte4 = function IntToByte4(data) { var targets = []; targets[0] = data & 0xFF; targets[1] = data >> 8 & 0xFF; targets[2] = data >> 16 & 0xFF; targets[3] = data >> 24 & 0xFF; return targets; }; ToUtil.Byte4ToInt = function Byte4ToInt(bytes) { var b3 = bytes[0] & 0xFF; var b2 = bytes[0 + 1] & 0xFF; var b1 = bytes[0 + 2] & 0xFF; var b0 = bytes[0 + 3] & 0xFF; return b0 << 24 | b1 << 16 | b2 << 8 | b3; }; return ToUtil; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "4b809uBRuFHT4rYma/mnJ38", "NDataUtil", undefined); //网络数据工具类 var NDataUtil = /*#__PURE__*/function () { function NDataUtil() {} //解析 NDataUtil.Parse = function Parse(data) { data = Array.from(new Uint8Array(data)); if (data.length < 8) return; return JNetParam.Build(ToUtil.Byte4ToInt([].concat(data.slice(0, 4))), ToUtil.Byte4ToInt([].concat(data.slice(4, 8)))).setByte(data.slice(8, data.length)); } //加密 [请求Id*4,处理Id*4,...参数数据*N] ; NDataUtil.Encrypt = function Encrypt(data, type) { var datas = Array.from(NGameMessage.getIns().DataToByte4(type, data.data)); var _byte = [].concat(ToUtil.IntToByte4(data.id), ToUtil.IntToByte4(data.hId), datas); var array = new ArrayBuffer(_byte.length); var datao = new DataView(array); for (var index = 0; index < _byte.length; index++) { datao.setUint8(index, _byte[index]); } return array; }; return NDataUtil; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "eba91Ga4SlFGrcWjEmwdraC", "JNSocket", undefined); //WebSocket 连接的 JNetGame var JNSocket = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(JNSocket, _SystemBase); function JNSocket() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _SystemBase.call.apply(_SystemBase, [this].concat(args)) || this; _this.socket = void 0; _this.id = 0; _this.events = {}; //是否连接成功 _this.isConnect = false; //消息返回回调 _this.callback = new Map(); //延迟 (10s) _this.timeout = 10000; return _this; } var _proto = JNSocket.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return this.onConnect(); case 2: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }(); _proto.onConnect = /*#__PURE__*/function () { var _onConnect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) { var _this2 = this; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: if (!resolve) { _context3.next = 17; break; } if (!this.isConnect) { _context3.next = 3; break; } return _context3.abrupt("return"); case 3: this.isConnect = true; _context3.t0 = WebSocket; _context3.next = 7; return this.url(); case 7: _context3.t1 = _context3.sent; _context3.t2 = "" + _context3.t1; this.socket = new _context3.t0(_context3.t2); this.socket.binaryType = 'arraybuffer'; this.socket.onopen = function () { console.log("NGame WebSocket \u8FDE\u63A5\u6210\u529F"); resolve(); }; this.socket.onmessage = this.onMessage.bind(this); this.socket.onclose = function () { console.log("NGame WebSocket \u65AD\u5F00\u8FDE\u63A5"); _this2.isConnect = false; setTimeout(function () { _this2.onConnect(resolve); }, 1000); }; return _context3.abrupt("return"); case 17: return _context3.abrupt("return", new Promise( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve) { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return _this2.onConnect(resolve); case 2: case "end": return _context2.stop(); } }, _callee2); })))); case 18: case "end": return _context3.stop(); } }, _callee3, this); })); function onConnect(_x) { return _onConnect.apply(this, arguments); } return onConnect; }() //接收到消息 ; _proto.onMessage = function onMessage(message) { this.emit(NDataUtil.Parse(message.data)); }; _proto.emit = function emit(data) { //处理方法0可能是返回消息 if (data.hId == 0) { //回调方法 var callback = this.callback.get(data.id); if (callback) { this.callback.get(data.id).fun(NGameMessage.getIns().Byte4ToData(callback.type, data["byte"])); } } else { if (!this.events["" + data.hId]) this.events["" + data.hId] = []; //广播 this.events["" + data.hId].forEach(function (item) { if (item.className) { if (item.root) ;else { item.func.bind(item.target)(NGameMessage.getIns().Byte4ToData(item.className, data["byte"])); } } else { item.func.bind(item.target)(); } }); } } //外部监听消息 ; _proto.on = function on(hId, func, target, className, root) { // this.event.on(`${hId}`,func,target); if (!this.events["" + hId]) this.events["" + hId] = []; this.events["" + hId].push({ func: func, target: target, className: className, root: root }); } //删除外部监听 ; _proto.off = function off(hId, func, target, className, root) { if (!this.events["" + hId]) this.events["" + hId] = []; for (var index = 0; index < this.events["" + hId].length; index++) { var item = this.events["" + hId][index]; if (item.func == func && item.target == target && item.className == className && item.root == root) { this.events["" + hId].splice(index, 1); index--; } } } //发送消息 ; _proto.Send = function Send(hId, data, type) { var send = NDataUtil.Encrypt(JNetParam.Build(this.id++, hId).setData(data), type); console.log("send", send); this.socket.send(send); } //发送消息并且等待返回 (一般用来接受可能返回的消息) ; _proto.SendBack = function SendBack(hId, back, data, type) { var _this3 = this; var id = this.id++; var send = NDataUtil.Encrypt(JNetParam.Build(id, hId).setData(data), type); console.log("sendback", send); this.socket.send(send); //创建返回监听 this.callback.set(id, back); //如果长时间没有返回则移除 setTimeout(function () { if (_this3.callback.get(id)) { //移除 _this3.callback.set(id, null); } }, this.timeout); }; return JNSocket; }(SystemBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "d97c0FjrAxEh6jbVSTsles9", "JNSyncAction", undefined); var JNSyncAction = /*#__PURE__*/function (JNSyncAction) { JNSyncAction[JNSyncAction["NSyncFrameStart"] = 100] = "NSyncFrameStart"; JNSyncAction[JNSyncAction["NSyncFrameEnd"] = 101] = "NSyncFrameEnd"; JNSyncAction[JNSyncAction["NSyncFrameBack"] = 102] = "NSyncFrameBack"; JNSyncAction[JNSyncAction["NSyncFrameInput"] = 103] = "NSyncFrameInput"; JNSyncAction[JNSyncAction["NSyncFrameReset"] = 104] = "NSyncFrameReset"; return JNSyncAction; }({}); //帧同步重置 cclegacy._RF.pop(); cclegacy._RF.push({}, "b26a0TOXyhOYahKasytChyi", "JNSyncMessage", undefined); var JNSyncMessage = /*#__PURE__*/function (JNSyncMessage) { JNSyncMessage["JNInput"] = "JNInput"; JNSyncMessage["JNFrameInputs"] = "JNFrameInputs"; JNSyncMessage["JNFrameInfos"] = "JNFrameInfos"; return JNSyncMessage; }({}); cclegacy._RF.pop(); cclegacy._RF.push({}, "3e996ylIKJO6aFY1//5+RRj", "JNFrameSkeletonSystem", undefined); var JNFrameSkeletonSystem = /*#__PURE__*/function (_System) { _inheritsLoose(JNFrameSkeletonSystem, _System); function JNFrameSkeletonSystem() { var _this; _this = _System.call(this) || this; _this._skeletons = new Set(); return _this; } /** * @en * Gets the instance of the Spine Skeleton system. * @zh * 获取 Spine 骨骼系统的单例。 */ JNFrameSkeletonSystem.getInstance = function getInstance() { if (!JNFrameSkeletonSystem._instance) { console.log("JNSyncFrame 创建SpineSystem"); JNFrameSkeletonSystem._instance = new JNFrameSkeletonSystem(); } return JNFrameSkeletonSystem._instance; } /** * 销毁 */ ; JNFrameSkeletonSystem.deleteInstance = function deleteInstance() { console.log("JNSyncFrame 销毁 SpineSystem"); JNFrameSkeletonSystem._instance = new JNFrameSkeletonSystem(); }; var _proto = JNFrameSkeletonSystem.prototype; _proto.add = function add(skeleton) { if (!skeleton) return; if (!this._skeletons.has(skeleton)) { this._skeletons.add(skeleton); } }; _proto.remove = function remove(skeleton) { if (!skeleton) return; if (this._skeletons.has(skeleton)) { this._skeletons["delete"](skeleton); } }; _proto.onUpdate = function onUpdate(dt) { this.postUpdate(dt); }; _proto.postUpdate = function postUpdate(dt) { if (!this._skeletons) { return; } this._skeletons.forEach(function (skeleton) { skeleton.updateAnimation(dt); skeleton["syncAttachedNode"](); }); }; _proto.prepareRenderData = function prepareRenderData() { if (!this._skeletons) { return; } this._skeletons.forEach(function (skeleton) { skeleton.markForUpdateRenderData(); }); }; return JNFrameSkeletonSystem; }(System); /** * @en * The ID flag of the system. * @zh * 此系统的 ID 标记。 */ JNFrameSkeletonSystem.ID = 'JNFrameSkeletonSystem'; JNFrameSkeletonSystem._instance = void 0; cclegacy._RF.pop(); cclegacy._RF.push({}, "430adDYWTZM5JW11ED9WlF2", "RandomUtil", undefined); //随机工具类 var RandomUtil = /*#__PURE__*/function () { function RandomUtil() {} //用于同步的随机方法 RandomUtil.SyncRandom = function SyncRandom(seed, start) { if (start === void 0) { start = 0; } for (var i = 0; i < start; i++) { seed = (seed * 9301 + 49297) % 233280; } return function (max, min) { if (max === void 0) { max = 1; } if (min === void 0) { min = 0; } seed = (seed * 9301 + 49297) % 233280; var rnd = seed / 233280.0; return min + rnd * (max - min); }; } //++ ; RandomUtil.Next = function Next(start) { return function () { return start++; }; }; return RandomUtil; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "c31f3aSNUdI5KVdkTB1wVr+", "EventDispatcher", undefined); var EventDispatcher = /*#__PURE__*/function (_Singleton) { _inheritsLoose(EventDispatcher, _Singleton); function EventDispatcher() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Singleton.call.apply(_Singleton, [this].concat(args)) || this; /** * key: 事件名 * value: 缓存事件 */ _this._eventCacheMap = js.createMap(); /**未找到监听事件的留存 */ _this._bufferMap = js.createMap(); /**是否自动清理监听留存 */ _this.isAutoClearBufferMap = true; return _this; } var _proto = EventDispatcher.prototype; /** * 广播事件 * * @param eventName 事件名 * @param param 传递的剩余不定参数 */ _proto.emit = function emit(eventName) { if (EventDispatcher.excludeEventNameLogList.indexOf(eventName) == -1) ; var eventCacheArray = this._eventCacheMap[eventName]; for (var _len2 = arguments.length, param = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { param[_key2 - 1] = arguments[_key2]; } if (eventCacheArray && eventCacheArray.length > 0) { var eventCache = null; for (var i = 0; i < eventCacheArray.length; i++) { eventCache = eventCacheArray[i]; // call 方法的语法和作用与 apply() 方法类似 // 只有一个区别 // 就是 call() 方法接受的是一个参数列表,而 apply() 方法接受的是一个包含多个参数的数组。 eventCache.func.apply(eventCache.target, param); } for (var _i = eventCacheArray.length - 1; _i >= 0; _i--) { eventCache = eventCacheArray[_i]; if (eventCache.once) { eventCacheArray.splice(_i, 1); } } } else { if (EventDispatcher.autoClearBufferTime > 0) { var _eventCacheArray = this._bufferMap[eventName]; if (!_eventCacheArray) { _eventCacheArray = []; this._bufferMap[eventName] = _eventCacheArray; } _eventCacheArray.push(param); if (this.isAutoClearBufferMap) { this.autoClearBuffer(eventName); } } } } /**自动清理未找到监听事件的留存 */ ; _proto.autoClearBuffer = function autoClearBuffer(eventName) { var _this2 = this; setTimeout(function () { if (_this2._bufferMap[eventName]) delete _this2._bufferMap[eventName]; }, EventDispatcher.autoClearBufferTime * 1000); } /** * 注册事件 * * @param eventName 事件名 * @param func 事件处理函数 * @param target 事件处理函数的执行对象 */ ; _proto.on = function on(eventName, func, target) { if (!eventName) { error("EventDispatcher on eventName 不合法", eventName); return; } this._on(eventName, func, target, false); } /** * 注册事件(接受函数执行一次后会自动销毁,不用主动off) * * @param eventName 事件名 * @param func 事件处理函数 * @param target 事件处理函数的执行对象 */ ; _proto.onOnce = function onOnce(eventName, func, target) { this._on(eventName, func, target, true); } /** * 注册事件 * * @param eventName 事件名 * @param func 事件处理函数 * @param target 事件处理函数的执行对象 * @param once 是否只回调一次 */ ; _proto._on = function _on(eventName, func, target, once) { var eventCacheArray = this._eventCacheMap[eventName]; if (!eventCacheArray) { eventCacheArray = []; } var isAddOn = true; if (eventCacheArray && eventCacheArray.length > 0) { for (var index = 0; index < eventCacheArray.length; index++) { var element = eventCacheArray[index]; if (element.target == target && element.func == func) { isAddOn = false; } } } if (isAddOn) { eventCacheArray.push({ target: target, func: func, once: once }); this._eventCacheMap[eventName] = eventCacheArray; } if (Object.getOwnPropertyNames(this._bufferMap).length > 0) { var eventBufferArrays = this._bufferMap[eventName]; if (eventBufferArrays) { for (var _index = 0; _index < eventBufferArrays.length; _index++) { var eventBufferArray = eventBufferArrays[_index]; var newBuff = [eventName].concat(eventBufferArray); this.emit.apply(this, newBuff); } delete this._bufferMap[eventName]; } } } /** * 注销事件 * * @param eventName 事件名 * @param func 事件处理函数 * @param target 事件处理函数的执行对象 */ ; _proto.off = function off(eventName, func, target) { var eventCacheArray = this._eventCacheMap[eventName]; if (eventCacheArray) { if (func && target) { for (var index = 0; index < eventCacheArray.length; index++) { var element = eventCacheArray[index]; if (element.target == target && element.func) { eventCacheArray.splice(index, 1); } } } else { delete this._eventCacheMap[eventName]; } } } /** * 注销某个已经注册的对象的所有事件 * @param target 事件函数处理的执行对象 */ ; _proto.targetOff = function targetOff(target) { for (var _key3 in this._eventCacheMap) { var eventCacheArrays = this._eventCacheMap[_key3]; for (var index = eventCacheArrays.length - 1; index >= 0; index--) { var eventCacheArray = eventCacheArrays[index]; if (eventCacheArray[index].target == target) { eventCacheArrays.splice(index, 1); } } } }; return EventDispatcher; }(Singleton); /**自动清理监听留存的时间 */ EventDispatcher.autoClearBufferTime = 0; EventDispatcher.excludeEventNameLogList = []; cclegacy._RF.pop(); cclegacy._RF.push({}, "8cae3AOhplLwrwVlDX0hR27", "JNFrameTweenSystem", undefined); var JNFrameTweenSystem = /*#__PURE__*/function () { function JNFrameTweenSystem() { this.tweens = []; this._addTime = 0; } var _proto = JNFrameTweenSystem.prototype; _proto.addTween = function addTween(tween) { this.tweens.push(tween); }; _proto.hasTween = function hasTween(tween) { return this.tweens.indexOf(tween) >= 0; }; _proto.delTween = function delTween(tween) { this.tweens.splice(this.tweens.indexOf(tween), 1); }; JNFrameTweenSystem.getInstance = function getInstance() { if (JNFrameTweenSystem._instance) return JNFrameTweenSystem._instance; return JNFrameTweenSystem._instance = new JNFrameTweenSystem(); }; JNFrameTweenSystem.deleteInstance = function deleteInstance() { JNFrameTweenSystem._instance = null; }; _proto.onUpdate = function onUpdate(dt) { var _this = this; this._addTime += dt; this.tweens.forEach(function (tween) { tween.update(_this.addTime); }); }; _createClass(JNFrameTweenSystem, [{ key: "addTime", get: function get() { return this._addTime; } /** * @en * Gets the instance of the tween system. * @zh * 获取缓动系统的实例。 */ }]); return JNFrameTweenSystem; }(); JNFrameTweenSystem._instance = void 0; cclegacy._RF.pop(); cclegacy._RF.push({}, "ea662LlXAFHnKlv4AWNqVQM", "JNFrameTime", undefined); //帧同步定时器 var JNFrameTime = /*#__PURE__*/function () { function JNFrameTime() { this.id = void 0; this.handlers = []; } JNFrameTime.getInstance = function getInstance() { if (JNFrameTime._instance) return JNFrameTime._instance; return JNFrameTime._instance = new JNFrameTime(); }; JNFrameTime.deleteInstance = function deleteInstance() { JNFrameTime._instance = null; }; var _proto = JNFrameTime.prototype; //设置定时器 _proto.setTimeout = function setTimeout(handler, timeout) { if (timeout === void 0) { timeout = 0; } return this.handlers.push({ id: this.id++, handler: handler, timeout: timeout }); } //清除定时器 ; _proto.clearTimeout = function clearTimeout(id) { for (var index = 0; index < this.handlers.length; index++) { var handler = this.handlers[index]; if (handler.id === id) { this.handlers.splice(index, 1); index--; } } }; _proto.onUpdate = function onUpdate(dt) { for (var index = 0; index < this.handlers.length; index++) { var handler = this.handlers[index]; handler.timeout -= dt; if (handler.timeout <= 0) { this.handlers.splice(index, 1); index--; handler.handler(); } } }; return JNFrameTime; }(); JNFrameTime._instance = void 0; cclegacy._RF.pop(); cclegacy._RF.push({}, "91284Dns1RBj4aiBAyz9XQk", "JNSyncFrame", undefined); //通知 var JNSyncFrameEvent = /*#__PURE__*/function (JNSyncFrameEvent) { JNSyncFrameEvent["CLEAR"] = "JNSyncFrameEvent_CLEAR"; JNSyncFrameEvent["CREATE"] = "JNSyncFrameEvent_CREATE"; return JNSyncFrameEvent; }({}); //创建世界 //操作数据包 //操作列表 //数据包 //数据包列表 //帧同步核心类 var JNSyncFrame = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(JNSyncFrame, _SystemBase); function JNSyncFrame() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _SystemBase.call.apply(_SystemBase, [this].concat(args)) || this; //物理 _this.instance = null; //同步时间 (和服务器保持一致) _this.nSyncTime = 67; //大于多少帧进行追帧 _this.nMaxFrameBan = 3; //大于多少帧进行快速追帧 _this.nMaxFrameLoopBan = 18; //将服务器帧数进行平分 _this.nDivideFrame = 3; //帧队列 _this.nFrameQueue = []; //本地帧 _this.nLocalFrame = 0; //运行的帧 _this.nFrameRun = 0; //暂存帧列表 _this.nFrameTempQueue = new Map(); //帧更新 _this.dtTotal = 0; //输入更新 _this.dtInputTotal = 0; //需要同步的Actor _this.nSyncActors = []; //ID 每添加 JNSyncFrameComponent + 1 _this.nSyncID = RandomUtil.Next(0); //初始化随机 _this.nRandSyncNumber = RandomUtil.SyncRandom(100); //是否开始同步 _this.isStart = false; //是否请求服务器数据中 _this.isServerData = false; return _this; } var _proto = JNSyncFrame.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var that; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: //通知清除 EventDispatcher.getIns().emit(JNSyncFrameEvent.CLEAR); //即使摧毁 CCObject._deferredDestroy(); that = this; //------------------- 重写 2D 物理 ----------------------- Object.defineProperty(PhysicsSystem2D, "instance", { get: function get() { if (!that.instance) { console.log("JNSyncFrame 初始化物理"); that.instance = new PhysicsSystem2D(); that.instance.enable = false; that.instance.autoSimulation = false; return that.instance; } else { return that.instance; } } }); PhysicsSystem2D["deleteInstance"] = function () { console.log("JNSyncFrame 销毁物理"); that.instance = null; }; PhysicsSystem2D.prototype.postUpdate = function () {}; PhysicsSystem2D.prototype.update = function () {}; sp.spine.MathUtils.randomTriangularWith = function (min, max, mode) { console.log("randomTriangularWith"); var d = max - min; if (0.1 <= (mode - min) / d) return min + Math.sqrt(0.1 * d * (mode - min)); return max - Math.sqrt((1 - 0.1) * d * (max - mode)); }; //摧毁Tween JNFrameTweenSystem.deleteInstance(); //摧毁定时器 JNFrameTime.deleteInstance(); this.onResetValue(); //通知创建 EventDispatcher.getIns().emit(JNSyncFrameEvent.CREATE); this.onActionInit(); case 13: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }() //开始 ; _proto.onStart = function onStart() { this.isStart = true; } //重置 JNSyncFrame ; _proto.onReset = function onReset() { //通知清除 EventDispatcher.getIns().emit(JNSyncFrameEvent.CLEAR); //销毁物理 PhysicsSystem2D["deleteInstance"](); //销毁Spine JNFrameSkeletonSystem.deleteInstance(); //摧毁Tween JNFrameTweenSystem.deleteInstance(); //摧毁定时器 JNFrameTime.deleteInstance(); //即使摧毁 CCObject._deferredDestroy(); this.onResetValue(); //通知创建 EventDispatcher.getIns().emit(JNSyncFrameEvent.CREATE); this.onActionInit(); } //重置数据 ; _proto.onResetValue = function onResetValue() { this.isStart = false; this.nFrameQueue = []; this.nFrameTempQueue = new Map(); this.nLocalFrame = 0; this.dtTotal = 0; this.nSyncActors = []; this.nSyncID = RandomUtil.Next(0); this.nRandSyncNumber = RandomUtil.SyncRandom(100); PhysicsSystem2D.instance.enable = false; PhysicsSystem2D.instance.autoSimulation = false; } //通知Action初始化完成 ; _proto.onActionInit = function onActionInit() { this.nSyncActors.forEach(function (action) { if (!action.isSyncInitSuccess) { action.isSyncInitSuccess = true; action.onSyncInitSuccess(); } }); } //添加同步组件 ; _proto.addSyncActor = function addSyncActor(sync) { if (this.nSyncActors.indexOf(sync) == -1) { this.nSyncActors.push(sync); } } //销毁同步组件 ; _proto.delSyncActor = function delSyncActor(sync) { this.nSyncActors.splice(this.nSyncActors.indexOf(sync), 1); } //更新同步 ; _proto.update = function update(dt) { if (!this.isStart) return; this.dtTotal += dt * 1000; this.dtInputTotal += dt * 1000; var nSyncTime = this.dyTime(); if (nSyncTime) { while (nSyncTime != 0 && this.dtTotal > nSyncTime) { this.onUpdate(); this.dtTotal -= nSyncTime; nSyncTime = this.dyTime(); } } else { //追帧运行 保持前端 15 帧 刷新 var endTime = Date.now() + 66; while (this.dyTime() == 0 && Date.now() < endTime) { this.onUpdate(); } } //更新输入 if (this.dtInputTotal > this.nSyncTime) { this.dtInputTotal = 0; this.onUpdateInput(); } } //更新输入 ; _proto.onUpdateInput = function onUpdateInput() { //帧数据 var inputs = []; //收集帧数据 this.nSyncActors.forEach(function (action) { if (action.isInput()) { //如果输入了 inputs.push({ nId: action.nId, input: action.encoder(action.input) }); } //清空输入 action.clearInput(); }); //发送输入 inputs.length && this.onSendInput({ inputs: inputs }); } //获取帧数据 ; /** * 接收帧数据 * @param frame 帧数据 * @param isLatestData 是否最新的帧数据 */ _proto.addFrame = function addFrame(info, isLatestData) { var _this2 = this; if (isLatestData === void 0) { isLatestData = false; } info.index = info.index || 0; info.messages = info.messages || []; if (isLatestData) { //如果推的帧小于本地帧 则 重开 if (info.index < this.nLocalFrame) { this.onReset(); return; } } //我需要的下一帧 var index = this.nLocalFrame + 1; //判断接受的帧是否下一帧 如果不是则加入未列入 if (info.index != index) { this.nFrameTempQueue[info.index] = info; //在未列入中拿到需要的帧 var tamp = null; if (!(tamp = this.nFrameTempQueue[index])) { //如果没有则向服务器请求我需要的帧数 if (!this.isServerData) { this.isServerData = true; //请求 this.onServerData(this.nLocalFrame).then(function (infos) { //拿到数据 插入 帧列表 infos.frames.forEach(function (frame) { if (frame.index > _this2.nLocalFrame) { _this2.addFrame(frame); } }); //结束 _this2.isServerData = false; }); } return; } else { info = tamp; } } //删除临时帧 this.nFrameTempQueue["delete"](info.index); this.nLocalFrame = index; //分帧插入 this.nFrameQueue.push(info); for (var _index = 0; _index < this.nDivideFrame - 1; _index++) { this.nFrameQueue.push({}); } }; _proto.dyTime = function dyTime() { var dt = this.nSyncTime / this.nDivideFrame; var loop = dt; //大于nMaxFrameBan 进行 追帧 if (this.nFrameQueue.length > this.nMaxFrameBan) { //计算超过的帧数 var exceed = this.nFrameQueue.length - this.nMaxFrameBan; var most = this.nMaxFrameLoopBan - this.nMaxFrameBan; var ldt = (most - exceed) / most * dt; //自适应追帧算法 if (exceed <= this.nMaxFrameLoopBan) { loop = ldt; } else { loop = 0; } } else { loop = dt; } return loop; // return dt; }; _proto.onUpdatePhysics = function onUpdatePhysics() { var dt = this.nSyncTime / this.nDivideFrame / 1000; this.instance.physicsWorld.step(dt, 10, 10); this.instance.physicsWorld.syncPhysicsToScene(); // this.instance.enable = true; // this.instance.autoSimulation = true; // this.instance.update(dt); // this.instance.enable = false; // this.instance.autoSimulation = false; // // if (this.instance.debugDrawFlags) { // this.instance.physicsWorld.drawDebug(); // let canvas = find("Canvas"); // let physics2dDebugDrawNode = canvas.getChildByName("PHYSICS_2D_DEBUG_DRAW"); // if (physics2dDebugDrawNode) { // physics2dDebugDrawNode.layer = 1; // } // // } } //运行帧 ; _proto.onUpdate = function onUpdate() { var frame = this.nFrameQueue.shift(); if (!frame) return; // if(frame.index == 115) debugger; var dt = this.nSyncTime / this.nDivideFrame; //拆出输入 var inputs = {}; (frame.messages || []).forEach(function (input) { inputs[input.nId] = input; }); //更新帧 this.nSyncActors.forEach(function (action) { var input = inputs[action.nId]; if (input) { //解码 action.onSyncUpdate(dt, frame, action.decoder(input.input)); return; } action.onSyncUpdate(dt, frame); }); //运行物理 this.onUpdatePhysics(); //运行Spine JNFrameSkeletonSystem.getInstance().onUpdate(dt / 1000); //更新Tween JNFrameTweenSystem.getInstance().onUpdate(dt); //更新定时器 JNFrameTime.getInstance().onUpdate(dt); //即使摧毁 CCObject._deferredDestroy(); //通知初始化 this.onActionInit(); this.nFrameRun = frame.index || this.nFrameRun; return frame; }; _createClass(JNSyncFrame, [{ key: "frame", get: function get() { return this.nFrameRun; } }, { key: "dt", get: function get() { return this.nSyncTime / this.nDivideFrame / 1000; } }]); return JNSyncFrame; }(SystemBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "c225anFAwNI0KCBbuX8L7G1", "NGameRes", undefined); var NGameRes = /*#__PURE__*/function () { function NGameRes() {} NGameRes.load = /*#__PURE__*/function () { var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url) { var _this = this; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: return _context2.abrupt("return", new Promise( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) { var loadRes; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: loadRes = function _loadRes() { NGameRes.bundle.load(url, resolve); }; if (!_this.bundle) { assetManager.loadBundle('ngame_src', function (err, bundle) { NGameRes.bundle = bundle; loadRes(); }); } else { loadRes(); } case 2: case "end": return _context.stop(); } }, _callee); })))); case 1: case "end": return _context2.stop(); } }, _callee2); })); function load(_x) { return _load.apply(this, arguments); } return load; }(); NGameRes.loadBundle = /*#__PURE__*/function () { var _loadBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { var _this2 = this; return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: return _context4.abrupt("return", new Promise( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) { return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: if (!_this2.bundle) { assetManager.loadBundle('ngame_src', function (err, bundle) { resolve(NGameRes.bundle = bundle); }); } else { resolve(_this2.bundle); } case 1: case "end": return _context3.stop(); } }, _callee3); })))); case 1: case "end": return _context4.stop(); } }, _callee4); })); function loadBundle() { return _loadBundle.apply(this, arguments); } return loadBundle; }(); NGameRes.BindSpriteFrame = /*#__PURE__*/function () { var _BindSpriteFrame = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sprite, path) { return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: _context5.next = 2; return this.loadBundle(); case 2: _context5.sent.load(path, function (err, data) { sprite.spriteFrame = data; }); case 3: case "end": return _context5.stop(); } }, _callee5, this); })); function BindSpriteFrame(_x4, _x5) { return _BindSpriteFrame.apply(this, arguments); } return BindSpriteFrame; }(); return NGameRes; }(); NGameRes.bundle = void 0; cclegacy._RF.pop(); var _dec$o, _dec2$d, _dec3$5, _dec4$4, _class$o, _class2$9, _descriptor$9, _descriptor2$4, _descriptor3$4; cclegacy._RF.push({}, "dcc7dYVLyxK+LNjgpBMDIUi", "JNLayerBase", undefined); var ccclass$9 = _decorator.ccclass, property$4 = _decorator.property; /** * JNLayerBase * UI Base 类 */ var JNLayerBase = (_dec$o = ccclass$9('JNLayerBase'), _dec2$d = property$4(CCBoolean), _dec3$5 = property$4({ type: CCInteger, visible: function visible() { return this.mask; } }), _dec4$4 = property$4({ type: CCBoolean, visible: function visible() { return this.mask; } }), _dec$o(_class$o = (_class2$9 = /*#__PURE__*/function (_Component) { _inheritsLoose(JNLayerBase, _Component); function JNLayerBase() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "mask", _descriptor$9, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "maskOpcity", _descriptor2$4, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "isClickMaskeClose", _descriptor3$4, _assertThisInitialized(_this)); _this.maskNode = void 0; return _this; } var _proto = JNLayerBase.prototype; //加载 _proto.onJNLoad = function onJNLoad(data) { var _this2 = this; if (this.mask) { var node = new Node("mask"); var ui = node.addComponent(UITransform); node.addComponent(BlockInputEvents); node.layer = this.node.layer; this.node.addChild(node); var mask = node.addComponent(Sprite); mask.color = color(0, 0, 0, this.maskOpcity); mask.sizeMode = Sprite.SizeMode.CUSTOM; NGameRes.BindSpriteFrame(mask, "ui/default_sprite_splash/spriteFrame"); ui.width = 99999; ui.height = 99999; node.on(Node.EventType.TOUCH_START, function () { if (_this2.isClickMaskeClose) _this2.onJNClose(); }); node.setSiblingIndex(0); this.maskNode = node; } } //加载动画结束 ; _proto.onJNLoadAnimEnd = function onJNLoadAnimEnd() {} //关闭 ; _proto.onJNClose = function onJNClose() { if (this.node.isValid) this.node.destroy(); }; return JNLayerBase; }(Component), (_descriptor$9 = _applyDecoratedDescriptor(_class2$9.prototype, "mask", [_dec2$d], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor2$4 = _applyDecoratedDescriptor(_class2$9.prototype, "maskOpcity", [_dec3$5], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 80; } }), _descriptor3$4 = _applyDecoratedDescriptor(_class2$9.prototype, "isClickMaskeClose", [_dec4$4], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } })), _class2$9)) || _class$o); cclegacy._RF.pop(); cclegacy._RF.push({}, "9d319eiU1VDuIYjkV2Z7Fi4", "AnimsNodeUtil", undefined); //CC Node 动画工具 var AnimsNodeUtil = /*#__PURE__*/function () { function AnimsNodeUtil() {} AnimsNodeUtil.onEnlarge = function onEnlarge(node, time, info, callback) { var _tween$to; if (time === void 0) { time = 0.3; } if (info === void 0) { info = { key: "scale", start: v3(0, 0, 0), end: v3(1, 1, 1) }; } console.log("AnimsNodeUtil_onEnlarge", node); node[info.key] = info.start; tween(node).to(time, (_tween$to = {}, _tween$to[info.key] = info.end, _tween$to), { onComplete: function onComplete() { callback && callback(); } }).start(); }; AnimsNodeUtil.onSmaller = function onSmaller(node, time, info, callback) { var _tween$to2; if (time === void 0) { time = 0.3; } if (info === void 0) { info = { key: "scale", start: v3(0, 0, 0), end: v3(0, 0, 0) }; } console.log("AnimsNodeUtil_onSmaller", node); tween(node).to(time, (_tween$to2 = {}, _tween$to2[info.key] = info.end, _tween$to2), { onComplete: function onComplete() { callback && callback(); } }).start(); }; AnimsNodeUtil.onCubicInOutOpen = function onCubicInOutOpen(node, time, info) { if (time === void 0) { time = 0.5; } this.Open("cubicInOut", node, time, info); }; AnimsNodeUtil.onCubicInOutClose = function onCubicInOutClose(node, time, info) { if (time === void 0) { time = 0.5; } this.Close("cubicInOut", node, time, info); }; AnimsNodeUtil.onBackOutOpen = function onBackOutOpen(node, time, info) { if (time === void 0) { time = 0.5; } this.Open("backOut", node, time, info); }; AnimsNodeUtil.onBackInClose = function onBackInClose(node, time, info) { if (time === void 0) { time = 0.5; } this.Close("backIn", node, time, info); }; AnimsNodeUtil.Open = function Open(easing, node, time, info, callback) { var _tween$to3; if (time === void 0) { time = 0.3; } if (info === void 0) { info = { key: "scale", start: v3(0, 0, 0), end: v3(1, 1, 1) }; } console.log("AnimsNodeUtil_Open", node); node[info.key] = info.start; tween(node).to(time, (_tween$to3 = {}, _tween$to3[info.key] = info.end, _tween$to3), { onComplete: function onComplete() { callback && callback(); }, easing: easing }).start(); }; AnimsNodeUtil.Close = function Close(easing, node, time, info, callback) { var _tween$to4; if (time === void 0) { time = 0.3; } if (info === void 0) { info = { key: "scale", start: v3(0, 0, 0), end: v3(0, 0, 0) }; } console.log("AnimsNodeUtil_Close", node); tween(node).to(time, (_tween$to4 = {}, _tween$to4[info.key] = info.end, _tween$to4), { onComplete: function onComplete() { callback && callback(); }, easing: easing }).start(); }; return AnimsNodeUtil; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "1b20f8bo8tAN5sIOQ+GEvSr", "JNLayer", undefined); var JNLayerAnim = /*#__PURE__*/function (JNLayerAnim) { JNLayerAnim["Enlarge"] = "Enlarge"; JNLayerAnim["Smaller"] = "Smaller"; JNLayerAnim["CubicInOutOpen"] = "CubicInOutOpen"; JNLayerAnim["CubicInOutClose"] = "CubicInOutClose"; JNLayerAnim["BackOutOpen"] = "BackOutOpen"; JNLayerAnim["BackInClose"] = "BackInClose"; return JNLayerAnim; }({}); //页面回调生命周期 var JNLayer = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(JNLayer, _SystemBase); function JNLayer() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _SystemBase.call.apply(_SystemBase, [this].concat(args)) || this; //层 _this.layers = []; //Node 层 _this.layerMap = {}; //根节点 _this.root = void 0; //页面 _this.views = {}; //当前打开的页面 _this.nodes = {}; return _this; } var _proto = JNLayer.prototype; _proto.bind = function bind(root) { var _this2 = this; this.root = root; this.root.removeAllChildren(); //初始化层 this.layers.forEach(function (view) { // this.root.addChild(); var node = new Node(view); _this2.layerMap[view] = node; var widget = node.addComponent(Widget); widget.isAlignBottom = true; widget.isAlignTop = true; widget.isAlignLeft = true; widget.isAlignRight = true; widget.bottom = widget.left = widget.right = widget.top = 0; _this2.root.addChild(node); widget.updateAlignment(); }); } //初始化 ; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (this.root) { _context.next = 2; break; } return _context.abrupt("return"); case 2: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }() //打开页面 ; _proto.Open = /*#__PURE__*/function () { var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, args, callback) { var info, prefab, view, _view$getComponent, uiBase, onJNLoad, onJNLoadAnimEnd, onJNClose; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (args === void 0) { args = null; } if (callback === void 0) { callback = {}; } if (!(!key || !(info = this.views[key]))) { _context2.next = 5; break; } console.info("JNLayer \u6CA1\u6709 " + key + " \u9875\u9762"); return _context2.abrupt("return"); case 5: if (!info) { _context2.next = 14; break; } _context2.next = 8; return this.loadPrefab(info); case 8: prefab = _context2.sent; view = instantiate(prefab); this.layerMap[info.layer].addChild(view); (this.nodes[key] || (this.nodes[key] = [])).push(view); if (view.getComponent(Widget)) { (_view$getComponent = view.getComponent(Widget)) == null ? void 0 : _view$getComponent.updateAlignment(); view.getComponent(Widget).enabled = false; } if (uiBase = view.getComponent(JNLayerBase)) { //播放动画 if (info.anims) { this.onHandleAnim(info.anims, uiBase); } //打开生命周期 onJNLoad = uiBase.onJNLoad; uiBase.onJNLoad = function (args) { callback.onJNLoad && callback.onJNLoad(args); onJNLoad.bind(uiBase)(args); }; //打开动画生命周期 onJNLoadAnimEnd = uiBase.onJNLoadAnimEnd; uiBase.onJNLoadAnimEnd = function () { onJNLoadAnimEnd.bind(uiBase)(args); if (view.getComponent(Widget)) { view.getComponent(Widget).enabled = true; } }; //关闭生命周期 onJNClose = uiBase.onJNClose; uiBase.onJNClose = function () { callback.onJNClose && callback.onJNClose(); onJNClose.bind(uiBase)(); }; //生命周期 uiBase.onJNLoad(args); } case 14: case "end": return _context2.stop(); } }, _callee2, this); })); function Open(_x, _x2, _x3) { return _Open.apply(this, arguments); } return Open; }() //打开到关闭 ; _proto.OpenToClose = function OpenToClose(key, args) { var _this3 = this; if (args === void 0) { args = null; } return new Promise(function (resolve) { _this3.Open(key, args, { onJNClose: resolve }); }); } //关闭Node页面 ; _proto.CloseNode = function CloseNode(node) { if (!node.isValid) return; if (node.getComponent(JNLayerBase)) { node.getComponent(JNLayerBase).onJNClose(); } else { node.destroy(); } //删除记录 Object.values(this.nodes).forEach(function (nodes) { if (nodes.indexOf(node) >= 0) { nodes.splice(nodes.indexOf(node), 1); } }); } //关闭 ; _proto.Close = function Close(key) { var list = this.nodes[key] || (this.nodes[key] = []); for (var index = 0; index < list.length; index++) { var node = list[index]; if (node.isValid) { if (node.getComponent(JNLayerBase)) { node.getComponent(JNLayerBase).onJNClose(); } else { node.destroy(); } } list.splice(index, 1); index--; } } //处理动画 ; _proto.onHandleAnim = function onHandleAnim(anims, node) { //显示 if (anims.front) { var onJNLoad = node.onJNLoad; node.onJNLoad = function (data) { AnimsNodeUtil["on" + anims.front](this.node, anims.frontTime || 0.5, anims.frontInfo, node.onJNLoadAnimEnd.bind(this)); onJNLoad.bind(this)(data); }; } //关闭 if (anims.back) { var onJNClose = node.onJNClose; node.onJNClose = function (data) { var _this4 = this; AnimsNodeUtil["on" + anims.back](this.node, anims.backTime || 0.5, anims.backInfo); this.scheduleOnce(function () { onJNClose.bind(_this4)(data); }, anims.backTime || 0.5); }; } } //加载页面 ; _proto.loadPrefab = /*#__PURE__*/function () { var _loadPrefab = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(info) { var _this5 = this; return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: return _context4.abrupt("return", new Promise( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) { var res; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return _this5.getBundle(); case 2: res = _context3.sent; res.load(info.uri, function (error, data) { return resolve(data); }); case 4: case "end": return _context3.stop(); } }, _callee3); })))); case 1: case "end": return _context4.stop(); } }, _callee4); })); function loadPrefab(_x4) { return _loadPrefab.apply(this, arguments); } return loadPrefab; }(); _proto.getBundle = /*#__PURE__*/function () { var _getBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() { return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: return _context5.abrupt("return", resources); case 1: case "end": return _context5.stop(); } }, _callee5); })); function getBundle() { return _getBundle.apply(this, arguments); } return getBundle; }(); return JNLayer; }(SystemBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "d70f4XXAwBAVbHduLz9UWd7", "loader", undefined); var loader$1 = /*#__PURE__*/function () { function loader() {} loader.loadurl = /*#__PURE__*/function () { var _loadurl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, type) { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (type === void 0) { type = Asset; } return _context.abrupt("return", new Promise(function (resolve, reject) { assetManager.resources.load(url, type, function (err, res) { if (err) { reject(err); } else { resolve(res); } }); })); case 2: case "end": return _context.stop(); } }, _callee); })); function loadurl(_x, _x2) { return _loadurl.apply(this, arguments); } return loadurl; }(); loader.loadlocalCache = function loadlocalCache(path, bundleName) { var bundle = resources; if (bundleName) { bundle = assetManager.getBundle(bundleName) || bundle; } return bundle.get(path); }; loader.loadlocal = /*#__PURE__*/function () { var _loadlocal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, bundleName) { var bundle; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!bundleName) { _context2.next = 9; break; } _context2.next = 3; return loader.getBundle(bundleName); case 3: bundle = _context2.sent; if (!bundle.get(path)) { _context2.next = 6; break; } return _context2.abrupt("return", bundle.get(path)); case 6: return _context2.abrupt("return", new Promise(function (resolve, reject) { bundle.load(path, function (err, res) { //assets.addRef(); if (err) { reject(err); return; } resolve(res); }); })); case 9: if (!resources.get(path)) { _context2.next = 11; break; } return _context2.abrupt("return", resources.get(path)); case 11: return _context2.abrupt("return", new Promise(function (resolve, reject) { resources.load(path, function (err, res) { if (err) { reject(err); } else { resolve(res); } }); })); case 12: case "end": return _context2.stop(); } }, _callee2); })); function loadlocal(_x3, _x4) { return _loadlocal.apply(this, arguments); } return loadlocal; }(); loader.loadPrefab = /*#__PURE__*/function () { var _loadPrefab = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(uiPrefabPath, bundleName) { var bundle, prefab; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: bundleName = bundleName || "resources"; _context3.next = 3; return loader.getBundle(bundleName); case 3: bundle = _context3.sent; if (!bundle.get(uiPrefabPath)) { _context3.next = 7; break; } prefab = bundle.get(uiPrefabPath); return _context3.abrupt("return", instantiate(prefab)); case 7: return _context3.abrupt("return", new Promise(function (res, rej) { bundle.load(uiPrefabPath, Prefab, function (err, assets) { //assets.addRef(); if (err) { res(null); return; } res(instantiate(assets)); }); })); case 8: case "end": return _context3.stop(); } }, _callee3); })); function loadPrefab(_x5, _x6) { return _loadPrefab.apply(this, arguments); } return loadPrefab; }(); loader.getBundle = /*#__PURE__*/function () { var _getBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(bundleName) { var bundle; return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: bundle = assetManager.getBundle(bundleName); if (!bundle) { _context4.next = 5; break; } return _context4.abrupt("return", bundle); case 5: _context4.next = 7; return loader.loadBundle(bundleName); case 7: return _context4.abrupt("return", _context4.sent); case 8: case "end": return _context4.stop(); } }, _callee4); })); function getBundle(_x7) { return _getBundle.apply(this, arguments); } return getBundle; }(); loader.loadBundle = /*#__PURE__*/function () { var _loadBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(bundleName) { return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: return _context5.abrupt("return", new Promise(function (res, rej) { assetManager.loadBundle(bundleName, function (err, bundle) { if (!err) { res(bundle); } else { rej(bundle); } }); })); case 1: case "end": return _context5.stop(); } }, _callee5); })); function loadBundle(_x8) { return _loadBundle.apply(this, arguments); } return loadBundle; }(); loader.release = /*#__PURE__*/function () { var _release = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(bundleName, path) { var bundle, asset; return _regeneratorRuntime().wrap(function _callee6$(_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: if (path === void 0) { path = null; } bundle = assetManager.getBundle(bundleName); if (bundle) { _context6.next = 4; break; } return _context6.abrupt("return"); case 4: if (path == null) bundle.releaseAll();else { asset = bundle.get(path); if (asset) { assetManager.releaseAsset(asset); } } case 5: case "end": return _context6.stop(); } }, _callee6); })); function release(_x9, _x10) { return _release.apply(this, arguments); } return release; }(); return loader; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "612dc7ThI1OcZZKFoIpVlSo", "JAPI", undefined); var JAPIMethod = /*#__PURE__*/function (JAPIMethod) { JAPIMethod["POST"] = "POST"; JAPIMethod["GET"] = "GET"; return JAPIMethod; }({}); var JAPI = /*#__PURE__*/function () { function JAPI(config) { if (config === void 0) { config = {}; } this.config = { headers: { "Content-Type": "application/json; charset=utf-8" } }; this.requestInterceptors = []; this.responseInterceptors = []; Object.assign(this.config, config); this.config.baseURL = config.baseURL || ""; this.config.timeout = config.timeout || 5000; this.config.headers = config.headers || { "Content-Type": "application/json; charset=utf-8" }; this.config.responseType = config.responseType || "json"; } JAPI.create = function create(config) { if (config === void 0) { config = {}; } return new JAPI(config); }; var _proto = JAPI.prototype; _proto.post = function post(url, data) { if (data === void 0) { data = {}; } var config = Object.assign({}, this.config); if (!this.onRequestInterceptors(config)) return; return new Promise(function (resolve, reject) { JAPI.request("" + config.baseURL + url, JAPIMethod.POST, data, config, resolve, reject); }); }; JAPI.get = function get(url, data) { if (data === void 0) { data = {}; } return new Promise(function (resolve, reject) { JAPI.request("" + url, JAPIMethod.GET, data, {}, resolve, reject); }); }; _proto.get = function get(url, data) { if (data === void 0) { data = {}; } data.responseType = data.responseType || this.config.responseType; data.params = data.params || {}; var config = Object.assign({}, this.config); config.responseType = data.responseType; if (!this.onRequestInterceptors(config)) return; return new Promise(function (resolve, reject) { JAPI.request("" + config.baseURL + url, JAPIMethod.GET, data, config, resolve, reject); }); }; _proto.onRequestInterceptors = function onRequestInterceptors(config) { //执行拦截器 for (var index = 0; index < this.requestInterceptors.length; index++) { var inter = this.requestInterceptors[index]; if (!inter(config)) return false; } return true; } //请求拦截 ; _proto.addRequestInterceptors = function addRequestInterceptors(inter) { this.requestInterceptors.push(inter); } //响应拦截 ; _proto.addResponseInterceptors = function addResponseInterceptors(inter) { this.responseInterceptors.push(inter); }; JAPI.request = function request(url, method, data, config, resolve, reject) { if (data === void 0) { data = {}; } if (config === void 0) { config = {}; } if (resolve === void 0) { resolve = function resolve(data) {}; } if (reject === void 0) { reject = function reject(data) {}; } config.headers = config.headers || {}; var result = { data: null }; var xhr = new XMLHttpRequest(); xhr.responseType = config.responseType; xhr.open(method, url); //设置请求头 Object.keys(config.headers).forEach(function (key) { xhr.setRequestHeader(key, config.headers[key]); }); //设置超时 if (config.timeout) { xhr.timeout = config.timeout; xhr.ontimeout = function () { console.log("JAPI ontimeout"); reject(result); }; } xhr.onloadend = function (data) { console.log("JAPI onloadend"); }; xhr.onerror = function (data) { console.log("JAPI onerror"); reject(result); }; xhr.onreadystatechange = function () { if (xhr.readyState != 4) return; if (xhr.status == 200) { console.log("JAPI", xhr.response); if (xhr.responseType == 'arraybuffer') { // 加载非文本格式 result.data = xhr.response; resolve(result); return; } else { //默认JSON if (config.responseType == "text") result.data = JSON.parse(xhr.response); if (config.responseType == "json") result.data = xhr.response; resolve(result); return; } } }; if (method == JAPIMethod.GET) { xhr.send(); } else { xhr.send(JSON.stringify(data)); } }; return JAPI; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "e222cbSaP5J4qhkT4UwKEXW", "JsonUtil", undefined); /** 数据缓存 */ var data = new Map(); /** JSON数据表工具 */ var JsonUtil = /*#__PURE__*/function () { function JsonUtil() {} /** * 通知资源名从缓存中获取一个Json数据表 * @param name 资源名 */ JsonUtil.get = function get(name) { if (data.has(name)) return data.get(name); } /** * 获取所有Json */ ; JsonUtil.getAll = function getAll() { return data; } /** * 通知资源名加载Json数据表 * @param name 资源名 * @param callback 资源加载完成回调 */ ; JsonUtil.load = /*#__PURE__*/function () { var _load2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_load, callback) { var json, res, path, _res; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (callback === void 0) { callback = function callback() {}; } if (!data.has(_load.name)) { _context.next = 6; break; } callback(data.get(_load.name)); return _context.abrupt("return", data.get(_load.name)); case 6: json = null; if (!_load.isHttp) { _context.next = 14; break; } _context.next = 10; return JAPI.get(_load.path); case 10: res = _context.sent.data; json = res; _context.next = 20; break; case 14: //加载Json文件 _load.bundle = _load.bundle || 'resources'; path = _load.path + _load.name; _context.next = 18; return loader$1.loadlocal(path, _load.bundle); case 18: _res = _context.sent; json = _res.json; case 20: json && data.set(_load.name, json); callback(json); return _context.abrupt("return", json); case 23: case "end": return _context.stop(); } }, _callee); })); function load(_x, _x2) { return _load2.apply(this, arguments); } return load; }() /** * 通过指定资源名释放资源 * @param name 资源名 */ ; JsonUtil.release = function release(load) { data["delete"](load.name); var path = load.path + load.name; loader$1.release(load.bundle, path); }; return JsonUtil; }(); cclegacy._RF.pop(); /** * The Ease class provides a collection of easing functions for use with tween.js. */ var Easing = Object.freeze({ Linear: Object.freeze({ None: function None(amount) { return amount; }, In: function In(amount) { return this.None(amount); }, Out: function Out(amount) { return this.None(amount); }, InOut: function InOut(amount) { return this.None(amount); } }), Quadratic: Object.freeze({ In: function In(amount) { return amount * amount; }, Out: function Out(amount) { return amount * (2 - amount); }, InOut: function InOut(amount) { if ((amount *= 2) < 1) { return 0.5 * amount * amount; } return -0.5 * (--amount * (amount - 2) - 1); } }), Cubic: Object.freeze({ In: function In(amount) { return amount * amount * amount; }, Out: function Out(amount) { return --amount * amount * amount + 1; }, InOut: function InOut(amount) { if ((amount *= 2) < 1) { return 0.5 * amount * amount * amount; } return 0.5 * ((amount -= 2) * amount * amount + 2); } }), Quartic: Object.freeze({ In: function In(amount) { return amount * amount * amount * amount; }, Out: function Out(amount) { return 1 - --amount * amount * amount * amount; }, InOut: function InOut(amount) { if ((amount *= 2) < 1) { return 0.5 * amount * amount * amount * amount; } return -0.5 * ((amount -= 2) * amount * amount * amount - 2); } }), Quintic: Object.freeze({ In: function In(amount) { return amount * amount * amount * amount * amount; }, Out: function Out(amount) { return --amount * amount * amount * amount * amount + 1; }, InOut: function InOut(amount) { if ((amount *= 2) < 1) { return 0.5 * amount * amount * amount * amount * amount; } return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2); } }), Sinusoidal: Object.freeze({ In: function In(amount) { return 1 - Math.sin((1.0 - amount) * Math.PI / 2); }, Out: function Out(amount) { return Math.sin(amount * Math.PI / 2); }, InOut: function InOut(amount) { return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount))); } }), Exponential: Object.freeze({ In: function In(amount) { return amount === 0 ? 0 : Math.pow(1024, amount - 1); }, Out: function Out(amount) { return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount); }, InOut: function InOut(amount) { if (amount === 0) { return 0; } if (amount === 1) { return 1; } if ((amount *= 2) < 1) { return 0.5 * Math.pow(1024, amount - 1); } return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2); } }), Circular: Object.freeze({ In: function In(amount) { return 1 - Math.sqrt(1 - amount * amount); }, Out: function Out(amount) { return Math.sqrt(1 - --amount * amount); }, InOut: function InOut(amount) { if ((amount *= 2) < 1) { return -0.5 * (Math.sqrt(1 - amount * amount) - 1); } return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1); } }), Elastic: Object.freeze({ In: function In(amount) { if (amount === 0) { return 0; } if (amount === 1) { return 1; } return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI); }, Out: function Out(amount) { if (amount === 0) { return 0; } if (amount === 1) { return 1; } return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1; }, InOut: function InOut(amount) { if (amount === 0) { return 0; } if (amount === 1) { return 1; } amount *= 2; if (amount < 1) { return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI); } return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1; } }), Back: Object.freeze({ In: function In(amount) { var s = 1.70158; return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s); }, Out: function Out(amount) { var s = 1.70158; return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1; }, InOut: function InOut(amount) { var s = 1.70158 * 1.525; if ((amount *= 2) < 1) { return 0.5 * (amount * amount * ((s + 1) * amount - s)); } return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2); } }), Bounce: Object.freeze({ In: function In(amount) { return 1 - Easing.Bounce.Out(1 - amount); }, Out: function Out(amount) { if (amount < 1 / 2.75) { return 7.5625 * amount * amount; } else if (amount < 2 / 2.75) { return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75; } else if (amount < 2.5 / 2.75) { return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375; } else { return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375; } }, InOut: function InOut(amount) { if (amount < 0.5) { return Easing.Bounce.In(amount * 2) * 0.5; } return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5; } }), generatePow: function generatePow(power) { if (power === void 0) { power = 4; } power = power < Number.EPSILON ? Number.EPSILON : power; power = power > 10000 ? 10000 : power; return { In: function In(amount) { return Math.pow(amount, power); }, Out: function Out(amount) { return 1 - Math.pow(1 - amount, power); }, InOut: function InOut(amount) { if (amount < 0.5) { return Math.pow(amount * 2, power) / 2; } return (1 - Math.pow(2 - amount * 2, power)) / 2 + 0.5; } }; } }); var now = function now() { return performance.now(); }; /** * Controlling groups of tweens * * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components. * In these cases, you may want to create your own smaller groups of tween */ var Group = /** @class */ function () { function Group() { this._tweens = {}; this._tweensAddedDuringUpdate = {}; } Group.prototype.getAll = function () { var _this = this; return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; }); }; Group.prototype.removeAll = function () { this._tweens = {}; }; Group.prototype.add = function (tween) { this._tweens[tween.getId()] = tween; this._tweensAddedDuringUpdate[tween.getId()] = tween; }; Group.prototype.remove = function (tween) { delete this._tweens[tween.getId()]; delete this._tweensAddedDuringUpdate[tween.getId()]; }; Group.prototype.update = function (time, preserve) { if (time === void 0) { time = now(); } if (preserve === void 0) { preserve = false; } var tweenIds = Object.keys(this._tweens); if (tweenIds.length === 0) { return false; } // Tweens are updated in "batches". If you add a new tween during an // update, then the new tween will be updated in the next batch. // If you remove a tween during an update, it may or may not be updated. // However, if the removed tween was added during the current batch, // then it will not be updated. while (tweenIds.length > 0) { this._tweensAddedDuringUpdate = {}; for (var i = 0; i < tweenIds.length; i++) { var tween = this._tweens[tweenIds[i]]; var autoStart = !preserve; if (tween && tween.update(time, autoStart) === false && !preserve) { delete this._tweens[tweenIds[i]]; } } tweenIds = Object.keys(this._tweensAddedDuringUpdate); } return true; }; return Group; }(); /** * */ var Interpolation = { Linear: function Linear(v, k) { var m = v.length - 1; var f = m * k; var i = Math.floor(f); var fn = Interpolation.Utils.Linear; if (k < 0) { return fn(v[0], v[1], f); } if (k > 1) { return fn(v[m], v[m - 1], m - f); } return fn(v[i], v[i + 1 > m ? m : i + 1], f - i); }, Bezier: function Bezier(v, k) { var b = 0; var n = v.length - 1; var pw = Math.pow; var bn = Interpolation.Utils.Bernstein; for (var i = 0; i <= n; i++) { b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i); } return b; }, CatmullRom: function CatmullRom(v, k) { var m = v.length - 1; var f = m * k; var i = Math.floor(f); var fn = Interpolation.Utils.CatmullRom; if (v[0] === v[m]) { if (k < 0) { i = Math.floor(f = m * (1 + k)); } return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i); } else { if (k < 0) { return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]); } if (k > 1) { return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]); } return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i); } }, Utils: { Linear: function Linear(p0, p1, t) { return (p1 - p0) * t + p0; }, Bernstein: function Bernstein(n, i) { var fc = Interpolation.Utils.Factorial; return fc(n) / fc(i) / fc(n - i); }, Factorial: function () { var a = [1]; return function (n) { var s = 1; if (a[n]) { return a[n]; } for (var i = n; i > 1; i--) { s *= i; } a[n] = s; return s; }; }(), CatmullRom: function CatmullRom(p0, p1, p2, p3, t) { var v0 = (p2 - p0) * 0.5; var v1 = (p3 - p1) * 0.5; var t2 = t * t; var t3 = t * t2; return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; } } }; /** * Utils */ var Sequence$1 = /** @class */ function () { function Sequence() {} Sequence.nextId = function () { return Sequence._nextId++; }; Sequence._nextId = 0; return Sequence; }(); var mainGroup = new Group(); /** * Tween.js - Licensed under the MIT license * https://github.com/tweenjs/tween.js * ---------------------------------------------- * * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors. * Thank you all, you're awesome! */ var Tween = /** @class */ function () { function Tween(_object, _group) { if (_group === void 0) { _group = mainGroup; } this._object = _object; this._group = _group; this._isPaused = false; this._pauseStart = 0; this._valuesStart = {}; this._valuesEnd = {}; this._valuesStartRepeat = {}; this._duration = 1000; this._isDynamic = false; this._initialRepeat = 0; this._repeat = 0; this._yoyo = false; this._isPlaying = false; this._reversed = false; this._delayTime = 0; this._startTime = 0; this._easingFunction = Easing.Linear.None; this._interpolationFunction = Interpolation.Linear; // eslint-disable-next-line this._chainedTweens = []; this._onStartCallbackFired = false; this._onEveryStartCallbackFired = false; this._id = Sequence$1.nextId(); this._isChainStopped = false; this._propertiesAreSetUp = false; this._goToEnd = false; } Tween.prototype.getId = function () { return this._id; }; Tween.prototype.isPlaying = function () { return this._isPlaying; }; Tween.prototype.isPaused = function () { return this._isPaused; }; Tween.prototype.to = function (target, duration) { if (duration === void 0) { duration = 1000; } if (this._isPlaying) throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.'); this._valuesEnd = target; this._propertiesAreSetUp = false; this._duration = duration; return this; }; Tween.prototype.duration = function (duration) { if (duration === void 0) { duration = 1000; } this._duration = duration; return this; }; Tween.prototype.dynamic = function (dynamic) { if (dynamic === void 0) { dynamic = false; } this._isDynamic = dynamic; return this; }; Tween.prototype.start = function (time, overrideStartingValues) { if (time === void 0) { time = now(); } if (overrideStartingValues === void 0) { overrideStartingValues = false; } if (this._isPlaying) { return this; } // eslint-disable-next-line this._group && this._group.add(this); this._repeat = this._initialRepeat; if (this._reversed) { // If we were reversed (f.e. using the yoyo feature) then we need to // flip the tween direction back to forward. this._reversed = false; for (var property in this._valuesStartRepeat) { this._swapEndStartRepeatValues(property); this._valuesStart[property] = this._valuesStartRepeat[property]; } } this._isPlaying = true; this._isPaused = false; this._onStartCallbackFired = false; this._onEveryStartCallbackFired = false; this._isChainStopped = false; this._startTime = time; this._startTime += this._delayTime; if (!this._propertiesAreSetUp || overrideStartingValues) { this._propertiesAreSetUp = true; // If dynamic is not enabled, clone the end values instead of using the passed-in end values. if (!this._isDynamic) { var tmp = {}; for (var prop in this._valuesEnd) tmp[prop] = this._valuesEnd[prop]; this._valuesEnd = tmp; } this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues); } return this; }; Tween.prototype.startFromCurrentValues = function (time) { return this.start(time, true); }; Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) { for (var property in _valuesEnd) { var startValue = _object[property]; var startValueIsArray = Array.isArray(startValue); var propType = startValueIsArray ? 'array' : typeof startValue; var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]); // If `to()` specifies a property that doesn't exist in the source object, // we should not set that property in the object if (propType === 'undefined' || propType === 'function') { continue; } // Check if an Array was provided as property value if (isInterpolationList) { var endValues = _valuesEnd[property]; if (endValues.length === 0) { continue; } // Handle an array of relative values. // Creates a local copy of the Array with the start value at the front var temp = [startValue]; for (var i = 0, l = endValues.length; i < l; i += 1) { var value = this._handleRelativeValue(startValue, endValues[i]); if (isNaN(value)) { isInterpolationList = false; console.warn('Found invalid interpolation list. Skipping.'); break; } temp.push(value); } if (isInterpolationList) { // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp. _valuesEnd[property] = temp; // } } } // handle the deepness of the values if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) { _valuesStart[property] = startValueIsArray ? [] : {}; var nestedObject = startValue; for (var prop in nestedObject) { _valuesStart[property][prop] = nestedObject[prop]; } // TODO? repeat nested values? And yoyo? And array values? _valuesStartRepeat[property] = startValueIsArray ? [] : {}; var endValues = _valuesEnd[property]; // If dynamic is not enabled, clone the end values instead of using the passed-in end values. if (!this._isDynamic) { var tmp = {}; for (var prop in endValues) tmp[prop] = endValues[prop]; _valuesEnd[property] = endValues = tmp; } this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues); } else { // Save the starting value, but only once unless override is requested. if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) { _valuesStart[property] = startValue; } if (!startValueIsArray) { // eslint-disable-next-line // @ts-ignore FIXME? _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings } if (isInterpolationList) { // eslint-disable-next-line // @ts-ignore FIXME? _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse(); } else { _valuesStartRepeat[property] = _valuesStart[property] || 0; } } } }; Tween.prototype.stop = function () { if (!this._isChainStopped) { this._isChainStopped = true; this.stopChainedTweens(); } if (!this._isPlaying) { return this; } // eslint-disable-next-line this._group && this._group.remove(this); this._isPlaying = false; this._isPaused = false; if (this._onStopCallback) { this._onStopCallback(this._object); } return this; }; Tween.prototype.end = function () { this._goToEnd = true; this.update(Infinity); return this; }; Tween.prototype.pause = function (time) { if (time === void 0) { time = now(); } if (this._isPaused || !this._isPlaying) { return this; } this._isPaused = true; this._pauseStart = time; // eslint-disable-next-line this._group && this._group.remove(this); return this; }; Tween.prototype.resume = function (time) { if (time === void 0) { time = now(); } if (!this._isPaused || !this._isPlaying) { return this; } this._isPaused = false; this._startTime += time - this._pauseStart; this._pauseStart = 0; // eslint-disable-next-line this._group && this._group.add(this); return this; }; Tween.prototype.stopChainedTweens = function () { for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { this._chainedTweens[i].stop(); } return this; }; Tween.prototype.group = function (group) { if (group === void 0) { group = mainGroup; } this._group = group; return this; }; Tween.prototype.delay = function (amount) { if (amount === void 0) { amount = 0; } this._delayTime = amount; return this; }; Tween.prototype.repeat = function (times) { if (times === void 0) { times = 0; } this._initialRepeat = times; this._repeat = times; return this; }; Tween.prototype.repeatDelay = function (amount) { this._repeatDelayTime = amount; return this; }; Tween.prototype.yoyo = function (yoyo) { if (yoyo === void 0) { yoyo = false; } this._yoyo = yoyo; return this; }; Tween.prototype.easing = function (easingFunction) { if (easingFunction === void 0) { easingFunction = Easing.Linear.None; } this._easingFunction = easingFunction; return this; }; Tween.prototype.interpolation = function (interpolationFunction) { if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; } this._interpolationFunction = interpolationFunction; return this; }; // eslint-disable-next-line Tween.prototype.chain = function () { var tweens = []; for (var _i = 0; _i < arguments.length; _i++) { tweens[_i] = arguments[_i]; } this._chainedTweens = tweens; return this; }; Tween.prototype.onStart = function (callback) { this._onStartCallback = callback; return this; }; Tween.prototype.onEveryStart = function (callback) { this._onEveryStartCallback = callback; return this; }; Tween.prototype.onUpdate = function (callback) { this._onUpdateCallback = callback; return this; }; Tween.prototype.onRepeat = function (callback) { this._onRepeatCallback = callback; return this; }; Tween.prototype.onComplete = function (callback) { this._onCompleteCallback = callback; return this; }; Tween.prototype.onStop = function (callback) { this._onStopCallback = callback; return this; }; /** * @returns true if the tween is still playing after the update, false * otherwise (calling update on a paused tween still returns true because * it is still playing, just paused). */ Tween.prototype.update = function (time, autoStart) { if (time === void 0) { time = now(); } if (autoStart === void 0) { autoStart = true; } if (this._isPaused) return true; var property; var elapsed; var endTime = this._startTime + this._duration; if (!this._goToEnd && !this._isPlaying) { if (time > endTime) return false; if (autoStart) this.start(time, true); } this._goToEnd = false; if (time < this._startTime) { return true; } if (this._onStartCallbackFired === false) { if (this._onStartCallback) { this._onStartCallback(this._object); } this._onStartCallbackFired = true; } if (this._onEveryStartCallbackFired === false) { if (this._onEveryStartCallback) { this._onEveryStartCallback(this._object); } this._onEveryStartCallbackFired = true; } elapsed = (time - this._startTime) / this._duration; elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed; var value = this._easingFunction(elapsed); // properties transformations this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value); if (this._onUpdateCallback) { this._onUpdateCallback(this._object, elapsed); } if (elapsed === 1) { if (this._repeat > 0) { if (isFinite(this._repeat)) { this._repeat--; } // Reassign starting values, restart by making startTime = now for (property in this._valuesStartRepeat) { if (!this._yoyo && typeof this._valuesEnd[property] === 'string') { this._valuesStartRepeat[property] = // eslint-disable-next-line // @ts-ignore FIXME? this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]); } if (this._yoyo) { this._swapEndStartRepeatValues(property); } this._valuesStart[property] = this._valuesStartRepeat[property]; } if (this._yoyo) { this._reversed = !this._reversed; } if (this._repeatDelayTime !== undefined) { this._startTime = time + this._repeatDelayTime; } else { this._startTime = time + this._delayTime; } if (this._onRepeatCallback) { this._onRepeatCallback(this._object); } this._onEveryStartCallbackFired = false; return true; } else { if (this._onCompleteCallback) { this._onCompleteCallback(this._object); } for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { // Make the chained tweens start exactly at the time they should, // even if the `update()` method was called way past the duration of the tween this._chainedTweens[i].start(this._startTime + this._duration, false); } this._isPlaying = false; return false; } } return true; }; Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) { for (var property in _valuesEnd) { // Don't update properties that do not exist in the source object if (_valuesStart[property] === undefined) { continue; } var start = _valuesStart[property] || 0; var end = _valuesEnd[property]; var startIsArray = Array.isArray(_object[property]); var endIsArray = Array.isArray(end); var isInterpolationList = !startIsArray && endIsArray; if (isInterpolationList) { _object[property] = this._interpolationFunction(end, value); } else if (typeof end === 'object' && end) { // eslint-disable-next-line // @ts-ignore FIXME? this._updateProperties(_object[property], start, end, value); } else { // Parses relative end values with start as base (e.g.: +10, -3) end = this._handleRelativeValue(start, end); // Protect against non numeric properties. if (typeof end === 'number') { // eslint-disable-next-line // @ts-ignore FIXME? _object[property] = start + (end - start) * value; } } } }; Tween.prototype._handleRelativeValue = function (start, end) { if (typeof end !== 'string') { return end; } if (end.charAt(0) === '+' || end.charAt(0) === '-') { return start + parseFloat(end); } return parseFloat(end); }; Tween.prototype._swapEndStartRepeatValues = function (property) { var tmp = this._valuesStartRepeat[property]; var endValue = this._valuesEnd[property]; if (typeof endValue === 'string') { this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue); } else { this._valuesStartRepeat[property] = this._valuesEnd[property]; } this._valuesEnd[property] = tmp; }; return Tween; }(); /** * Controlling groups of tweens * * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components. * In these cases, you may want to create your own smaller groups of tweens. */ var TWEEN = mainGroup; // This is the best way to export things in a way that's compatible with both ES // Modules and CommonJS, without build hacks, and so as not to break the // existing API. // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881 var getAll = TWEEN.getAll.bind(TWEEN); var removeAll = TWEEN.removeAll.bind(TWEEN); var add = TWEEN.add.bind(TWEEN); var remove = TWEEN.remove.bind(TWEEN); var update = TWEEN.update.bind(TWEEN); cclegacy._RF.push({}, "af5886sl8VPnoWB+INr7Cqa", "JNFrameTween", undefined); var JNFrameTween = /*#__PURE__*/function (_Tween) { _inheritsLoose(JNFrameTween, _Tween); var _proto = JNFrameTween.prototype; //是否Node可用 _proto.isNodeValid = function isNodeValid() { if (!this.node) return true; return this.node.isValid; }; function JNFrameTween(_object, node, _group) { var _this; _this = _Tween.call(this, _object, _group) || this; _this.node = void 0; _this.node = node; return _this; } _proto.start = function start(time, overrideStartingValues) { if (!this.isNodeValid) return this; time = JNFrameTweenSystem.getInstance().addTime; JNFrameTweenSystem.getInstance().addTween(this); _Tween.prototype.start.call(this, time, overrideStartingValues); return this; }; _proto.update = function update(time, autoStart) { var bool = _Tween.prototype.update.call(this, time, autoStart); if (!bool && JNFrameTweenSystem.getInstance().hasTween(this) || !this.isNodeValid) { JNFrameTweenSystem.getInstance().delTween(this); } return bool; }; _proto.stop = function stop() { _Tween.prototype.stop.call(this); if (JNFrameTweenSystem.getInstance().hasTween(this)) { JNFrameTweenSystem.getInstance().delTween(this); } return this; }; return JNFrameTween; }(Tween); function JTween(data, node) { return new JNFrameTween(data, node); } var JEasing = Easing; cclegacy._RF.pop(); cclegacy._RF.push({}, "5a9e0xvXXdDkoFmTsVtmxi8", "JNSyncFrameComponent", undefined); var JNSyncFrameComponent = /*#__PURE__*/function (_Component) { _inheritsLoose(JNSyncFrameComponent, _Component); function JNSyncFrameComponent() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _this._nId = void 0; _this._input = void 0; //是否初始化完成 _this.isSyncInitSuccess = false; return _this; } var _proto = JNSyncFrameComponent.prototype; //清空输入 _proto.clearInput = function clearInput() { this._input = null; } //判断是否输入 ; _proto.isInput = function isInput() { return !(!this._input || Object.keys(this._input).length == 0); }; //初始化完成 _proto.onSyncInitSuccess = function onSyncInitSuccess() {} //帧同步 ; _proto.onLoad = function onLoad() { //将组件添加到 JNSyncFrame this._nId = this.getSync().nSyncID(); this.getSync().addSyncActor(this); this.onSyncLoad(); } //解析 ; _proto.decoder = function decoder(bytes) { return JSON.parse(new TextDecoder().decode(bytes)); } //编码 ; _proto.encoder = function encoder(input) { return new TextEncoder().encode(JSON.stringify(input)); }; _proto.JTween = function JTween(data) { return new JNFrameTween(data, this.node); } //销毁 ; _proto.onDestroy = function onDestroy() { this.getSync().delSyncActor(this); }; _createClass(JNSyncFrameComponent, [{ key: "input", get: function get() { if (!this._input) { //初始化一个输入 this._input = {}; } return this._input; } }, { key: "nId", get: function get() { return this._nId; } }]); return JNSyncFrameComponent; }(Component); cclegacy._RF.pop(); cclegacy._RF.push({}, "b64dbKTho9J9aj21aGu9sfD", "JNSyncFrameProtoComponent", undefined); var JNSyncFrameProtoComponent = /*#__PURE__*/function (_JNSyncFrameComponent) { _inheritsLoose(JNSyncFrameProtoComponent, _JNSyncFrameComponent); function JNSyncFrameProtoComponent() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNSyncFrameComponent.call.apply(_JNSyncFrameComponent, [this].concat(args)) || this; _this.TYPE = void 0; return _this; } var _proto = JNSyncFrameProtoComponent.prototype; _proto.onLoad = function onLoad() { console.log("this.getClassName()", this.getClassName()); if (this.getClassName()) { this.TYPE = NGameMessage.getIns().getType(this.getClassName()); } _JNSyncFrameComponent.prototype.onLoad.call(this); }; _proto.getClassName = function getClassName() { return null; }; //解析 _proto.decoder = function decoder(bytes) { if (this.TYPE) { return this.TYPE.decode(bytes); } else { return {}; } } //编码 ; _proto.encoder = function encoder(input) { return this.TYPE.encode(input).finish(); }; return JNSyncFrameProtoComponent; }(JNSyncFrameComponent); cclegacy._RF.pop(); cclegacy._RF.push({}, "1dcadbI3X5NMK09LZjh6fSN", "JNComponent", undefined); //重写UI Base var JNGLayerBase = /*#__PURE__*/function (_JNLayerBase) { _inheritsLoose(JNGLayerBase, _JNLayerBase); function JNGLayerBase() { return _JNLayerBase.apply(this, arguments) || this; } var _proto = JNGLayerBase.prototype; _proto.close = function close() { console.log("close"); app.layer.CloseNode(this.node); }; return JNGLayerBase; }(JNLayerBase); //重写Sync Base var JNGSyncBase = /*#__PURE__*/function (_JNSyncFrameComponent) { _inheritsLoose(JNGSyncBase, _JNSyncFrameComponent); function JNGSyncBase() { return _JNSyncFrameComponent.apply(this, arguments) || this; } var _proto2 = JNGSyncBase.prototype; _proto2.onSyncLoad = function onSyncLoad() {}; _proto2.onSyncUpdate = function onSyncUpdate(dt, frame, input) {}; _proto2.getSync = function getSync() { return app.sync; }; return JNGSyncBase; }(JNSyncFrameComponent); //重写Sync Proto Base var JNGSyncProtoBase = /*#__PURE__*/function (_JNSyncFrameProtoComp) { _inheritsLoose(JNGSyncProtoBase, _JNSyncFrameProtoComp); function JNGSyncProtoBase() { return _JNSyncFrameProtoComp.apply(this, arguments) || this; } var _proto3 = JNGSyncProtoBase.prototype; _proto3.onSyncLoad = function onSyncLoad() {}; _proto3.onSyncUpdate = function onSyncUpdate(dt, frame, input) {}; _proto3.getSync = function getSync() { return app.sync; }; return JNGSyncProtoBase; }(JNSyncFrameProtoComponent); cclegacy._RF.pop(); cclegacy._RF.push({}, "465ebGO6ExMv5MPlJDF9RUQ", "GObject", undefined); var GTowards = /*#__PURE__*/function (GTowards) { GTowards[GTowards["RIGHT"] = 0] = "RIGHT"; GTowards[GTowards["LEFT"] = 1] = "LEFT"; return GTowards; }({}); var GObject = /*#__PURE__*/function (_JNGSyncProtoBase) { _inheritsLoose(GObject, _JNGSyncProtoBase); function GObject() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGSyncProtoBase.call.apply(_JNGSyncProtoBase, [this].concat(args)) || this; //当前模式 _this._mode = void 0; //是否镜像 _this._isMirror = false; return _this; } //设置镜像 GObject.SetMirror = function SetMirror(role, flipX, flipY) { if (flipX === void 0) { flipX = true; } if (flipY === void 0) { flipY = false; } var node = role.node; node.setScale(flipX ? -Math.abs(node.scale.x) : Math.abs(node.scale.x), flipY ? -Math.abs(node.scale.y) : Math.abs(node.scale.y)); } //获取v2世界坐标 ; var _proto = GObject.prototype; //向后添加距离 _proto.getWorldBackLen = function getWorldBackLen(add) { if (this.isMirror) { return this.v2World.add(add); } else { add.y = 0 - add.y; return this.v2World.subtract(add); } } //设置朝向 ; _proto.setTowards = function setTowards(towards) { if (towards == GTowards.LEFT) { this.isMirror = true; } else { this.isMirror = false; } } //镜像值处理 ; _proto.getMirrorValue = function getMirrorValue(value) { if (this.isMirror) { return value * -1; } else { return value; } }; _createClass(GObject, [{ key: "isMirror", get: function get() { return this._isMirror; }, set: function set(value) { if (value) { GObject.SetMirror(this); } else { GObject.SetMirror(this, false); } this._isMirror = value; } }, { key: "mode", get: function get() { return this._mode; }, set: function set(value) { this._mode = value; } }, { key: "v2World", get: function get() { var world = this.node.worldPosition; return v2(world.x, world.y); } }]); return GObject; }(JNGSyncProtoBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "4ec90lxNMhHRrDGry2/sj7E", "GBaseMode", undefined); var GBaseMode = /*#__PURE__*/function (_GObject) { _inheritsLoose(GBaseMode, _GObject); function GBaseMode() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GObject.call.apply(_GObject, [this].concat(args)) || this; //场景相机 _this.camera = void 0; //模式数据 _this.data = void 0; return _this; } var _proto = GBaseMode.prototype; //添加对象到场景中 _proto.addGObject = function addGObject(obj, pos) { obj.mode = this; this.scene.addChild(obj.node); if (pos) { obj.node.setWorldPosition(v3(pos.x, pos.y, 0)); } } //添加Node到场景中 ; _proto.addGNode = function addGNode(obj, pos) { this.scene.addChild(obj); if (pos) { obj.setWorldPosition(v3(pos.x, pos.y, 0)); } } //结束场景 ; _proto.Close = function Close() { GBattleModeManager.getIns().Close(); }; _proto.onSyncUpdate = function onSyncUpdate(dt, frame, input) { //重置 场景中的层级 [].concat(this.scene.children).sort(function (node1, node2) { return node2.worldPosition.y - node1.worldPosition.y; }).forEach(function (node, index) { node.setSiblingIndex(index); }); }; _createClass(GBaseMode, [{ key: "scene", get: function get() { return this.node; } }]); return GBaseMode; }(GObject); cclegacy._RF.pop(); cclegacy._RF.push({}, "9e451PIj11Pt6IQEG1Q1KfG", "GBattleModeManager", undefined); var BattleMode = /*#__PURE__*/function (BattleMode) { BattleMode[BattleMode["OnHook"] = 0] = "OnHook"; BattleMode[BattleMode["PVP"] = 1] = "PVP"; return BattleMode; }({}); //全局战斗模式管理器 var GBattleModeManager = /*#__PURE__*/function (_Singleton) { _inheritsLoose(GBattleModeManager, _Singleton); function GBattleModeManager() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Singleton.call.apply(_Singleton, [this].concat(args)) || this; //模式预制体 _this.modes = []; //场景相机 _this.camera = void 0; //世界场景Root _this.root = void 0; //是否初始化 _this.isInit = false; //当前模式 _this.current = null; //是否自动退帧 _this.isAuto = false; //自动推帧间隔 _this.autoTime = 0; //默认模式 _this["default"] = BattleMode.OnHook; //默认无限模式 //当前帧不切换模式 _this.frameNoSwitch = false; //模式数据 _this.data = void 0; return _this; } var _proto = GBattleModeManager.prototype; //初始化管理器 _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(info) { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: this.modes = info.modes || []; this.camera = info.camera; this.root = info.root; //监听帧同步 世界创建逻辑 app.event.on(JNSyncFrameEvent.CLEAR, this.clear, this); app.event.on(JNSyncFrameEvent.CREATE, this.create, this); this.isInit = true; case 6: case "end": return _context.stop(); } }, _callee, this); })); function onInit(_x) { return _onInit.apply(this, arguments); } return onInit; }() //打开指定模式 ; _proto.Open = /*#__PURE__*/function () { var _Open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(mode, isAuto, data) { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (mode === void 0) { mode = null; } if (isAuto === void 0) { isAuto = false; } if (data === void 0) { data = this.data; } this.data = data; if (!(!this.current && mode == null)) { _context2.next = 10; break; } _context2.next = 7; return this.Open(this["default"], true, data); case 7: return _context2.abrupt("return"); case 10: if (!(mode == null)) { _context2.next = 12; break; } return _context2.abrupt("return"); case 12: this.current = mode; this.setAuto(isAuto); app.sync.onReset(); app.sync.onStart(); case 16: case "end": return _context2.stop(); } }, _callee2, this); })); function Open(_x2, _x3, _x4) { return _Open.apply(this, arguments); } return Open; }() //关闭当前模式 ; _proto.Close = /*#__PURE__*/function () { var _Close = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: //主动调用场景销毁 app.sync.onReset(); this.current = null; this.frameNoSwitch = true; case 3: case "end": return _context3.stop(); } }, _callee3, this); })); function Close() { return _Close.apply(this, arguments); } return Close; }() //设置自动推帧 ( 帧不由addFrame控制 管理器自动推帧) ; _proto.setAuto = function setAuto(is) { this.isAuto = is; this.autoTime = 0; } //清除当前模式 ; _proto.clear = function clear() { if (!this.isInit) return; this.root.destroyAllChildren(); } //创建当前模式 ; _proto.create = function create() { if (!this.isInit || this.current == null) return; var mode = instantiate(this.modes[this.current]); mode.getComponent(GBaseMode).camera = this.camera; mode.getComponent(GBaseMode).data = this.data; this.root.addChild(mode); } //向场景推帧 ; _proto.addFrame = function addFrame(info) { if (this.isAuto) return; //如果是自动推帧则返回 app.sync.addFrame(info, true); } //管理器更新 ; _proto.onUpdate = function onUpdate(dt) { //更新帧同步 app.sync.update(dt); //自动推帧 this.onAutoFrame(dt); //如果当前模式是空则默认模式 if (this.current == null && !this.frameNoSwitch) { this.Open(); } this.frameNoSwitch = false; } //自动推帧 ; _proto.onAutoFrame = function onAutoFrame(dt) { if (!this.isAuto) return; this.autoTime += dt * 1000; //获取当前帧同步的帧数推空帧 if (app.sync.nSyncTime < this.autoTime) { //如果事件够则推帧 this.autoTime -= app.sync.nSyncTime; app.sync.addFrame({ index: app.sync.nLocalFrame + 1 }); } }; return GBattleModeManager; }(Singleton); cclegacy._RF.pop(); var _UISystemConfig, _UIMainConfig, _UINoviceConfig, _UIGModeConfig, _extends2; cclegacy._RF.push({}, "08b7e3BKnhOJp3kLeQaOsG9", "UIConfig", undefined); var GLayer = /*#__PURE__*/function (GLayer) { GLayer["View"] = "View"; GLayer["Popup"] = "Popup"; GLayer["Tips"] = "Tips"; return GLayer; }({}); var GUI = /*#__PURE__*/function (GUI) { GUI["Login"] = "Login"; GUI["Loading"] = "Loading"; GUI["Tips"] = "Tips"; GUI["SelectionBox"] = "SelectionBox"; GUI["NoviceNamingView"] = "NoviceNamingView"; GUI["NoviceSelectPetView"] = "NoviceSelectPetView"; GUI["MainChat"] = "MainChat"; GUI["IntoBattleView"] = "IntoBattleView"; GUI["PVPModeMatchView"] = "PVPModeMatchView"; GUI["Home"] = "Home"; GUI["Main"] = "Main"; return GUI; }({}); //主页面2 //常用动画 var BackOutScale = { front: JNLayerAnim.BackOutOpen, back: JNLayerAnim.BackInClose }; //系统UI var UISystemConfig = (_UISystemConfig = {}, _UISystemConfig[GUI.Tips] = { layer: GLayer.Tips, uri: "prefab/ui/系统页面/提示/TipsView", anims: BackOutScale }, _UISystemConfig[GUI.SelectionBox] = { layer: GLayer.Tips, uri: "prefab/ui/系统页面/选择提示/SelectionBox", anims: BackOutScale }, _UISystemConfig[GUI.Login] = { layer: GLayer.Popup, uri: "prefab/ui/系统页面/LoginView", anims: BackOutScale }, _UISystemConfig[GUI.Loading] = { layer: GLayer.View, uri: "prefab/ui/加载页面/LoadingView", anims: { back: JNLayerAnim.Smaller, backInfo: { key: "position", start: v3(0, 0, 0), end: v3(-720, 0, 0) } } }, _UISystemConfig); //主页UI var UIMainConfig = (_UIMainConfig = {}, _UIMainConfig[GUI.MainChat] = { layer: GLayer.Popup, uri: "prefab/ui/主页/聊天/MainChatView", anims: { front: JNLayerAnim.Enlarge, back: JNLayerAnim.Smaller, frontInfo: { key: "position", start: v3(0, -1280, 0), end: v3(0, 0, 0) }, backInfo: { key: "position", start: v3(0, 0, 0), end: v3(0, -1280, 0) } } }, _UIMainConfig[GUI.IntoBattleView] = { layer: GLayer.Popup, uri: "prefab/ui/阵法/阵法选择页面", anims: BackOutScale }, _UIMainConfig); //新手引导页面 var UINoviceConfig = (_UINoviceConfig = {}, _UINoviceConfig[GUI.NoviceNamingView] = { layer: GLayer.Popup, uri: "prefab/ui/新手引导页面/NoviceNamingView", anims: BackOutScale }, _UINoviceConfig[GUI.NoviceSelectPetView] = { layer: GLayer.Popup, uri: "prefab/ui/新手引导页面/NoviceSelectPetView", anims: BackOutScale }, _UINoviceConfig); //游戏模式页面 var UIGModeConfig = (_UIGModeConfig = {}, _UIGModeConfig[GUI.PVPModeMatchView] = { layer: GLayer.Popup, uri: "prefab/ui/模式/PVP/PVP匹配页面", anims: BackOutScale }, _UIGModeConfig); var UIConfig = _extends((_extends2 = {}, _extends2[GUI.Home] = { layer: GLayer.View, uri: "prefab/ui/主页/HomeView", anims: { front: JNLayerAnim.Enlarge, back: JNLayerAnim.Smaller, frontInfo: { key: "position", start: v3(720, 0, 0), end: v3(0, 0, 0) }, backInfo: { key: "position", start: v3(0, 0, 0), end: v3(-720, 0, 0) } } }, _extends2[GUI.Main] = { layer: GLayer.View, uri: "prefab/ui/主页/MainView", anims: { front: JNLayerAnim.Enlarge, back: JNLayerAnim.Smaller, frontInfo: { key: "position", start: v3(720, 0, 0), end: v3(0, 0, 0) }, backInfo: { key: "position", start: v3(0, 0, 0), end: v3(-720, 0, 0) } } }, _extends2), UISystemConfig, UINoviceConfig, UIMainConfig, UIGModeConfig); cclegacy._RF.pop(); cclegacy._RF.push({}, "6a51fjqlUJAq5TKjkfOS8Pc", "JLoaderSystem", undefined); //加载指定包 var JLoaderSystem = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(JLoaderSystem, _SystemBase); function JLoaderSystem(bundle) { var _this; _this = _SystemBase.call(this) || this; _this.bundle = void 0; _this.bundleName = void 0; _this.bundleName = bundle; return _this; } var _proto = JLoaderSystem.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return loader$1.getBundle(this.bundleName); case 2: this.bundle = _context.sent; case 3: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }(); _proto.get = function get() { return this.bundle; }; return JLoaderSystem; }(SystemBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "3c8c0jzEGpMr5OzvpGA9gsn", "Loading", undefined); //加载类 用于 显示加载信息 var Loading = /*#__PURE__*/function () { function Loading(loadings) { this.loadings = {}; this.current = void 0; Object.values(loadings).forEach(function (info) { info.isLoadingSuccess = false; }); this.loadings = loadings; } //设置当前加载内容 var _proto = Loading.prototype; _proto.setCurrent = function setCurrent(key) { this.current = key; } //指定加载完成 ; _proto.ok = function ok(key) { this.loadings[key].isLoadingSuccess = true; } //返回当前加载内容 ; _proto.getCurrentInfo = function getCurrentInfo() { return this.loadings[this.current]; } //返回进度 ; _proto.progress = function progress() { var infos = Object.values(this.loadings); var ok = 0; for (var index = 0; index < infos.length; index++) { if (infos[index].isLoadingSuccess) { ok += 1; } } return ok / infos.length; } //是否全部加载完成 ; _proto.isAllSuccess = function isAllSuccess() { var infos = Object.values(this.loadings); for (var index = 0; index < infos.length; index++) { if (!infos[index].isLoadingSuccess) return false; } return true; }; return Loading; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "a7027bx4hhCfLqWeREzNBNj", "GAction", undefined); var GAction = /*#__PURE__*/function (GAction) { GAction[GAction["TOKEN_EXPIRED"] = 1001] = "TOKEN_EXPIRED"; GAction[GAction["CHAT_MESSAGE"] = 2001] = "CHAT_MESSAGE"; GAction[GAction["CHAT_RECEIVE_MESSAGE"] = 2002] = "CHAT_RECEIVE_MESSAGE"; GAction[GAction["S_MODE_PVP_JOIN"] = 3001] = "S_MODE_PVP_JOIN"; GAction[GAction["S_MODE_PVP_LEAVE"] = 3002] = "S_MODE_PVP_LEAVE"; GAction[GAction["C_MODE_PVP_WAIT"] = 3003] = "C_MODE_PVP_WAIT"; GAction[GAction["C_MODE_PVP_START"] = 3004] = "C_MODE_PVP_START"; GAction[GAction["C_MODE_PVP_END"] = 3005] = "C_MODE_PVP_END"; GAction[GAction["C_MODE_PVP_START_WAIT"] = 3006] = "C_MODE_PVP_START_WAIT"; GAction[GAction["C_MODE_PVP_END_WAIT"] = 3007] = "C_MODE_PVP_END_WAIT"; GAction[GAction["C_MODE_PVP_MESSAGE"] = 3008] = "C_MODE_PVP_MESSAGE"; return GAction; }({}); //PVP 消息通知 cclegacy._RF.pop(); cclegacy._RF.push({}, "d784f7OGolErZEZKbllkSx9", "GData", undefined); //UI 动画 var UIPetAnim = /*#__PURE__*/function (UIPetAnim) { UIPetAnim["std"] = "std"; return UIPetAnim; }({}); //存储Key var StorageEnum = /*#__PURE__*/function (StorageEnum) { StorageEnum["Token"] = "Storage_Token"; return StorageEnum; }({}); // Token var StorageData = /*#__PURE__*/function () { function StorageData() {} StorageData.get = function get(key) { return sys.localStorage.getItem(key); }; StorageData.set = function set(key, value) { sys.localStorage.setItem(key, value); }; StorageData.delect = function delect(key) { sys.localStorage.removeItem(key); }; return StorageData; }(); var GData = function GData() {}; //层级 GData.layer = { World: 1 }; //世界画布节点 GData.WorldCanvas = void 0; cclegacy._RF.pop(); cclegacy._RF.push({}, "d3e60dltMpMY53YIL79ZYRX", "GActionType", undefined); var GActionType = /*#__PURE__*/function (GActionType) { GActionType["GUIChatMessage"] = "GUIChatMessage"; GActionType["GOnHookPet"] = "GOnHookPet"; GActionType["GOnHookPets"] = "GOnHookPets"; GActionType["GPVPStart"] = "GPVPStart"; GActionType["GPVPText"] = "GPVPText"; return GActionType; }({}); //PVP 提示 cclegacy._RF.pop(); cclegacy._RF.push({}, "3caceebNrVP1Kz6iKSyEOOr", "BaseData", undefined); //数据基类 var BaseData = /*#__PURE__*/function (_Singleton) { _inheritsLoose(BaseData, _Singleton); function BaseData() { return _Singleton.apply(this, arguments) || this; } return BaseData; }(Singleton); cclegacy._RF.pop(); cclegacy._RF.push({}, "37e2ca9UHJDH6nE7H/aU7Qf", "ChatData", undefined); //聊天数据 var ChatData = /*#__PURE__*/function (_BaseData) { _inheritsLoose(ChatData, _BaseData); function ChatData() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BaseData.call.apply(_BaseData, [this].concat(args)) || this; //世界消息列表 _this.datas = []; return _this; } var _proto = ChatData.prototype; _proto.onInit = function onInit() { //监听聊天消息 app.socket.on(GAction.CHAT_RECEIVE_MESSAGE, this.onChatReceiveMessage, this, GActionType.GUIChatMessage); } //接受聊天消息 ; _proto.onChatReceiveMessage = function onChatReceiveMessage(info) { console.log("ChatData - onChatReceiveMessage", info.message); this.datas.push(info.message); app.event.emit(ChatData.Event, info); } //发送消息 ; _proto.onSend = function onSend(message) { app.socket.Send(GAction.CHAT_MESSAGE, message, GActionType.GUIChatMessage); } //监听接受消息 ; _proto.on = function on(receive, target) { app.event.on(ChatData.Event, receive, target); } //取消 ; _proto.off = function off(receive, target) { app.event.off(ChatData.Event, receive, target); }; return ChatData; }(BaseData); ChatData.Event = "ChatData_Event_Message"; cclegacy._RF.pop(); cclegacy._RF.push({}, "7d3c7X0N/1ACbqrH8wkMLc5", "ResourceData", undefined); var ResourceEvent = /*#__PURE__*/function (ResourceEvent) { ResourceEvent["UPDATE"] = "ResourceEvent_UPDATE"; return ResourceEvent; }({}); //刷新资源 //资源类型 var ResourceType = /*#__PURE__*/function (ResourceType) { ResourceType[ResourceType["Gold"] = 90001] = "Gold"; return ResourceType; }({}); //金币 //玩家资源数据 var ResourceData = /*#__PURE__*/function (_BaseData) { _inheritsLoose(ResourceData, _BaseData); function ResourceData() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BaseData.call.apply(_BaseData, [this].concat(args)) || this; //资源数据 {资源Id:资源数量} _this.data = {}; return _this; } var _proto = ResourceData.prototype; //初始化 _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return this.onUpdateResource(); case 2: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }() //更新玩家资源 ; _proto.onUpdateResource = /*#__PURE__*/function () { var _onUpdateResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { var _this2 = this; var res; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return API.GetPlayerResource(); case 2: res = _context2.sent; //保存资源数量 res.forEach(function (data) { _this2.data[data.resourceTbId] = data.resourceValue; }); case 4: case "end": return _context2.stop(); } }, _callee2); })); function onUpdateResource() { return _onUpdateResource.apply(this, arguments); } return onUpdateResource; }() //获取指定资源的数量 ; _proto.getValue = function getValue(type) { return this.data[type] || 0; } //刷新返回资源 ; _proto.onUpdateOV = function onUpdateOV(operation, resource) { if (operation == 0) { //更新资源 this.data[resource.resourceTbId] = resource.resourceValue; } app.event.emit(ResourceEvent.UPDATE); }; return ResourceData; }(BaseData); cclegacy._RF.pop(); cclegacy._RF.push({}, "503f2CGLEhHDJDgmOksXdNU", "API", undefined); //接受到JSON消息 var RData = function RData(data, isTips) { if (isTips === void 0) { isTips = true; } if (data.data.state == 200) { //如果有 Resource 字段 表示要刷新资源 if (data.data['resources']) { //刷新资源 data.data['resources'].forEach(function (res) { ResourceData.getIns().onUpdateOV(res.operation, res.resource); }); } return data.data.data; } else { //弹出提示 if (isTips) { app.layer.Open(GUI.Tips, { text: data.data.msg }); } return data.data.data; } }; //接受到Protobuf var RProto = function RProto(data, type) { try { return app.proto.getType(type).decode(new Uint8Array(data.data)); ; } catch (_unused) { app.layer.Open(GUI.Tips, { text: "Protobuf 解析失败" }); } }; /************** 请求类 *******************/ //玩家登录返回 /************** 实体类 **************************/ //玩家信息 //游戏玩家信息 //玩家宠物信息 //玩家阵法信息 //玩家资源 var API = { UserRegister: function () { var _UserRegister = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.t0 = RData; _context.next = 3; return app.api.post("/user/register"); case 3: _context.t1 = _context.sent; return _context.abrupt("return", (0, _context.t0)(_context.t1)); case 5: case "end": return _context.stop(); } }, _callee); })); function UserRegister() { return _UserRegister.apply(this, arguments); } return UserRegister; }(), //玩家注册 UserLogin: function () { var _UserLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(account, password) { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.t0 = RData; _context2.next = 3; return app.api.post("/user/login", { userId: account, userPass: password }); case 3: _context2.t1 = _context2.sent; return _context2.abrupt("return", (0, _context2.t0)(_context2.t1)); case 5: case "end": return _context2.stop(); } }, _callee2); })); function UserLogin(_x, _x2) { return _UserLogin.apply(this, arguments); } return UserLogin; }(), //玩家登录 GetPlayerInfo: function () { var _GetPlayerInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.t0 = RData; _context3.next = 3; return app.api.get("/game/player/info"); case 3: _context3.t1 = _context3.sent; return _context3.abrupt("return", (0, _context3.t0)(_context3.t1, false)); case 5: case "end": return _context3.stop(); } }, _callee3); })); function GetPlayerInfo() { return _GetPlayerInfo.apply(this, arguments); } return GetPlayerInfo; }(), //获取玩家信息 /********** 新手引导接口 *****************/ SavePlayerInfo: function () { var _SavePlayerInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(playerName, novice) { return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: if (novice === void 0) { novice = true; } _context4.next = 3; return app.api.post("/game/player/info/save", { playerName: playerName, novice: novice }); case 3: return _context4.abrupt("return", _context4.sent.data); case 4: case "end": return _context4.stop(); } }, _callee4); })); function SavePlayerInfo(_x3, _x4) { return _SavePlayerInfo.apply(this, arguments); } return SavePlayerInfo; }(), //保存玩家信息 SelectNovicePet: function () { var _SelectNovicePet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(petId) { return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: _context5.t0 = RData; _context5.next = 3; return app.api.post("/game/novice/select/" + petId); case 3: _context5.t1 = _context5.sent; return _context5.abrupt("return", (0, _context5.t0)(_context5.t1, true)); case 5: case "end": return _context5.stop(); } }, _callee5); })); function SelectNovicePet(_x5) { return _SelectNovicePet.apply(this, arguments); } return SelectNovicePet; }(), //选择新手引导宠物 /********** 宠物接口 ******************/ GetPlayerPets: function () { var _GetPlayerPets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() { return _regeneratorRuntime().wrap(function _callee6$(_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: _context6.t0 = RData; _context6.next = 3; return app.api.get("/game/pet/list"); case 3: _context6.t1 = _context6.sent; return _context6.abrupt("return", (0, _context6.t0)(_context6.t1, false)); case 5: case "end": return _context6.stop(); } }, _callee6); })); function GetPlayerPets() { return _GetPlayerPets.apply(this, arguments); } return GetPlayerPets; }(), //获取玩家全部宠物 /********** 阵法接口 ******************/ GetPlayerTactical: function () { var _GetPlayerTactical = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() { return _regeneratorRuntime().wrap(function _callee7$(_context7) { while (1) switch (_context7.prev = _context7.next) { case 0: _context7.t0 = RData; _context7.next = 3; return app.api.get("/game/tactical/get"); case 3: _context7.t1 = _context7.sent; return _context7.abrupt("return", (0, _context7.t0)(_context7.t1, false)); case 5: case "end": return _context7.stop(); } }, _callee7); })); function GetPlayerTactical() { return _GetPlayerTactical.apply(this, arguments); } return GetPlayerTactical; }(), //获取玩家阵法 SetPlayerTactical: function () { var _SetPlayerTactical = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(data) { return _regeneratorRuntime().wrap(function _callee8$(_context8) { while (1) switch (_context8.prev = _context8.next) { case 0: _context8.t0 = RData; _context8.next = 3; return app.api.post("/game/tactical/set", data); case 3: _context8.t1 = _context8.sent; return _context8.abrupt("return", (0, _context8.t0)(_context8.t1, false)); case 5: case "end": return _context8.stop(); } }, _callee8); })); function SetPlayerTactical(_x6) { return _SetPlayerTactical.apply(this, arguments); } return SetPlayerTactical; }(), //更新玩家阵法 /********** 资源接口 ******************/ GetPlayerResource: function () { var _GetPlayerResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() { return _regeneratorRuntime().wrap(function _callee9$(_context9) { while (1) switch (_context9.prev = _context9.next) { case 0: _context9.t0 = RData; _context9.next = 3; return app.api.get("/game/resource/get"); case 3: _context9.t1 = _context9.sent; return _context9.abrupt("return", (0, _context9.t0)(_context9.t1, false)); case 5: case "end": return _context9.stop(); } }, _callee9); })); function GetPlayerResource() { return _GetPlayerResource.apply(this, arguments); } return GetPlayerResource; }() //获取玩家资源 }; cclegacy._RF.pop(); cclegacy._RF.push({}, "58cb2vhEnlAXoyJF6NcoM1t", "PlayerData", undefined); //玩家数据 var PlayerData = /*#__PURE__*/function (_BaseData) { _inheritsLoose(PlayerData, _BaseData); function PlayerData() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BaseData.call.apply(_BaseData, [this].concat(args)) || this; _this.data = void 0; return _this; } var _proto = PlayerData.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.t0 = console; _context.next = 3; return API.GetPlayerInfo(); case 3: _context.t1 = _context.sent; _context.t0.log.call(_context.t0, "PlayerData", _context.t1); _context.next = 7; return API.GetPlayerInfo(); case 7: this.data = _context.sent; case 8: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }() //获取玩家信息 ; _proto.getInfo = function getInfo() { return this.data; }; return PlayerData; }(BaseData); cclegacy._RF.pop(); cclegacy._RF.push({}, "405fdElK6FItbwVf24UVpJx", "PlayerPetData", undefined); //玩家宠物数据 var PlayerPetData = /*#__PURE__*/function (_BaseData) { _inheritsLoose(PlayerPetData, _BaseData); function PlayerPetData() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BaseData.call.apply(_BaseData, [this].concat(args)) || this; //玩家宠物列表 _this.datas = []; return _this; } var _proto = PlayerPetData.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return this.UpdatePlayerPet(); case 2: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }() //获取全部宠物 ; _proto.getData = function getData() { return this.datas; } //更新玩家宠物 ; _proto.UpdatePlayerPet = /*#__PURE__*/function () { var _UpdatePlayerPet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return API.GetPlayerPets(); case 2: this.datas = _context2.sent; case 3: case "end": return _context2.stop(); } }, _callee2, this); })); function UpdatePlayerPet() { return _UpdatePlayerPet.apply(this, arguments); } return UpdatePlayerPet; }() //选择宠物 ; _proto.SelectNovicePet = /*#__PURE__*/function () { var _SelectNovicePet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(petId) { return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return API.SelectNovicePet(petId); case 2: _context3.next = 4; return this.UpdatePlayerPet(); case 4: case "end": return _context3.stop(); } }, _callee3, this); })); function SelectNovicePet(_x) { return _SelectNovicePet.apply(this, arguments); } return SelectNovicePet; }() //通过宠物Id找到宠物 ; _proto.petIdQueryPetInfo = function petIdQueryPetInfo(petId) { return this.datas.filter(function (item) { return item.petId == petId; })[0]; } //添加宠物 ; _proto.addPet = function addPet(pet) { this.datas.push(pet); }; return PlayerPetData; }(BaseData); cclegacy._RF.pop(); cclegacy._RF.push({}, "d2425NSrdZGGqsgMlFc+ese", "PlayerTacticalData", undefined); var PlayerTacticalEvent = /*#__PURE__*/function (PlayerTacticalEvent) { PlayerTacticalEvent["UPDATE_TACTICAL"] = "PlayerTacticalEvent_UPDATE_TACTICAL"; return PlayerTacticalEvent; }({}); //玩家阵法数据 (玩家最多上阵 9 个宠物) var PlayerTacticalData = /*#__PURE__*/function (_BaseData) { _inheritsLoose(PlayerTacticalData, _BaseData); function PlayerTacticalData() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BaseData.call.apply(_BaseData, [this].concat(args)) || this; //阵法信息 _this.info = void 0; return _this; } var _proto = PlayerTacticalData.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return this.onUpdateInfo(); case 2: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }() //保存阵法信息 ; _proto.onSaveTacticalInfo = function onSaveTacticalInfo(ov) { if (!ov.tacticalData) { ov.tacticalData = JSON.stringify(this.getInitTacticalInfo()); } this.info = _extends({}, ov, { roles: JSON.parse(ov.tacticalData) }); //通知阵法信息已更新 app.event.emit(PlayerTacticalEvent.UPDATE_TACTICAL); } //更新阵法信息 ; _proto.onUpdateInfo = /*#__PURE__*/function () { var _onUpdateInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.t0 = this; _context2.next = 3; return API.GetPlayerTactical(); case 3: _context2.t1 = _context2.sent; _context2.t0.onSaveTacticalInfo.call(_context2.t0, _context2.t1); case 5: case "end": return _context2.stop(); } }, _callee2, this); })); function onUpdateInfo() { return _onUpdateInfo.apply(this, arguments); } return onUpdateInfo; }() //更新上阵 ; _proto.UpdateTactical = /*#__PURE__*/function () { var _UpdateTactical = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(roles) { return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: if (!(this.info.tacticalData == JSON.stringify(roles))) { _context3.next = 2; break; } return _context3.abrupt("return", false); case 2: this.info.roles = roles; this.info.tacticalData = JSON.stringify(this.info.roles); //上传到服务器 并且保存 _context3.t0 = this; _context3.next = 7; return API.SetPlayerTactical(this.info); case 7: _context3.t1 = _context3.sent; _context3.t0.onSaveTacticalInfo.call(_context3.t0, _context3.t1); return _context3.abrupt("return", true); case 10: case "end": return _context3.stop(); } }, _callee3, this); })); function UpdateTactical(_x) { return _UpdateTactical.apply(this, arguments); } return UpdateTactical; }() //修改指定位置的上阵 上阵下标,上阵的宠物Id ; _proto.UpdateIndexTactical = /*#__PURE__*/function () { var _UpdateIndexTactical = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(index, petId) { return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: this.info.roles[index] = petId; _context4.next = 3; return this.UpdateTactical(this.info.roles); case 3: case "end": return _context4.stop(); } }, _callee4, this); })); function UpdateIndexTactical(_x2, _x3) { return _UpdateIndexTactical.apply(this, arguments); } return UpdateIndexTactical; }() //获取指定位置 ; _proto.getItem = function getItem(index) { return this.info.roles[index]; } //获取初始化上阵信息 ; _proto.getInitTacticalInfo = function getInitTacticalInfo() { return [0, 0, 0, 0, 0, 0, 0, 0, 0]; }; _proto.getTacticalInfo = function getTacticalInfo() { return this.info.roles; }; return PlayerTacticalData; }(BaseData); cclegacy._RF.pop(); cclegacy._RF.push({}, "edb3b67abJKSaqoOzxTmI9G", "AppData", undefined); //数据类 (用于初始化游戏信息) var AppData = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(AppData, _SystemBase); function AppData() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _SystemBase.call.apply(_SystemBase, [this].concat(args)) || this; _this.loadings = [PlayerData.getIns(), //玩家信息 PlayerPetData.getIns(), //玩家宠物信息 ChatData.getIns(), //聊天 PlayerTacticalData.getIns(), //阵法 ResourceData.getIns() //玩家资源 ]; return _this; } var _proto = AppData.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var index, data; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: app.loading.setCurrent(AppData.loading); //初始化所有数据类 index = 0; case 2: if (!(index < this.loadings.length)) { _context.next = 9; break; } data = this.loadings[index]; _context.next = 6; return data.onInit(); case 6: index++; _context.next = 2; break; case 9: app.loading.ok(AppData.loading); case 10: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }(); return AppData; }(SystemBase); AppData.loading = "AppData"; cclegacy._RF.pop(); cclegacy._RF.push({}, "60bafZucVZCNIR76lIMHgzB", "BaseAction", undefined); var BaseAction = /*#__PURE__*/function (_Singleton) { _inheritsLoose(BaseAction, _Singleton); function BaseAction() { return _Singleton.apply(this, arguments) || this; } return BaseAction; }(Singleton); cclegacy._RF.pop(); cclegacy._RF.push({}, "20d83kR+8VA07lwtIq0pSm/", "PVPAction", undefined); var PVPAction = /*#__PURE__*/function (_BaseAction) { _inheritsLoose(PVPAction, _BaseAction); function PVPAction() { return _BaseAction.apply(this, arguments) || this; } var _proto = PVPAction.prototype; _proto.onInit = function onInit() { app.socket.on(GAction.C_MODE_PVP_START_WAIT, this.onModePVPStartWait, this); app.socket.on(GAction.C_MODE_PVP_END_WAIT, this.onModePVPEndWait, this); app.socket.on(GAction.C_MODE_PVP_START, this.onModePVPStart, this, GActionType.GPVPStart); app.socket.on(GAction.C_MODE_PVP_MESSAGE, this.onModePVPMessage, this, GActionType.GPVPText); } //PVP开始等待 ; _proto.onModePVPStartWait = function onModePVPStartWait() { //PVP 匹配页面 app.layer.Open(GUI.PVPModeMatchView); } //PVP结束等待 ; _proto.onModePVPEndWait = function onModePVPEndWait() { //PVP 匹配页面 app.layer.Close(GUI.PVPModeMatchView); } //开始PVP ; _proto.onModePVPStart = function onModePVPStart(info) { console.log("开始PVP", info); GBattleModeManager.getIns().Open(BattleMode.PVP, true, info); } //提示 ; _proto.onModePVPMessage = function onModePVPMessage(info) { console.log("提示PVP", info); app.layer.Open(GUI.Tips, { text: info.text }); }; return PVPAction; }(BaseAction); cclegacy._RF.pop(); cclegacy._RF.push({}, "b1127AuCcBApoiH6nlxlUiO", "AppAction", undefined); var AppAction = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(AppAction, _SystemBase); function AppAction() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _SystemBase.call.apply(_SystemBase, [this].concat(args)) || this; _this.loadings = [PVPAction.getIns() //PVP Action ]; return _this; } var _proto = AppAction.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var index, data; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: index = 0; case 1: if (!(index < this.loadings.length)) { _context.next = 8; break; } data = this.loadings[index]; _context.next = 5; return data.onInit(); case 5: index++; _context.next = 1; break; case 8: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }(); return AppAction; }(SystemBase); cclegacy._RF.pop(); var _Loading; cclegacy._RF.push({}, "5731aetpcVDX4ch210LIxqv", "App", undefined); // let APIPath = `http://localhost:8080` // let WsPath = `ws://localhost:8080/websocket` var APIPath = "http://192.168.0.174:8080"; var WsPath = "ws://192.168.0.174:8080/websocket"; // let APIPath = `https://api.pet.jisol.cn` // let WsPath = `wss://api.pet.jisol.cn/websocket` //重写UI var JNGLayer = /*#__PURE__*/function (_JNLayer) { _inheritsLoose(JNGLayer, _JNLayer); function JNGLayer() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNLayer.call.apply(_JNLayer, [this].concat(args)) || this; _this.layers = [GLayer.View, GLayer.Popup, GLayer.Tips]; _this.views = UIConfig; return _this; } return JNGLayer; }(JNLayer); //重写Socket var JNGSocket = /*#__PURE__*/function (_JNSocket) { _inheritsLoose(JNGSocket, _JNSocket); function JNGSocket() { return _JNSocket.apply(this, arguments) || this; } var _proto = JNGSocket.prototype; _proto.onInit = /*#__PURE__*/function () { var _onInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: this.on(GAction.TOKEN_EXPIRED, this.onTokenExpired.bind(this)); _context.next = 3; return _JNSocket.prototype.onInit.call(this); case 3: case "end": return _context.stop(); } }, _callee, this); })); function onInit() { return _onInit.apply(this, arguments); } return onInit; }(); _proto.url = function url() { return new Promise(function (resolve) { //获取Token var token = StorageData.get(StorageEnum.Token); if (token) { resolve(WsPath + "/" + token); return; } var loginResolve = function loginResolve(token) { resolve(WsPath + "/" + token); }; //如果没有Token则弹出登入页面 app.layer.Open(GUI.Login, loginResolve); }); } //Token失效 ; _proto.onTokenExpired = function onTokenExpired() { console.log("onTokenExpired"); //清除Token StorageData.delect(StorageEnum.Token); }; return JNGSocket; }(JNSocket); // 重写帧同步 var JNGSyncFrame = /*#__PURE__*/function (_JNSyncFrame) { _inheritsLoose(JNGSyncFrame, _JNSyncFrame); function JNGSyncFrame() { return _JNSyncFrame.apply(this, arguments) || this; } var _proto2 = JNGSyncFrame.prototype; _proto2.onResetValue = function onResetValue() { //重置状态机 BehaviorManager.deleteInstance(); _JNSyncFrame.prototype.onResetValue.call(this); }; _proto2.onServerData = /*#__PURE__*/function () { var _onServerData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(start, end) { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.t0 = app.proto.getType(JNSyncMessage.JNFrameInfos); _context2.t1 = Uint8Array; _context2.next = 4; return app.api.get("/sync/frame", { responseType: 'arraybuffer', params: { start: start, end: end } }); case 4: _context2.t2 = _context2.sent.data; _context2.t3 = new _context2.t1(_context2.t2); return _context2.abrupt("return", _context2.t0.decode.call(_context2.t0, _context2.t3)); case 7: case "end": return _context2.stop(); } }, _callee2); })); function onServerData(_x, _x2) { return _onServerData.apply(this, arguments); } return onServerData; }(); _proto2.onSendInput = function onSendInput(message) { app.socket.Send(JNSyncAction.NSyncFrameInput, message, JNSyncMessage.JNFrameInputs); }; return JNGSyncFrame; }(JNSyncFrame); var TD = null; //读写config var JNGConfig = /*#__PURE__*/function (_SystemBase) { _inheritsLoose(JNGConfig, _SystemBase); function JNGConfig() { return _SystemBase.apply(this, arguments) || this; } var _proto3 = JNGConfig.prototype; _proto3.onInit = /*#__PURE__*/function () { var _onInit2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { var json2, _key2, load; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: app.loading.setCurrent(JNGConfig.loading); json2 = resources.getDirWithPath("config/json/", JsonAsset).map(function (info) { var args = info.path.split("/"); return { name: args[args.length - 1], bundle: "resources", path: "config/json/" }; }); _context3.t0 = _regeneratorRuntime().keys(json2); case 3: if ((_context3.t1 = _context3.t0()).done) { _context3.next = 10; break; } _key2 = _context3.t1.value; load = json2[_key2]; _context3.next = 8; return JsonUtil.load(load); case 8: _context3.next = 3; break; case 10: TD = new Tables(function (file) { return JsonUtil.get(file); }); console.log(TD); app.loading.ok(JNGConfig.loading); case 13: case "end": return _context3.stop(); } }, _callee3); })); function onInit() { return _onInit2.apply(this, arguments); } return onInit; }(); return JNGConfig; }(SystemBase); //资源初始器 JNGConfig.loading = "JNGConfig"; var JLoaderBattle = /*#__PURE__*/function (_JLoaderSystem) { _inheritsLoose(JLoaderBattle, _JLoaderSystem); function JLoaderBattle() { var _this2; for (var _len2 = arguments.length, args = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { args[_key3] = arguments[_key3]; } _this2 = _JLoaderSystem.call.apply(_JLoaderSystem, [this].concat(args)) || this; _this2.roleSpine = {}; //角色Spine _this2.roleResImage = {}; //角色战斗素材图片 _this2.roleResSpine = {}; //角色战斗素材Spine _this2.effects = {}; //Spine特效 _this2.maps = {}; return _this2; } var _proto4 = JLoaderBattle.prototype; //地图 _proto4.onInit = /*#__PURE__*/function () { var _onInit3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { var _this3 = this; var _loop, _iterator, _step, _loop2, _iterator2, _step2, _loop3, _iterator3, _step3; return _regeneratorRuntime().wrap(function _callee4$(_context7) { while (1) switch (_context7.prev = _context7.next) { case 0: app.loading.setCurrent(JLoaderBattle.loading); _context7.next = 3; return _JLoaderSystem.prototype.onInit.call(this); case 3: app.loading.ok(JLoaderBattle.loading); app.loading.setCurrent(JLoaderBattle.loadingInit); //将配置表的角色都读取出来 _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() { var info; return _regeneratorRuntime().wrap(function _loop$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: info = _step.value; _context4.next = 3; return new Promise(function (r) { _this3.bundle.load(info.spine, sp.SkeletonData, function (err, data) { r(data); }); }); case 3: _this3.roleSpine[info.id] = _context4.sent; case 4: case "end": return _context4.stop(); } }, _loop); }); _iterator = _createForOfIteratorHelperLoose(TD.TbGRole.getDataMap().values()); case 7: if ((_step = _iterator()).done) { _context7.next = 11; break; } return _context7.delegateYield(_loop(), "t0", 9); case 9: _context7.next = 7; break; case 11: _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() { var info; return _regeneratorRuntime().wrap(function _loop2$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: info = _step2.value; if (!(info.resType == "Spine")) { _context5.next = 7; break; } _context5.next = 4; return new Promise(function (r) { _this3.bundle.load(info.resSrc, sp.SkeletonData, function (err, data) { r(data); }); }); case 4: _this3.roleResSpine[info.id] = _context5.sent; _context5.next = 10; break; case 7: _context5.next = 9; return new Promise(function (r) { _this3.bundle.load(info.resSrc, SpriteFrame, function (err, data) { r(data); }); }); case 9: _this3.roleResImage[info.id] = _context5.sent; case 10: case "end": return _context5.stop(); } }, _loop2); }); _iterator2 = _createForOfIteratorHelperLoose(TD.TbGRoleBattleRes.getDataMap().values()); case 13: if ((_step2 = _iterator2()).done) { _context7.next = 17; break; } return _context7.delegateYield(_loop2(), "t1", 15); case 15: _context7.next = 13; break; case 17: _loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() { var info; return _regeneratorRuntime().wrap(function _loop3$(_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: info = _step3.value; _context6.next = 3; return Promise.all(["1", "2", "3"].map(function (index) { return "map" + index; }).map(function (key) { return new Promise(function (r) { if (info[key]) { _this3.bundle.load(info[key], SpriteFrame, function (err, data) { r(data); }); } }); })); case 3: _this3.maps[info.id] = _context6.sent; case 4: case "end": return _context6.stop(); } }, _loop3); }); _iterator3 = _createForOfIteratorHelperLoose(TD.TbGMap.getDataMap().values()); case 19: if ((_step3 = _iterator3()).done) { _context7.next = 23; break; } return _context7.delegateYield(_loop3(), "t2", 21); case 21: _context7.next = 19; break; case 23: app.loading.ok(JLoaderBattle.loadingInit); case 24: case "end": return _context7.stop(); } }, _callee4, this); })); function onInit() { return _onInit3.apply(this, arguments); } return onInit; }(); return JLoaderBattle; }(JLoaderSystem); JLoaderBattle.loading = "JLoaderBattle"; JLoaderBattle.loadingInit = "JLoaderBattle_Init"; var app = { layer: new JNGLayer(), //UI socket: new JNGSocket(), //Socket sync: new JNGSyncFrame(), //同步 event: EventDispatcher.getIns(), //通知 proto: NGameMessage.getIns(), //消息 api: JAPI.create({ baseURL: "" + APIPath }), //请求 // api : {}, //请求 battle: GBattleModeManager.getIns(), //战斗 config: new JNGConfig(), //配置文件 battleRes: new JLoaderBattle("battle"), //battle包 data: new AppData(), //游戏基础信息 action: new AppAction(), //游戏行为 loading: new Loading((_Loading = {}, _Loading[JNGConfig.loading] = { title: "加载配置文件" }, _Loading[JLoaderBattle.loading] = { title: "加载战斗资源" }, _Loading[JLoaderBattle.loadingInit] = { title: "初始化战斗资源" }, _Loading[AppData.loading] = { title: "初始化信息" }, _Loading)) }; app.api.addRequestInterceptors(function (config) { //设置Token config.headers["Token"] = StorageData.get(StorageEnum.Token); return true; }); cclegacy._RF.pop(); cclegacy._RF.push({}, "46f6f6rTlxAVJ3gEcOHPhcp", "JNGame", undefined); var Env = /*#__PURE__*/function (Env) { Env[Env["WEB"] = 0] = "WEB"; Env[Env["WX"] = 1] = "WX"; return Env; }({}); var JNGame = /*#__PURE__*/function () { function JNGame() {} JNGame.Init = /*#__PURE__*/function () { var _Init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) { var _i, _Object$values, value; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _i = 0, _Object$values = Object.values(data); case 1: if (!(_i < _Object$values.length)) { _context.next = 9; break; } value = _Object$values[_i]; if (!(value instanceof SystemBase)) { _context.next = 6; break; } _context.next = 6; return value.onInit(); case 6: _i++; _context.next = 1; break; case 9: case "end": return _context.stop(); } }, _callee); })); function Init(_x) { return _Init.apply(this, arguments); } return Init; }(); return JNGame; }(); JNGame.env = Env.WEB; cclegacy._RF.pop(); var _dec$p, _dec2$e, _dec3$6, _class$p, _class2$a, _descriptor$a, _descriptor2$5; cclegacy._RF.push({}, "1e0e1EfsZhOOZDlp+IFMryA", "Main", undefined); var ccclass$a = _decorator.ccclass, property$5 = _decorator.property; var Main = (_dec$p = ccclass$a('Main'), _dec2$e = property$5(Prefab), _dec3$6 = property$5(Prefab), _dec$p(_class$p = (_class2$a = /*#__PURE__*/function (_Component) { _inheritsLoose(Main, _Component); function Main() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "UIPrefab", _descriptor$a, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "WorldPrefab", _descriptor2$5, _assertThisInitialized(_this)); return _this; } var _proto = Main.prototype; _proto.onLoad = /*#__PURE__*/function () { var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: // 创建UI director.getScene().addChild(instantiate(this.UIPrefab)); //加载 APP _context.next = 3; return JNGame.Init(app); case 3: //发生帧同步开始 app.socket.Send(JNSyncAction.NSyncFrameStart); // 创建世界 director.getScene().addChild(instantiate(this.WorldPrefab)); case 5: case "end": return _context.stop(); } }, _callee, this); })); function onLoad() { return _onLoad.apply(this, arguments); } return onLoad; }(); return Main; }(Component), (_descriptor$a = _applyDecoratedDescriptor(_class2$a.prototype, "UIPrefab", [_dec2$e], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$5 = _applyDecoratedDescriptor(_class2$a.prototype, "WorldPrefab", [_dec3$6], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class2$a)) || _class$p); cclegacy._RF.pop(); var _dec$q, _dec2$f, _class$q, _class2$b, _descriptor$b; cclegacy._RF.push({}, "34651Y5HSBHQZzfE+T94QNV", "UICanvas", undefined); var ccclass$b = _decorator.ccclass, property$6 = _decorator.property; var UICanvas = (_dec$q = ccclass$b('UICanvas'), _dec2$f = property$6(Node), _dec$q(_class$q = (_class2$b = /*#__PURE__*/function (_Component) { _inheritsLoose(UICanvas, _Component); function UICanvas() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "root", _descriptor$b, _assertThisInitialized(_this)); return _this; } var _proto = UICanvas.prototype; _proto.onLoad = function onLoad() { //绑定层级 app.layer.bind(this.root); //显示Loading app.layer.Open(GUI.Loading); }; return UICanvas; }(Component), _descriptor$b = _applyDecoratedDescriptor(_class2$b.prototype, "root", [_dec2$f], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$b)) || _class$q); cclegacy._RF.pop(); var _dec$r, _dec2$g, _dec3$7, _dec4$5, _class$r, _class2$c, _descriptor$c, _descriptor2$6, _descriptor3$5; cclegacy._RF.push({}, "40653r5OQJPFZf7cTR6hCHX", "WorldCanvas", undefined); var ccclass$c = _decorator.ccclass, property$7 = _decorator.property; var WorldCanvas = (_dec$r = ccclass$c('WorldCanvas'), _dec2$g = property$7(Node), _dec3$7 = property$7(Camera), _dec4$5 = property$7([Prefab]), _dec$r(_class$r = (_class2$c = /*#__PURE__*/function (_Component) { _inheritsLoose(WorldCanvas, _Component); function WorldCanvas() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "root", _descriptor$c, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "camera", _descriptor2$6, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "modes", _descriptor3$5, _assertThisInitialized(_this)); _this.index = 1; return _this; } var _proto = WorldCanvas.prototype; _proto.onLoad = /*#__PURE__*/function () { var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: GData.WorldCanvas = this; //重置相机位置 this.camera.node.setWorldPosition(0, 0, 1000); //初始化游戏模式管理器 GBattleModeManager.getIns().onInit({ modes: this.modes, //模式 camera: this.camera, //相机 root: this.root //场景 }); case 3: case "end": return _context.stop(); } }, _callee, this); })); function onLoad() { return _onLoad.apply(this, arguments); } return onLoad; }(); _proto.update = function update(deltaTime) { GBattleModeManager.getIns().onUpdate(deltaTime); }; return WorldCanvas; }(Component), (_descriptor$c = _applyDecoratedDescriptor(_class2$c.prototype, "root", [_dec2$g], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$6 = _applyDecoratedDescriptor(_class2$c.prototype, "camera", [_dec3$7], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor3$5 = _applyDecoratedDescriptor(_class2$c.prototype, "modes", [_dec4$5], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } })), _class2$c)) || _class$r); cclegacy._RF.pop(); cclegacy._RF.push({}, "9504004sm5N6JfInh7IYIQ+", "GAttackNormal", undefined); //普通攻击 var GAttackNormal = /*#__PURE__*/function () { function GAttackNormal() {} var _proto = GAttackNormal.prototype; _proto.attack = function attack(role, info) { role.fsm.enemy.onHit(); }; return GAttackNormal; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "66564hubHtC8JAK1q8sBXha", "GButtleBase", undefined); //子弹基类 var GButtleBase = /*#__PURE__*/function (_GObject) { _inheritsLoose(GButtleBase, _GObject); function GButtleBase() { return _GObject.apply(this, arguments) || this; } var _proto = GButtleBase.prototype; _proto.setData = function setData(data) {}; return GButtleBase; }(GObject); cclegacy._RF.pop(); var _dec$s, _class$s; cclegacy._RF.push({}, "cf273RbsI9Il4oua+MJ6dB2", "GButtleDefault", undefined); var ccclass$d = _decorator.ccclass, property$8 = _decorator.property; //默认子弹类 var GButtleDefault = (_dec$s = ccclass$d("GButtleDefault"), _dec$s(_class$s = /*#__PURE__*/function (_GButtleBase) { _inheritsLoose(GButtleDefault, _GButtleBase); function GButtleDefault() { return _GButtleBase.apply(this, arguments) || this; } var _proto = GButtleDefault.prototype; _proto.setData = function setData(info) { this.node.layer = GData.layer.World; this.node.addComponent(Sprite).spriteFrame = info.image; this.node.scale = v3(info.scale, info.scale, 0); }; return GButtleDefault; }(GButtleBase)) || _class$s); cclegacy._RF.pop(); var _dec$t, _class$t; cclegacy._RF.push({}, "7bbd2ZLN+pAR5d5W2wmy3A0", "JNFrameSkeleton", undefined); var ccclass$e = _decorator.ccclass, property$9 = _decorator.property; var JNSkeleton = (_dec$t = ccclass$e('JNSkeleton'), _dec$t(_class$t = /*#__PURE__*/function (_sp$Skeleton) { _inheritsLoose(JNSkeleton, _sp$Skeleton); function JNSkeleton() { return _sp$Skeleton.apply(this, arguments) || this; } var _proto = JNSkeleton.prototype; _proto.onEnable = function onEnable() { UIRenderer.prototype.onEnable.bind(this)(); this._flushAssembler(); JNFrameSkeletonSystem.getInstance().add(this); }; _proto.onDisable = function onDisable() { UIRenderer.prototype.onDisable.bind(this)(); JNFrameSkeletonSystem.getInstance().remove(this); }; return JNSkeleton; }(sp.Skeleton)) || _class$t); cclegacy._RF.pop(); cclegacy._RF.push({}, "4ab3eCYAqFCdIwXvCrAj2Q7", "GNode", undefined); //Node 工具 var GNode = /*#__PURE__*/function () { function GNode() {} GNode.create = function create() { var mapNode = new Node(); mapNode.layer = GData.layer.World; return mapNode; }; return GNode; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "c0673NyN/lFOrQ5ESNLwtin", "GEffectUtil", undefined); var GEffectUtil = /*#__PURE__*/function () { function GEffectUtil() {} //创建一个Spine特效 GEffectUtil.create = function create(spine) { var effectNode = GNode.create(); effectNode.addComponent(UITransform); var ske = effectNode.addComponent(JNSkeleton); ske.skeletonData = spine; ske.premultipliedAlpha = false; return ske; } //创建只播放一次的Spine特效 ; GEffectUtil.createOne = function createOne(spine) { var ske = GEffectUtil.create(spine); ske.setCompleteListener(function () { ske.node.destroy(); }); return ske; }; return GEffectUtil; }(); cclegacy._RF.pop(); var _dec$u, _class$u, _descriptor$d; cclegacy._RF.push({}, "15e91RcTrhIXZnrbXCbOZHn", "GRoleBase", undefined); var ccclass$f = _decorator.ccclass, property$a = _decorator.property; var GRoleAnimEvent = /*#__PURE__*/function (GRoleAnimEvent) { GRoleAnimEvent["Attack"] = "attack"; return GRoleAnimEvent; }({}); //普通攻击 //角色基类 var GRoleBase = (_dec$u = property$a(JNSkeleton), (_class$u = /*#__PURE__*/function (_GObject) { _inheritsLoose(GRoleBase, _GObject); function GRoleBase() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GObject.call.apply(_GObject, [this].concat(args)) || this; _initializerDefineProperty(_this, "spine", _descriptor$d, _assertThisInitialized(_this)); //角色 _this.role = void 0; //状态机 _this.fsm = void 0; //动画状态机 _this.fsmAnim = void 0; //玩家攻击范围 _this.range = 100; //移动速度 _this.moveSpeed = 80; //血量 _this.blood = 100; _this.fullBlood = 100; //是否死亡 _this._isDie = false; //受击回调 _this.hitCallbacks = []; //攻击回调 _this.attackCallbacks = []; return _this; } var _proto = GRoleBase.prototype; //添加受击回调 _proto.addHitCallback = function addHitCallback(fun) { this.hitCallbacks.push(fun); }; //添加攻击回调 _proto.addAttackCallback = function addAttackCallback(fun) { this.attackCallbacks.push(fun); }; _proto.get = function get() { if (this.isDie) return null; return this; }; _proto.onSyncLoad = function onSyncLoad() { if (!this.spine) this.spine = this.node.getComponent(JNSkeleton); //如果没有生成则直接销毁 if (!this.spine) { this.node.destroy(); return; } //创建角色状态机 this.fsm = this.fsmCreate(); //创建角色动画状态机 this.fsmAnim = this.fsmAnimCreate(); } //初始化 ; _proto.init = function init(role) { if (this.spine) this.spine.skeletonData = app.battleRes.roleSpine[role.id]; } //创建一个状态机 ; _proto.onSyncUpdate = function onSyncUpdate(dt, frame, input) { //更新状态机 this.fsm && this.fsm.onUpdate(dt / 1000, frame); this.fsmAnim && this.fsmAnim.onUpdate(dt / 1000, frame); } //向目标点移动 ; _proto.onMoveTarget = function onMoveTarget(target, dt) { //获取两个坐标差值向量 var mins = this.v2World.subtract(target); var normal = this.v2World.subtract(target).normalize(); //设置朝向 if (normal.x != 0) { if (normal.x < 0) { this.setTowards(GTowards.RIGHT); } else { this.setTowards(GTowards.LEFT); } } if (Vec2.len(normal) >= Vec2.len(mins)) { this.node.setWorldPosition(Object.assign(v3(), target.clone())); return true; } else { //移动 this.node.worldPosition = this.node.worldPosition.subtract(v3(normal.x * dt * this.moveSpeed, normal.y * dt * this.moveSpeed, 0)); return false; } } //朝向目标 ; _proto.onTowardsTarget = function onTowardsTarget(role) { //获取两个坐标差值向量 var normal = this.v2World.subtract(role.v2World).normalize(); //设置朝向 if (normal.x != 0) { if (normal.x < 0) { this.setTowards(GTowards.RIGHT); } else { this.setTowards(GTowards.LEFT); } } } //受击 ; _proto.onHit = function onHit() { var _this2 = this; // return; this.blood -= 10; this.hitCallbacks.forEach(function (fun) { return fun(_this2, 10); }); //检测是否死亡 if (this.blood <= 0) { //关闭状态机 this.fsm.close(); //设置死亡 this.isDie = true; } }; _proto.onDebugHit = function onDebugHit() { this.blood -= 10; //检测是否死亡 if (this.blood <= 0) { //关闭状态机 this.fsm.close(); //设置死亡 this.isDie = true; } }; _createClass(GRoleBase, [{ key: "isDie", get: function get() { return this._isDie; }, set: function set(value) { this._isDie = value; if (this.isDie) { //如果死亡则关闭状态机 //关闭状态机 this.fsm.close(); } } }]); return GRoleBase; }(GObject), _descriptor$d = _applyDecoratedDescriptor(_class$u.prototype, "spine", [_dec$u], { configurable: true, enumerable: true, writable: true, initializer: null }), _class$u)); cclegacy._RF.pop(); cclegacy._RF.push({}, "a2cdfylR5xOUZJFKd02JsvC", "GDetection", undefined); //检测工具类 var GDetection = /*#__PURE__*/function () { function GDetection() {} //检测角色 GDetection.testAABBRole = function testAABBRole(rect) { //@ts-ignore return PhysicsSystem2D.instance.testAABB(rect).map(function (item) { return item.getComponent(GRoleBase); }); } //检测角色 ; GDetection.testPointRole = function testPointRole(pos) { //@ts-ignore console.log(PhysicsSystem2D.instance.testPoint(pos)); }; return GDetection; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "f4c29zeLKNFLa0+PWN28r1s", "GAttackParabolicBangRemote", undefined); /** * 抛物线 爆炸普攻 * 攻击子弹,爆炸特效,龙骨-初始位置,子弹大小,爆炸宽度,爆炸高度 */ var GAttackParabolicRemote = /*#__PURE__*/function () { function GAttackParabolicRemote() {} var _proto = GAttackParabolicRemote.prototype; _proto.attack = function attack(role, info) { var enemy = role.fsm.enemy; if (!enemy) return; var image = app.battleRes.roleResImage[info.attackArgs[0]]; var bang = { ske: app.battleRes.roleResSpine[info.attackArgs[1]], info: TD.TbGRoleBattleRes.get(parseInt(info.attackArgs[1])) }; var bone = role.spine.findBone(info.attackArgs[2]); var scale = parseFloat(info.attackArgs[3]); var aw = parseFloat(info.attackArgs[4]); var ah = parseFloat(info.attackArgs[5]); if (!image || !bone || !scale || !bang || !aw || !ah) { console.warn("GAttackParabolicRemote ERROR", image, bone, scale, bang); return; } // console.log(`播放动画[GAttackParabolicRemote]`,role.nId,enemy.nId) console.log(role.spine, bone); var bullet = GAttackBullet.create(GButtleDefault, { image: image, scale: scale }); role.mode.addGObject(bullet); var world2 = role.node.worldPosition.clone().add(v3(role.getMirrorValue(bone.worldX), bone.worldY, 0)); //设置子弹位置 bullet.node.setWorldPosition(v3(world2.x, world2.y, world2.z)); //子弹移动 var start = bullet.v2World; var end = enemy.v2World; var center = v2((start.x + end.x) / 2, (start.y + end.y) / 2 + Math.abs(start.x - end.x) / 2); bullet.JTween({}).to({}, Vec2.distance(start, end) * 3).onUpdate(function (data, elapsed) { bullet.node.setWorldPosition(v3(bezier(start.x, center.x, center.x, end.x, elapsed), bezier(start.y, center.y, center.y, end.y, elapsed), 0)); }).onComplete(function () { //生成爆炸特效 var effect = GEffectUtil.createOne(bang.ske); role.mode.addGNode(effect.node, bullet.node.worldPosition); //获取默认动画 effect.setAnimation(0, "animation", false); //销毁 bullet.node.destroy(); // enemy.getComponent(BoxCollider2D).apply(); // console.log(enemy.v2World,enemy.getComponent(BoxCollider2D).worldPoints,enemy.getComponent(UITransform).getBoundingBoxToWorld()); GDetection.testAABBRole(rect(effect.node.worldPosition.x, effect.node.worldPosition.y, aw, ah)).forEach(function (role) { role.onHit(); }); }).start(); }; return GAttackParabolicRemote; }(); cclegacy._RF.pop(); var _GAttack; cclegacy._RF.push({}, "27b492StadJcppyhWy7Larz", "GAttack", undefined); //攻击子弹类 var GAttackBullet = /*#__PURE__*/function () { function GAttackBullet() {} //创建子弹 GAttackBullet.create = function create(GClass, data) { var bulletNode = GNode.create(); bulletNode.addComponent(UITransform); var bullet = bulletNode.addComponent(GClass); bullet.setData(data); return bullet; }; return GAttackBullet; }(); //攻击方式基类 //攻击方式 var GAttack = (_GAttack = {}, _GAttack["Normal"] = GAttackNormal, _GAttack["ParabolicBangRemote"] = GAttackParabolicRemote, _GAttack); cclegacy._RF.pop(); cclegacy._RF.push({}, "ded09l3kfFJMqunycXYSJhZ", "GSpine", undefined); //Spine 工具 var GSpine = /*#__PURE__*/function () { function GSpine() {} //保存当前Spine 播放新 Spine 结束后还原 GSpine.onPlayAnotherSpine = function onPlayAnotherSpine(role, spine, play, fun) { if (fun === void 0) { fun = {}; } //关闭当前角色原本的Spine role.spine.enabled = false; //添加新的spine var spineNode = GNode.create(); role.node.addChild(spineNode); var another = spineNode.addComponent(JNSkeleton); another.skeletonData = spine; fun.start && fun.start(another); another.setCompleteListener(function () { //还原 role.spine.enabled = true; spineNode.destroy(); fun.end && fun.end(); }); another.setAnimation(0, play, false); // another.setAnimation(0,play,false); return another; } //创建一个Spine ; GSpine.onCreateSpine = function onCreateSpine(spine) { var spineNode = GNode.create(); var another = spineNode.addComponent(JNSkeleton); another.premultipliedAlpha = false; another.skeletonData = spine; return another; } // 创建一个 Spine 并且 播放 销毁 ; GSpine.onPlaySceneSpine = function onPlaySceneSpine(scene, pos, spine, play) { var create = this.onCreateSpine(spine); scene.addGNode(create.node, pos); create.setCompleteListener(function () { //销毁 create.node.destroy(); }); create.setAnimation(0, play, false); return create; }; return GSpine; }(); cclegacy._RF.pop(); var _dec$v, _class$v; cclegacy._RF.push({}, "0dd9fmWmbBAra4y0n8wnsva", "GMapLoop", undefined); var ccclass$g = _decorator.ccclass, property$b = _decorator.property; /** * 循环地图 */ var GMapLoop = (_dec$v = ccclass$g('GMapLoop'), _dec$v(_class$v = /*#__PURE__*/function (_JNGSyncBase) { _inheritsLoose(GMapLoop, _JNGSyncBase); function GMapLoop() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGSyncBase.call.apply(_JNGSyncBase, [this].concat(args)) || this; _this.map = void 0; //地图 //地图重复次数 _this.repeat = 1; //一块的地图宽度 _this.mapWidth = 100; //一块的地图高度 _this.mapHeight = 100; //是否初始化 _this.isInit = false; //世界坐标Y轴 _this.worldY = 0; //创建的地图列表{开始区块:地图图片} _this.createMaps = new Map(); return _this; } var _proto = GMapLoop.prototype; _proto.init = function init(map, repeat, width, height) { if (repeat === void 0) { repeat = 1; } if (width === void 0) { width = 0; } if (height === void 0) { height = 0; } this.map = map; this.isInit = true; this.repeat = repeat; this.mapWidth = width || this.map.width; this.mapHeight = height || this.map.height; } //更新地图(世界坐标X) ; _proto.UpdateMap = function UpdateMap(x, offsetX, offsetY) { var _this2 = this; if (offsetX === void 0) { offsetX = 0; } if (offsetY === void 0) { offsetY = 0; } //计算x在第几个区块 var blockIndex = Math.floor((x + offsetX) / this.mapWidth); //生成区块的列表 var maps = []; for (var index = 0; index < 1 + this.repeat * 2; index++) { maps.push(blockIndex + (index - this.repeat)); } //生成 maps.forEach(function (blockIndex) { _this2.createMap(blockIndex, offsetX, offsetY); }); //销毁其他地图 var keys = Array.from(this.createMaps.keys()); keys.forEach(function (key) { if (maps.indexOf(key) < 0) { _this2.createMaps.get(key).destroy(); _this2.createMaps["delete"](key); } }); } //生成区块地图 ; _proto.createMap = function createMap(blockIndex, offsetX, offsetY) { if (offsetX === void 0) { offsetX = 0; } if (offsetY === void 0) { offsetY = 0; } //计算区块开始位置 var start = blockIndex * this.mapWidth - offsetX; if (!this.createMaps.get(blockIndex)) { //生成地图 var mapNode = GNode.create(); var uiTransform = mapNode.addComponent(UITransform); uiTransform.anchorX = 0; this.node.addChild(mapNode); mapNode.worldPosition = v3(start, offsetY, 0); var mapImage = mapNode.addComponent(Sprite); mapImage.spriteFrame = this.map; mapImage.sizeMode = Sprite.SizeMode.CUSTOM; uiTransform.contentSize = size(this.mapWidth, this.mapHeight); this.createMaps.set(blockIndex, mapNode); } else { this.createMaps.get(blockIndex).worldPosition = v3(start, offsetY, 0); } }; return GMapLoop; }(JNGSyncBase)) || _class$v); cclegacy._RF.pop(); cclegacy._RF.push({}, "6b762Fkk2dPa6Foi3FaydW1", "GFSMBase", undefined); //流程模式 var GFSMProcessMode = /*#__PURE__*/function (GFSMProcessMode) { GFSMProcessMode[GFSMProcessMode["Execute"] = 0] = "Execute"; GFSMProcessMode[GFSMProcessMode["WaitExecute"] = 1] = "WaitExecute"; return GFSMProcessMode; }({}); //等待执行 //流程信息 //流程枚举 var GFSMProcessEnum = /*#__PURE__*/function (GFSMProcessEnum) { GFSMProcessEnum[GFSMProcessEnum["Reset"] = -1] = "Reset"; GFSMProcessEnum[GFSMProcessEnum["Wait"] = -2] = "Wait"; return GFSMProcessEnum; }({}); //等待 //状态机基类 var GFSMBase = /*#__PURE__*/function () { function GFSMBase() { //是否关闭 this.isClose = false; //状态流程图 this.process = {}; //开始流程Id this.start = 0; //当前流程 this.current = 0; } var _proto = GFSMBase.prototype; //状态机刷新 _proto.onUpdate = function onUpdate(dt, frame) { if (this.isClose) return; if (!this.start) this.start = 0; if (!this.current) this.current = 0; //运行流程 this.execute(this.process[this.current], dt, frame); }; _proto.close = function close() { this.isClose = true; }; _proto.open = function open() { this.current = 0; this.isClose = false; } //执行流程 ; _proto.execute = function execute(process, dt, frame) { if (!process) return; process.mode = process.mode || GFSMProcessMode.Execute; process.to = process.to || []; var next; var isReset = true; //执行流程 switch (process.mode) { case GFSMProcessMode.Execute: //执行方法 next = process.execute(dt, process, frame); break; case GFSMProcessMode.WaitExecute: //执行等待方法 next = process.execute(dt, process, frame); //如果 状态 Wait 则 不重置 下一次状态从当前开始流程执行 if (next == GFSMProcessEnum.Wait) { isReset = false; } break; } if (process.to.indexOf(next) == -1 && next != GFSMProcessEnum.Wait && next != GFSMProcessEnum.Reset) { console.log("[GFSM]: \u6D41\u7A0BTo\u4E2D\u6CA1\u6709\u8FD9\u4E2A\u6D41\u7A0B \u8BF7\u68C0\u67E5\u4EE3\u7801", process, next); return; } if (!this.process[next]) next = null; if (next) { this.current = next; //运行下一个流程 this.execute(this.process[next], dt, frame); } else { if (isReset) { //重置 this.current = this.start; } } }; return GFSMBase; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "ff6b5u3W9pCu79MDZGnYnUk", "GRole", undefined); //角色工具类 var GRoleUtil = /*#__PURE__*/function () { function GRoleUtil() {} //获取存活的玩家 如果不存活则返回 null GRoleUtil.get = function get(player) { if (!player) return null; return function () { if (player) return player.get(); return null; }; } //通过Id 获取 GRole ; GRoleUtil.getGRole = function getGRole(id) { var info; if (!(info = TD.TbGRole.get(id))) return null; return info; }; GRoleUtil.getGRoles = function getGRoles(ids) { return ids.map(function (id) { return GRoleUtil.getGRole(id); }); }; return GRoleUtil; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "37959w4UMxDCriS7w5t8/Fd", "GFSMDefault", undefined); //流程枚举 var ProcessEnum = /*#__PURE__*/function (ProcessEnum) { ProcessEnum[ProcessEnum["SeekEnemy"] = 0] = "SeekEnemy"; ProcessEnum[ProcessEnum["MoveToAttackRange"] = 1] = "MoveToAttackRange"; ProcessEnum[ProcessEnum["AttackEnemy"] = 2] = "AttackEnemy"; ProcessEnum[ProcessEnum["MoveToTactical"] = 3] = "MoveToTactical"; ProcessEnum[ProcessEnum["ReleaseSkills"] = 4] = "ReleaseSkills"; return ProcessEnum; }(ProcessEnum || {}); var GFSMDefault = /*#__PURE__*/function (_GFSMBase) { _inheritsLoose(GFSMDefault, _GFSMBase); function GFSMDefault(player) { var _this$process; var _this; _this = _GFSMBase.call(this) || this; _this._player = void 0; //锁定的敌人 _this._enemy = void 0; //流程图 _this.process = (_this$process = {}, _this$process[ProcessEnum.SeekEnemy] = { title: "寻找敌人", execute: _this.onSeekEnemyProcess.bind(_assertThisInitialized(_this)), // to:[ProcessEnum.MoveToAttackRange], //移动到可攻击范围 to: [ProcessEnum.MoveToAttackRange, ProcessEnum.MoveToTactical] //移动到可攻击范围 }, _this$process[ProcessEnum.MoveToAttackRange] = { title: "移动到可攻击范围", mode: GFSMProcessMode.WaitExecute, execute: _this.onMoveToAttackRangeProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum.AttackEnemy] //攻击敌人 回阵型 }, _this$process[ProcessEnum.AttackEnemy] = { title: "攻击敌人", mode: GFSMProcessMode.WaitExecute, execute: _this.onAttackProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum.SeekEnemy, ProcessEnum.ReleaseSkills] //移动回阵型 释放技能 }, _this$process[ProcessEnum.MoveToTactical] = { title: "获取初始点", mode: GFSMProcessMode.WaitExecute, execute: _this.onMoveToInitPosProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum.SeekEnemy] //移动回阵型 }, _this$process[ProcessEnum.ReleaseSkills] = { title: "释放技能", mode: GFSMProcessMode.WaitExecute, execute: _this.onReleaseSkillsProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum.AttackEnemy] //继续攻击 }, _this$process); _this._player = GRoleUtil.get(player); return _this; } //寻敌 var _proto = GFSMDefault.prototype; _proto.onSeekEnemy = function onSeekEnemy() { return this.player.onQueryEunmy(); } //寻敌流程 ; _proto.onSeekEnemyProcess = function onSeekEnemyProcess(dt) { //播放等待 this.player.fsmAnim.isMove = false; this.player.fsmAnim.isAttack = false; if (this.enemy) { //如果有敌人 直接 攻击 return ProcessEnum.MoveToAttackRange; } if ((this._enemy = GRoleUtil.get(this.onSeekEnemy())) && this.enemy) { //如果有敌人 直接 攻击 return ProcessEnum.MoveToAttackRange; } else { //如果没有敌人则回去 if (!this.player.tacticalPos.equals(this.player.v2World)) { return ProcessEnum.MoveToTactical; } else { return GFSMProcessEnum.Reset; } } } //移动可攻击范围 ; _proto.onMoveToAttackRangeProcess = function onMoveToAttackRangeProcess(dt) { //播放移动 this.player.fsmAnim.isMove = true; this.player.fsmAnim.isAttack = false; //如果没有敌人则重置 if (!this.enemy) return GFSMProcessEnum.Reset; var distance = Vec2.distance(this.player.v2World, this.enemy.v2World); //如果在攻击范围则调用攻击 负责 靠近目标 if (distance < this.player.range) { return ProcessEnum.AttackEnemy; } else { //靠近目标 this.player.onMoveTarget(this.enemy.v2World, dt); return GFSMProcessEnum.Wait; } } //移动回阵型 ; _proto.onMoveToInitPosProcess = function onMoveToInitPosProcess(dt) { //播放移动 this.player.fsmAnim.isMove = true; this.player.fsmAnim.isAttack = false; if (this.player.onMoveTarget(this.player.tacticalPos, dt)) { this.player.onRecoverTacticalTowards(); //回到阵容 搜索敌人 return ProcessEnum.SeekEnemy; } return GFSMProcessEnum.Wait; } //攻击敌人 ; _proto.onAttackProcess = function onAttackProcess(dt) { //播放移动 this.player.fsmAnim.isMove = false; this.player.fsmAnim.isAttack = true; //如果有敌人则攻击 没有 则 重置 if (this.enemy) { //朝向敌人 this.player.onTowardsTarget(this.enemy); //是否可释放技能 if (this.player.isReleaseSkill()) { //则释放技能 return ProcessEnum.ReleaseSkills; } else { return GFSMProcessEnum.Wait; } } else { return ProcessEnum.SeekEnemy; } } //释放技能 ; _proto.onReleaseSkillsProcess = function onReleaseSkillsProcess() { //如果正在释放则等待 if (this.player.isReleasingSkill()) { return GFSMProcessEnum.Wait; } //释放技能 if (this.player.isReleaseSkill()) { //如果可以释放技能则释放 this.player.onReleaseSkill(); return GFSMProcessEnum.Wait; } else { //不可以则回到攻击 return ProcessEnum.AttackEnemy; } } //获取 寻找敌人状态 ; _proto.getSeekEnemyProcessEnum = function getSeekEnemyProcessEnum() { return ProcessEnum.SeekEnemy; }; _createClass(GFSMDefault, [{ key: "player", get: function get() { return this._player(); } }, { key: "enemy", get: function get() { if (this._enemy) return this._enemy(); return null; } }]); return GFSMDefault; }(GFSMBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "dda21qPk9pEIaDZvaKYF6bJ", "GFSMAnimBase", undefined); //角色动画名称枚举 var GFSMBattleAminEnum = /*#__PURE__*/function (GFSMBattleAminEnum) { GFSMBattleAminEnum["Wait"] = "std"; GFSMBattleAminEnum["Walk"] = "walk"; GFSMBattleAminEnum["Attack"] = "atk"; GFSMBattleAminEnum["Fly"] = "jifei"; return GFSMBattleAminEnum; }({}); //击飞 //动画流程信息 //动画状态机基类 var GFSMAnimBase = /*#__PURE__*/function (_GFSMBase) { _inheritsLoose(GFSMAnimBase, _GFSMBase); function GFSMAnimBase(spine, trackIndex) { var _this; if (trackIndex === void 0) { trackIndex = 0; } _this = _GFSMBase.call(this) || this; //轨道的索引 _this.trackIndex = void 0; //动画Root _this.spine = void 0; _this.events = {}; _this.starts = {}; _this.ends = {}; // 流程图 _this.process = {}; _this.spine = spine; _this.trackIndex = trackIndex; //设置监听 _this.spine.setEventListener(_this.onEventListener.bind(_assertThisInitialized(_this))); //设置结束监听 _this.spine.setCompleteListener(_this.onEndListener.bind(_assertThisInitialized(_this))); // //因为SpineBUG所以不使用Spine监听 采用自己调用 // this.spine.setStartListener(this.onStartListener.bind(this)); return _this; } var _proto = GFSMAnimBase.prototype; _proto.open = function open() { _GFSMBase.prototype.open.call(this); //重置 Object.values(this.process).forEach(function (info) { info.track = null; }); } //添加事件监听 ; _proto.addEventListener = function addEventListener(event, fun) { if (!this.events[event]) this.events[event] = []; this.events[event].push(fun); } //监听动画开始播放 ; _proto.addStartListener = function addStartListener(name, fun) { if (!this.starts[name]) this.starts[name] = []; this.starts[name].push(fun); } //监听动画结束播放 ; _proto.addEndListener = function addEndListener(name, fun) { if (!this.ends[name]) this.ends[name] = []; this.ends[name].push(fun); } //删除事件监听 ; _proto.delEventListener = function delEventListener(event, fun) { if (!this.events[event]) this.events[event] = []; var index = this.events[event].indexOf(fun); if (index >= 0) this.events[event].splice(index, 1); } //删除动画开始播放 ; _proto.delStartListener = function delStartListener(name, fun) { if (!this.starts[name]) this.starts[name] = []; var index = this.starts[name].indexOf(fun); if (index >= 0) this.starts[name].splice(index, 1); } //删除动画结束播放 ; _proto.delEndListener = function delEndListener(name, fun) { if (!this.ends[name]) this.ends[name] = []; var index = this.ends[name].indexOf(fun); if (index >= 0) this.ends[name].splice(index, 1); }; _proto.onEventListener = function onEventListener(entry, ev) { if (!this.events[ev.data.name]) this.events[ev.data.name] = []; this.events[ev.data.name].forEach(function (fun) { fun(); }); }; _proto.onStartListener = function onStartListener(entry) { if (!this.starts[entry.animation.name]) this.starts[entry.animation.name] = []; this.starts[entry.animation.name].forEach(function (fun) { fun(); }); }; _proto.onEndListener = function onEndListener(entry) { if (!this.ends[entry.animation.name]) this.ends[entry.animation.name] = []; this.ends[entry.animation.name].forEach(function (fun) { fun(); }); }; _proto.execute = function execute(process, dt, frame) { process.ifTo = process.ifTo || []; process.to = process.to || []; process.mode = GFSMProcessMode.WaitExecute; process.execute = this.tick.bind(this); _GFSMBase.prototype.execute.call(this, process, dt, frame); } //-1 继续播放 0 重新执行流程 * 指定分支 ; _proto.tick = function tick(dt, info, frame) { //判断是否会切换动画 (默认不切换) var to = GFSMProcessEnum.Wait; info.ifTo.forEach(function (run, index) { if (run()) { to = info.to[index]; } }); if (to >= 0) { //和下一个动作融合 var mix = info.mixs[to - 1] || 0; if (mix) { //设置融合 this.spine.setMix(info.animName, this.process[to].animName, mix); } info.track = null; return to; } //播放动画 if (!info.track) { // console.log(`${frame.index} 播放动画-${this.spine.getComponent(GObject).nId}-`,info); info.track = this.spine.setAnimation(this.trackIndex, info.animName, !!info.isLoop); this.onStartListener(info.track); } return to; }; return GFSMAnimBase; }(GFSMBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "1016ewzttJFPZ7iare6W/t6", "GFSMDefaultAnim", undefined); //角色动画名称枚举 var GFSMBattleAminEnum$1 = /*#__PURE__*/function (GFSMBattleAminEnum) { GFSMBattleAminEnum["Wait"] = "std"; GFSMBattleAminEnum["Walk"] = "walk"; GFSMBattleAminEnum["Attack"] = "atk"; GFSMBattleAminEnum["Fly"] = "jifei"; return GFSMBattleAminEnum; }({}); //击飞 //流程枚举 var ProcessEnum$1 = /*#__PURE__*/function (ProcessEnum) { ProcessEnum[ProcessEnum["Wait"] = 0] = "Wait"; ProcessEnum[ProcessEnum["Move"] = 1] = "Move"; ProcessEnum[ProcessEnum["Attack"] = 2] = "Attack"; ProcessEnum[ProcessEnum["Die"] = 3] = "Die"; return ProcessEnum; }(ProcessEnum$1 || {}); //动画状态机基类 var GFSMDefaultAnim = /*#__PURE__*/function (_GFSMAnimBase) { _inheritsLoose(GFSMDefaultAnim, _GFSMAnimBase); function GFSMDefaultAnim() { var _this$process; var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GFSMAnimBase.call.apply(_GFSMAnimBase, [this].concat(args)) || this; //是否攻击 _this.isAttack = false; //是否移动 _this.isMove = false; //是否死亡 _this.isDie = false; // 流程图 _this.process = (_this$process = {}, _this$process[ProcessEnum$1.Wait] = { title: "等待", isLoop: true, animName: GFSMBattleAminEnum$1.Wait, mixs: [0.1, 0.1], to: [ProcessEnum$1.Move, ProcessEnum$1.Attack, ProcessEnum$1.Die], ifTo: [function () { return _this.isMove; }, //前往移动 function () { return _this.isAttack; }, //前往攻击 function () { return _this.isDie; }] }, _this$process[ProcessEnum$1.Move] = { title: "移动", animName: GFSMBattleAminEnum$1.Walk, isLoop: true, mixs: [0.1, 0.1], to: [ProcessEnum$1.Wait, ProcessEnum$1.Attack, ProcessEnum$1.Die], ifTo: [function () { return !_this.isMove; }, //前往等待 function () { return _this.isAttack; }, //前往攻击 function () { return _this.isDie; }] }, _this$process[ProcessEnum$1.Attack] = { title: "攻击", animName: GFSMBattleAminEnum$1.Attack, isLoop: true, mixs: [0.1, 0.1], to: [ProcessEnum$1.Wait, ProcessEnum$1.Move, ProcessEnum$1.Die], ifTo: [function () { return !_this.isAttack; }, //前往等待 function () { return !_this.isAttack && _this.isMove; }, //前往移动 function () { return _this.isDie; }] }, _this$process[ProcessEnum$1.Die] = { title: "死亡", animName: GFSMBattleAminEnum$1.Fly, isLoop: true, mixs: [0.1, 0.1] }, _this$process); return _this; } return GFSMDefaultAnim; }(GFSMAnimBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "0f31efIwBhMPasMrQx1nk6x", "GSkillCDBase", undefined); //冷却技能基类 用于多长时间释放技能 var GSkillCDBase = /*#__PURE__*/function () { function GSkillCDBase() { //冷却总时间 this.cdTatal = 0; //冷却时间 this.cdTime = 0; } var _proto = GSkillCDBase.prototype; _proto.bind = function bind(role, info) { return this; } //是否可以释放技能 ; _proto.isRelease = function isRelease() { return this.cdTime >= this.cdTatal; } //释放技能 ; _proto.release = function release() { //是否可以释放技能 if (!this.isRelease()) return false; this.cdTime = 0; return this.onRelease(); } //子类实现释放 ; //查询状态 _proto.state = function state() { if (this.isReleasing()) { return GSkillState.Releasing; } if (this.isRelease()) return GSkillState.Releasable;else return GSkillState.NoRelease; } //是否正在释放技能 ; _proto.isReleasing = function isReleasing() { return false; } //更新 ; _proto.onUpdate = function onUpdate(dt) { if (this.state() == GSkillState.NoRelease) { this.cdTime += dt / 1000; } } //返回进度 ; _proto.getProgress = function getProgress() { return this.cdTime / this.cdTatal; }; return GSkillCDBase; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "d06a5iSB4dGNLhKnSOATwFu", "GSkillCrazySquirrel", undefined); /** * 疯狂松鼠技能 * 参数:[技能冷却] */ var GSkillCrazySquirrel = /*#__PURE__*/function (_GSkillCDBase) { _inheritsLoose(GSkillCrazySquirrel, _GSkillCDBase); function GSkillCrazySquirrel() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GSkillCDBase.call.apply(_GSkillCDBase, [this].concat(args)) || this; _this.role = void 0; _this.info = void 0; return _this; } var _proto = GSkillCrazySquirrel.prototype; _proto.bind = function bind(role, info) { //技能冷却 this.cdTatal = parseInt(info.skillArgs[0]); this.role = role; this.info = info; return this; }; _proto.onRelease = function onRelease() { var _this2 = this; //获取敌人位置 var enemy = this.role.fsm.enemy; var scene = this.role.mode; if (!enemy) return false; var aw = parseInt(this.info.skillArgs[1]); var ah = parseInt(this.info.skillArgs[2]); //出现松鼠丢炸弹 GSpine.onPlayAnotherSpine(this.role, app.battleRes.roleResSpine[30003], "skill", { end: function end() { //从天而降 var pos = enemy.v2World.add(v2(0, 1000)); var end = enemy.v2World.clone(); //生成火球 var spine = GSpine.onCreateSpine(app.battleRes.roleResSpine[30004]); _this2.role.mode.addGNode(spine.node, pos); spine.setAnimation(0, "animation", true); spine.node.angle = 90; JTween(pos).to(end, 600).onUpdate(function (pos) { spine.node.worldPosition = v3(pos.x, pos.y, 0); }).onComplete(function () { var world = spine.node.worldPosition; spine.node.destroy(); GSpine.onPlaySceneSpine(scene, v2(world.x, world.y), app.battleRes.roleResSpine[30005], "animation"); console.log(GDetection.testAABBRole(rect(world.x, world.y, aw, ah)).length); GDetection.testAABBRole(rect(world.x, world.y, aw, ah)).forEach(function (role) { role.onHit(); }); }).start(); } }); return true; }; return GSkillCrazySquirrel; }(GSkillCDBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "e648a7txJxPELJPau9F/BT1", "GSkillAngerBase", undefined); //怒气冷却 var GSkillAngerBase = /*#__PURE__*/function () { function GSkillAngerBase() { //怒气值 this.anger = 0; //怒气最大值 this.angerMax = 0; } var _proto = GSkillAngerBase.prototype; _proto.bind = function bind(role, info) { throw new Error("Method not implemented."); }; _proto.isRelease = function isRelease() { return this.anger >= this.angerMax; }; _proto.release = function release() { //是否可以释放技能 if (!this.isRelease()) return false; this.anger = 0; return this.onRelease(); } //子类实现释放 ; //是否正在释放技能 _proto.isReleasing = function isReleasing() { return false; }; _proto.state = function state() { if (this.isReleasing()) { return GSkillState.Releasing; } if (this.isRelease()) return GSkillState.Releasable;else return GSkillState.NoRelease; }; _proto.onUpdate = function onUpdate(dt) {} //返回进度条 ; _proto.getProgress = function getProgress() { return this.anger / this.angerMax; }; return GSkillAngerBase; }(); cclegacy._RF.pop(); cclegacy._RF.push({}, "74452kLXoZKiaKB+QGu1jEu", "GSkillBulbasaurDoubleHit", undefined); var GSkillBulbasaurDoubleHit = /*#__PURE__*/function (_GSkillAngerBase) { _inheritsLoose(GSkillBulbasaurDoubleHit, _GSkillAngerBase); function GSkillBulbasaurDoubleHit() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GSkillAngerBase.call.apply(_GSkillAngerBase, [this].concat(args)) || this; _this.role = void 0; _this.info = void 0; return _this; } var _proto = GSkillBulbasaurDoubleHit.prototype; _proto.bind = function bind(role, info) { //技能冷却 this.role = role; this.info = info; this.angerMax = parseInt(info.skillArgs[0]); this.role.addAttackCallback(this.addAnger.bind(this)); return this; }; _proto.onRelease = function onRelease() { var _this2 = this; var enemy = this.role.fsm.enemy; //关闭动画管理器 this.role.fsmAnim.close(); var skill1Attack = function skill1Attack() { if (!enemy.isDie) { enemy.onHit(); } }; var end = function end() { _this2.role.fsmAnim.open(); _this2.role.fsmAnim.delEventListener("skill1Attack", skill1Attack); _this2.role.fsmAnim.delEndListener("skill1", end); }; //监听伤害 this.role.fsmAnim.addEventListener("skill1Attack", skill1Attack); //播放妙蛙种子技能 this.role.spine.setAnimation(0, "skill1", false); this.role.fsmAnim.addEndListener("skill1", end); return true; } //添加怒气 ; _proto.addAnger = function addAnger() { this.anger++; }; return GSkillBulbasaurDoubleHit; }(GSkillAngerBase); cclegacy._RF.pop(); var _GSkill; cclegacy._RF.push({}, "a6992qkqjFBs6pfQkh+QXgW", "GSkill", undefined); //技能状态 var GSkillState = /*#__PURE__*/function (GSkillState) { GSkillState[GSkillState["NoRelease"] = 0] = "NoRelease"; GSkillState[GSkillState["Releasable"] = 1] = "Releasable"; GSkillState[GSkillState["Releasing"] = 2] = "Releasing"; return GSkillState; }({}); //释放中 //技能基类 //技能方式 var GSkill = (_GSkill = {}, _GSkill["GSkillCrazySquirrel"] = GSkillCrazySquirrel, _GSkill["GSkillBulbasaurDoubleHit"] = GSkillBulbasaurDoubleHit, _GSkill); cclegacy._RF.pop(); var _dec$w, _dec2$h, _dec3$8, _class$w, _class2$d, _descriptor$e, _descriptor2$7; cclegacy._RF.push({}, "276817jnQlKBr5eca8EUxm4", "GRoleDefault", undefined); var property$c = _decorator.property, ccclass$h = _decorator.ccclass; //默认角色类 var GRoleDefault = (_dec$w = ccclass$h('GRoleDefault'), _dec2$h = property$c(ProgressBar), _dec3$8 = property$c(ProgressBar), _dec$w(_class$w = (_class2$d = /*#__PURE__*/function (_GRoleBase) { _inheritsLoose(GRoleDefault, _GRoleBase); function GRoleDefault() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GRoleBase.call.apply(_GRoleBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "bloodVolume", _descriptor$e, _assertThisInitialized(_this)); //能量条 _initializerDefineProperty(_this, "energyVolume", _descriptor2$7, _assertThisInitialized(_this)); //状态机 _this.fsm = void 0; //动画状态机 _this.fsmAnim = void 0; //角色类型 _this.type = void 0; //在阵容中的下标 _this.tacticalIndex = void 0; //阵容 _this._tactical = void 0; //角色技能 _this.skills = []; //宠物死亡回调 _this.killBack = []; return _this; } var _proto = GRoleDefault.prototype; _proto.onSyncLoad = function onSyncLoad() { _GRoleBase.prototype.onSyncLoad.call(this); //监听攻击 this.fsmAnim.addEventListener(GRoleAnimEvent.Attack, this.onAttack.bind(this)); //监听死亡击飞 this.fsmAnim.addStartListener(GFSMBattleAminEnum.Fly, this.onFly.bind(this)); } //初始化 ; _proto.onInit = function onInit(type, role, tactical, tacticalIndex) { var _this2 = this; _GRoleBase.prototype.init.call(this, role); this.type = type; this.range = role.roleAttackRange; //设置攻击范围 this.role = role; //设置角色 this.tactical = tactical; this.tacticalIndex = tacticalIndex; // 设置技能 this.skills = role.roleSkillIds.map(function (skillId) { var info = TD.TbGRoleSkill.get(skillId); return new GSkill[info.skillController]().bind(_this2, info); }); }; _proto.onSyncUpdate = function onSyncUpdate(dt, frame, input) { _GRoleBase.prototype.onSyncUpdate.call(this, dt, frame, input); //更新技能 this.skills.forEach(function (skill) { return skill.onUpdate(dt); }); //更新显示 this.bloodVolume.progress = this.blood / this.fullBlood; //显示第一个技能进度条 if (this.skills[0]) { this.energyVolume.progress = this.skills[0].getProgress(); } }; _proto.fsmCreate = function fsmCreate() { return new GFSMDefault(this); }; _proto.fsmAnimCreate = function fsmAnimCreate() { return new GFSMDefaultAnim(this.spine); } //攻击 ; _proto.onAttack = function onAttack() { if (!this.fsm.enemy) return; // console.log(`播放动画[${this.nId}] onAttack`,this.fsm.enemy.nId) //敌人扣血 var info = TD.TbGRoleAttack.get(this.role.id); new GAttack[info.attackWay]().attack(this, info); this.attackCallbacks.forEach(function (fun) { return fun(); }); } //击飞 ; _proto.onFly = function onFly() { var _this3 = this; var vWorld = this.node.worldPosition; var vEndWorld = this.getWorldBackLen(v2(1500, 500)); this.JTween(vWorld).to({ x: vEndWorld.x }, 1000).onUpdate(function (pos) { return _this3.node.worldPosition = pos; }).start(); this.JTween(vWorld).to({ y: vEndWorld.y }, 1000).easing(JEasing.Circular.Out).onUpdate(function (pos) { return _this3.node.worldPosition = vWorld; }).start(); } //过滤敌人 ; _proto.filterEnemy = function filterEnemy(roles) { var _this4 = this; if (roles === void 0) { roles = []; } return roles.filter(function (role) { return role.type != _this4.type; }); } //恢复阵容朝向 ; _proto.onRecoverTacticalTowards = function onRecoverTacticalTowards() { this.setTowards(this.tactical.towards); } //释放技能 每一次只能释放一次 ; _proto.onSkill = function onSkill() { for (var _iterator = _createForOfIteratorHelperLoose(this.skills), _step; !(_step = _iterator()).done;) { var item = _step.value; if (item.isRelease()) { //如果可以释放则释放 item.release(); return true; } } return false; } //判断是否可以释放技能 ; _proto.isReleaseSkill = function isReleaseSkill() { for (var _iterator2 = _createForOfIteratorHelperLoose(this.skills), _step2; !(_step2 = _iterator2()).done;) { var skill = _step2.value; if (skill.isRelease()) { return true; } } return false; } //释放技能 ; _proto.onReleaseSkill = function onReleaseSkill() { for (var _iterator3 = _createForOfIteratorHelperLoose(this.skills), _step3; !(_step3 = _iterator3()).done;) { var skill = _step3.value; if (skill.isRelease()) { skill.release(); return true; } } return false; } //是否正在释放技能 ; _proto.isReleasingSkill = function isReleasingSkill() { for (var _iterator4 = _createForOfIteratorHelperLoose(this.skills), _step4; !(_step4 = _iterator4()).done;) { var skill = _step4.value; if (skill.state() == GSkillState.Releasing) { return true; } } return false; }; _proto.onQueryEunmy = function onQueryEunmy() { return null; } //添加一个死亡回调 ; _proto.addKillBackEvent = function addKillBackEvent(callback) { this.killBack.push(callback); } //判断玩家是否在阵法位置 ; _proto.isTacticalPos = function isTacticalPos() { return this.tactical.getPosition(this.tacticalIndex).equals(this.v2World); }; _createClass(GRoleDefault, [{ key: "isDie", get: function get() { return this._isDie; }, set: function set(value) { var _this5 = this; this._isDie = value; //设置死亡状态 this.fsmAnim.isDie = value; if (this.isDie) { //关闭状态机 this.fsm.close(); //死亡回调 this.killBack.forEach(function (fun) { return fun(_this5); }); } } }, { key: "tactical", get: function get() { return this._tactical; }, set: function set(value) { this.setTowards(value.towards); this._tactical = value; } //阵容位置 }, { key: "tacticalPos", get: function get() { return this.tactical.getPosition(this.tacticalIndex); } }]); return GRoleDefault; }(GRoleBase), (_descriptor$e = _applyDecoratedDescriptor(_class2$d.prototype, "bloodVolume", [_dec2$h], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$7 = _applyDecoratedDescriptor(_class2$d.prototype, "energyVolume", [_dec3$8], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$d)) || _class$w); cclegacy._RF.pop(); cclegacy._RF.push({}, "bba56EVqsFOXryOCHv5IjKj", "GRoleExpandBase", undefined); /** * 扩展类基类 用于代码动态添加 角色脚本的类 */ var GRoleExpandBase = /*#__PURE__*/function (_JNGSyncProtoBase) { _inheritsLoose(GRoleExpandBase, _JNGSyncProtoBase); function GRoleExpandBase() { return _JNGSyncProtoBase.apply(this, arguments) || this; } return GRoleExpandBase; }(JNGSyncProtoBase); cclegacy._RF.pop(); var _dec$x, _class$x; cclegacy._RF.push({}, "3a215GKdmtPYaWfPoglzwjw", "GRoleOnHookCreepsExpand", undefined); var ccclass$i = _decorator.ccclass, property$d = _decorator.property; /** * 无限模式 野怪 扩展类 */ var GRoleOnHookCreepsExpand = (_dec$x = ccclass$i('GRoleOnHookCreepsExpand'), _dec$x(_class$x = /*#__PURE__*/function (_GRoleExpandBase) { _inheritsLoose(GRoleOnHookCreepsExpand, _GRoleExpandBase); function GRoleOnHookCreepsExpand() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GRoleExpandBase.call.apply(_GRoleExpandBase, [this].concat(args)) || this; //野怪 _this.creeps = void 0; return _this; } return GRoleOnHookCreepsExpand; }(GRoleExpandBase)) || _class$x); cclegacy._RF.pop(); var _dec$y, _class$y; cclegacy._RF.push({}, "3c2ffA7p+RK+7s8zqyxcwCu", "GRoleOnHookPlayerExpand", undefined); var ccclass$j = _decorator.ccclass, property$e = _decorator.property; /** * 无限模式 玩家 扩展类 */ var GRoleOnHookPlayerExpand = (_dec$y = ccclass$j('GRoleOnHookPlayerExpand'), _dec$y(_class$y = /*#__PURE__*/function (_GRoleExpandBase) { _inheritsLoose(GRoleOnHookPlayerExpand, _GRoleExpandBase); function GRoleOnHookPlayerExpand() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GRoleExpandBase.call.apply(_GRoleExpandBase, [this].concat(args)) || this; //角色Id _this.petId = void 0; return _this; } return GRoleOnHookPlayerExpand; }(GRoleExpandBase)) || _class$y); cclegacy._RF.pop(); cclegacy._RF.push({}, "1b62196PL1BZYo+V2Xwi/Gf", "GTactical", undefined); //阵法类 var GTactical = /*#__PURE__*/function () { function GTactical(tactical, towards, offset) { if (towards === void 0) { towards = GTowards.RIGHT; } if (offset === void 0) { offset = Vec2.ZERO; } this.tactical = void 0; //阵容朝向 this.towards = void 0; //位置偏差 this.offset = void 0; this.tactical = tactical; this.towards = towards; this.offset = offset; } var _proto = GTactical.prototype; _proto.setOffset = function setOffset(offset) { this.offset = offset; return this; } //获取阵法 ; GTactical.getTactical = function getTactical(isReversed) { if (isReversed === void 0) { isReversed = false; } var tactical = [[7, 4, 1], [8, 5, 2], [9, 6, 3]]; if (isReversed) { tactical = this.getTacticalFlipX(tactical); return new GTactical(tactical, GTowards.LEFT); } return new GTactical(tactical); } //获取阵法 ; GTactical.getTactical1 = function getTactical1(isReversed) { if (isReversed === void 0) { isReversed = false; } var tactical = [[0, 3, 0], [0, 1, 0], [0, 2, 0]]; if (isReversed) { tactical = this.getTacticalFlipX(tactical); return new GTactical(tactical, GTowards.LEFT); } return new GTactical(tactical); } //获取阵法 ; GTactical.getTactical2 = function getTactical2(isReversed) { if (isReversed === void 0) { isReversed = false; } var tactical = [[0, 0, 3], [0, 1, 0], [2, 0, 0]]; if (isReversed) { tactical = this.getTacticalFlipX(tactical); return new GTactical(tactical, GTowards.LEFT); } return new GTactical(tactical); } //阵法取反 ; GTactical.getTacticalFlipX = function getTacticalFlipX(tactical) { return tactical.map(function (row) { return row.reverse(); }); } //返回阵法位置 ; _proto.getPosition = function getPosition(index, father) { if (father === void 0) { father = this.offset; } var pos; if (pos = this.getXY(index)) { return father.clone().add(GTactical.pos[pos.y][pos.x].clone()); } return null; } //返回XY ; _proto.getXY = function getXY(index) { for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { var tag = this.tactical[i][j]; if (tag == index) { return v2(j, i); } } } return null; } //返回我在第几排 ; _proto.getRow = function getRow(index) { var pos; if (pos = this.getXY(index)) { return pos.y; } return null; }; return GTactical; }(); //阵法位置 GTactical.pos = [[v2(-100, 150), v2(0, 150), v2(100, 150)], [v2(-100, 0), v2(0, 0), v2(100, 0)], [v2(-100, -150), v2(0, -150), v2(100, -150)]]; cclegacy._RF.pop(); cclegacy._RF.push({}, "9168apnWORDNLXGmn9hYcE7", "GFSMOnHookMode", undefined); //流程枚举 var ProcessEnum$2 = /*#__PURE__*/function (ProcessEnum) { ProcessEnum[ProcessEnum["SeekEnemy"] = 0] = "SeekEnemy"; ProcessEnum[ProcessEnum["GenNextFight"] = 1] = "GenNextFight"; ProcessEnum[ProcessEnum["LeaveFight"] = 2] = "LeaveFight"; ProcessEnum[ProcessEnum["GenEnemy"] = 3] = "GenEnemy"; ProcessEnum[ProcessEnum["Fight"] = 4] = "Fight"; return ProcessEnum; }(ProcessEnum$2 || {}); //战斗 //无限模式的状态类 var GFSMOnHookMode = /*#__PURE__*/function (_GFSMBase) { _inheritsLoose(GFSMOnHookMode, _GFSMBase); function GFSMOnHookMode(mode) { var _this$process; var _this; _this = _GFSMBase.call(this) || this; _this.mode = void 0; _this.start = ProcessEnum$2.SeekEnemy; _this.process = (_this$process = {}, _this$process[ProcessEnum$2.SeekEnemy] = { title: "寻找敌人", mode: GFSMProcessMode.Execute, execute: _this.onSeekEnemyProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum$2.GenNextFight, ProcessEnum$2.Fight] }, _this$process[ProcessEnum$2.GenNextFight] = { title: "生成下一个战斗位置", mode: GFSMProcessMode.Execute, execute: _this.onGenNextFightProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum$2.GenEnemy] }, _this$process[ProcessEnum$2.GenEnemy] = { title: "生成敌人", mode: GFSMProcessMode.Execute, execute: _this.onGenEnemyProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum$2.LeaveFight] }, _this$process[ProcessEnum$2.LeaveFight] = { title: "前往战斗", mode: GFSMProcessMode.WaitExecute, execute: _this.onLeaveFightProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum$2.Fight] }, _this$process[ProcessEnum$2.Fight] = { title: "战斗", mode: GFSMProcessMode.WaitExecute, execute: _this.onFightProcess.bind(_assertThisInitialized(_this)), to: [ProcessEnum$2.SeekEnemy] }, _this$process); _this.mode = mode; return _this; } var _proto = GFSMOnHookMode.prototype; //寻找敌人 _proto.onSeekEnemyProcess = function onSeekEnemyProcess(dt) { //判断是否还有敌人 if (this.mode.isHaveEnemy()) { return ProcessEnum$2.Fight; //如果有则攻击 } else { return ProcessEnum$2.GenNextFight; //没有则生成下一个战斗位置 } } //生成下一个战斗位置 ; _proto.onGenNextFightProcess = function onGenNextFightProcess() { this.mode.isAllowAttack = false; this.mode.onNextTarget(); return ProcessEnum$2.GenEnemy; //生成敌人 } //生成敌人 ; _proto.onGenEnemyProcess = function onGenEnemyProcess() { this.mode.onResetGenerateEnemy(); return ProcessEnum$2.LeaveFight; //前往战斗 } //前往战斗 ; _proto.onLeaveFightProcess = function onLeaveFightProcess() { //判断玩家是否前往到战斗位置 var roles = this.mode.getOnesRoleAlive(GOnHookModePlayerEnum.PLAYER); if (roles.length == 0) return GFSMProcessEnum.Reset; for (var index = 0; index < roles.length; index++) { var role = roles[index]; if (!role.isTacticalPos()) { //如果不在位置则等待 return GFSMProcessEnum.Wait; } } //到达位置生成敌人 return ProcessEnum$2.Fight; } //战斗 ; _proto.onFightProcess = function onFightProcess() { this.mode.isAllowAttack = true; //等待敌人击杀完 if (!this.mode.isHaveEnemy()) { return ProcessEnum$2.SeekEnemy; //击杀完寻找敌人 } //没有击杀完则等待击杀 return GFSMProcessEnum.Wait; }; return GFSMOnHookMode; }(GFSMBase); cclegacy._RF.pop(); cclegacy._RF.push({}, "4ecc4gMbQVLV7wBFgWuDBUS", "GAPI", undefined); var GAPI = { /************** 无限模式接口 ********************/ //生成野怪 GOnHookSpawnCreeps: function () { var _GOnHookSpawnCreeps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.t0 = RProto; _context.next = 3; return app.api.get("/game/mode/onHook/onSpawnCreeps", { responseType: 'arraybuffer' }); case 3: _context.t1 = _context.sent; _context.t2 = GActionType.GOnHookPets; return _context.abrupt("return", (0, _context.t0)(_context.t1, _context.t2)); case 6: case "end": return _context.stop(); } }, _callee); })); function GOnHookSpawnCreeps() { return _GOnHookSpawnCreeps.apply(this, arguments); } return GOnHookSpawnCreeps; }(), //捕捉野怪 GOnHookCatchCreeps: function () { var _GOnHookCatchCreeps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(creepId) { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.t0 = RData; _context2.next = 3; return app.api.post("/game/mode/onHook/onCatchCreeps/" + creepId); case 3: _context2.t1 = _context2.sent; return _context2.abrupt("return", (0, _context2.t0)(_context2.t1)); case 5: case "end": return _context2.stop(); } }, _callee2); })); function GOnHookCatchCreeps(_x) { return _GOnHookCatchCreeps.apply(this, arguments); } return GOnHookCatchCreeps; }(), //出售野怪 GOnHookSellCreeps: function () { var _GOnHookSellCreeps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(creepId) { return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.t0 = RData; _context3.next = 3; return app.api.post("/game/mode/onHook/onSellCreeps/" + creepId); case 3: _context3.t1 = _context3.sent; return _context3.abrupt("return", (0, _context3.t0)(_context3.t1)); case 5: case "end": return _context3.stop(); } }, _callee3); })); function GOnHookSellCreeps(_x2) { return _GOnHookSellCreeps.apply(this, arguments); } return GOnHookSellCreeps; }() }; cclegacy._RF.pop(); cclegacy._RF.push({}, "3e8810K3WhMppBDc+LUUxi9", "GOnHookManager", undefined); var GOnHookManagerEvent = /*#__PURE__*/function (GOnHookManagerEvent) { GOnHookManagerEvent["ADD_KILL_SREEP"] = "GOnHookManagerEvent_ADD_KILL_SREEP"; GOnHookManagerEvent["DEL_KILL_SREEP"] = "GOnHookManagerEvent_DEL_KILL_SREEP"; return GOnHookManagerEvent; }({}); //游戏模式 OnHook 管理器 var GOnHookManager = /*#__PURE__*/function (_Singleton) { _inheritsLoose(GOnHookManager, _Singleton); function GOnHookManager() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Singleton.call.apply(_Singleton, [this].concat(args)) || this; //野怪列表 _this._sreeps = new Map(); //已经死亡的野怪列表 _this.killSreeps = []; return _this; } var _proto = GOnHookManager.prototype; //生成野怪 _proto.onSpawnSreeps = function onSpawnSreeps() { var _this2 = this; GAPI.GOnHookSpawnCreeps().then(function (data) { data.pets.forEach(function (pet) { _this2._sreeps.set(pet.key, pet); }); }); } //获取下一只野怪 ; _proto.getNextCreeps = function getNextCreeps() { var _this$sreeps$keys$nex; if (!this.sreeps) return; var creeps = this.sreeps.get((_this$sreeps$keys$nex = this.sreeps.keys().next()) == null ? void 0 : _this$sreeps$keys$nex.value); return creeps; } //野怪死亡 ; _proto.onKillSreeps = function onKillSreeps(creeps) { this.sreeps["delete"](creeps.key); //记入死亡 //判断是否在死亡中如果在则跳出 if (this.killSreeps.indexOf(creeps) > -1) { return; } this.killSreeps.push(creeps); //通知添加死亡野怪 app.event.emit(GOnHookManagerEvent.ADD_KILL_SREEP, creeps); console.log("GOnHookManager : " + creeps.key + " \u5BA0\u7269\u6B7B\u4EA1 \u53EF\u8FDB\u884C\u6355\u6349 \u51FA\u552E"); } //捕捉野怪 ; _proto.onCatchCreeps = /*#__PURE__*/function () { var _onCatchCreeps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(creeps) { var index, pet; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!((index = this.killSreeps.indexOf(creeps)) < 0)) { _context.next = 3; break; } app.layer.Open(GUI.Tips, { text: "不可捕捉该野怪" }); return _context.abrupt("return", false); case 3: //删除 this.killSreeps.splice(index, 1); //通知添加野怪被删除 app.event.emit(GOnHookManagerEvent.DEL_KILL_SREEP, creeps); _context.next = 7; return GAPI.GOnHookCatchCreeps(creeps.key); case 7: pet = _context.sent; //保存宠物 if (pet) { PlayerPetData.getIns().addPet(pet); } return _context.abrupt("return", !!pet); case 10: case "end": return _context.stop(); } }, _callee, this); })); function onCatchCreeps(_x) { return _onCatchCreeps.apply(this, arguments); } return onCatchCreeps; }() //出售野怪 ; _proto.onSellCreeps = /*#__PURE__*/function () { var _onSellCreeps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(creeps) { var index; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!((index = this.killSreeps.indexOf(creeps)) < 0)) { _context2.next = 3; break; } app.layer.Open(GUI.Tips, { text: "不可出售当前野怪" }); return _context2.abrupt("return", false); case 3: //删除 this.killSreeps.splice(index, 1); //通知添加野怪被删除 app.event.emit(GOnHookManagerEvent.DEL_KILL_SREEP, creeps); _context2.next = 7; return GAPI.GOnHookSellCreeps(creeps.key); case 7: return _context2.abrupt("return", _context2.sent); case 8: case "end": return _context2.stop(); } }, _callee2, this); })); function onSellCreeps(_x2) { return _onSellCreeps.apply(this, arguments); } return onSellCreeps; }(); _createClass(GOnHookManager, [{ key: "sreeps", get: function get() { //如果没有野怪了 则 向服务器生成 if (!this._sreeps || !this._sreeps.size) { //生成 this.onSpawnSreeps(); return null; } return this._sreeps; }, set: function set(data) { this._sreeps = data; } }]); return GOnHookManager; }(Singleton); cclegacy._RF.pop(); var _dec$z, _dec2$i, _class$z, _class2$e, _descriptor$f; cclegacy._RF.push({}, "fad17KCTqZBj4nGCb/xtHxi", "ModeRenderHitText", undefined); var ccclass$k = _decorator.ccclass, property$f = _decorator.property; var ModeRenderHitText = (_dec$z = ccclass$k('ModeRenderHitText'), _dec2$i = property$f(Label), _dec$z(_class$z = (_class2$e = /*#__PURE__*/function (_Component) { _inheritsLoose(ModeRenderHitText, _Component); function ModeRenderHitText() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "hitLabel", _descriptor$f, _assertThisInitialized(_this)); return _this; } var _proto = ModeRenderHitText.prototype; _proto.setText = function setText(hit) { this.hitLabel.string = "" + hit; this.setAnimation(); } //设置动画 ; _proto.setAnimation = function setAnimation() { var _this2 = this; this.node.scale = v3(0, 0, 0); tween(this.node).to(.5, { position: this.node.position.clone().add(v3(0, 100, 0)), scale: v3(1, 1, 1) }, { onComplete: function onComplete() { _this2.node.destroy(); }, easing: "quadInOut" }).start(); }; return ModeRenderHitText; }(Component), _descriptor$f = _applyDecoratedDescriptor(_class2$e.prototype, "hitLabel", [_dec2$i], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$e)) || _class$z); cclegacy._RF.pop(); var _dec$A, _dec2$j, _class$A, _class2$f, _descriptor$g; cclegacy._RF.push({}, "00e93M1gwFDX4OxuD8p5I6L", "ModeRender", undefined); var ccclass$l = _decorator.ccclass, property$g = _decorator.property; var ModeRenderEvent = /*#__PURE__*/function (ModeRenderEvent) { ModeRenderEvent["HIT"] = "ModeRenderEvent_HIT"; return ModeRenderEvent; }({}); var ModeRender = (_dec$A = ccclass$l('ModeRender'), _dec2$j = property$g(Prefab), _dec$A(_class$A = (_class2$f = /*#__PURE__*/function (_Component) { _inheritsLoose(ModeRender, _Component); function ModeRender() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //受击预制体 _initializerDefineProperty(_this, "hitPrefab", _descriptor$g, _assertThisInitialized(_this)); return _this; } var _proto = ModeRender.prototype; _proto.onLoad = function onLoad() { app.event.on(ModeRenderEvent.HIT, this.onHit, this); }; _proto.onDestroy = function onDestroy() { app.event.off(ModeRenderEvent.HIT, this.onHit, this); } //受击 ; _proto.onHit = function onHit(pos, hit) { var rolePos = GData.WorldCanvas.camera.worldToScreen(v3(pos.x, pos.y)); var hitNode = instantiate(this.hitPrefab); this.node.addChild(hitNode); hitNode.position = rolePos.add(v3(0, 100, 0)); hitNode.getComponent(ModeRenderHitText).setText(hit); }; return ModeRender; }(Component), _descriptor$g = _applyDecoratedDescriptor(_class2$f.prototype, "hitPrefab", [_dec2$j], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$f)) || _class$A); cclegacy._RF.pop(); var _dec$B, _dec2$k, _dec3$9, _dec4$6, _dec5$2, _dec6$2, _class$B, _class2$g, _descriptor$h, _descriptor2$8, _descriptor3$6, _descriptor4$3, _descriptor5$3; cclegacy._RF.push({}, "84547zJhY9O5JtlJy/NgK9H", "GOnHookMode", undefined); var ccclass$m = _decorator.ccclass, property$h = _decorator.property; //角色 var GOnHookModePlayerEnum = /*#__PURE__*/function (GOnHookModePlayerEnum) { GOnHookModePlayerEnum[GOnHookModePlayerEnum["PLAYER"] = 0] = "PLAYER"; GOnHookModePlayerEnum[GOnHookModePlayerEnum["ENEMY"] = 1] = "ENEMY"; return GOnHookModePlayerEnum; }({}); //怪物 //玩家信息 /** * 挂机模式 无限出现小怪 (不是联机模式 该模式支持使用本地数据 和 API) */ var GOnHookMode = (_dec$B = ccclass$m('GOnHookMode'), _dec2$k = property$h(Prefab), _dec3$9 = property$h(GMapLoop), _dec4$6 = property$h(GMapLoop), _dec5$2 = property$h(GMapLoop), _dec6$2 = property$h(Node), _dec$B(_class$B = (_class2$g = /*#__PURE__*/function (_GBaseMode) { _inheritsLoose(GOnHookMode, _GBaseMode); function GOnHookMode() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GBaseMode.call.apply(_GBaseMode, [this].concat(args)) || this; _initializerDefineProperty(_this, "rolePrefab", _descriptor$h, _assertThisInitialized(_this)); //场景地图 _initializerDefineProperty(_this, "map1", _descriptor2$8, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "map2", _descriptor3$6, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "map3", _descriptor4$3, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "objects", _descriptor5$3, _assertThisInitialized(_this)); //玩家信息 _this.playerInfo = void 0; //宠物信息 _this.enemyInfo = void 0; //玩家宠物位置 _this.playerPos = new Vec2(-400, 0); //怪物位置 _this.enemyPos = new Vec2(400, 0); //玩家宠物 _this.playerRoles = []; //敌方宠物 _this.enemyRoles = []; //地图信息 _this.mapInfo = void 0; //每一波怪的距离 _this.everyX = 600; //下一波怪的对战位置X _this._nextFightX = 0; _this.fsm = void 0; //是否允许攻击 _this.isAllowAttack = false; return _this; } var _proto = GOnHookMode.prototype; //添加监听事件 _proto.addEvent = function addEvent() { app.event.on(PlayerTacticalEvent.UPDATE_TACTICAL, this.onUpdatePlayerPet, this); } //移除监听事件 ; _proto.onDestroy = function onDestroy() { _GBaseMode.prototype.onDestroy.call(this); app.event.off(PlayerTacticalEvent.UPDATE_TACTICAL, this.onUpdatePlayerPet, this); }; _proto.onSyncInitSuccess = function onSyncInitSuccess() { //初始化战斗 console.log("GOnHookMode 模式初始化"); //调整相机 var camreaPos = this.camera.node.worldPosition; this.camera.node.worldPosition = v3(0, 800, camreaPos.z); //初始化状态机 this.fsm = new GFSMOnHookMode(this); //初始化地图 this.mapInfo = TD.TbGMap.get(60001); var scale = this.mapInfo.scale; this.map1.init(app.battleRes.maps[60001][0], 1, app.battleRes.maps[60001][0].width * scale, app.battleRes.maps[60001][0].height * scale); this.map2.init(app.battleRes.maps[60001][1], 1, app.battleRes.maps[60001][1].width * scale, app.battleRes.maps[60001][1].height * scale); this.map3.init(app.battleRes.maps[60001][2], 1, app.battleRes.maps[60001][1].width * scale, 1048 * scale); this.onUpdateMap(0); this.playerInfo = { tactical: GTactical.getTactical().setOffset(this.playerPos) }; this.enemyInfo = { tactical: GTactical.getTactical(true).setOffset(this.enemyPos) }; this.onUpdatePlayerPet(); //添加监听 this.addEvent(); // //模拟请求生成宠物 // app.socket.SendBack(GAction.MODE_ON_HOOK_SPAWN_PET,{ // type:GActionType.GOnHookPets, // fun:(info:GOnHookPets) => { // console.log("接受到野怪列表",info) // } // }) //生成玩家 // this.playerInfo.roles.forEach((info,index) => this.onGenRole(GOnHookModePlayerEnum.PLAYER,index + 1,info)) // //生成敌人 // this.onResetGenerateEnemy(); } //更新玩家宠物 ; _proto.onUpdatePlayerPet = function onUpdatePlayerPet() { var _this2 = this; //获取玩家阵容 var infos = PlayerTacticalData.getIns().getTacticalInfo(); //移除不再阵容中的宠物 var roles = [].concat(this.getOnesRoleAlive(GOnHookModePlayerEnum.PLAYER)); roles.forEach(function (role) { var expand = role.getComponent(GRoleOnHookPlayerExpand); //如果宠物不再阵容中 则 移除宠物 if (infos.indexOf(expand.petId) < 0) { //移除宠物 _this2.playerRoles.splice(_this2.playerRoles.indexOf(role), 1); role.isDie = true; } }); infos.forEach(function (petId, index) { if (petId) { _this2.onGenPlayerPet(index + 1, petId); } }); } //更新帧 ; _proto.onSyncUpdate = function onSyncUpdate(dt, frame, input) { _GBaseMode.prototype.onSyncUpdate.call(this, dt, frame, input); this.onUpdateMap(dt); this.onUpdateCamera(dt); this.fsm.onUpdate(dt, frame); } //更新地图 ; _proto.onUpdateMap = function onUpdateMap(dt) { var cameraX = this.camera.node.worldPosition.x; this.map1.UpdateMap(cameraX, 0, this.mapInfo.map1OffsetY); this.map2.UpdateMap(cameraX, cameraX / 10, this.mapInfo.map2OffsetY); this.map3.UpdateMap(cameraX, 0, this.mapInfo.map3OffsetY); } //更新相机逻辑 ; _proto.onUpdateCamera = function onUpdateCamera(dt) { //如果没有敌人相机永远锁定最前面的宠物 if (this.isAllowAttack && this.isHaveEnemy()) { //如果有敌人则移动到战斗位置 var cameraWorld = this.camera.node.worldPosition.clone(); this.camera.node.worldPosition = cameraWorld.lerp(v3(this.nextFightX, cameraWorld.y, cameraWorld.z), dt / 1000); } else { //获取冲到最前面的宠物 var roles = this.getOnesRoleAlive(GOnHookModePlayerEnum.PLAYER); var frontRole = roles.sort(function (role1, role2) { return role2.v2World.x - role1.v2World.x; })[0]; if (!frontRole) return; //设置相机 位置 var _cameraWorld = this.camera.node.worldPosition.clone(); this.camera.node.worldPosition = _cameraWorld.lerp(v3(frontRole.v2World.x, _cameraWorld.y, _cameraWorld.z), dt / 1000); } } //生成玩家宠物 ; _proto.onGenPlayerPet = function onGenPlayerPet(index, petId) { //如果场上有这个宠物则更新阵法位置 var passRole; this.playerRoles.forEach(function (role) { if (role.getComponent(GRoleOnHookPlayerExpand).petId == petId) passRole = role; }); if (passRole) { //更新宠物阵法位置 passRole.tacticalIndex = index; return; } //获取要生成的宠物 var info = PlayerPetData.getIns().petIdQueryPetInfo(petId); if (!info) { app.layer.Open(GUI.Tips, { text: "未拥有当前上阵的宠物" }); return; } var role = this.onGenRole(GOnHookModePlayerEnum.PLAYER, index, TD.TbGRole.get(info.petTbId)); //向宠物添加 OnHook 扩展 var expand = role.node.addComponent(GRoleOnHookPlayerExpand); expand.petId = petId; } //生成野怪 ; _proto.onGenCreeps = function onGenCreeps(index, creeps) { var role = this.onGenRole(GOnHookModePlayerEnum.ENEMY, index, TD.TbGRole.get(creeps.petTbId)); //向野怪添加扩展 var expand = role.node.addComponent(GRoleOnHookCreepsExpand); expand.creeps = creeps; } //生成宠物 ; _proto.onGenRole = function onGenRole(type, index, info) { var _this3 = this; var tactical = this.getInfo(type).tactical; var pos = this.getInfo(type).tactical.getPosition(index); if (!pos) return; var role = instantiate(this.rolePrefab); var entity = role.getComponent(GRoleDefault); //初始化 entity.onInit(type, info, tactical, index); //绑定寻敌 entity.onQueryEunmy = function () { return _this3.getEnumy(entity, type); }; //绑定死亡回调 entity.addKillBackEvent(this.onRoleKillBack.bind(this)); //绑定受击回调 entity.addHitCallback(this.onHitBack.bind(this)); this.addGObject(entity, tactical.getPosition(index)); this.getOnesRole(type).push(entity); return entity; } //获取配置 ; _proto.getInfo = function getInfo(type) { if (type == GOnHookModePlayerEnum.PLAYER) return this.playerInfo; if (type == GOnHookModePlayerEnum.ENEMY) return this.enemyInfo; } //获取阵营宠物 ; _proto.getOnesRole = function getOnesRole(type) { if (type == GOnHookModePlayerEnum.PLAYER) return this.playerRoles; if (type == GOnHookModePlayerEnum.ENEMY) return this.enemyRoles; } //获取存活的宠物 ; _proto.getOnesRoleAlive = function getOnesRoleAlive(type) { if (type == GOnHookModePlayerEnum.PLAYER) return this.playerRoles.filter(function (role) { return !!role.get(); }); if (type == GOnHookModePlayerEnum.ENEMY) return this.enemyRoles.filter(function (role) { return !!role.get(); }); } //获取敌人 ; _proto.getEnumy = function getEnumy(player, type) { if (!this.isAllowAttack) return null; var enumyOnes = GOnHookModePlayerEnum.ENEMY; //如果是ENEMY 则 它的敌人是 PLAYER if (type == GOnHookModePlayerEnum.ENEMY) enumyOnes = GOnHookModePlayerEnum.PLAYER; //获取敌人 var roles = this.getOnesRoleAlive(enumyOnes); //通过距离获取最近的敌人 if (roles[0]) { var len = Math.abs(Vec2.distance(player.v2World, roles[0].v2World)); var enumy = roles[0]; for (var index = 0; index < roles.length; index++) { var role = roles[index]; var tLen = void 0; if (tLen = Math.abs(Vec2.distance(player.v2World, role.v2World)) < len) { enumy = role; len = tLen; } } return enumy; } else { return null; } } //生成敌人 ; _proto.onResetGenerateEnemy = function onResetGenerateEnemy() { this.enemyRoles = []; //获取敌人 var creeps = GOnHookManager.getIns().getNextCreeps(); if (!creeps) return; //没有获取到野怪则返回 this.onGenCreeps(2, creeps); // this.enemyInfo.roles.forEach((info,index) => this.onGenRole(GOnHookModePlayerEnum.ENEMY,index + 1,info)); } //角色死亡回调 ; _proto.onRoleKillBack = function onRoleKillBack(role) { //死亡销毁 JNFrameTime.getInstance().setTimeout(function () { if (role.isValid) role.node.destroy(); }, 3000); //如果死亡的是野怪则通知野怪死亡 if (role.getComponent(GRoleOnHookCreepsExpand)) { GOnHookManager.getIns().onKillSreeps(role.getComponent(GRoleOnHookCreepsExpand).creeps); } //清理 this.onClearCache(); } //角色受击回调 ; _proto.onHitBack = function onHitBack(role, hit) { if (!role.get()) return; //添加受击显示 app.event.emit(ModeRenderEvent.HIT, role.v2World.clone(), hit); } //清理缓存 ; _proto.onClearCache = function onClearCache() { var _this4 = this; //清理宠物 var roles = [].concat(this.playerRoles); roles.forEach(function (role) { if (!role.get()) { _this4.playerRoles.splice(_this4.playerRoles.indexOf(role), 1); } }); roles = [].concat(this.enemyRoles); roles.forEach(function (role) { if (!role.get()) { _this4.enemyRoles.splice(_this4.enemyRoles.indexOf(role), 1); } }); } //是否有怪物 ; _proto.isHaveEnemy = function isHaveEnemy() { if (!this.isAllowAttack) return []; return this.getOnesRoleAlive(GOnHookModePlayerEnum.ENEMY).filter(function (role) { return !!role.get(); }).length > 0; } //前往下一个目标 ; _proto.onNextTarget = function onNextTarget() { //下一个目标点 this.nextFightX = this.nextFightX + this.everyX; }; _createClass(GOnHookMode, [{ key: "scene", get: function get() { return this.objects; } }, { key: "nextFightX", get: function get() { return this._nextFightX; }, set: function set(value) { //修改玩家阵法位置 this.playerInfo.tactical.setOffset(this.playerPos.clone().add(v2(value, 0))); this.enemyInfo.tactical.setOffset(this.enemyPos.clone().add(v2(value, 0))); this._nextFightX = value; } }]); return GOnHookMode; }(GBaseMode), (_descriptor$h = _applyDecoratedDescriptor(_class2$g.prototype, "rolePrefab", [_dec2$k], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$8 = _applyDecoratedDescriptor(_class2$g.prototype, "map1", [_dec3$9], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3$6 = _applyDecoratedDescriptor(_class2$g.prototype, "map2", [_dec4$6], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor4$3 = _applyDecoratedDescriptor(_class2$g.prototype, "map3", [_dec5$2], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor5$3 = _applyDecoratedDescriptor(_class2$g.prototype, "objects", [_dec6$2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class2$g)) || _class$B); cclegacy._RF.pop(); var _dec$C, _dec2$l, _dec3$a, _class$C, _class2$h, _descriptor$i, _descriptor2$9; cclegacy._RF.push({}, "31e6dKeQdRNfaJKs3+cDKq9", "GPVPMode", undefined); var ccclass$n = _decorator.ccclass, property$i = _decorator.property; //PVP 角色 var GPVPModePlayerEnum = /*#__PURE__*/function (GPVPModePlayerEnum) { GPVPModePlayerEnum[GPVPModePlayerEnum["PLAYER"] = 0] = "PLAYER"; GPVPModePlayerEnum[GPVPModePlayerEnum["ENEMY"] = 1] = "ENEMY"; return GPVPModePlayerEnum; }({}); //敌人 //PVP 玩家信息 /** * PVP 模式 */ var GPVPMode = (_dec$C = ccclass$n('GPVPMode'), _dec2$l = property$i(Prefab), _dec3$a = property$i(Node), _dec$C(_class$C = (_class2$h = /*#__PURE__*/function (_GBaseMode) { _inheritsLoose(GPVPMode, _GBaseMode); function GPVPMode() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _GBaseMode.call.apply(_GBaseMode, [this].concat(args)) || this; _initializerDefineProperty(_this, "rolePrefab", _descriptor$i, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "objects", _descriptor2$9, _assertThisInitialized(_this)); //玩家信息 _this.playerInfo = void 0; //敌方信息 _this.enemyInfo = void 0; //玩家宠物 _this.playerRoles = []; //敌方宠物 _this.enemyRoles = []; //玩家位置 _this.playerPos = new Vec2(-400, 0); //敌方位置 _this.enemyPos = new Vec2(400, 0); //是否结束游戏 _this.isEndGame = false; return _this; } var _proto = GPVPMode.prototype; _proto.onLoad = function onLoad() { //整理GPVPStart数据 //宠物Id列表 var leftTactical = JSON.parse(this.data.leftTactical); var rightTactical = JSON.parse(this.data.rightTactical); //宠物列表 var leftTbs = JSON.parse(this.data.leftTactical); var rightTbs = JSON.parse(this.data.rightTactical); //玩家宠物信息 for (var index = 0; index < leftTactical.length; index++) { var petId = leftTactical[index]; if (petId != 0) { var pet = JSON.parse(this.data.leftPets[petId]); leftTbs[index] = TD.TbGRole.get(pet.petTbId); } else { leftTbs[index] = null; } } for (var _index = 0; _index < rightTactical.length; _index++) { var _petId = rightTactical[_index]; if (_petId != 0) { var _pet = JSON.parse(this.data.leftPets[_petId]); rightTbs[_index] = TD.TbGRole.get(_pet.petTbId); } else { rightTbs[_index] = null; } } this.playerInfo = { tactical: GTactical.getTactical().setOffset(this.playerPos), roles: leftTbs }; this.enemyInfo = { tactical: GTactical.getTactical(true).setOffset(this.enemyPos), roles: rightTbs }; _GBaseMode.prototype.onLoad.call(this); }; _proto.onSyncInitSuccess = function onSyncInitSuccess() { var _this2 = this; //调整相机 var camreaPos = this.camera.node.worldPosition; this.camera.node.worldPosition = v3(0, 800, camreaPos.z); //初始化战斗 console.log("GPVPMode 模式初始化"); //生成宠物 this.playerInfo.roles.forEach(function (info, index) { return info && _this2.onGenRole(GPVPModePlayerEnum.PLAYER, index + 1, info); }); this.enemyInfo.roles.forEach(function (info, index) { return info && _this2.onGenRole(GPVPModePlayerEnum.ENEMY, index + 1, info); }); } //生成角色 ; _proto.onGenRole = function onGenRole(type, index, info) { var _this3 = this; var tactical = this.getInfo(type).tactical; var pos = this.getInfo(type).tactical.getPosition(index); if (!pos) return; var role = instantiate(this.rolePrefab); var entity = role.getComponent(GRoleDefault); //初始化 entity.onInit(type, info, tactical, index); //绑定寻敌 entity.onQueryEunmy = function () { return _this3.getEnumy(entity, type); }; //绑定受击回调 entity.addHitCallback(this.onHitBack.bind(this)); //绑定死亡回调 entity.addKillBackEvent(this.onRoleKillBack.bind(this)); this.addGObject(entity, tactical.getPosition(index)); this.getOnesRole(type).push(entity); } //获取配置 ; _proto.getInfo = function getInfo(type) { if (type == GPVPModePlayerEnum.PLAYER) return this.playerInfo; if (type == GPVPModePlayerEnum.ENEMY) return this.enemyInfo; } //获取阵营角色 ; _proto.getOnesRole = function getOnesRole(type) { if (type == GPVPModePlayerEnum.PLAYER) return this.playerRoles; if (type == GPVPModePlayerEnum.ENEMY) return this.enemyRoles; } //获取存活的宠物 ; _proto.getOnesRoleAlive = function getOnesRoleAlive(type) { if (type == GPVPModePlayerEnum.PLAYER) return this.playerRoles.filter(function (role) { return !!role.get(); }); if (type == GPVPModePlayerEnum.ENEMY) return this.enemyRoles.filter(function (role) { return !!role.get(); }); } //获取敌人 ; _proto.getEnumy = function getEnumy(player, type) { var enumyOnes = GPVPModePlayerEnum.ENEMY; //如果是ENEMY 则 它的敌人是 PLAYER if (type == GPVPModePlayerEnum.ENEMY) enumyOnes = GPVPModePlayerEnum.PLAYER; //获取敌人 var roles = this.getOnesRoleAlive(enumyOnes); //通过距离获取最近的敌人 if (roles[0]) { var len = Math.abs(Vec2.distance(player.v2World, roles[0].v2World)); var enumy = roles[0]; for (var index = 0; index < roles.length; index++) { var role = roles[index]; var tLen = void 0; if (tLen = Math.abs(Vec2.distance(player.v2World, role.v2World)) < len) { enumy = role; len = tLen; } } return enumy; } else { return null; } } //角色死亡回调 ; _proto.onRoleKillBack = function onRoleKillBack(role) { //死亡销毁 JNFrameTime.getInstance().setTimeout(function () { if (role.isValid) role.node.destroy(); }, 3000); this.onUpdateEndState(); } //刷新结束状态 ; _proto.onUpdateEndState = function onUpdateEndState() { var _this4 = this; //如果已经结束则返回 if (this.isEndGame) return; //判断是否有队伍都死亡 if (this.getOnesRoleAlive(GPVPModePlayerEnum.PLAYER).length == 0 || this.getOnesRoleAlive(GPVPModePlayerEnum.ENEMY).length == 0) { this.isEndGame = true; //结束游戏 JNFrameTime.getInstance().setTimeout(function () { _this4.Close(); }, 3000); } } //角色受击回调 ; _proto.onHitBack = function onHitBack(role, hit) { if (!role.get()) return; //添加受击显示 app.event.emit(ModeRenderEvent.HIT, role.v2World.clone(), hit); }; _createClass(GPVPMode, [{ key: "scene", get: function get() { return this.objects; } }]); return GPVPMode; }(GBaseMode), (_descriptor$i = _applyDecoratedDescriptor(_class2$h.prototype, "rolePrefab", [_dec2$l], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$9 = _applyDecoratedDescriptor(_class2$h.prototype, "objects", [_dec3$a], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class2$h)) || _class$C); cclegacy._RF.pop(); cclegacy._RF.push({}, "772c2FoloVFZ5Kwk8sAuNZ5", "HttpCode", undefined); cclegacy._RF.pop(); cclegacy._RF.push({}, "ef14djFn1NPQrrrHGY75fKD", "NoviceManager", undefined); var NoviceManager = /*#__PURE__*/function (_Singleton) { _inheritsLoose(NoviceManager, _Singleton); function NoviceManager() { return _Singleton.apply(this, arguments) || this; } var _proto = NoviceManager.prototype; //新手引导执行 _proto.onStart = /*#__PURE__*/function () { var _onStart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (PlayerData.getIns().data.novice) { _context.next = 3; break; } _context.next = 3; return app.layer.OpenToClose(GUI.NoviceNamingView); case 3: if (!(PlayerPetData.getIns().getData().length == 0)) { _context.next = 6; break; } _context.next = 6; return app.layer.OpenToClose(GUI.NoviceSelectPetView); case 6: console.log("新手引导结束"); case 7: case "end": return _context.stop(); } }, _callee); })); function onStart() { return _onStart.apply(this, arguments); } return onStart; }(); return NoviceManager; }(Singleton); cclegacy._RF.pop(); var _dec$D, _dec2$m, _class$D, _class2$i, _descriptor$j; cclegacy._RF.push({}, "b3809FuWrhB2ovECDdqMTOs", "PetIcon", undefined); var ccclass$o = _decorator.ccclass, property$j = _decorator.property; var PetIcon = (_dec$D = ccclass$o('PetIcon'), _dec2$m = property$j(sp.Skeleton), _dec$D(_class$D = (_class2$i = /*#__PURE__*/function (_Component) { _inheritsLoose(PetIcon, _Component); function PetIcon() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "spine", _descriptor$j, _assertThisInitialized(_this)); return _this; } var _proto = PetIcon.prototype; //设置icon _proto.setIcon = function setIcon(petTbId) { this.spine.skeletonData = app.battleRes.roleSpine[petTbId]; this.spine.setAnimation(0, UIPetAnim.std, true); }; return PetIcon; }(Component), _descriptor$j = _applyDecoratedDescriptor(_class2$i.prototype, "spine", [_dec2$m], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$i)) || _class$D); cclegacy._RF.pop(); var _dec$E, _dec2$n, _dec3$b, _dec4$7, _class$E, _class2$j, _descriptor$k, _descriptor2$a, _descriptor3$7; cclegacy._RF.push({}, "7c665fcvLRGDqzjhgvUI4oN", "PetIconSelect", undefined); var ccclass$p = _decorator.ccclass, property$k = _decorator.property; var PetIconSelect = (_dec$E = ccclass$p('PetIconSelect'), _dec2$n = property$k(PetIcon), _dec3$b = property$k(Node), _dec4$7 = property$k(Node), _dec$E(_class$E = (_class2$j = /*#__PURE__*/function (_Component) { _inheritsLoose(PetIconSelect, _Component); function PetIconSelect() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; _initializerDefineProperty(_this, "petIcon", _descriptor$k, _assertThisInitialized(_this)); //选中节点 _initializerDefineProperty(_this, "select", _descriptor2$a, _assertThisInitialized(_this)); //不可选中节点 _initializerDefineProperty(_this, "noselect", _descriptor3$7, _assertThisInitialized(_this)); //是否被选中 _this._isSelect = false; //是否不可选中 _this._isNoSelect = false; return _this; } var _proto = PetIconSelect.prototype; _proto.onLoad = function onLoad() { this.onUpdateSelect(); this.noselect.active = false; this.select.active = false; } //设置icon ; _proto.setIcon = function setIcon(petTbId) { this.petIcon.setIcon(petTbId); }; _proto.onUpdateSelect = function onUpdateSelect() { this.select.active = this.isSelect; this.noselect.active = this.isNoSelect; }; _createClass(PetIconSelect, [{ key: "isSelect", get: function get() { return this._isSelect; }, set: function set(data) { this._isSelect = data; this.onUpdateSelect(); } }, { key: "isNoSelect", get: function get() { return this._isNoSelect; }, set: function set(data) { this._isNoSelect = data; this.onUpdateSelect(); } }]); return PetIconSelect; }(Component), (_descriptor$k = _applyDecoratedDescriptor(_class2$j.prototype, "petIcon", [_dec2$n], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$a = _applyDecoratedDescriptor(_class2$j.prototype, "select", [_dec3$b], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3$7 = _applyDecoratedDescriptor(_class2$j.prototype, "noselect", [_dec4$7], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$j)) || _class$E); cclegacy._RF.pop(); var _dec$F, _dec2$o, _dec3$c, _class$F, _class2$k, _descriptor$l, _descriptor2$b; cclegacy._RF.push({}, "dd6ff3gNGFAzKeTlGPK1jnx", "PlayerResourceShow", undefined); var ccclass$q = _decorator.ccclass, property$l = _decorator.property; var PlayerResourceShow = (_dec$F = ccclass$q('PlayerResourceShow'), _dec2$o = property$l({ type: Enum(ResourceType) }), _dec3$c = property$l(Label), _dec$F(_class$F = (_class2$k = /*#__PURE__*/function (_Component) { _inheritsLoose(PlayerResourceShow, _Component); function PlayerResourceShow() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //显示的资源 _initializerDefineProperty(_this, "type", _descriptor$l, _assertThisInitialized(_this)); //显示文本 _initializerDefineProperty(_this, "show", _descriptor2$b, _assertThisInitialized(_this)); return _this; } var _proto = PlayerResourceShow.prototype; _proto.onLoad = function onLoad() { //更新 this.onUpdateView(); //监听 app.event.on(ResourceEvent.UPDATE, this.onUpdateView, this); }; _proto.onDestroy = function onDestroy() { app.event.off(ResourceEvent.UPDATE, this.onUpdateView, this); } //刷新 ; _proto.onUpdateView = function onUpdateView() { //更新资源数量 this.show.string = "" + ResourceData.getIns().getValue(this.type); }; return PlayerResourceShow; }(Component), (_descriptor$l = _applyDecoratedDescriptor(_class2$k.prototype, "type", [_dec2$o], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ResourceType.Gold; } }), _descriptor2$b = _applyDecoratedDescriptor(_class2$k.prototype, "show", [_dec3$c], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$k)) || _class$F); cclegacy._RF.pop(); var _dec$G, _class$G; cclegacy._RF.push({}, "a3a9dIzSOFPPpmZbiL9N5+m", "JNodeDrag", undefined); var ccclass$r = _decorator.ccclass, property$m = _decorator.property; /** * 拖拽组件 */ var JNodeDrag = (_dec$G = ccclass$r('JNodeDrag'), _dec$G(_class$G = /*#__PURE__*/function (_Component) { _inheritsLoose(JNodeDrag, _Component); function JNodeDrag() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //原始位置 _this.original = void 0; //开始接触时候的位置 _this.startTouchPos = void 0; //是否拖拽了 _this.isMove = false; //是否触摸 _this.isTouch = false; //添加移动回调 _this.moveFuns = []; //添加移动结束回调 _this.moveEndFuns = []; return _this; } var _proto = JNodeDrag.prototype; _proto.addMoveEvent = function addMoveEvent(fun) { this.moveFuns.push(fun); }; _proto.addMoveEndEvent = function addMoveEndEvent(fun) { this.moveEndFuns.push(fun); }; _proto.onLoad = function onLoad() { this.original = this.original || this.node.position.clone(); //添加拖拽事件 this.node.on(NodeEventType.TOUCH_START, this.onTouchStart, this); this.node.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this); this.node.on(NodeEventType.TOUCH_END, this.onTouchEnd, this); this.node.on(NodeEventType.TOUCH_CANCEL, this.onTouchEnd, this); } //传入UI位置返回位置 ; _proto.getPosition = function getPosition(ui) { return Object.assign(v2(), this.node.parent.getComponent(UITransform).convertToNodeSpaceAR(v3(ui.x, ui.y))); } //触摸开始 ; _proto.onTouchStart = function onTouchStart() { this.startTouchPos = this.node.position.clone(); this.isMove = false; this.isTouch = true; } //触摸移动 ; _proto.onTouchMove = function onTouchMove(e) { var start = this.getPosition(e.getUIStartLocation()); var move = this.getPosition(e.getUILocation()); //移动了标记移动了 if (!e.getUIStartLocation().equals(e.getUILocation())) this.isMove = true; var diff = move.subtract(start); this.node.position = this.startTouchPos.clone().add(v3(diff.x, diff.y, 0)); //移动事件通知 this.moveFuns.forEach(function (fun) { return fun(e); }); } //触摸结束 ; _proto.onTouchEnd = function onTouchEnd(e) { console.log("触摸结束"); this.isTouch = false; //结束之后回到原始位置 this.onReturnAnim(); //移动结束通知 this.moveEndFuns.forEach(function (fun) { return fun(e); }); }; _proto.onReturnAnim = function onReturnAnim() { if (this.isTouch) return; //回到原始位置 tween(this.node).to(.25, { position: this.original }).start(); } //更新原始点 ; _proto.onUpdateOriginal = function onUpdateOriginal(original) { if (this.original.equals(original)) return; this.original = original; this.onReturnAnim(); }; return JNodeDrag; }(Component)) || _class$G); cclegacy._RF.pop(); var _dec$H, _dec2$p, _dec3$d, _dec4$8, _class$H, _class2$l, _descriptor$m, _descriptor2$c, _descriptor3$8; cclegacy._RF.push({}, "78c308a0dBCEJ/E9wZzZPJq", "PlayerTacticalItem", undefined); var ccclass$s = _decorator.ccclass, property$n = _decorator.property; var PlayerTacticalItem = (_dec$H = ccclass$s('PlayerTacticalItem'), _dec2$p = property$n(Node), _dec3$d = property$n(Node), _dec4$8 = property$n(JNodeDrag), _dec$H(_class$H = (_class2$l = /*#__PURE__*/function (_Component) { _inheritsLoose(PlayerTacticalItem, _Component); function PlayerTacticalItem() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //阵法的Index; _this.index = void 0; //没有宠物的节点 _initializerDefineProperty(_this, "noPet", _descriptor$m, _assertThisInitialized(_this)); //有宠物的节点 _initializerDefineProperty(_this, "havePet", _descriptor2$c, _assertThisInitialized(_this)); //拖拽 _initializerDefineProperty(_this, "drag", _descriptor3$8, _assertThisInitialized(_this)); //当前上阵的宠物 _this.petId = void 0; //初始位置 _this.initPos = void 0; return _this; } var _proto = PlayerTacticalItem.prototype; //初始化阵法 _proto.onInit = function onInit(index) { this.index = index; this.initPos = this.node.position; }; _proto.start = function start() { this.onUpdateView(); } //更新信息 ; _proto.onUpdateView = function onUpdateView() { //获取阵法下的宠物 this.petId = PlayerTacticalData.getIns().getItem(this.index); //如果为0则没有宠物 if (this.petId) { this.havePet.active = true; this.noPet.active = false; this.onUpdatePetView(); } else { this.noPet.active = true; this.havePet.active = false; } } //更新宠物信息 ; _proto.onUpdatePetView = function onUpdatePetView() { var spine = this.havePet.getComponentInChildren(sp.Skeleton); //获取宠物信息 var info = PlayerPetData.getIns().petIdQueryPetInfo(this.petId); spine.skeletonData = app.battleRes.roleSpine[info.petTbId]; spine.setAnimation(0, UIPetAnim.std, true); } //打开选择阵法宠物 ; _proto.onClick = function onClick() { var _this2 = this; //如果拖拽了则不生效点击事件 if (this.drag.isMove) return; //如果没有宠物则弹出选择宠物 负责 删除宠物 if (this.petId) { //移除宠物 //提示是否移除宠物 app.layer.Open(GUI.SelectionBox, { tigText: "是否移除宠物?", cancel: function cancel() {}, confirm: function () { var _confirm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return PlayerTacticalData.getIns().UpdateIndexTactical(_this2.index, 0); case 2: case "end": return _context.stop(); } }, _callee); })); function confirm() { return _confirm.apply(this, arguments); } return confirm; }() }); } else { //选择宠物 app.layer.Open(GUI.IntoBattleView, { index: this.index //当前选择的阵法下标 }); } } //交换阵法 ; _proto.onExchange = function onExchange(item) { var rootIndex = this.index; this.index = item.index; item.index = rootIndex; //更新拖拽位置 var rootOriginal = this.drag.original; this.drag.onUpdateOriginal(item.drag.original); item.drag.onUpdateOriginal(rootOriginal); }; _proto.addMoveEvent = function addMoveEvent(fun) { var _this3 = this; this.drag.addMoveEvent(function (e) { fun(_this3, e); }); }; _proto.addMoveEndEvent = function addMoveEndEvent(fun) { var _this4 = this; this.drag.addMoveEndEvent(function (e) { fun(_this4, e); }); }; return PlayerTacticalItem; }(Component), (_descriptor$m = _applyDecoratedDescriptor(_class2$l.prototype, "noPet", [_dec2$p], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$c = _applyDecoratedDescriptor(_class2$l.prototype, "havePet", [_dec3$d], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3$8 = _applyDecoratedDescriptor(_class2$l.prototype, "drag", [_dec4$8], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$l)) || _class$H); cclegacy._RF.pop(); var _dec$I, _class$I; cclegacy._RF.push({}, "a93723onHFJLq9yzuZv1eBF", "PlayerTacticalView", undefined); var ccclass$t = _decorator.ccclass, property$o = _decorator.property; /** * 玩家阵法 */ var PlayerTacticalView = (_dec$I = ccclass$t('PlayerTacticalView'), _dec$I(_class$I = /*#__PURE__*/function (_Component) { _inheritsLoose(PlayerTacticalView, _Component); function PlayerTacticalView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //阵法子节点列表 _this.items = []; return _this; } var _proto = PlayerTacticalView.prototype; _proto.onLoad = function onLoad() { var _this2 = this; //阵法 this.items = this.node.getComponentsInChildren(PlayerTacticalItem); this.items.forEach(function (item, index) { item.onInit(index); //初始化阵法下标 //添加移动事件 item.addMoveEvent(_this2.onMoveItem.bind(_this2)); //添加移动结束事件 item.addMoveEndEvent(_this2.onMoveEndItem.bind(_this2)); }); this.onUpdateView(); this.onEvent(); } //移动子节点 ; _proto.onMoveItem = function onMoveItem(root, e) { //获取接触的节点(除了自己) this.items.forEach(function (item) { //排除自己 if (item == root) return; //排除在移动的节点 if (!item.node.position.equals(item.drag.original)) return; //检测接触 if (item.getComponent(UITransform).isHit(e.getUILocation())) { //如果手指接触了 则 将接触的阵法移动到自己 item.onExchange(root); } }); } //子节点移动结束 ; _proto.onMoveEndItem = /*#__PURE__*/function () { var _onMoveEndItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var pets; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: //移动结束则保存阵法 pets = PlayerTacticalData.getIns().getInitTacticalInfo(); this.items.forEach(function (item) { pets[item.index] = item.petId || 0; }); _context.next = 4; return PlayerTacticalData.getIns().UpdateTactical(pets); case 4: if (!_context.sent) { _context.next = 6; break; } app.layer.Open(GUI.Tips, { text: "保存阵法成功" }); case 6: case "end": return _context.stop(); } }, _callee, this); })); function onMoveEndItem() { return _onMoveEndItem.apply(this, arguments); } return onMoveEndItem; }(); _proto.onDestroy = function onDestroy() { this.offEvent(); } //添加监听 ; _proto.onEvent = function onEvent() { app.event.on(PlayerTacticalEvent.UPDATE_TACTICAL, this.onUpdateView, this); } //移除监听 ; _proto.offEvent = function offEvent() { app.event.off(PlayerTacticalEvent.UPDATE_TACTICAL, this.onUpdateView, this); } //更新阵法显示 ; _proto.onUpdateView = function onUpdateView() { this.items.forEach(function (item) { item.onUpdateView(); }); }; return PlayerTacticalView; }(Component)) || _class$I); cclegacy._RF.pop(); var _dec$J, _dec2$q, _dec3$e, _class$J, _class2$m, _descriptor$n, _descriptor2$d; cclegacy._RF.push({}, "e1d16dgPwNMG6XbZzTQUsMn", "JScrollExceedHide", undefined); var ccclass$u = _decorator.ccclass, property$p = _decorator.property; /** * 超出隐藏 可简单的实现虚拟列表 */ var JScrollExceedHide = (_dec$J = ccclass$u('JScrollExceedHide'), _dec2$q = property$p(UITransform), _dec3$e = property$p(Node), _dec$J(_class$J = (_class2$m = /*#__PURE__*/function (_Component) { _inheritsLoose(JScrollExceedHide, _Component); function JScrollExceedHide() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //列表 _this.scroll = void 0; _initializerDefineProperty(_this, "view", _descriptor$n, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "content", _descriptor2$d, _assertThisInitialized(_this)); //上次更新的数量 _this.lastUpdate = 0; return _this; } var _proto = JScrollExceedHide.prototype; _proto.onLoad = function onLoad() { var _this2 = this; this.scheduleOnce(function () { _this2.scroll = _this2.getComponent(ScrollView); _this2.scroll.node.on('scrolling', _this2.onScrolling, _this2); _this2.onScrolling(); }); } //滑动事件 ; _proto.onScrolling = function onScrolling() { this.onUpdate(); }; _proto.onUpdate = function onUpdate() { var children = this.content.children; //动态隐藏显示 //获取 view 最高高度 和 最低高度 var viewWorld = this.view.node.worldPosition; var viewSize = this.view.contentSize; var anchorPoint = this.view.anchorPoint; var top = viewWorld.y + viewSize.height / 2 * (2 - anchorPoint.y * 2); var bottom = viewWorld.y - viewSize.height / 2 * (anchorPoint.y * 2); var right = viewWorld.x + viewSize.width / 2 * (2 - anchorPoint.x * 2); var left = viewWorld.x - viewSize.width / 2 * (anchorPoint.x * 2); children.forEach(function (child) { var childRect = child.getComponent(UITransform).getBoundingBoxToWorld(); var ctop = childRect.center.y + childRect.height / 2; var cbottom = childRect.center.y - childRect.height / 2; var cright = childRect.center.x + childRect.width / 2; var cleft = childRect.center.x - childRect.width / 2; var opacity; if (!(opacity = child.getComponent(UIOpacity))) { opacity = child.addComponent(UIOpacity); } //如果在框里面则显示 否则隐藏 if ((top >= ctop && bottom <= ctop || top >= cbottom && bottom <= cbottom //Y 在内容中间 ) && (right >= cright && left <= cright || right >= cleft && left <= cleft) //X 在内容中间 ) { opacity.opacity = 255; } else { opacity.opacity = 0; } }); }; return JScrollExceedHide; }(Component), (_descriptor$n = _applyDecoratedDescriptor(_class2$m.prototype, "view", [_dec2$q], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$d = _applyDecoratedDescriptor(_class2$m.prototype, "content", [_dec3$e], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$m)) || _class$J); cclegacy._RF.pop(); var _dec$K, _dec2$r, _dec3$f, _dec4$9, _class$K, _class2$n, _descriptor$o, _descriptor2$e, _descriptor3$9; cclegacy._RF.push({}, "ec6f0yWsr5CypPnEboLemYl", "MainChatView", undefined); var ccclass$v = _decorator.ccclass, property$q = _decorator.property; var MainChatView = (_dec$K = ccclass$v('MainChatView'), _dec2$r = property$q(Node), _dec3$f = property$q(Prefab), _dec4$9 = property$q(EditBox), _dec$K(_class$K = (_class2$n = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(MainChatView, _JNGLayerBase); function MainChatView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "content", _descriptor$o, _assertThisInitialized(_this)); //聊天内容 _initializerDefineProperty(_this, "chatPrefab", _descriptor2$e, _assertThisInitialized(_this)); //聊天预制体 _initializerDefineProperty(_this, "inputMessage", _descriptor3$9, _assertThisInitialized(_this)); return _this; } var _proto = MainChatView.prototype; //聊天输入框 _proto.onJNLoad = function onJNLoad(data) { _JNGLayerBase.prototype.onJNLoad.call(this, data); this.onInitUpdate(); //监听消息 ChatData.getIns().on(this.onMessage.bind(this), this); }; _proto.onJNClose = function onJNClose() { _JNGLayerBase.prototype.onJNClose.call(this); ChatData.getIns().off(this.onMessage.bind(this), this); } //初始化聊天显示 ; _proto.onInitUpdate = function onInitUpdate() { var _this2 = this; this.content.destroyAllChildren(); var messages = ChatData.getIns().datas; messages.forEach(function (message) { var node = instantiate(_this2.chatPrefab); node.getComponent(Label).string = message; _this2.content.addChild(node); }); } //发送消息 ; _proto.onClickSendMessage = function onClickSendMessage() { if (!this.inputMessage.string) { app.layer.Open(GUI.Tips, { text: "请输入内容" }); return; } ChatData.getIns().onSend({ message: this.inputMessage.string }); } //接受到消息 ; _proto.onMessage = function onMessage(info) { var _this3 = this; //插入数据 var node = instantiate(this.chatPrefab); node.getComponent(Label).string = info.message; this.content.addChild(node); this.scheduleOnce(function () { _this3.getComponentInChildren(JScrollExceedHide).onUpdate(); }); }; return MainChatView; }(JNGLayerBase), (_descriptor$o = _applyDecoratedDescriptor(_class2$n.prototype, "content", [_dec2$r], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$e = _applyDecoratedDescriptor(_class2$n.prototype, "chatPrefab", [_dec3$f], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3$9 = _applyDecoratedDescriptor(_class2$n.prototype, "inputMessage", [_dec4$9], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$n)) || _class$K); cclegacy._RF.pop(); var _dec$L, _dec2$s, _class$L, _class2$o, _descriptor$p; cclegacy._RF.push({}, "15051raQgZN6J5ICgY2OfSS", "HomeView", undefined); var ccclass$w = _decorator.ccclass, property$r = _decorator.property; var HomeView = (_dec$L = ccclass$w('HomeView'), _dec2$s = property$r(Label), _dec$L(_class$L = (_class2$o = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(HomeView, _JNGLayerBase); function HomeView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "frameText", _descriptor$p, _assertThisInitialized(_this)); return _this; } var _proto = HomeView.prototype; _proto.onLoad = /*#__PURE__*/function () { var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: case "end": return _context.stop(); } }, _callee); })); function onLoad() { return _onLoad.apply(this, arguments); } return onLoad; }(); _proto.update = function update() { this.frameText.string = "\u5F53\u524D\u5E27\u6570: " + app.sync.frame; } //设置移动 ; _proto.setRoleMove = function setRoleMove(data) { console.log("移动", data.isChecked); } //设置攻击 ; _proto.setRoleAttack = function setRoleAttack(data) { console.log("攻击", data.isChecked); } //重置 ; _proto.onClickReset = function onClickReset() { app.sync.onReset(); } //重置服务器帧 ; _proto.onClickResetServer = function onClickResetServer() { app.socket.Send(JNSyncAction.NSyncFrameReset); } //前往PVP ; _proto.onClickGoPVP = function onClickGoPVP() { director.getScene().getComponentInChildren(WorldCanvas).index = 0; app.layer.Open(GUI.Tips, { text: "切换成功 请点击重置" }); } //前往无尽 ; _proto.onClickGoOnHook = function onClickGoOnHook() { director.getScene().getComponentInChildren(WorldCanvas).index = 1; app.layer.Open(GUI.Tips, { text: "切换成功 请点击重置" }); } //清除Token ; _proto.onClickToken = function onClickToken() { StorageData.delect(StorageEnum.Token); app.layer.Open(GUI.Tips, { text: "清除成功" }); }; return HomeView; }(JNGLayerBase), _descriptor$p = _applyDecoratedDescriptor(_class2$o.prototype, "frameText", [_dec2$s], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$o)) || _class$L); cclegacy._RF.pop(); var _dec$M, _dec2$t, _class$M, _class2$p, _descriptor$q; cclegacy._RF.push({}, "b51bfKvsidNPKBbFirAFgQI", "MainView", undefined); var ccclass$x = _decorator.ccclass, property$s = _decorator.property; var MainView = (_dec$M = ccclass$x('MainView'), _dec2$t = property$s(Label), _dec$M(_class$M = (_class2$p = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(MainView, _JNGLayerBase); function MainView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "playerNameLabel", _descriptor$q, _assertThisInitialized(_this)); return _this; } var _proto = MainView.prototype; //玩家名称 _proto.onJNLoad = function onJNLoad(data) { //发送消息 ChatData.getIns().onSend({ message: PlayerData.getIns().data.playerId + " \u52A0\u5165\u6E38\u620F" }); this.onUpdateView(); } //更新UI界面 ; _proto.onUpdateView = function onUpdateView() { this.playerNameLabel.string = PlayerData.getIns().getInfo().playerName; } //打开Demo页面 ; _proto.onOpenDemo = function onOpenDemo() { app.layer.Open(GUI.Home); } //打开聊天页面 ; _proto.onOpenChat = function onOpenChat() { app.layer.Open(GUI.MainChat); } //点击打开无限模式 ; _proto.onOpenOnHook = function onOpenOnHook() { GBattleModeManager.getIns().Open(BattleMode.OnHook, true); } //点击PVP模式 ; _proto.onOpenPVP = function onOpenPVP() { app.socket.Send(GAction.S_MODE_PVP_JOIN); }; return MainView; }(JNGLayerBase), _descriptor$q = _applyDecoratedDescriptor(_class2$p.prototype, "playerNameLabel", [_dec2$t], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$p)) || _class$M); cclegacy._RF.pop(); cclegacy._RF.push({}, "cd19ccYjRJABKH8rmg7daLy", "JNScrollViewItem", undefined); var JNScrollViewItem = /*#__PURE__*/function (_Component) { _inheritsLoose(JNScrollViewItem, _Component); function JNScrollViewItem() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //数据 _this.data = void 0; return _this; } var _proto = JNScrollViewItem.prototype; _proto.onInit = function onInit(data) {}; return JNScrollViewItem; }(Component); cclegacy._RF.pop(); var _dec$N, _dec2$u, _class$N, _class2$q, _descriptor$r; cclegacy._RF.push({}, "590f9LG0/NBQ53k5HoSVyV6", "MainSreepsIcon", undefined); var ccclass$y = _decorator.ccclass, property$t = _decorator.property; var MainSreepsIcon = (_dec$N = ccclass$y('MainSreepsIcon'), _dec2$u = property$t(PetIconSelect), _dec$N(_class$N = (_class2$q = /*#__PURE__*/function (_JNScrollViewItem) { _inheritsLoose(MainSreepsIcon, _JNScrollViewItem); function MainSreepsIcon() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNScrollViewItem.call.apply(_JNScrollViewItem, [this].concat(args)) || this; _initializerDefineProperty(_this, "icon", _descriptor$r, _assertThisInitialized(_this)); return _this; } var _proto = MainSreepsIcon.prototype; _proto.start = function start() { this.icon.setIcon(this.data.petTbId); }; return MainSreepsIcon; }(JNScrollViewItem), _descriptor$r = _applyDecoratedDescriptor(_class2$q.prototype, "icon", [_dec2$u], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$q)) || _class$N); cclegacy._RF.pop(); var _dec$O, _dec2$v, _class$O, _class2$r, _descriptor$s; cclegacy._RF.push({}, "563f2c1JcVKmrpHhC0vl3PI", "JNScrollView", undefined); var ccclass$z = _decorator.ccclass, property$u = _decorator.property; //一个通过对象控制的 ScrollView //预制体必须拥有 JNScrollViewItem 组件 var JNScrollView = (_dec$O = ccclass$z('JNScrollView'), _dec2$v = property$u(Prefab), _dec$O(_class$O = (_class2$r = /*#__PURE__*/function (_ScrollView) { _inheritsLoose(JNScrollView, _ScrollView); function JNScrollView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _ScrollView.call.apply(_ScrollView, [this].concat(args)) || this; _initializerDefineProperty(_this, "itemPrefab", _descriptor$s, _assertThisInitialized(_this)); //预制体 _this.exceed = void 0; _this.events = {}; return _this; } var _proto = JNScrollView.prototype; _proto.onLoad = function onLoad() { //清除数据 this.content.destroyAllChildren(); //挂载虚拟列表组件 if (!this.node.getComponent(JScrollExceedHide)) { var exceed = this.node.addComponent(JScrollExceedHide); exceed.view = this.view; exceed.content = this.content; this.exceed = exceed; } } //刷新数据 ; _proto.refreshData = function refreshData(dataList) { var _this2 = this; //清除数据 this.content.destroyAllChildren(); //添加新数据 dataList.forEach(function (data) { var item = instantiate(_this2.itemPrefab); //获取 JNScrollViewItem 组件赋值 var itemSC = item.getComponent(JNScrollViewItem); itemSC.data = data; itemSC.onInit(itemSC.data); _this2.content.addChild(item); }); } //添加数据 ; _proto.addData = function addData(data) { var _this3 = this; var item = instantiate(this.itemPrefab); //获取 JNScrollViewItem 组件赋值 var itemSC = item.getComponent(JNScrollViewItem); itemSC.data = data; itemSC.onInit(itemSC.data); this.content.addChild(item); //添加事件 Object.keys(this.events).forEach(function (type) { item.off(type); item.on(type, function (e) { _this3.events[type](item.getSiblingIndex(), e); //传入下标和事件 }); }); //刷新虚拟列表 this.scheduleOnce(function () { return _this3.exceed.onUpdate(); }); } //删除数据 ; _proto.delData = function delData(data) { var _this4 = this; var items = this.getItems(); for (var index = 0; index < items.length; index++) { var child = items[index]; if (child.data == data) { //销毁 child.node.destroy(); } } //刷新虚拟列表 this.scheduleOnce(function () { return _this4.exceed.onUpdate(); }); } //获取列表中Item的组件 ; _proto.getItems = function getItems() { return this.content.getComponentsInChildren(JNScrollViewItem).filter(function (item) { return item.node.active && item.node.isValid; }); } //向Item 添加监听事件 ; _proto.addItemEvent = function addItemEvent(type, callback) { this.events[type] = callback; this.getItems().forEach(function (item) { item.node.off(type); item.node.on(type, function (e) { callback(item.node.getSiblingIndex(), e); //传入下标和事件 }); }); }; return JNScrollView; }(ScrollView), _descriptor$s = _applyDecoratedDescriptor(_class2$r.prototype, "itemPrefab", [_dec2$v], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$r)) || _class$O); cclegacy._RF.pop(); var _dec$P, _dec2$w, _class$P, _class2$s, _descriptor$t; cclegacy._RF.push({}, "fe2adMH7MZF5KXgR4KwvwJX", "MainSreepsList", undefined); var ccclass$A = _decorator.ccclass, property$v = _decorator.property; var MainSreepsList = (_dec$P = ccclass$A('MainSreepsList'), _dec2$w = property$v(JNScrollView), _dec$P(_class$P = (_class2$s = /*#__PURE__*/function (_Component) { _inheritsLoose(MainSreepsList, _Component); function MainSreepsList() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _Component.call.apply(_Component, [this].concat(args)) || this; //野怪列表 _initializerDefineProperty(_this, "views", _descriptor$t, _assertThisInitialized(_this)); //默认选择 _this.index = 0; return _this; } var _proto = MainSreepsList.prototype; _proto.onLoad = function onLoad() { //监听 野怪死亡 app.event.on(GOnHookManagerEvent.ADD_KILL_SREEP, this.onAddSreep, this); //监听 野怪删除 app.event.on(GOnHookManagerEvent.DEL_KILL_SREEP, this.onDelSreep, this); //添加子节点事件 this.views.addItemEvent(NodeEventType.TOUCH_END, this.onClickItem.bind(this)); }; _proto.onDestroy = function onDestroy() { //取消监听 app.event.off(GOnHookManagerEvent.ADD_KILL_SREEP, this.onAddSreep, this); app.event.on(GOnHookManagerEvent.DEL_KILL_SREEP, this.onDelSreep, this); } //添加野怪 ; _proto.onAddSreep = function onAddSreep(sreep) { this.views.addData(sreep); this.onUpdateView(); } //删除野怪 ; _proto.onDelSreep = function onDelSreep(sreep) { this.views.delData(sreep); this.onUpdateView(); } //刷新 ; _proto.onUpdateView = function onUpdateView() { var items = this.views.getItems(); if (items.length <= 0) return; //取消选中 items.forEach(function (item) { return item.icon.isSelect = false; }); //选中index if (items[this.index]) items[this.index].icon.isSelect = true; } //点击子节点 ; _proto.onClickItem = function onClickItem(index) { this.index = index; this.onUpdateView(); } //捕捉野怪 ; _proto.onClickCatch = /*#__PURE__*/function () { var _onClickCatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var item; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: //获取选中的野怪 item = this.views.getItems()[this.index]; if (item) { _context.next = 4; break; } app.layer.Open(GUI.Tips, { text: "请选择需要捕捉的宠物" }); return _context.abrupt("return"); case 4: _context.next = 6; return GOnHookManager.getIns().onCatchCreeps(item.data); case 6: if (!_context.sent) { _context.next = 8; break; } app.layer.Open(GUI.Tips, { text: "捕捉成功!" }); case 8: case "end": return _context.stop(); } }, _callee, this); })); function onClickCatch() { return _onClickCatch.apply(this, arguments); } return onClickCatch; }() //野怪出售 ; _proto.onClickSell = /*#__PURE__*/function () { var _onClickSell = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { var item; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: //获取选中的野怪 item = this.views.getItems()[this.index]; if (item) { _context2.next = 4; break; } app.layer.Open(GUI.Tips, { text: "请选择需要出售的宠物" }); return _context2.abrupt("return"); case 4: _context2.next = 6; return GOnHookManager.getIns().onSellCreeps(item.data); case 6: if (!_context2.sent) { _context2.next = 8; break; } app.layer.Open(GUI.Tips, { text: "出售成功!" }); case 8: case "end": return _context2.stop(); } }, _callee2, this); })); function onClickSell() { return _onClickSell.apply(this, arguments); } return onClickSell; }(); return MainSreepsList; }(Component), _descriptor$t = _applyDecoratedDescriptor(_class2$s.prototype, "views", [_dec2$w], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$s)) || _class$P); cclegacy._RF.pop(); var _dec$Q, _dec2$x, _dec3$g, _class$Q, _class2$t, _descriptor$u, _descriptor2$f; cclegacy._RF.push({}, "7b00a/4yERL/LgI4ZobxPAs", "LoadingView", undefined); var ccclass$B = _decorator.ccclass, property$w = _decorator.property; var LoadingView = (_dec$Q = ccclass$B('LoadingView'), _dec2$x = property$w(ProgressBar), _dec3$g = property$w(Label), _dec$Q(_class$Q = (_class2$t = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(LoadingView, _JNGLayerBase); function LoadingView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "progress", _descriptor$u, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "label", _descriptor2$f, _assertThisInitialized(_this)); //是否加载成功 _this.isOk = false; return _this; } var _proto = LoadingView.prototype; _proto.update = function update(dt) { if (app.loading.getCurrentInfo()) this.label.string = app.loading.getCurrentInfo().title; this.progress.progress = lerp(this.progress.progress, app.loading.progress(), dt); if (!this.isOk && app.loading.isAllSuccess()) { this.isOk = true; this.onSuccess(); } }; _proto.onSuccess = /*#__PURE__*/function () { var _onSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 2; return NoviceManager.getIns().onStart(); case 2: _context.next = 4; return app.layer.Open(GUI.Main); case 4: app.layer.Close(GUI.Loading); case 5: case "end": return _context.stop(); } }, _callee); })); function onSuccess() { return _onSuccess.apply(this, arguments); } return onSuccess; }(); return LoadingView; }(JNGLayerBase), (_descriptor$u = _applyDecoratedDescriptor(_class2$t.prototype, "progress", [_dec2$x], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$f = _applyDecoratedDescriptor(_class2$t.prototype, "label", [_dec3$g], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$t)) || _class$Q); cclegacy._RF.pop(); var _dec$R, _dec2$y, _class$R, _class2$u, _descriptor$v; cclegacy._RF.push({}, "9979dVt91REw44px2Tq6wqv", "PVPMatchView", undefined); var ccclass$C = _decorator.ccclass, property$x = _decorator.property; /** * 游戏匹配页面 */ var PVPMatchView = (_dec$R = ccclass$C('PVPMatchView'), _dec2$y = property$x(Node), _dec$R(_class$R = (_class2$u = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(PVPMatchView, _JNGLayerBase); function PVPMatchView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "content", _descriptor$v, _assertThisInitialized(_this)); return _this; } var _proto = PVPMatchView.prototype; _proto.onJNLoad = function onJNLoad(data) { _JNGLayerBase.prototype.onJNLoad.call(this, data); tween(this.content).repeatForever(tween().to(.5, { scale: v3(.8, .8, .8) }).to(.5, { scale: v3(1, 1, 1) })).start(); } //取消匹配 ; _proto.onClickCancel = function onClickCancel() { app.socket.Send(GAction.S_MODE_PVP_LEAVE); }; return PVPMatchView; }(JNGLayerBase), _descriptor$v = _applyDecoratedDescriptor(_class2$u.prototype, "content", [_dec2$y], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$u)) || _class$R); cclegacy._RF.pop(); var _dec$S, _dec2$z, _class$S, _class2$v, _descriptor$w; cclegacy._RF.push({}, "ccac1QqhdBMwp9m5xEQ4dad", "NoviceNamingView", undefined); var ccclass$D = _decorator.ccclass, property$y = _decorator.property; var NoviceNamingView = (_dec$S = ccclass$D('NoviceNamingView'), _dec2$z = property$y(EditBox), _dec$S(_class$S = (_class2$v = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(NoviceNamingView, _JNGLayerBase); function NoviceNamingView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "text", _descriptor$w, _assertThisInitialized(_this)); return _this; } var _proto = NoviceNamingView.prototype; //保存名称 _proto.onSave = /*#__PURE__*/function () { var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!this.text.string) { _context.next = 4; break; } _context.next = 3; return API.SavePlayerInfo(this.text.string); case 3: //关闭页面 app.layer.CloseNode(this.node); case 4: case "end": return _context.stop(); } }, _callee, this); })); function onSave() { return _onSave.apply(this, arguments); } return onSave; }(); return NoviceNamingView; }(JNGLayerBase), _descriptor$w = _applyDecoratedDescriptor(_class2$v.prototype, "text", [_dec2$z], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$v)) || _class$S); cclegacy._RF.pop(); var _dec$T, _dec2$A, _class$T, _class2$w, _descriptor$x; cclegacy._RF.push({}, "0bc93vaJLZPuYCc1dTrvyLs", "NoviceSelectPetView", undefined); var ccclass$E = _decorator.ccclass, property$z = _decorator.property; var NoviceSelectPetView = (_dec$T = ccclass$E('NoviceSelectPetView'), _dec2$A = property$z([Node]), _dec$T(_class$T = (_class2$w = /*#__PURE__*/function (_JNGLayerBase) { _inheritsLoose(NoviceSelectPetView, _JNGLayerBase); function NoviceSelectPetView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNGLayerBase.call.apply(_JNGLayerBase, [this].concat(args)) || this; //选择宠物的节点 _initializerDefineProperty(_this, "selects", _descriptor$x, _assertThisInitialized(_this)); //可选择宠物的列表 _this.petIds = void 0; //选择index _this.index = 0; return _this; } var _proto = NoviceSelectPetView.prototype; _proto.onJNLoad = /*#__PURE__*/function () { var _onJNLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) { var _this2 = this; var info; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _JNGLayerBase.prototype.onJNLoad.call(this); //加载配置表 (找到可选择的宠物Id) info = TD.TbGGlobal.get(TbGGlobalEnum.SELECT_PET_ID); this.petIds = JSON.parse(info.args); //显示宠物 this.selects.forEach(function (item, index) { //获取Spine组件 var spine = item.getComponentInChildren(sp.Skeleton); //设置显示的角色 spine.skeletonData = app.battleRes.roleSpine[_this2.petIds[index]]; //全部角色播放等待动画 spine.setAnimation(0, UIPetAnim.std, true); }); this.onUpdateView(); case 5: case "end": return _context.stop(); } }, _callee, this); })); function onJNLoad(_x) { return _onJNLoad.apply(this, arguments); } return onJNLoad; }() //更新UI ; _proto.onUpdateView = function onUpdateView() { this.selects.forEach(function (item) { item.getComponent(Sprite).color = new Color("8D8D8D"); }); //被选择赋黑 this.selects[this.index].getComponent(Sprite).color = new Color("#000000"); } //点击选择 ; _proto.onClickSelect = function onClickSelect(e, data) { var index = parseInt(data); this.index = index; //更新UI this.onUpdateView(); } //点击确定 ; _proto.onClickOk = /*#__PURE__*/function () { var _onClickOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.t0 = console; _context2.next = 3; return PlayerPetData.getIns().SelectNovicePet(this.petIds[this.index]); case 3: _context2.t1 = _context2.sent; _context2.t0.log.call(_context2.t0, _context2.t1); app.layer.Open(GUI.Tips, { text: "选择宠物成功 欢迎来到宠物世界..." }); //关闭页面 app.layer.CloseNode(this.node); case 7: case "end": return _context2.stop(); } }, _callee2, this); })); function onClickOk() { return _onClickOk.apply(this, arguments); } return onClickOk; }(); return NoviceSelectPetView; }(JNGLayerBase), _descriptor$x = _applyDecoratedDescriptor(_class2$w.prototype, "selects", [_dec2$A], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _class2$w)) || _class$T); cclegacy._RF.pop(); var _dec$U, _dec2$B, _dec3$h, _class$U, _class2$x, _descriptor$y, _descriptor2$g; cclegacy._RF.push({}, "d36bcqouzBBm74l7Z8QrvOH", "LoginView", undefined); var ccclass$F = _decorator.ccclass, property$A = _decorator.property; var LoginView = (_dec$U = ccclass$F('LoginView'), _dec2$B = property$A(EditBox), _dec3$h = property$A(EditBox), _dec$U(_class$U = (_class2$x = /*#__PURE__*/function (_JNLayerBase) { _inheritsLoose(LoginView, _JNLayerBase); function LoginView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNLayerBase.call.apply(_JNLayerBase, [this].concat(args)) || this; _this.resolve = void 0; _initializerDefineProperty(_this, "account", _descriptor$y, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "password", _descriptor2$g, _assertThisInitialized(_this)); return _this; } var _proto = LoginView.prototype; _proto.onJNLoad = function onJNLoad(resolve) { _JNLayerBase.prototype.onJNLoad.call(this); this.resolve = resolve; } //点击登录 ; _proto.onClickLogin = /*#__PURE__*/function () { var _onClickLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var info; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!(!this.account.string.length || !this.password.string.length)) { _context.next = 3; break; } app.layer.Open(GUI.Tips, { text: "请输入账号密码" }); return _context.abrupt("return"); case 3: _context.next = 5; return API.UserLogin(this.account.string, this.password.string); case 5: info = _context.sent; if (info) { app.layer.Open(GUI.Tips, { text: "登录成功" }); //保存Token StorageData.set(StorageEnum.Token, info.token); this.resolve(info.token); this.onJNClose(); } case 7: case "end": return _context.stop(); } }, _callee, this); })); function onClickLogin() { return _onClickLogin.apply(this, arguments); } return onClickLogin; }() //点击注册账号 ; _proto.onClickRegister = /*#__PURE__*/function () { var _onClickRegister = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { var info; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return API.UserRegister(); case 2: info = _context2.sent; //显示提示 app.layer.Open(GUI.Tips, { text: "注册成功" }); //显示账号和密码 this.account.string = "" + info.userId; this.password.string = info.userPass; case 6: case "end": return _context2.stop(); } }, _callee2, this); })); function onClickRegister() { return _onClickRegister.apply(this, arguments); } return onClickRegister; }(); return LoginView; }(JNLayerBase), (_descriptor$y = _applyDecoratedDescriptor(_class2$x.prototype, "account", [_dec2$B], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$g = _applyDecoratedDescriptor(_class2$x.prototype, "password", [_dec3$h], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$x)) || _class$U); cclegacy._RF.pop(); var _dec$V, _dec2$C, _dec3$i, _dec4$a, _dec5$3, _dec6$3, _class$V, _class2$y, _descriptor$z, _descriptor2$h, _descriptor3$a, _descriptor4$4, _descriptor5$4; cclegacy._RF.push({}, "637d2qdlk5B8rlrK/1+fcaG", "SelectionBox", undefined); var ccclass$G = _decorator.ccclass, property$B = _decorator.property; var SelectionBox = (_dec$V = ccclass$G('SelectionBox'), _dec2$C = property$B(Label), _dec3$i = property$B(Label), _dec4$a = property$B(Button), _dec5$3 = property$B(Button), _dec6$3 = property$B(Node), _dec$V(_class$V = (_class2$y = /*#__PURE__*/function (_JNLayerBase) { _inheritsLoose(SelectionBox, _JNLayerBase); function SelectionBox() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNLayerBase.call.apply(_JNLayerBase, [this].concat(args)) || this; //标题 _initializerDefineProperty(_this, "titleLabel", _descriptor$z, _assertThisInitialized(_this)); //提示文字 _initializerDefineProperty(_this, "tigLabel", _descriptor2$h, _assertThisInitialized(_this)); //取消按钮 _initializerDefineProperty(_this, "cancalBtn", _descriptor3$a, _assertThisInitialized(_this)); //确认按钮 _initializerDefineProperty(_this, "confirmBtn", _descriptor4$4, _assertThisInitialized(_this)); //按钮列表 _initializerDefineProperty(_this, "btns", _descriptor5$4, _assertThisInitialized(_this)); _this.data = void 0; return _this; } var _proto = SelectionBox.prototype; _proto.onJNLoad = function onJNLoad(data) { this.data = data; //默认不可以 data.isMaskClose = !!data.isMaskClose; data.tigText = data.tigText || "这是一个提示选择框"; data.titleText = data.titleText || "标 题"; data.cancelText = data.cancelText || "取 消"; data.confirmText = data.confirmText || "确 认"; this.mask = !data.isHideMake; this.isClickMaskeClose = data.isMaskClose; this.tigLabel.string = data.tigText; this.titleLabel.string = data.titleText; //没有事件则不显示 this.cancalBtn.node.active = !!data.cancel; this.confirmBtn.node.active = !!data.confirm; //显示按钮文字 this.cancalBtn.getComponentInChildren(Label).string = data.cancelText; this.confirmBtn.getComponentInChildren(Label).string = data.confirmText; //如果都没有则隐藏按钮列表 if (!data.cancel && data.confirm) this.btns.active = false; _JNLayerBase.prototype.onJNLoad.call(this); } //点击确认 ; _proto.onClickConfirm = /*#__PURE__*/function () { var _onClickConfirm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.t0 = this.data.confirm; if (!_context.t0) { _context.next = 4; break; } _context.next = 4; return this.data.confirm(); case 4: //关闭页面 app.layer.CloseNode(this.node); case 5: case "end": return _context.stop(); } }, _callee, this); })); function onClickConfirm() { return _onClickConfirm.apply(this, arguments); } return onClickConfirm; }() //点击取消 ; _proto.onClickCancel = /*#__PURE__*/function () { var _onClickCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.t0 = this.data.cancel; if (!_context2.t0) { _context2.next = 4; break; } _context2.next = 4; return this.data.cancel(); case 4: //关闭页面 app.layer.CloseNode(this.node); case 5: case "end": return _context2.stop(); } }, _callee2, this); })); function onClickCancel() { return _onClickCancel.apply(this, arguments); } return onClickCancel; }(); return SelectionBox; }(JNLayerBase), (_descriptor$z = _applyDecoratedDescriptor(_class2$y.prototype, "titleLabel", [_dec2$C], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$h = _applyDecoratedDescriptor(_class2$y.prototype, "tigLabel", [_dec3$i], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3$a = _applyDecoratedDescriptor(_class2$y.prototype, "cancalBtn", [_dec4$a], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor4$4 = _applyDecoratedDescriptor(_class2$y.prototype, "confirmBtn", [_dec5$3], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor5$4 = _applyDecoratedDescriptor(_class2$y.prototype, "btns", [_dec6$3], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$y)) || _class$V); cclegacy._RF.pop(); var _dec$W, _dec2$D, _class$W, _class2$z, _descriptor$A; cclegacy._RF.push({}, "76584YE7/1K9rPvckaow3Jg", "TipsView", undefined); var ccclass$H = _decorator.ccclass, property$C = _decorator.property; var TipsView = (_dec$W = ccclass$H('TipsView'), _dec2$D = property$C(Label), _dec$W(_class$W = (_class2$z = /*#__PURE__*/function (_JNLayerBase) { _inheritsLoose(TipsView, _JNLayerBase); function TipsView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNLayerBase.call.apply(_JNLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "text", _descriptor$A, _assertThisInitialized(_this)); return _this; } var _proto = TipsView.prototype; _proto.onJNLoad = function onJNLoad(data) { var _this2 = this; if (data === void 0) { data = {}; } if (!data) data = {}; data.text = data.text || "这是一个提示"; data.time = data.time || 3; //显示弹窗内容 this.text.string = data.text; this.scheduleOnce(function () { _this2.onJNClose(); }, data.time); }; return TipsView; }(JNLayerBase), _descriptor$A = _applyDecoratedDescriptor(_class2$z.prototype, "text", [_dec2$D], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$z)) || _class$W); cclegacy._RF.pop(); var _dec$X, _dec2$E, _class$X, _class2$A, _descriptor$B; cclegacy._RF.push({}, "0d7f0xLgLJJ+7qr9McTG53a", "IntoBattlePetIcon", undefined); var ccclass$I = _decorator.ccclass, property$D = _decorator.property; var IntoBattlePetIcon = (_dec$X = ccclass$I('IntoBattlePetIcon'), _dec2$E = property$D(PetIconSelect), _dec$X(_class$X = (_class2$A = /*#__PURE__*/function (_JNScrollViewItem) { _inheritsLoose(IntoBattlePetIcon, _JNScrollViewItem); function IntoBattlePetIcon() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNScrollViewItem.call.apply(_JNScrollViewItem, [this].concat(args)) || this; _initializerDefineProperty(_this, "select", _descriptor$B, _assertThisInitialized(_this)); return _this; } var _proto = IntoBattlePetIcon.prototype; _proto.start = function start() { this.select.setIcon(this.data.petTbId); }; return IntoBattlePetIcon; }(JNScrollViewItem), _descriptor$B = _applyDecoratedDescriptor(_class2$A.prototype, "select", [_dec2$E], { configurable: true, enumerable: true, writable: true, initializer: null }), _class2$A)) || _class$X); cclegacy._RF.pop(); var _dec$Y, _dec2$F, _dec3$j, _class$Y, _class2$B, _descriptor$C, _descriptor2$i; cclegacy._RF.push({}, "00e5fiwk55OFq7ZIZmksXGJ", "IntoBattleView", undefined); var ccclass$J = _decorator.ccclass, property$E = _decorator.property; //上阵页面 var IntoBattleView = (_dec$Y = ccclass$J('IntoBattleView'), _dec2$F = property$E(JNScrollView), _dec3$j = property$E(sp.Skeleton), _dec$Y(_class$Y = (_class2$B = /*#__PURE__*/function (_JNLayerBase) { _inheritsLoose(IntoBattleView, _JNLayerBase); function IntoBattleView() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _JNLayerBase.call.apply(_JNLayerBase, [this].concat(args)) || this; _initializerDefineProperty(_this, "views", _descriptor$C, _assertThisInitialized(_this)); //宠物列表 _initializerDefineProperty(_this, "spine", _descriptor2$i, _assertThisInitialized(_this)); //当前选中的宠物 //宠物数据 _this.pets = []; //当前选中 _this.index = -1; _this.tIndex = -1; return _this; } var _proto = IntoBattleView.prototype; //阵法下标 _proto.onJNLoad = function onJNLoad(data) { _JNLayerBase.prototype.onJNLoad.call(this); //获取传入的下标 this.tIndex = data.index; console.log("你选择的是", this.tIndex); this.onUpdateView(); } //刷新页面 ; _proto.onUpdateView = function onUpdateView() { //获取所有玩家宠物 this.pets = PlayerPetData.getIns().getData(); this.views.refreshData(this.pets); //设置不可选中 this.views.getItems().forEach(function (item) { if (PlayerTacticalData.getIns().getTacticalInfo().indexOf(item.data.petId) != -1) item.select.isNoSelect = true; //如果在阵法里则不可选中 }); //向子节点添加点击事件 this.views.addItemEvent(NodeEventType.TOUCH_START, this.onClickItem.bind(this)); this.onUpdateSelect(); } //刷新选中 ; _proto.onUpdateSelect = function onUpdateSelect() { //默认都不选中 this.views.getItems().forEach(function (item) { item.select.isSelect = false; }); //设置选中 if (this.index != -1) { var current = this.views.getItems()[this.index]; current.select.isSelect = true; //显示选中宠物 this.spine.skeletonData = app.battleRes.roleSpine[this.pets[this.index].petTbId]; this.spine.setAnimation(0, UIPetAnim.std, true); } } //点击Item ; _proto.onClickItem = function onClickItem(index) { //判断是否不可选中 if (this.views.getItems()[index].select.isNoSelect) { app.layer.Open(GUI.Tips, { text: "当前宠物已上阵" }); return; } //设置当前选中 this.index = index; //刷新 this.onUpdateSelect(); } //点击上阵 ; _proto.onClickTactical = /*#__PURE__*/function () { var _onClickTactical = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!(this.index < 0)) { _context.next = 3; break; } app.layer.Open(GUI.Tips, { text: "请选择要上阵的宠物." }); return _context.abrupt("return"); case 3: _context.next = 5; return PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex, this.pets[this.index].petId); case 5: //上阵完 关闭页面 app.layer.CloseNode(this.node); case 6: case "end": return _context.stop(); } }, _callee, this); })); function onClickTactical() { return _onClickTactical.apply(this, arguments); } return onClickTactical; }(); return IntoBattleView; }(JNLayerBase), (_descriptor$C = _applyDecoratedDescriptor(_class2$B.prototype, "views", [_dec2$F], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2$i = _applyDecoratedDescriptor(_class2$B.prototype, "spine", [_dec3$j], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2$B)) || _class$Y); cclegacy._RF.pop(); cclegacy._RF.push({}, "94eea0qL7tIYZDZNUN4PCRC", "attribute-defines", undefined); /* * @Author: OreoWang * @Email: ihc523@163.com * @Date: 2022-03-21 21:24:23 * @LastEditors: OreoWang * @LastEditTime: 2022-04-21 15:54:10 * @Description: */ /* Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. https://www.cocos.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ cclegacy._RF.pop(); var _dec$Z, _dec2$G, _class$Z, _descriptor$D, _descriptor2$j; cclegacy._RF.push({}, "bdb14ZbxzRA7qS7Pg3O51rm", "TestCondition", undefined); // @bt.ccclass("TestCondition") var TestCondition = (_dec$Z = property$1({ type: SharedNumber }), _dec2$G = property$1({ type: SharedNode }), (_class$Z = /*#__PURE__*/function (_bt$Conditional) { _inheritsLoose(TestCondition, _bt$Conditional); function TestCondition() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$Conditional.call.apply(_bt$Conditional, [this].concat(args)) || this; _initializerDefineProperty(_this, "count", _descriptor$D, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "target", _descriptor2$j, _assertThisInitialized(_this)); return _this; } var _proto = TestCondition.prototype; _proto.load = function load() {}; return TestCondition; }(Conditional), (_descriptor$D = _applyDecoratedDescriptor(_class$Z.prototype, "count", [_dec$Z], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$j = _applyDecoratedDescriptor(_class$Z.prototype, "target", [_dec2$G], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class$Z)); cclegacy._RF.pop(); var _dec$_, _dec2$H, _class$_, _descriptor$E, _descriptor2$k; cclegacy._RF.push({}, "05febjgu/lCc46QCxo0tPhb", "TestDecorator", undefined); // @bt.ccclass("TestDecorator") var TestDecorator = (_dec$_ = property$1({ type: SharedNumber }), _dec2$H = property$1({ type: SharedNode }), (_class$_ = /*#__PURE__*/function (_bt$Decorator) { _inheritsLoose(TestDecorator, _bt$Decorator); function TestDecorator() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$Decorator.call.apply(_bt$Decorator, [this].concat(args)) || this; _initializerDefineProperty(_this, "count", _descriptor$E, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "target", _descriptor2$k, _assertThisInitialized(_this)); return _this; } var _proto = TestDecorator.prototype; _proto.load = function load() {}; return TestDecorator; }(Decorator), (_descriptor$E = _applyDecoratedDescriptor(_class$_.prototype, "count", [_dec$_], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$k = _applyDecoratedDescriptor(_class$_.prototype, "target", [_dec2$H], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class$_)); cclegacy._RF.pop(); var _dec$$, _dec2$I, _class$$, _descriptor$F, _descriptor2$l; cclegacy._RF.push({}, "f45f3T5fCBHN4A89j+0tKIo", "TestService", undefined); // @bt.ccclass("TestService") var TestService = (_dec$$ = property$1({ type: SharedNumber }), _dec2$I = property$1({ type: SharedNode }), (_class$$ = /*#__PURE__*/function (_bt$Service) { _inheritsLoose(TestService, _bt$Service); function TestService() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$Service.call.apply(_bt$Service, [this].concat(args)) || this; _initializerDefineProperty(_this, "count", _descriptor$F, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "target", _descriptor2$l, _assertThisInitialized(_this)); return _this; } var _proto = TestService.prototype; _proto.load = function load() {}; return TestService; }(Service), (_descriptor$F = _applyDecoratedDescriptor(_class$$.prototype, "count", [_dec$$], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$l = _applyDecoratedDescriptor(_class$$.prototype, "target", [_dec2$I], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class$$)); cclegacy._RF.pop(); var _dec$10, _dec2$J, _dec3$k, _class$10, _descriptor$G, _descriptor2$m, _descriptor3$b; cclegacy._RF.push({}, "b8a95IvA3BKL7nNXvpCa2CL", "TestTask", undefined); // @bt.ccclass("TestTask") var TestTask = (_dec$10 = property$1({ type: SharedNumber }), _dec2$J = property$1({ type: SharedNode }), _dec3$k = property$1(Node), (_class$10 = /*#__PURE__*/function (_bt$Task) { _inheritsLoose(TestTask, _bt$Task); function TestTask() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$Task.call.apply(_bt$Task, [this].concat(args)) || this; _initializerDefineProperty(_this, "count", _descriptor$G, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "targetShared", _descriptor2$m, _assertThisInitialized(_this)); _initializerDefineProperty(_this, "target", _descriptor3$b, _assertThisInitialized(_this)); return _this; } var _proto = TestTask.prototype; _proto.load = function load() {}; return TestTask; }(Task), (_descriptor$G = _applyDecoratedDescriptor(_class$10.prototype, "count", [_dec$10], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor2$m = _applyDecoratedDescriptor(_class$10.prototype, "targetShared", [_dec2$J], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _descriptor3$b = _applyDecoratedDescriptor(_class$10.prototype, "target", [_dec3$k], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } })), _class$10)); cclegacy._RF.pop(); var _dec$11, _dec2$K, _dec3$l, _class$11, _class2$C, _descriptor$H; cclegacy._RF.push({}, "af7c4rIqLhGK6XwHK/SZ/ry", "ConditionalFilter", undefined); // const { Behavior } = Node; var ConditionalFilter = (_dec$11 = ccclass$5('bt.ConditionalFilter'), _dec2$K = delegate(), _dec3$l = property$1({ type: SharedBoolean, tooltip: "Filter by shared variable / 根据共享变量值进行条件过滤" }), _dec$11(_class$11 = _dec2$K(_class$11 = (_class2$C = /*#__PURE__*/function (_bt$BehaviorCondition) { _inheritsLoose(ConditionalFilter, _bt$BehaviorCondition); function ConditionalFilter() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorCondition.call.apply(_bt$BehaviorCondition, [this].concat(args)) || this; _initializerDefineProperty(_this, "filter", _descriptor$H, _assertThisInitialized(_this)); return _this; } var _proto = ConditionalFilter.prototype; _proto.execute = function execute(status) { if (this.filter) { var _this$filter; status = (_this$filter = this.filter) != null && _this$filter.value ? BehaviorStatus.Success : BehaviorStatus.Failure; } return _bt$BehaviorCondition.prototype.execute.call(this, status); }; return ConditionalFilter; }(BehaviorConditional), _descriptor$H = _applyDecoratedDescriptor(_class2$C.prototype, "filter", [_dec3$l], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return null; } }), _class2$C)) || _class$11) || _class$11); cclegacy._RF.pop(); var _dec$12, _class$12; cclegacy._RF.push({}, "d859ahQW6VIxatfaZ96fDkw", "ConditionalInverter", undefined); // const { Behavior } = Node; var ConditionalInverter = (_dec$12 = ccclass$5('bt.ConditionalInverter'), _dec$12(_class$12 = /*#__PURE__*/function (_bt$BehaviorCondition) { _inheritsLoose(ConditionalInverter, _bt$BehaviorCondition); function ConditionalInverter() { return _bt$BehaviorCondition.apply(this, arguments) || this; } var _proto = ConditionalInverter.prototype; _proto.execute = function execute(status) { if (status == BehaviorStatus.Success) { status = BehaviorStatus.Failure; } else if (status == BehaviorStatus.Failure) { status = BehaviorStatus.Success; } return _bt$BehaviorCondition.prototype.execute.call(this, status); }; return ConditionalInverter; }(BehaviorConditional)) || _class$12); cclegacy._RF.pop(); var _dec$13, _class$13; cclegacy._RF.push({}, "b7669siUSlIOpyiRz9musn0", "ForceRunning", undefined); // const { Behavior } = Node; var ForceRunning = (_dec$13 = ccclass$5('bt.ForceRunning'), _dec$13(_class$13 = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(ForceRunning, _bt$BehaviorDecorator); function ForceRunning() { return _bt$BehaviorDecorator.apply(this, arguments) || this; } var _proto = ForceRunning.prototype; _proto.execute = function execute(status) { status = BehaviorStatus.Running; return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return ForceRunning; }(BehaviorDecorator)) || _class$13); cclegacy._RF.pop(); var _dec$14, _dec2$L, _class$14, _class2$D, _descriptor$I; cclegacy._RF.push({}, "e9db3uUzwpLYpDF+APaIB+Q", "RandomSuccessful", undefined); var RandomSuccessful = (_dec$14 = ccclass$5('bt.RandomSuccessful'), _dec2$L = property$1({ tooltip: "返回成功的机率(0~1)" }), _dec$14(_class$14 = (_class2$D = /*#__PURE__*/function (_bt$BehaviorDecorator) { _inheritsLoose(RandomSuccessful, _bt$BehaviorDecorator); function RandomSuccessful() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _bt$BehaviorDecorator.call.apply(_bt$BehaviorDecorator, [this].concat(args)) || this; _initializerDefineProperty(_this, "percent", _descriptor$I, _assertThisInitialized(_this)); return _this; } var _proto = RandomSuccessful.prototype; _proto.execute = function execute(status) { if (this.percent == 0) { status = BehaviorStatus.Failure; } else if (this.percent == 1) { status = BehaviorStatus.Success; } else { var percent = Math.random(); if (percent < this.percent) { status = BehaviorStatus.Success; } else { status = BehaviorStatus.Failure; } } return _bt$BehaviorDecorator.prototype.execute.call(this, status); }; return RandomSuccessful; }(BehaviorDecorator), _descriptor$I = _applyDecoratedDescriptor(_class2$D.prototype, "percent", [_dec2$L], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 0.5; } }), _class2$D)) || _class$14); cclegacy._RF.pop(); cclegacy._RF.push({}, "5ba0eod3LhAg514wDDq7aT4", "NActionMessage", undefined); cclegacy._RF.pop(); cclegacy._RF.push({}, "b4012r8xoRP+b8Xs1YkV5UZ", "NActionServer", undefined); cclegacy._RF.pop(); } }; }); (function(r) { r('virtual:///prerequisite-imports/main', 'chunks:///main.js'); })(function(mid, cid) { System.register(mid, [cid], function (_export, _context) { return { setters: [function(_m) { var _exportObj = {}; for (var _key in _m) { if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key]; } _export(_exportObj); }], execute: function () { } }; }); });