Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package net.pixvi.myr.panel.growswitch
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.effect.effects.JumpToNumEffect;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class GrowthMonUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_card:MonCardSetUI;
|
||||
|
||||
public var mc_rank_atk:MovieClip;
|
||||
|
||||
public var mc_rank_def:MovieClip;
|
||||
|
||||
public var mc_rank_hp:MovieClip;
|
||||
|
||||
public var mc_rank_dex:MovieClip;
|
||||
|
||||
public var text_atk:TextField;
|
||||
|
||||
public var text_def:TextField;
|
||||
|
||||
public var text_hp:TextField;
|
||||
|
||||
public var text_dex:TextField;
|
||||
|
||||
public var mon:MonsterVo;
|
||||
|
||||
public function GrowthMonUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_rank_atk.stop();
|
||||
mc_rank_def.stop();
|
||||
mc_rank_hp.stop();
|
||||
mc_rank_dex.stop();
|
||||
super.onSkinComplete();
|
||||
setEmpty();
|
||||
}
|
||||
|
||||
public function setEmpty() : void
|
||||
{
|
||||
mc_rank_atk.visible = mc_rank_def.visible = mc_rank_dex.visible = mc_rank_hp.visible = false;
|
||||
text_atk.visible = text_def.visible = text_dex.visible = text_hp.visible = false;
|
||||
ui_card.showEmpty();
|
||||
}
|
||||
|
||||
public function ondata(mon:MonsterVo, showChange:Boolean = false) : void
|
||||
{
|
||||
if(mon == null)
|
||||
{
|
||||
setEmpty();
|
||||
return;
|
||||
}
|
||||
this.mon = mon;
|
||||
ui_card.onData(mon);
|
||||
mc_rank_atk.gotoAndStop(mon.quality_atk);
|
||||
mc_rank_def.gotoAndStop(mon.quality_def);
|
||||
mc_rank_hp.gotoAndStop(mon.quality_hp);
|
||||
mc_rank_dex.gotoAndStop(mon.quality_dex);
|
||||
mc_rank_atk.visible = mc_rank_def.visible = mc_rank_dex.visible = mc_rank_hp.visible = true;
|
||||
text_atk.visible = text_def.visible = text_dex.visible = text_hp.visible = true;
|
||||
if(showChange)
|
||||
{
|
||||
new JumpToNumEffect(500,Number(mon.g_atk.val.toFixed(1)),1).startEffect(text_atk);
|
||||
new JumpToNumEffect(500,Number(mon.g_def.val.toFixed(1)),1).startEffect(text_def);
|
||||
new JumpToNumEffect(500,Number(mon.g_hp.val.toFixed(1)),1).startEffect(text_hp);
|
||||
new JumpToNumEffect(500,Number(mon.g_dex.val.toFixed(1)),1).startEffect(text_dex);
|
||||
}
|
||||
else
|
||||
{
|
||||
text_atk.text = mon.g_atk.val.toFixed(1);
|
||||
text_def.text = mon.g_def.val.toFixed(1);
|
||||
text_hp.text = mon.g_hp.val.toFixed(1);
|
||||
text_dex.text = mon.g_dex.val.toFixed(1);
|
||||
}
|
||||
TipCenter.registTextTip(mc_rank_atk,mon.atk_grow_min.toFixed(1) + "~" + mon.atk_grow_max.toFixed(1));
|
||||
TipCenter.registTextTip(mc_rank_def,mon.def_grow_min.toFixed(1) + "~" + mon.def_grow_max.toFixed(1));
|
||||
TipCenter.registTextTip(mc_rank_hp,mon.hp_grow_min.toFixed(1) + "~" + mon.hp_grow_max.toFixed(1));
|
||||
TipCenter.registTextTip(mc_rank_dex,mon.dex_grow_min.toFixed(1) + "~" + mon.dex_grow_max.toFixed(1));
|
||||
new FlashEffect(900,16777215).startEffect(this);
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
setEmpty();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
package net.pixvi.myr.panel.growswitch
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.MonsterCenter;
|
||||
import net.pixvi.myr.panel.monster.MonsterSelectPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class GrowthSwitchPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:GrowthSwitchPanelUI = new GrowthSwitchPanelUI();
|
||||
|
||||
public function GrowthSwitchPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
buffMode = false;
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.btn_yes.onClick(startSwitch);
|
||||
update();
|
||||
}
|
||||
|
||||
public static function getIns() : GrowthSwitchPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(GrowthSwitchPanel) as GrowthSwitchPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
PopCenter.getIns().setMaskAlpha();
|
||||
ui.ui_growth1.ondata(null);
|
||||
ui.ui_growth2.ondata(null);
|
||||
ui.ui_growth1.ui_card.addEventListener(MobiEvent.CLICK,target1Handler);
|
||||
ui.ui_growth2.ui_card.addEventListener(MobiEvent.CLICK,target2Handler);
|
||||
PopCenter.getIns().mask.addEventListener(MobiEvent.CLICK,maskClickHandler);
|
||||
GlobalBroadcast.addEventListener("androidBack",AndroidBackHandler);
|
||||
}
|
||||
|
||||
private function AndroidBackHandler(e:Event = null) : void
|
||||
{
|
||||
if(PopCenter.getIns().topPanel == this)
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
public function maskClickHandler(e:Event = null) : void
|
||||
{
|
||||
if(PopCenter.getIns().topPanel == this)
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
ui.btn_yes.visible = false;
|
||||
ui.mc_tips.visible = true;
|
||||
ui.ui_growth1.reset();
|
||||
ui.ui_growth1.ui_card.removeEventListener(MobiEvent.CLICK,target1Handler);
|
||||
ui.ui_growth2.reset();
|
||||
ui.ui_growth2.ui_card.removeEventListener(MobiEvent.CLICK,target2Handler);
|
||||
ui.text_cost.visible = ui.mc_cost.visible = false;
|
||||
ui.mc_complete.visible = ui.mc_denile.visible = ui.mc_pass.visible = false;
|
||||
}
|
||||
|
||||
public function startSwitch(e:Event = null) : void
|
||||
{
|
||||
if(GameMath.getSwitchMoney(ui.ui_growth1.mon.star) > Master.money)
|
||||
{
|
||||
Alert.showMsg(lang("金币不足!"));
|
||||
new FlashEffect(900,16711680).startEffect(ui.text_cost);
|
||||
return;
|
||||
}
|
||||
MonsterCenter.getIns().switchGrowth(ui.ui_growth1.mon.id,ui.ui_growth2.mon.id,startSwitchHandler);
|
||||
}
|
||||
|
||||
public function startSwitchHandler() : void
|
||||
{
|
||||
switchCompleteHandler();
|
||||
}
|
||||
|
||||
public function switchCompleteHandler() : void
|
||||
{
|
||||
Caller.delayCall(ui.ui_growth1.ondata,1000,1,[ui.ui_growth1.mon,true]);
|
||||
Caller.delayCall(ui.ui_growth2.ondata,1000,1,[ui.ui_growth2.mon,true]);
|
||||
ui.btn_yes.visible = false;
|
||||
ui.text_cost.visible = ui.mc_cost.visible = ui.mc_pass.visible = ui.mc_denile.visible = false;
|
||||
ui.startSwitchShow();
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
PopCenter.getIns().mask.removeEventListener(MobiEvent.CLICK,maskClickHandler);
|
||||
GlobalBroadcast.removeEventListener("androidBack",AndroidBackHandler);
|
||||
this.showOut();
|
||||
}
|
||||
|
||||
public function target1Handler(e:Event) : void
|
||||
{
|
||||
MonsterSelectPanel.getIns().modeSwitch(ui.ui_growth2.mon);
|
||||
MonsterSelectPanel.getIns().popIn();
|
||||
MonsterSelectPanel.getIns().addEventListener("complete",target1HandlerComplete);
|
||||
}
|
||||
|
||||
public function target1HandlerComplete(e:Event) : void
|
||||
{
|
||||
MonsterSelectPanel.getIns().removeEventListener("complete",target1HandlerComplete);
|
||||
if(MonsterSelectPanel.selectedComplete)
|
||||
{
|
||||
ui.ui_growth1.ondata(MonsterSelectPanel.selectedMonster);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public function target2Handler(e:Event) : void
|
||||
{
|
||||
MonsterSelectPanel.getIns().modeSwitch(ui.ui_growth1.mon);
|
||||
MonsterSelectPanel.getIns().popIn();
|
||||
MonsterSelectPanel.getIns().addEventListener("complete",target2HandlerComplete);
|
||||
}
|
||||
|
||||
public function target2HandlerComplete(e:Event) : void
|
||||
{
|
||||
MonsterSelectPanel.getIns().removeEventListener("complete",target2HandlerComplete);
|
||||
if(MonsterSelectPanel.selectedComplete)
|
||||
{
|
||||
ui.ui_growth2.ondata(MonsterSelectPanel.selectedMonster);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
ui.mc_complete.visible = false;
|
||||
ui.btn_yes.visible = ui.text_cost.visible = ui.mc_cost.visible = false;
|
||||
if(ui.ui_growth1.mon != null && ui.ui_growth2.mon != null)
|
||||
{
|
||||
if(ui.ui_growth1.mon.type == ui.ui_growth2.mon.type)
|
||||
{
|
||||
ui.mc_tips.visible = false;
|
||||
ui.btn_yes.visible = true;
|
||||
ui.text_cost.visible = ui.mc_cost.visible = ui.mc_pass.visible = true;
|
||||
ui.mc_denile.visible = false;
|
||||
ui.text_cost.text = GameMath.getSwitchMoney(ui.ui_growth1.mon.star).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_tips.visible = true;
|
||||
ui.mc_denile.visible = true;
|
||||
ui.mc_pass.visible = false;
|
||||
ui.text_cost.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_tips.visible = true;
|
||||
ui.btn_yes.visible = ui.mc_denile.visible = ui.mc_pass.visible = ui.text_cost.visible = ui.mc_complete.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package net.pixvi.myr.panel.growswitch
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
import net.pixvi.pfw.utils.Oncer;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class GrowthSwitchPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var text_cost:PiBitTextField;
|
||||
|
||||
public var mc_cost:Sprite;
|
||||
|
||||
public var ui_growth1:GrowthMonUI;
|
||||
|
||||
public var ui_growth2:GrowthMonUI;
|
||||
|
||||
public var mc_denile:Sprite;
|
||||
|
||||
public var mc_pass:Sprite;
|
||||
|
||||
public var mc_complete:Sprite;
|
||||
|
||||
public var mc_tips:Sprite;
|
||||
|
||||
public var mc_switchMov:MovieClip;
|
||||
|
||||
private var movY:Number;
|
||||
|
||||
private var num:int = 0;
|
||||
|
||||
public function GrowthSwitchPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.GrowthSwitchPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
mc_switchMov.visible = false;
|
||||
mc_switchMov.gotoAndStop(0);
|
||||
movY = mc_switchMov.y;
|
||||
}
|
||||
|
||||
public function startSwitchShow() : void
|
||||
{
|
||||
num = 0;
|
||||
mc_switchMov.visible = true;
|
||||
showNextRow();
|
||||
}
|
||||
|
||||
private function showNextRow() : void
|
||||
{
|
||||
trace("loop",num);
|
||||
if(num > 3)
|
||||
{
|
||||
mc_complete.visible = true;
|
||||
mc_switchMov.stop();
|
||||
mc_switchMov.visible = false;
|
||||
return;
|
||||
}
|
||||
mc_switchMov.y = movY + num * 35;
|
||||
mc_switchMov.gotoAndPlay(1);
|
||||
Director.playOnceMC(mc_switchMov,showNextRow2);
|
||||
num++;
|
||||
}
|
||||
|
||||
private function showNextRow2() : void
|
||||
{
|
||||
Oncer.lastRun(showNextRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package net.pixvi.myr.panel.growswitch
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.team.MonCardMidUI;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MonCardSetUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_empty:Sprite;
|
||||
|
||||
public var ui_card:MonCardMidUI;
|
||||
|
||||
public function MonCardSetUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
}
|
||||
|
||||
public function onData(value:MonsterVo) : void
|
||||
{
|
||||
showEmpty();
|
||||
var mon:MonsterVo = value;
|
||||
if(mon == null)
|
||||
{
|
||||
mc_empty.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_empty.visible = true;
|
||||
ui_card.onData(mon);
|
||||
ui_card.showJoin();
|
||||
}
|
||||
}
|
||||
|
||||
public function showEmpty() : void
|
||||
{
|
||||
ui_card.reset();
|
||||
mc_empty.visible = true;
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_click_mon);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user