mirror of
https://gitee.com/sli97/behavior-eden-coco-plugin.git
synced 2024-12-25 11:19:06 +00:00
save
This commit is contained in:
parent
fa6639356a
commit
3ff8955095
3
dist/panels/default/index.js
vendored
3
dist/panels/default/index.js
vendored
@ -345,6 +345,9 @@ const component = lib_1.Vue.extend({
|
|||||||
this.assets = assets.map(({ name, source, file }) => ({ name, url: source, file: file, content: "" }));
|
this.assets = assets.map(({ name, source, file }) => ({ name, url: source, file: file, content: "" }));
|
||||||
},
|
},
|
||||||
async initSelection() {
|
async initSelection() {
|
||||||
|
// 切换节点时清空全局数据
|
||||||
|
selectedBoxes = [];
|
||||||
|
SAVE_DEBOUNCE_TIMER = null;
|
||||||
// 找到当前选中的节点
|
// 找到当前选中的节点
|
||||||
const node = await Editor.Message.request("scene", "query-node", Editor.Selection.getSelected("node"));
|
const node = await Editor.Message.request("scene", "query-node", Editor.Selection.getSelected("node"));
|
||||||
// 未选中节点或者选中的是场景节点(场景节点不能添加组件)
|
// 未选中节点或者选中的是场景节点(场景节点不能添加组件)
|
||||||
|
47
dist/runtime/node/composite/RandomSelector.js
vendored
Normal file
47
dist/runtime/node/composite/RandomSelector.js
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
"use strict";
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const index_1 = require("../index");
|
||||||
|
const decorator_1 = require("../../core/decorator");
|
||||||
|
let RandomSelector = class RandomSelector extends index_1.Composite {
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
this.executionOrder = [];
|
||||||
|
}
|
||||||
|
get index() {
|
||||||
|
return this.executionOrder[this.executionOrder.length - 1];
|
||||||
|
}
|
||||||
|
onStart() {
|
||||||
|
super.onStart();
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
canExecute() {
|
||||||
|
return Boolean(this.executionOrder.length) && this.status !== index_1.NodeStatus.Success;
|
||||||
|
}
|
||||||
|
onChildExecuted(status, _) {
|
||||||
|
this.executionOrder.pop();
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
onConditionalAbort() {
|
||||||
|
this.executionOrder = [];
|
||||||
|
this.status = index_1.NodeStatus.Inactive;
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
shuffle() {
|
||||||
|
this.executionOrder = [];
|
||||||
|
const indexList = Array.from({ length: this.children.length }, (e, i) => i);
|
||||||
|
for (let i = indexList.length - 1; i >= 0; i--) {
|
||||||
|
const num = Math.floor(Math.random() * indexList.length);
|
||||||
|
this.executionOrder.push(indexList.splice(num, 1)[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RandomSelector = __decorate([
|
||||||
|
(0, decorator_1.btclass)("RandomSelector")
|
||||||
|
], RandomSelector);
|
||||||
|
exports.default = RandomSelector;
|
64
dist/runtime/node/composite/RandomSequence copy.js
vendored
Normal file
64
dist/runtime/node/composite/RandomSequence copy.js
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
"use strict";
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||||
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||||
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const index_1 = require("../index");
|
||||||
|
const decorator_1 = require("../../core/decorator");
|
||||||
|
let RandomSequence = class RandomSequence extends index_1.Composite {
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
this.executionOrder = [];
|
||||||
|
}
|
||||||
|
get index() {
|
||||||
|
return this.executionOrder[this.executionOrder.length - 1];
|
||||||
|
}
|
||||||
|
onStart() {
|
||||||
|
super.onStart();
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
canExecute() {
|
||||||
|
return Boolean(this.executionOrder.length) && this.status !== index_1.NodeStatus.Failure;
|
||||||
|
}
|
||||||
|
onChildExecuted(status, _) {
|
||||||
|
switch (status) {
|
||||||
|
case index_1.NodeStatus.Success:
|
||||||
|
this.executionOrder.pop();
|
||||||
|
if (this.executionOrder.length <= 0) {
|
||||||
|
this.status = index_1.NodeStatus.Success;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.status = index_1.NodeStatus.Running;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case index_1.NodeStatus.Failure:
|
||||||
|
this.status = index_1.NodeStatus.Failure;
|
||||||
|
break;
|
||||||
|
case index_1.NodeStatus.Running:
|
||||||
|
this.status = index_1.NodeStatus.Running;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onConditionalAbort() {
|
||||||
|
this.executionOrder = [];
|
||||||
|
this.status = index_1.NodeStatus.Inactive;
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
shuffle() {
|
||||||
|
this.executionOrder = [];
|
||||||
|
const indexList = Array.from({ length: this.children.length }, (e, i) => i);
|
||||||
|
for (let i = indexList.length - 1; i >= 0; i--) {
|
||||||
|
const num = Math.floor(Math.random() * indexList.length);
|
||||||
|
this.executionOrder.push(indexList.splice(num, 1)[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RandomSequence = __decorate([
|
||||||
|
(0, decorator_1.btclass)("RandomSequence")
|
||||||
|
], RandomSequence);
|
||||||
|
exports.default = RandomSequence;
|
19
dist/runtime/node/composite/RandomSequence.js
vendored
19
dist/runtime/node/composite/RandomSequence.js
vendored
@ -24,25 +24,8 @@ let RandomSequence = class RandomSequence extends index_1.Composite {
|
|||||||
return Boolean(this.executionOrder.length) && this.status !== index_1.NodeStatus.Failure;
|
return Boolean(this.executionOrder.length) && this.status !== index_1.NodeStatus.Failure;
|
||||||
}
|
}
|
||||||
onChildExecuted(status, _) {
|
onChildExecuted(status, _) {
|
||||||
switch (status) {
|
|
||||||
case index_1.NodeStatus.Success:
|
|
||||||
this.executionOrder.pop();
|
this.executionOrder.pop();
|
||||||
if (this.executionOrder.length <= 0) {
|
this.status = status;
|
||||||
this.status = index_1.NodeStatus.Success;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.status = index_1.NodeStatus.Running;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case index_1.NodeStatus.Failure:
|
|
||||||
this.status = index_1.NodeStatus.Failure;
|
|
||||||
break;
|
|
||||||
case index_1.NodeStatus.Running:
|
|
||||||
this.status = index_1.NodeStatus.Running;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onConditionalAbort() {
|
onConditionalAbort() {
|
||||||
this.executionOrder = [];
|
this.executionOrder = [];
|
||||||
|
19
dist/runtime/node/composite/Sequence.js
vendored
19
dist/runtime/node/composite/Sequence.js
vendored
@ -17,25 +17,8 @@ let Sequence = class Sequence extends index_1.Composite {
|
|||||||
return this.index < this.children.length && this.status !== index_1.NodeStatus.Failure;
|
return this.index < this.children.length && this.status !== index_1.NodeStatus.Failure;
|
||||||
}
|
}
|
||||||
onChildExecuted(status, _) {
|
onChildExecuted(status, _) {
|
||||||
switch (status) {
|
|
||||||
case index_1.NodeStatus.Success:
|
|
||||||
this.index++;
|
this.index++;
|
||||||
if (this.index >= this.children.length) {
|
this.status = status;
|
||||||
this.status = index_1.NodeStatus.Success;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.status = index_1.NodeStatus.Running;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case index_1.NodeStatus.Failure:
|
|
||||||
this.status = index_1.NodeStatus.Failure;
|
|
||||||
break;
|
|
||||||
case index_1.NodeStatus.Running:
|
|
||||||
this.status = index_1.NodeStatus.Running;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onConditionalAbort(index) {
|
onConditionalAbort(index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
1
dist/runtime/node/composite/index.js
vendored
1
dist/runtime/node/composite/index.js
vendored
@ -18,3 +18,4 @@ __exportStar(require("./Sequence"), exports);
|
|||||||
__exportStar(require("./Selector"), exports);
|
__exportStar(require("./Selector"), exports);
|
||||||
__exportStar(require("./Parallel"), exports);
|
__exportStar(require("./Parallel"), exports);
|
||||||
__exportStar(require("./RandomSequence"), exports);
|
__exportStar(require("./RandomSequence"), exports);
|
||||||
|
__exportStar(require("./RandomSelector"), exports);
|
||||||
|
@ -377,6 +377,9 @@ const component = Vue.extend({
|
|||||||
this.assets = assets.map(({ name, source, file }) => ({ name, url: source, file: file, content: "" }));
|
this.assets = assets.map(({ name, source, file }) => ({ name, url: source, file: file, content: "" }));
|
||||||
},
|
},
|
||||||
async initSelection() {
|
async initSelection() {
|
||||||
|
// 切换节点时清空全局数据
|
||||||
|
selectedBoxes = [];
|
||||||
|
SAVE_DEBOUNCE_TIMER = null;
|
||||||
// 找到当前选中的节点
|
// 找到当前选中的节点
|
||||||
const node = await Editor.Message.request("scene", "query-node", Editor.Selection.getSelected("node"));
|
const node = await Editor.Message.request("scene", "query-node", Editor.Selection.getSelected("node"));
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ ui-prop[no-label] {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fix-left {
|
.fix-left-top {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 14px;
|
left: 14px;
|
||||||
top: 14px;
|
top: 14px;
|
||||||
@ -58,21 +58,28 @@ ui-prop[no-label] {
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fix-right {
|
.fix-right-top {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 14px;
|
right: 20px;
|
||||||
top: 14px;
|
top: 14px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fix-bottom {
|
.fix-left-bottom {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 14px;
|
left: 14px;
|
||||||
bottom: 24px;
|
bottom: 24px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fix-right-bottom {
|
||||||
|
position: absolute;
|
||||||
|
right: 20px;
|
||||||
|
bottom: 24px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.fix-bottom ui-button {
|
.fix-bottom ui-button {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
@ -4,23 +4,24 @@
|
|||||||
<div class="scroll" ref="scroll">
|
<div class="scroll" ref="scroll">
|
||||||
<div id="tree" ref="tree" />
|
<div id="tree" ref="tree" />
|
||||||
</div>
|
</div>
|
||||||
<div class="fix-left">
|
<div class="fix-left-top">
|
||||||
<div class="log">
|
<div class="log">
|
||||||
<ui-section header="Logs" class="config" expand>
|
<ui-section header="Logs" class="config" expand>
|
||||||
<div v-for="log of logs" :key="log.id">{{log.content}}</div>
|
<div v-for="log of logs" :key="log.id">{{log.content}}</div>
|
||||||
</ui-section>
|
</ui-section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fix-right">
|
<div class="fix-right-top">
|
||||||
<div class="asset" v-if="currentAsset">
|
<div class="asset" v-if="currentAsset">
|
||||||
<ui-select :value="currentAsset.url" @change="handleSelectAsset($event.target.value)">
|
<ui-select :value="currentAsset.url" @change="handleSelectAsset($event.target.value)">
|
||||||
<option v-for="(asset,index) of assets" :value="asset.url" :key="asset.url">{{ asset.name }}</option>
|
<option v-for="(asset,index) of assets" :value="asset.url" :key="asset.url">{{ asset.name }}</option>
|
||||||
</ui-select>
|
</ui-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fix-bottom" @click="backRoot">
|
<div class="fix-left-bottom" @click="backRoot">
|
||||||
<ui-button>Root</ui-button>
|
<ui-button>Root</ui-button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="fix-right-bottom" @click="backRoot">Version 1.0.2</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
40
src/runtime/node/composite/RandomSelector.ts
Normal file
40
src/runtime/node/composite/RandomSelector.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { Composite, NodeStatus } from "../index";
|
||||||
|
import { btclass } from "../../core/decorator";
|
||||||
|
|
||||||
|
@btclass("RandomSelector")
|
||||||
|
export default class RandomSelector extends Composite {
|
||||||
|
executionOrder: Array<number> = [];
|
||||||
|
|
||||||
|
get index() {
|
||||||
|
return this.executionOrder[this.executionOrder.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
onStart(): void {
|
||||||
|
super.onStart();
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
|
canExecute(): boolean {
|
||||||
|
return Boolean(this.executionOrder.length) && this.status !== NodeStatus.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
onChildExecuted(status: NodeStatus, _: number): void {
|
||||||
|
this.executionOrder.pop();
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
onConditionalAbort() {
|
||||||
|
this.executionOrder = [];
|
||||||
|
this.status = NodeStatus.Inactive;
|
||||||
|
this.shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
|
shuffle() {
|
||||||
|
this.executionOrder = [];
|
||||||
|
const indexList = Array.from({ length: this.children.length }, (e, i) => i);
|
||||||
|
for (let i = indexList.length - 1; i >= 0; i--) {
|
||||||
|
const num = Math.floor(Math.random() * indexList.length);
|
||||||
|
this.executionOrder.push(indexList.splice(num, 1)[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
src/runtime/node/composite/RandomSelector.ts.meta
Normal file
9
src/runtime/node/composite/RandomSelector.ts.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "ff11c9ef-38fb-430b-96c6-398bea66af98",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -19,24 +19,8 @@ export default class RandomSequence extends Composite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChildExecuted(status: NodeStatus, _: number): void {
|
onChildExecuted(status: NodeStatus, _: number): void {
|
||||||
switch (status) {
|
|
||||||
case NodeStatus.Success:
|
|
||||||
this.executionOrder.pop();
|
this.executionOrder.pop();
|
||||||
if (this.executionOrder.length <= 0) {
|
this.status = status;
|
||||||
this.status = NodeStatus.Success;
|
|
||||||
} else {
|
|
||||||
this.status = NodeStatus.Running;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NodeStatus.Failure:
|
|
||||||
this.status = NodeStatus.Failure;
|
|
||||||
break;
|
|
||||||
case NodeStatus.Running:
|
|
||||||
this.status = NodeStatus.Running;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onConditionalAbort() {
|
onConditionalAbort() {
|
||||||
|
@ -13,24 +13,8 @@ export default class Sequence extends Composite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChildExecuted(status: NodeStatus, _: number): void {
|
onChildExecuted(status: NodeStatus, _: number): void {
|
||||||
switch (status) {
|
|
||||||
case NodeStatus.Success:
|
|
||||||
this.index++;
|
this.index++;
|
||||||
if (this.index >= this.children.length) {
|
this.status = status;
|
||||||
this.status = NodeStatus.Success;
|
|
||||||
} else {
|
|
||||||
this.status = NodeStatus.Running;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NodeStatus.Failure:
|
|
||||||
this.status = NodeStatus.Failure;
|
|
||||||
break;
|
|
||||||
case NodeStatus.Running:
|
|
||||||
this.status = NodeStatus.Running;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onConditionalAbort(index: number) {
|
onConditionalAbort(index: number) {
|
||||||
|
@ -2,3 +2,4 @@ export * from "./Sequence";
|
|||||||
export * from "./Selector";
|
export * from "./Selector";
|
||||||
export * from "./Parallel";
|
export * from "./Parallel";
|
||||||
export * from "./RandomSequence";
|
export * from "./RandomSequence";
|
||||||
|
export * from "./RandomSelector";
|
||||||
|
Loading…
Reference in New Issue
Block a user