Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
package net.pixvi.myr.panel.randomevent
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.RandomEventCenter;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventType;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.minigame.MiniGamePanel;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
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;
|
||||
|
||||
public class FarmEventImgPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:FarmEventImgPanelUI = new FarmEventImgPanelUI();
|
||||
|
||||
private var vo:RandomEventVo;
|
||||
|
||||
private var rewardResultCache:RewardResultVo;
|
||||
|
||||
public function FarmEventImgPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
buffMode = false;
|
||||
PopCenter.getIns().setMaskAlpha();
|
||||
update();
|
||||
}
|
||||
|
||||
public static function getIns() : FarmEventImgPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(FarmEventImgPanel) as FarmEventImgPanel;
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
vo = new RandomEventVo();
|
||||
vo.typeId = Master.randomEvent[RandomEventType.FARM_TIMER_NAME];
|
||||
ui.container_img.loadNetBitImg(vo.img);
|
||||
if(vo.des.length > 28)
|
||||
{
|
||||
ui.text_des.htmlText = Paster.font(vo.des,null,23);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.text_des.text = vo.des;
|
||||
}
|
||||
ui.btn_yes.onClick(yesHandler);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
if(vo.miniGame > 0)
|
||||
{
|
||||
ui.mc_minigame.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_minigame.visible = false;
|
||||
}
|
||||
GlobalBroadcast.addEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
}
|
||||
|
||||
public function eventChangeHandler(e:Event = null) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
Alert.showMsg(lang("事件结束了..."));
|
||||
this.showOut();
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
RandomEventCenter.getIns().finishFarmEvent(farmEventHandler);
|
||||
}
|
||||
|
||||
public function farmEventHandler(rewardResult:RewardResultVo) : void
|
||||
{
|
||||
var game:MiniGamePanel = null;
|
||||
this.showOut();
|
||||
if(vo.miniGame > 0)
|
||||
{
|
||||
rewardResultCache = rewardResult;
|
||||
game = new MiniGamePanel(vo.miniGame);
|
||||
PopCenter.POP(game);
|
||||
game.gameStart(miniGameOver);
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardShowPanel.showByVo(rewardResult);
|
||||
}
|
||||
}
|
||||
|
||||
private function miniGameOver(point:int = 0) : void
|
||||
{
|
||||
RewardShowPanel.showByVo(rewardResultCache);
|
||||
closeHandler();
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
this.showOut();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.pixvi.myr.panel.randomevent
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
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 FarmEventImgPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var container_img:PiImgContainer;
|
||||
|
||||
public var text_des:PiBitTextField;
|
||||
|
||||
public var mc_minigame:Sprite;
|
||||
|
||||
public function FarmEventImgPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.RandomEventPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package net.pixvi.myr.panel.randomevent
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.gaooo.nano.center.GAoNano;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.RandomEventCenter;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.reward.RewardShowPanel;
|
||||
import net.pixvi.myr.panel.story.StoryPanel;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
import net.pixvi.psg.utils.Blacker;
|
||||
|
||||
public class FarmEventStoryPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var vo:RandomEventVo;
|
||||
|
||||
private var curPanel:PSGPopPanel;
|
||||
|
||||
private var storyAnswer:Boolean = true;
|
||||
|
||||
private var eventClose:Boolean = false;
|
||||
|
||||
public function FarmEventStoryPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
super(showTime,hideTime);
|
||||
}
|
||||
|
||||
public static function getIns() : FarmEventStoryPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(FarmEventStoryPanel) as FarmEventStoryPanel;
|
||||
}
|
||||
|
||||
public function startEvent(event:RandomEventVo, curPanel:PSGPopPanel) : void
|
||||
{
|
||||
vo = event;
|
||||
eventClose = false;
|
||||
storyAnswer = true;
|
||||
this.curPanel = curPanel;
|
||||
Blacker.getIns().show(startHandler);
|
||||
}
|
||||
|
||||
private function startHandler() : void
|
||||
{
|
||||
if(curPanel != null)
|
||||
{
|
||||
curPanel.showOut();
|
||||
}
|
||||
this.popIn();
|
||||
GAoNano.getIns().stage.addEventListener("GAoEvent",gaoEventHandler);
|
||||
Blacker.getIns().hide();
|
||||
StoryPanel.getIns().start(vo.story,storyOver,null,false);
|
||||
GlobalBroadcast.addEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
}
|
||||
|
||||
public function gaoEventHandler(e:PiEvent = null) : void
|
||||
{
|
||||
if(e.data == "true")
|
||||
{
|
||||
storyAnswer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
storyAnswer = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function storyOver(e:Event = null) : void
|
||||
{
|
||||
Blacker.getIns().show(storyOverHandler);
|
||||
}
|
||||
|
||||
public function storyOverHandler(e:Event = null) : void
|
||||
{
|
||||
StoryPanel.getIns().endOut();
|
||||
GAoNano.getIns().stage.removeEventListener("GAoEvent",gaoEventHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
Blacker.getIns().hide();
|
||||
if(storyAnswer && !eventClose)
|
||||
{
|
||||
RandomEventCenter.getIns().finishFarmEvent(finishEventHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
showOver();
|
||||
}
|
||||
}
|
||||
|
||||
public function eventChangeHandler(e:Event = null) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
Alert.showMsg(lang("事件结束了..."));
|
||||
eventClose = true;
|
||||
}
|
||||
|
||||
public function finishEventHandler(reward:RewardResultVo) : void
|
||||
{
|
||||
showOver();
|
||||
if(RewardResultVo != null)
|
||||
{
|
||||
RewardShowPanel.showByVo(reward);
|
||||
}
|
||||
}
|
||||
|
||||
public function showOver() : void
|
||||
{
|
||||
this.showOut();
|
||||
if(curPanel != null)
|
||||
{
|
||||
curPanel.popIn();
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package net.pixvi.myr.panel.randomevent
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventVo;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class RanEventImgPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:RanEventImgPanelUI = new RanEventImgPanelUI();
|
||||
|
||||
private var vo:RandomEventVo;
|
||||
|
||||
public var onYesFunction:Function;
|
||||
|
||||
public var onNoFunction:Function;
|
||||
|
||||
public function RanEventImgPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
buffMode = false;
|
||||
PopCenter.getIns().setMaskAlpha();
|
||||
}
|
||||
|
||||
public function startShow(event:RandomEventVo, closeMode:Boolean = true, onYes:Function = null, onNo:Function = null) : void
|
||||
{
|
||||
vo = event;
|
||||
onYesFunction = onYes;
|
||||
ui.container_img.loadNetBitImg(vo.img);
|
||||
if(vo.des.length > 28)
|
||||
{
|
||||
ui.text_des.htmlText = Paster.font(vo.des,null,23);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.text_des.text = vo.des;
|
||||
}
|
||||
ui.btn_yes.onClick(yesHandler);
|
||||
if(closeMode)
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.btn_close.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.btn_close.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
Alert.resumeMsg();
|
||||
this.showOut();
|
||||
if(onYesFunction != null)
|
||||
{
|
||||
onYesFunction();
|
||||
}
|
||||
onYesFunction = null;
|
||||
onNoFunction = null;
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
if(onNoFunction != null)
|
||||
{
|
||||
onNoFunction();
|
||||
}
|
||||
onYesFunction = null;
|
||||
onNoFunction = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.pixvi.myr.panel.randomevent
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
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 RanEventImgPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var container_img:PiImgContainer;
|
||||
|
||||
public var text_des:PiBitTextField;
|
||||
|
||||
public var mc_minigame:Sprite;
|
||||
|
||||
public function RanEventImgPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.RandomEventPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_minigame.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package net.pixvi.myr.panel.randomevent
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.gaooo.nano.center.GAoNano;
|
||||
import net.pixvi.myr.element.randomevent.RandomEventVo;
|
||||
import net.pixvi.myr.panel.story.StoryPanel;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
import net.pixvi.psg.utils.Blacker;
|
||||
|
||||
public class RanEventStoryPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var vo:RandomEventVo;
|
||||
|
||||
private var curPanel:PSGPopPanel;
|
||||
|
||||
private var storyAnswer:Boolean = true;
|
||||
|
||||
public var onYesFunction:Function;
|
||||
|
||||
public var onNoFunction:Function;
|
||||
|
||||
public function RanEventStoryPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
super(showTime,hideTime);
|
||||
}
|
||||
|
||||
public static function getIns() : RanEventStoryPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(RanEventStoryPanel) as RanEventStoryPanel;
|
||||
}
|
||||
|
||||
public function startEvent(event:RandomEventVo, curPanel:PSGPopPanel, onYes:Function = null, onNo:Function = null) : void
|
||||
{
|
||||
onYesFunction = onYes;
|
||||
onNoFunction = onNo;
|
||||
vo = event;
|
||||
storyAnswer = true;
|
||||
this.curPanel = curPanel;
|
||||
Blacker.getIns().show(startHandler);
|
||||
}
|
||||
|
||||
private function startHandler() : void
|
||||
{
|
||||
if(curPanel != null)
|
||||
{
|
||||
curPanel.showOut();
|
||||
}
|
||||
this.popIn();
|
||||
GAoNano.getIns().stage.addEventListener("GAoEvent",gaoEventHandler);
|
||||
Blacker.getIns().hide();
|
||||
StoryPanel.getIns().start(vo.story,storyOver,null,false);
|
||||
}
|
||||
|
||||
public function gaoEventHandler(e:PiEvent = null) : void
|
||||
{
|
||||
if(e.data == "true")
|
||||
{
|
||||
storyAnswer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
storyAnswer = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function storyOver(e:Event = null) : void
|
||||
{
|
||||
Blacker.getIns().show(storyOverHandler);
|
||||
}
|
||||
|
||||
public function storyOverHandler(e:Event = null) : void
|
||||
{
|
||||
StoryPanel.getIns().endOut();
|
||||
GAoNano.getIns().stage.removeEventListener("GAoEvent",gaoEventHandler);
|
||||
Blacker.getIns().hide();
|
||||
showOver();
|
||||
}
|
||||
|
||||
public function showOver() : void
|
||||
{
|
||||
this.showOut();
|
||||
if(curPanel != null)
|
||||
{
|
||||
curPanel.popIn();
|
||||
}
|
||||
if(storyAnswer)
|
||||
{
|
||||
if(onYesFunction != null)
|
||||
{
|
||||
onYesFunction();
|
||||
}
|
||||
}
|
||||
else if(onNoFunction != null)
|
||||
{
|
||||
onNoFunction();
|
||||
}
|
||||
onYesFunction = null;
|
||||
onNoFunction = null;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user