From 3fec4a43e72fe04b4a09ec719296cac091b209bc Mon Sep 17 00:00:00 2001 From: Yoshiki Ohshima Date: Thu, 31 Aug 2023 17:19:37 -0700 Subject: [PATCH] add import line --- behaviors/default/bouncingBall.js | 13 +++++++++++-- behaviors/default/csmLights.js | 11 ++++++++++- behaviors/default/demo.js | 11 ++++++++++- behaviors/default/lights.js | 11 ++++++++++- behaviors/default/mirror.js | 13 +++++++++++-- behaviors/default/openPortal.js | 13 +++++++++++-- behaviors/default/pool.js | 12 ++++++++++-- behaviors/default/replaceWorld.js | 11 ++++++++++- behaviors/default/spatialSound.js | 13 +++++++++++-- behaviors/default/spin.js | 13 +++++++++++-- behaviors/default/synchronousLoad.js | 11 ++++++++++- behaviors/default/text3D.js | 10 +++++++++- behaviors/default/urlLink.js | 15 ++++++++++++--- behaviors/default/video.js | 18 +++++++++++++----- 14 files changed, 149 insertions(+), 26 deletions(-) diff --git a/behaviors/default/bouncingBall.js b/behaviors/default/bouncingBall.js index 5b25e03..d6d51cb 100644 --- a/behaviors/default/bouncingBall.js +++ b/behaviors/default/bouncingBall.js @@ -3,7 +3,16 @@ // A very simple demonstration of how to create a similar application // using the DynamicTexture surface. -class BouncingLogoActor { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class BouncingLogoActor extends ActorBehavior { setup() { this.SPEED = 10; this.position = [512, 512]; @@ -51,7 +60,7 @@ class BouncingLogoActor { } } -class BouncingLogoPawn { +class BouncingLogoPawn extends PawnBehavior { setup() { this.updatePosition(this.actor.position); this.listen("updatePosition", "updatePosition"); diff --git a/behaviors/default/csmLights.js b/behaviors/default/csmLights.js index 2ae6c3b..9c508a7 100644 --- a/behaviors/default/csmLights.js +++ b/behaviors/default/csmLights.js @@ -1,4 +1,13 @@ -class LightPawn { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class LightPawn extends PawnBehavior { setup() { console.log("LightPawn"); let trm = this.service("ThreeRenderManager"); diff --git a/behaviors/default/demo.js b/behaviors/default/demo.js index 3d3118f..49e26f1 100644 --- a/behaviors/default/demo.js +++ b/behaviors/default/demo.js @@ -1,4 +1,13 @@ -class CircleActor { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class CircleActor extends ActorBehavior { setup() { if (!this.circling) { this.circling = true; diff --git a/behaviors/default/lights.js b/behaviors/default/lights.js index 8ac6759..53bc296 100644 --- a/behaviors/default/lights.js +++ b/behaviors/default/lights.js @@ -1,4 +1,13 @@ -class LightPawn { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class LightPawn extends PawnBehavior { setup() { let trm = this.service("ThreeRenderManager"); let group = this.shape; diff --git a/behaviors/default/mirror.js b/behaviors/default/mirror.js index 9c90b69..352195b 100644 --- a/behaviors/default/mirror.js +++ b/behaviors/default/mirror.js @@ -3,7 +3,16 @@ // Croquet Microverse // A variable sized rectangular mirror -class MirrorPawn { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class MirrorPawn extends PawnBehavior { setup() { this.constructMirror(); } @@ -38,4 +47,4 @@ export default { pawnBehaviors: [MirrorPawn], } ] -} \ No newline at end of file +} diff --git a/behaviors/default/openPortal.js b/behaviors/default/openPortal.js index b4b7de5..801216f 100644 --- a/behaviors/default/openPortal.js +++ b/behaviors/default/openPortal.js @@ -1,4 +1,13 @@ -class PortalButtonActor { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class PortalButtonActor extends ActorBehavior { setup() { this.listen("openPortal", "openPortal"); } @@ -40,7 +49,7 @@ class PortalButtonActor { } } -class PortalButtonPawn { +class PortalButtonPawn extends PawnBehavior { setup() { this.addEventListener("pointerMove", "nop"); this.addEventListener("pointerEnter", "hilite"); diff --git a/behaviors/default/pool.js b/behaviors/default/pool.js index 20f766c..1fa74d3 100644 --- a/behaviors/default/pool.js +++ b/behaviors/default/pool.js @@ -3,8 +3,16 @@ // Croquet Microverse // A variable sized rectangular pool of water +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. -class PoolActor { +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class PoolActor extends ActorBehavior { setup() { this.future(1000).update(); let version = '0.1'; @@ -16,7 +24,7 @@ class PoolActor { } } -class PoolPawn { +class PoolPawn extends PawnBehavior { setup() { this.constructPool(); this.listen("updatePool", this.updatePool); diff --git a/behaviors/default/replaceWorld.js b/behaviors/default/replaceWorld.js index 4cc8c16..8ba03b9 100644 --- a/behaviors/default/replaceWorld.js +++ b/behaviors/default/replaceWorld.js @@ -2,7 +2,16 @@ // https://croquet.io // info@croquet.io -class ReplaceWorldPawn { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class ReplaceWorldPawn extends PawnBehavior { get targetURL() { return this.actor._cardData.replaceWorldTargetURL; } set targetURL(url) { if (this.targetURL !== url) this.say("setCardData", { replaceWorldTargetURL: url }); } diff --git a/behaviors/default/spatialSound.js b/behaviors/default/spatialSound.js index d8f4a15..0a2e7dc 100644 --- a/behaviors/default/spatialSound.js +++ b/behaviors/default/spatialSound.js @@ -1,4 +1,13 @@ -class SpatialSoundActor { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class SpatialSoundActor extends ActorBehavior { setup() { this.listen("tapped", "tapped"); this.listen("ended", "ended"); @@ -44,7 +53,7 @@ class SpatialSoundActor { } } -class SpatialSoundPawn { +class SpatialSoundPawn extends PawnBehavior { setup() { this.handler = () => this.start(); document.addEventListener("pointerdown", this.handler); diff --git a/behaviors/default/spin.js b/behaviors/default/spin.js index 329686c..fce7364 100644 --- a/behaviors/default/spin.js +++ b/behaviors/default/spin.js @@ -3,7 +3,16 @@ // Croquet Microverse // Adds drag-to-spin around the vertical axis to a Card -class SpinActor { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class SpinActor extends ActorBehavior { setup() { this.listen("newAngle", "newAngle"); this.listen("startSpinning", "startSpinning"); @@ -43,7 +52,7 @@ class SpinActor { } } -class SpinPawn { +class SpinPawn extends PawnBehavior { setup() { this.addEventListener("pointerDown", "onPointerDown"); this.addEventListener("pointerUp", "onPointerUp"); diff --git a/behaviors/default/synchronousLoad.js b/behaviors/default/synchronousLoad.js index 0cf760f..082a61c 100644 --- a/behaviors/default/synchronousLoad.js +++ b/behaviors/default/synchronousLoad.js @@ -1,4 +1,13 @@ -class SynchronousCardLoaderPawn { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class SynchronousCardLoaderPawn extends PawnBehavior { setup() { this.subscribe(this.sessionId, "synchronousLoadCardsStarted", "synchronousLoadCardsStarted"); this.subscribe(this.sessionId, "allSynchronousCardsLoaded", "allSynchronousCardsLoaded"); diff --git a/behaviors/default/text3D.js b/behaviors/default/text3D.js index b32cbb0..55f7407 100644 --- a/behaviors/default/text3D.js +++ b/behaviors/default/text3D.js @@ -14,8 +14,16 @@ // Copyright 2022 Croquet Corporation */ +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. -class Text3DPawn { +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class Text3DPawn extends PawnBehavior { setup() { this.generateText3D(); this.listen("updateShape", "generateText3D"); diff --git a/behaviors/default/urlLink.js b/behaviors/default/urlLink.js index 493a2ee..fa98c02 100644 --- a/behaviors/default/urlLink.js +++ b/behaviors/default/urlLink.js @@ -1,8 +1,17 @@ // turn a card into a clickable link that will launch another web page // Copyright 2022 Croquet Corporation -// DAS +// DAS -class URLPawn { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class URLPawn extends PawnBehavior { setup() { this.addEventListener("pointerTap", "tap"); this.addEventListener("pointerEnter", "enter"); @@ -78,4 +87,4 @@ export default { pawnBehaviors: [URLPawn] } ] -} \ No newline at end of file +} diff --git a/behaviors/default/video.js b/behaviors/default/video.js index 6a72812..337f0ca 100644 --- a/behaviors/default/video.js +++ b/behaviors/default/video.js @@ -12,7 +12,16 @@ There is a case that the session comes back from dormant. so care is taken that the video element recreated won't start playing. */ -class VideoActor { +// the following import statement is solely for the type checking and +// autocompletion features in IDE. A Behavior cannot inherit from +// another behavior or a base class but can use the methods and +// properties of the card to which it is installed. +// The prototype classes ActorBehavior and PawnBehavior provide +// the features defined at the card object. + +import {ActorBehavior, PawnBehavior} from "../PrototypeBehavior"; + +class VideoActor extends ActorBehavior { setup() { this.listen("setSize", "setSize"); this.listen("ended", "ended"); @@ -152,7 +161,7 @@ class VideoActor { } } -class VideoPawn { +class VideoPawn extends PawnBehavior { setup() { this.addEventListener("pointerTap", "tapped"); this.listen("cardDataSet", "videoChanged"); @@ -465,8 +474,7 @@ class VideoPawn { } } - -class VideoButtonActor { +class VideoButtonActor extends ActorBehavior { // setup() { // } @@ -480,7 +488,7 @@ class VideoButtonActor { } } -class VideoButtonPawn { +class VideoButtonPawn extends PawnBehavior { setup() { if (this.actor._cardData.isPrototype) {return;}