From b1ee750d4920bc33f8876eb17b66e95e4566e458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E8=83=BD=E5=B2=9B=E6=B0=91?= Date: Wed, 7 Aug 2024 22:02:07 +0800 Subject: [PATCH] 2024.8.7 update --- docs/_assets/global.css | 20 +- docs/_assets/icons.css | 6 +- docs/_assets/iconsParser.js | 411 +++++++++++++---------- docs/api/class/DataStorage.md | 130 +++++++ docs/api/class/Entity.md | 46 +-- docs/api/class/EventHandlerToken.md | 0 docs/api/class/HttpFetchResponse.md | 43 +++ docs/api/class/HttpRequest.md | 12 + docs/api/class/HttpResponse.md | 12 + docs/api/class/Player.md | 64 ++-- docs/api/class/QueryList.md | 31 ++ docs/api/class/RTCChannel.md | 2 +- docs/api/class/Zone.md | 147 ++++++++ docs/api/event/ChatEvent.md | 2 +- docs/api/event/EntityEvent.md | 13 +- docs/api/event/KeyBoardEvent.md | 123 +++++++ docs/api/event/PlayerEntityEvent.md | 12 +- docs/api/event/TriggerEvent.md | 13 + docs/api/gui.md | 1 - docs/api/http.md | 55 ++- docs/api/icons.md | 3 +- docs/api/index.md | 31 +- docs/api/resources.md | 11 - docs/api/rtc.md | 2 +- docs/api/storage.md | 57 +++- docs/api/tool.md | 149 ++++++++ docs/api/type/DialogCall.md | 42 --- docs/api/type/DialogParams.md | 73 ++++ docs/api/type/DialogSelectResponse.md | 16 + docs/api/type/EventChannel.md | 20 ++ docs/api/type/EventFuture.md | 62 ++++ docs/api/type/HttpFetchHeaders.md | 23 ++ docs/api/type/HttpFetchParams.md | 12 + docs/api/type/HttpFetchRequestOptions.md | 17 + docs/api/type/HttpHandler.md | 15 + docs/api/type/JSONValue.md | 15 + docs/api/type/ListPageOptions.md | 19 ++ docs/api/type/ReturnValue.md | 23 ++ docs/api/type/SelectorString.md | 31 +- docs/api/type/ZoneConfig.md | 63 ++++ docs/api/type/base/undefined.md | 0 docs/api/voxels.md | 14 +- docs/api/world.md | 151 ++++++--- docs/modules/index.md | 0 docs/todo.md | 28 +- mkdocs.yml | 45 ++- 46 files changed, 1672 insertions(+), 393 deletions(-) create mode 100644 docs/api/class/EventHandlerToken.md create mode 100644 docs/api/class/HttpFetchResponse.md create mode 100644 docs/api/class/HttpRequest.md create mode 100644 docs/api/class/HttpResponse.md create mode 100644 docs/api/class/QueryList.md create mode 100644 docs/api/event/TriggerEvent.md delete mode 100644 docs/api/resources.md create mode 100644 docs/api/tool.md delete mode 100644 docs/api/type/DialogCall.md create mode 100644 docs/api/type/DialogParams.md create mode 100644 docs/api/type/HttpFetchHeaders.md create mode 100644 docs/api/type/HttpFetchParams.md create mode 100644 docs/api/type/HttpFetchRequestOptions.md create mode 100644 docs/api/type/HttpHandler.md create mode 100644 docs/api/type/JSONValue.md create mode 100644 docs/api/type/ListPageOptions.md create mode 100644 docs/api/type/ReturnValue.md create mode 100644 docs/api/type/ZoneConfig.md create mode 100644 docs/api/type/base/undefined.md create mode 100644 docs/modules/index.md diff --git a/docs/_assets/global.css b/docs/_assets/global.css index 73a3649..604c1fd 100644 --- a/docs/_assets/global.css +++ b/docs/_assets/global.css @@ -10,7 +10,7 @@ anchor { summary, img { border: 1px solid transparent; - transition-duration: 0.25s !important; + transition-duration: 0.25s; cursor: pointer; box-shadow: 0 0 3px transparent; } @@ -20,6 +20,9 @@ img:active { border-color: #2094f3 !important; background: rgba(32, 148, 243, 0.5) !important; box-shadow: 0 0 3px #2094f3 !important; +} + +img { transition-duration: 0s !important; } @@ -34,16 +37,27 @@ a>.kind-icon:active { /*解决方块速查表颜色太深看不见字问题*/ .voxelsTableTableData span, .coloredWord { - transition: all 300ms; + transition: background-color 300ms; padding: 5px; border-radius: 3px; } + .voxelsTableTableData span:hover, .coloredWord:hover { background-color: unset !important; } /*Joke Mode Only*/ -.jokeElement{ +.jokeElement { transition: all 300ms; +} + +* { + transition: background-color 0.5s, border-color 0.5s; +} + +.admonition, +summary { + -webkit-user-select: none; + user-select: none; } \ No newline at end of file diff --git a/docs/_assets/icons.css b/docs/_assets/icons.css index 7aea01c..21df240 100644 --- a/docs/_assets/icons.css +++ b/docs/_assets/icons.css @@ -2,7 +2,6 @@ icon, def { display: none; } - .kind-icon { position: relative; border-bottom: 1px solid transparent; @@ -11,9 +10,12 @@ def { cursor: pointer; -webkit-user-select: none; -moz-user-select: none; + user-select: none; font-weight: bold; + transition: border-bottom-color 0.25s; + display: inline-block; } -.kind-icon:hover { +a .kind-icon:hover { border-bottom-color: rgba(32, 148, 243, 0.3); } .kind-icon:active { diff --git a/docs/_assets/iconsParser.js b/docs/_assets/iconsParser.js index 0fd7248..dd769d6 100644 --- a/docs/_assets/iconsParser.js +++ b/docs/_assets/iconsParser.js @@ -2,195 +2,237 @@ const JOKE_MODE = new URL(location).searchParams.get('jokemode') === 'true'; /**@type {HTMLElement | null} */ var $JokeModeonly_element = null; const defsMap = { - any: ['type generic', 'type/any'], - object: ['type generic'], - resources: ["object private", 'resources'], - Box3TickEvent: ["event", "event/TickEvent"], - GameTickEvent: ["event", "event/TickEvent"], - Box3World: ["class", "world"], - world: ["object", "world"], - GameWorld: ["class", "world"], - Box3Entity: ["class", "class/Entity"], - GameEntity: ["class", "class/Entity"], - Box3PlayerEntity: ["type private", "type/PlayerEntity"], - GamePlayerEntity: ["type private", "type/PlayerEntity"], - Box3Player: ["class", "class/Player"], - GamePlayer: ["class", "class/Player"], - URL: ["class", "type/base/URL"], - Box3ClickEvent: ["event", "event/ClickEvent"], - GameClickEvent: ["event", "event/ClickEvent"], - Box3EventChannel: ["type generic", "type/EventChannel"], - GameEventChannel: ["type generic", "event/ClickEvent"], - Box3EventFuture: ["type generic", "type/EventFuture"], - GameEventFuture: ["type generic", "type/EventFuture"], - Box3RespawnEvent: ["event", "event/RespawnEvent"], - GameRespawnEvent: ["event", "event/RespawnEvent"], - Partial: ["type parent-interface generic", "type/base/Partial"], - Box3EntityConfig: ["interface", "type/EntityConfig"], - GameEntityConfig: ["interface", "type/EntityConfig"], - Box3Vector3: ["class", "type/Vector3"], - GameVector3: ["class", "type/Vector3"], - null: ["property parent-interface", "type/base/null"], - Box3SelectorString: ["type", "type/SelectorString"], - GameSelectorString: ["type", "type/SelectorString"], - Number: ["object", "type/base/Number"], - number: ["type generic", "type/base/Number"], - Boolean: ["object", "type/base/Boolean"], - boolean: ["type generic", "type/base/Boolean"], - Box3RaycastOptions: ["interface", "type/RaycastOptions"], - GameRaycastOptions: ["interface", "type/RaycastOptions"], - Box3RaycastResult: ["class", "type/RaycastResult"], - GameRaycastResult: ["class", "type/RaycastResult"], - String: ["object", "type/base/String"], - string: ["type generic", "type/base/String"], - void: ["type generic", "type/base/void"], - never: ["type generic", "type/base/never"], - null: ["static", "type/base/null"], - undefined: ["static", "type/base/undefined"], - Box3Bounds3: ["class", "type/Bounds3"], - GameBounds3: ["class", "type/Bounds3"], - Box3Quaternion: ["class", "type/Quaternion"], - GameQuaternion: ["class", "type/Quaternion"], - Box3ButtonType: ["enum", "type/enum/ButtonType"], - GameButtonType: ["enum", "type/enum/ButtonType"], - Box3AnimationPlaybackConfig: ["interface", "type/AnimationPlaybackConfig"], - GameAnimationPlaybackConfig: ["interface", "type/AnimationPlaybackConfig"], - Box3Animation: ["class", "type/Animation"], - GameAnimation: ["class", "type/Animation"], - Box3WorldKeyframe: ["class", "type/WorldKeyframe"], - GameWorldKeyframe: ["class", "type/WorldKeyframe"], - Box3EntityKeyframe: ["class", "type/EntityKeyframe"], - GameEntityKeyframe: ["class", "type/EntityKeyframe"], - Box3PlayerKeyframe: ["class", "type/PlayerKeyframe"], - GamePlayerKeyframe: ["class", "type/PlayerKeyframe"], - Box3RGBColor: ["class", "type/RGBColor"], - Box3RGBAColor: ["class", "type/RGBAColor"], - GameRGBColor: ["class", "type/RGBColor"], - GameRGBAColor: ["class", "type/RGBAColor"], - Box3SoundEffect: ["interface", "type/SoundEffect"], - GameSoundEffect: ["interface", "type/SoundEffect"], - GameMotionController: ["class", "class/MotionController"], - Box3CameraMode: ["enum", "type/enum/CameraMode"], - GameCameraMode: ["enum", "type/enum/CameraMode"], - Box3CameraFreezedAxis: ["enum private", "type/enum/CameraFreezedAxis"], - GameCameraFreezedAxis: ["enum private", "type/enum/CameraFreezedAxis"], - Box3DamageEvent: ["event", "event/DamageEvent"], - GameDamageEvent: ["event", "event/DamageEvent"], - Box3DieEvent: ["event", "event/DieEvent"], - GameDieEvent: ["event", "event/DieEvent"], - Box3PlayerEntityEvent: ["event parent-class inherited", "event/PlayerEntityEvent"], - GamePlayerEntityEvent: ["event parent-class inherited", "event/PlayerEntityEvent"], - Box3EntityEvent: ["event", "event/EntityEvent"], - GameEntityEvent: ["event", "event/EntityEvent"], - Box3ChatEvent: ["event", "event/ChatEvent"], - GameChatEvent: ["event", "event/ChatEvent"], - Box3InputEvent: ["event", "event/InputEvent"], - GameInputEvent: ["event", "event/InputEvent"], - Box3EntityContactEvent: ["event", "event/EntityContactEvent"], - GameEntityContactEvent: ["event", "event/EntityContactEvent"], - Box3VoxelContactEvent: ["event", "event/VoxelContactEvent"], - GameVoxelContactEvent: ["event", "event/VoxelContactEvent"], - Box3InteractEvent: ["event", "event/InteractEvent"], - GameInteractEvent: ["event", "event/InteractEvent"], - Box3FluidContactEvent: ["event", "event/FluidContactEvent"], - GameFluidContactEvent: ["event", "event/FluidContactEvent"], - GamePurchaseSuccessEvent: ["event", "event/PurchaseSuccessEvent"], - GameSkin: ["type private", "type/Skin"], - GameSkinValue: ["type private", "type/SkinValue"], - Box3SkinInvisible: ["type", "type/SkinInvisible"], - GameSkinInvisible: ["type", "type/SkinInvisible"], - Box3InputDirection: ["enum", "type/enum/InputDirection"], - GameInputDirection: ["enum", "type/enum/InputDirection"], - Box3PlayerMoveState: ["enum", "type/enum/PlayerMoveState"], - GamePlayerMoveState: ["enum", "type/enum/PlayerMoveState"], - Box3PlayerWalkState: ["enum", "type/enum/PlayerWalkState"], - GamePlayerWalkState: ["enum", "type/enum/PlayerWalkState"], - Box3DialogType: ["enum", "type/enum/DialogType"], - GameDialogType: ["enum", "type/enum/DialogType"], - Box3DialogSelectResponse: ["type", "type/DialogSelectResponse"], - GameDialogSelectResponse: ["type", "type/DialogSelectResponse"], - Box3TextDialogParams: ["type", "type/TextDialogParams"], - GameTextDialogParams: ["type", "type/TextDialogParams"], - Box3SelectDialogParams: ["type", "type/SelectDialogParams"], - GameSelectDialogParams: ["type", "type/SelectDialogParams"], - Box3InputDialogParams: ["type", "type/InputDialogParams"], - GameInputDialogParams: ["type", "type/InputDialogParams"], - Box3DialogCancelOption: ["type", "type/DialogCancelOption"], - GameDialogCancelOption: ["type", "type/DialogCancelOption"], - Box3DialogCall: ["type", "type/DialogCall"], - GameDialogCall: ["type", "type/DialogCall"], - Box3AssetListEntry: ["type", "type/DialogCall"], - GameAssetListEntry: ["type", "type/DialogCall"], + any: ['type generic', 'api/type/any', 'type'], + object: ['type generic', 'type'], + resources: ["object private", 'api/resources', 'const'], + Box3TickEvent: ["event", "api/event/TickEvent", 'class'], + GameTickEvent: ["event", "api/event/TickEvent", 'class'], + world: ["object", "api/world", 'const'], + Box3World: ["class", "api/world", 'class'], + GameWorld: ["class", "/api/world", 'class'], + Box3Entity: ["class", "api/class/Entity", 'class'], + GameEntity: ["class", "api/class/Entity", 'class'], + Box3PlayerEntity: ["type private", "api/type/PlayerEntity", 'type'], + GamePlayerEntity: ["type private", "api/type/PlayerEntity", 'type'], + Box3Player: ["class", "api/class/Player", 'class'], + GamePlayer: ["class", "api/class/Player", 'class'], + Box3Zone: ["class", "api/class/Zone", 'class'], + GameZone: ["class", "api/class/Zone", 'class'], + URL: ["class", "api/type/base/URL", 'class'], + Box3ClickEvent: ["event", "api/event/ClickEvent", 'class'], + GameClickEvent: ["event", "api/event/ClickEvent", 'class'], + Box3EventChannel: ["type generic", "api/type/EventChannel", 'type'], + GameEventChannel: ["type generic", "api/type/EventChannel", 'type'], + Box3EventFuture: ["type generic", "api/type/EventFuture", 'type'], + GameEventFuture: ["type generic", "api/type/EventFuture", 'type'], + Box3RespawnEvent: ["event", "api/event/RespawnEvent", 'class'], + GameRespawnEvent: ["event", "api/event/RespawnEvent", 'class'], + Partial: ["type parent-interface generic", "api/type/base/Partial", 'type'], + Box3EntityConfig: ["interface", "api/type/EntityConfig", "interface"], + GameEntityConfig: ["interface", "api/type/EntityConfig", "interface"], + Box3Vector3: ["class", "api/type/Vector3", 'class'], + GameVector3: ["class", "api/type/Vector3", 'class'], + Box3SelectorString: ["type", "api/type/SelectorString", 'type'], + GameSelectorString: ["type", "api/type/SelectorString", 'type'], + Number: ["interface", "api/type/base/Number", 'interface'], + number: ["type generic", "api/type/base/Number", 'type'], + Boolean: ["interface", "api/type/base/Boolean", 'interface'], + boolean: ["type generic", "api/type/base/Boolean", 'type'], + Box3RaycastOptions: ["interface", "api/type/RaycastOptions", 'interface'], + GameRaycastOptions: ["interface", "api/type/RaycastOptions", 'interface'], + Box3RaycastResult: ["class", "api/type/RaycastResult", 'class'], + GameRaycastResult: ["class", "api/type/RaycastResult", 'class'], + String: ["interface", "api/type/base/String", 'interface'], + string: ["type generic", "api/type/base/String", 'type'], + void: ["type generic", "api/type/base/void", 'type'], + never: ["type generic", "api/type/base/never", 'type'], + null: ["static", "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/null", 'keyword'], + undefined: ["static", "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/undefined", 'keyword'], + Box3Bounds3: ["class", "api/type/Bounds3", 'class'], + GameBounds3: ["class", "api/type/Bounds3", 'class'], + Box3Quaternion: ["class", "api/type/Quaternion", 'class'], + GameQuaternion: ["class", "api/type/Quaternion", 'class'], + Box3ButtonType: ["enum", "api/type/enum/ButtonType", 'enum'], + GameButtonType: ["enum", "api/type/enum/ButtonType", 'enum'], + Box3AnimationPlaybackConfig: ["interface", "api/type/AnimationPlaybackConfig", 'interface'], + GameAnimationPlaybackConfig: ["interface", "api/type/AnimationPlaybackConfig", 'interface'], + Box3Animation: ["class", "api/type/Animation", 'class'], + GameAnimation: ["class", "api/type/Animation", 'class'], + Box3WorldKeyframe: ["class", "api/type/WorldKeyframe", 'class'], + GameWorldKeyframe: ["class", "api/type/WorldKeyframe", 'class'], + Box3EntityKeyframe: ["class", "api/type/EntityKeyframe", 'class'], + GameEntityKeyframe: ["class", "api/type/EntityKeyframe", 'class'], + Box3PlayerKeyframe: ["class", "api/type/PlayerKeyframe", 'class'], + GamePlayerKeyframe: ["class", "api/type/PlayerKeyframe", 'class'], + Box3RGBColor: ["class", "api/type/RGBColor", 'class'], + Box3RGBAColor: ["class", "api/type/RGBAColor", 'class'], + GameRGBColor: ["class", "api/type/RGBColor", 'class'], + GameRGBAColor: ["class", "api/type/RGBAColor", 'class'], + Box3SoundEffect: ["interface", "api/type/SoundEffect", 'interface'], + GameSoundEffect: ["interface", "api/type/SoundEffect", 'interface'], + GameMotionController: ["class", "api/class/MotionController", 'class'], + Box3CameraMode: ["enum", "api/type/enum/CameraMode", 'enum'], + GameCameraMode: ["enum", "api/type/enum/CameraMode", 'enum'], + Box3CameraFreezedAxis: ["enum private", "api/type/enum/CameraFreezedAxis", 'hiddenEnum'], + GameCameraFreezedAxis: ["enum private", "api/type/enum/CameraFreezedAxis", 'hiddenEnum'], + Box3DamageEvent: ["event", "api/event/DamageEvent", 'class'], + GameDamageEvent: ["event", "api/event/DamageEvent", 'class'], + Box3DieEvent: ["event", "api/event/DieEvent", 'class'], + GameDieEvent: ["event", "api/event/DieEvent", 'class'], + Box3PlayerEntityEvent: ["event parent-class inherited", "api/event/PlayerEntityEvent", 'class'], + GamePlayerEntityEvent: ["event parent-class inherited", "api/event/PlayerEntityEvent", 'class'], + Box3EntityEvent: ["event", "api/event/EntityEvent", 'class'], + GameEntityEvent: ["event", "api/event/EntityEvent", 'class'], + Box3ChatEvent: ["event", "api/event/ChatEvent", 'class'], + GameChatEvent: ["event", "api/event/ChatEvent", 'class'], + Box3InputEvent: ["event", "api/event/InputEvent", 'class'], + GameInputEvent: ["event", "api/event/InputEvent", 'class'], + GameKeyBoardEvent: ["event", "api/event/KeyBoardEvent", 'class'], + Box3EntityContactEvent: ["event", "api/event/EntityContactEvent", 'class'], + GameEntityContactEvent: ["event", "api/event/EntityContactEvent", 'class'], + Box3VoxelContactEvent: ["event", "api/event/VoxelContactEvent", 'class'], + GameVoxelContactEvent: ["event", "api/event/VoxelContactEvent", 'class'], + Box3InteractEvent: ["event", "api/event/InteractEvent", 'class'], + GameInteractEvent: ["event", "api/event/InteractEvent", 'class'], + Box3FluidContactEvent: ["event", "api/event/FluidContactEvent", 'class'], + GameFluidContactEvent: ["event", "api/event/FluidContactEvent", 'class'], + Box3TriggerEvent: ["event", "api/event/TriggerEvent", 'class'], + GameTriggerEvent: ["event", "api/event/TriggerEvent", 'class'], + GamePurchaseSuccessEvent: ["event", "api/event/PurchaseSuccessEvent", 'class'], + GameSkin: ["type private", "api/type/Skin", 'type'], + GameSkinValue: ["type private", "api/type/SkinValue", 'hiddenType'], + Box3SkinInvisible: ["type", "api/type/SkinInvisible", 'type'], + GameSkinInvisible: ["type", "api/type/SkinInvisible", 'type'], + Box3InputDirection: ["enum", "api/type/enum/InputDirection", 'enum'], + GameInputDirection: ["enum", "api/type/enum/InputDirection", 'enum'], + Box3PlayerMoveState: ["enum", "api/type/enum/PlayerMoveState", 'enum'], + GamePlayerMoveState: ["enum", "api/type/enum/PlayerMoveState", 'enum'], + Box3PlayerWalkState: ["enum", "api/type/enum/PlayerWalkState", 'enum'], + GamePlayerWalkState: ["enum", "api/type/enum/PlayerWalkState", 'enum'], + Box3DialogType: ["enum", "api/type/enum/DialogType", 'enum'], + GameDialogType: ["enum", "api/type/enum/DialogType", 'enum'], + Box3DialogSelectResponse: ["type", "api/type/DialogSelectResponse", 'type'], + GameDialogSelectResponse: ["type", "api/type/DialogSelectResponse", 'type'], + Box3DialogParams: ["type", "api/type/DialogParams", 'type'], + GameDialogParams: ["type", "api/type/DialogParams", 'type'], + Box3TextDialogParams: ["type", "api/type/DialogParams", 'type'], + GameTextDialogParams: ["type", "api/type/DialogParams", 'type'], + Box3SelectDialogParams: ["type", "api/type/DialogParams", 'type'], + GameSelectDialogParams: ["type", "api/type/DialogParams", 'type'], + Box3InputDialogParams: ["type", "api/type/DialogParams", 'type'], + GameInputDialogParams: ["type", "api/type/DialogParams", 'type'], + Box3DialogCancelOption: ["type", "api/type/DialogCancelOption", 'type'], + GameDialogCancelOption: ["type", "api/type/DialogCancelOption", 'type'], + Box3DialogCall: ["type", "api/class/Player/#Box3DialogCall", 'type'], + GameDialogCall: ["type", "api/class/Player/#GameDialogCall", 'type'], + Box3AssetListEntry: ["type", "api/type/DialogCall", 'type'], + GameAssetListEntry: ["type", "api/type/DialogCall", 'type'], + Box3ZoneConfig: ["type", "api/type/ZoneConfig", 'type'], + GameZoneConfig: ["type", "api/type/ZoneConfig", 'type'], + Box3EventHandlerToken: ["class", "api/class/EventHandlerToken", 'class'], + GameEventHandlerToken: ["class", "api/class/EventHandlerToken", 'class'], - Box3DataBase: ["class", "db"], - Box3QueryResult: ["class", 'class/QueryResult'], - GameStorage: ["class", "storage"], - GameDataStorage: ["class", "class/DataStorage"], - db: ["object", "db"], - storage: ["object", "storage"], - gui: ["object private", "gui"], - GameGUI: ["class private", "gui"], - GameGUIEventListener: ["interface private", "type/GUIEventListener"], - GUIConfig: ["type private"], - GUIConfigItem: ["interface private"], - GameGUIEvent: ["event private"], - rtc: ["object private", "rtc"], - GameRTC: ["class private", "rtc"], - GameRTCChannel: ["class private", "class/RTCChannel"], - http: ["object private", "http"], - GameHttpAPI: ["class private", "http"], + Box3DataBase: ["class", "api/db", 'class'], + Box3QueryResult: ["class", 'api/class/QueryResult', 'class'], + GameStorage: ["class", "api/storage", 'class'], + GameDataStorage: ["class", "api/class/DataStorage", 'class'], + QueryList: ["class", "api/class/QueryList", 'class'], + ListPageOptions: ["type", "api/type/ListPageOptions", 'type'], + ReturnValue: ["type", "api/type/ReturnValue", 'type'], + JSONValue: ["type", "api/type/JSONValue", 'type'], + db: ["object", "api/db", 'const'], + storage: ["object", "api/storage", 'const'], + gui: ["object private", "api/gui", 'const'], + GameGUI: ["class private", "api/gui", 'class'], + GameGUIEventListener: ["interface private", "api/type/GUIEventListener", 'hiddenInterface'], + GUIConfig: ["type private", "hiddenType"], + GUIConfigItem: ["interface private", "hiddenInterface"], + GameGUIEvent: ["event private", "hiddenClass"], + rtc: ["object private", "api/rtc", 'hiddenConst'], + GameRTC: ["class private", "api/rtc", "hiddenClass"], + GameRTCChannel: ["class private", "api/class/RTCChannel", "hiddenClass"], + http: ["object private", "api/http", 'hiddenConst'], + Box3HttpAPI: ["class private", "api/http", "hiddenClass"], + GameHttpAPI: ["class private", "api/http", "hiddenClass"], + Box3HttpFetchParams: ["type private", "api/type/HttpFetchParams", "hiddenType"], + GameHttpFetchRequestOptions: ["type private", "api/type/HttpFetchRequestOptions", "hiddenType"], + Box3HttpFetchResponse: ["class private", "api/class/HttpFetchResponse", "hiddenClass"], + GameHttpFetchResponse: ["class private", "api/class/HttpFetchResponse", "hiddenClass"], + GameHttpFetchHeaders: ["type private", "api/type/HttpFetchHeaders", "hiddenType"], + Box3HttpHandler: ["type private", "api/type/HttpHandler", 'type'], + GameHttpHandler: ["type private", "api/type/HttpHandler", 'type'], + Box3HttpRequest: ["class private", "api/class/HttpRequest", 'class'], + GameHttpRequest: ["class private", "api/class/HttpRequest", 'class'], + Box3HttpResponse: ["class private", "api/class/HttpResponse", 'class'], + GameHttpResponse: ["class private", "api/class/HttpResponse", 'class'], - Box3Voxels: ["class", "voxels"], - GameVoxels: ["class", "voxels"], - voxels: ["object", "voxels"], + Box3Voxels: ["class", "api/voxels", "class"], + GameVoxels: ["class", "api/voxels", "class"], + voxels: ["object", "api/voxels", "const"], - Box3BodyPart: ["enum", "type/enum/BodyPart"], - GameBodyPart: ["enum", "type/enum/BodyPart"], + Box3BodyPart: ["enum", "api/type/enum/BodyPart", "enum"], + GameBodyPart: ["enum", "api/type/enum/BodyPart", "enum"], - ServerRemoteChannel: ["class", "class/ServerRemoteChannel"], - PlayerNavigator: ["class private", "class/PlayerNavigator"], - SocialType: ["enum", "enum/SocialType"], + ServerRemoteChannel: ["class", "api/class/ServerRemoteChannel", "class"], + PlayerNavigator: ["class private", "api/class/PlayerNavigator", "hiddenClass"], + SocialType: ["enum", "api/enum/SocialType", "enum"], - Promise: ["object", "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise"], - NavigatorEventType: ["enum private"], + Promise: ["interface", "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise", "interface"], + Map: ["interface", "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Map", "interface"], + ArrayBuffer: ["interface", "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", "interface"], + NavigatorEventType: ["enum private", , "hiddenEnum"], }; const keywordDefsMap = { this: [], } const iconTagMap = { - method: "method parent-class", - listener: "event parent-class", - promiseEvent: "event parent-interface", - event: "event", - function: "function", - arg: "variable parent-enum", - hiddenArg: "variable parent-enum private", - property: "property parent-class", - readonly: "property parent-class protected", - hiddenProperty: "property parent-class private", - hiddenReadonly: "property parent-class private", - hiddenMethod: "method parent-class private", - object: "object", - constructor: "constructor parent-class", - interface: "interface", - class: "class", - staticMethod: "static method parent-class", - hiddenStaticMethod: "static function parent-class private", - inheritedEvent: "event parent-class inherited", - enumMember: "enum-member", - hiddenEnumMember: "enum-member private", - variable: "variable", - type: "type", - keyword: "", - callback: "callback", - callbackArg: "callable parent-enum", + method: ["method parent-class", "#c2c262"], + listener: ["method parent-class", "#c2c262"], + promiseEvent: ["method parent-class", "#c2c262"], + event: ["event", "#00bfa5"], + eventArg: ["event parent-enum", "#00bfa5"], + function: ["function", "#c2c262"], + arg: ["variable parent-enum", "#00b0ff"], + hiddenArg: ["variable parent-enum private", "#00b0ff"], + property: ["property parent-class", "#00b0ff"], + readonly: ["property parent-class protected", "#448aff"], + hiddenProperty: ["property parent-class private", "#00b0ff"], + hiddenReadonly: ["property parent-class private", "#448aff"], + hiddenMethod: ["method parent-class private", "#c2c262"], + object: ["object", "#00b0ff"], + hiddenObject: ["object", "#00b0ff"], + constructor: ["constructor parent-class", "#508fe0"], + interface: ["interface", "#00bfa5"], + hiddenInterface: ["interface private", "#00bfa5"], + class: ["class", "#00bfa5"], + hiddenClass: ["class", "#00bfa5"], + const: ["variable protected", "#448aff"], + hiddenConst: ["variable protected", "#448aff"], + staticMethod: ["static method parent-class", "#c2c262"], + hiddenStaticMethod: ["static function parent-class private", "#c2c262"], + inheritedEvent: ["event parent-class inherited", "#00bfa5"], + enumMember: ["enum-member", "#00b0ff"], + hiddenEnumMember: ["enum-member private", "#00b0ff"], + enum: ["enum", "#00bfa5"], + hiddenEnum: ["enum private", "#00bfa5"], + variable: ["variable", "#00b0ff"], + type: ["type", "#00bfa5"], + hiddenType: ["type private", "#00bfa5"], + keyword: ["", "#508fe0"], + callback: ["callback", "#c2c262"], + callbackArg: ["callable parent-enum", "#c2c262"], + getter: ["getter parent-class", "#448aff"], + setter: ["setter parent-class", "#00b0ff"], + accessor: ["accessor parent-class", "#00b0ff"], }; -function createIconElement(text, id) { +function createIconElement(text, id, color) { const list = id.split(" "); const i = document.createElement("span"); i.classList.add("kind-icon", ...list.filter((s) => !!s)); i.innerText = text.trim(); i.style.display = "inline-block"; + if(color) + i.style.color = color; i.setAttribute("title", "右键单击可复制此处内容"); i.addEventListener("contextmenu", (e) => { e.preventDefault(); @@ -222,8 +264,8 @@ function parse() { if (el.innerHTML.trim() === '' && (Object.keys(defsMap).includes(def))) { iconId = defsMap[def][0]; const prefix = location.href.includes("github.io") - ? "/box3-docs/api/" - : "/api/"; + ? "/box3-docs/" + : "/"; const search = JOKE_MODE ? '?jokemode=true' : ''; if (defsMap[def][1]) { if (defsMap[def][1].startsWith('http://') || defsMap[def][1].startsWith('https://')) { @@ -239,8 +281,8 @@ function parse() { if (def === 'keyword' && Object.keys(keywordDefsMap).includes(innerHTML)) { el.style.fontWeight = 'bold'; const prefix = location.href.includes("github.io") - ? "/box3-docs/api/" - : "/api/"; + ? "/box3-docs/" + : "/"; const search = JOKE_MODE ? '?jokemode=true' : ''; if (keywordDefsMap[innerHTML][0]) { if (keywordDefsMap[innerHTML][0].startsWith('http://') || keywordDefsMap[innerHTML][0].startsWith('https://')) @@ -250,14 +292,15 @@ function parse() { } else { el.href = `javascript:alert$.next("❌ 找不到对应页面")`; } + el.style.color = iconTagMap.type[1]; return; } - iconId = iconTagMap[def]; - el.parentElement.replaceChild(createIconElement(innerHTML, iconId), el); + iconId = iconTagMap[def][0]; + el.parentElement.replaceChild(createIconElement(innerHTML, iconId, iconTagMap[def][1]), el); return; } else return; a.href = href; - const i = createIconElement(def, iconId); + const i = createIconElement(def, iconId, iconTagMap[defsMap[def][2]]?.[1]); a.appendChild(i); el.parentElement.replaceChild(a, el); }); @@ -275,7 +318,7 @@ function parse() { document.querySelectorAll(key).forEach((el) => { const text = el.getAttribute("label") || el.innerHTML; el.parentElement.replaceChild( - createIconElement(text, iconTagMap[key]), + createIconElement(text, iconTagMap[key][0], iconTagMap[key][1]), el ); }); @@ -289,8 +332,8 @@ function parse() { if (Object.keys(defsMap).includes(def)) { iconId = defsMap[def][0]; const prefix = location.href.includes("github.io") - ? "/box3-docs/api/" - : "/api/"; + ? "/box3-docs/" + : "/"; const search = JOKE_MODE ? '?jokemode=true' : ''; if (defsMap[def][1]) { if (defsMap[def][1].startsWith('http://') || defsMap[def][1].startsWith('https://')){ @@ -308,7 +351,7 @@ function parse() { href = "javascript:alert$.next('⚠ 此标识未定义')"; } a.href = href; - const i = createIconElement(def, iconId); + const i = createIconElement(def, iconId, iconTagMap[defsMap[def][2]]?.[1]); a.appendChild(i); el.parentElement.replaceChild(a, el); if (isError) { diff --git a/docs/api/class/DataStorage.md b/docs/api/class/DataStorage.md index e69de29..a375402 100644 --- a/docs/api/class/DataStorage.md +++ b/docs/api/class/DataStorage.md @@ -0,0 +1,130 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +!!! info "Arena独有" + 该API仅在Arena编辑器使用 + +: [查阅官方文档(Arena)](https://box3.yuque.com/staff-khn556/wupvz3/yifnc28uw0e9d8hl) + [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/dwqtzys3uh6ksnnt) + +: 代表数据存储空间的类 + 其操作类似于[](Map),使用键值对储存数据,一个键只能对应一个值,同一数据储存空间不允许存在两个相同的键 + +???+ warning "操作频率限制" + + 对于每一张地图,数据储存空间的操作存在频率限制 + 根据2024/8/7的官方API文档, + : $每分钟写入频率限制 = 60 + (玩家数 \times 10)$ + $每分钟读取频率限制 = 120 + (玩家数 \times 20)$ + + 当前版本下,$玩家数$固定取$70$,也就是说, + : $每分钟写入频率限制 = 60 + (70 \times 10) = 760$[^1] + $每分钟读取频率限制 = 120 + (70 \times 20) = 1520$[^2] + + 同时,对于每一个键值对,也有频率限制 + 根据2024/8/7的官方API文档, + : $每分钟每键值对写入数据量频率限制 = 4MiB/min$[^3] + $每分钟每键值对读取数据量频率限制 = 25MiB/min$[^4] + + 若在编辑端,重启地图并不会重置限制(也就是说你超限了重新运行地图是不行的) + + ~~要是真是这样,一般使用一般不会超过限制吧~~ + + 测试代码如下: + + ```javascript + // 测试同一键值对可写入数据量频率 + var s = storage.getDataStorage('test'); + + (async () => { + for(let i = 0; i < 757; i++){ + s.set('a', 'a'.repeat(5526)).catch((reason) => { + console.error(reason); + }); + console.log("写入", i); + } + console.log('写入完成'); + })(); + ``` + ```javascript + // 测试读取频率,测试时不考虑同一键值对可读取数据量频率 + // 测试数据量为3601条数据 + var s = storage.getDataStorage('test'); + + (async () => { + let cnt = 0; + for(let i = 1; i <= 600; i++){ + s.get('a').catch((reason) => { + console.error(++cnt, reason); + }); + } + console.log("读取", 600); + await sleep(2e3); + for(let i = 1; i <= 3001; i++){ + s.get('a').catch((reason) => { + console.error(++cnt, reason); + }); + if(i % 100 === 0) { + console.log("读取", i); + await sleep(500); + } + } + console.log('读取完成', cnt); + })(); + ``` + + [^1]: 根据2024/8/7实际测试,编辑端每分钟只能写入$759$条数据 + [^2]: 根据2024/8/7实际测试,编辑端每分钟只能读取$3600$条数据 + [^3]: 根据实际测试,键的大小也被包含在内。也就是说,键的长度也会影响能存入的数据量。但数据储存空间的名称不会影响。 + [^4]: 根据实际测试,键的大小也被包含在内 + +## 属性 +[key](readonly): [](string) +: 只读,当前数据储存空间名称 + +## 方法 +[set](method)([key](arg): [](string), [value](arg): [](JSONValue)) => [](Promise)<[](void)> +: 设置该数据储存空间中指定键的值 + +[update](method)([key](arg): [](string), [handler](callbackArg): ([prevValue](arg): [](ReturnValue)) => [](JSONValue)) => [](Promise)<[](void)> +: 使用回调函数,设置该数据储存空间中指定键的值 + +[get](method)([key](arg): [](string)) => [](Promise)<[](ReturnValue)> +: 获取该数据储存空间中指定键的值 + +[list](method)([options](arg): [](ListPageOptions)) => [](Promise)<[](QueryList)> +: 批量列出该数据储存空间的值 + +[remove](method)([key](arg): [](string)) => [](Promise)<[](ReturnValue)> +: 移除该数据储存空间中指定键的值 + +[destroy](hiddenMethod)() => [](Promise)<[](void)> +: 销毁该数据储存空间 + + +## 错误码 +!!! info "当数据库发生错误时,返回JSON格式的错误信息" + + 返回的错误信息: + : [status](property): [](string) + : 对应下表的状态 + : [code](property): [](number) + : 对应下表的错误码 + : [msg](property): [](string) + : 对应下表的信息 + +| 错误码 | 状态 | 信息 | 说明 | +| :-: | - | - | :-: | +| `#!javascript 400` | `#!javascript DB_NAME_INVALID` | `Invalid data storage name.` | 数据储存空间名称无效 | +| `#!javascript 400` | `#!javascript KEY_INVALID` | `Invalid data key.` | 数据键无效 | +| `#!javascript 400` | `#!javascript VALUE_INVALID` | `Invalid data value.` | 数据值无效 | +| `#!javascript 400` | `#!javascript PARAMS_INVALID` | `Invalid parameters.` | 参数无效 | +| `#!javascript 429` | `#!javascript REQUEST_THROTTLED` | `Too Many Requests` | 操作频率超过限制 | +| `#!javascript 500` | `#!javascript SERVER_FETCH_ERROR` | `Server network error.` | 服务器网络错误 | +| `#!javascript 500` | `#!javascript SERVER_FETCH_ERROR` | `写频率过高,触发限流` | 键值对写入频率过高 | +| `#!javascript 500` | `#!javascript SERVER_FETCH_ERROR` | `读数据量超限,触发限流` | 读取频率过高 | +| `#!javascript 500` | `#!javascript UNKNOWN` | `Unknown server error.` | 未知错误 | +| 未知,待补充 | `#!javascript CONSTRAINT_TARGET_INVALID` | 未知,待补充 | 约束目标无效 | +| 未知,待补充 | `#!javascript DB_NAME_INVALID` | 未知,待补充 | 数据库名称无效 | \ No newline at end of file diff --git a/docs/api/class/Entity.md b/docs/api/class/Entity.md index b8e754b..f02903d 100644 --- a/docs/api/class/Entity.md +++ b/docs/api/class/Entity.md @@ -3,9 +3,9 @@ !!! info "这是一个服务端API" 该API仅在服务端脚本使用 -: [查阅官方文档](https://box3.yuque.com/org-wiki-box3-ev7rl4/guide/aqkg27coplqk183f) - [查阅官方文档(Arena)](https://box3.yuque.com/staff-khn556/wupvz3/kgrabhf749axn65y) - [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/crnsxu2gtymwx013) +: [查阅官方文档](https://box3.yuque.com/org-wiki-box3-ev7rl4/guide/aqkg27coplqk183f) + [查阅官方文档(Arena)](https://box3.yuque.com/staff-khn556/wupvz3/kgrabhf749axn65y) + [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/crnsxu2gtymwx013) : [](Box3Entity) / [](GameEntity)实体是Box3中的游戏对象,用于对物体、玩家等的控制。 @@ -366,24 +366,24 @@ ??? example "示例" - ```javascript - // 玩家牌喷泉 - world.onPlayerJoin(({ entity }) => { - entity.particleRate = 300; - entity.particleLimit = 1000; - entity.particleLifetime = 1.8; - entity.particleDamping = -1; - entity.particleSize = [1, 2, 4, 4, 4]; - entity.particleColor[0].set(1, 1, 1); - entity.particleColor[1].set(0.5, 0.5, 1); - entity.particleColor[2].set(0.1, 0.1, 1); - entity.particleColor[3].set(0, 0, 1); - entity.particleColor[4].set(0, 0, 1); - entity.particleVelocity.set(0, 9, 0); - entity.particleVelocitySpread.set(5, 1, 5); - entity.particleAcceleration.set(0, -10, 0); - }); - ``` + ```javascript + // 玩家牌喷泉 + world.onPlayerJoin(({ entity }) => { + entity.particleRate = 300; + entity.particleLimit = 1000; + entity.particleLifetime = 1.8; + entity.particleDamping = -1; + entity.particleSize = [1, 2, 4, 4, 4]; + entity.particleColor[0].set(1, 1, 1); + entity.particleColor[1].set(0.5, 0.5, 1); + entity.particleColor[2].set(0.1, 0.1, 1); + entity.particleColor[3].set(0, 0, 1); + entity.particleColor[4].set(0, 0, 1); + entity.particleVelocity.set(0, 9, 0); + entity.particleVelocitySpread.set(5, 1, 5); + entity.particleAcceleration.set(0, -10, 0); + }); + ``` [particleNoise](property): [](number) : 粒子扰动幅度,数值越大,各个粒子的运动相对原有方向的偏离越明显 @@ -418,6 +418,10 @@ [tags](method)() => [](string)[] : 获取实体的所有标签 + !!! warning "警告" + + 尽管其命名非常像一个属性,但这其实是一个方法 + [addTag](method)([tag](arg): [](string)) => [](void) diff --git a/docs/api/class/EventHandlerToken.md b/docs/api/class/EventHandlerToken.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/api/class/HttpFetchResponse.md b/docs/api/class/HttpFetchResponse.md new file mode 100644 index 0000000..ebfcadf --- /dev/null +++ b/docs/api/class/HttpFetchResponse.md @@ -0,0 +1,43 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +!!! info "建议在Arena使用" + + 该API建议在Arena编辑器使用 + 旧版编辑器上也有此API,但可用性未知 + +: [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/qte7ch2h5i62voue) + +: 请求的响应结果 + +## 属性 +[status](readonly): [](number) +: 请求状态码 + +[statusText](readonly): [](string) +: 请求状态文本信息 + +[headers](readonly): [](GameHttpFetchHeaders) +: 响应头内容 + + !!! info "Arena独有" + 此属性仅在Arena编辑器中使用 + +## 方法 +[json](method): [](Promise)<[](any)> +: 获取该请求JSON化的内容 + +[text](method): [](Promise)<[](string)> +: 获取该请求文本化的内容 + +[arrayBuffer](method): [](Promise)<[](ArrayBuffer)> +: 获取该请求的二进制内容 + +[close](method): [](Promise)<[](void)> +: 关闭该请求 + +[ok](getter)() => [](boolean) +: 该请求是否成功 + diff --git a/docs/api/class/HttpRequest.md b/docs/api/class/HttpRequest.md new file mode 100644 index 0000000..ee160dd --- /dev/null +++ b/docs/api/class/HttpRequest.md @@ -0,0 +1,12 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +: HTTP请求 + +## 属性 +无(是的你没看错) + +## 方法 +无(是的你没看错) \ No newline at end of file diff --git a/docs/api/class/HttpResponse.md b/docs/api/class/HttpResponse.md new file mode 100644 index 0000000..787b0f7 --- /dev/null +++ b/docs/api/class/HttpResponse.md @@ -0,0 +1,12 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +: HTTP响应 + +## 属性 +无(是的你没看错) + +## 方法 +无(是的你没看错) \ No newline at end of file diff --git a/docs/api/class/Player.md b/docs/api/class/Player.md index 6e037ca..6f61e25 100644 --- a/docs/api/class/Player.md +++ b/docs/api/class/Player.md @@ -116,12 +116,12 @@ !!! example "示例" - ```javascript - // 隐藏玩家的头部 - world.onPlayerJoin(({ entity }) => { - entity.player.skinInvisible.head = true; - }); - ``` + ```javascript + // 隐藏玩家的头部 + world.onPlayerJoin(({ entity }) => { + entity.player.skinInvisible.head = true; + }); + ``` [showName](property): [](boolean) = `#!javascript true` : 是否显示玩家名称 @@ -137,12 +137,12 @@ ??? example "示例" - ```javascript - // 玩家进入游戏的时候缩小到0.25倍 - world.onPlayerJoin(({ entity }) => { - entity.player.scale = 0.25; - }); - ``` + ```javascript + // 玩家进入游戏的时候缩小到0.25倍 + world.onPlayerJoin(({ entity }) => { + entity.player.scale = 0.25; + }); + ``` [emissive](property): [](number) : 玩家的发光度,范围$[0, 1]$ @@ -152,7 +152,7 @@ ??? example "示例" - ``` + ```javascript // 使玩家发光 world.onPlayerJoin(({ entity }) => { entity.player.emissive = 1; @@ -613,7 +613,7 @@ 虽然这个方法的命名很像一个属性,但其实这是一个方法 具体见下面的示例 - !!! failure "错误示例" + ???+ failure "错误示例" ```javascript // 玩家按下右键时,告诉玩家所有穿戴配件的数量 @@ -624,7 +624,7 @@ }); ``` - !!! success "正确示例" + ???+ success "正确示例" ```javascript // 玩家按下右键时,告诉玩家所有穿戴配件的数量 @@ -667,7 +667,7 @@ 在打开对话框(特别是选择和输入对话框)时,需要注意其调用 该方法返回的是一个[](Promise) & ([](Box3DialogCancelOption) / [](GameDialogCancelOption)),而不是直接的结果 - !!! failure "错误示例" + ???+ failure "错误示例" ```javascript world.onPlayerJoin(({ entity }) => { @@ -694,7 +694,7 @@ }); ``` - !!! success "正确示例" + ???+ success "正确示例" 下面是上面的错误示例的几种正确写法 实际使用时,可以将`await`和[](Promise)搭配使用,而不是像下面只使用一种 @@ -979,6 +979,19 @@ [cancelDialogs](method)() => [](void) : 关闭玩家所有打开的对话框 + +[](Box3DialogCall) = ( + ([params](arg): [](Box3TextDialogParams)) => [](Promise)<[](string) | [](null)> & [](Box3DialogCancelOption) | + ([params](arg): [](Box3SelectDialogParams)) => [](Promise)<[](Box3DialogSelectResponse) | [](null)> & [](Box3DialogCancelOption) | + ([params](arg): [](Box3InputDialogParams)) => [](Promise)<[](string) | [](null)> & [](Box3DialogCancelOption) +) + +[](GameDialogCall) = ( + ([params](arg): [](GameTextDialogParams)) => [](Promise)<[](string) | [](null)> & [](GameDialogCancelOption) | + ([params](arg): [](GameSelectDialogParams)) => [](Promise)<[](GameDialogSelectResponse) | [](null)> & [][](GameDialogCancelOption) | + ([params](arg): [](GameInputDialogParams)) => [](Promise)<[](string) | [](null)> & [](GameDialogCancelOption) +) + ### 复活 [forceRespawn](method)() => [](void) : 将玩家的血量回满,并将玩家传送回出生点 @@ -986,13 +999,13 @@ ### 摄像机相关 [setCameraPitch](method)([v](arg): [](number)) => [](void) -: 设置玩家视角准心绕x轴(视角的上下移动)的旋转**弧度** +: 设置玩家视角准心绕x轴(视角的上下移动)的旋转 **弧度** !!! info "Arena 独有" 该方法仅在Arena编辑器中使用 [setCameraYaw](method)([v](arg): [](number)) => [](void) -: 设置玩家视角准心绕y轴(视角的左右移动)的旋转**弧度** +: 设置玩家视角准心绕y轴(视角的左右移动)的旋转 **弧度** !!! info "Arena 独有" 该方法仅在Arena编辑器中使用 @@ -1101,3 +1114,16 @@ [onRelease](listener) : [](Box3EventChannel) / [](GameEventChannel) <[](Box3InputEvent) / [](GameInputEvent)> [nextRelease](promiseEvent) : [](Box3EventFuture) / [](GameEventFuture) <[](Box3InputEvent) / [](GameInputEvent)> : 当玩家松开按键(或未来)触发 + +[onKeyDown](listener) : [](GameEventChannel) <[](GameKeyBoardEvent)> +: 当玩家按下键盘按键触发 + + !!! info "Arena 独有" + 该事件仅在Arena编辑器中使用 + + +[onKeyUp](listener) : [](GameEventChannel) <[](GameKeyBoardEvent)> +: 当玩家松开键盘按键触发 + + !!! info "Arena 独有" + 该事件仅在Arena编辑器中使用 diff --git a/docs/api/class/QueryList.md b/docs/api/class/QueryList.md new file mode 100644 index 0000000..84ab8f7 --- /dev/null +++ b/docs/api/class/QueryList.md @@ -0,0 +1,31 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +!!! info "Arena独有" + 该API仅在Arena编辑器使用 + +: [查阅官方文档(Arena)](https://box3.yuque.com/staff-khn556/wupvz3/dw93mzb6q0d5d181) + [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/dwqtzys3uh6ksnnt#hfKS5) + +## 属性 +[isLastPage](readonly): [](boolean) +: 是否为最后一页 + + !!! info "如果反过头了,也为`#!javascript true`" + +## 方法 +[getCurrentPage](method)() => [](ReturnValue)[] +: 获取当前页数据 + + !!! warning "警告" + + 其返回值 **不是**[](Promise) + +[nextPage](method)() => [](Promise)<[](void)> +: 翻到下一页 + + !!! warning "警告" + + 这是一个[](Promise) diff --git a/docs/api/class/RTCChannel.md b/docs/api/class/RTCChannel.md index 99cbf71..bbec0cc 100644 --- a/docs/api/class/RTCChannel.md +++ b/docs/api/class/RTCChannel.md @@ -14,7 +14,7 @@ 若地图无法进入,可以先尝试等待容器重启(3~5min);若仍无效,则需寻求官方帮助 - 编者注:为了测试RTC损失一张空白地图 + 编者注:为了测试RTC损失一张空白地图,等了一天都没用 : [查阅社区文档](https://www.yuque.com/box3lab/api/ogh9sncntyg18gd5) diff --git a/docs/api/class/Zone.md b/docs/api/class/Zone.md index e69de29..6e5d418 100644 --- a/docs/api/class/Zone.md +++ b/docs/api/class/Zone.md @@ -0,0 +1,147 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +: [查阅官方文档](https://box3.yuque.com/org-wiki-box3-ev7rl4/guide/uvxcoaf8ywsh3t78) + [查阅官方文档(Arena)](https://box3.yuque.com/staff-khn556/wupvz3/puh5iyu2e8s1lar8) + [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/zqv1iks07wvzbs0m) + +: [](Box3Zone) / [](GameZone)用于检测实体进入或离开某个区域。 也可以用来设置环境参数,如雾、雨、天、雪、风、重力等定义区域内的环境参数 + +!!! note "未证实" + + 似乎现在的区域就是原来的触发器改名而来,但未得到证实 + 原因是[](Box3Zone) / [](GameZone)的注释为: + ``` + Triggers can be used to detect when an object enters some zone or leaves. + ``` + +### 属性 +[bounds](property): [](Box3Bounds3) / [](GameBounds3) +: 该区域的立方体空间区域 + +[selector](property): [](Box3SelectorString) / [](GameSelectorString) +: 区域使用的选择器,该区域的效果/事件只能作用在满足该选择器的实体上 + +[massScale](property): [](number) +: 实体在该区域内质量[mass](property)的缩放 + +[force](property): [](Box3Vector3) / [](GameVector3): +: 实体在该区域内每tick都会受到的作用力 + +[fogEnabled](property): [](boolean) +: 是否在该区域内启用单独的雾 + +[fogColor](property): [](Box3RGBColor) / [](GameRGBColor) +: 该区域内雾的颜色 + +[fogStartDistance](property): [](number) +: 该区域内雾的起始距离 + +[fogHeightOffset](property): [](number) +: 该区域内雾高度 + +[fogHeightFalloff](property): [](number) +: 该区域内的雾衰减速率 + +[fogDensity](property): [](number) +: 该区域内的均匀雾量 + +[fogMax](property): [](number) +: 该区域内的最大雾量 + +[snowEnabled](property): [](boolean) +: 是否在该区域内启用单独的雪 + +[snowDensity](property): [](number): +: 该区域的雪密度 + +[snowSizeLo](property): [](number) +: 该区域雪花最小尺寸 + +[snowSizeHi](property): [](number) +: 该区域雪花最大尺寸 + +[snowFallSpeed](property): [](number) +: 该区域雪花下落速率 + +[snowSpinSpeed](property): [](number) +: 该区域雪花自旋速度 + +[snowColor](property): [](Box3RGBAColor) / [](GameRGBAColor) +: 该区域雪花颜色 +[snowTexture](property): [](string) +: 该区域雪花纹理,格式为`#!javascript 'snow/*.part'` + +[rainEnabled](property): [](boolean) +: 是否在该区域内启用单独的雨 + +[rainDensity](property): [](number) +: 该区域的雨密度 + +[rainDirection](property): [](Box3Vector3) / [](GameVector3) +: 该区域雨的方向 + +[rainSpeed](property): [](number) +: 该区域雨点下落速率 + +[rainSizeLo](property): [](number) +: 该区域雨点最小尺寸 + +[rainSizeHi](property): [](number) +: 该区域雨点最大尺寸 + +[rainInterference](property): [](number) +: 该区域雨扰流幅度 + +[rainColor](property): [](Box3RGBAColor) / [](GameRGBAColor) +: 该区域雨点颜色 + +[skyEnabled](property): [](boolean) +: 是否在该区域内启用单独的天空光照 + +[skyMode](property): `#!javascript 'natural'` | `#!javascript 'manual'` +: 该区域内光照模式 + + === "`#!javascript 'natural'` 自然光照" + + [skySunPhase](property): [](number) + : 该区域内太阳运行阶段,按照`#!javascript timeOfDay = (sunPhase + sunFrequency * tick) % 1`公式计算 + + [skySunFrequency](property): [](number) + : 该区域内太阳在天空中移动的频率。 数值越高,太阳运动越快 + + [skyLunarPhase](property): [](number) 该区域内月亮的相位,范围$[0, 1]$ + + === "`#!javascript 'manual'` 手动光照" + + [skySunDirection](property): [](Box3Vector3) / [](GameVector3) + : 该区域内太阳的方向 + + [skySunLight](property): [](Box3RGBColor) / [](GameRGBColor) + : 该区域内太阳的光照颜色 + + [skyLeftLight](property): [](Box3RGBColor) / [](GameRGBColor) + [skyRightLight](property): [](Box3RGBColor) / [](GameRGBColor) + [skyBottomLight](property): [](Box3RGBColor) / [](GameRGBColor) + [skyTopLight](property): [](Box3RGBColor) / [](GameRGBColor) + [skyFrontLight](property): [](Box3RGBColor) / [](GameRGBColor) + [skyBackLight](property): [](Box3RGBColor) / [](GameRGBColor) + : 该区域内太阳分别在`-x`、`+x`、`-y`、`+y`、`-z`、`+z`方向的光照颜色 + +### 方法 +[entities](method)() => [](Box3Entity)[] / [](GameEntity)[] +: 获取该区域内所有的实体 + +[remove](method)() => [](void) +: 移除该区域 + +#### 事件 +[onEnter](method): [](Box3EventChannel) / [](GameEventChannel)<[](Box3TriggerEvent) / [](GameTriggerEvent)> +[nextEnter](method): [](Box3EventFuture) / [](GameEventFuture)<[](Box3TriggerEvent) / [](GameTriggerEvent)> +: 当实体进入(或未来)触发的事件 + +[onLeave](method): [](Box3EventChannel) / [](GameEventChannel)<[](Box3TriggerEvent) / [](GameTriggerEvent)> +[nextLeave](method): [](Box3EventFuture) / [](GameEventFuture)<[](Box3TriggerEvent) / [](GameTriggerEvent)> +: 当实体离开(或未来)触发的事件 \ No newline at end of file diff --git a/docs/api/event/ChatEvent.md b/docs/api/event/ChatEvent.md index 61b0e54..2e1ac2a 100644 --- a/docs/api/event/ChatEvent.md +++ b/docs/api/event/ChatEvent.md @@ -1,7 +1,7 @@ Box3 中聊天触发的事件 Chat 本意为”聊天“,在此地表示实体聊天所触发的事件。 -实体聊天 box3 中表示为物体在地图聊天区域主动/被动发送文字 +实体聊天 Box3 中表示为物体在地图聊天区域主动/被动发送文字 触发方法由[](Box3World).[onChat](event) / [](GameWorld).[onChat](event)和[](Box3Entity).[onChat](event) / [](GameEntity)[onChat](event)组成 diff --git a/docs/api/event/EntityEvent.md b/docs/api/event/EntityEvent.md index bce7caf..94367b3 100644 --- a/docs/api/event/EntityEvent.md +++ b/docs/api/event/EntityEvent.md @@ -5,14 +5,13 @@ Box3 中当创建或销毁实体时触发的事件 2. `world`内实体被创建或销毁:Box3World.onEntityCreate,Box3World.onEntityDestroy 3. 指定`Box3Entity`被销毁:Box3Entity.onDestroy -## 示例代码 +!!! note "内容待补充" -```javascript -world.onPlayerJoin((entityEvent) => { - // entityEvent.entity - // entityEvent.tick -}); -``` + 待测试该事件是否能由玩家实体触发 + +!!! failure "类型错误" + + 该页面存在和[](Box3PlayerEntityEvent) / [](GamePlayerEntityEvent)混淆的问题,待修正 ## 事件参数 diff --git a/docs/api/event/KeyBoardEvent.md b/docs/api/event/KeyBoardEvent.md index e69de29..c484617 100644 --- a/docs/api/event/KeyBoardEvent.md +++ b/docs/api/event/KeyBoardEvent.md @@ -0,0 +1,123 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +: [查阅官方文档(Arena)](https://box3.yuque.com/staff-khn556/wupvz3/su9rkpkv6yte84s8) + [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/rgssolkr068w0fy9#anWjP) + + +Box3 中键盘触发的事件 +由[](GameWorld).[onKeyDown](event)、[](GameWorld).[onKeyUp](event)触发 + +## 事件参数 +[tick](property): [](number) +: 键盘事件发生的时间 + +[keyCode](property): [](number) +: 按下/松开键盘的按钮keyCode + +## keyCode 映射表 +来源: + + +| 按键 | KeyCode | +| :-: | :-: | +| Esc | `#!javascript 27` | +| F1 | `#!javascript 112` | +| F2 | `#!javascript 113` | +| F3 | `#!javascript 114` | +| F4 | `#!javascript 115` | +| F5 | `#!javascript 116` | +| F6 | `#!javascript 117` | +| F7 | `#!javascript 118` | +| F8 | `#!javascript 119` | +| F9 | `#!javascript 120` | +| F10 | `#!javascript 121` | +| F11 | `#!javascript 122` | +| F12 | `#!javascript 123` | +| 主键盘区 0 | `#!javascript 48` | +| 主键盘区 1 | `#!javascript 49` | +| 主键盘区 2 | `#!javascript 50` | +| 主键盘区 3 | `#!javascript 51` | +| 主键盘区 4 | `#!javascript 52` | +| 主键盘区 5 | `#!javascript 53` | +| 主键盘区 6 | `#!javascript 54` | +| 主键盘区 7 | `#!javascript 55` | +| 主键盘区 8 | `#!javascript 56` | +| 主键盘区 9 | `#!javascript 57` | +| A | `#!javascript 65` | +| B | `#!javascript 66` | +| C | `#!javascript 67` | +| D | `#!javascript 68` | +| E | `#!javascript 69` | +| F | `#!javascript 70` | +| G | `#!javascript 71` | +| H | `#!javascript 72` | +| I | `#!javascript 73` | +| J | `#!javascript 74` | +| K | `#!javascript 75` | +| L | `#!javascript 76` | +| M | `#!javascript 77` | +| N | `#!javascript 78` | +| O | `#!javascript 79` | +| P | `#!javascript 80` | +| Q | `#!javascript 81` | +| R | `#!javascript 82` | +| S | `#!javascript 83` | +| T | `#!javascript 84` | +| U | `#!javascript 85` | +| V | `#!javascript 86` | +| W | `#!javascript 87` | +| X | `#!javascript 88` | +| Y | `#!javascript 89` | +| Z | `#!javascript 90` | +| ~
\` | `#!javascript 192` | +| _
- | `#!javascript 189` | +| +
= | `#!javascript 187` | +| \|
\\ | `#!javascript 220` | +| {
[ | `#!javascript 219` | +| }
] | `#!javascript 221` | +| :
; | `#!javascript 186` | +| "
' | `#!javascript 222` | +| <
, | `#!javascript 188` | +| >
. | `#!javascript 190` | +| ?
/ | `#!javascript 191` | +| Tab | `#!javascript 9` | +| 大写锁定键 Caps Lock | `#!javascript 20` | +| Shift | `#!javascript 16` | +| Ctrl / 左Control | `#!javascript 17` | +| Alt | `#!javascript 18` | +| 空格 | `#!javascript 32` | +| 回车键 Enter | `#!javascript 13` | +| Context Menu | `#!javascript 93` | +| 退格键 Backspace | `#!javascript 8` | +| 截图键 Print Screen | `#!javascript 44` | +| 滚动锁定键 Scroll Lock | `#!javascript 145` | +| Pause / Pause Break | `#!javascript 19` | +| Insert | `#!javascript 45` | +| Home | `#!javascript 36` | +| Page Up | `#!javascript 33` | +| Delete | `#!javascript 46` | +| End | `#!javascript 35` | +| Page Down | `#!javascript 34` | +| ↑ | `#!javascript 38` | +| ↓ | `#!javascript 40` | +| ← | `#!javascript 37` | +| → | `#!javascript 39` | +| Num Lock | `#!javascript 144` | +| 小键盘区 0 | `#!javascript 96` | +| 小键盘区 1 | `#!javascript 97` | +| 小键盘区 2 | `#!javascript 98` | +| 小键盘区 3 | `#!javascript 99` | +| 小键盘区 4 | `#!javascript 100` | +| 小键盘区 5 | `#!javascript 101` | +| 小键盘区 6 | `#!javascript 102` | +| 小键盘区 7 | `#!javascript 103` | +| 小键盘区 8 | `#!javascript 104` | +| 小键盘区 9 | `#!javascript 105` | +| 小键盘区 . | `#!javascript 110` | +| 小键盘区 + | `#!javascript 107` | +| 小键盘区 - | `#!javascript 109` | +| 小键盘区 * | `#!javascript 106` | +| 小键盘区 / | `#!javascript 111` | \ No newline at end of file diff --git a/docs/api/event/PlayerEntityEvent.md b/docs/api/event/PlayerEntityEvent.md index 3db74a3..b23f43b 100644 --- a/docs/api/event/PlayerEntityEvent.md +++ b/docs/api/event/PlayerEntityEvent.md @@ -1 +1,11 @@ -与Box3EntityEvent类似,但是确保其中的entity一定是玩家实体。 +与Box3EntityEvent / GameEntityEvent类似,但是确保其中的entity一定是玩家实体。 + +[](Box3PlayerEntityEvent) / [](GamePlayerEntityEvent) = [](Box3EntityEvent) / [](GameEntityEvent) & {[entity](property): [](Box3PlayerEntity) / [](GamePlayerEntity)} + + +```javascript +world.onPlayerJoin((entityEvent) => { + // entityEvent.entity + // entityEvent.tick +}); +``` \ No newline at end of file diff --git a/docs/api/event/TriggerEvent.md b/docs/api/event/TriggerEvent.md new file mode 100644 index 0000000..73b1efe --- /dev/null +++ b/docs/api/event/TriggerEvent.md @@ -0,0 +1,13 @@ + + +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 + +Box3中区域(触发器)事件 + +## 事件参数 +[tick](property): [](number) +: 事件触发的tick + +[entity](property): [](Box3Entity) / [](GameEntity) +: 触发事件的实体 \ No newline at end of file diff --git a/docs/api/gui.md b/docs/api/gui.md index 7f73379..c080c92 100644 --- a/docs/api/gui.md +++ b/docs/api/gui.md @@ -4,7 +4,6 @@ 该API仅在服务端脚本使用 !!! info "Arena独有" - 该API仅在Arena编辑器使用 : [](GameGUI)是在 **服务端** 控制客户端GUI的[类](class) diff --git a/docs/api/http.md b/docs/api/http.md index 651b50c..36743be 100644 --- a/docs/api/http.md +++ b/docs/api/http.md @@ -1,9 +1,52 @@ -!!! bug "页面缺失" + - API文档内容繁多,有一些页面还未完工。 +!!! info "这是一个服务端API" + 该API仅在服务端脚本使用 - 如果你愿意为此贡献一份力量,请[加入我们](/about) +!!! info "建议在Arena使用" - [似乎官方也没有文档](){.md-button} - [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/obiw5557v5m67ziw){.md-button} - [返回](javascript:history.back()){.md-button} + 该API建议在Arena编辑器使用 + 旧版编辑器上也有此API,但可用性未知 + +: [查阅社区文档(Arena)](https://www.yuque.com/box3lab/api/obiw5557v5m67ziw) + +: [](Box3HttpAPI) / [](GameHttpAPI)是实现外部网络请求的[类](class) + [](Box3HttpAPI) / [](GameHttpAPI)无法(很难)被实例化,但在全局存在一个单例对象[](http) + +## 属性 +[url](hiddenReadonly): [](string) +: 服务器链接 + 2024/8/7测试 结果为`#!javascript "http://localhost"` + + !!! info "不适用于Arena" + + 该属性在Arena编辑器中不存在 + +## 方法 +[仅旧版编辑器][fetch](hiddenMethod)([url](arg): [](string), [params](arg)?: [](Box3HttpFetchParams)) => [](Promise)<[](Box3HttpFetchResponse)> +[仅Arena编辑器][fetch](hiddenMethod)([url](arg): [](string), [options](arg)?: [](GameHttpFetchRequestOptions)) => [](Promise)<[](GameHttpFetchResponse)> +: 发送HTTP请求 + + !!! warning "警告" + + 只有被Box3列入白名单的网站才能发送请求 + + ??? example "示例" + + === "Arena 编辑器" + + ```javascript + http.fetch('dao3.fun', { + header: { + "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36' + } + }).then(() => console.log('收到数据')); + ``` + +### 事件 +[onRequest](method)([handler](callbackArg): [](Box3HttpHandler)) => [](void) +: 当收到HTTP请求时,触发的事件 + + !!! info "不适用于Arena" + + 该方法在Arena编辑器中不存在 \ No newline at end of file diff --git a/docs/api/icons.md b/docs/api/icons.md index 49594e6..8ee3ebe 100644 --- a/docs/api/icons.md +++ b/docs/api/icons.md @@ -74,6 +74,7 @@ API 文档中会出现一些表示类型的图标,下面是常用图标的含 padding: 0 8px; border: 1px solid transparent; transition-duration: 0.25s; + display: block; } .icon-item:hover{ background: rgba(32, 148, 243, 0.3); @@ -85,7 +86,7 @@ API 文档中会出现一些表示类型的图标,下面是常用图标的含 }