Skip to content

Commit

Permalink
Merge commit '2db80256856c14f8bc85dbbe453be64f4ac2556d'
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Dec 25, 2022
2 parents a7f5bc2 + 2db8025 commit 25e4b72
Show file tree
Hide file tree
Showing 391 changed files with 15,748 additions and 975 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ desktop\.ini

# Generated files
src/typedefs/ct.js/types.d.ts
app/data/ctLibJSDocAst.json
app/examples
app/templates
app/bundledAssets
Expand Down Expand Up @@ -99,3 +100,4 @@ app/pleaseCtJSLoadWithoutGPUAccelerationMmkay
app/debugger.html

**/**/*.orig
app/data/ct.libs/gamedistribution/.vscode/settings.json
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ build:
- gulp build

pack-deploy-release:
tags: [ "saas-linux-medium-amd64" ]
stage: pack
needs: ["lint", "build"]
script:
Expand Down
63 changes: 63 additions & 0 deletions app/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
## v3.2.0

*Mon Dec 26 2022*

### ✨ New Features

* Add a small button to collapse template's properties panel. Useful for presentations.
* Add an option to room settings to automatically follow a copy of a given template
* Catmod for integration with Game Distribution, an ad service (#394 by @UlisesFreitas)
* Support for CoffeeScript! Choose your preferred language when creating a new project 💪

### ⚡️ General Improvements

* 🌐 Update Turkish translation, made by Sarpmanon from our Discord server!
* Add aliases `this.moveSmart` and `this.moveBullet` for `this.moveContinuousByAxes` and `this.moveContinuous` correspondingly (these come from the ct.place module)
* Add documentation links to the content editor's panels
* Add hotkey hints to undo/redo buttons in the room editor
* Do not show table headers for copies' custom properties when no properties exist
* Force background on the notepad panel's "expand" button; useful on dark themes with which it can blend with backgrounds
* Make addresses in the QR code panel selectable (debugger's toolbar)
* Prevent nw.js SDK menu from popping up when ct.js is packaged
* Relayout code editors when switching tabs. Prevents code editors from disappearing after zooming or switching template coding layouts
* Rework texture editor's layout
* Show theme colors in the app settings -> theme menu
* Update textbox tutorial for v3 and add the missing step (#396 by @firecakes)
* Warn users that they need to add a tile layer when they try to add tiles into a room that doesn't have any layers

### 🐛 Bug Fixes

* 🍱 Update 2DPhysics example
* Don't attempt to focus items in a context menus if there are no such
* Fix an ugly splash screen for the DungeonCrawler demo project
* Fix broken sound recorder
* Fix scrollbars sometimes appearing in the room editor
* Fix templates not being properly cleaned up if they are in a currently opened room
* Fix texture offset being applied to the texture preview window
* Fix wrong click location on a tile picker
* Ignore clicks on the "Run" button if a project is already being compiled.
Should remove most of the headache with Window's EPERM issues
* Initialize timers for rooms
* Outline currently selected template in the room editor's template browser
* Room's background color input must not have an alpha input
* Set default values for room's camera restrictions
* Update respective asset viewers when they are changed or created. Fixes outdated template list in the room editor when you've created or modified a template while a room editor is open.

### 🍱 Demos, Dependencies and Stuff

* Update bundled assets
* Pull the latest gallery assets

### 📝 Docs

* 🐛 Multiply horizontal x-change with delta when robot travels on platform (#102 by @godmar)
* ✨ Translate jsintro_pt1.md to Russian (#100 by @progzone122)
* ⚡️ Create ru/jsintro_pt2.md and fix ru/readme.md (#101 by @progzone122)

### 🌐 Website

* 📝 Update changelog
* ⚡️ Add a big Discord badge to the downloads page
* ⚡️ Add a button for ARM builds for mac


## v3.1.0

*Mon Nov 07 2022*
Expand Down
1 change: 1 addition & 0 deletions app/data/boosters.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cats:
- Dēmētrius ille
- GAKONS
- Penny Gautreaux

businessCats:
- myOmochi Games
Expand Down
3 changes: 3 additions & 0 deletions app/data/ct.libs/gamedistribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ct.gamedistribution

A module for `Game Distribution` SDK.
132 changes: 132 additions & 0 deletions app/data/ct.libs/gamedistribution/docs/General use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# General use of `ct.gamedistribution`
An easy way to display `Game Distribution` Ads.

## Catmods' settings -> Game Distribution

* GameID
* Auto init
* Localization of the Ads
* Enable GDPR
* Enable Debug, note you can enable debug in console just write `gdsdk.openConsole()` then the GD debug bar will appear, and it will keep showing until you delete the localStorage in your game.

## How do you use `ct.gamedistribution`?

* To use it you need to init the `Game Distribution SDK`.

* You can do this from `Catmods' settings -> Game Distribution` and check `Auto init Game Distribution SDK`.

* If you prefer to initialize `Game Distribution SDK` manually you can add this code into a `custom script`.

### Init the Game Distribution SDK

!important: Make sure this runs only `one time`.

```js
ct.gamedistribution.init();
```

### Show an Ad manually

Inside a `Click` event add this code:

```js
if (!ct.gamedistribution.adPlaying) {
ct.gamedistribution.showAd();
}
```

* Now go to your `UI` room and add an event of `Ads` `Check if an Ads has finished`

* Inside the code and according to your game logic you can add something like this:

```js
ct.room.coins +=1;
```
- This way you reward the player with 1 coin after the Ad has finished.

## Available methods

`ct.gamedistribution.init();`
Initialize the Game distribution SDK, manually.

`ct.gamedistribution.gdsdkReady()`
Check if Game distribution SDK, is ready to show Ads.

`ct.gamedistribution.pauseGame()`
Used to pause the game.

`ct.gamedistribution.resumeGame()`
Used to resume the game.

`ct.gamedistribution.showAd();`
Is available when GD SDK is ready, so you can call this method in a button click of wherever you want but `make sure is called one time`

`ct.gamedistribution.isAdFinished();`
This method is the same as the event that you can add into the events editor in the room, according to the image we seen above.

## Available Variables

* var isFinished: boolean; `Used to check if an Ad is completed.`
* var isPaused: boolean; `Used to check if the game is paused or running.`
* var sdkReady: boolean; `Use to check if the Game Distribution SDK is ready to display Ads.`
* var adPlaying: boolean; `Used to check if an Ad is showing.`

### Game Distribution SDK

Check if the `Game Distribution SDK` is ready to display Ads.
```js
if (ct.gamedistribution.sdkReady) {
//Usually you don't need to use this method but in case you want.
//Do something here...
}
```

### Ad has finished, completed.

In case you don't want to use the built-in `event` to check if the Ad has finished, you can use `ct.gamedistribution.isFinished` in `OnStep` like:
```js
if(ct.gamedistribution.isFinished){
//Reward the player here
this.coins +=1;
ct.gamedistribution.isFinished = false;
ct.gamedistribution.isPaused = false;
}
```
### Pause the game. Please make sure you mute the music and sounds otherwise Game Distribution is going to reject your game.

In some case you maybe want to pause the game manually do:
```js
if(!ct.gamedistribution.isPaused){
if (ct.gamedistribution.adPlaying) {
ct.gamedistribution.isPaused = true;
//Do something here...
}
}
```

### Resume the game after the Ad is completed. Remember to enable music and sounds.

In case you need to manually resume the game do:
```js
if(ct.gamedistribution.isPaused){
if (!ct.gamedistribution.adPlaying) {
ct.gamedistribution.isPaused = false;
//Do something
}
}
```

### Show an Ad manually
Make sure this runs `one time` maybe with a `button click` or any event that triggers `only once`.
```js
if (!ct.gamedistribution.adPlaying) {
ct.gamedistribution.showAd();
}
```


A mini tutorial is available here: https://www.youtube.com/watch?v=CO7kU1vkwXg and thats it...

Enjoy making money with Ads.

By Ulises Freitas.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
if (ct.gamedistribution.isFinished) {
ct.gamedistribution.isFinished = false;
ct.gamedistribution.isPaused = false;
/*%%USER_CODE%%*/
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
if(!ct.gamedistribution.isPaused){
if (ct.gamedistribution.adPlaying) {
ct.gamedistribution.isPaused = true;
/*%%USER_CODE%%*/
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
if(ct.gamedistribution.isPaused){
if (!ct.gamedistribution.adPlaying) {
ct.gamedistribution.isPaused = false;
/*%%USER_CODE%%*/
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
if (ct.gamedistribution.sdkReady) {
/*%%USER_CODE%%*/
}
}
90 changes: 90 additions & 0 deletions app/data/ct.libs/gamedistribution/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
(function ctGamedistribution(ct) {
ct.gamedistribution = {

init() {
ct.gamedistribution.isFinished = false;
ct.gamedistribution.adPlaying = false;
ct.gamedistribution.isPaused = false;

window["GD_OPTIONS"] = {
"gameId": "/*%gameID%*/", // Your gameId can be found at your Gamedistribution.com account.
advertisementSettings: {
debug: [/*%debugMode%*/][0],
"locale": "/*%gdsdkLocale%*/", // Locale used in IMA SDK, this will localize the "Skip ad after x seconds" phrases.
},
"onEvent": function(event) {
switch (event.name) {
case "SDK_GAME_START":
ct.gamedistribution.adPlaying = false;
break;
case "SDK_GAME_PAUSE":
ct.gamedistribution.adPlaying = true;
break;
case "SDK_READY":
ct.gamedistribution.sdkReady = true;
break;
case "SDK_ERROR":
/** This is not managed right now */
ct.gamedistribution.sdkError = true;
break;
case "COMPLETE":
ct.gamedistribution.isFinished = true;
ct.gamedistribution.adPlaying = false;
break;
case "SDK_GDPR_TRACKING":
/** This is not managed right now */
ct.gamedistribution.sdkGdprTracking = true;
break;
case "SDK_GDPR_TARGETING":
/** This is not managed right now */
ct.gamedistribution.sdkGdprTargeting = true;
break;
case "SDK_GDPR_THIRD_PARTY":
/** This is not managed right now */
ct.gamedistribution.sdkGdprThirdParty = true;
break;
}
},
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = 'https://html5.api.gamedistribution.com/main.min.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'gamedistribution-jssdk'));

/**
* Includes a basic GDPR
*/
if([/*%gdpr%*/][0]){
const script = document.createElement("script");
script.src = "//acdn.adnxs.com/cmp/cmp.complete.bundle.js";
document.head.appendChild(script);
}

},
showAd(){
if (typeof gdsdk !== 'undefined' && gdsdk.showAd !== 'undefined') {
gdsdk.showAd();
}
},
pauseGame(){
if(ct.gamedistribution.adPlaying){
return true;
}
},
resumeGame(){
if(!ct.gamedistribution.adPlaying){
return true;
}
}
}
/**
* Auto init the Game Distribution SDK.
*/
if([/*%autoInit%*/][0]){
ct.gamedistribution.init();
}
})(ct);
Loading

0 comments on commit 25e4b72

Please sign in to comment.