fml update

This commit is contained in:
Steffen Schröder 2014-01-21 20:30:40 +01:00
parent 71a19d2464
commit 11abd5ee6e
73 changed files with 209 additions and 83 deletions

View File

@ -12,7 +12,7 @@ use FML\Types\Scriptable;
* @author steeffeen * @author steeffeen
*/ */
class Audio extends Control implements Playable, Scriptable { class Audio extends Control implements Playable, Scriptable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $data = ''; protected $data = '';

View File

@ -11,7 +11,7 @@ use FML\Types\Renderable;
* @author steeffeen * @author steeffeen
*/ */
abstract class Control implements Renderable { abstract class Control implements Renderable {
/** /*
* Constants * Constants
*/ */
const CENTER = 'center'; const CENTER = 'center';
@ -21,7 +21,7 @@ abstract class Control implements Renderable {
const BOTTOM = 'bottom'; const BOTTOM = 'bottom';
const LEFT = 'left'; const LEFT = 'left';
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'control'; protected $tagName = 'control';

View File

@ -14,7 +14,7 @@ use FML\Types\TextFormatable;
* @author steeffeen * @author steeffeen
*/ */
class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable { class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $name = ''; protected $name = '';

View File

@ -9,7 +9,7 @@ namespace FML\Controls;
* @author steeffeen * @author steeffeen
*/ */
class FileEntry extends Entry { class FileEntry extends Entry {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $folder = ''; protected $folder = '';

View File

@ -14,7 +14,7 @@ use FML\Elements\FrameModel;
* @author steeffeen * @author steeffeen
*/ */
class Frame extends Control implements Container { class Frame extends Control implements Container {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $children = array(); protected $children = array();

View File

@ -12,7 +12,7 @@ use FML\Stylesheet\Style3d;
* @author steeffeen * @author steeffeen
*/ */
class Frame3d extends Frame implements Scriptable { class Frame3d extends Frame implements Scriptable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $style3dId = ''; protected $style3dId = '';

View File

@ -12,7 +12,7 @@ use FML\Types\Renderable;
* @author steeffeen * @author steeffeen
*/ */
class FrameInstance extends Control { class FrameInstance extends Control {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $modelId = ''; protected $modelId = '';

View File

@ -10,9 +10,16 @@ use FML\Types\Styleable;
* *
* @author steeffeen * @author steeffeen
*/ */
// TODO: gauge styles
class Gauge extends Control implements Styleable { class Gauge extends Control implements Styleable {
/** /*
* Constants
*/
const STYLE_BgCard = 'BgCard';
const STYLE_EnergyBar = 'EnergyBar';
const STYLE_ProgressBar = 'ProgressBar';
const STYLE_ProgressBarSmall = 'ProgressBarSmall';
/*
* Protected Properties * Protected Properties
*/ */
protected $ratio = 0.; protected $ratio = 0.;

View File

@ -16,7 +16,7 @@ use FML\Types\TextFormatable;
* @author steeffeen * @author steeffeen
*/ */
class Label extends Control implements Actionable, Linkable, NewLineable, Scriptable, Styleable, TextFormatable { class Label extends Control implements Actionable, Linkable, NewLineable, Scriptable, Styleable, TextFormatable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $text = ''; protected $text = '';
@ -137,6 +137,14 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
return $this; return $this;
} }
/**
*
* @see \FML\Types\Actionable::getAction()
*/
public function getAction() {
return $this->action;
}
/** /**
* *
* @see \FML\Types\Actionable::setActionKey() * @see \FML\Types\Actionable::setActionKey()
@ -263,7 +271,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
*/ */
public function render(\DOMDocument $domDocument) { public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument); $xmlElement = parent::render($domDocument);
if ($this->text) { if (strlen($this->text) > 0) {
$xmlElement->setAttribute('text', $this->text); $xmlElement->setAttribute('text', $this->text);
} }
if ($this->textId) { if ($this->textId) {
@ -281,7 +289,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
if ($this->maxLines >= 0) { if ($this->maxLines >= 0) {
$xmlElement->setAttribute('maxlines', $this->maxLines); $xmlElement->setAttribute('maxlines', $this->maxLines);
} }
if ($this->action) { if (strlen($this->action) > 0) {
$xmlElement->setAttribute('action', $this->action); $xmlElement->setAttribute('action', $this->action);
} }
if ($this->actionKey >= 0) { if ($this->actionKey >= 0) {

View File

@ -10,7 +10,7 @@ use FML\Controls\Label;
* @author steeffeen * @author steeffeen
*/ */
class Label_Button extends Label { class Label_Button extends Label {
/** /*
* Constants * Constants
*/ */
const STYLE_CardButtonMedium = 'CardButtonMedium'; const STYLE_CardButtonMedium = 'CardButtonMedium';

View File

@ -10,7 +10,7 @@ use FML\Controls\Label;
* @author steeffeen * @author steeffeen
*/ */
class Label_Text extends Label { class Label_Text extends Label {
/** /*
* Constants * Constants
*/ */
const STYLE_AvatarButtonNormal = 'AvatarButtonNormal'; const STYLE_AvatarButtonNormal = 'AvatarButtonNormal';
@ -93,7 +93,7 @@ class Label_Text extends Label {
* Create a new Label_Text Control * Create a new Label_Text Control
* *
* @param string $id (optional) Control Id * @param string $id (optional) Control Id
* @return \FML\Controls\Labels\Label_Button * @return \FML\Controls\Labels\Label_Text
*/ */
public static function create($id = null) { public static function create($id = null) {
$labelText = new Label_Text($id); $labelText = new Label_Text($id);

View File

@ -16,7 +16,7 @@ use FML\Types\SubStyleable;
* @author steeffeen * @author steeffeen
*/ */
class Quad extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable { class Quad extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $image = ''; protected $image = '';
@ -146,6 +146,14 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
return $this; return $this;
} }
/**
*
* @see \FML\Types\Actionable::getAction()
*/
public function getAction() {
return $this->action;
}
/** /**
* *
* @see \FML\Types\Actionable::setActionKey() * @see \FML\Types\Actionable::setActionKey()
@ -274,7 +282,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
if (!$this->autoScale) { if (!$this->autoScale) {
$xmlElement->setAttribute('autoscale', $this->autoScale); $xmlElement->setAttribute('autoscale', $this->autoScale);
} }
if ($this->action) { if (strlen($this->action) > 0) {
$xmlElement->setAttribute('action', $this->action); $xmlElement->setAttribute('action', $this->action);
} }
if ($this->actionKey >= 0) { if ($this->actionKey >= 0) {

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_321Go extends Quad { class Quad_321Go extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = '321Go'; const STYLE = '321Go';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_BgRaceScore2 extends Quad { class Quad_BgRaceScore2 extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'BgRaceScore2'; const STYLE = 'BgRaceScore2';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Bgs1 extends Quad { class Quad_Bgs1 extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Bgs1'; const STYLE = 'Bgs1';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Bgs1InRace extends Quad { class Quad_Bgs1InRace extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Bgs1InRace'; const STYLE = 'Bgs1InRace';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_BgsChallengeMedals extends Quad { class Quad_BgsChallengeMedals extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'BgsChallengeMedals'; const STYLE = 'BgsChallengeMedals';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_BgsPlayerCard extends Quad { class Quad_BgsPlayerCard extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'BgsPlayerCard'; const STYLE = 'BgsPlayerCard';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Copilot extends Quad { class Quad_Copilot extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Copilot'; const STYLE = 'Copilot';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Emblems extends Quad { class Quad_Emblems extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Emblems'; const STYLE = 'Emblems';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_EnergyBar extends Quad { class Quad_EnergyBar extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'EnergyBar'; const STYLE = 'EnergyBar';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Hud3dEchelons extends Quad { class Quad_Hud3dEchelons extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Hud3dEchelons'; const STYLE = 'Hud3dEchelons';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Icons128x128_1 extends Quad { class Quad_Icons128x128_1 extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Icons128x128_1'; const STYLE = 'Icons128x128_1';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Icons128x128_Blink extends Quad { class Quad_Icons128x128_Blink extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Icons128x128_Blink'; const STYLE = 'Icons128x128_Blink';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Icons128x32_1 extends Quad { class Quad_Icons128x32_1 extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Icons128x32_1'; const STYLE = 'Icons128x32_1';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Icons64x64_1 extends Quad { class Quad_Icons64x64_1 extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Icons64x64_1'; const STYLE = 'Icons64x64_1';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_Icons64x64_2 extends Quad { class Quad_Icons64x64_2 extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'Icons64x64_2'; const STYLE = 'Icons64x64_2';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_ManiaPlanetLogos extends Quad { class Quad_ManiaPlanetLogos extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'ManiaPlanetLogos'; const STYLE = 'ManiaPlanetLogos';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_ManiaplanetSystem extends Quad { class Quad_ManiaplanetSystem extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'ManiaplanetSystem'; const STYLE = 'ManiaplanetSystem';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_MedalsBig extends Quad { class Quad_MedalsBig extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'MedalsBig'; const STYLE = 'MedalsBig';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_TitleLogos extends Quad { class Quad_TitleLogos extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'TitleLogos'; const STYLE = 'TitleLogos';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_UIConstruction_Buttons extends Quad { class Quad_UIConstruction_Buttons extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'UIConstruction_Buttons'; const STYLE = 'UIConstruction_Buttons';

View File

@ -10,7 +10,7 @@ use FML\Controls\Quad;
* @author steeffeen * @author steeffeen
*/ */
class Quad_UiSMSpectatorScoreBig extends Quad { class Quad_UiSMSpectatorScoreBig extends Quad {
/** /*
* Constants * Constants
*/ */
const STYLE = 'UiSMSpectatorScoreBig'; const STYLE = 'UiSMSpectatorScoreBig';

View File

@ -12,7 +12,7 @@ use FML\Types\Scriptable;
* @author steeffeen * @author steeffeen
*/ */
class Video extends Control implements Playable, Scriptable { class Video extends Control implements Playable, Scriptable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $data = ''; protected $data = '';

View File

@ -8,7 +8,7 @@ namespace FML;
* @author steeffeen * @author steeffeen
*/ */
class CustomUI { class CustomUI {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $encoding = 'utf-8'; protected $encoding = 'utf-8';

View File

@ -148,7 +148,7 @@ class Dico {
*/ */
const LANG_CHINESE = 'zh'; const LANG_CHINESE = 'zh';
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'dico'; protected $tagName = 'dico';

View File

@ -13,7 +13,7 @@ use FML\Types\TextFormatable;
* @author steeffeen * @author steeffeen
*/ */
class Format implements BgColorable, Renderable, Styleable, TextFormatable { class Format implements BgColorable, Renderable, Styleable, TextFormatable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'format'; protected $tagName = 'format';

View File

@ -12,7 +12,7 @@ use FML\Types\Renderable;
* @author steeffeen * @author steeffeen
*/ */
class FrameModel implements Container, Renderable { class FrameModel implements Container, Renderable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'framemodel'; protected $tagName = 'framemodel';

View File

@ -10,7 +10,7 @@ use FML\Types\Renderable;
* @author steeffeen * @author steeffeen
*/ */
class Including implements Renderable { class Including implements Renderable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'include'; protected $tagName = 'include';

View File

@ -10,7 +10,7 @@ use FML\Types\Renderable;
* @author steeffeen * @author steeffeen
*/ */
class Music implements Renderable { class Music implements Renderable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'music'; protected $tagName = 'music';

View File

@ -10,7 +10,7 @@ use FML\Types\Renderable;
* @author steeffeen * @author steeffeen
*/ */
class SimpleScript implements Renderable { class SimpleScript implements Renderable {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'script'; protected $tagName = 'script';

View File

@ -25,7 +25,7 @@ use FML\ManiaCode\ViewReplay;
* @author steeffeen * @author steeffeen
*/ */
class ManiaCode { class ManiaCode {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $encoding = 'utf-8'; protected $encoding = 'utf-8';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class AddBuddy implements Element { class AddBuddy implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'add_buddy'; protected $tagName = 'add_buddy';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class AddFavorite implements Element { class AddFavorite implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'add_favourite'; protected $tagName = 'add_favourite';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class GetSkin implements Element { class GetSkin implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'get_skin'; protected $tagName = 'get_skin';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class Go_To implements Element { class Go_To implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'goto'; protected $tagName = 'goto';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class InstallMap implements Element { class InstallMap implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'install_map'; protected $tagName = 'install_map';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class InstallPack implements Element { class InstallPack implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'install_pack'; protected $tagName = 'install_pack';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class InstallReplay implements Element { class InstallReplay implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'install_replay'; protected $tagName = 'install_replay';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class InstallScript implements Element { class InstallScript implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'install_script'; protected $tagName = 'install_script';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class InstallSkin implements Element { class InstallSkin implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'install_skin'; protected $tagName = 'install_skin';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class JoinServer implements Element { class JoinServer implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'join_server'; protected $tagName = 'join_server';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class PlayMap implements Element { class PlayMap implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'play_map'; protected $tagName = 'play_map';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class PlayReplay implements Element { class PlayReplay implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'play_replay'; protected $tagName = 'play_replay';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class ShowMessage implements Element { class ShowMessage implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'show_message'; protected $tagName = 'show_message';

View File

@ -8,7 +8,7 @@ namespace FML\ManiaCode;
* @author steeffeen * @author steeffeen
*/ */
class ViewReplay implements Element { class ViewReplay implements Element {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'view_replay'; protected $tagName = 'view_replay';

View File

@ -2,10 +2,10 @@
namespace FML; namespace FML;
use FML\Types\Renderable;
use FML\Script\Script;
use FML\Elements\Dico; use FML\Elements\Dico;
use FML\Script\Script;
use FML\Stylesheet\Stylesheet; use FML\Stylesheet\Stylesheet;
use FML\Types\Renderable;
/** /**
* Class representing a ManiaLink * Class representing a ManiaLink
@ -13,7 +13,7 @@ use FML\Stylesheet\Stylesheet;
* @author steeffeen * @author steeffeen
*/ */
class ManiaLink { class ManiaLink {
/** /*
* Constants * Constants
*/ */
const BACKGROUND_0 = '0'; const BACKGROUND_0 = '0';
@ -21,7 +21,7 @@ class ManiaLink {
const BACKGROUND_STATIONS = 'stations'; const BACKGROUND_STATIONS = 'stations';
const BACKGROUND_TITLE = 'title'; const BACKGROUND_TITLE = 'title';
/** /*
* Protected Properties * Protected Properties
*/ */
protected $encoding = 'utf-8'; protected $encoding = 'utf-8';
@ -224,16 +224,17 @@ class ManiaLink {
if (!$isChild) { if (!$isChild) {
$domDocument->appendChild($maniaLink); $domDocument->appendChild($maniaLink);
} }
if ($this->id) { if (strlen($this->id) > 0) {
$maniaLink->setAttribute('id', $this->id); $maniaLink->setAttribute('id', $this->id);
} }
if ($this->version) { if ($this->version) {
$maniaLink->setAttribute('version', $this->version); $maniaLink->setAttribute('version', $this->version);
} }
if ($this->background) { if (strlen($this->background) > 0) {
$maniaLink->setAttribute('background', $this->background); $maniaLink->setAttribute('background', $this->background);
} }
if (!$this->navigable3d) { if ($this->navigable3d) {
// TODO: check default value
$maniaLink->setAttribute('navigable3d', $this->navigable3d); $maniaLink->setAttribute('navigable3d', $this->navigable3d);
} }
if ($this->timeout) { if ($this->timeout) {

View File

@ -8,7 +8,7 @@ namespace FML;
* @author steeffeen * @author steeffeen
*/ */
class ManiaLinks { class ManiaLinks {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $encoding = 'utf-8'; protected $encoding = 'utf-8';

View File

@ -8,7 +8,7 @@ namespace FML\Script;
* @author steeffeen * @author steeffeen
*/ */
abstract class EUISound { abstract class EUISound {
/** /*
* Constants * Constants
*/ */
const SOUND_Bonus = 'Bonus'; const SOUND_Bonus = 'Bonus';

View File

@ -5,6 +5,7 @@ namespace FML\Script;
use FML\Controls\Control; use FML\Controls\Control;
use FML\Controls\Label; use FML\Controls\Label;
use FML\Types\Scriptable; use FML\Types\Scriptable;
use FML\Types\Actionable;
/** /**
* Class representing the ManiaLink Script * Class representing the ManiaLink Script
@ -12,7 +13,7 @@ use FML\Types\Scriptable;
* @author steeffeen * @author steeffeen
*/ */
class Script { class Script {
/** /*
* Constants * Constants
*/ */
const CLASS_TOOLTIP = 'FML_Tooltip'; const CLASS_TOOLTIP = 'FML_Tooltip';
@ -26,6 +27,7 @@ class Script {
const CLASS_SOUND = 'FML_Sound'; const CLASS_SOUND = 'FML_Sound';
const CLASS_TOGGLE = 'FML_Toggle'; const CLASS_TOGGLE = 'FML_Toggle';
const CLASS_SPECTATE = 'FML_Spectate'; const CLASS_SPECTATE = 'FML_Spectate';
const CLASS_PAGEACTION = 'FML_PageAction';
const OPTION_TOOLTIP_STAYONCLICK = 'FML_StayOnClick_Tooltip'; const OPTION_TOOLTIP_STAYONCLICK = 'FML_StayOnClick_Tooltip';
const OPTION_TOOLTIP_INVERT = 'FML_Invert_Tooltip'; const OPTION_TOOLTIP_INVERT = 'FML_Invert_Tooltip';
const OPTION_TOOLTIP_TEXT = 'FML_Text_Tooltip'; const OPTION_TOOLTIP_TEXT = 'FML_Text_Tooltip';
@ -44,7 +46,7 @@ class Script {
const FUNCTION_SETTOOLTIPTEXT = 'FML_SetTooltipText'; const FUNCTION_SETTOOLTIPTEXT = 'FML_SetTooltipText';
const FUNCTION_TOGGLE = 'FML_Toggle'; const FUNCTION_TOGGLE = 'FML_Toggle';
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'script'; protected $tagName = 'script';
@ -60,6 +62,7 @@ class Script {
protected $sounds = array(); protected $sounds = array();
protected $toggles = false; protected $toggles = false;
protected $spectate = false; protected $spectate = false;
protected $pageActions = false;
/** /**
* Create a new Script Object * Create a new Script Object
@ -357,6 +360,33 @@ class Script {
return $this; return $this;
} }
/**
* Trigger an Action on Control Click
*
* @param Control $actionControl The Control triggering the Action
* @param string $action (optional) The Action to trigger (if empty the Action of the Control will be triggered)
*/
public function addPageActionTrigger(Control $actionControl, $action = null) {
if (!($actionControl instanceof Scriptable)) {
trigger_error('Scriptable Control needed as ActionControl for PageActions!');
return $this;
}
$action = (string) $action;
if (strlen($action) <= 0) {
if (!($actionControl instanceof Actionable)) {
trigger_error('Either Action or Actionable Control needed for PageActions!');
return $this;
}
$action = $actionControl->getAction();
}
$actionControl->setScriptEvents(true);
$actionControl->setAction('');
$actionControl->addClass(self::CLASS_PAGEACTION);
$actionControl->addClass(self::CLASS_PAGEACTION . '-' . $action);
$this->pageActions = true;
return $this;
}
/** /**
* Create the Script XML Tag * Create the Script XML Tag
* *
@ -644,10 +674,10 @@ if (Event.Control.HasClass(\"" . self::CLASS_PAGER . "\")) {
if (ClassParts[0] != \"" . self::CLASS_PAGER . "\") continue; if (ClassParts[0] != \"" . self::CLASS_PAGER . "\") continue;
switch (TextLib::SubText(ClassParts[1], 0, 1)) { switch (TextLib::SubText(ClassParts[1], 0, 1)) {
case \"I\": { case \"I\": {
PagesId = TextLib::SubText(ClassParts[1], 1, 99); PagesId = TextLib::SubText(ClassParts[1], 1, TextLib::Length(ClassParts[1]));
} }
case \"A\": { case \"A\": {
PagingAction = TextLib::ToInteger(TextLib::SubText(ClassParts[1], 1, 99)); PagingAction = TextLib::ToInteger(TextLib::SubText(ClassParts[1], 1, TextLib::Length(ClassParts[1])));
} }
} }
} }
@ -661,7 +691,7 @@ if (Event.Control.HasClass(\"" . self::CLASS_PAGER . "\")) {
if (!PageControl.HasClass(\"" . self::CLASS_PAGE . "\")) continue; if (!PageControl.HasClass(\"" . self::CLASS_PAGE . "\")) continue;
foreach (ControlClass in PageControl.ControlClasses) { foreach (ControlClass in PageControl.ControlClasses) {
if (TextLib::SubText(ControlClass, 0, {$pagesNumberPrefixLength}) != \"{$pagesNumberPrefix}\") continue; if (TextLib::SubText(ControlClass, 0, {$pagesNumberPrefixLength}) != \"{$pagesNumberPrefix}\") continue;
declare PageNumber = TextLib::ToInteger(TextLib::SubText(ControlClass, {$pagesNumberPrefixLength}, 99)); declare PageNumber = TextLib::ToInteger(TextLib::SubText(ControlClass, {$pagesNumberPrefixLength}, TextLib::Length(ControlClass)));
if (!FML_MinPageNumber.existskey(PagesId) || PageNumber < FML_MinPageNumber[PagesId]) { if (!FML_MinPageNumber.existskey(PagesId) || PageNumber < FML_MinPageNumber[PagesId]) {
FML_MinPageNumber[PagesId] = PageNumber; FML_MinPageNumber[PagesId] = PageNumber;
} }
@ -687,7 +717,7 @@ if (Event.Control.HasClass(\"" . self::CLASS_PAGER . "\")) {
declare PageNumber = -1; declare PageNumber = -1;
foreach (ControlClass in PageControl.ControlClasses) { foreach (ControlClass in PageControl.ControlClasses) {
if (TextLib::SubText(ControlClass, 0, {$pagesNumberPrefixLength}) != \"{$pagesNumberPrefix}\") continue; if (TextLib::SubText(ControlClass, 0, {$pagesNumberPrefixLength}) != \"{$pagesNumberPrefix}\") continue;
PageNumber = TextLib::ToInteger(TextLib::SubText(ControlClass, {$pagesNumberPrefixLength}, 99)); PageNumber = TextLib::ToInteger(TextLib::SubText(ControlClass, {$pagesNumberPrefixLength}, TextLib::Length(ControlClass)));
break; break;
} }
PageControl.Visible = (PageNumber == FML_PageNumber[PagesId]); PageControl.Visible = (PageNumber == FML_PageNumber[PagesId]);
@ -841,6 +871,33 @@ if (Event.Control.HasClass(\"" . self::CLASS_SPECTATE . "\")) {
return $spectateScript; return $spectateScript;
} }
/**
* Get the Page Actions Labels
*
* @return string
*/
private function getPageActionLabels() {
if (!$this->pageActions) return '';
$this->setInclude('TextLib', 'TextLib');
$prefixLength = strlen(self::CLASS_PAGEACTION) + 1;
$pageActionScript = "
if (Event.Control.HasClass(\"" . self::CLASS_PAGEACTION . "\")) {
declare Action = \"\";
foreach (ControlClass in Event.Control.ControlClasses) {
declare ClassParts = TextLib::Split(\"-\", ControlClass);
if (ClassParts.count < 2) continue;
if (ClassParts[0] != \"" . self::CLASS_PAGEACTION . "\") continue;
Action = TextLib::SubText(ControlClass, {$prefixLength}, TextLib::Length(ControlClass));
break;
}
if (Action != \"\") {
TriggerPageAction(Action);
}
}";
$pageActionScript = Builder::getLabelImplementationBlock(self::LABEL_MOUSECLICK, $pageActionScript);
return $pageActionScript;
}
/** /**
* Get the Main Function * Get the Main Function
* *

View File

@ -11,7 +11,7 @@ namespace FML\Stylesheet;
* @author steeffeen * @author steeffeen
*/ */
class Mood { class Mood {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'mood'; protected $tagName = 'mood';

View File

@ -8,7 +8,7 @@ namespace FML\Stylesheet;
* @author steeffeen * @author steeffeen
*/ */
class Style3d { class Style3d {
/** /*
* Constants * Constants
*/ */
const MODEL_Box = 'Box'; const MODEL_Box = 'Box';
@ -17,7 +17,7 @@ class Style3d {
const MODEL_Title = 'Title'; const MODEL_Title = 'Title';
const MODEL_Window = 'Window'; const MODEL_Window = 'Window';
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'style3d'; protected $tagName = 'style3d';

View File

@ -8,7 +8,7 @@ namespace FML\Stylesheet;
* @author steeffeen * @author steeffeen
*/ */
class Stylesheet { class Stylesheet {
/** /*
* Protected Properties * Protected Properties
*/ */
protected $tagName = 'stylesheet'; protected $tagName = 'stylesheet';

View File

@ -8,9 +8,23 @@ namespace FML\Types;
* @author steeffeen * @author steeffeen
*/ */
interface Actionable { interface Actionable {
/** /*
* Constants * Constants
*/ */
const ACTION_0 = '0';
const ACTION_BACK = 'back';
const ACTION_ENTER = 'enter';
const ACTION_HOME = 'home';
const ACTION_MENU_SOLO = 'menu_solo';
const ACTION_MENU_COMPETITIONS = 'menu_competitions';
const ACTION_MENU_LOCAL = 'menu_local';
const ACTION_MENU_INTERNET = 'menu_internet';
const ACTION_MENU_EDITORS = 'menu_editors';
const ACTION_MENU_PROFILE = 'menu_profile';
const ACTION_QUIT = 'quit';
const ACTION_QUITSERVER = 'maniaplanet:quitserver';
const ACTION_SAVEREPLAY = 'maniaplanet:savereplay';
const ACTION_TOGGLESPEC = 'maniaplanet:togglespec';
const ACTIONKEY_F5 = 1; const ACTIONKEY_F5 = 1;
const ACTIONKEY_F6 = 2; const ACTIONKEY_F6 = 2;
const ACTIONKEY_F7 = 3; const ACTIONKEY_F7 = 3;
@ -20,13 +34,22 @@ interface Actionable {
* Set Action * Set Action
* *
* @param string $action Action Name * @param string $action Action Name
* @return \FML\Types\Actionable
*/ */
public function setAction($action); public function setAction($action);
/**
* Get the assigned Action
*
* @return string
*/
public function getAction();
/** /**
* Set Action Key * Set Action Key
* *
* @param int $actionKey Action Key Number * @param int $actionKey Action Key Number
* @return \FML\Types\Actionable
*/ */
public function setActionKey($actionKey); public function setActionKey($actionKey);
} }

View File

@ -13,6 +13,7 @@ interface BgColorable {
* Set Background Color * Set Background Color
* *
* @param string $bgColor Background Color * @param string $bgColor Background Color
* @return \FML\Types\BgColorable
*/ */
public function setBgColor($bgColor); public function setBgColor($bgColor);
} }

View File

@ -13,6 +13,7 @@ interface Linkable {
* Set Url * Set Url
* *
* @param string $url Link Url * @param string $url Link Url
* @return \FML\Types\Linkable
*/ */
public function setUrl($url); public function setUrl($url);
@ -20,6 +21,7 @@ interface Linkable {
* Set Url Id to use from the Dico * Set Url Id to use from the Dico
* *
* @param string $urlId * @param string $urlId
* @return \FML\Types\Linkable
*/ */
public function setUrlId($urlId); public function setUrlId($urlId);
@ -27,6 +29,7 @@ interface Linkable {
* Set Manialink * Set Manialink
* *
* @param string $manialink Manialink Name * @param string $manialink Manialink Name
* @return \FML\Types\Linkable
*/ */
public function setManialink($manialink); public function setManialink($manialink);
@ -34,6 +37,7 @@ interface Linkable {
* Set Manialink Id to use from the Dico * Set Manialink Id to use from the Dico
* *
* @param string $manialinkId Manialink Id * @param string $manialinkId Manialink Id
* @return \FML\Types\Linkable
*/ */
public function setManialinkId($manialinkId); public function setManialinkId($manialinkId);
} }

View File

@ -13,6 +13,7 @@ interface NewLineable {
* Set Auto New Line * Set Auto New Line
* *
* @param bool $autoNewLine Whether the Control should insert New Lines automatically * @param bool $autoNewLine Whether the Control should insert New Lines automatically
* @return \FML\Types\NewLineable
*/ */
public function setAutoNewLine($autoNewLine); public function setAutoNewLine($autoNewLine);
} }

View File

@ -13,6 +13,7 @@ interface Playable {
* Set Data * Set Data
* *
* @param string $data Media Url * @param string $data Media Url
* @return \FML\Types\Playable
*/ */
public function setData($data); public function setData($data);
@ -20,6 +21,7 @@ interface Playable {
* Set Data Id to use from the Dico * Set Data Id to use from the Dico
* *
* @param string $dataId * @param string $dataId
* @return \FML\Types\Playable
*/ */
public function setDataId($dataId); public function setDataId($dataId);
@ -27,6 +29,7 @@ interface Playable {
* Set Play * Set Play
* *
* @param bool $play Whether the Control should start playing automatically * @param bool $play Whether the Control should start playing automatically
* @return \FML\Types\Playable
*/ */
public function setPlay($play); public function setPlay($play);
@ -34,6 +37,7 @@ interface Playable {
* Set Looping * Set Looping
* *
* @param bool $looping Whether the Control should play looping * @param bool $looping Whether the Control should play looping
* @return \FML\Types\Playable
*/ */
public function setLooping($looping); public function setLooping($looping);
@ -41,6 +45,7 @@ interface Playable {
* Set Music * Set Music
* *
* @param bool $music Whether the Control represents Background Music * @param bool $music Whether the Control represents Background Music
* @return \FML\Types\Playable
*/ */
public function setMusic($music); public function setMusic($music);
@ -48,6 +53,7 @@ interface Playable {
* Set Volume * Set Volume
* *
* @param float $volume Media Volume * @param float $volume Media Volume
* @return \FML\Types\Playable
*/ */
public function setVolume($volume); public function setVolume($volume);
} }

View File

@ -13,6 +13,7 @@ interface Scriptable {
* Set ScriptEvents * Set ScriptEvents
* *
* @param bool $scriptEvents Whether Script Events should be enabled * @param bool $scriptEvents Whether Script Events should be enabled
* @return \FML\Types\Scriptable
*/ */
public function setScriptEvents($scriptEvents); public function setScriptEvents($scriptEvents);
} }

View File

@ -13,6 +13,7 @@ interface Styleable {
* Set Style * Set Style
* *
* @param string $style Style Name * @param string $style Style Name
* @return \FML\Types\Styleable
*/ */
public function setStyle($style); public function setStyle($style);
} }

View File

@ -13,6 +13,7 @@ interface SubStyleable {
* Set SubStyle * Set SubStyle
* *
* @param string $subStyle SubStyle Name * @param string $subStyle SubStyle Name
* @return \FML\Types\SubStyleable
*/ */
public function setSubStyle($subStyle); public function setSubStyle($subStyle);
@ -21,6 +22,7 @@ interface SubStyleable {
* *
* @param string $style Style Name * @param string $style Style Name
* @param string $subStyle SubStyle Name * @param string $subStyle SubStyle Name
* @return \FML\Types\SubStyleable
*/ */
public function setStyles($style, $subStyle); public function setStyles($style, $subStyle);
} }

View File

@ -13,6 +13,7 @@ interface TextFormatable {
* Set Text Size * Set Text Size
* *
* @param int $textSize Text Size * @param int $textSize Text Size
* @return \FML\Types\TextFormatable
*/ */
public function setTextSize($textSize); public function setTextSize($textSize);
@ -20,6 +21,7 @@ interface TextFormatable {
* Set Text Color * Set Text Color
* *
* @param string $textColor Text Color * @param string $textColor Text Color
* @return \FML\Types\TextFormatable
*/ */
public function setTextColor($textColor); public function setTextColor($textColor);
@ -27,6 +29,7 @@ interface TextFormatable {
* Set Area Color * Set Area Color
* *
* @param string $areaColor Area Color * @param string $areaColor Area Color
* @return \FML\Types\TextFormatable
*/ */
public function setAreaColor($areaColor); public function setAreaColor($areaColor);
@ -34,6 +37,7 @@ interface TextFormatable {
* Set Area Focus Color * Set Area Focus Color
* *
* @param string $areaFocusColor Area Focus Color * @param string $areaFocusColor Area Focus Color
* @return \FML\Types\TextFormatable
*/ */
public function setAreaFocusColor($areaFocusColor); public function setAreaFocusColor($areaFocusColor);
} }

View File

@ -13,7 +13,9 @@ if (!defined('FML_VERSION')) {
define('FML_VERSION', 1.0); define('FML_VERSION', 1.0);
} }
// Register Autoload Function that loads FML Class Files on Demand /*
* Autoload Function that loads FML Class Files on Demand
*/
spl_autoload_register( spl_autoload_register(
function ($className) { function ($className) {
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className); $classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className);