Skip to content

Commit

Permalink
add import line
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshikiohshima committed Sep 1, 2023
1 parent bb47c55 commit 3fec4a4
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 26 deletions.
13 changes: 11 additions & 2 deletions behaviors/default/bouncingBall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -51,7 +60,7 @@ class BouncingLogoActor {
}
}

class BouncingLogoPawn {
class BouncingLogoPawn extends PawnBehavior {
setup() {
this.updatePosition(this.actor.position);
this.listen("updatePosition", "updatePosition");
Expand Down
11 changes: 10 additions & 1 deletion behaviors/default/csmLights.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
11 changes: 10 additions & 1 deletion behaviors/default/demo.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
11 changes: 10 additions & 1 deletion behaviors/default/lights.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
13 changes: 11 additions & 2 deletions behaviors/default/mirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -38,4 +47,4 @@ export default {
pawnBehaviors: [MirrorPawn],
}
]
}
}
13 changes: 11 additions & 2 deletions behaviors/default/openPortal.js
Original file line number Diff line number Diff line change
@@ -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");
}
Expand Down Expand Up @@ -40,7 +49,7 @@ class PortalButtonActor {
}
}

class PortalButtonPawn {
class PortalButtonPawn extends PawnBehavior {
setup() {
this.addEventListener("pointerMove", "nop");
this.addEventListener("pointerEnter", "hilite");
Expand Down
12 changes: 10 additions & 2 deletions behaviors/default/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -16,7 +24,7 @@ class PoolActor {
}
}

class PoolPawn {
class PoolPawn extends PawnBehavior {
setup() {
this.constructPool();
this.listen("updatePool", this.updatePool);
Expand Down
11 changes: 10 additions & 1 deletion behaviors/default/replaceWorld.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
// https://croquet.io
// [email protected]

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 }); }
Expand Down
13 changes: 11 additions & 2 deletions behaviors/default/spatialSound.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -44,7 +53,7 @@ class SpatialSoundActor {
}
}

class SpatialSoundPawn {
class SpatialSoundPawn extends PawnBehavior {
setup() {
this.handler = () => this.start();
document.addEventListener("pointerdown", this.handler);
Expand Down
13 changes: 11 additions & 2 deletions behaviors/default/spin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -43,7 +52,7 @@ class SpinActor {
}
}

class SpinPawn {
class SpinPawn extends PawnBehavior {
setup() {
this.addEventListener("pointerDown", "onPointerDown");
this.addEventListener("pointerUp", "onPointerUp");
Expand Down
11 changes: 10 additions & 1 deletion behaviors/default/synchronousLoad.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
10 changes: 9 additions & 1 deletion behaviors/default/text3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
15 changes: 12 additions & 3 deletions behaviors/default/urlLink.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -78,4 +87,4 @@ export default {
pawnBehaviors: [URLPawn]
}
]
}
}
18 changes: 13 additions & 5 deletions behaviors/default/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -152,7 +161,7 @@ class VideoActor {
}
}

class VideoPawn {
class VideoPawn extends PawnBehavior {
setup() {
this.addEventListener("pointerTap", "tapped");
this.listen("cardDataSet", "videoChanged");
Expand Down Expand Up @@ -465,8 +474,7 @@ class VideoPawn {
}
}


class VideoButtonActor {
class VideoButtonActor extends ActorBehavior {
// setup() {
// }

Expand All @@ -480,7 +488,7 @@ class VideoButtonActor {
}
}

class VideoButtonPawn {
class VideoButtonPawn extends PawnBehavior {
setup() {
if (this.actor._cardData.isPrototype) {return;}

Expand Down

0 comments on commit 3fec4a4

Please sign in to comment.