Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiListItem;
|
||||
|
||||
public class MineDropListItem extends PiListItem
|
||||
{
|
||||
|
||||
public var container_img:PiImgContainer;
|
||||
|
||||
public function MineDropListItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
container_img.setSize(65,65);
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
var item:ItemVo = value as ItemVo;
|
||||
container_img.loadNetBitImg(item.imgsrc,true,true,0);
|
||||
TipCenter.registTextTip(this,item.name);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
TipCenter.remove(this);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.StageCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.stage.StageVo;
|
||||
import net.pixvi.pfw.display.NetImg;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class MineLayer extends PiSprite
|
||||
{
|
||||
|
||||
public var mineType:String = "mine1";
|
||||
|
||||
public var layer:int = 0;
|
||||
|
||||
public var stageObjects:Array = [];
|
||||
|
||||
public var ui:MineLayerUI;
|
||||
|
||||
public function MineLayer()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function buildView() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var objdata:Object = null;
|
||||
var stagevo:StageVo = null;
|
||||
var mineObj:MineObject = null;
|
||||
var bgData:Object = Table.mine_info.layerBg[table.bg];
|
||||
if(bgData == null)
|
||||
{
|
||||
Alert.showMsg("can\'t find mineLayerBg:" + table.bg);
|
||||
return;
|
||||
}
|
||||
var bg:NetImg = new NetImg(bgData.img);
|
||||
bg.y = bgData.floatY;
|
||||
addChild(bg);
|
||||
var objs:Array = table.objs;
|
||||
for(i = objs.length - 1; i >= 0; i--)
|
||||
{
|
||||
objdata = objs[i];
|
||||
if(objdata.passHide && StageCenter.getIns().isStagePass(objdata.stageId))
|
||||
{
|
||||
stagevo = new StageVo();
|
||||
stagevo.id = objdata.stageId;
|
||||
if(stagevo.nextStageIsAllUnlock())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mineObj = new MineObject();
|
||||
mineObj.buildView(objdata);
|
||||
mineObj.x = objdata.x;
|
||||
mineObj.y = objdata.y;
|
||||
if(objdata.type == "stage")
|
||||
{
|
||||
stageObjects.push(mineObj);
|
||||
}
|
||||
addChild(mineObj);
|
||||
}
|
||||
ui = new MineLayerUI();
|
||||
if(ui != null && ui.text_layerName != null)
|
||||
{
|
||||
ui.y = layerHeight - 410;
|
||||
ui.x = 4;
|
||||
addChild(ui);
|
||||
ui.text_layerName.text = table.name;
|
||||
}
|
||||
}
|
||||
|
||||
public function unlock() : Boolean
|
||||
{
|
||||
if(table.stage == "" || Master.history.unlockStage[table.stage] != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get maps() : Array
|
||||
{
|
||||
return table().maps;
|
||||
}
|
||||
|
||||
public function get stages() : Array
|
||||
{
|
||||
return table().stages;
|
||||
}
|
||||
|
||||
public function get table() : Object
|
||||
{
|
||||
return Table.mine_info.mines[mineType].layers[layer];
|
||||
}
|
||||
|
||||
public function get layerHeight() : int
|
||||
{
|
||||
return Table.mine_info.layerBg[table.bg].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class MineLayerUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_layerName:PiBitTextField;
|
||||
|
||||
public function MineLayerUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MineLayerUI");
|
||||
if(skin != null)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class MineMap extends PiSprite
|
||||
{
|
||||
|
||||
public var mineType:String = "";
|
||||
|
||||
public var layers:Array = [];
|
||||
|
||||
public function MineMap()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function buildView(mineType:String = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var l:MineLayer = null;
|
||||
if(mineType != null)
|
||||
{
|
||||
this.mineType = mineType;
|
||||
}
|
||||
var cacheY:int = 0;
|
||||
for(i = 0; i < table.layers.length; )
|
||||
{
|
||||
l = new MineLayer();
|
||||
l.mineType = mineType;
|
||||
l.layer = i;
|
||||
layers.push(l);
|
||||
if(l.unlock())
|
||||
{
|
||||
l.buildView();
|
||||
addChild(l);
|
||||
l.y = cacheY - 1;
|
||||
cacheY += l.layerHeight - 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function get table() : Object
|
||||
{
|
||||
return Table.mine_info.mines[mineType];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.bag.ItemVo;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiDataList;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MineMenuUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_start1:PiLightButton;
|
||||
|
||||
public var btn_start2:PiLightButton;
|
||||
|
||||
public var btn_start3:PiLightButton;
|
||||
|
||||
public var list_drop:PiDataList;
|
||||
|
||||
public var container_item:PiImgContainer;
|
||||
|
||||
public var text_ti:TextField;
|
||||
|
||||
public var text_item:TextField;
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public function MineMenuUI(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(40,40);
|
||||
list_drop.itemClass = MineDropListItem;
|
||||
}
|
||||
|
||||
public function update(obj:MineObject) : void
|
||||
{
|
||||
var rec:Rectangle = obj.getRect(StageDriver.stage);
|
||||
this.x = obj.x - this.width / 2;
|
||||
if(rec.y > 300)
|
||||
{
|
||||
this.y = rec.y - this.height - 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.y = rec.y + this.height + 4;
|
||||
}
|
||||
this.visible = true;
|
||||
if(obj.data.btnType == 2)
|
||||
{
|
||||
btn_start1.visible = false;
|
||||
btn_start2.visible = true;
|
||||
if(btn_start3 != null)
|
||||
{
|
||||
btn_start3.visible = false;
|
||||
}
|
||||
}
|
||||
else if(obj.data.btnType == 3)
|
||||
{
|
||||
btn_start1.visible = false;
|
||||
btn_start2.visible = false;
|
||||
if(btn_start3 != null)
|
||||
{
|
||||
btn_start3.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_start1.visible = true;
|
||||
btn_start2.visible = false;
|
||||
if(btn_start3 != null)
|
||||
{
|
||||
btn_start3.visible = false;
|
||||
}
|
||||
}
|
||||
if(obj.data.needItem != null && obj.data.needItem != "")
|
||||
{
|
||||
loadItemType(int(obj.data.needItem));
|
||||
text_item.visible = container_item.visible = true;
|
||||
text_item.text = "×1";
|
||||
if(BagCenter.getIns().getNum(obj.data.needItem) > 0)
|
||||
{
|
||||
text_item.text = "×1";
|
||||
}
|
||||
else
|
||||
{
|
||||
text_item.htmlText = Paster.font("×1","#ff3333");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text_item.visible = container_item.visible = false;
|
||||
}
|
||||
var costti:int = int(Table.stage_info[obj.data.stageId].level["1"].cost);
|
||||
text_ti.text = "×" + costti;
|
||||
var rewardvo:RewardVo = new RewardVo();
|
||||
rewardvo.setByObject(Table.stage_info[obj.data.stageId].level["1"].reward);
|
||||
list_drop.setDatas(rewardvo.getAllRewardList());
|
||||
StageDriver.keepInStage(this);
|
||||
}
|
||||
|
||||
public function loadItemType(type:int) : void
|
||||
{
|
||||
container_item.loadNetBitImg(ImgCenter.getItemImg(type));
|
||||
TipCenter.registTextTip(container_item,ItemVo.getName(type));
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
TipCenter.remove(container_item);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.StageCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.view.mon.MonView;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MineObject extends PiSprite
|
||||
{
|
||||
|
||||
public var data:Object;
|
||||
|
||||
public var img:Sprite;
|
||||
|
||||
public var monview:MonView;
|
||||
|
||||
public function MineObject()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function buildView(data:Object) : void
|
||||
{
|
||||
var mon:MonsterVo = null;
|
||||
var bimg:NetBitImg = null;
|
||||
this.data = data;
|
||||
removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
removeEventListener(MobiEvent.CLICK,getRewardHandler);
|
||||
if(data.type == "stage")
|
||||
{
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
}
|
||||
if(typeId == "monster")
|
||||
{
|
||||
monview = new MonView();
|
||||
mon = new MonsterVo(monType);
|
||||
if(data.monMode != null)
|
||||
{
|
||||
mon.mode = data.monMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
mon.mode = 2;
|
||||
}
|
||||
monview.vo = mon;
|
||||
monview.buildView();
|
||||
monview.container.scaleX = objScaleX;
|
||||
monview.container.scaleY = objScaleY;
|
||||
if(data.monHeight != null)
|
||||
{
|
||||
monview.container.y = -data.monHeight;
|
||||
}
|
||||
addChild(monview);
|
||||
}
|
||||
else
|
||||
{
|
||||
bimg = new NetBitImg(imgData.img);
|
||||
bimg.x = imgData.floatX;
|
||||
bimg.y = imgData.floatY;
|
||||
img = new Sprite();
|
||||
img.addChild(bimg);
|
||||
img.scaleX = objScaleX;
|
||||
img.scaleY = objScaleY;
|
||||
addChild(img);
|
||||
if(data.type == "reward")
|
||||
{
|
||||
if(Table.loopStage_info.rewards[data.rewardId] == null)
|
||||
{
|
||||
this.visible = false;
|
||||
return;
|
||||
}
|
||||
if(Master.activityHistory.stageRewardStatus.indexOf(data.rewardId) != -1)
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.visible = true;
|
||||
}
|
||||
addEventListener(MobiEvent.CLICK,getRewardHandler);
|
||||
this.mouseChildren = this.mouseEnabled = true;
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
dispatchEvent(new PiEvent("piselect",this,true));
|
||||
}
|
||||
|
||||
public function getRewardHandler(e:Event = null) : void
|
||||
{
|
||||
var a:Object = Table.loopStage_info;
|
||||
var loopstageobj:Object = Table.loopStage_info.rewards[data.rewardId];
|
||||
if(StageCenter.getIns().isStagePass(loopstageobj.stage))
|
||||
{
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
Caller.delayCall(startGetReward,300);
|
||||
new FlashEffect(300,16777215,1).startEffect(this);
|
||||
TweenMax.to(this,0.3,{
|
||||
"scaleX":2,
|
||||
"scaleY":2,
|
||||
"alpha":0
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.showMsg(lang("宝物被看守着..."));
|
||||
}
|
||||
}
|
||||
|
||||
private function startGetReward() : void
|
||||
{
|
||||
StageCenter.getIns().getStageOnceReward(data.rewardId,startGetRewardComplete);
|
||||
}
|
||||
|
||||
private function startGetRewardComplete(re:Object = null, rewardResultVo:RewardResultVo = null) : void
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public function get imgData() : Object
|
||||
{
|
||||
return Table.mine_info.objs[typeId];
|
||||
}
|
||||
|
||||
public function get typeId() : String
|
||||
{
|
||||
return data.typeId;
|
||||
}
|
||||
|
||||
public function get monType() : int
|
||||
{
|
||||
return data.monType;
|
||||
}
|
||||
|
||||
public function get type() : String
|
||||
{
|
||||
return data.type;
|
||||
}
|
||||
|
||||
public function get objX() : String
|
||||
{
|
||||
return data.x;
|
||||
}
|
||||
|
||||
public function get objY() : String
|
||||
{
|
||||
return data.y;
|
||||
}
|
||||
|
||||
public function get objScaleX() : Number
|
||||
{
|
||||
if(data.scaleX == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return data.scaleX;
|
||||
}
|
||||
|
||||
public function get objScaleY() : Number
|
||||
{
|
||||
if(data.scaleY == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return data.scaleY;
|
||||
}
|
||||
|
||||
public function get stageId() : String
|
||||
{
|
||||
return data.stageId;
|
||||
}
|
||||
|
||||
public function get passHide() : Boolean
|
||||
{
|
||||
return data.passHide;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.events.Event;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.Engine2D;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.myr.CP;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.GameSetting;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
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.bag.ItemVo;
|
||||
import net.pixvi.myr.element.cost.CostVo;
|
||||
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.city.CityPanel;
|
||||
import net.pixvi.myr.panel.exchange.ExchangePanel;
|
||||
import net.pixvi.myr.panel.explore.ExplorePanel;
|
||||
import net.pixvi.myr.panel.guide.NewFunctionGuidePanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.stage.StageStartPanel;
|
||||
import net.pixvi.myr.panel.story.StoryPanel;
|
||||
import net.pixvi.myr.panel.team.TeamPanel;
|
||||
import net.pixvi.myr.panel.wild.WildPanel;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.Locator;
|
||||
import net.pixvi.pfw.utils.Oncer;
|
||||
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 MinePanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:MinePanelUI = new MinePanelUI();
|
||||
|
||||
public var curCity:int = -1;
|
||||
|
||||
private var showOutMode:String = "in";
|
||||
|
||||
public var container:PiSprite;
|
||||
|
||||
public var gesturer:Gesturer;
|
||||
|
||||
public var engine:Engine2D;
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var mineMap:MineMap;
|
||||
|
||||
public var curStageId:String = "";
|
||||
|
||||
public function MinePanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super();
|
||||
engine = new Engine2D(0,0,0,0,0.86);
|
||||
container = new PiSprite();
|
||||
gesturer = new Gesturer(container,true);
|
||||
gesturer.start();
|
||||
addChild(container);
|
||||
container.y = StageLocator.MainFixVo.fix[0] + GameSetting.MainUITopHeight;
|
||||
ui.ui_bottom.btn_close.onClick(cityHandler);
|
||||
ui.ui_bottom.btn_explore.onClick(exploreHandler);
|
||||
ui.ui_bottom.btn_exchange.onClick(exchangeHandler);
|
||||
if(ui.ui_bottom.btn_zhanzheng != null)
|
||||
{
|
||||
ui.ui_bottom.btn_zhanzheng.onClick(zhanzhengHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getIns() : MinePanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(MinePanel) as MinePanel;
|
||||
}
|
||||
|
||||
public function exchangeHandler(e:Event = null) : void
|
||||
{
|
||||
ExchangePanel.getIns().mode = "mine";
|
||||
PopCenter.POP(ExchangePanel.getIns());
|
||||
}
|
||||
|
||||
public function zhanzhengHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
TeamPanel.getIns().modeBattleTeam();
|
||||
TeamPanel.getIns().popInWith(this);
|
||||
}
|
||||
|
||||
public function exploreHandler(e:Event = null) : void
|
||||
{
|
||||
ExplorePanel.getIns().mineMode = true;
|
||||
var mineData:Object = Table.mine_info.mines[Table.mine_info.cityMine[curCity]];
|
||||
ExplorePanel.getIns().mine = mineData.type;
|
||||
ExplorePanel.getIns().team = "mine1";
|
||||
PopCenter.POP(ExplorePanel.getIns());
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
if(curCity != 1)
|
||||
{
|
||||
curCity = 1;
|
||||
container.y = StageLocator.MainFixVo.fix[0] + GameSetting.MainUITopHeight;
|
||||
update();
|
||||
}
|
||||
var mineData:Object = Table.mine_info.mines[Table.mine_info.cityMine[curCity]];
|
||||
ui.ui_menu.visible = false;
|
||||
ui.ui_bottom.update();
|
||||
if(!GameMath.ModeTrace)
|
||||
{
|
||||
ui.ui_bottom.btn_explore.visible = Master.history.openExplore;
|
||||
}
|
||||
TweenMax.fromTo(container,0.3,{"alpha":0},{"alpha":1});
|
||||
addChild(ui.ui_menu);
|
||||
addChild(MainMenu.getIns(this));
|
||||
addChild(ui.ui_bottom);
|
||||
MainMenu.getIns().onIn();
|
||||
MainMenu.getIns().ui.mineMode();
|
||||
PosCenter.activity("city1_mine");
|
||||
CityPanel.getIns().ui.ui_top.text_des.text = mineData.des;
|
||||
CityPanel.getIns().ui.ui_top.text_name.text = mineData.name;
|
||||
addChild(CityPanel.getIns().ui.ui_top);
|
||||
gesturer.addEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesturer.addEventListener(Gesturer.TAP_OVER,dragOverHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.EXPLORE_STAGE_UPDATE,stageUpdateHandler);
|
||||
if(GameMath.ModeTrace || GuideCenter.getIns().checkFin(GSub.OPEN_MINE_EXCHANGE))
|
||||
{
|
||||
ui.ui_bottom.btn_exchange.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_bottom.btn_exchange.visible = false;
|
||||
}
|
||||
guide();
|
||||
}
|
||||
|
||||
public function stageUpdateHandler(e:Event = null) : void
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
public function guide() : void
|
||||
{
|
||||
var p:NewFunctionGuidePanel = null;
|
||||
var mineobj:MineObject = null;
|
||||
var point:Point = null;
|
||||
if(ui.ui_bottom.btn_explore.visible && !GuideCenter.getIns().checkFin(GSub.OPEN_MINE_EXPLORE))
|
||||
{
|
||||
GuideCenter.getIns().fin(GSub.OPEN_MINE_EXPLORE);
|
||||
p = new NewFunctionGuidePanel();
|
||||
p.modeMineExplore();
|
||||
PopCenter.POP(p);
|
||||
}
|
||||
else if(!GuideCenter.getIns().checkFin(GSub.GUIDE_MINE))
|
||||
{
|
||||
if(mineMap != null && mineMap.layers.length > 0 && mineMap.layers[0].stageObjects.length > 0)
|
||||
{
|
||||
mineobj = mineMap.layers[0].stageObjects[1] as MineObject;
|
||||
point = mineobj.localToGlobal(new Point());
|
||||
GuideCenter.getIns().fin(GSub.GUIDE_MINE);
|
||||
GuideDriver.getIns().guideRect(new Rectangle(point.x - 24,point.y - 48,50,50),"ui.guideicon_mine1",true);
|
||||
}
|
||||
}
|
||||
else if(!GuideCenter.getIns().checkFin(GSub.OPEN_MINE_EXCHANGE) && Master.history.passStage["m109"] != null)
|
||||
{
|
||||
GuideCenter.getIns().fin(GSub.OPEN_MINE_EXCHANGE);
|
||||
StoryPanel.getIns().start("sys_guide_mineex",guideExchange);
|
||||
ui.ui_bottom.btn_exchange.visible = true;
|
||||
}
|
||||
else if(ui.ui_bottom.btn_explore.visible && Master.history.passStage["m103"] != null && !GuideCenter.getIns().checkFin(GSub.GUIDE_MINE_DIG))
|
||||
{
|
||||
StoryPanel.getIns().start("sys_guide_minedig",guideMineDig);
|
||||
}
|
||||
}
|
||||
|
||||
private function guideMineDig() : void
|
||||
{
|
||||
GuideDriver.getIns().guideDisplay(ui.ui_bottom.btn_explore,"ui.guideicon_minedig");
|
||||
GuideCenter.getIns().fin(GSub.GUIDE_MINE_DIG);
|
||||
}
|
||||
|
||||
public function guideExchange() : void
|
||||
{
|
||||
GuideDriver.getIns().guideDisplay(ui.ui_bottom.btn_exchange);
|
||||
}
|
||||
|
||||
public function clickStageHandler(e:Event = null) : void
|
||||
{
|
||||
container.removeEventListener(MobiEvent.CLICK,clickStageHandler);
|
||||
ui.ui_menu.visible = false;
|
||||
}
|
||||
|
||||
public function dragHandler(e:Event) : void
|
||||
{
|
||||
ui.ui_menu.visible = false;
|
||||
rec = Locator.getInStageRectangleByDisplay(container);
|
||||
rec.width = 0;
|
||||
rec.x = container.x;
|
||||
GameSetting.fixDragRecWithMainUI(rec,container.scaleY);
|
||||
container.startMoveDrag(false,rec);
|
||||
}
|
||||
|
||||
public function dragOverHandler(e:Event = null) : void
|
||||
{
|
||||
engine.speedY = gesturer.speedY;
|
||||
container.stopMoveDrag();
|
||||
EnterFrameDriver.getInstance().regist(step);
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
if(engine.hasSpeed && rec != null)
|
||||
{
|
||||
engine.step(container);
|
||||
engine.autoSetSpeedByViewInRect(container,rec);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
}
|
||||
}
|
||||
|
||||
public function cityHandler(e:Event = null) : void
|
||||
{
|
||||
showOutMode = "out";
|
||||
this.showOut();
|
||||
WildPanel.getIns().popInWith(this);
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var recordy:Number = 0;
|
||||
if(mineMap != null)
|
||||
{
|
||||
mineMap.dispose();
|
||||
recordy = mineMap.y;
|
||||
}
|
||||
ui.ui_bottom.update();
|
||||
mineMap = new MineMap();
|
||||
mineMap.buildView(Table.mine_info.cityMine[curCity]);
|
||||
mineMap.setScale(StageLocator.MainFixVo.fixWidth / 720);
|
||||
mineMap.x = StageLocator.MainFixVo.fix[3];
|
||||
mineMap.y = recordy;
|
||||
container.addChild(mineMap);
|
||||
mineMap.addEventListener("piselect",stageHandler,false,10);
|
||||
var rec:Rectangle = Locator.getInStageRectangleByDisplay(container);
|
||||
}
|
||||
|
||||
public function stageHandler(e:PiEvent = null) : void
|
||||
{
|
||||
container.removeEventListener(MobiEvent.CLICK,clickStageHandler);
|
||||
trace(1);
|
||||
if(gesturer.draging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj:MineObject = e.target as MineObject;
|
||||
ui.ui_menu.update(obj);
|
||||
curStageId = obj.stageId;
|
||||
ui.ui_menu.btn_start1.addEventListener(MobiEvent.CLICK,startStageHandler);
|
||||
ui.ui_menu.btn_start2.addEventListener(MobiEvent.CLICK,startStageHandler);
|
||||
Oncer.lastRun(container.addEventListener,[MobiEvent.CLICK,clickStageHandler]);
|
||||
}
|
||||
|
||||
private function startStageHandler(e:Event) : void
|
||||
{
|
||||
ui.ui_menu.visible = false;
|
||||
var stage:StageVo = new StageVo();
|
||||
stage.id = curStageId;
|
||||
if(curStageId != "" && Master.history.unlockStage[curStageId] == null)
|
||||
{
|
||||
Alert.showMsg(lang("元素矿石被附近的魔物看守着..."));
|
||||
return;
|
||||
}
|
||||
var costvo:CostVo = stage.costVo;
|
||||
if(costvo != null && !BagCenter.getIns().checkCost(costvo))
|
||||
{
|
||||
Alert.yes(lang("缺少工具"),lang("缺少挖掘所需的工具:") + CP.item(ItemVo.getName(stage.costVo.items[0].typeId)));
|
||||
return;
|
||||
}
|
||||
if(StageStartPanel.checkStage(stage))
|
||||
{
|
||||
StageStartPanel.getIns().start(stage,"1",this,stageOverHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function stageOverHandler() : void
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.EXPLORE_STAGE_UPDATE,stageUpdateHandler);
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
gesturer.removeEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesturer.removeEventListener(Gesturer.TAP_OVER,dragOverHandler);
|
||||
if(!buffMode)
|
||||
{
|
||||
mineMap.removeEventListener("piselect",stageHandler);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.myr.center.ExploreCenter;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiLoopMC;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MinePanelBottomUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var btn_explore:PiLightButton;
|
||||
|
||||
public var btn_exchange:PiLightButton;
|
||||
|
||||
public var mc_tipExplore:PiLoopMC;
|
||||
|
||||
public var btn_zhanzheng:PiLightButton;
|
||||
|
||||
public function MinePanelBottomUI(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;
|
||||
mc_tipExplore.visible = ExploreCenter.getIns().hasFinishExplore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package net.pixvi.myr.panel.mine
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.GameSetting;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class MinePanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_bottom:MinePanelBottomUI;
|
||||
|
||||
public var ui_menu:MineMenuUI;
|
||||
|
||||
public function MinePanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MinePanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
ui_menu.visible = false;
|
||||
if(ui_bottom.btn_zhanzheng != null)
|
||||
{
|
||||
StageLocator.setSide(ui_bottom.btn_zhanzheng,"right","none",0);
|
||||
}
|
||||
StageLocator.setSide(ui_bottom.btn_close,"left","none");
|
||||
StageLocator.setSide(ui_bottom,"none","bottom",0,GameSetting.BottomMenuSpace + 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user