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