Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
package net.pixvi.myr.panel.egg
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.myr.GameSetting;
|
||||
import net.pixvi.myr.center.GuideCenter;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.element.guide.GMain;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.myr.panel.stackground.StackGroundPanel;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.driver.GuideDriver;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class EggSelectPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public static var selectedComplete:Boolean = true;
|
||||
|
||||
public static var selectedEgg:EggVo;
|
||||
|
||||
public static var selectedEggs:Array;
|
||||
|
||||
public static var selectMode:String;
|
||||
|
||||
public var ui:EggSelectPanelUI = new EggSelectPanelUI();
|
||||
|
||||
private var cacheY:Number = 0;
|
||||
|
||||
public function EggSelectPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(GameSetting.PanelTransTime,GameSetting.PanelTransTime);
|
||||
selectedEgg = null;
|
||||
selectedComplete = false;
|
||||
ui.btn_close.onClick(closeBtnHandler);
|
||||
ui.btn_yes.onClick(yesHandler);
|
||||
ui.switch_sort.addEventListener("piselect",updateSort);
|
||||
ui.btn_sortDirect.onClick(switchSortDirect);
|
||||
}
|
||||
|
||||
public static function getIns() : EggSelectPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(EggSelectPanel) as EggSelectPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
selectedEgg = null;
|
||||
selectedComplete = false;
|
||||
guide();
|
||||
ImgCenter.addFsMask(this);
|
||||
GlobalBroadcast.addEventListener("androidBack",AndroidBackHandler);
|
||||
if(cacheY > 0)
|
||||
{
|
||||
ui.list_egg.process_value = cacheY;
|
||||
}
|
||||
}
|
||||
|
||||
private function AndroidBackHandler(e:Event = null) : void
|
||||
{
|
||||
if(PopCenter.getIns().topPanel == this)
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateSort(e:Event = null) : void
|
||||
{
|
||||
var sortA:uint = 18;
|
||||
if(ui.btn_sortDirect.selected)
|
||||
{
|
||||
sortA = 16;
|
||||
}
|
||||
ui.list_egg.itemDatas.sortOn(ui.switch_sort.value,sortA);
|
||||
ui.list_egg.setDatas(ui.list_egg.itemDatas);
|
||||
}
|
||||
|
||||
public function switchSortDirect(e:Event = null) : void
|
||||
{
|
||||
ui.btn_sortDirect.switchSelectStatus();
|
||||
updateSort();
|
||||
}
|
||||
|
||||
public function guide() : void
|
||||
{
|
||||
if(GuideCenter.getIns().checkCur(GMain.stackMon25))
|
||||
{
|
||||
GuideDriver.getIns().curGuideComplete();
|
||||
GuideCenter.getIns().fin("auto",false);
|
||||
GuideDriver.getIns().guideDisplay(ui.list_egg.items[0],"",true);
|
||||
}
|
||||
}
|
||||
|
||||
private function closeBtnHandler(e:Event = null) : void
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
if(ui.list_egg.curItemDatasSelected.length > 0)
|
||||
{
|
||||
selectedComplete = true;
|
||||
selectedEggs = ui.list_egg.curItemDatasSelected;
|
||||
selectedEgg = selectedEggs[0];
|
||||
}
|
||||
closeHandler();
|
||||
}
|
||||
|
||||
private function selectHandler(e:Event = null) : void
|
||||
{
|
||||
selectedEgg = ui.list_egg.curSelectedItemData as EggVo;
|
||||
selectedComplete = true;
|
||||
closeHandler();
|
||||
ui.list_egg.removeEventListener("piselect",selectHandler);
|
||||
StackGroundPanel.getIns().guide();
|
||||
if(ui.list_egg.multiSelectedMax > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeSingle() : void
|
||||
{
|
||||
selectMode = "single";
|
||||
ui.modeSingle();
|
||||
ui.list_egg.multiSelectedMax = 1;
|
||||
ui.list_egg.setDatas(Master.bag.getEggArr());
|
||||
ui.list_egg.addEventListener("piselect",selectHandler);
|
||||
if(ui.switch_sort.value != null)
|
||||
{
|
||||
updateSort();
|
||||
}
|
||||
if(ui.mc_empty != null)
|
||||
{
|
||||
if(ui.list_egg.itemDatasLength <= 0)
|
||||
{
|
||||
ui.mc_empty.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_empty.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function modeMuilty(num:int) : void
|
||||
{
|
||||
ui.modeMuilty();
|
||||
selectMode = "multy";
|
||||
ui.list_egg.multiSelectedMax = num;
|
||||
ui.list_egg.setDatas(Master.bag.getEggArr());
|
||||
ui.list_egg.addEventListener("piselect",selectHandler);
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
cacheY = ui.list_egg.process_value;
|
||||
GlobalBroadcast.removeEventListener("androidBack",AndroidBackHandler);
|
||||
this.showOut();
|
||||
dispatchEvent(new Event("complete"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package net.pixvi.myr.panel.egg
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.bag.EggSelectSliderListItem;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiSliderList;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
import net.pixvi.psg.ui.controller.PiLightSwitch;
|
||||
|
||||
public class EggSelectPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var list_egg:PiSliderList;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var mc_kxcw:Sprite;
|
||||
|
||||
public var text_num:TextField;
|
||||
|
||||
public var switch_sort:PiLightSwitch;
|
||||
|
||||
public var btn_sortDirect:PiLightButton;
|
||||
|
||||
public var mc_empty:Sprite;
|
||||
|
||||
public function EggSelectPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.EggSelectPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
switch_sort.setValues("star","timeTotal","q1","q2","q3","q4","q5");
|
||||
list_egg.setList(EggSelectSliderListItem,16,false,165,4,146);
|
||||
list_egg.multiSelectedMax = 1;
|
||||
if(mc_empty != null)
|
||||
{
|
||||
mc_empty.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeSingle() : void
|
||||
{
|
||||
mc_kxcw.visible = text_num.visible = btn_yes.visible = false;
|
||||
}
|
||||
|
||||
public function modeMuilty() : void
|
||||
{
|
||||
mc_kxcw.visible = text_num.visible = btn_yes.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package net.pixvi.myr.panel.egg
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.element.mon.EggVo;
|
||||
import net.pixvi.myr.panel.bag.BagPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiSliderListItem;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EggSliderListItem extends PiSliderListItem
|
||||
{
|
||||
|
||||
public var container_bg:PiImgContainer;
|
||||
|
||||
public var container_egg:PiImgContainer;
|
||||
|
||||
public var container_star:PiImgContainer;
|
||||
|
||||
public var container_element:PiImgContainer;
|
||||
|
||||
public var text_time:TextField;
|
||||
|
||||
public var text_num:PiBitTextField;
|
||||
|
||||
public function EggSliderListItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.EggSliderListItemUI");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
container_egg.setSize(125,125);
|
||||
container_bg.setSize(125,129);
|
||||
container_star.setSize(110,34);
|
||||
container_element.setSize(48,50);
|
||||
container_element.setScale(0.8);
|
||||
container_egg.mouseChildren = container_egg.mouseEnabled = false;
|
||||
container_element.mouseChildren = container_egg.mouseEnabled = false;
|
||||
container_star.mouseChildren = container_egg.mouseEnabled = false;
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
var egg:EggVo = value as EggVo;
|
||||
container_bg.loadNetBitImg(ImgCenter.getItemBgImg(egg));
|
||||
container_egg.loadNetBitImg(egg.imgsrc,true);
|
||||
container_star.loadNetBitImg(ImgCenter.getStarImg(egg.star));
|
||||
container_element.loadNetBitImg(ImgCenter.getMonElement(egg.element),true,true,0);
|
||||
text_time.text = Paster.secondFormat(egg.timeTotal);
|
||||
text_num.text = egg.num.toString();
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
TipCenter.registTextTip(this,egg.name,10);
|
||||
if(egg.feedLock)
|
||||
{
|
||||
container_egg.alpha = 0.4;
|
||||
text_time.text = lang("LOCK");
|
||||
}
|
||||
else
|
||||
{
|
||||
container_egg.alpha = 1;
|
||||
text_time.text = Paster.secondFormat((data as EggVo).timeTotal);
|
||||
}
|
||||
container_bg.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
if(BagPanel.getIns().ui.mc_eggTip != null)
|
||||
{
|
||||
(data as EggVo).feedLock = !(data as EggVo).feedLock;
|
||||
if((data as EggVo).feedLock)
|
||||
{
|
||||
text_time.text = lang("LOCK");
|
||||
container_egg.alpha = 0.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_time.text = Paster.secondFormat((data as EggVo).timeTotal);
|
||||
container_egg.alpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
TipCenter.remove(this);
|
||||
container_bg.removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
this.removeEventListener(MobiEvent.CLICK,sendSelect);
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user