diff --git a/Plug-in Authoring Kit/Basics-of-scripting/benchmarks.js b/Plug-in Authoring Kit/Basics-of-scripting/benchmarks.js index 065d4683..f02cdf0d 100644 --- a/Plug-in Authoring Kit/Basics-of-scripting/benchmarks.js +++ b/Plug-in Authoring Kit/Basics-of-scripting/benchmarks.js @@ -1,24 +1,24 @@ /* - * benchmarks.js - version 4 + * benchmarks.js - version 5 * * The script runs a series of timed tests and prints the - * results, to give you a sense of the performance of the + * results to give you a sense of the performance of the * script engine. As a side effect it also demonstrates * various features of the language and script engine, so - * it may be useful for programmers who are familiar with - * other languages to get a quick overview of JavaScript. + * it's helpful for programmers who are familiar with + * another language to get a quick overview of the flavour + * of JavaScript used in Strange Eons. * - * Note: depending on your system, these tests may take - * from several seconds to several minutes to complete. + * Note: depending on your system, these tests will take + * several seconds to complete. */ importClass(java.lang.System); /** - * time( func ) - * Calls the function func with no arguments, - * and returns the (approximate) number of nanoseconds - * that the function took to execute. + * Calls the function `func` with no arguments + * and returns the approximate number of nanoseconds + * that the function took to execute. */ function time(func) { let start = System.nanoTime(); @@ -75,7 +75,7 @@ const TESTS = [ function interface_implementor() { for (let r = 0; r < 100; ++r) { let listener = new java.awt.event.ActionListener() { - actionPerformed: function() { + actionPerformed() { 1 + 1; } }; @@ -85,11 +85,11 @@ const TESTS = [ } }, - // instantiate a JavaScript object with method 100 times and call each instance 1000 times + // instantiate a JavaScript object with a method 100 times and call each instance 1000 times function function_caller() { for (let r = 0; r < 100; ++r) { let listener = new Object() { - actionPerformed: function() { + actionPerformed() { 1 + 1; } }; @@ -316,9 +316,8 @@ const TESTS = [ ]; // END OF THE ARRAY OF TEST FUNCTIONS /** - * runTests() - * Repeatedly times each function in tests, - * printing the name of each test and its best time. + * Repeatedly times each function in `TESTS`, + * printing the name of each and its best time. */ function runTests() { const REPS = 5; diff --git a/Plug-in Authoring Kit/Basics-of-scripting/console-components.js b/Plug-in Authoring Kit/Basics-of-scripting/console-components.js index 5e25ea8f..7f64293a 100644 --- a/Plug-in Authoring Kit/Basics-of-scripting/console-components.js +++ b/Plug-in Authoring Kit/Basics-of-scripting/console-components.js @@ -27,7 +27,7 @@ let okBtn = new JButton('OK'); let yellowSign = ImageUtils.get('project:pak-assets/yellow-sign.png', true); okBtn.addActionListener( - function actionPerformed() { + function actionPerformed(event) { println('\nHey there, ' + nameField.text + '.'); println('Tell me, have you seen the yellow sign?'); Console.printImage(yellowSign); diff --git a/Plug-in Authoring Kit/Code Snippets and Demos/fonts-in-families.js b/Plug-in Authoring Kit/Code Snippets and Demos/fonts-in-families.js index 3eeb4728..332e2ba0 100644 --- a/Plug-in Authoring Kit/Code Snippets and Demos/fonts-in-families.js +++ b/Plug-in Authoring Kit/Code Snippets and Demos/fonts-in-families.js @@ -12,25 +12,20 @@ const fontMap = {}; const allFonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() - .getAllFonts(); - -for (let i = 0; i < allFonts.length; ++i) { - // Notice that we explicitly convert all of the Java strings - // to JavaScript strings; if we didn't, then JSON.stringify - // would not work as intended. - let f = allFonts[i]; - let family = String(f.getFamily()); - let mapping = fontMap[family]; - if (!mapping) { - mapping = { - names: [], - logicalNames: [] - }; - fontMap[family] = mapping; - } - mapping.names.push(String(f.getFontName())); - mapping.logicalNames.push(String(f.getName())); -} + .getAllFonts().forEach((font) => { + let family = String(font.getFamily()); + let mapping = fontMap[family]; + if (!mapping) { + mapping = { + names: [], + logicalNames: [] + }; + fontMap[family] = mapping; + } + mapping.names.push(String(font.getFontName())); + mapping.logicalNames.push(String(font.getName())); + }); +delete fontMap.Dialog; // // Now fontMap["familyName"] returns an object like this: diff --git a/Plug-in Authoring Kit/Game-component-examples/Bleed Margins/README.md b/Plug-in Authoring Kit/Game-component-examples/Bleed Margins/README.md new file mode 100644 index 00000000..49f33ed0 --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Bleed Margins/README.md @@ -0,0 +1,13 @@ +# Bleed Margins + +This demonstrates how to include a bleed margin and/or rounded edges +in your component design. All of the interesting bits are in +`bleed-margin.settings`. + +Right click and **Run** `bleed-margin-diy.js` to play with the example. +Then try the various **View/Edge Finish** options to see the component +with or without its bleed margin and rounded edges. + +You can also try **View/Unsafe Area** and **View/True Face Edge** +to see the effect of these options. (Try enabling them with +**Edge Finish** set to **Include Bleed Margin** first. \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Design Support/README.md b/Plug-in Authoring Kit/Game-component-examples/Design Support/README.md new file mode 100644 index 00000000..af4a6463 --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Design Support/README.md @@ -0,0 +1,23 @@ +# Design Support + +This demonstrates how to create design supports. A design support +is an extra user interface element that provides feedback on +the design. For example, if the design breaks one of the game's +rules, the design support could indicate that. + +There are three examples you can right click and **Run**. +For each, be sure to edit the field to see how the design +feedback changes. + +`design-support-diy1.js` +Creates a simple support using the default "verbal feedback" +design support component. + +`design-support-diy2.js` +A more complex use of the same "verbal feedback" model that +highlights how the user's actions change the provided +feedback over time. + +`design-support-diy3.js` +Demonstrates how to create your own custom "view" (user interface +element) instead of the built-in verbal feedback component. \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Design Support/resources/example/design-support-diy3.js b/Plug-in Authoring Kit/Game-component-examples/Design Support/resources/example/design-support-diy3.js index 65b93e51..9dfb3bd7 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Design Support/resources/example/design-support-diy3.js +++ b/Plug-in Authoring Kit/Game-component-examples/Design Support/resources/example/design-support-diy3.js @@ -45,19 +45,19 @@ function createInterface(diy, editor) { analysis: '', changed: true, valid: true, - getGameComponent: function getGameComponent() { + getGameComponent() { return diy; }, - markChanged: function markChanged() { + markChanged() { this.changed = true; }, - isDesignValid: function isDesignValid() { + isDesignValid() { if (this.changed) { this.updateAnalysis(); } return this.valid; }, - createSupportView: function createSupportView() { + createSupportView() { // we can return any component we like, // in this case we'll just return a simple label let view = label(); @@ -66,7 +66,7 @@ function createInterface(diy, editor) { view.background = new Color(0xfaffc4); return view; }, - updateSupportView: function updateSupportView(view) { + updateSupportView(view) { // if the "analysis" is out of date, update it if (this.changed) { this.updateAnalysis(); @@ -76,7 +76,7 @@ function createInterface(diy, editor) { // set its text to our analysis string view.text = this.analysis; }, - updateAnalysis: function updateAnalysis() { + updateAnalysis() { // reset the changed flag so we don't do another analysis // until the component changes this.changed = false; diff --git a/Plug-in Authoring Kit/Game-component-examples/Multiple and Custom Portraits/README.md b/Plug-in Authoring Kit/Game-component-examples/Multiple and Custom Portraits/README.md new file mode 100644 index 00000000..026e093d --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Multiple and Custom Portraits/README.md @@ -0,0 +1,19 @@ +# Multiple and Custom Portraits + +This contains three examples you can right click and **Run** +to test some more advanced uses of portraits: + +`multi-portrait-diy.js` +Demonstrates how to create a component with more than one +portrait. Also demonstrates how to create a portrait that +the user can rotate. + +`linked-multi-portrait-diy.js` +Demonstrates how to create a linked portrait. That is, a +portrait that uses the same image as another portrait, +but is drawn separately and has its own pan and scale settings. + +`roving-portrait-region.js` +Demonstrates how to create a portrait that can move to different +locations depending on how the user changes the game component +state. \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Prefab/README.md b/Plug-in Authoring Kit/Game-component-examples/Prefab/README.md new file mode 100644 index 00000000..5e05e86b --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Prefab/README.md @@ -0,0 +1,20 @@ +@ -0,0 +1,19 @@ +# Prefab + +This example includes two "prefab" components you can try by right clicking +and **Run**ning their script files. + +A [prefab component](http://se3docs.cgjennings.ca/dm-diy-prefab.html) +is one whose design is controlled by its `.settings` file. +The `-diy` script is just a *stub* that loads the `prefab` library and +says which setting keys to use. + +`prefab-diy.js` +This prefab includes a heading, body text, and portrait. + +`prefab2-diy.js` +This example demonstrates how the default behaviour of a prefab component +can be customized using before and after functions. It adds a page +shape that restricts the text to fit inside the white oval. +(Use **View/Region Boxes** to make the page shape visible as a dashed +blue line.) \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Prototype/README.md b/Plug-in Authoring Kit/Game-component-examples/Prototype/README.md new file mode 100644 index 00000000..a7b71a9f --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Prototype/README.md @@ -0,0 +1,88 @@ +# Prototype + +This example plug-in registers six new game component types. +They are intended to be used to create quick prototype cards +for games. The six card types are two different common +playing card sizes (poker and bridge) in portrait layout, +landscape layout, and with a portrait image. + +## Running the examples + +One way to test the plug-in is to right click on it and choose +**Test Plug-in**, then choose **Test**. The new card types +will be found in the **Miscellaneous** category. + +You can also try it out without building it by running the +diy scripts directly. If you try right clicking on +`poker.js` and choosing **Run**, the card will appear but +you will also get an error message (`#proto-deck` is not defined). +This happens because this plug-in is designed to be translated +into multiple languages, and the translated strings are missing. +You can get around this by right clicking on the string table +(`game.properties`) and choosing **Merge Strings Into/Game Language**. +Now if you right click and **Run** `poker.js` it will work as expected. +You still won't get the same experience as using **Test Plug-in**, +because the custom font used by the cards hasn't been +loaded—but it will run! + +## Tour of the files + +`plugin.js` +This is the main plug-in script. It loads the translatable strings, +card template settings, custom font, and the class map (which adds +the new card types). + +`plug-in.png` +This image is used to create an icon for the plug-in. (You'll see +this icon in the **Plug-in Manager**, for exmaple.) + +`prefab-ext` +This is a shared library used by all of the card DIY scripts. It +loads the standard `prefab` library and then customizes it. +(See the **Prefab** example for an introduction to prefabs.) + +`bridge.js`, `bridge-ls.js`, `bridge-im.js` +The diy scripts for the bridge-sized cards (portrait, landscape, +and portrait with image). + +`poker.js`, `poker-ls.js`, `poker-im.js` +The diy scripts for the poker-sized cards. + +*The diy scripts are all simple stubs because this example uses +prefab components.* + +`poker-tpl.png`, `bridge-tpl.png` +The template images for the poker and bridge-sized cards. + +`poker-ls-tpl.js`, `bridge-ls.js` +These are [resource creation scripts](http://se3docs.cgjennings.ca/dm-res-image.html#resource-creation-scripts). +When loading using `ResourceKit.getImage()` they will create the +landscape versions of the template images using script code that +rotates the portrait images. +This is a fancy way to do it. You could just as easily +rotate the templates in a paint program and save them as `.png` +images just like the portrait images. + +**Note:** These scripts won't work as expected unless you install +the plug-in or run it with **Test Plug-in**. + +`Unkepmpt-Regular.ttf` +This is the font file that contains the custom font used on the +prototypes. As mentioned above, to see it in use you have to +build and install the plug-in or use **Test Plug-in**. However, +you can explore the font by double-clicking on it. + +`game.properties` +This is the string table. It assigns named keys to a set of strings. +Then those strings can be referred to by their key, so that +translated versions will be used when running in a different game +language. You can add a translation by right clicking and choosing +**Add Locale**. + +`layout.settings` +This file defines settings that direct the prefab library as to how +to lay out the cards. + +`proto.classmap` +This is used to register the new card types with Strange Eons. +(The registration step happens in `plugin.js`.) \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Prototype/resources/proto/layout.settings b/Plug-in Authoring Kit/Game-component-examples/Prototype/resources/proto/layout.settings index 5d3a5e7d..02854fc2 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Prototype/resources/proto/layout.settings +++ b/Plug-in Authoring Kit/Game-component-examples/Prototype/resources/proto/layout.settings @@ -34,7 +34,7 @@ bridge-im-content = #proto-content bridge-im-content-region = 20,315,298,190 bridge-im-content-style = family: 'Unkempt'; size: 12 bridge-im-content-alignment = left, top -bridge-im-portrait-template = icons/application/256.png +bridge-im-portrait-template = icons/application/app@16x.png bridge-im-portrait-clip-region = 20,100,298,190 # creates an 1 pixel invisible overlay so the portrait is # drawn overtop of the card template instead of under @@ -52,7 +52,7 @@ poker-im-content = #proto-content poker-im-content-region = 20,315,335,190 poker-im-content-style = family: 'Unkempt'; size: 12 poker-im-content-alignment = left, top -poker-im-portrait-template = icons/application/256.png +poker-im-portrait-template = icons/application/app@16x.png poker-im-portrait-clip-region = 20,100,298,190 poker-im-portrait-overlay = icons/1x1.png poker-im-portrait-overlay-region = 0,0,1,1 diff --git a/Plug-in Authoring Kit/Game-component-examples/Register Game/README.md b/Plug-in Authoring Kit/Game-component-examples/Register Game/README.md new file mode 100644 index 00000000..3c9e18a6 --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Register Game/README.md @@ -0,0 +1,33 @@ +# Register Game + +This example demonstrates how to +[register a new game, and how to register an expansion for that game](http://se3docs.cgjennings.ca/dm-register-game.html). + +## Registering a game +Registering a game lets you group all of the related game components under that +game's name. For example, in the **File/New** dialog, you can choose to filter +the listed components so that only those from a certain game are shown. +Plug-ins can also declare that they add on to a certain game (in their +[root file](http://se3docs.cgjennings.ca/dm-eons-plugin.html#for-game)). +This lets users search for plug-ins related to a given game. + +Games also have their own settings that are shared between all components +for that game. This lets you load a single collection of settings for +all of your components. These will be "inherited" automatically and +if you change them in a future update, all components for that game +will get those changes automatically. (This is unlike the settings +set directly on a component's "private settings", which are are unique +to each individual component.) + +## Registering an expansion +Registering expansions for a game lets you take advantage of the built-in +system for adding expansion symbols to your designs: a few lines each +near the end of `register-game-plugin.js`. + +### Expansion symbol templates +Most of the code in the plug-in script is used to create an +[expansion symbol template](http://se3docs.cgjennings.ca/dm-register-game.html#custom-expansionsymboltemplates). +This is used to add custom "variants" of expansion symbols. +(For example, a light version for some card designs and a dark verison for others.) +In most cases, you can ignore this code and stick with the default template +by passing `null` to `registerGame` as the `ExpansionSymbolTemplate`. \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Register Game/resources/example/register-game-plugin.js b/Plug-in Authoring Kit/Game-component-examples/Register Game/resources/example/register-game-plugin.js index fc994398..10025fd5 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Register Game/resources/example/register-game-plugin.js +++ b/Plug-in Authoring Kit/Game-component-examples/Register Game/resources/example/register-game-plugin.js @@ -40,17 +40,17 @@ const template = new JavaAdapter( AbstractExpansionSymbolTemplate, { // In our example game, there is only one variant of each expansion symbol, // which is described as "Golden". - getVariantCount: function getSymbolCount() { + getVariantCount() { return 1; }, // Returns the "Golden" name for the symbol style. - getVariantName: function getSymbolName(n) { + getVariantName(n) { this.checkIndex(n); return 'Golden'; }, // Returns a standard icon that features a characteristic colour (#e1b733) // from the "Golden" symbol design. - getVariantIcon: function getVariantIcon(n) { + getVariantIcon(n) { this.checkIndex(n); // the icon is only created if actually requested if (this.icon == null) { @@ -60,17 +60,17 @@ const template = new JavaAdapter( }, icon: null, // returns the sample symbol - getDefaultSymbol: function getDefaultSymbol(n) { + getDefaultSymbol(n) { this.checkIndex(n); return image('template-sample-symbol'); }, // this game draws expansion symbols itself; see register-game-diy.js - isCustomDrawn: function isCustomDrawn() { + isCustomDrawn() { return true; }, // since there is only one symbol variant, this function rejects // all indices other than 0 - checkIndex: function checkIndex(n) { + checkIndex(n) { if (n != 0) throw new Error('invalid symbol index: ' + n); } } diff --git a/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/README.md b/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/README.md new file mode 100644 index 00000000..a96a515d --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/README.md @@ -0,0 +1,31 @@ +# Rise of the Servitors + +This example expands an existing game (that has its own separate plug-in) +with a new card type. + +Since the main plug-in for the game does most of the work of setting up, +the plug-in script doesn't have much to do: it checks that the main game +(Arkham Horror 2nd ed, with code `AH`) has been installed, and stops +if not. Otherwise it adds the settings needed for the new card type to +the existing settings for the `AH` game, and then registers the new +card type using the `rots.classmap` file. + +## Requiring other plug-ins +The `eons-plugin` root file also indicates that this plug-in requires Arkham Horror +(check the **Referenced Bundles** and **Advanced** tabs). This entry becomes part +of the metadata about the plug-in in the catalogue, so Strange Eons can check the +requirements before installation. The check in the plug-in script is still important, +since a user could install both plug-ins and then uninstall Arkham Horror. + +## Installation notes +Notice the [install.html](install.html) file. This contains the *installation notes* +for the plug-in. It is displayed when the plug-in is installed. Strange Eons looks +for this file, named `install.html` or `install.md`, in the root of the plug-in bundle. +Translations can be provided by adding more files, tagged with the relevant locale +code (such as `install_en_US.html`). Right click on the file and choose **Add Locale** +to create a file with correct name automatically. + +## The `diy` script +The DIY script for the component, `diy.js` is interesting in that instead of painting +each element of the design directly, it builds the design up using markup box tags. +Have a look, it is straightforward and well documented. \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/diy.js b/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/diy.js index 2053d715..cf46cc4d 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/diy.js +++ b/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/diy.js @@ -152,7 +152,7 @@ function paintFront(g, diy, sheet) { // article is a Java string; hence it has a length() method, // not a length property. // TIP: if you want to be sure that a string is a JS string, - // just concatenate it with an empty string: s = "" + s; + // you can use String(s) or concatenation ("" + s) if (article.length() > 0) { // Compose the home name as (e.g.) "T" + "he" + " " + "Location" home = article.substring(0, 1).toUpperCase() + article.substring(1) + diff --git a/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/servitors.js b/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/servitors.js index ae96a577..cf635a36 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/servitors.js +++ b/Plug-in Authoring Kit/Game-component-examples/Rise of the Servitors/resources/cgj/servitors/servitors.js @@ -22,7 +22,7 @@ function initialize() { const AH = Game.get("AH"); if (AH == null) return false; - AH.masterSettings.addSettingsFrom("cgj/servitors/card-layout.settings"); + AH.settings.addSettingsFrom("cgj/servitors/card-layout.settings"); ClassMap.add("cgj/servitors/rots.classmap"); return true; } \ No newline at end of file diff --git a/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman HD/resources/talisman/hd-plugin.js b/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman HD/resources/talisman/hd-plugin.js index 7e8d27bb..00d17a41 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman HD/resources/talisman/hd-plugin.js +++ b/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman HD/resources/talisman/hd-plugin.js @@ -20,7 +20,7 @@ let talismanGame = Game.get('TAL'); if (game != null) { // add the keys needed to activate high resolution mode - talismanGame.masterSettings.addSettingsFrom('talisman/hd.settings'); + talismanGame.settings.addSettingsFrom('talisman/hd.settings'); } else { Eons.log.warning('Talisman HD cannot find Talisman'); } diff --git a/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/plugin.js b/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/plugin.js index b6b7efa1..d3940699 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/plugin.js +++ b/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/plugin.js @@ -41,7 +41,7 @@ function initialize() { // now that the game is registered, we can add the // default settings to use for new cards - Game.get('TAL').masterSettings.addSettingsFrom('talisman/base.settings'); + Game.get('TAL').settings.addSettingsFrom('talisman/base.settings'); ClassMap.add('talisman/base.classmap'); @@ -131,15 +131,15 @@ function createExpansionSymbolTemplate() { // Returns the number of visual variants: this is the number // of different design variants required for each symbol in // order to paint it on any card - getVariantCount: function getVariantCount() { + getVariantCount() { return 3; }, - getVariantName: function getVariantName(n) { + getVariantName(n) { this.checkIndex(n); return @('tal-exp-vis-' + n.toInt()); }, // Returns a standard icon representing the variant's visual style - getVariantIcon: function getVariantIcon(n) { + getVariantIcon(n) { this.checkIndex(n); if (this.icons == null) { const SU = SymbolVariantUtilities; @@ -155,19 +155,19 @@ function createExpansionSymbolTemplate() { // two logical variants: part of an expansion, or requires an expansion - getLogicalVariantCount: function getLogicalVariantCount() { + getLogicalVariantCount() { return 3; }, - getLogicalVariantName: function getLogicalVariantName(n) { + getLogicalVariantName(n) { this.checkLogicalIndex(n); return @('tal-exp-log-' + n.toInt()); }, - getLogicalVariantIcon: function getLogicalVariantIcon(n) { + getLogicalVariantIcon(n) { this.checkLogicalIndex(n); return null; }, // returns the sample symbol - getDefaultSymbol: function getDefaultSymbol(n) { + getDefaultSymbol(n) { this.checkIndex(n); let bi = ImageUtils.get('talisman/expansions/dungeon.jp2'); if (n > 0) { @@ -176,26 +176,26 @@ function createExpansionSymbolTemplate() { return bi; }, // this game draws expansion symbols itself - isCustomDrawn: function isCustomDrawn() { + isCustomDrawn() { return true; }, // since there is only one symbol variant, this function rejects // all indices other than 0 - checkIndex: function checkIndex(n) { + checkIndex(n) { if (n < 0 || n >= this.getVariantCount()) throw new Error('invalid design variant index: ' + n); }, // since there is only one symbol variant, this function rejects // all indices other than 0 - checkLogicalIndex: function checkLogicalIndex(n) { + checkLogicalIndex(n) { if (n < 0 || n >= this.getLogicalVariantCount()) throw new Error('invalid logical variant index: ' + n); }, // override the base class to return true since we can generate symbol variants - canGenerateVariantsAutomatically: function canGenerateVariantsAutomatically() { + canGenerateVariantsAutomatically() { return true; }, // generates an expansion symbol from a user-supplied sample image; // this uses SymbolVariantUtilities - generateVariant: function generateVariant(bi, variant) { + generateVariant(bi, variant) { this.checkIndex(variant); const SU = SymbolVariantUtilities; diff --git a/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/test-lib.js b/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/test-lib.js index cc242677..aded29bb 100644 --- a/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/test-lib.js +++ b/Plug-in Authoring Kit/Game-component-examples/Talisman/Talisman/resources/talisman/test-lib.js @@ -15,7 +15,7 @@ importClass(gamedata.Game); let settings; let talismanGame = Game.get('TAL'); if (talismanGame != null) { - settings = talismanGame.masterSettings; + settings = talismanGame.settings; } else { settings = Settings.shared; } diff --git a/Plug-in Authoring Kit/Game-component-examples/Three or More Faces/README.md b/Plug-in Authoring Kit/Game-component-examples/Three or More Faces/README.md new file mode 100644 index 00000000..fb303224 --- /dev/null +++ b/Plug-in Authoring Kit/Game-component-examples/Three or More Faces/README.md @@ -0,0 +1,25 @@ +# Three or more faces + +This example demonstrates how to create components with three or more faces. +A face is (generally) one side of a card. Each face of a game component is +managed by a `Sheet` object, which is responsible for painting it. +(For `DIY` components, a `DIYSheet` paints the component by calling into +your scipt code.) + +A typical game component has two faces, a front and a back. It is also possible +to make a component with one face (for example, a sheet with nothing printed +on the back). Components with more faces are possible, but not as common. + +You can check out each of the example components directly without installing the plug-in. +Right click on the script, and choose **Run**. + +`3-face-diy.js` +This is the script for a component with three faces: a sheet with a front and back, and +a character marker token. (Strange Eons will know that if you put two copies of the +token next together in a deck they should be considered the front and back of a token, +so it will add fold lines if the two sides are correctly aligned and rotated +with respect to each other.) + +`4-face-diy.js`, `6-face-diy.js`, `8-face-diy.js` +These examples showcase, in order, a component that consists of 2, 3, and 4 cards +(each with two faces). \ No newline at end of file diff --git a/Plug-in Authoring Kit/Graphics-and-layout-examples/README.md b/Plug-in Authoring Kit/Graphics-and-layout-examples/README.md index fb4adf55..e531d839 100644 --- a/Plug-in Authoring Kit/Graphics-and-layout-examples/README.md +++ b/Plug-in Authoring Kit/Graphics-and-layout-examples/README.md @@ -3,4 +3,20 @@ These scripts demonstrate a wide variety of techniques and effects that can be used when painting card faces. Right click an example and choose **Run**, or double-click -to open example to see how an effect is achieved. \ No newline at end of file +to open example to see how an effect is achieved. + +## `painting-techniques.js` +See and experiment with various techniques you can use when +painting game components: + + - `AffineTransform`s (rotation, scaling, translation, etc.) + - `Paint`s and `Gradients` + - `Composite`s, including `AlphaComposite`s, Porter-Duff rules, and + `BlendMode` composites like the layer blend modes in paint apps (darken, lighten, add, + subtract, difference, multiply, screen, burn, color burn, dodge, color dodge, + linear burn, overlay, hard light, soft light, linear light, pin light, + vivid light, hard mix, reflect, glow, exclusion, negation, hue, saturation, + color, luminosity). + - Image filters (brightness, contrast, glow, drop shadow, convolutions + such as blur and sharpen, colour manipulation, bloom, and special effects). + - Stroking and filling lines, shapes, curves, and polygons. \ No newline at end of file diff --git a/Plug-in Authoring Kit/Graphics-and-layout-examples/image-filters.js b/Plug-in Authoring Kit/Graphics-and-layout-examples/image-filters.js index e538fbc2..2e82dc24 100644 --- a/Plug-in Authoring Kit/Graphics-and-layout-examples/image-filters.js +++ b/Plug-in Authoring Kit/Graphics-and-layout-examples/image-filters.js @@ -332,8 +332,8 @@ function filterChanged(actionEvent) { } } filterChanged.focusListener = new java.awt.event.FocusListener { - focusGained: function focusGained(focusEvent) {}, - focusLost: function focusLost(focusEvent) { + focusGained(focusEvent) {}, + focusLost(focusEvent) { updateFilter(); updateImage(curFilter); } diff --git a/Plug-in Authoring Kit/Graphics-and-layout-examples/page-shapes.js b/Plug-in Authoring Kit/Graphics-and-layout-examples/page-shapes.js index 9700764e..50f4e80e 100644 --- a/Plug-in Authoring Kit/Graphics-and-layout-examples/page-shapes.js +++ b/Plug-in Authoring Kit/Graphics-and-layout-examples/page-shapes.js @@ -47,10 +47,10 @@ function makeHexShape(region, insetFactor, topOnly) { let iMax = region.width * insetFactor; let shape = { - lerp: function lerp(y) { + lerp(y) { return 1 - (y - ry0) / (ry1 - ry0); }, - insetAt: function insetAt(y) { + insetAt(y) { if (y <= ry1) { return this.lerp(y) * iMax; } else if (y <= ry2) { @@ -59,18 +59,18 @@ function makeHexShape(region, insetFactor, topOnly) { return 0; } }, - getInset: function getInset(y1, y2) { + getInset(y1, y2) { return Math.max(this.insetAt(y1), this.insetAt(y2)); }, // the getLeftInset, getRightInset, and debugDraw functions // form our implementation of the PageShape class - getLeftInset: function getLeftInset(y1, y2) { + getLeftInset(y1, y2) { return this.getInset(y1, y2); }, - getRightInset: function getRightInset(y1, y2) { + getRightInset(y1, y2) { return this.getInset(y1, y2); }, - debugDraw: function debugDraw(g, r) { + debugDraw(g, r) { let li = new java.awt.geom.Line2D.Double( region.x + region.width * insetFactor, region.y, @@ -216,10 +216,10 @@ function createShape() { let s1 = shape, s2 = shapes[i2]; let interpolator = { - getLeftInset: function getLeftInset(y1, y2) { + getLeftInset(y1, y2) { return (s1.getLeftInset(y1, y2) + s2.getLeftInset(y1, y2)) / 2; }, - getRightInset: function getRightInset(y1, y2) { + getRightInset(y1, y2) { return (s1.getRightInset(y1, y2) + s2.getRightInset(y1, y2)) / 2; } }; diff --git a/Plug-in Authoring Kit/Graphics-and-layout-examples/painting-techniques.js b/Plug-in Authoring Kit/Graphics-and-layout-examples/painting-techniques.js index e03c88a3..20e94053 100644 --- a/Plug-in Authoring Kit/Graphics-and-layout-examples/painting-techniques.js +++ b/Plug-in Authoring Kit/Graphics-and-layout-examples/painting-techniques.js @@ -691,7 +691,7 @@ let BlendDemo = { DEST_SIZE: 256, // updates the source and blend image to match the current selection - changeBlendImages: function changeBlendImages(actionEvent) { + changeBlendImages(actionEvent) { // Note: we can't use this.imageCombo.selectedIndex because the // conversion to an ActionListener object changes the // value of 'this' from BlendDemo to the proxy object. @@ -721,7 +721,7 @@ let BlendDemo = { }, // updates the destination control using the currently selected blend mode - changeBlendMode: function changeBlendMode(actionEvent) { + changeBlendMode(actionEvent) { let thiz = BlendDemo; // (See above) let sel = thiz.modeCombo.selectedItem; if (sel == null) return; @@ -744,7 +744,7 @@ let BlendDemo = { }, // create a source image for blending using a colour gradient - createBlendSource: function createBlendSource(x1, y1, x2, y2, size, col) { + createBlendSource(x1, y1, x2, y2, size, col) { let im = ImageUtils.create(size, size, true); let scale = size-1; let paint = new java.awt.GradientPaint( @@ -763,7 +763,7 @@ let BlendDemo = { }, // create a source image for blending using an image resource - createBlendImage: function createBlendImage(name, size) { + createBlendImage(name, size) { let dest = ImageUtils.create(size, size, false); let im = ImageUtils.get(name, true); @@ -783,7 +783,7 @@ let BlendDemo = { // creates a control to display a source, blend, or destination image - blendBox: function blendBox(size) { + blendBox(size) { let bb = new swing.JLabel(); bb.setPreferredSize(new java.awt.Dimension(size + 2, size + 2)); bb.border = swing.BorderFactory.createLineBorder(Color.GRAY, 1); @@ -792,7 +792,7 @@ let BlendDemo = { // creates a panel of controls that can be used to interactively // experiment with blending modes - createUIPanel: function createUIPanel() { + createUIPanel() { let blendPanel = new TypeGrid(); blendPanel.setTitle('Blend Mode Compositing Demo'); @@ -834,7 +834,7 @@ let BlendDemo = { let PorterDuffDemo = new Object() { SIZE: 256, - createUIPanel: function createUIPanel() { + createUIPanel() { function makeImage(size, circle, c1, c2) { size *= 2 / 3; let src = ImageUtils.create(size, size, true); @@ -942,7 +942,7 @@ let PorterDuffDemo = new Object() { let StrokeDemo = new Object() { SIZE: 256, - createUIPanel: function createUIPanel() { + createUIPanel() { let strokePanel = new TypeGrid(); strokePanel.setTitle('Stroke Demo'); let thiz = this; @@ -1019,7 +1019,7 @@ let starBox = new swing.JComponent() { pen: new java.awt.BasicStroke(1), arms: 46, - setStroke: function setStroke(s) { + setStroke(s) { // Note: if we had named this 'stroke' // instead of pen, JavaScript would have gotten // confused because we are subclassing a Java class @@ -1029,7 +1029,7 @@ let starBox = new swing.JComponent() { this.repaint(); }, - paintComponent: function paintComponent(g) { + paintComponent(g) { g.setRenderingHint( java.awt.RenderingHints.KEY_ANTIALIASING, java.awt.RenderingHints.VALUE_ANTIALIAS_ON @@ -1079,7 +1079,7 @@ let starBox = new swing.JComponent() { g.drawOval(cx + r3 / 2.5 - 8, cy - r3 / 2.5, 16, 12); }, - createPaint: function createPaint(outerColor, innerColor, radius, cx, cy, fx, fy) { + createPaint(outerColor, innerColor, radius, cx, cy, fx, fy) { let center = new java.awt.geom.Point2D.Float(cx, cy); if (fx === undefined) fx = cx; if (fy === undefined) fy = cx; diff --git a/Plug-in Authoring Kit/Interface-examples/context-bar-button.js b/Plug-in Authoring Kit/Interface-examples/context-bar-button.js index 125c4c8c..5ae94972 100644 --- a/Plug-in Authoring Kit/Interface-examples/context-bar-button.js +++ b/Plug-in Authoring Kit/Interface-examples/context-bar-button.js @@ -23,21 +23,21 @@ importClass(arkham.ContextBar); let button = { // A unique identifier for the button; used to store the // user's preferred context bar configuration. - getID: function getID() { + getID() { return 'CAT_BUTTON'; }, // The name of the button as presented to the user. - getName: function getName() { - return 'Critter'; + getName() { + return 'Sleepy Kitty'; }, // The icon shown on the context bar. - getIcon: function getIcon() { + getIcon() { return this.catIcon; }, - // Note: this cannot be called "icon" or an odd thing happens: + // Note: this *cannot* be called "icon" or an odd thing happens: // after we turn this into a Java object, this.getIcon() and // this.icon will mean the same thing, so if we call this property // icon, the getIcon() function will effectively call itself @@ -59,17 +59,17 @@ let button = { // The implementation for this example simply checks that the context // bar is attached to a multi-line markup target in a game component editor // (so that it can insert lines of text if the button is activated). - isVisibleInCurrentContext: function isVisibleInCurrentContext(context) { + isVisibleInCurrentContext(context) { return context.isMultipleLineTextEditor() && context.gameComponent != null; }, - isEnabledInCurrentContext: function isEnabledInCurrentContext(context) { + isEnabledInCurrentContext(context) { // always enabled as long as it is visible return true; }, // Called when the button is activated. - actionPerformed: function actionPerformed(actionEvent) { + actionPerformed(actionEvent) { try { let mt = Eons.markupTarget; mt.selectNone(); diff --git a/Plug-in Authoring Kit/Interface-examples/custom-preferences.js b/Plug-in Authoring Kit/Interface-examples/custom-preferences.js index 2c620845..897e142e 100644 --- a/Plug-in Authoring Kit/Interface-examples/custom-preferences.js +++ b/Plug-in Authoring Kit/Interface-examples/custom-preferences.js @@ -54,7 +54,7 @@ let myPrefs = new JavaAdapter( // After the class/interface list, you provide a script object with the // functions (methods) that you want to override from the superclass: { - loadSettings: function() { + loadSettings() { // This weird syntax lets us call the superclass, in this case // so that it will load settings for the *managed* controls. this.super$loadSettings(); @@ -65,7 +65,7 @@ let myPrefs = new JavaAdapter( printf("Loaded the secret setting '%s'.\n", msss); myControl.text = msss; }, - storeSettings: function() { + storeSettings() { // Again, we want to let the superclass do its thing: this.super$storeSettings(); diff --git a/Plug-in Authoring Kit/Interface-examples/editor-listeners.js b/Plug-in Authoring Kit/Interface-examples/editor-listeners.js index 12e24815..b3ff5647 100644 --- a/Plug-in Authoring Kit/Interface-examples/editor-listeners.js +++ b/Plug-in Authoring Kit/Interface-examples/editor-listeners.js @@ -11,7 +11,7 @@ importClass(arkham.StrangeEonsEditor); // This is a listener that is called when a new editor is added. let editorAdded = new StrangeEonsAppWindow.EditorAddedListener() { - editorAdded: function editorAdded(editor) { + editorAdded(editor) { println('editor added: ' + editor); if (!targetEditor) { println('[adding editor-specific listener to this editor]'); @@ -26,19 +26,19 @@ let editorAdded = new StrangeEonsAppWindow.EditorAddedListener() { // editor because we register it with the application, // not a particular editor. let allEditors = new StrangeEonsEditor.EditorListener() { - editorSelected: function editorSelected(editor) { + editorSelected(editor) { println('editor selected: ' + editor); }, - editorDeselected: function editorDeselected(editor) { + editorDeselected(editor) { println('editor deselected: ' + editor); }, - editorClosing: function editorClosing(editor) { + editorClosing(editor) { println('editor closing: ' + editor); }, - editorDetached: function editorDetached(editor) { + editorDetached(editor) { println('editor detached: ' + editor); }, - editorAttached: function editorAttached(editor) { + editorAttached(editor) { println('editor attached: ' + editor); } }; @@ -48,19 +48,19 @@ let allEditors = new StrangeEonsEditor.EditorListener() { // one editor because we register it on that editor, not // the entire application. let specificEditor = new StrangeEonsEditor.EditorListener() { - editorSelected: function editorSelected(editor) { + editorSelected(editor) { println('specific editor selected: ' + editor); }, - editorDeselected: function editorDeselected(editor) { + editorDeselected(editor) { println('specific editor deselected: ' + editor); }, - editorClosing: function editorClosing(editor) { + editorClosing(editor) { println('specific editor closing: ' + editor); }, - editorDetached: function editorDetached(editor) { + editorDetached(editor) { println('specific editor detached: ' + editor); }, - editorAttached: function editorAttached(editor) { + editorAttached(editor) { println('specific editor attached: ' + editor); } }; diff --git a/Plug-in Authoring Kit/Project Examples/KDiff3/resources/cgj/kdiff3.js b/Plug-in Authoring Kit/Project Examples/KDiff3/resources/cgj/kdiff3.js index 0cafecf7..4f957db5 100644 --- a/Plug-in Authoring Kit/Project Examples/KDiff3/resources/cgj/kdiff3.js +++ b/Plug-in Authoring Kit/Project Examples/KDiff3/resources/cgj/kdiff3.js @@ -51,7 +51,7 @@ function createAction() { // we need to create an object that overrides a concrete class // (rather than implementing a method). let kd3Action = { - appliesToSelection: function appliesToSelection(members) { + appliesToSelection(members) { // unlike the built-in task action, KDiff3 can operate on // 2 *or* 3 files, and it also works on folders if (members.length < 2 || members.length > 3) return false; @@ -66,7 +66,7 @@ function createAction() { } return true; }, - performOnSelection: function performOnSelection(members) { + performOnSelection(members) { if (this.appliesToSelection(members)) { try { kdiff3(members); diff --git a/Plug-in Authoring Kit/Project Examples/MD5/resources/example/md5.js b/Plug-in Authoring Kit/Project Examples/MD5/resources/example/md5.js index 4ffbc78a..bf5fa677 100644 --- a/Plug-in Authoring Kit/Project Examples/MD5/resources/example/md5.js +++ b/Plug-in Authoring Kit/Project Examples/MD5/resources/example/md5.js @@ -43,19 +43,19 @@ function createAction() { // we are overriding a method in a concrete class, not implementing // an interface. let md5Action = { - getLabel: function getLabel() { + getLabel() { return 'Print MD5 Checksum'; }, - getActionName: function getActionName() { + getActionName() { return 'md5'; }, - appliesTo: function appliesTo(project, task, member) { + appliesTo(project, task, member) { // Only files can have a checksum, not folders: // since projects and tasks are both kinds of folder, member // must be non-null and not a folder. return member != null && !member.isFolder(); }, - perform: function perform(project, task, member) { + perform(project, task, member) { let md5 = arkham.plugins.catalog.MD5Checksum.forFile(member.file); printf('%s: %s\n', member.name, md5.checksumString); } diff --git a/Plug-in Authoring Kit/Project Examples/PNG Packer/resources/cgj/PNGPack.js b/Plug-in Authoring Kit/Project Examples/PNG Packer/resources/cgj/PNGPack.js index 34003255..c030687d 100644 --- a/Plug-in Authoring Kit/Project Examples/PNG Packer/resources/cgj/PNGPack.js +++ b/Plug-in Authoring Kit/Project Examples/PNG Packer/resources/cgj/PNGPack.js @@ -45,13 +45,13 @@ function createAction() { // we are overriding a method in a concrete class, not implementing // an interface. let pngAction = { - getLabel: function getLabel() { + getLabel() { return 'Pack PNG Images'; }, - getActionName: function getActionName() { + getActionName() { return 'pngpack'; }, - appliesTo: function appliesTo(project, task, member) { + appliesTo(project, task, member) { member = ProjectUtilities.simplify(project, task, member); if (member.isFolder()) { let kids = member.getChildren(); @@ -63,7 +63,7 @@ function createAction() { } return false; }, - perform: function perform(project, task, member) { + perform(project, task, member) { member = ProjectUtilities.simplify(project, task, member); Eons.setWaitCursor(true); try { @@ -74,7 +74,7 @@ function createAction() { Eons.setWaitCursor(false); } }, - performImpl: function performImpl(member) { + performImpl(member) { let packed = 0; let skipped = 0; let inSize = 0; diff --git a/Plug-in Authoring Kit/Project Examples/PSD Layer Extractor/resources/cgj/psd-extractor.js b/Plug-in Authoring Kit/Project Examples/PSD Layer Extractor/resources/cgj/psd-extractor.js index d1b87c93..879dc30d 100644 --- a/Plug-in Authoring Kit/Project Examples/PSD Layer Extractor/resources/cgj/psd-extractor.js +++ b/Plug-in Authoring Kit/Project Examples/PSD Layer Extractor/resources/cgj/psd-extractor.js @@ -50,19 +50,19 @@ function createAction() { // we are overriding a method in a concrete class, not implementing // an interface. let psdAction = { - getLabel: function getLabel() { + getLabel() { return 'Extract Layers'; }, - getActionName: function getActionName() { + getActionName() { return 'psd-extractor'; }, - getIcon: function getIcon() { + getIcon() { return ICON; }, - appliesTo: function appliesTo(project, task, member) { + appliesTo(project, task, member) { return !member.isFolder() && ProjectUtilities.matchExtension(member, PSD); }, - perform: function perform(project, task, member) { + perform(project, task, member) { try { let psd = new PSDImageReader(member.file); let parent = member.file.parent; diff --git a/Plug-in Authoring Kit/Project Examples/Tab Synch/resources/cgj/tabsynch/tab-synch.js b/Plug-in Authoring Kit/Project Examples/Tab Synch/resources/cgj/tabsynch/tab-synch.js index 40be999b..8b916de1 100644 --- a/Plug-in Authoring Kit/Project Examples/Tab Synch/resources/cgj/tabsynch/tab-synch.js +++ b/Plug-in Authoring Kit/Project Examples/Tab Synch/resources/cgj/tabsynch/tab-synch.js @@ -125,7 +125,7 @@ function isEnabled() { function installEditorListener() { if (editorListener != null) uninstallEditorListener(); editorListener = new StrangeEonsEditor.EditorListener { - editorSelected: function editorSelected(ed) { + editorSelected(ed) { // check is syncing enabled and there is a new editor if (ed == null || !isEnabled()) return; // check if the editor has a file @@ -167,7 +167,7 @@ function installProjectListener() { // when attached to a project view, listens for selection changes and // selects the matching editor, if any selListener = new SelectionListener { - projectSelectionChanged: function projectSelectionChanged(viewEvent) { + projectSelectionChanged(viewEvent) { if (!isEnabled()) return; let m = viewEvent.selection; @@ -189,10 +189,10 @@ function installProjectListener() { // when the project changes, detach selListener from the old one // and attach it to the new one projListener = new ProjectEventListener { - projectOpened: function projectOpened(proj) { + projectOpened(proj) { reattachSelectionListener(); }, - projectClosing: function projectClosing(proj) { + projectClosing(proj) { reattachSelectionListener(); } }; diff --git a/Plug-in Authoring Kit/Project Examples/View Tab/resources/example/viewtab/view-tabs.js b/Plug-in Authoring Kit/Project Examples/View Tab/resources/example/viewtab/view-tabs.js index d2d4bd90..361dd77c 100644 --- a/Plug-in Authoring Kit/Project Examples/View Tab/resources/example/viewtab/view-tabs.js +++ b/Plug-in Authoring Kit/Project Examples/View Tab/resources/example/viewtab/view-tabs.js @@ -47,7 +47,7 @@ function run() { // Creates a new object that implements the ViewTab interface, which // we can then register let tab = new ViewTab { - createViewForProject: function createViewForProject(projectView, project) { + createViewForProject(projectView, project) { try { let view = new swing.JLabel('Example View'); view.opaque = true; @@ -59,10 +59,10 @@ function run() { throw ex; } }, - getLabel: function getLabel() { + getLabel() { return 'Example'; }, - getViewTabName: function getViewTabName() { + getViewTabName() { return 'dummy-example'; } }; diff --git a/Plug-in Authoring Kit/Project Examples/Zip Tools/resources/cgj/zip-tools.js b/Plug-in Authoring Kit/Project Examples/Zip Tools/resources/cgj/zip-tools.js index bd6d8f2a..04fe039c 100644 --- a/Plug-in Authoring Kit/Project Examples/Zip Tools/resources/cgj/zip-tools.js +++ b/Plug-in Authoring Kit/Project Examples/Zip Tools/resources/cgj/zip-tools.js @@ -74,11 +74,11 @@ function createOpener() { // create and return the opener implementation return new Open.InternalOpener() { // the opener can open files with the 'zip' extension - appliesTo: function appliesTo(file) { + appliesTo(file) { return ProjectUtilities.matchExtension(file, 'zip'); }, // this is what the opener will do to open a file when it applies - open: function open(file) { + open(file) { try { if (!confirm.yesno('Unpack ' + file.name + ' here?', 'Zip Archive')) { return; @@ -142,13 +142,13 @@ function createAction() { // we are overriding a method in a concrete class, not implementing // an interface. let zipAction = { - getLabel: function getLabel() { + getLabel() { return 'Compress'; }, - getActionName: function getActionName() { + getActionName() { return 'zipcompress'; }, - appliesToSelection: function appliesToSelection(members) { + appliesToSelection(members) { // Don't show the command if exactly 1 zip file is selected if (members.length == 1 && !members[0].isFolder() && ProjectUtils.matchExtension(members[0], 'zip')) { return false; @@ -157,11 +157,11 @@ function createAction() { // individual files. return this.super$appliesToSelection(members); }, - appliesTo: function appliesTo(project, task, member) { + appliesTo(project, task, member) { // Don't show command if only the project is selected return task != null || member != null; }, - performOnSelection: function performOnSelection(members) { + performOnSelection(members) { members = ProjectUtilities.merge(members); if (members.length == 0) return; @@ -203,7 +203,7 @@ function createAction() { [parent.findChild(zipFile)] ); }, - perform: function perform(project, task, member) { + perform(project, task, member) { // We override performOnSelection, which by default will call this // with individual members. We put a dummy implementation here // just in case someone wants to use our action and calls this @@ -221,16 +221,16 @@ function createAction() { function createMetadataSource() { let zipIcon = ImageUtils.getIcon('cgj/zip-tools.png'); let zipMetadata = { - appliesTo: function appliesTo(member) { + appliesTo(member) { return ProjectUtilities.matchExtension(member, 'zip'); }, - getIcon: function getIcon(member) { + getIcon(member) { return zipIcon; }, - getDescription: function getDescription(member) { + getDescription(member) { return 'Zip archive'; }, - fillInMetadataImpl: function fillInMetadataImpl(member, consumer) { + fillInMetadataImpl(member, consumer) { // This bit of voodoo is how you access a superclass method // from script code that implements a Java class. // In this case, it fills in the basic metadata common to all diff --git a/Plug-in Authoring Kit/Tool Examples/FTP Export Container/resources/example/ftp-export.js b/Plug-in Authoring Kit/Tool Examples/FTP Export Container/resources/example/ftp-export.js index 2347e966..15fb23ba 100644 --- a/Plug-in Authoring Kit/Tool Examples/FTP Export Container/resources/example/ftp-export.js +++ b/Plug-in Authoring Kit/Tool Examples/FTP Export Container/resources/example/ftp-export.js @@ -98,36 +98,36 @@ function createExportContainer() { session: null, // returns the text used to describe the container to the user - toString: function toString() { + toString() { return 'FTP server'; }, // returns a unique internal identifier for the container type - getIdentifier: function getIdentifier() { + getIdentifier() { return CONTAINER_ID; }, // returns true if the container has extra options that can be // configured in a separate dialog - isConfigurable: function isConfigurable() { + isConfigurable() { return false; }, // if the container was configurable, this would be called to // display the configuration dialog - configure: function configure() { + configure() { throw new UnsupportedOperationException(); }, // a sanity check: checks if a session is active; if not throws an error - checkOpen: function checkOpen() { + checkOpen() { if (this.session == null) { throw new IllegalStateException('no session is active'); } }, // a sanity check: checks if a session is active; if so throws an error - checkClosed: function checkClosed() { + checkClosed() { if (this.session != null) { throw new IllegalStateException('a previous session is still active'); } @@ -136,7 +136,7 @@ function createExportContainer() { // this is called when the user is about to begin exporting files; // we show a dialog that fills in the session property with the // information we need to connect to the FTP server - selectLocation: function selectLocation(baseName, componentHint) { + selectLocation(baseName, componentHint) { this.checkClosed(); this.session = showSessionDialog(); // we need to return a boolean indicating whether to continue; @@ -147,20 +147,20 @@ function createExportContainer() { // for container types that use the local file system, this can be // used to set the destination programmatically - setLocation: function setLocation(file) { + setLocation(file) { throw new UnsupportedOperationException(); }, // called at the start of an export; for this container there is // nothing to do since the destination (the FTP server) already exists - createContainer: function createContainer() { + createContainer() { this.checkOpen(); }, // called when a new file is about to exported as part of the export // operation; it must return an java.io.OutputStream, which the exported // file will be written to - addEntry: function addEntry(fileName) { + addEntry(fileName) { this.checkOpen(); let url = this.createURL(fileName); return url.openConnection().outputStream; @@ -170,7 +170,7 @@ function createExportContainer() { // gone smoothly; if display is true, the user has requested that // the exported files be "displayed" (what this does is up to the // container type) - closeContainer: function closeContainer(display) { + closeContainer(display) { this.checkOpen(); this.session = null; }, @@ -179,7 +179,7 @@ function createExportContainer() { // during export; ideally we would delete any files that we created // on the server, but we can't do that using FTP URLs, we'd need a more // advanced FTP API - destroyContainer: function destroyContainer() { + destroyContainer() { this.checkOpen(); this.session = null; }, @@ -188,13 +188,13 @@ function createExportContainer() { // certain type are fully supported by the container; we can // write any kind of file to the FTP server, so this simply // returns true - isFileFormatSupported: function isFileFormatSupported(ext) { + isFileFormatSupported(ext) { return true; }, // creates a URL that can be used to upload a file using the // current FTP session parameters - createURL: function createURL(fileName) { + createURL(fileName) { let s = this.session; let url = 'ftp://'; // add login credentials for non-anonymous access diff --git a/Plug-in Authoring Kit/Tool Examples/Pickman's Portrait Studio/resources/cgj/painter-lib.js b/Plug-in Authoring Kit/Tool Examples/Pickman's Portrait Studio/resources/cgj/painter-lib.js index f3172c1b..4ddea413 100644 --- a/Plug-in Authoring Kit/Tool Examples/Pickman's Portrait Studio/resources/cgj/painter-lib.js +++ b/Plug-in Authoring Kit/Tool Examples/Pickman's Portrait Studio/resources/cgj/painter-lib.js @@ -31,7 +31,7 @@ var Painter = { insensitivity: 3, strength: 4, - paint: function paint(image) { + paint(image) { image = this.edgeExtend(image); var painted = this.colourAndLighting(image); if (this.applyPaintEffect) { @@ -43,7 +43,7 @@ var Painter = { return painted; }, - colourAndLighting: function colourAndLighting(im) { + colourAndLighting(im) { // Note that 'im' is the original image. We must take care // not to overwrite the image data when applying filters. // (See lines marked '*', below.) @@ -59,7 +59,7 @@ var Painter = { return im; }, - edgeExtend: function edgeExtend(im) { + edgeExtend(im) { if (this.topExtend == 0 && this.rightExtend == 0 && this.bottomExtend == 0 && this.leftExtend == 0) { return im; } @@ -96,7 +96,7 @@ var Painter = { return exim; }, - paintEffect: function paintEffect(im) { + paintEffect(im) { this.oilFilt.setLevels(this.levels); this.oilFilt.setSmearRadius(this.radius); im = this.oilFilt.filter(im, null); @@ -105,7 +105,7 @@ var Painter = { return im; }, - sketchEffect: function sketchEffect(im, original) { + sketchEffect(im, original) { // for sketch lines, we perform edge detection on the // source image, then convert the edges into greyscale, // and convert that to a black image with those greyscale diff --git a/Plug-in Authoring Kit/pak-assets/yellow-sign.png b/Plug-in Authoring Kit/pak-assets/yellow-sign.png index 301ee14d..5c933f4b 100644 Binary files a/Plug-in Authoring Kit/pak-assets/yellow-sign.png and b/Plug-in Authoring Kit/pak-assets/yellow-sign.png differ diff --git a/Plug-in Authoring Kit/pak-assets/yellow-sign@2x.png b/Plug-in Authoring Kit/pak-assets/yellow-sign@2x.png new file mode 100644 index 00000000..19714aee Binary files /dev/null and b/Plug-in Authoring Kit/pak-assets/yellow-sign@2x.png differ