Adding frmCreatureViewer MXML file
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / frmCreatureViewer.mxml
blobdae444d263996c896bea9fc3d6f6de3a306ed3cc
1 <?xml version="1.0" encoding="utf-8"?>
2 <s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
3 xmlns:s="library://ns.adobe.com/flex/spark"
4 xmlns:mx="library://ns.adobe.com/flex/halo"
5 title="Creature Viewer (WIP)" width="100%">
6 <fx:Script>
7 <![CDATA[
8 import flashx.textLayout.conversion.ConversionType;
9 import flashx.textLayout.conversion.TextConverter;
10 import mx.collections.ArrayCollection;
11 import org.sevenchan.AdventureController;
12 import org.sevenchan.dongs.bodyparts.IBodyPart;
13 import org.sevenchan.dongs.creature.Player;
14 import spark.components.DataGroup;
15 import flash.utils.describeType;
17 public var player:Player = null;
18 private var currentCreature:Creature = null;
19 public function init(ply:Player):void {
20 player = ply;
21 cmbCreature.dataProvider = new ArrayCollection();
22 for each(var creatureName:XML in describeType(CreatureRegistry)..accessor.@name) {
23 (cmbCreature.dataProvider as ArrayCollection).addItem(creatureName.toXMLString());
25 var dat:XML = describeType(CreatureRegistry);
26 trace("[frmCreatureViewer]",dat);
27 txtDescr.text = dat;
30 private function creatureChanged():void {
31 currentCreature = CreatureRegistry[(String(cmbCreature.selectedItem))]
32 currentCreature.initialGenderSetup();
33 txtDescr.text = currentCreature.getDescription();
34 txtDescr.text += "<ul>";
35 txtDescr.text += "<li><b>_strength:</b> " + currentCreature._strength + "</li>";
36 txtDescr.text += "<li><b>_speed:</b> " + currentCreature._speed + "</li>";
37 txtDescr.text += "<li><b>_intellect:</b> " + currentCreature._intellect + "</li>";
38 txtDescr.text += "<li><b>_lust:</b> " + currentCreature._lust + "</li>";
39 txtDescr.text += "<li><b>_sensitivity:</b> " + currentCreature._sensitivity + "</li>";
40 txtDescr.text += "<li><b>_HP:</b> " + currentCreature._HP + "</li>";
41 txtDescr.text += "<li><b>_XP:</b> " + currentCreature._XP + "</li>";
42 txtDescr.text += "<li><b>_mana:</b> " + currentCreature._mana + "</li>";
43 txtDescr.text += "<li><b>_gold:</b> " + currentCreature._gold + "</li>";
44 txtDescr.text += "</ul>";
45 txtDescr.textFlow=TextConverter.importToFlow(txtDescr.text, TextConverter.TEXT_FIELD_HTML_FORMAT);
48 private function onFight():void {
49 lolclose();
50 player.main.startCombat(null,currentCreature);
52 private function onTransform():void {
53 lolclose();
54 player.changeTo(currentCreature);
56 private function lolclose():void {
57 player.main.showCreatureViewer(false);
60 private function append(message:String):void {
61 var oldText:String = TextConverter.export(txtDescr.textFlow, TextConverter.TEXT_FIELD_HTML_FORMAT, ConversionType.STRING_TYPE) as String;
62 txtDescr.textFlow = TextConverter.importToFlow(oldText + message, TextConverter.TEXT_FIELD_HTML_FORMAT);
64 ]]>
65 </fx:Script>
66 <s:VGroup width="100%">
67 <s:DropDownList prompt="Creature" id="cmbCreature" change="creatureChanged()" width="100%">
68 </s:DropDownList>
69 <s:TextArea id="txtDescr" width="100%" height="50%">Select a creature</s:TextArea>
70 <s:HGroup width="100%">
71 <s:Button id="cmdFight" label="Fight" click="onFight()" width="50%" />
72 <s:Button id="cmdTransform" label="Change Into" click="onTransform()" width="50%" />
73 </s:HGroup>
74 <s:Button label="Close" click="lolclose()" width="90%"></s:Button>
75 </s:VGroup>
76 </s:Panel>