npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cve-ts/controls

v1.1.0

Published

This tool should help get you started developing with Web Pages in UE5.

Downloads

6

Readme

CVE Controls

CVE Controls 插件提供各类 Control,其中封装了最常使用的 UE 交互指令。

云渲染控制

class CveControl {
  /** 和云端交互的超时阈值,默认为 15 秒 */
  timeoutSpan: number
  /** 执行自定义指令。通常该指令和数据由虚幻引擎开发人员定义。 */
  executeCustomCommand(Command: string, Data: string | undefined, callback?: CveCallback): Promise`<ResponseData>`
  /** 执行虚幻引擎指令。该指令为虚幻引擎内置的控制台指令。 */
  executeUeCommand(command: string): Promise`<ResponseData>`
  getResponse(uid: string, callback?: CveCallback): Promise`<ResponseData>`
  getrenderer(): CvePlayer | null
  sendCommand(descriptor: UIDescriptor, callback?: CveCallback): Promise`<ResponseData>`
}

Actor 控制

class ActorControl extends CveControl {
  /** 显示指定 Tag 的 Actor */
  showByTag(tag: string, callback?: CveCallback): Promise`<CveResponse>`
  /** 隐藏指定 Tag 的 Actor */
  hideByTag(tag: string, callback?: CveCallback): Promise`<CveResponse>`
}

镜头控制

interface CameraData {
  ArmLength: number
  Duration?: number
  Location: [x: number, y: number, z: number]
  Rotation: [roll: number, pitch: number, yaw: number]
}
class CameraControl extends CveControl {
  /** 飞到指定的位置,duration:飞行时间(s) */
  flyTo(position: CameraData, duration: number, callback?: CveCallback): Promise`<CveResponse>`
  /** 获取当前位置 */
  getPosition(callback?: CveCallback): Promise`<CveResponse>`
}

测量控制

type MeasureType = 'Area' | 'Distance' | 'Height'
class MeasureControl extends CveControl {
  /** 开始测量 */
  startMeasure(type: MeasureType, callback?: CveCallback): Promise`<CveResponse>`
  /** 取消测量 */
  cancelMeasure(callback?: CveCallback): Promise`<CveResponse>`
  /** 清除测量结果*/
  clearMeasureResults(callback?: CveCallback): Promise`<CveResponse>`
}

Feature 控制

Interface

  • 用于选中/显隐控制 Point/Polygon/Polyline/Polymesh 的数据集合
interface CveSelector {
  [x: string]: unknown
  ID?: string
  Name?: string
  Tags?: SelectorTags
}
  • 用于删除 Point/Polygon/Polyline 的数据集合
interface ToBeDeleted {
  ID?: string[]
  Name?: string[]
  Tag?: string[]
}

Point 控制

Methods

| 方法名 | 必要参数 | 数据类型 | 说明 | | -------------- | -------- | ------------------------- | ------------------------------ | | checkExistance | Selector | CveSelector | 检查指定的 Point 是否已存在 | | create | Points | PointData<PointStyle> | 生成 Point | | delete | List | ToBeDeleted | 删除指定的 Points | | hide | Selector | CveSelector | 隐藏指定的 Point | | pick | Selector | CveSelector | 选择指定的 Point,只能选中一个 | | show | Selector | CveSelector | 显示指定的 Point | | unpick | - | - | 取消选择的 Point |

Usage

import { PointControl } from '@cve-ts/controls'

const control = new PointControl()

// PointData 参见 @cve-ts/features
const points = [...]

control.checkExistance({ ID: 'A1B2C3D4E5F6' })
control.create(points)
control.delete({ Tag: ['第一批'] })
control.hide({ ID: 'A1B2C3D4E5F6' })
control.pick({ ID: 'A1B2C3D4E5F6' })
control.show({ ID: 'A1B2C3D4E5F6' })
control.unpick()

Polygon 控制

Methods

| 方法名 | 必要参数 | 数据类型 | 说明 | | -------------- | -------- | ----------------------------- | -------------------------------- | | checkExistance | Selector | CveSelector | 检查指定的 Polygon 是否已存在 | | create | Polygons | PolygonData<PolygonStyle> | 生成 Polygon | | delete | List | ToBeDeleted | 删除指定的 Polygons | | hide | Selector | CveSelector | 隐藏指定的 Polygon | | pick | Selector | CveSelector | 选择指定的 Polygon,只能选中一个 | | show | Selector | CveSelector | 显示指定的 Polygon | | unpick | - | - | 取消选择的 Polygon |

Usage

import { PolygonControl } from '@cve-ts/controls'

const control = new PolygonControl()

// PolygonData 参见 @cve-ts/features
const polygons = [...]

control.checkExistance({ ID: 'A1B2C3D4E5F6' })
control.create(polygons)
control.delete({ Tag: ['第一批'] })
control.hide({ ID: 'A1B2C3D4E5F6' })
control.pick({ ID: 'A1B2C3D4E5F6' })
control.show({ ID: 'A1B2C3D4E5F6' })
control.unpick()

Polyline 控制

Methods

| 方法名 | 必要参数 | 数据类型 | 说明 | | -------------------------- | --------------------------- | ------------------------------------------ | --------------------------------- | | checkExistance | Selector | CveSelector | 检查指定的 Polyline 是否已存在 | | create | Polylines | PolylineData<PolylineStyle> | 生成 Polylines | | delete | List | ToBeDeleted | 删除指定的 Points | | hide | Selector | CveSelector | 隐藏指定的 Polyline | | hideWithAnimateAndDuration | Selector, Animate, Duration | CveSelector, PLAnimate, number | 同上,指定显示动画和动画持续时间 | | hideWithAnimateAndSpeed | Selector, Animate, Speed | CveSelector, PLAnimate, number | 同上,指定隐藏动画和动画速度 | | pick | Selector | CveSelector | 选择指定的 Polyline,只能选中一个 | | show | Selector | CveSelector | 显示指定的 Polyline | | showWithAnimateAndDuration | Selector, Animate, Duration | CveSelector, PLAnimate, number | 同上,指定显示动画和动画持续时间 | | showWithAnimateAndSpeed | Selector, Animate, Speed | CveSelector, PLAnimate, number | 同上,指定显示动画和动画速度 | | unpick | - | - | 取消选择的 Polyline |

Usage

import { PolylineControl } from '@cve-ts/controls'

const control = new PolylineControl()

// PolylineData 参见 @cve-ts/features
const polylines = [...]

control.checkExistance({ ID: 'A1B2C3D4E5F6' })
control.create(polylines)
control.delete({ Tag: ['第一批'] })
control.hide({ ID: 'A1B2C3D4E5F6' })
control.hideWithAnimateAndDuration({ ID: 'A1B2C3D4E5F6' }, 'StartToEnd', 1)
control.hideWithAnimateAndSpeed({ ID: 'A1B2C3D4E5F6' }, 'StartToEnd', 5)
control.pick({ ID: 'A1B2C3D4E5F6' })
control.show({ ID: 'A1B2C3D4E5F6' })
control.showWithAnimateAndDuration({ ID: 'A1B2C3D4E5F6' }, 'StartToEnd', 1)
control.showWithAnimateAndSpeed({ ID: 'A1B2C3D4E5F6' }, 'StartToEnd', 5)
control.unpick()

Polymesh 控制

Methods

| 方法名 | 必要参数 | 数据类型 | 说明 | | ------ | -------- | --------------- | --------------------------------- | | hide | Selector | CveSelector | 隐藏指定的 Polymesh | | pick | Selector | CveSelector | 选择指定的 Polymesh,只能选中一个 | | show | Selector | CveSelector | 显示指定的 Polymesh | | unpick | - | - | 取消选择的 Polymesh |

Usage

import { PolymeshControl } from '@cve-ts/controls'

const control = new PolymeshControl()

// PointData 参见 @cve-ts/features
const points = [...]

control.hide({ ID: 'A1B2C3D4E5F6' })
control.pick({ ID: 'A1B2C3D4E5F6' })
control.show({ ID: 'A1B2C3D4E5F6' })
control.unpick()

场景控制

class SceneControl extends CveControl {
  /** 重置当前场景视角 */
  resetView(callback?: CveCallback): Promise`<CveResponse>`
  /** 切换自定义场景 */
  switchToCustomScene(sceneName: string, callback?: CveCallback): Promise`<CveResponse>`
}

过场控制

class SequenceControl extends CveControl {
  /** 暂停 */
  pause(isLockCamera: boolean, callback?: CveCallback): Promise`<CveResponse>`
  /** 播放 */
  play(sequenceName: string, callback?: CveCallback): Promise`<CveResponse>`
  /** 停止播放 */
  stop(callback?: CveCallback): Promise`<CveResponse>`
}

系统控制

class SystemControl extends CveControl {
  /** 开始连接云渲染,URL: 云渲染实例地址 */
  start(url: string): void
  /** 结束连接云渲染 */
  stop(): void
  /** 设置云渲染实例分辨率 */
  setResolution(width: number, height: number, callback?: CveCallback): Promise`<CveResponse>`
  /** 设置云渲染实例帧率上限 */
  setFramerateCap(rate: number, callback?: CveCallback): Promise`<CveResponse>`
  /** 设置云渲染实例带宽(Mb) 上限 */
  setBandwidthCap(bandwidth: number, callback?: CveCallback): Promise`<CveResponse>`
  /** 设置云渲染实例流送质量偏好 */
  setDegradationPreference(degradationPreference: RTCDegradationPreference, callback?: CveCallback): Promise`<CveResponse>`
  /** 重设页面渲染器尺寸 */
  resetPlayerSize(): void
  /** 重启云渲染实例当前关卡 */
  restartLevel(callback?: CveCallback): Promise`<CveResponse>`
  /** 打开云渲染实例指定关卡 */
  openLevel(levelName: string, sceneName: string, callback?: CveCallback): Promise`<CveResponse>`
  /** 显示、隐藏云渲染实例的帧率指示 */
  toggleFps(callback?: CveCallback): Promise`<CveResponse>`
  /** 设置云渲染实例音量大小,volume: [0.0,1.0] */
  setVolume(volume: number, callback?: CveCallback): Promise`<CveResponse>`
  /** 设置云渲染实例关闭声音 */
  mute(callback?: CveCallback): Promise`<CveResponse>`
  /** 设置云渲染实例打开声音 */
  unmute(callback?: CveCallback): Promise`<CveResponse>`
}

时间控制

class TimeControl extends CveControl {
  /** 禁用实时,渲染场景中的时间不随服务器时间变化。 */
  disableRealtime(callback?: CveCallback): Promise`<CveResponse>`
  /** 启用实时,渲染场景中的时间随服务器时间变化。 */
  enableRealtime(callback?: CveCallback): Promise`<CveResponse>`
  /** 设置渲染场景中的时间,设置后渲染场景将禁用实时。 */
  setDateTime(dateTime: Date, callback?: CveCallback): Promise`<CveResponse>`
}

天气控制

class WeatherControl extends CveControl {
  /** 根据预设变换天气效果,duration: 变换时间(s),preset: 天气类型 */
  changeWeatherByPreset(duration: number, preset: WeatherPreset, callback?: CveCallback): Promise`<CveResponse>`
  /** 根据参数变换天气效果,duration: 变换时间(s) */
  changeWeatherBySettings(duration: number, settings: WeatherSettings, callback?: CveCallback): Promise`<CveResponse>`
}