added labelline
This commit is contained in:
		| @@ -2,6 +2,9 @@ | |||||||
|  |  | ||||||
| namespace ManiaControl\Manialinks; | namespace ManiaControl\Manialinks; | ||||||
|  |  | ||||||
|  | use FML\Controls\Control; | ||||||
|  | use FML\Controls\Frame; | ||||||
|  | use FML\Controls\Labels\Label_Text; | ||||||
| use FML\ManiaLink; | use FML\ManiaLink; | ||||||
| use ManiaControl\ManiaControl; | use ManiaControl\ManiaControl; | ||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
| @@ -188,5 +191,30 @@ class ManialinkManager implements CallbackListener { | |||||||
| 		//unset($this->playersMenuShown[$player->login]); | 		//unset($this->playersMenuShown[$player->login]); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Adds a line of labels | ||||||
|  | 	 * @param Frame $frame | ||||||
|  | 	 * @param array $labelStrings | ||||||
|  | 	 * @param array $properties | ||||||
|  | 	 */ | ||||||
|  | 	public function labelLine(Frame $frame, array $labelStrings, array $properties = array()){ | ||||||
|  | 		//TODO overwrite standard properties with properties from array | ||||||
| 		 | 		 | ||||||
|  | 		//define standard properties | ||||||
|  | 		$hAlign = Control::LEFT; | ||||||
|  | 		$style = Label_Text::STYLE_TextCardSmall; | ||||||
|  | 		$textSize = 1.5; | ||||||
|  | 		$textColor = 'FFF'; | ||||||
|  |  | ||||||
|  | 		foreach($labelStrings as $text => $x){ | ||||||
|  | 			$label = new Label_Text(); | ||||||
|  | 			$frame->add($label); | ||||||
|  | 			$label->setHAlign($hAlign); | ||||||
|  | 			$label->setX($x); | ||||||
|  | 			$label->setStyle($style); | ||||||
|  | 			$label->setTextSize($textSize); | ||||||
|  | 			$label->setText($text); | ||||||
|  | 			$label->setTextColor($textColor); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -141,7 +141,16 @@ class MapList implements ManialinkPageAnswerListener { | |||||||
| 		$frame = $this->buildMainFrame(); | 		$frame = $this->buildMainFrame(); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		//TODO headline |  | ||||||
|  | 		//Headline | ||||||
|  | 		$headFrame = new Frame(); | ||||||
|  | 		$frame->add($headFrame); | ||||||
|  | 		$headFrame->setY($this->height / 2 - 3); | ||||||
|  | 		$x = -$this->width / 2; | ||||||
|  | 		$array = array("Id" => $x + 5, "Mx ID" => $x + 10, "MapName" => $x + 20, "Author" => $x + 70); | ||||||
|  | 		$this->maniaControl->manialinkManager->labelLine($headFrame,$array); | ||||||
|  |  | ||||||
|  | 		//Get Maplist | ||||||
| 		$mapList = $this->maniaControl->mapManager->getMapList(); | 		$mapList = $this->maniaControl->mapManager->getMapList(); | ||||||
|  |  | ||||||
| 		$id = 1; | 		$id = 1; | ||||||
| @@ -160,11 +169,22 @@ class MapList implements ManialinkPageAnswerListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	private function displayMap($id, Map $map, Frame $frame){ | 	private function displayMap($id, Map $map, Frame $frame){ | ||||||
|  |  | ||||||
| 		$frame->setZ(-0.01); | 		$frame->setZ(-0.01); | ||||||
|  |  | ||||||
|  | 		//set starting x-value | ||||||
| 		$x = -$this->width / 2; | 		$x = -$this->width / 2; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 		$mxId = ''; | ||||||
|  | 		if(isset($map->mx->id)) | ||||||
|  | 			$mxId = $map->mx->id; | ||||||
|  |  | ||||||
|  | 		//Display Maps | ||||||
|  | 		$array = array($id => $x + 5, $mxId => $x + 10, $map->name => $x + 20, $map->authorNick => $x + 70); | ||||||
|  | 		$this->maniaControl->manialinkManager->labelLine($frame,$array); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* | ||||||
| 		//TODO detailed mx info page with link to mx | 		//TODO detailed mx info page with link to mx | ||||||
| 		$x +=5; | 		$x +=5; | ||||||
| 		$idLabel = new Label_Text(); | 		$idLabel = new Label_Text(); | ||||||
| @@ -218,7 +238,7 @@ class MapList implements ManialinkPageAnswerListener { | |||||||
|  |  | ||||||
| 		//TODO later add buttons for jukebox, admin control buttons (remove map, change to map) | 		//TODO later add buttons for jukebox, admin control buttons (remove map, change to map) | ||||||
| 		//TODO side switch | 		//TODO side switch | ||||||
| 		//var_dump($map); | 		//var_dump($map);*/ | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user