Initialize local project and fix ranch growth synchronization

This commit is contained in:
AttilaNet
2026-11-07 22:14:49 +08:00
commit 657f5f33b5
1417 changed files with 202171 additions and 0 deletions
@@ -0,0 +1,81 @@
package net.pixvi.myr.panel.wild
{
import com.greensock.TweenMax;
import flash.display.DisplayObject;
import net.pixvi.myr.GameMath;
import net.pixvi.myr.center.TaskCenter;
import net.pixvi.myr.event.MYREvent;
import net.pixvi.pfw.ui.UIComponent;
import net.pixvi.pfw.ui.controls.PiLoopMC;
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
import net.pixvi.psg.ui.controller.PiLightButton;
public class AreaIconUI extends UIComponent
{
public var mc_task:PiLoopMC;
public var vo:AreaVo;
public function AreaIconUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
{
super(skin,auto,w,h);
}
override public function onSkinComplete() : void
{
PiLightButton.btnTouchLight.setDisplay(this);
mc_task.mouseChildren = mc_task.mouseEnabled = false;
GlobalBroadcast.addEventListener(MYREvent.STAGE_UPDATE,passStageHandler);
}
public function passStageHandler(e:MYREvent = null) : void
{
if(e.data.stageid == vo.openStage)
{
TweenMax.fromTo(this,0.8,{"tint":16777215},{"removeTint":true});
update();
}
}
public function setAreaVo(areavo:AreaVo) : void
{
vo = areavo;
update();
}
public function update() : void
{
if(!vo.isOpen)
{
if(!GameMath.ModeTrace)
{
this.visible = false;
return;
}
this.alpha = 0.6;
}
else
{
this.visible = true;
}
this.mouseChildren = this.mouseEnabled = true;
if(TaskCenter.getIns().hasTaskByPosition("city" + this.vo.city + "_wild_" + this.vo.area))
{
mc_task.visible = true;
}
else
{
mc_task.visible = false;
}
}
override public function dispose() : void
{
super.dispose();
GlobalBroadcast.removeEventListener(MYREvent.STAGE_UPDATE,passStageHandler);
PiLightButton.btnTouchLight.removeDisplay(this);
}
}
}
@@ -0,0 +1,16 @@
package net.pixvi.myr.panel.wild
{
public class AreaPositionAction
{
public static var DUNGEON:String = "dungeon";
public static var AREA:String = "area";
public function AreaPositionAction()
{
super();
}
}
}
@@ -0,0 +1,121 @@
package net.pixvi.myr.panel.wild
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import net.pixvi.common.view.FF;
import net.pixvi.myr.GameMath;
import net.pixvi.myr.center.StageCenter;
import net.pixvi.myr.center.Table;
import net.pixvi.myr.center.TaskCenter;
import net.pixvi.myr.element.npc.ConditionVo;
import net.pixvi.myr.event.MYREvent;
import net.pixvi.pfw.display.NetBitImg;
import net.pixvi.pfw.ui.UIComponent;
import net.pixvi.pfw.ui.controls.PiLoopMC;
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
import net.pixvi.psg.ui.controller.PiLightButton;
public class AreaPositionIconUI extends UIComponent
{
public var container_img:Sprite;
public var mc_task:PiLoopMC;
public var posData:Object;
public var spIcon:NetBitImg;
public function AreaPositionIconUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
{
skin = FF.getMC("ui.AreaPositionUI");
super(skin,auto,w,h);
}
override public function onSkinComplete() : void
{
PiLightButton.btnTouchLight.setDisplay(this);
mc_task.mouseChildren = mc_task.mouseEnabled = false;
mc_task.parent.addChild(mc_task);
GlobalBroadcast.addEventListener(MYREvent.DAY_CHANGE,dayChange);
GlobalBroadcast.addEventListener(MYREvent.TASK_CHANGE,taskChange);
GlobalBroadcast.addEventListener(MYREvent.STAGE_UPDATE,taskChange);
}
public function dayChange(e:MYREvent = null) : void
{
update();
}
public function taskChange(e:MYREvent = null) : void
{
update();
}
public function setPosData(data:Object) : void
{
this.posData = data;
update();
}
public function update() : void
{
var openStage:String = null;
var con:ConditionVo = new ConditionVo(posData.condition);
if(con.check())
{
this.visible = true;
}
else
{
if(!GameMath.ModeTrace)
{
this.visible = false;
return;
}
this.alpha = 0.6;
}
if(posData.action == AreaPositionAction.AREA)
{
openStage = Table.area_info.areaInfo[posData.actionPara.area].openStage;
if(!GameMath.ModeTrace && openStage != "" && !StageCenter.getIns().isStageUnlock(openStage))
{
this.visible = false;
}
}
if(TaskCenter.getIns().hasTaskByPosition(posData.posId))
{
mc_task.visible = true;
}
else
{
mc_task.visible = false;
}
if(spIcon != null)
{
spIcon.dispose();
while(container_img.numChildren > 0)
{
container_img.removeChildAt(0);
}
}
spIcon = new NetBitImg(posData.position.img);
container_img.addChild(spIcon);
spIcon.x = posData.position.imgFloatX;
spIcon.y = posData.position.imgFloatY;
this.x = posData.position.x;
this.y = posData.position.y;
container_img.scaleX = container_img.scaleY = posData.position.imgScale;
}
override public function dispose() : void
{
super.dispose();
GlobalBroadcast.removeEventListener(MYREvent.DAY_CHANGE,dayChange);
GlobalBroadcast.removeEventListener(MYREvent.TASK_CHANGE,taskChange);
GlobalBroadcast.removeEventListener(MYREvent.STAGE_UPDATE,taskChange);
PiLightButton.btnTouchLight.removeDisplay(this);
}
}
}
@@ -0,0 +1,51 @@
package net.pixvi.myr.panel.wild
{
import net.pixvi.myr.center.Master;
import net.pixvi.myr.center.Table;
public class AreaVo
{
public var area:String;
public function AreaVo(area:String = null)
{
super();
if(area != null)
{
this.area = area;
}
}
public function get name() : String
{
return table().name;
}
public function get des() : String
{
return table().des;
}
public function get openStage() : String
{
return table().openStage;
}
public function get isOpen() : Boolean
{
return Master.history.unlockStage[openStage] != null;
}
public function get city() : String
{
return table().city;
}
public function table() : Object
{
return Table.area_info.areaInfo[area];
}
}
}
@@ -0,0 +1,94 @@
package net.pixvi.myr.panel.wild
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import net.pixvi.common.view.FF;
import net.pixvi.myr.center.TaskCenter;
import net.pixvi.myr.element.boss.BossVo;
import net.pixvi.myr.event.MYREvent;
import net.pixvi.pfw.display.NetBitImg;
import net.pixvi.pfw.ui.UIComponent;
import net.pixvi.pfw.ui.controls.PiLoopMC;
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
import net.pixvi.psg.ui.controller.PiLightButton;
public class BossIconUI extends UIComponent
{
public var container_img:Sprite;
public var mc_task:PiLoopMC;
public var vo:BossVo;
public var spIcon:NetBitImg;
public function BossIconUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
{
skin = FF.getMC("ui.BossStageIconUI");
super(skin,auto,w,h);
}
override public function onSkinComplete() : void
{
PiLightButton.btnTouchLight.setDisplay(this);
mc_task.mouseChildren = mc_task.mouseEnabled = false;
container_img = new Sprite();
addChild(container_img);
GlobalBroadcast.addEventListener(MYREvent.BOSS_STATUS_UPDATE,bossStatusHandler);
}
public function bossStatusHandler(e:MYREvent = null) : void
{
update();
}
public function setBossVo(bossvo:BossVo) : void
{
vo = bossvo;
update();
}
public function update() : void
{
if(vo.isShow())
{
this.visible = true;
if(TaskCenter.getIns().hasTaskByPosition("boss_" + this.vo.bossId))
{
mc_task.visible = true;
}
else
{
mc_task.visible = false;
}
if(spIcon != null)
{
spIcon.dispose();
while(container_img.numChildren > 0)
{
container_img.removeChildAt(0);
}
}
spIcon = new NetBitImg(vo.position.img);
container_img.addChild(FF.getBS("img.Shadow",false,true));
container_img.addChild(spIcon);
spIcon.x = vo.position.imgFloatX;
spIcon.y = vo.position.imgFloatY;
this.x = vo.position.x;
this.y = vo.position.y;
container_img.scaleX = container_img.scaleY = vo.position.imgScale;
return;
}
this.visible = false;
}
override public function dispose() : void
{
super.dispose();
GlobalBroadcast.removeEventListener(MYREvent.BOSS_STATUS_UPDATE,bossStatusHandler);
PiLightButton.btnTouchLight.removeDisplay(this);
}
}
}
@@ -0,0 +1,135 @@
package net.pixvi.myr.panel.wild
{
import com.greensock.TweenMax;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Sprite;
import net.pixvi.common.view.FF;
import net.pixvi.myr.center.TaskCenter;
import net.pixvi.myr.element.stage.StageVo;
import net.pixvi.myr.event.MYREvent;
import net.pixvi.pfw.display.NetBitImg;
import net.pixvi.pfw.ui.UIComponent;
import net.pixvi.pfw.ui.controls.PiBitTextField;
import net.pixvi.pfw.ui.controls.PiLoopMC;
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
import net.pixvi.psg.ui.controller.PiLightButton;
public class StageIconUI extends UIComponent
{
public var mc_star:MovieClip;
public var mc_icon:MovieClip;
public var container_img:Sprite;
public var mc_task:PiLoopMC;
public var vo:StageVo;
public var text_name:PiBitTextField;
public var spIcon:NetBitImg;
public function StageIconUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
{
super(skin,auto,w,h);
}
override public function onSkinComplete() : void
{
mc_star.stop();
PiLightButton.btnTouchLight.setDisplay(this);
mc_icon.stop();
mc_task.mouseChildren = mc_task.mouseEnabled = false;
GlobalBroadcast.addEventListener(MYREvent.STAGE_UPDATE,passStageHandler);
}
public function passStageHandler(e:MYREvent = null) : void
{
if(e.data.stageid == vo.id)
{
TweenMax.fromTo(this,0.8,{"tint":16777215},{"removeTint":true});
update();
}
}
public function setStageVo(stagevo:StageVo) : void
{
vo = stagevo;
update();
}
public function update() : void
{
if(!vo.getShow())
{
this.visible = false;
return;
}
this.visible = true;
if(vo.getUnlock())
{
mc_star.gotoAndStop(vo.getStar() + 1);
this.mouseChildren = this.mouseEnabled = true;
}
else
{
this.mouseChildren = this.mouseEnabled = false;
}
text_name.text = vo.tagname;
if(TaskCenter.getIns().hasTaskByPosition("city" + this.vo.city + "_wild_stage" + this.vo.id))
{
mc_task.visible = true;
}
else
{
mc_task.visible = false;
}
if(vo.posmode)
{
mc_icon.gotoAndStop(2);
mc_star.visible = false;
}
else
{
mc_icon.gotoAndStop(1);
mc_star.visible = true;
}
if(vo.hasSpIcon)
{
mc_icon.visible = false;
if(spIcon == null || spIcon.src != vo.spIconImg)
{
if(spIcon != null)
{
spIcon.dispose();
while(container_img.numChildren > 0)
{
container_img.removeChildAt(0);
}
}
spIcon = new NetBitImg(vo.spIconImg);
container_img.addChild(FF.getBS("img.Shadow",false,true));
container_img.addChild(spIcon);
spIcon.x = vo.spIconFloatX;
spIcon.y = vo.spIconFloatY;
container_img.scaleX = container_img.scaleY = vo.spIconScale;
}
}
else
{
mc_icon.visible = true;
}
}
override public function dispose() : void
{
super.dispose();
GlobalBroadcast.removeEventListener(MYREvent.STAGE_UPDATE,passStageHandler);
PiLightButton.btnTouchLight.removeDisplay(this);
}
}
}
@@ -0,0 +1,369 @@
package net.pixvi.myr.panel.wild
{
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
import net.pixvi.common.center.SoundCenter;
import net.pixvi.common.utils.Engine2D;
import net.pixvi.common.utils.Gesturer;
import net.pixvi.common.utils.StageLocator;
import net.pixvi.common.view.FF;
import net.pixvi.myr.GameSetting;
import net.pixvi.myr.center.BossCenter;
import net.pixvi.myr.center.Table;
import net.pixvi.myr.element.boss.BossVo;
import net.pixvi.myr.element.snd.GameSound;
import net.pixvi.myr.element.stage.StageVo;
import net.pixvi.pfw.display.NetBitImg;
import net.pixvi.pfw.driver.EnterFrameDriver;
import net.pixvi.pfw.event.MobiEvent;
import net.pixvi.pfw.event.PiEvent;
import net.pixvi.pfw.ui.UIComponent;
import net.pixvi.pfw.utils.Locator;
public class StageMap extends UIComponent
{
public static var STAGE_CLICK:String = "stageClick";
public static var AREA_CLICK:String = "areaClick";
public static var BOSS_CLICK:String = "bossClick";
public static var POSITION_CLICK:String = "posClick";
public var stageicons:Array = [];
public var areaicons:Array = [];
public var bossicons:Array = [];
public var posIcons:Array = [];
public var city:int;
public var area:String;
public var gesturer:Gesturer;
public var engine:Engine2D;
public var rec:Rectangle;
public var createStageIconUI:Object;
public function StageMap(city:int, area:String = null)
{
var ui:String = null;
var switchSkin:DisplayObject = null;
var skinmc:MovieClip = null;
var skinsp:Sprite = null;
this.city = city;
this.area = area;
if(area != null)
{
ui = "ui.WildStage" + area;
}
else
{
ui = "ui.WildStage" + city;
this.area = city.toString();
}
if(!isTableArea)
{
skinmc = FF.getMC(ui);
buildUIByAreaTable(skinmc);
switchSkin = skinmc;
}
else
{
skinsp = new Sprite();
buildUIByAreaTable(skinsp);
switchSkin = skinsp;
}
super(switchSkin);
engine = new Engine2D(0,0,0,0,0.86);
}
public function buildUIByAreaTable(uiskin:DisplayObjectContainer) : void
{
var bgImg:NetBitImg = null;
var stageIconUI:Sprite = null;
createStageIconUI = {};
if(isTableArea)
{
bgImg = new NetBitImg(areaTable().img);
uiskin.addChild(bgImg);
}
if(areaTable() != null)
{
for each(var stageo:Object in areaTable().stages)
{
stageIconUI = FF.getMC("ui.StageFlagUI");
stageIconUI.name = "stage_" + stageo.stageId;
stageIconUI.x = stageo.x;
stageIconUI.y = stageo.y;
createStageIconUI["stage_" + stageo.stageId] = stageIconUI;
uiskin.addChild(stageIconUI);
}
}
}
public function get isTableArea() : Boolean
{
return areaTable() != null && areaTable().img != null && areaTable().img != "";
}
public function areaTable() : Object
{
return Table.area_info.areaMap[this.area];
}
public function get draging() : Boolean
{
return gesturer.draging;
}
override public function onSkinComplete() : void
{
var i:int = 0;
var dis:DisplayObject = null;
var stageid:String = null;
var stagevo:StageVo = null;
var si:StageIconUI = null;
var areaid:String = null;
var areavo:AreaVo = null;
var ai:AreaIconUI = null;
var j:int = 0;
var bvo:BossVo = null;
var bossarea:String = null;
var bi:BossIconUI = null;
var posData:Object = null;
var di:AreaPositionIconUI = null;
var skinc:DisplayObjectContainer = skinAsContainer;
for(i = 0; i < skinc.numChildren; )
{
dis = skinc.getChildAt(i);
if(dis.name.indexOf("stage_") == 0)
{
stageid = dis.name.replace("stage_","");
stagevo = new StageVo();
stagevo.id = stageid;
if(createStageIconUI != null && createStageIconUI["stage_" + stagevo.id] != null)
{
si = new StageIconUI(createStageIconUI["stage_" + stagevo.id]);
}
else
{
si = new StageIconUI(skin["stage_" + stagevo.id]);
}
si.setStageVo(stagevo);
stageicons.push(si);
si.addEventListener("click",stageClickHandler);
}
else if(dis.name.indexOf("area_") == 0)
{
areaid = dis.name.replace("area_","");
areavo = new AreaVo();
areavo.area = areaid;
ai = new AreaIconUI(skin["area_" + areaid]);
ai.setAreaVo(areavo);
ai.addEventListener("click",areaClickHandler);
}
i++;
}
for(j = 0; j < BossCenter.getIns().bossData.length; )
{
bvo = BossCenter.getIns().bossData[j];
bossarea = area;
if(bossarea == null)
{
bossarea = city.toString();
}
if(bvo.position != null && bvo.position.area == bossarea)
{
bi = new BossIconUI();
bi.setBossVo(bvo);
bi.addEventListener("click",bossClickHandler);
bossicons.push(bi);
bi.x = bvo.position.x;
bi.y = bvo.position.y;
skinAsContainer.addChild(bi);
}
j++;
}
if(areaTable() != null)
{
for each(var o:Object in areaTable().positions)
{
posData = o;
di = new AreaPositionIconUI();
di.setPosData(o);
di.addEventListener("click",positionClickHandler);
posIcons.push(di);
di.x = posData.position.x;
di.y = posData.position.y;
skinAsContainer.addChild(di);
}
}
StageLocator.setfullWithNoFix(skinc,1,"center","center");
gesturer = new Gesturer(this,true);
gesturer.addEventListener(Gesturer.DRAG,dragHandler);
gesturer.addEventListener(Gesturer.TAP_OVER,dragOverHandler);
gesturer.start();
this.addEventListener(MobiEvent.MOUSE_DOWN,tapDownHandler);
Locator.setInStageRectangleByDisplay(this);
}
public function tapDownHandler(e:Event = null) : void
{
engine.speedX = 0;
engine.speedY = 0;
}
public function dragHandler(e:Event) : void
{
var skinc:DisplayObjectContainer = skinAsContainer;
rec = Locator.getInStageRectangleByDisplay(this,0,0,false);
GameSetting.fixDragRecWithMainUI(rec,1,false);
this.startMoveDrag(false,rec);
}
public function dragOverHandler(e:Event = null) : void
{
engine.speedX = gesturer.speedX;
engine.speedY = gesturer.speedY;
this.stopMoveDrag();
EnterFrameDriver.getInstance().regist(step);
}
public function step() : void
{
if(engine.hasSpeed && rec != null)
{
engine.step(this);
engine.autoSetSpeedByViewInRect(this,rec);
}
else
{
EnterFrameDriver.getInstance().remove(step);
}
}
public function stageClickHandler(e:Event = null) : void
{
if(!gesturer.draging)
{
SoundCenter.getIns().play(GameSound.effect_click1);
dispatchEvent(new PiEvent(StageMap.STAGE_CLICK,(e.currentTarget as StageIconUI).vo));
}
}
public function areaClickHandler(e:Event = null) : void
{
if(!gesturer.draging)
{
SoundCenter.getIns().play(GameSound.effect_click1);
dispatchEvent(new PiEvent(StageMap.AREA_CLICK,(e.currentTarget as AreaIconUI).vo));
}
}
public function bossClickHandler(e:Event = null) : void
{
if(!gesturer.draging)
{
SoundCenter.getIns().play(GameSound.effect_click1);
dispatchEvent(new PiEvent(StageMap.BOSS_CLICK,(e.currentTarget as BossIconUI).vo));
}
}
public function positionClickHandler(e:Event = null) : void
{
if(!gesturer.draging)
{
SoundCenter.getIns().play(GameSound.effect_click1);
dispatchEvent(new PiEvent(StageMap.POSITION_CLICK,(e.currentTarget as AreaPositionIconUI).posData));
}
}
public function update() : void
{
for each(var si:StageIconUI in stageicons)
{
si.update();
}
for each(var ai:AreaIconUI in areaicons)
{
ai.update();
}
for each(var bi:BossIconUI in bossicons)
{
bi.update();
}
for each(var aii:AreaPositionIconUI in posIcons)
{
aii.update();
}
}
public function updateBoss() : void
{
for each(var bi:BossIconUI in bossicons)
{
bi.update();
}
}
public function getStageIcon(stageid:String) : StageIconUI
{
for each(var stagei:StageIconUI in stageicons)
{
if(stagei.vo.id == stageid)
{
return stagei;
}
}
return null;
}
public function getAreaIcon(areaid:String) : AreaIconUI
{
for each(var ai:AreaIconUI in areaicons)
{
if(ai.vo.area == areaid)
{
return ai;
}
}
return null;
}
public function getBossIcon(bossid:String) : BossIconUI
{
for each(var bi:BossIconUI in bossicons)
{
if(bi.vo.bossId == bossid)
{
return bi;
}
}
return null;
}
public function refreshCondition() : void
{
}
override public function dispose() : void
{
EnterFrameDriver.getInstance().remove(step);
gesturer.removeEventListener(Gesturer.DRAG,dragHandler);
gesturer.removeEventListener(Gesturer.TAP_OVER,dragOverHandler);
super.dispose();
}
}
}
@@ -0,0 +1,56 @@
package net.pixvi.myr.panel.wild
{
import flash.display.DisplayObject;
import net.pixvi.myr.center.ExploreCenter;
import net.pixvi.myr.center.Master;
import net.pixvi.myr.center.TaskCenter;
import net.pixvi.pfw.ui.UIComponent;
import net.pixvi.pfw.ui.controls.PiLoopMC;
import net.pixvi.psg.ui.controller.PiLightButton;
public class WildBottomUI extends UIComponent
{
public var btn_city:PiLightButton;
public var btn_explore:PiLightButton;
public var mc_tipExplore:PiLoopMC;
public var btn_mine:PiLightButton;
public var mc_taskTip_mine:PiLoopMC;
public function WildBottomUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
{
super(skin,autoViewSize,w,h);
}
public function update() : void
{
mc_tipExplore.x = btn_explore.x + 91;
mc_tipExplore.y = btn_explore.y;
if(btn_explore.visible == true && ExploreCenter.getIns().hasFinishExplore())
{
mc_tipExplore.visible = true;
}
else
{
mc_tipExplore.visible = false;
}
if(WildPanel.getIns().curAreaVo != null)
{
btn_mine.visible = false;
}
if(TaskCenter.getIns().hasTaskByPosition("city" + Master.curCityId + "_mine") && WildPanel.getIns().curAreaVo == null)
{
mc_taskTip_mine.visible = true;
}
else
{
mc_taskTip_mine.visible = false;
}
}
}
}
@@ -0,0 +1,475 @@
package net.pixvi.myr.panel.wild
{
import com.greensock.TweenMax;
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.GameSetting;
import net.pixvi.myr.center.CityCenter;
import net.pixvi.myr.center.GuideCenter;
import net.pixvi.myr.center.Master;
import net.pixvi.myr.center.PosCenter;
import net.pixvi.myr.center.Table;
import net.pixvi.myr.element.boss.BossVo;
import net.pixvi.myr.element.city.CityVo;
import net.pixvi.myr.element.guide.GMain;
import net.pixvi.myr.element.guide.GSub;
import net.pixvi.myr.element.stage.StageVo;
import net.pixvi.myr.event.MYREvent;
import net.pixvi.myr.panel.boss.BossStagePanel;
import net.pixvi.myr.panel.city.CityPanel;
import net.pixvi.myr.panel.explore.ExplorePanel;
import net.pixvi.myr.panel.gameroom.GameRoomPanel;
import net.pixvi.myr.panel.guide.NewFunctionGuidePanel;
import net.pixvi.myr.panel.loopStagePanel.LoopStagePanel;
import net.pixvi.myr.panel.mainmenu.MainMenu;
import net.pixvi.myr.panel.mine.MinePanel;
import net.pixvi.myr.panel.stage.StagePanel;
import net.pixvi.myr.panel.stagegzxb.StageGzxbPanel;
import net.pixvi.myr.panel.stagejbl.StageJblPanel;
import net.pixvi.myr.panel.stagejr.StageJRPanel;
import net.pixvi.myr.panel.stagelnp.StageLnp2Panel;
import net.pixvi.myr.panel.stagelnp.StageLnpPanel;
import net.pixvi.myr.panel.stagemj.StageMjPanel;
import net.pixvi.myr.panel.stagept.StagePtPanel;
import net.pixvi.myr.panel.stagesp.StageSpPanel;
import net.pixvi.myr.panel.stagesyc.StageSycPanel;
import net.pixvi.myr.panel.stagexm1.StageXm1Panel;
import net.pixvi.myr.panel.stagexm2.StageXm2Panel;
import net.pixvi.myr.panel.stagexxs.StageXxsPanel;
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.driver.GuideDriver;
import net.pixvi.psg.ui.PSGPopPanel;
public class WildPanel extends PSGPopPanel
{
public var ui:WildPanelUI = new WildPanelUI();
public var curCityVo:CityVo;
public var curAreaVo:AreaVo;
public var stageMap:StageMap;
public var showOutMode:String = "";
public function WildPanel()
{
addChild(ui);
super();
ui.ui_bottom.btn_city.onClick(cityHandler);
ui.ui_bottom.btn_explore.onClick(exploreHandler);
ui.ui_bottom.btn_mine.onClick(mineHandler);
}
public static function getIns() : WildPanel
{
return Singleton.getInstanceOrCreate(WildPanel) as WildPanel;
}
override public function showOut() : void
{
baseShowOut();
if(showOutMode == "in")
{
TweenMax.fromTo(stageMap,GameSetting.PanelTransTime,{
"scaleX":1,
"scaleY":1
},{
"scaleX":1.05,
"scaleY":1.05,
"onComplete":showOutEnd
});
}
else if(showOutMode == "none")
{
showOutEnd();
}
else
{
TweenMax.fromTo(stageMap,GameSetting.PanelTransTime,{},{"onComplete":showOutEnd});
}
}
private function exploreHandler(e:Event) : void
{
ExplorePanel.getIns().mineMode = false;
if(curAreaVo == null || Table.area_info.areaInfo[curAreaVo.area].explore == null)
{
ExplorePanel.getIns().team = "normal";
}
else
{
ExplorePanel.getIns().team = Table.area_info.areaInfo[curAreaVo.area].explore;
}
trace("探索分组:",ExplorePanel.getIns().team);
PopCenter.POP(ExplorePanel.getIns());
}
public function mineHandler(e:Event = null) : void
{
if(!stageMap.draging || e.target == ui.ui_bottom.btn_mine)
{
showOutMode = "none";
this.showOut();
MinePanel.getIns().popInWith(this);
}
}
public function setWild(cityId:int, area:String = null, transArea:Boolean = false) : void
{
var curAreaId:String = null;
if(curAreaVo != null)
{
curAreaId = curAreaVo.area;
}
if(curCityVo != null && curCityVo.cid == cityId && curAreaId == area)
{
stageMap.update();
}
else
{
curCityVo = CityCenter.getIns().curCity;
if(area != null)
{
curAreaVo = new AreaVo(area);
}
else
{
curAreaVo = null;
}
if(stageMap != null)
{
stageMap.dispose();
}
stageMap = new StageMap(curCityVo.cid,area);
addChildAt(stageMap,0);
stageMap.addEventListener(StageMap.STAGE_CLICK,clickStageHandler);
stageMap.addEventListener(StageMap.AREA_CLICK,clickAreaHandler);
stageMap.addEventListener(StageMap.BOSS_CLICK,clickBossHandler);
stageMap.addEventListener(StageMap.POSITION_CLICK,clickPositionHandler);
if(transArea)
{
TweenMax.fromTo(stageMap,0.3,{"alpha":0},{"alpha":1});
}
updateInfo();
}
if(curAreaVo != null)
{
if(Table.area_info.areaInfo[curAreaVo.area].explore != null)
{
if(Table.area_info.areaInfo[curAreaVo.area].exploreOpenStage == "" || Master.history.passStage[Table.area_info.areaInfo[curAreaVo.area].exploreOpenStage] != null)
{
ui.ui_bottom.btn_explore.visible = true;
}
else
{
ui.ui_bottom.btn_explore.visible = false;
}
}
else
{
ui.ui_bottom.btn_explore.visible = false;
}
}
else
{
ui.ui_bottom.btn_explore.visible = true;
}
}
private function enableMouse() : void
{
ui.ui_bottom.mouseChildren = ui.ui_bottom.mouseEnabled = true;
}
override public function init() : void
{
showOutMode = "";
ui.ui_bottom.mouseChildren = ui.ui_bottom.mouseEnabled = false;
if(openPanel is CityPanel)
{
TweenMax.fromTo(stageMap,0.3,{
"scaleX":1.05,
"scaleY":1.05,
"alpha":0
},{
"alpha":1,
"scaleX":1,
"scaleY":1,
"onComplete":enableMouse
});
}
else
{
TweenMax.fromTo(stageMap,0.3,{"alpha":0},{
"alpha":1,
"onComplete":enableMouse
});
}
ui.ui_bottom.btn_explore.visible = Master.history.openExplore;
ui.ui_bottom.btn_mine.visible = Master.history.openMine;
addChild(MainMenu.getIns(this));
addChild(ui.ui_bottom);
MainMenu.getIns().onIn();
MainMenu.getIns().ui.wildMode();
GlobalBroadcast.addEventListener(MYREvent.TASK_CHANGE,taskChangeHandler);
addChild(CityPanel.getIns().ui.ui_top);
if(curAreaVo != null)
{
if(Table.area_info.areaInfo[curAreaVo.area].explore != null)
{
if(Table.area_info.areaInfo[curAreaVo.area].exploreOpenStage == "" || Master.history.passStage[Table.area_info.areaInfo[curAreaVo.area].exploreOpenStage] != null)
{
ui.ui_bottom.btn_explore.visible = true;
}
else
{
ui.ui_bottom.btn_explore.visible = false;
}
}
else
{
ui.ui_bottom.btn_explore.visible = false;
}
}
else
{
ui.ui_bottom.btn_explore.visible = true;
}
updateInfo();
stageMap.updateBoss();
guide();
}
public function guide(e:Event = null) : void
{
var stageicon:StageIconUI = null;
var p:NewFunctionGuidePanel = null;
p = null;
if(!GuideCenter.getIns().checkFin(GSub.START_WILD))
{
GuideCenter.getIns().fin(GSub.START_WILD);
StoryPanel.getIns().start("sys_guide_9",guide);
}
else if(GuideCenter.getIns().checkCur(GMain.goWild2))
{
stageicon = stageMap.getStageIcon("0101");
GuideCenter.getIns().fin();
if(stageicon != null)
{
GuideDriver.getIns().guideDisplay(stageicon,"ui.guideicon_goWild2",false);
}
}
if(ui.ui_bottom.btn_explore.visible && !GuideCenter.getIns().checkFin(GSub.OPEN_EXPLORE))
{
GuideCenter.getIns().fin(GSub.OPEN_EXPLORE);
p = new NewFunctionGuidePanel();
p.modeExplore();
PopCenter.POP(p);
}
else if(ui.ui_bottom.btn_mine.visible && !GuideCenter.getIns().checkFin(GSub.OPEN_MINE))
{
GuideCenter.getIns().fin(GSub.OPEN_MINE);
p = new NewFunctionGuidePanel();
p.modeMine();
p.addEventListener("showoutend",guide);
PopCenter.POP(p);
}
else if(GuideCenter.getIns().checkFin(GSub.OPEN_MINE) && !GuideCenter.getIns().checkFin(GSub.GUIDE_MINE))
{
GuideDriver.getIns().guideDisplay(ui.ui_bottom.btn_mine,"",false);
}
}
public function update() : void
{
if(curAreaVo != null)
{
PosCenter.activity("city" + CityPanel.getIns().curCityVo.cid + "_wild_" + curAreaVo.area);
}
else
{
PosCenter.activity("city" + CityPanel.getIns().curCityVo.cid + "_wild");
}
stageMap.update();
}
public function updateInfo() : void
{
if(curAreaVo != null)
{
CityPanel.getIns().ui.ui_top.text_des.text = curAreaVo.des.replace("{name}",Master.name);
CityPanel.getIns().ui.ui_top.text_name.text = curAreaVo.name.replace("{name}",Master.name);
}
else
{
CityPanel.getIns().ui.ui_top.text_des.text = CityCenter.getIns().curCity.wildDes;
CityPanel.getIns().ui.ui_top.text_name.text = lang("{0}地区",CityCenter.getIns().curCity.name);
}
if(curAreaVo != null)
{
PosCenter.activity("city" + CityPanel.getIns().curCityVo.cid + "_wild_" + curAreaVo.area);
}
else
{
PosCenter.activity("city" + CityPanel.getIns().curCityVo.cid + "_wild");
}
ui.ui_bottom.btn_mine.visible = Master.history.openMine;
ui.update();
}
private function taskChangeHandler(t:Event = null) : void
{
update();
}
public function clickStageHandler(e:PiEvent = null) : void
{
showOutMode = "";
var map:StageVo = e.data as StageVo;
if(map.spData != null && map.spData.tag == "slmzx" && !Master.history.openSLMZX)
{
Alert.showMsg(lang("赛拉姆之星好像还没有开放。"));
return;
}
this.showOut();
if(map.posmode)
{
if(map.spData != null && map.spData.tag == "lnp")
{
StageLnpPanel.getIns().curstage = map;
StageLnpPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "lnp2")
{
StageLnp2Panel.getIns().curstage = map;
StageLnp2Panel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "gzxb")
{
StageGzxbPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "mj")
{
StageMjPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "jr")
{
StageJRPanel.getIns().curstage = map;
StageJRPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "xxs")
{
StageXxsPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "syc")
{
StageSycPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "jbl")
{
StageJblPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "xm1")
{
StageXm1Panel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "xm2")
{
StageXm2Panel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "pt")
{
StagePtPanel.getIns().popInWith(this);
}
else if(map.spData != null && map.spData.tag == "slmzx")
{
GameRoomPanel.getIns().popInWith(this);
GameRoomPanel.getIns().prePanel = this;
}
else
{
StageSpPanel.getIns().curstage = map;
StageSpPanel.getIns().popInWith(this);
}
}
else
{
StagePanel.getIns().curstage = map;
StagePanel.getIns().popInWith(this);
}
}
public function clickAreaHandler(e:PiEvent = null) : void
{
var areavo:AreaVo = e.data as AreaVo;
setWild(curCityVo.cid,areavo.area,true);
}
public function clickBossHandler(e:PiEvent = null) : void
{
var boss:BossVo = e.data as BossVo;
showOutMode = "";
this.showOut();
BossStagePanel.getIns().curVo = boss;
BossStagePanel.getIns().popIn();
}
public function clickPositionHandler(e:PiEvent = null) : void
{
var areavo:AreaVo = null;
var posData:Object = e.data;
switch(posData.action)
{
case AreaPositionAction.AREA:
areavo = new AreaVo(posData.actionPara.area);
setWild(curCityVo.cid,areavo.area,true);
break;
case AreaPositionAction.DUNGEON:
showOutMode = "";
this.showOut();
LoopStagePanel.curDungeon = posData.actionPara.dungeon;
LoopStagePanel.getIns().openPanel2 = this;
LoopStagePanel.getIns().popIn();
}
}
public function cityHandler(e:Event = null) : void
{
if(curAreaVo != null && curAreaVo.area.indexOf("gzxb") == 0)
{
showOutMode = "in";
this.showOut();
PopCenter.POP(StageGzxbPanel.getIns());
return;
}
if(curAreaVo != null)
{
setWild(curCityVo.cid,null,true);
return;
}
if(!stageMap.draging || e.target == ui.ui_bottom.btn_city)
{
showOutMode = "in";
this.showOut();
CityPanel.getIns().popInWith(this);
}
}
override public function dispose() : void
{
if(buffMode == false)
{
GlobalBroadcast.removeEventListener(MYREvent.TASK_CHANGE,taskChangeHandler);
}
super.dispose();
}
}
}
@@ -0,0 +1,31 @@
package net.pixvi.myr.panel.wild
{
import flash.display.DisplayObject;
import net.pixvi.common.utils.StageLocator;
import net.pixvi.common.view.FF;
import net.pixvi.pfw.ui.UIComponent;
public class WildPanelUI extends UIComponent
{
public var ui_bottom:WildBottomUI;
public function WildPanelUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
{
skin = FF.getMC("ui.WildPanelUI");
super(skin,auto,w,h);
}
override public function onSkinComplete() : void
{
StageLocator.setSide(ui_bottom,"none","bottom",0,0);
StageLocator.setSide(ui_bottom.btn_city,"left","none",0,0);
}
public function update() : void
{
ui_bottom.update();
}
}
}