Skip to content

Commit

Permalink
Merge pull request #155 from renderforest/mute-music
Browse files Browse the repository at this point in the history
Remove mute music functionality.
  • Loading branch information
ArtyomHov authored Jun 12, 2021
2 parents e348cfc + 6b40c52 commit 49f1424
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "renderforest/sdk-php",
"description": "Renderforest SDK for PHP",
"version": "0.5.5",
"version": "0.5.6",
"homepage": "https://github.com/renderforest/renderforest-sdk-php",
"keywords": [
"animation maker",
Expand Down
4 changes: 2 additions & 2 deletions doc/PROJECTS_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ $renderforestClient = new \Renderforest\ApiClient(
$projectId = $renderforestClient->addProject(701); // template id
```
- Also, project-data is created with the following list of initial properties:
templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteMusic,
templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteSfx,
currentScreenId, projectColors (optional), themeVariableName (optional), themeVariableValue (optional).
- The "muteMusic" is false initially.
- The "muteSfx" is false initially.
- If template is lego ("isLego": true), then no initial screen is added and "screens" defaults to []. Otherwise, at least one screen is present.
- The "currentScreenId" is the id of the first screen for non-lego templates & null for lego templates.
- The "projectColors" is optional and gets value if the template has default colors. Both lego & non-lego templates might have default colors.
Expand Down
3 changes: 2 additions & 1 deletion examples/project-data/get-project-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
echo 'Is Equalizer - ' . ($projectData->isEqualizer() ? 'True' : 'False') . PHP_EOL;
echo 'Is Extendable Screens - ' . ($projectData->isExtendableScreens() ? 'True' : 'False') . PHP_EOL;
echo 'Is Lego - ' . ($projectData->isLego() ? 'True' : 'False') . PHP_EOL;
echo 'Is Mute Music - ' . ($projectData->isMuteMusic() ? 'True' : 'False') . PHP_EOL;
echo 'Has Sfx - ' . ($projectData->hasSfx() ? 'True' : 'False') . PHP_EOL;
echo 'Is Mute Sfx - ' . ($projectData->isMuteSfx() ? 'True' : 'False') . PHP_EOL;

echo 'Project Colors: ' . PHP_EOL;
foreach ($projectData->getProjectColors() as $projectColor) {
Expand Down
2 changes: 0 additions & 2 deletions examples/project-data/update-project-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

$projectData = $renderforestClient->getProjectData(16165971);

$projectData->setMuteMusic(false);

$projectData
->getScreenByOrder(1)
->getAreaByOrder(1)
Expand Down
3 changes: 2 additions & 1 deletion examples/projects/get-trial-project.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
echo 'Is Equalizer - ' . ($trialProject->isEqualizer() ? 'True' : 'False') . PHP_EOL;
echo 'Is Extendable Screens - ' . ($trialProject->isExtendableScreens() ? 'True' : 'False') . PHP_EOL;
echo 'Is Lego - ' . ($trialProject->isLego() ? 'True' : 'False') . PHP_EOL;
echo 'Is Mute Music - ' . ($trialProject->isMuteMusic() ? 'True' : 'False') . PHP_EOL;
echo 'Has Sfx - ' . ($trialProject->hasSfx() ? 'True' : 'False') . PHP_EOL;
echo 'Is Mute Sfx - ' . ($trialProject->isMuteSfx() ? 'True' : 'False') . PHP_EOL;

echo 'Project Colors: ' . PHP_EOL;
foreach ($trialProject->getProjectColors() as $projectColor) {
Expand Down
53 changes: 42 additions & 11 deletions src/ProjectData/ProjectData.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class ProjectData extends ApiEntityBase
const KEY_EQUALIZER = 'equalizer';
const KEY_EXTENDABLE_SCREENS = 'extendableScreens';
const KEY_IS_LEGO = 'isLego';
const KEY_MUTE_MUSIC = 'muteMusic';
const KEY_MUTE_SFX = 'muteSfx';
const KEY_HAS_SFX = 'hasSfx';
const KEY_PROJECT_COLORS = 'projectColors';
const KEY_PROJECT_VERSION = 'projectVersion';
const KEY_SCREENS = 'screens';
Expand All @@ -42,7 +43,7 @@ class ProjectData extends ApiEntityBase
const WRITABLE_KEYS = [
self::KEY_CURRENT_SCREEN_ID,
self::KEY_EDITING_MODE,
self::KEY_MUTE_MUSIC,
self::KEY_MUTE_SFX,
self::KEY_SOUNDS,
self::KEY_PROJECT_COLORS,
self::KEY_SCREENS,
Expand Down Expand Up @@ -83,7 +84,10 @@ class ProjectData extends ApiEntityBase
protected $isLego;

/** @var bool */
protected $muteMusic;
protected $muteSfx;

/** @var bool */
protected $hasSfx;

/** @var ColorCollection */
protected $projectColors;
Expand Down Expand Up @@ -266,6 +270,25 @@ public function isLego(): bool
return $this->isLego;
}

/**
* @return bool
*/
public function hasSfx(): bool
{
return $this->hasSfx;
}

/**
* @param bool $hasSfx
* @return ProjectData
*/
public function setHasSfx(bool $hasSfx): ProjectData
{
$this->hasSfx = $hasSfx;

return $this;
}

/**
* @param bool $isLego
* @return ProjectData
Expand All @@ -280,18 +303,22 @@ public function setIsLego(bool $isLego): ProjectData
/**
* @return bool
*/
public function isMuteMusic(): bool
public function isMuteSfx(): bool
{
return $this->muteMusic;
return $this->muteSfx;
}

/**
* @param bool $muteMusic
* @param bool $muteSfx
* @return ProjectData
*/
public function setMuteMusic(bool $muteMusic): ProjectData
public function setMuteSfx(bool $muteSfx): ProjectData
{
$this->muteMusic = $muteMusic;
if (true === $this->hasSfx) {
$this->muteSfx = $muteSfx;
} else {
$this->muteSfx = false;
}

return $this;
}
Expand Down Expand Up @@ -604,8 +631,11 @@ public function exchangeArray(array $projectDataArrayData)
$isLego = $projectDataArrayData[self::KEY_IS_LEGO];
$this->setIsLego($isLego);

$muteMusic = $projectDataArrayData[self::KEY_MUTE_MUSIC];
$this->setMuteMusic($muteMusic);
$hasSfx = $projectDataArrayData[self::KEY_HAS_SFX];
$this->setHasSfx($hasSfx);

$muteSfx = $projectDataArrayData[self::KEY_MUTE_SFX];
$this->setMuteSfx($muteSfx);

if (array_key_exists(self::KEY_PROJECT_COLORS, $projectDataArrayData)) {
$projectColorsArrayData = $projectDataArrayData[self::KEY_PROJECT_COLORS];
Expand Down Expand Up @@ -723,7 +753,8 @@ public function getArrayCopyFull(): array
self::KEY_EQUALIZER => $this->isEqualizer(),
self::KEY_EXTENDABLE_SCREENS => $this->isExtendableScreens(),
self::KEY_IS_LEGO => $this->isLego(),
self::KEY_MUTE_MUSIC => $this->isMuteMusic(),
self::KEY_HAS_SFX => $this->hasSfx(),
self::KEY_MUTE_SFX => $this->isMuteSfx(),
self::KEY_PROJECT_COLORS => $this->projectColors->getArrayCopy(),
self::KEY_PROJECT_VERSION => $this->getProjectVersion(),
self::KEY_SCREENS => $this->screens->getArrayCopy(),
Expand Down

0 comments on commit 49f1424

Please sign in to comment.