fix
This commit is contained in:
parent
564866393f
commit
40eebf9dd8
5 changed files with 42 additions and 31 deletions
|
@ -36,7 +36,7 @@ export interface IWeightsDependency {
|
||||||
export interface IDeviceDependency {
|
export interface IDeviceDependency {
|
||||||
sid: string;
|
sid: string;
|
||||||
}
|
}
|
||||||
export interface IDependency {}
|
export interface IDependency { }
|
||||||
export interface IParam {
|
export interface IParam {
|
||||||
isFilled: boolean;
|
isFilled: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
|
@ -276,7 +276,7 @@ export class SkillModel extends ValidationModel implements ISkill {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SkillDependency implements IDependency {
|
export class SkillDependency implements IDependency {
|
||||||
constructor(public skills: ISkillDependency[]) {}
|
constructor(public skills: ISkillDependency[]) { }
|
||||||
static empty() {
|
static empty() {
|
||||||
return new SkillDependency([]);
|
return new SkillDependency([]);
|
||||||
}
|
}
|
||||||
|
@ -424,24 +424,27 @@ export class Skills {
|
||||||
.flat(1)
|
.flat(1)
|
||||||
.filter((el) => el !== "");
|
.filter((el) => el !== "");
|
||||||
|
|
||||||
getDependencyBySkillLabelAndType = (skillType: string, sid: string): DependencyViewModel =>
|
getDependencyBySkillLabelAndType = (skillType: string, sid: string): DependencyViewModel => this.skills
|
||||||
this.skills
|
.reduce<DependencyViewModel[]>((acc, skill) => {
|
||||||
.reduce<DependencyViewModel[]>((acc, skill) => {
|
if (skill.sid?.isEqual(sid)) {
|
||||||
if (skill.sid?.isEqual(sid)) {
|
skill.BTAction.map((action) => {
|
||||||
skill.BTAction.map((action) => {
|
action.param.map((param) => {
|
||||||
action.param.map((param) => {
|
|
||||||
if (param.type.isEqualR(skillType)) {
|
|
||||||
acc.push(param?.dependency ?? DependencyViewModel.empty());
|
|
||||||
}
|
|
||||||
return param;
|
|
||||||
});
|
|
||||||
return action;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return acc;
|
if (param.type.isEqual(skillType)) {
|
||||||
}, [])
|
|
||||||
.at(0) ?? DependencyViewModel.empty();
|
|
||||||
|
acc.push(param?.dependency ?? DependencyViewModel.empty());
|
||||||
|
}
|
||||||
|
// console.log(acc);
|
||||||
|
return param;
|
||||||
|
});
|
||||||
|
return action;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, [])
|
||||||
|
.at(0) ?? DependencyViewModel.empty()
|
||||||
static isEmpty(model: Skills): Result<void, void> {
|
static isEmpty(model: Skills): Result<void, void> {
|
||||||
if (model.skills.isEmpty()) {
|
if (model.skills.isEmpty()) {
|
||||||
return Result.error(undefined);
|
return Result.error(undefined);
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { CalculationModel } from "../../../../../../features/calculation_instanc
|
||||||
export const SelectProcess = observer((props: IFormBuilderComponentsProps<SelectProcessModel>) => {
|
export const SelectProcess = observer((props: IFormBuilderComponentsProps<SelectProcessModel>) => {
|
||||||
const [store] = useState(new SelectProcessStore());
|
const [store] = useState(new SelectProcessStore());
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(props.dependency);
|
|
||||||
if (typeof props.dependency === "string") {
|
if (typeof props.dependency === "string") {
|
||||||
store.loadClassInstance(SelectProcessModel, JSON.parse(props.dependency));
|
store.loadClassInstance(SelectProcessModel, JSON.parse(props.dependency));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,7 +49,9 @@ export const BehaviorTreeBuilderScreen = observer(() => {
|
||||||
if (ref.current) {
|
if (ref.current) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const domReact: DOMReact = ref.current.getBoundingClientRect();
|
const domReact: DOMReact = ref.current.getBoundingClientRect();
|
||||||
store.dragZoneSetOffset(0, domReact.y, domReact.width, domReact.height);
|
|
||||||
|
// УБЕРИ + 300
|
||||||
|
store.dragZoneSetOffset(0, domReact.y, domReact.width + 300, domReact.height);
|
||||||
}
|
}
|
||||||
}, [ref.current]);
|
}, [ref.current]);
|
||||||
|
|
||||||
|
@ -198,11 +200,13 @@ export const BehaviorTreeBuilderScreen = observer(() => {
|
||||||
)
|
)
|
||||||
.rFind<IForms>((form) => form.name.isEqual(formType))
|
.rFind<IForms>((form) => form.name.isEqual(formType))
|
||||||
.fold(
|
.fold(
|
||||||
(s) => (
|
(s) => {
|
||||||
<div key={index} style={{ height: "100%" }}>
|
return (
|
||||||
{s.component}
|
<div key={index} style={{ flex: 1 }}>
|
||||||
</div>
|
{s.component}
|
||||||
),
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
() => (
|
() => (
|
||||||
<div key={index + "error"} style={{ height: "100%" }}>
|
<div key={index + "error"} style={{ height: "100%" }}>
|
||||||
Error: Unknown form type {formType}
|
Error: Unknown form type {formType}
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class BehaviorTreeBuilderStore extends UiDrawerFormState<BehaviorTreeView
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
panels: PanelBody[] = [new PanelBody(undefined,undefined,undefined)];
|
panels: PanelBody[] = [new PanelBody(undefined, undefined, undefined)];
|
||||||
addNewPanel = () => this.panels.push(new PanelBody(undefined, undefined, undefined));
|
addNewPanel = () => this.panels.push(new PanelBody(undefined, undefined, undefined));
|
||||||
removePanel = (index: number) =>
|
removePanel = (index: number) =>
|
||||||
this.panels.length !== 1
|
this.panels.length !== 1
|
||||||
|
@ -130,6 +130,13 @@ export class BehaviorTreeBuilderStore extends UiDrawerFormState<BehaviorTreeView
|
||||||
};
|
};
|
||||||
drawSkillCheck = (x: number, y: number, name: string) => {
|
drawSkillCheck = (x: number, y: number, name: string) => {
|
||||||
const drawPoint = { x: x, y: y, w: 1, h: 1 };
|
const drawPoint = { x: x, y: y, w: 1, h: 1 };
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
drawPoint.x < this.area!.x + this.area!.w &&
|
||||||
|
drawPoint.x + drawPoint.w > this.area!.x &&
|
||||||
|
drawPoint.y < this.area!.y + this.area!.h &&
|
||||||
|
drawPoint.y + drawPoint.h > this.area!.y
|
||||||
|
);
|
||||||
if (
|
if (
|
||||||
drawPoint.x < this.area!.x + this.area!.w &&
|
drawPoint.x < this.area!.x + this.area!.w &&
|
||||||
drawPoint.x + drawPoint.w > this.area!.x &&
|
drawPoint.x + drawPoint.w > this.area!.x &&
|
||||||
|
@ -143,7 +150,7 @@ export class BehaviorTreeBuilderStore extends UiDrawerFormState<BehaviorTreeView
|
||||||
name: name,
|
name: name,
|
||||||
id: sid,
|
id: sid,
|
||||||
});
|
});
|
||||||
// this.isNeedSaveBtn = true;
|
|
||||||
if (!name.isEqualMany(Object.keys(SystemPrimitive))) {
|
if (!name.isEqualMany(Object.keys(SystemPrimitive))) {
|
||||||
this.skillTemplates?.getSkill(name).fold(
|
this.skillTemplates?.getSkill(name).fold(
|
||||||
(skill) => {
|
(skill) => {
|
||||||
|
@ -235,7 +242,6 @@ export class BehaviorTreeBuilderStore extends UiDrawerFormState<BehaviorTreeView
|
||||||
)
|
)
|
||||||
).fold(
|
).fold(
|
||||||
(xml) => {
|
(xml) => {
|
||||||
console.log(xml);
|
|
||||||
this.behaviorTreeModel.skills = this.filledOutTemplates;
|
this.behaviorTreeModel.skills = this.filledOutTemplates;
|
||||||
this.behaviorTreeModel.scene = NodeBehaviorTree.fromReteScene(
|
this.behaviorTreeModel.scene = NodeBehaviorTree.fromReteScene(
|
||||||
this.editor as NodeEditor<Schemes>,
|
this.editor as NodeEditor<Schemes>,
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const FormBuilderForm = observer((props: IPropsForm<Partial<FormBuilderVa
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ overflowX: "scroll", height: "100%" }}>
|
<div style={{ overflowX: "scroll", height: "100%", flex: 1 }}>
|
||||||
<div>FormBuilder</div>
|
<div>FormBuilder</div>
|
||||||
{store.isBtScreen ? (
|
{store.isBtScreen ? (
|
||||||
<div>
|
<div>
|
||||||
|
@ -27,7 +27,6 @@ export const FormBuilderForm = observer((props: IPropsForm<Partial<FormBuilderVa
|
||||||
formBuilder={store.viewModel}
|
formBuilder={store.viewModel}
|
||||||
onChange={(form) => {
|
onChange={(form) => {
|
||||||
store.viewModel = form;
|
store.viewModel = form;
|
||||||
console.log(form);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div style={{ height: 100 }} />
|
<div style={{ height: 100 }} />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue