Zones/DetailPage

* directly display AudioControls for all ZoneMusic & Ambience
This commit is contained in:
Sarjuuk
2017-04-22 22:25:11 +02:00
parent 6377a9e659
commit 4316d3ad40
7 changed files with 92 additions and 12 deletions

View File

@@ -711,6 +711,9 @@ $lang = array(
'notFound' => "Dieser Klang existiert nicht.",
'foundIn' => "Dieser Klang befindet sich in",
'goToPlaylist' => "Gehe zu meiner Playlist",
'music' => "Musik",
'intro' => "Intromusik",
'ambience' => "Umgebung",
'cat' => array(
null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down",
"NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor",

View File

@@ -711,6 +711,9 @@ $lang = array(
'notFound' => "This sound doesn't exist.",
'foundIn' => "This sound can be found in",
'goToPlaylist' => "Go to My Playlist",
'music' => "Music",
'intro' => "Intro Music",
'ambience' => "Ambience",
'cat' => array(
null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down",
"NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor",

View File

@@ -711,6 +711,9 @@ $lang = array(
'notFound' => "Este sonido no existe.",
'foundIn' => "Este sonido se puede encontrar en",
'goToPlaylist' => "Ir a mi lista de reproducción",
'music' => "Música",
'intro' => "Música de introducción",
'ambience' => "Ambiente",
'cat' => array(
null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down",
"NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor",

View File

@@ -711,6 +711,9 @@ $lang = array(
'notFound' => "Ce son n'existe pas.",
'foundIn' => "Ce son se trouve dans",
'goToPlaylist' => "Aller à votre playlist",
'music' => "Musique",
'intro' => "Musique d'introduction",
'ambience' => "Ambiance",
'cat' => array(
null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down",
"NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor",

View File

@@ -711,6 +711,9 @@ $lang = array(
'notFound' => "Этот звук не существует.",
'foundIn' => "Этот Звук может быть найден в следующих зонах:",
'goToPlaylist' => "Перейти к плейлисту",
'music' => "Музыка",
'intro' => "Начальная музыка",
'ambience' => "Атмосфера",
'cat' => array(
null, "Spells", "User Interface", "Footsteps", "Weapons Impacts", null, "Weapons Misses", null, null, "Pick Up/Put Down",
"NPC Combat", null, "Errors", "Nature", "Objects", null, "Death", "NPC Greetings", null, "Armor",

View File

@@ -10,11 +10,13 @@ class ZonePage extends GenericPage
{
use detailPage;
protected $path = [0, 6];
protected $tabId = 0;
protected $type = TYPE_ZONE;
protected $tpl = 'detail-page-generic';
protected $js = ['ShowOnMap.js'];
protected $path = [0, 6];
protected $tabId = 0;
protected $type = TYPE_ZONE;
protected $tpl = 'detail-page-generic';
protected $js = ['ShowOnMap.js'];
protected $zoneMusic = [];
public function __construct($pageCall, $id)
{
@@ -708,13 +710,13 @@ class ZonePage extends GenericPage
$soundIds = [];
$zoneMusic = DB::Aowow()->select('
SELECT
x.soundId AS ARRAY_KEY, x.soundId, x.worldStateId, x.worldStateValue
x.soundId AS ARRAY_KEY, x.soundId, x.worldStateId, x.worldStateValue, x.type
FROM (
SELECT ambienceDay AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND ambienceDay > 0 UNION
SELECT ambienceNight AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND ambienceNight > 0 UNION
SELECT musicDay AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND musicDay > 0 UNION
SELECT musicNight AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND musicNight > 0 UNION
SELECT intro AS soundId, worldStateId, worldStateValue FROM ?_zones_sounds WHERE id IN (?a) AND intro > 0
SELECT ambienceDay AS soundId, worldStateId, worldStateValue, 1 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND ambienceDay > 0 UNION
SELECT ambienceNight AS soundId, worldStateId, worldStateValue, 1 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND ambienceNight > 0 UNION
SELECT musicDay AS soundId, worldStateId, worldStateValue, 2 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND musicDay > 0 UNION
SELECT musicNight AS soundId, worldStateId, worldStateValue, 2 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND musicNight > 0 UNION
SELECT intro AS soundId, worldStateId, worldStateValue, 3 AS `type` FROM ?_zones_sounds WHERE id IN (?a) AND intro > 0
) x
GROUP BY
x.soundId, x.worldStateId, x.worldStateValue
@@ -731,6 +733,7 @@ class ZonePage extends GenericPage
$music = new SoundList(array(['id', array_unique($soundIds)]));
if (!$music->error)
{
// tab
$data = $music->getListviewData();
$tabData = [];
@@ -748,6 +751,29 @@ class ZonePage extends GenericPage
$this->lvTabs[] = ['sound', $tabData];
$this->extendGlobalData($music->getJSGlobals(GLOBALINFO_SELF));
// audio controls
// ambience
if ($sounds = array_filter($zoneMusic, function ($x) { return $x['type'] == 1; } ))
foreach ($sounds as $sId => $_)
if (!empty($data[$sId]['files']))
foreach ($data[$sId]['files'] as $f)
$this->zoneMusic['ambience'][] = $f;
// music
if ($sounds = array_filter($zoneMusic, function ($x) { return $x['type'] == 2; } ))
foreach ($sounds as $sId => $_)
if (!empty($data[$sId]['files']))
foreach ($data[$sId]['files'] as $f)
$this->zoneMusic['music'][] = $f;
// intro
if ($sounds = array_filter($zoneMusic, function ($x) { return $x['type'] == 3; } ))
foreach ($sounds as $sId => $_)
if (!empty($data[$sId]['files']))
foreach ($data[$sId]['files'] as $f)
$this->zoneMusic['intro'][] = $f;
}
}
}

View File

@@ -44,10 +44,49 @@ if (!empty($this->transfer)):
echo " <div class=\"pad\"></div>\n ".$this->transfer."\n";
endif;
if ($this->zoneMusic):
?>
<div class="clear">
<?php
if (!empty($this->zoneMusic['music'])):
?>
<div id="zonemusicdiv-zonemusic" style="float: left">
<h3><?=Lang::sound('music'); ?></h3>
</div>
<script type="text/javascript">//<![CDATA[
(new AudioControls()).init(<?=Util::toJSON($this->zoneMusic['music']); ?>, $WH.ge('zonemusicdiv-zonemusic'), {loop: true});
//]]></script>
<?php
endif;
if (!empty($this->zoneMusic['intro'])):
?>
<div id="zonemusicdiv-zonemusicintro" style="float: left">
<h3><?=Lang::sound('intro'); ?></h3>
</div>
<script type="text/javascript">//<![CDATA[
(new AudioControls()).init(<?=Util::toJSON($this->zoneMusic['intro']); ?>, $WH.ge('zonemusicdiv-zonemusicintro'), {});
//]]></script>
<?php
endif;
if (!empty($this->zoneMusic['ambience'])):
?>
<div id="zonemusicdiv-soundambience" style="float: left">
<h3><?=Lang::sound('ambience'); ?></h3>
</div>
<script type="text/javascript">//<![CDATA[
(new AudioControls()).init(<?=Util::toJSON($this->zoneMusic['ambience']); ?>, $WH.ge('zonemusicdiv-soundambience'), {loop: true});
//]]></script>
<?php
endif;
?>
<br clear="all"/></div>
<?php
endif;
?>
<h2 class="clear"><?php echo Lang::main('related'); ?></h2>
</div>
<?php
$this->brick('lvTabs', ['relTabs' => true]);