Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
@easytwin/engine
Advanced tools
- [engine 核心](./src/engine/) - [测试页面](./src/page/) - [增加组件](#在引擎中新增组件component) - [引擎绘制模块](#使用引擎的draw-模块)
// 设置对应的绘制模式
world.drawUtils.mode = 'multi-rect';
// 设置为那个组件做绘制, 这里会触发与前端的交互,通知前端xxx组件的绘制状态
world.drawUtils.setActiveComponent(this);
// 设置绘制组件需要的 绘制点的根节点
world.drawUtils.showDrawPoint(this.group);
// 同上
world.drawUtils.showDrawMoveRect(this.group);
world.drawUtils.startDraw();
// 在改文件中全局替换Template 为你想要的组件名字
export const TemplateComponentType = 'Template';
// 函数的返回是有顺序的, 按照你期望的顺序加入函数的返回序列中
if (entity.getComponentByType('Model')) return 'Model';
// 函数用于判断该实体是否属于数字要素的一种
if (entity.isEntityDigital(entity: EngineEntity)) return boolean;
switch (this.type) {
case 'XXX':
}
// 在switch 中加入你新增的组件类型
getObjectById(id: string) {
// 返回你想要返回给选中模块的物体, 一般选中会通过子mesh 的id,来寻找你需要返回出的组件子实体
return this.group;
}
onDragEnd(): void
// 在选中模块中, 拖动组件会触发组件的 onDragEnd 函数,在这里你可以更新 组件中的位置等属性
// 如果没有特别的实现, 通用实现就是控制 组件下的group 的children 的某一个子的显示隐藏, 如果uuid 为空就直接设置group的显隐
setVisible(visible: boolean, uuid?: string): void
// 在可以被选中的dom对象添加数据元素 它自身的id, 所属实体的id, 所属组件的id
clickDom.dataset.id = id;
clickDom.dataset.entityId = entityId;
clickDom.dataset.componentId = componentId;
// 在选中模块中, 将通过ev.target 来直接获取组件id, 来判断是否点中
const componentId = target.getAttribute('data-component-id');
const objectId = target.getAttribute('data-id');
为了能在数字要素传出自定义属性 如果数字要素含有多个子,就在子的 data 数据中加上 customAttribute 字段 不然就放在最外层
public removeObjectById(id: string): void {
const object = this.getObjectById(id);
if (object) {
const child = this.childMap.get(object.uuid);
this.childMap.delete(object.uuid);
child && child.dispose();
child && this.group.remove(child);
this.needDataUpdateServer = true;
}
}
// 以poi panel v2为例
public setVisible(visible: boolean): PoiPanelV2Component {
const getExtendVisible = (object: Object3D, visible: boolean): boolean => {
if (object.parent) {
return getExtendVisible(object.parent, object.parent.visible && visible);
} else {
return visible;
}
};
const extendVisible = getExtendVisible(this.group, this.group.visible);
this.childMap.forEach((child) => {
child.setVisible(visible && extendVisible);
});
return this;
}
//在新增的组件中实现 设置显隐的方法, 并在load 该组件的函数中增加对于它显隐的控制调用
public loadPoiPanelV2Component(
world: World,
entity: EngineEntity,
options: ComponentOptions,
isAdded: boolean = false,
): PoiPanelV2Component {
const { type, id, name, states } = options;
const component = entity.addComponent<PoiPanelV2Component>(
id,
name ?? '',
PoiPanelV2Component,
isAdded,
);
......
component.setVisible(entity.visible);
.....
return component;
}
FAQs
- [engine 核心](./src/engine/) - [测试页面](./src/page/) - [增加组件](#在引擎中新增组件component) - [引擎绘制模块](#使用引擎的draw-模块)
The npm package @easytwin/engine receives a total of 0 weekly downloads. As such, @easytwin/engine popularity was classified as not popular.
We found that @easytwin/engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.