Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
package net.pixvi.myr.panel.equipexchange
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.ShopCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.cost.CostVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.panel.itemselect.ItemSelectPanel;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
import net.pixvi.myr.panel.story.StoryPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class EquipExchangePanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:EquipExchangePanelUI = new EquipExchangePanelUI();
|
||||
|
||||
public var exchangeId:String;
|
||||
|
||||
public var afterStory:String;
|
||||
|
||||
public function EquipExchangePanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
buffMode = false;
|
||||
}
|
||||
|
||||
public static function getIns() : EquipExchangePanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(EquipExchangePanel) as EquipExchangePanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
ui.btn_dazao.onClick(dazaoHandler);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.ui_after.mouseChildren = ui.ui_after.mouseEnabled = false;
|
||||
ui.btn_dazao.enabled = false;
|
||||
ui.btn_dazao.alpha = 0.5;
|
||||
ui.ui_before.alpha = 0.5;
|
||||
ui.ui_before.addEventListener(MobiEvent.CLICK,selectHandler);
|
||||
}
|
||||
|
||||
public function selectHandler(e:Event = null) : void
|
||||
{
|
||||
var arr:Array = [];
|
||||
for each(var itemvo:ItemVo in Master.bag.items)
|
||||
{
|
||||
if(Table.dazao_info[itemvo.type] != null)
|
||||
{
|
||||
arr.push(itemvo);
|
||||
}
|
||||
}
|
||||
ItemSelectPanel.getIns().modeArray(arr);
|
||||
ItemSelectPanel.getIns().addEventListener("complete",selectCompleteHandler);
|
||||
ItemSelectPanel.getIns().popIn();
|
||||
}
|
||||
|
||||
public function selectCompleteHandler(e:Event = null) : void
|
||||
{
|
||||
var target:ItemVo = null;
|
||||
var dazaoData:Object = null;
|
||||
var equipVo:EquipVo = null;
|
||||
var cost:CostVo = null;
|
||||
var exchange:Object = null;
|
||||
var rws:Array = null;
|
||||
if(ItemSelectPanel.selectedComplete)
|
||||
{
|
||||
target = ItemSelectPanel.selectItem;
|
||||
dazaoData = Table.dazao_info[target.type];
|
||||
ui.ui_before.onItem(target);
|
||||
equipVo = new EquipVo();
|
||||
equipVo.type = int(dazaoData.rewardType);
|
||||
equipVo.buildAuto(0);
|
||||
ui.ui_after.onItem(equipVo);
|
||||
ui.ui_after.visible = true;
|
||||
cost = new CostVo();
|
||||
exchange = Table.exchange_info[dazaoData.exchangeId];
|
||||
exchangeId = dazaoData.exchangeId;
|
||||
afterStory = dazaoData.afterStory;
|
||||
cost.setByVo(exchange.need);
|
||||
if(BagCenter.getIns().checkCost(cost))
|
||||
{
|
||||
ui.btn_dazao.enabled = true;
|
||||
ui.btn_dazao.alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.btn_dazao.enabled = false;
|
||||
ui.btn_dazao.alpha = 0.5;
|
||||
}
|
||||
ui.ui_before.alpha = 1;
|
||||
ui.mc_put.visible = false;
|
||||
rws = cost.getShowArray(false,false,false,target.type.toString());
|
||||
ui.list_need.setDatas(rws);
|
||||
}
|
||||
}
|
||||
|
||||
public function dazaoHandler(e:Event = null) : void
|
||||
{
|
||||
ShopCenter.getIns().exchangeItem(exchangeId,1,dazaoOverHandler);
|
||||
}
|
||||
|
||||
public function dazaoOverHandler(reward:RewardResultVo) : void
|
||||
{
|
||||
RewardShowPanel.showByVo(reward,afterStoryHandler);
|
||||
exchangeId = null;
|
||||
ui.ui_after.resetAll();
|
||||
ui.ui_before.resetAll();
|
||||
ui.list_need.reset();
|
||||
ui.btn_dazao.enabled = false;
|
||||
ui.btn_dazao.alpha = 0.5;
|
||||
ui.ui_before.alpha = 0.5;
|
||||
ui.mc_put.visible = true;
|
||||
}
|
||||
|
||||
private function afterStoryHandler() : void
|
||||
{
|
||||
if(afterStory != null)
|
||||
{
|
||||
StoryPanel.getIns().start(afterStory);
|
||||
afterStory = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOutAndRemove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.pixvi.myr.panel.equipexchange
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.build.CostShowMiddleItem;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiDataList;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EquipExchangePanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_before:EquipSelectCardUI;
|
||||
|
||||
public var ui_after:EquipSelectCardUI;
|
||||
|
||||
public var btn_dazao:PiLightButton;
|
||||
|
||||
public var list_need:PiDataList;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var mc_put:MovieClip;
|
||||
|
||||
public function EquipExchangePanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.EquipExchangePanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
list_need.itemClass = CostShowMiddleItem;
|
||||
mc_put.mouseChildren = mc_put.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package net.pixvi.myr.panel.equipexchange
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.panel.task.ItemCardUI;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class EquipSelectCardUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_card:ItemCardUI;
|
||||
|
||||
public var text_para1:TextField;
|
||||
|
||||
public var text_para2:TextField;
|
||||
|
||||
public var text_para3:TextField;
|
||||
|
||||
public var text_para4:TextField;
|
||||
|
||||
public var text_name:TextField;
|
||||
|
||||
public function EquipSelectCardUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
ui_card.modeBig();
|
||||
ui_card.reset();
|
||||
}
|
||||
|
||||
public function resetAll() : void
|
||||
{
|
||||
ui_card.reset();
|
||||
text_name.text = "";
|
||||
text_para1.text = "";
|
||||
text_para2.text = "";
|
||||
text_para3.text = "";
|
||||
text_para4.text = "";
|
||||
}
|
||||
|
||||
public function onItem(vo:ItemVo) : void
|
||||
{
|
||||
var arr:Array = null;
|
||||
var i:int = 0;
|
||||
ui_card.onItemVo(vo);
|
||||
TipCenter.remove(ui_card);
|
||||
text_name.text = vo.name;
|
||||
if(vo is EquipVo)
|
||||
{
|
||||
arr = (vo as EquipVo).effectDes();
|
||||
}
|
||||
else
|
||||
{
|
||||
arr = [];
|
||||
}
|
||||
i = 1;
|
||||
while(i <= 4)
|
||||
{
|
||||
if(arr[i - 1] != null)
|
||||
{
|
||||
this["text_para" + i].htmlText = arr[i - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
this["text_para" + i].htmlText = "";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
ui_card.text_num.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user