Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.element.alchemy.MaterialType;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class AlchemyMaterialItemUI extends UIComponent
|
||||
{
|
||||
|
||||
public var itemType:int;
|
||||
|
||||
public var item:ItemVo;
|
||||
|
||||
public var container_bg:PiImgContainer;
|
||||
|
||||
public var container_item:PiImgContainer;
|
||||
|
||||
public function AlchemyMaterialItemUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
container_item.setSize(70,70);
|
||||
container_bg.setSize(70,70);
|
||||
container_item.mouseChildren = container_item.mouseEnabled = false;
|
||||
PiLightButton.btnTouchLight.setDisplay(container_bg);
|
||||
container_bg.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
reset();
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_click_mon);
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
onData(null);
|
||||
}
|
||||
|
||||
public function onData(value:ItemVo = null) : void
|
||||
{
|
||||
if(value == null)
|
||||
{
|
||||
TipCenter.remove(this);
|
||||
this.item = null;
|
||||
this.itemType = -1;
|
||||
container_item.reset();
|
||||
container_bg.loadNetBitImg(ImgCenter.getItemBgImgByRank(1));
|
||||
return;
|
||||
}
|
||||
this.itemType = value.type;
|
||||
this.item = value;
|
||||
var imgsrc:String = "";
|
||||
var name:String = "";
|
||||
var rank:int = 1;
|
||||
rank = value.quality;
|
||||
imgsrc = value.imgsrc;
|
||||
name = ItemVo.getName(value.type);
|
||||
var tiptail:Array = MaterialType.getMaterialsTip([item.type]);
|
||||
var tip:String = name + "<br/>" + Paster.font(tiptail.join("<br/>"),"#ca5000",18);
|
||||
TipCenter.registTextTip(this,tip,9);
|
||||
container_bg.loadNetBitImg(ImgCenter.getItemBgImgByRank(rank,"M"));
|
||||
container_item.loadNetBitImg(imgsrc,true,true,9);
|
||||
}
|
||||
|
||||
public function onType(type:int = -1) : void
|
||||
{
|
||||
this.itemType = type;
|
||||
if(type == -1)
|
||||
{
|
||||
TipCenter.remove(this);
|
||||
this.item = null;
|
||||
this.itemType = -1;
|
||||
container_item.reset();
|
||||
container_bg.loadNetBitImg(ImgCenter.getItemBgImgByRank(1));
|
||||
return;
|
||||
}
|
||||
var vo:ItemVo = new ItemVo();
|
||||
vo.num = 1;
|
||||
vo.type = type;
|
||||
onData(vo);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
TipCenter.remove(this);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.bag.ItemType;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class EquipMakerCompletePanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:EquipMakerCompleteUI = new EquipMakerCompleteUI();
|
||||
|
||||
public var equip:EquipVo;
|
||||
|
||||
public function EquipMakerCompletePanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
ui.btn_yes.onClick(yesHandler);
|
||||
}
|
||||
|
||||
public static function getIns() : EquipMakerCompletePanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(EquipMakerCompletePanel) as EquipMakerCompletePanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
PopCenter.getIns().setMaskAlpha();
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var effects:Array = equip.effectDes();
|
||||
for(i = 0; i < 4; )
|
||||
{
|
||||
if(effects[i] != null)
|
||||
{
|
||||
ui["text_para" + (i + 1)].htmlText = effects[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
ui["text_para" + (i + 1)].htmlText = "";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
ui.text_name.text = equip.name;
|
||||
ui.text_type.text = equip.typeName;
|
||||
ui.text_des.text = equip.des;
|
||||
ui.text_quality.htmlText = Paster.font(ItemType.equipQuality[equip.quality].name,ItemType.equipQuality[equip.quality].color);
|
||||
ui.showIn();
|
||||
SoundCenter.getIns().play(GameSound.effect_levelUp);
|
||||
ui.container_img.loadNetBitImg(equip.imgsrc,true,true);
|
||||
new FlashEffect(1500,16777215).startEffect(ui.container_img);
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_itemGet);
|
||||
this.showOut();
|
||||
}
|
||||
|
||||
override protected function stageResizeAndKeepInCenter() : void
|
||||
{
|
||||
super.stageResizeAndKeepInCenter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EquipMakerCompleteUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public var text_type:PiBitTextField;
|
||||
|
||||
public var text_des:PiBitTextField;
|
||||
|
||||
public var text_quality:PiBitTextField;
|
||||
|
||||
public var text_para1:TextField;
|
||||
|
||||
public var text_para2:TextField;
|
||||
|
||||
public var text_para3:TextField;
|
||||
|
||||
public var text_para4:TextField;
|
||||
|
||||
public var container_img:PiImgContainer;
|
||||
|
||||
public var mc_title:Sprite;
|
||||
|
||||
public var mc_flash:Sprite;
|
||||
|
||||
public function EquipMakerCompleteUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.EquipMakerCompleteUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
container_img.setSize(125,125);
|
||||
}
|
||||
|
||||
public function showIn() : void
|
||||
{
|
||||
TweenMax.fromTo(mc_flash,1.5,{
|
||||
"scaleX":0.2,
|
||||
"scaleY":0.2,
|
||||
"alpha":0
|
||||
},{
|
||||
"alpha":1,
|
||||
"scaleX":1,
|
||||
"scaleY":1
|
||||
});
|
||||
TweenMax.fromTo(mc_title,1.5,{
|
||||
"scaleX":2,
|
||||
"scaleY":2
|
||||
},{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.AlchemyCenter;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EquipMakerControllerUI extends UIComponent
|
||||
{
|
||||
|
||||
public var bar_process:PiBar;
|
||||
|
||||
public var btn_speed:PiLightButton;
|
||||
|
||||
public var text_time:PiBitTextField;
|
||||
|
||||
public var btn_start:PiLightButton;
|
||||
|
||||
public function EquipMakerControllerUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
public function modeNormal(startable:Boolean = false) : void
|
||||
{
|
||||
bar_process.visible = false;
|
||||
btn_speed.visible = false;
|
||||
btn_start.visible = true;
|
||||
if(startable)
|
||||
{
|
||||
btn_start.alpha = 1;
|
||||
btn_start.mouseChildren = btn_start.mouseEnabled = true;
|
||||
new FlashEffect(800,16777215,1).startEffect(btn_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_start.alpha = 0.5;
|
||||
btn_start.mouseChildren = btn_start.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeing() : void
|
||||
{
|
||||
bar_process.visible = true;
|
||||
btn_speed.visible = true;
|
||||
btn_start.visible = false;
|
||||
}
|
||||
|
||||
public function modeComplete() : void
|
||||
{
|
||||
bar_process.visible = false;
|
||||
btn_speed.visible = false;
|
||||
btn_start.visible = false;
|
||||
text_time.htmlText = Paster.font(lang("点击完成炼金!"),"#fff479");
|
||||
}
|
||||
|
||||
public function showNeedTime() : void
|
||||
{
|
||||
var types:Array = EquipMakerPanel.getIns().ui.ui_left.getTypes();
|
||||
var formulaLevel:int = AlchemyCenter.getIns().getFormulaLevel(types);
|
||||
var dicobj:Object = GameMath.alchemyFormulaCost[formulaLevel];
|
||||
text_time.text = Paster.secondFormat(dicobj.time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.AlchemyCenter;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.panel.itemselect.ItemSelectPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class EquipMakerLeftUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_item1:AlchemyMaterialItemUI;
|
||||
|
||||
public var ui_item2:AlchemyMaterialItemUI;
|
||||
|
||||
public var ui_item3:AlchemyMaterialItemUI;
|
||||
|
||||
public var ui_item4:AlchemyMaterialItemUI;
|
||||
|
||||
public var items:Array;
|
||||
|
||||
public var text_cost:PiBitTextField;
|
||||
|
||||
public var curSelectItem:AlchemyMaterialItemUI;
|
||||
|
||||
private var nitems:Array = [];
|
||||
|
||||
public function EquipMakerLeftUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
items = [ui_item1,ui_item2,ui_item3,ui_item4];
|
||||
}
|
||||
|
||||
public function getTypes() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if((items[i] as AlchemyMaterialItemUI).itemType != -1)
|
||||
{
|
||||
arr.push(items[i].itemType);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function getItems() : Array
|
||||
{
|
||||
var i:int = 0;
|
||||
var arr:Array = [];
|
||||
for(i = 0; i < items.length; )
|
||||
{
|
||||
if((items[i] as AlchemyMaterialItemUI).itemType != -1)
|
||||
{
|
||||
arr.push(items[i].item);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public function modeLock() : void
|
||||
{
|
||||
ui_item1.removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
ui_item2.removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
ui_item3.removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
ui_item4.removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
|
||||
public function modeInput() : void
|
||||
{
|
||||
ui_item1.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
ui_item2.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
ui_item3.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
ui_item4.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
|
||||
private function clickHandler(e:Event) : void
|
||||
{
|
||||
if(EquipMakerPanel.getIns().curSelectStack.starting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
curSelectItem = e.currentTarget as AlchemyMaterialItemUI;
|
||||
var itemui:AlchemyMaterialItemUI = e.currentTarget as AlchemyMaterialItemUI;
|
||||
var p:ItemSelectPanel = ItemSelectPanel.getIns();
|
||||
ItemSelectPanel.getIns().modeEquipMakeMaterial();
|
||||
p.popIn();
|
||||
p.addEventListener("showout",selectItemHandler);
|
||||
}
|
||||
|
||||
public function onTypes(types:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < types.length; )
|
||||
{
|
||||
(items[i] as AlchemyMaterialItemUI).onType(types[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private function selectItemHandler(e:Event) : void
|
||||
{
|
||||
ItemSelectPanel.getIns().removeEventListener("showout",selectItemHandler);
|
||||
if(ItemSelectPanel.selectedComplete)
|
||||
{
|
||||
putItem(ItemSelectPanel.selectItem);
|
||||
}
|
||||
}
|
||||
|
||||
public function putItem(itemVo:ItemVo = null, curSelectItem:AlchemyMaterialItemUI = null) : void
|
||||
{
|
||||
if(curSelectItem == null)
|
||||
{
|
||||
curSelectItem = this.curSelectItem;
|
||||
}
|
||||
if(itemVo == null)
|
||||
{
|
||||
curSelectItem.onData(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
curSelectItem.onData(itemVo);
|
||||
}
|
||||
showCostMoney();
|
||||
EquipMakerPanel.getIns().ui.ui_controller.showNeedTime();
|
||||
EquipMakerPanel.getIns().updateTip();
|
||||
BagCenter.getIns().resetItemUsingNum();
|
||||
for each(var i:AlchemyMaterialItemUI in items)
|
||||
{
|
||||
if(i.item != null)
|
||||
{
|
||||
i.item.usingNum++;
|
||||
}
|
||||
}
|
||||
for each(var ai:AlchemyMaterialItemUI in items)
|
||||
{
|
||||
if(ai.itemType == -1)
|
||||
{
|
||||
EquipMakerPanel.getIns().ui.ui_controller.modeNormal(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
EquipMakerPanel.getIns().ui.ui_controller.modeNormal(true);
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
nitems = [];
|
||||
BagCenter.getIns().resetItemUsingNum();
|
||||
for each(var i:AlchemyMaterialItemUI in items)
|
||||
{
|
||||
if(i.item != null && i.item.num > 0)
|
||||
{
|
||||
nitems.push(i.item);
|
||||
}
|
||||
i.reset();
|
||||
}
|
||||
super.reset();
|
||||
}
|
||||
|
||||
public function resetWithOutItem() : void
|
||||
{
|
||||
var j:int = 0;
|
||||
var nnnitem:ItemVo = null;
|
||||
for(j = 0; j < nitems.length; )
|
||||
{
|
||||
nnnitem = BagCenter.getIns().getByType(nitems[j].type);
|
||||
if(nnnitem != null && nnnitem.showNum > 0)
|
||||
{
|
||||
putItem(nnnitem,items[j]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
public function showCostMoney() : void
|
||||
{
|
||||
var types:Array = getTypes();
|
||||
if(types.length == 0)
|
||||
{
|
||||
text_cost.text = "×0";
|
||||
return;
|
||||
}
|
||||
var formulaLevel:int = AlchemyCenter.getIns().getFormulaLevel(types);
|
||||
var dicobj:Object = GameMath.alchemyFormulaCost[formulaLevel];
|
||||
text_cost.text = "×" + dicobj.cost.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.AlchemyCenter;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.PosCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.alchemy.AlchemyStackVo;
|
||||
import net.pixvi.myr.element.alchemy.MaterialType;
|
||||
import net.pixvi.myr.element.bag.EquipVo;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.bag.UseItemPanel;
|
||||
import net.pixvi.myr.panel.city.CityPanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.market.MarketPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EquipMakerPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:EquipMakerPanelUI = new EquipMakerPanelUI();
|
||||
|
||||
private var itemsui:Array = [];
|
||||
|
||||
public var curSelectStack:AlchemyStackVo;
|
||||
|
||||
public function EquipMakerPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
}
|
||||
|
||||
public static function getIns() : EquipMakerPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(EquipMakerPanel) as EquipMakerPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
for each(var vo:AlchemyStackVo in Master.alchemyStacks)
|
||||
{
|
||||
if(vo.starting && vo.finish())
|
||||
{
|
||||
curSelectStack = vo;
|
||||
}
|
||||
}
|
||||
StageLocator.setSide(ui.mc_npc,"right","none",-130,0);
|
||||
TweenMax.from(ui.mc_npc,0.8,{"x":ui.mc_npc.x + 20});
|
||||
TweenMax.from(ui.mc_mov,0.8,{"x":ui.mc_mov.x + 10});
|
||||
TweenMax.from(ui.ui_left,0.8,{"x":ui.ui_left.x - 15});
|
||||
TweenMax.from(ui.ui_stackList,0.8,{"y":ui.ui_stackList.y + 15});
|
||||
addChild(MainMenu.getIns(this));
|
||||
MainMenu.getIns().onIn();
|
||||
MainMenu.getIns().ui.alchemyMode();
|
||||
PosCenter.activity("city" + CityPanel.getIns().curCityVo.cid + "_alchemy");
|
||||
ui.ui_left.reset();
|
||||
addChild(ui.btn_close);
|
||||
ui.ui_stackList.list_stack.setDatas(Master.alchemyStacks);
|
||||
ui.ui_stackList.list_stack.addEventListener("piselect",stackSelectHandler);
|
||||
ui.ui_stackList.btn_add.onClick(addStackHandler);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.ui_controller.btn_start.onClick(startAlchemy);
|
||||
ui.ui_controller.btn_speed.onClick(speedHandler);
|
||||
ui.mc_mov.addEventListener("hit",hitSound);
|
||||
CityPanel.getIns().ui.ui_top.text_des.text = CityPanel.getIns().curCityVo.alchemyDes;
|
||||
CityPanel.getIns().ui.ui_top.text_name.text = CityPanel.getIns().curCityVo.name + lang("炼金工坊");
|
||||
addChild(CityPanel.getIns().ui.ui_top);
|
||||
GlobalBroadcast.addEventListener("androidBack",AndroidBackHandler);
|
||||
update();
|
||||
}
|
||||
|
||||
private function AndroidBackHandler(e:Event = null) : void
|
||||
{
|
||||
if(PopCenter.getIns().topPanel == this)
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
private function hitSound(e:Event) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.soundName("effect_alchemy"));
|
||||
}
|
||||
|
||||
public function startAlchemy(e:Event = null) : void
|
||||
{
|
||||
var types:Array = EquipMakerPanel.getIns().ui.ui_left.getTypes();
|
||||
var formulaLevel:int = AlchemyCenter.getIns().getFormulaLevel(types);
|
||||
var dicobj:Object = GameMath.alchemyFormulaCost[formulaLevel];
|
||||
if(Master.money < dicobj.cost)
|
||||
{
|
||||
Alert.yes(lang("提示"),lang("没有足够的金币!"));
|
||||
return;
|
||||
}
|
||||
if(AlchemyCenter.getIns().checkAlchemyFormula(ui.ui_left.getTypes()))
|
||||
{
|
||||
AlchemyCenter.getIns().startAlchemy(curSelectStack.id,ui.ui_left.getTypes(),ui.ui_left.getItems(),startAlchemyHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.yes(lang("提示"),lang("材料太单一了...做不出什么东西的样子,换个配方试试吧!"));
|
||||
}
|
||||
}
|
||||
|
||||
public function startAlchemyHandler() : void
|
||||
{
|
||||
ui.modeWaiting();
|
||||
update();
|
||||
}
|
||||
|
||||
public function speedHandler(e:Event = null) : void
|
||||
{
|
||||
if(BagCenter.alchemySpeedItemNum() > 0)
|
||||
{
|
||||
startAlchemySpeed();
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.showMsg(lang("没有炼金加速券"));
|
||||
}
|
||||
}
|
||||
|
||||
public function startAlchemySpeed() : void
|
||||
{
|
||||
var neednum:int = Math.ceil(curSelectStack.leftTime() / AlchemyCenter.alchemySpeedTime);
|
||||
var hasnum:int = BagCenter.alchemySpeedItemNum();
|
||||
if(hasnum == 0)
|
||||
{
|
||||
Alert.showMsg(lang("没有炼金加速券"));
|
||||
return;
|
||||
}
|
||||
var maxnum:int = Math.min(hasnum,neednum);
|
||||
UseItemPanel.getIns().useItem(BagCenter.getIns().getByType(GameMath.alchemySpeedItemId),true,maxnum,startAlchemySpeedNumChange,yesStartAlchemySpeed,1);
|
||||
UseItemPanel.getIns().popIn();
|
||||
}
|
||||
|
||||
private function startAlchemySpeedNumChange(num:int) : void
|
||||
{
|
||||
var speedTimeStr:String = Paster.secondFormatAutoString(num * AlchemyCenter.alchemySpeedTime);
|
||||
UseItemPanel.getIns().ui.text_msg.htmlText = lang("加速") + CP.lightYellow(speedTimeStr);
|
||||
}
|
||||
|
||||
private function yesStartAlchemySpeed(num:int) : void
|
||||
{
|
||||
AlchemyCenter.getIns().speedAlchemyByItem(curSelectStack.id,num,yesStartAlchemySpeedHandler);
|
||||
}
|
||||
|
||||
private function yesStartAlchemySpeedHandler() : void
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
public function addStackHandler(e:Event = null) : void
|
||||
{
|
||||
var num:int = int(Master.alchemyStacks.length);
|
||||
var money:int = int(Table.alchemyStack_price[num.toString()].money);
|
||||
var ke:int = int(Table.alchemyStack_price[num.toString()].ke);
|
||||
if(money > 0)
|
||||
{
|
||||
Alert.yesno(lang("提示"),lang("是否要花费 {0} 开启一个新的炼金槽位?",CP.money(money.toString() + lang("金币"))),yesAddStackHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.yesno(lang("提示"),lang("是否要花费 {0} 开启一个新的炼金槽位?",CP.ke(ke.toString() + lang("氪金"))),yesAddStackHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function yesAddStackHandler() : void
|
||||
{
|
||||
var num:int = int(Master.alchemyStacks.length);
|
||||
var money:int = int(Table.alchemyStack_price[num.toString()].money);
|
||||
var ke:int = int(Table.alchemyStack_price[num.toString()].ke);
|
||||
if(Master.money < money)
|
||||
{
|
||||
Alert.showMsg(lang("没有足够的 {0} !",CP.money(lang("金币"))));
|
||||
return;
|
||||
}
|
||||
if(Master.ke < ke)
|
||||
{
|
||||
Alert.showMsg(lang("没有足够的 {0} !",CP.ke(lang("氪金"))));
|
||||
return;
|
||||
}
|
||||
AlchemyCenter.getIns().addAlchemeyStack(addStackComplete);
|
||||
}
|
||||
|
||||
private function addStackComplete() : void
|
||||
{
|
||||
update();
|
||||
new FlashEffect(900,16777215).startEffect(ui.ui_stackList);
|
||||
}
|
||||
|
||||
public function stackSelectHandler(e:Event = null) : void
|
||||
{
|
||||
curSelectStack = ui.ui_stackList.list_stack.curSelectedItemData as AlchemyStackVo;
|
||||
if(!curSelectStack.starting)
|
||||
{
|
||||
ui.ui_left.reset();
|
||||
}
|
||||
BagCenter.getIns().resetItemUsingNum();
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
if(curSelectStack == null)
|
||||
{
|
||||
curSelectStack = Master.alchemyStacks[0];
|
||||
}
|
||||
if(curSelectStack == null)
|
||||
{
|
||||
Alert.yes("data error","Can\'t find alchemySlot。");
|
||||
return;
|
||||
}
|
||||
ui.ui_stackList.showNum(Master.alchemyStacks.length);
|
||||
ui.ui_stackList.list_stack.update();
|
||||
if(ui.ui_stackList.list_stack.curSelectedItemData != curSelectStack)
|
||||
{
|
||||
ui.ui_stackList.list_stack.selectByValue(curSelectStack);
|
||||
}
|
||||
if(AlchemyCenter.getIns().hasFinish())
|
||||
{
|
||||
GameSound.playSysVoice("alchemyFinish",true,true);
|
||||
}
|
||||
PiLightButton.btnTouchLight.removeDisplay(ui.mc_mov);
|
||||
ui.mc_mov.removeEventListener(MobiEvent.CLICK,alchemyOver);
|
||||
if(curSelectStack.starting)
|
||||
{
|
||||
ui.ui_left.modeLock();
|
||||
ui.ui_left.onTypes(curSelectStack.itemTypes);
|
||||
if(curSelectStack.finish())
|
||||
{
|
||||
ui.modeComplete();
|
||||
ui.ui_controller.modeComplete();
|
||||
SecondDriver.getIns().remove(secondHandler);
|
||||
PiLightButton.btnTouchLight.setDisplay(ui.mc_mov);
|
||||
ui.mc_mov.addEventListener(MobiEvent.CLICK,alchemyOver);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.modeWaiting();
|
||||
ui.ui_controller.modeing();
|
||||
SecondDriver.getIns().regist(secondHandler);
|
||||
secondHandler();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_left.modeInput();
|
||||
ui.modeNormal();
|
||||
ui.ui_controller.modeNormal();
|
||||
ui.ui_controller.showNeedTime();
|
||||
SecondDriver.getIns().remove(secondHandler);
|
||||
}
|
||||
updateTip();
|
||||
ui.ui_left.showCostMoney();
|
||||
}
|
||||
|
||||
public function updateTip() : void
|
||||
{
|
||||
var mats:Array = MaterialType.getMaterialsTip(ui.ui_left.getTypes());
|
||||
ui.ui_tips.text_tips.htmlText = mats.join("<br/>");
|
||||
}
|
||||
|
||||
public function alchemyOver(e:Event) : void
|
||||
{
|
||||
AlchemyCenter.getIns().overAlchemy(curSelectStack.id,alchemyOverHandler);
|
||||
}
|
||||
|
||||
private function alchemyOverHandler(re:EquipVo) : void
|
||||
{
|
||||
var panel:EquipMakerCompletePanel = null;
|
||||
TaskCenter.getIns().activityLockStatus(GSub.ALCHEMY_OVER);
|
||||
if(re != null && re.quality == 3)
|
||||
{
|
||||
GameSound.playSysVoice("getEquip3",true,true);
|
||||
}
|
||||
else if(re != null && re.quality == 4)
|
||||
{
|
||||
GameSound.playSysVoice("getEquip4",true,true);
|
||||
}
|
||||
if(re != null)
|
||||
{
|
||||
panel = EquipMakerCompletePanel.getIns();
|
||||
panel.equip = re;
|
||||
PopCenter.POP(panel);
|
||||
panel.addEventListener("showoutend",alchemyOverResultOutHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function alchemyOverResultOutHandler(e:Event) : void
|
||||
{
|
||||
ui.ui_left.reset();
|
||||
update();
|
||||
ui.ui_left.resetWithOutItem();
|
||||
}
|
||||
|
||||
public function secondHandler() : void
|
||||
{
|
||||
if(curSelectStack.starting)
|
||||
{
|
||||
if(curSelectStack.finish())
|
||||
{
|
||||
SecondDriver.getInstance().remove(secondHandler);
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_controller.bar_process.setValue(curSelectStack.process(),1,0,false);
|
||||
ui.ui_controller.text_time.text = Paster.secondFormat(curSelectStack.leftTime());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SecondDriver.getInstance().remove(secondHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
MarketPanel.getIns().popInWith(this);
|
||||
}
|
||||
|
||||
override public function showOut() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener("androidBack",AndroidBackHandler);
|
||||
ui.mc_mov.stop();
|
||||
BagCenter.getIns().resetItemUsingNum();
|
||||
ui.ui_left.modeLock();
|
||||
PiLightButton.btnTouchLight.removeDisplay(ui.mc_mov);
|
||||
SecondDriver.getInstance().remove(secondHandler);
|
||||
super.showOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.Game;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EquipMakerPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var ui_left:EquipMakerLeftUI;
|
||||
|
||||
public var ui_controller:EquipMakerControllerUI;
|
||||
|
||||
public var ui_stackList:EquipMakerStackListUI;
|
||||
|
||||
public var ui_tips:EquipMakerTipsUI;
|
||||
|
||||
public var mc_npc:Sprite;
|
||||
|
||||
public var mc_mov:MovieClip;
|
||||
|
||||
public var mc_bg:Sprite;
|
||||
|
||||
public function EquipMakerPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.EquipMakerPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
ui_stackList.list_stack.itemClass = EquipMakerStackItem;
|
||||
mc_mov.stop();
|
||||
StageLocator.setSide(btn_close,"left","bottom",0,30);
|
||||
if(Game.getIns().setting.liuhaiMode)
|
||||
{
|
||||
StageLocator.setSide(ui_stackList,"none","top",0,285);
|
||||
}
|
||||
else
|
||||
{
|
||||
StageLocator.setSide(ui_stackList,"none","top",0,239);
|
||||
}
|
||||
mc_npc.scaleX = mc_npc.scaleY = 0.8;
|
||||
if(StageLocator.MainFixVo.fix[3] < 0)
|
||||
{
|
||||
ui_left.scaleX = ui_left.scaleY = 0.91;
|
||||
ui_left.y += 43;
|
||||
}
|
||||
}
|
||||
|
||||
public function modeWaiting() : void
|
||||
{
|
||||
mc_mov.gotoAndPlay("loading");
|
||||
}
|
||||
|
||||
public function modeComplete() : void
|
||||
{
|
||||
mc_mov.gotoAndPlay("finish");
|
||||
}
|
||||
|
||||
public function modeNormal() : void
|
||||
{
|
||||
mc_mov.gotoAndStop("normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.element.alchemy.AlchemyStackVo;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.ui.controls.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiListItem;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class EquipMakerStackItem extends PiListItem
|
||||
{
|
||||
|
||||
public var vo:AlchemyStackVo;
|
||||
|
||||
public var text_time:PiBitTextField;
|
||||
|
||||
public var bar_bar:PiBar;
|
||||
|
||||
public var mc_light:Sprite;
|
||||
|
||||
public function EquipMakerStackItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
text_time.mouseChildren = text_time.mouseEnabled = false;
|
||||
bar_bar.mouseChildren = bar_bar.mouseEnabled = false;
|
||||
mc_light.mouseChildren = mc_light.mouseEnabled = false;
|
||||
}
|
||||
|
||||
override public function hackUiMap(uimap:Object) : void
|
||||
{
|
||||
uimap["btn_select"] = "net.pixvi.psg.ui.controller.PiLightButton";
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
this.vo = value as AlchemyStackVo;
|
||||
update();
|
||||
btn_select.onClick(sendSelect);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(vo.starting)
|
||||
{
|
||||
if(vo.finish())
|
||||
{
|
||||
mc_light.visible = true;
|
||||
text_time.htmlText = Paster.font(lang("炼金完成"),"#ffff00");
|
||||
bar_bar.setValue(1,1,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_light.visible = false;
|
||||
secondUpdate();
|
||||
SecondDriver.getIns().regist(secondUpdate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EnterFrameDriver.getIns().remove(secondUpdate);
|
||||
text_time.htmlText = Paster.font(lang("空闲"),"#ffffff");
|
||||
bar_bar.setValue(0,1,0,false);
|
||||
}
|
||||
}
|
||||
|
||||
public function secondUpdate() : void
|
||||
{
|
||||
if(vo.finish())
|
||||
{
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
text_time.text = Paster.secondFormat(vo.leftTime());
|
||||
bar_bar.setValue(vo.process(),1,0,false);
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
SecondDriver.getIns().remove(secondUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiDataList;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class EquipMakerStackListUI extends UIComponent
|
||||
{
|
||||
|
||||
public var list_stack:PiDataList;
|
||||
|
||||
public var btn_add:PiLightButton;
|
||||
|
||||
public var mc_num1:Sprite;
|
||||
|
||||
public var mc_num2:Sprite;
|
||||
|
||||
public var mc_num3:Sprite;
|
||||
|
||||
public var mc_num4:Sprite;
|
||||
|
||||
private var original_btnadd_x:int = 0;
|
||||
|
||||
public function EquipMakerStackListUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
original_btnadd_x = btn_add.x;
|
||||
mc_num1.mouseChildren = mc_num1.mouseEnabled = false;
|
||||
mc_num2.mouseChildren = mc_num2.mouseEnabled = false;
|
||||
mc_num3.mouseChildren = mc_num3.mouseEnabled = false;
|
||||
mc_num4.mouseChildren = mc_num4.mouseEnabled = false;
|
||||
}
|
||||
|
||||
public function showNum(num:int) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
if(i <= num)
|
||||
{
|
||||
this["mc_num" + i].visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this["mc_num" + i].visible = false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(num < 4)
|
||||
{
|
||||
btn_add.visible = true;
|
||||
btn_add.x = original_btnadd_x + (num - 1) * 155;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_add.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.pixvi.myr.panel.alchemy
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class EquipMakerTipsUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_tips:TextField;
|
||||
|
||||
public function EquipMakerTipsUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user