Permalink
Browse files

Start refactor of game display code

  • Loading branch information...
1 parent 3042d42 commit 70105266f86128bec58715b20537c61a475b8a82 @nikop committed Mar 23, 2012
Showing with 114 additions and 0 deletions.
  1. +66 −0 Sources/Arcade/Game/Flash.php
  2. +16 −0 Sources/Arcade/Game/v1game.php
  3. +16 −0 Sources/Arcade/Game/v2game.php
  4. +16 −0 Sources/Arcade/Game/v3arcade.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * SMF Arcade
+ *
+ * @package SMF Arcade
+ * @version 2.6
+ * @license http://download.smfarcade.info/license.php New-BSD
+ */
+
+/**
+ *
+ */
+abstract class Arcade_Game_Flash extends Arcade_Game
+{
+ /**
+ *
+ */
+ public function Render()
+ {
+ global $context, $settings, $txt;
+
+ echo '
+ <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/swfobject.js" defer="defer"></script>
+ <script language="JavaScript" type="text/javascript" defer="defer"><!-- // --><![CDATA[
+ var play_url = smf_scripturl + "?action=arcade;sa=play;xml";
+ var running = false;
+
+ function arcadeRestart()
+ {
+ running = false;
+
+ setInnerHTML(document.getElementById("game"), "', addslashes($txt['arcade_please_wait']), '");
+
+ var i, x = new Array();
+
+ x[0] = "game=', $this->game['id'] . '";
+ x[1] = "', $context['session_var'], '=', $context['session_id'], '";
+
+ arcadeAjaxSend(play_url, x.join("&"), ArcadeStart);
+
+ return false;
+ }
+
+ function ArcadeStart()
+ {
+ if (running)
+ return;
+
+ running = true;
+
+ setInnerHTML(document.getElementById("game"), "', addslashes($txt['arcade_no_flash']), '");
+
+ var so = new SWFObject("' , $this->game['url']['flash'], '", "', $this->game['file'], '", "', $this->game['extra_data']['width'], '", "', $this->game['extra_data']['height'], '", "7");
+ so.addParam("menu", "false");
+ so.write("game");
+
+ return true;
+ }
+
+ ', $auto_start ? 'addLoadEvent(arcadeRestart);' : '', '
+ // ]]></script>
+ <div id="game" style="margin: auto; width: ', $this->game['extra_data']['width'], 'px; height: ', $this->game['extra_data']['height'], 'px; ">
+ ', $txt['arcade_no_javascript'], '
+ </div>';
+ }
+}
@@ -0,0 +1,16 @@
+<?php
+/**
+ * SMF Arcade
+ *
+ * @package SMF Arcade
+ * @version 2.6
+ * @license http://download.smfarcade.info/license.php New-BSD
+ */
+
+/**
+ *
+ */
+class Arcade_Game_v1game extends Arcade_Game_Flash
+{
+
+}
@@ -0,0 +1,16 @@
+<?php
+/**
+ * SMF Arcade
+ *
+ * @package SMF Arcade
+ * @version 2.6
+ * @license http://download.smfarcade.info/license.php New-BSD
+ */
+
+/**
+ *
+ */
+class Arcade_Game_v2game extends Arcade_Game_Flash
+{
+
+}
@@ -0,0 +1,16 @@
+<?php
+/**
+ * SMF Arcade
+ *
+ * @package SMF Arcade
+ * @version 2.6
+ * @license http://download.smfarcade.info/license.php New-BSD
+ */
+
+/**
+ *
+ */
+class Arcade_Game_v3arcade extends Arcade_Game_Flash
+{
+
+}

0 comments on commit 7010526

Please sign in to comment.