Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / frmBodyPartsPool.mxml
blob027e1690ba36c83569988b52d6754ad9fe3af05c
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="Body Parts (WIP)" width="90%">
6 <fx:Script>
7 <![CDATA[
8 import mx.collections.ArrayCollection;
9 import org.sevenchan.AdventureController;
10 import org.sevenchan.dongs.bodyparts.IBodyPart;
11 import org.sevenchan.dongs.creature.Player;
12 import spark.components.DataGroup;
13 import flash.utils.describeType;
15 public var player:Player = null;
16 public function init(ply:Player):void {
17 player = ply;
18 poolSelector.dataProvider = new ArrayCollection();
19 (poolSelector.dataProvider as ArrayCollection).addItem("arms");
20 (poolSelector.dataProvider as ArrayCollection).addItem("assholes");
21 (poolSelector.dataProvider as ArrayCollection).addItem("balls");
22 (poolSelector.dataProvider as ArrayCollection).addItem("breasts");
23 (poolSelector.dataProvider as ArrayCollection).addItem("dicks");
24 (poolSelector.dataProvider as ArrayCollection).addItem("eyes");
25 (poolSelector.dataProvider as ArrayCollection).addItem("legs");
26 (poolSelector.dataProvider as ArrayCollection).addItem("vaginas");
27 (poolSelector.dataProvider as ArrayCollection).addItem("wings");
30 private function poolChanged():void {
31 partList.dataProvider = new ArrayCollection();
32 partSelector.dataProvider = new ArrayCollection();
33 for each (var part:IBodyPart in player[poolSelector.selectedItem]) {
34 (partList.dataProvider as ArrayCollection).addItem(part.name);
36 for each(var name:XML in describeType(BodyPartRegistry)..accessor.@name) {
37 var partname:String = name.toString();
38 var bp:* = BodyPartRegistry[partname];
39 if(bp is IBodyPart) {
40 if(bp.category==poolSelector.selectedItem) {
41 (partSelector.dataProvider as ArrayCollection).addItem(partname);
47 private function addPart():void {
48 var pool:String = poolSelector.selectedItem;
49 trace(pool, partSelector.selectedItem);
50 var part:* = BodyPartRegistry[partSelector.selectedItem];
51 if(part is IBodyPart) {
52 trace(part);
53 (player[pool] as Vector.<*>).push(part);
55 poolChanged();
57 private function removePart():void {
58 var pool:String = poolSelector.selectedItem;
59 var idx:int = partList.selectedIndex;
60 (player[pool] as Vector.<*>).splice(idx, 1);
61 poolChanged();
63 private function lolclose():void {
64 player.main.showBodyPartSelector(false);
66 ]]>
67 </fx:Script>
68 <s:VGroup width="90%">
69 <s:HGroup width="90%">
70 <s:DropDownList prompt="Collection" id="poolSelector" change="poolChanged()" width="90%">
71 </s:DropDownList>
72 </s:HGroup>
73 <s:List id="partList" width="90%"></s:List>
74 <s:DropDownList id="partSelector" width="90%"></s:DropDownList>
75 <s:HGroup width="90%">
76 <s:Button id="add" label="Add" click="addPart()" width="50%" />
77 <s:Button id="remove" label="Remove" click="removePart()" width="50%" />
78 </s:HGroup>
79 <s:Button label="Close" click="lolclose()" width="90%"></s:Button>
80 </s:VGroup>
81 </s:Panel>