Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package net.pixvi.myr.panel.map
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.city.CityVo;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class CityUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var mc_task:MovieClip;
|
||||
|
||||
public var vo:CityVo;
|
||||
|
||||
public function CityUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
btn_yes.onClick(clickHandler);
|
||||
}
|
||||
|
||||
public function ondata(vo:CityVo) : void
|
||||
{
|
||||
mc_task.mouseChildren = mc_task.mouseEnabled = false;
|
||||
this.vo = vo;
|
||||
if(vo.unlock())
|
||||
{
|
||||
this.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
if(TaskCenter.getIns().hasTaskByPosition("city" + vo.cid))
|
||||
{
|
||||
mc_task.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_task.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event) : void
|
||||
{
|
||||
dispatchEvent(new Event("piselect"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package net.pixvi.myr.panel.map
|
||||
{
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.city.CityVo;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiLoopMC;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class CountryMapCityIcon extends UIComponent
|
||||
{
|
||||
|
||||
public var vo:CityVo;
|
||||
|
||||
public var iconData:Object;
|
||||
|
||||
public var mc_task:PiLoopMC;
|
||||
|
||||
public var container_title:PiImgContainer;
|
||||
|
||||
public var img:NetBitImg;
|
||||
|
||||
public function CountryMapCityIcon()
|
||||
{
|
||||
super(FF.getMC("ui.CountryMapIconUI"));
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function setData(data:Object) : void
|
||||
{
|
||||
iconData = data;
|
||||
vo = new CityVo(iconData.cityId);
|
||||
buildView();
|
||||
}
|
||||
|
||||
public function get charaX() : Number
|
||||
{
|
||||
return iconData.charaX;
|
||||
}
|
||||
|
||||
public function get charaY() : Number
|
||||
{
|
||||
return iconData.charaY;
|
||||
}
|
||||
|
||||
public function buildView() : void
|
||||
{
|
||||
img = new NetBitImg(iconData.img);
|
||||
addChildAt(img,0);
|
||||
this.x = iconData.x;
|
||||
this.y = iconData.y;
|
||||
container_title.x = iconData.titleX;
|
||||
container_title.y = iconData.titleY;
|
||||
container_title.loadNetBitImg(iconData.titleImg,false,false,0);
|
||||
mc_task.x = iconData.charaX * 2 - iconData.titleX;
|
||||
mc_task.y = iconData.charaY;
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
mc_task.mouseChildren = mc_task.mouseEnabled = false;
|
||||
if(!vo.unlock())
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.visible = true;
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
}
|
||||
if(TaskCenter.getIns().hasTaskByPosition("city" + vo.cid))
|
||||
{
|
||||
mc_task.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_task.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
package net.pixvi.myr.panel.map
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.driver.ActivityDriver;
|
||||
import net.pixvi.common.utils.Engine2D;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.myr.GameSetting;
|
||||
import net.pixvi.myr.center.CityCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.MasterCenter;
|
||||
import net.pixvi.myr.center.PosCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.panel.city.CityPanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.storeground.StoreGroundPanel;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.Locator;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class CountryMapPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:CountryMapPanelUI = new CountryMapPanelUI();
|
||||
|
||||
public var gesture:Gesturer;
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var engine:Engine2D;
|
||||
|
||||
public var engineCloud:Engine2D;
|
||||
|
||||
public var lockDrag:Boolean = false;
|
||||
|
||||
public var title:NetBitImg;
|
||||
|
||||
public var bg:NetBitImg;
|
||||
|
||||
public var mapdata:Object;
|
||||
|
||||
public var citys:Array = [];
|
||||
|
||||
public var curCountry:String;
|
||||
|
||||
public function CountryMapPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
gesture = new Gesturer(ui,true);
|
||||
gesture.addEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesture.addEventListener(Gesturer.TAP_OVER,dragOverHandler,false,10);
|
||||
gesture.start();
|
||||
engine = new Engine2D(0,0,0,0,0.85);
|
||||
engineCloud = new Engine2D(-0.25,-0.12,0,0,1);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.btn_back.onClick(backHandler);
|
||||
StageLocator.setSide(ui.btn_close,"left","bottom",0,30);
|
||||
StageLocator.setSide(ui.btn_back,"right","bottom",0,30);
|
||||
super(GameSetting.PanelTransTime,GameSetting.PanelTransTime);
|
||||
}
|
||||
|
||||
public static function getIns() : CountryMapPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(CountryMapPanel) as CountryMapPanel;
|
||||
}
|
||||
|
||||
public static function openCountry(countryId:String) : void
|
||||
{
|
||||
var a:Object = Table.setting;
|
||||
if(Table.setting.country_info == null || Table.setting.country_info[countryId] == null || countryId == "1" || countryId == null)
|
||||
{
|
||||
PopCenter.POP(GlobalMapPanel.getIns());
|
||||
GlobalMapPanel.getIns().openPanel = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
CountryMapPanel.getIns().setCountry(countryId);
|
||||
PopCenter.POP(CountryMapPanel.getIns());
|
||||
}
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
if(Master.curCityId == 0)
|
||||
{
|
||||
StoreGroundPanel.getIns().popIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
CityPanel.getIns().popInWith(this);
|
||||
}
|
||||
}
|
||||
|
||||
public function backHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
GlobalMapPanel.getIns().popInWith(this);
|
||||
}
|
||||
|
||||
public function dragHandler(e:Event) : void
|
||||
{
|
||||
if(lockDrag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
rec = Locator.getInStageRectangleByDisplay(bg);
|
||||
GameSetting.fixDragRecWithMainUI(rec);
|
||||
ui.startMoveDrag(false,rec);
|
||||
}
|
||||
|
||||
public function dragOverHandler(e:Event = null) : void
|
||||
{
|
||||
engine.speedX = gesture.speedX;
|
||||
engine.speedY = gesture.speedY;
|
||||
ui.stopMoveDrag();
|
||||
EnterFrameDriver.getInstance().regist(step);
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
if(engine.hasSpeed && rec != null)
|
||||
{
|
||||
engine.step(ui);
|
||||
engine.autoSetSpeedByViewInRect(ui,rec);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
}
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event) : void
|
||||
{
|
||||
if(gesture.draging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lockDrag = false;
|
||||
var cityvo:CountryMapCityIcon = e.currentTarget as CountryMapCityIcon;
|
||||
MasterCenter.getIns().goCity(cityvo.vo.cid);
|
||||
openCityPanel();
|
||||
}
|
||||
|
||||
public function openCityPanel() : void
|
||||
{
|
||||
MasterCenter.getIns().goCity(CityCenter.getIns().curCity.cid);
|
||||
this.showOut();
|
||||
CityPanel.getIns().popInWith(this);
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var flagid:String = null;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
ui["mc_yun" + i].x = (table.bgImgWidth - ui["mc_yun" + i].width) * Math.random();
|
||||
ui["mc_yun" + i].y = (table.bgImgHeight - ui["mc_yun" + i].height) * Math.random();
|
||||
i++;
|
||||
}
|
||||
EnterFrameDriver.getInstance().regist(step2);
|
||||
activity();
|
||||
if(Master.curCityId != 0)
|
||||
{
|
||||
flagid = Master.curCityId.toString();
|
||||
}
|
||||
if(flagid != null && getCityIcon(flagid) != null)
|
||||
{
|
||||
ui.mc_q.visible = true;
|
||||
ui.mc_q.x = getCityIcon(flagid).x + getCityIcon(flagid).charaX;
|
||||
ui.mc_q.y = getCityIcon(flagid).y + getCityIcon(flagid).charaY;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_q.visible = false;
|
||||
}
|
||||
StageLocator.setSide(ui);
|
||||
ui.x -= ui.mc_q.x - ui.width / 2;
|
||||
ui.y -= ui.mc_q.y - ui.height / 2;
|
||||
Locator.setInStageRectangleByDisplay(ui,bg);
|
||||
update();
|
||||
addChild(MainMenu.getIns(this));
|
||||
MainMenu.getIns().onIn();
|
||||
MainMenu.getIns().ui.mapMode();
|
||||
addChild(ui.btn_close);
|
||||
addChild(ui.btn_back);
|
||||
PosCenter.activity("country" + table.country);
|
||||
ActivityDriver.getIns().regist(activity,deactivity);
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
for each(var cui:CountryMapCityIcon in citys)
|
||||
{
|
||||
cui.update();
|
||||
}
|
||||
}
|
||||
|
||||
public function getCityIcon(cid:String) : CountryMapCityIcon
|
||||
{
|
||||
for each(var c:CountryMapCityIcon in citys)
|
||||
{
|
||||
if(c.vo.cid.toString() == cid)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function activity() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().regist(step2);
|
||||
}
|
||||
|
||||
public function deactivity() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().remove(step2);
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
engineCloud.step(ui["mc_yun" + i]);
|
||||
if(ui["mc_yun" + i].x < -ui["mc_yun" + i].width)
|
||||
{
|
||||
ui["mc_yun" + i].x = table.bgImgWidth;
|
||||
}
|
||||
if(ui["mc_yun" + i].y < -ui["mc_yun" + i].height)
|
||||
{
|
||||
ui["mc_yun" + i].y = table.bgImgHeight;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
deactivity();
|
||||
EnterFrameDriver.getInstance().remove(step2);
|
||||
ActivityDriver.getIns().remove(activity,deactivity);
|
||||
EnterFrameDriver.getInstance().remove(step2);
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
if(!buffMode)
|
||||
{
|
||||
gesture.removeEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesture.removeEventListener(Gesturer.TAP_OVER,dragOverHandler);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public function setCountry(cid:String) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var citydata:Object = null;
|
||||
var icon:CountryMapCityIcon = null;
|
||||
if(curCountry == cid)
|
||||
{
|
||||
update();
|
||||
return;
|
||||
}
|
||||
curCountry = cid;
|
||||
var countryTable:Object = Table.setting.country_info[curCountry];
|
||||
title = new NetBitImg(countryTable.titleImg);
|
||||
addChild(title);
|
||||
StageLocator.setSide(title,"left","top",countryTable.titleImgSpaceLeft,countryTable.titleImgSpaceTop);
|
||||
bg = new NetBitImg(table.bgImg);
|
||||
ui.skinAsContainer.addChildAt(bg,0);
|
||||
citys = [];
|
||||
for(i = 0; i < table.citys.length; )
|
||||
{
|
||||
citydata = table.citys[i];
|
||||
icon = new CountryMapCityIcon();
|
||||
icon.setData(citydata);
|
||||
citys.push(icon);
|
||||
ui.skinAsContainer.addChildAt(icon,1);
|
||||
icon.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
i++;
|
||||
}
|
||||
ui.skinAsContainer.addChild(ui.mc_q);
|
||||
}
|
||||
|
||||
public function get table() : Object
|
||||
{
|
||||
return Table.setting.country_info[curCountry];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package net.pixvi.myr.panel.map
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class CountryMapPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_q:MovieClip;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var mc_yun1:MovieClip;
|
||||
|
||||
public var mc_yun2:MovieClip;
|
||||
|
||||
public var mc_yun3:MovieClip;
|
||||
|
||||
public var mc_yun4:MovieClip;
|
||||
|
||||
public var btn_back:PiLightButton;
|
||||
|
||||
public function CountryMapPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.CountryMapPanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
mc_q.mouseChildren = mc_q.mouseEnabled = false;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
this["mc_yun" + i].mouseChildren = this["mc_yun" + i].mouseEnabled = false;
|
||||
i++;
|
||||
}
|
||||
mc_q.mouseChildren = mc_q.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
package net.pixvi.myr.panel.map
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Linear;
|
||||
import flash.events.Event;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.driver.ActivityDriver;
|
||||
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.GameMath;
|
||||
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.MasterCenter;
|
||||
import net.pixvi.myr.center.PosCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.guide.GMain;
|
||||
import net.pixvi.myr.element.guide.GSub;
|
||||
import net.pixvi.myr.element.npc.ConditionVo;
|
||||
import net.pixvi.myr.panel.city.CityPanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.storeground.StoreGroundPanel;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.utils.Locator;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.driver.GuideDriver;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class GlobalMapPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:GlobalMapUI = new GlobalMapUI();
|
||||
|
||||
public var gesture:Gesturer;
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var engine:Engine2D;
|
||||
|
||||
public var engineCloud:Engine2D;
|
||||
|
||||
public var engineFly:Engine2D;
|
||||
|
||||
public var flySpeed:Number = 2;
|
||||
|
||||
public var lockDrag:Boolean = false;
|
||||
|
||||
public var title:NetBitImg;
|
||||
|
||||
private var guidet:TweenMax;
|
||||
|
||||
public function GlobalMapPanel()
|
||||
{
|
||||
addChild(ui);
|
||||
gesture = new Gesturer(ui,true);
|
||||
gesture.addEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesture.addEventListener(Gesturer.TAP_OVER,dragOverHandler,false,10);
|
||||
gesture.start();
|
||||
engine = new Engine2D(0,0,0,0,0.85);
|
||||
engineFly = new Engine2D(-flySpeed,-flySpeed);
|
||||
engineCloud = new Engine2D(-0.25,-0.12,0,0,1);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
StageLocator.setSide(ui.btn_close,"left","bottom",0,30);
|
||||
super(GameSetting.PanelTransTime,GameSetting.PanelTransTime);
|
||||
}
|
||||
|
||||
public static function getIns() : GlobalMapPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(GlobalMapPanel) as GlobalMapPanel;
|
||||
}
|
||||
|
||||
public function dragHandler(e:Event) : void
|
||||
{
|
||||
if(lockDrag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
rec = Locator.getInStageRectangleByDisplay(ui.mc_bg);
|
||||
GameSetting.fixDragRecWithMainUI(rec);
|
||||
ui.startMoveDrag(false,rec);
|
||||
}
|
||||
|
||||
public function dragOverHandler(e:Event = null) : void
|
||||
{
|
||||
engine.speedX = gesture.speedX;
|
||||
engine.speedY = gesture.speedY;
|
||||
ui.stopMoveDrag();
|
||||
EnterFrameDriver.getInstance().regist(step);
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
if(engine.hasSpeed && rec != null)
|
||||
{
|
||||
engine.step(ui);
|
||||
engine.autoSetSpeedByViewInRect(ui,rec);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
}
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
engineCloud.step(ui["mc_yun" + i]);
|
||||
if(ui["mc_yun" + i].x < -ui["mc_yun" + i].width)
|
||||
{
|
||||
ui["mc_yun" + i].x = ui.mc_bg.width;
|
||||
}
|
||||
if(ui["mc_yun" + i].y < -ui["mc_yun" + i].height)
|
||||
{
|
||||
ui["mc_yun" + i].y = ui.mc_bg.height;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
engineFly.step(ui.mc_fly);
|
||||
if(ui.mc_fly.x < -100)
|
||||
{
|
||||
ui.mc_fly.y = 100 + Math.random() * 600;
|
||||
engineFly.speedX = flySpeed;
|
||||
engineFly.speedY = flySpeed * Math.random();
|
||||
ui.mc_fly.scaleX = ui.mc_fly.scaleY = Random.number(0.8,1);
|
||||
}
|
||||
if(ui.mc_fly.x > ui.mc_bg.width)
|
||||
{
|
||||
ui.mc_fly.y = 500 + Math.random() * 600;
|
||||
engineFly.speedX = -flySpeed;
|
||||
engineFly.speedY = -flySpeed * Math.random();
|
||||
ui.mc_fly.scaleX = ui.mc_fly.scaleY = Random.number(0.8,1);
|
||||
}
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event) : void
|
||||
{
|
||||
if(gesture.draging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lockDrag = false;
|
||||
MasterCenter.getIns().goCity((e.target as CityUI).vo.cid);
|
||||
openCityPanel();
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
if(guidet != null)
|
||||
{
|
||||
guidet.kill();
|
||||
}
|
||||
this.showOut();
|
||||
if(Master.curCityId == 0)
|
||||
{
|
||||
StoreGroundPanel.getIns().popIn();
|
||||
}
|
||||
else if(openPanel is CountryMapPanel)
|
||||
{
|
||||
CountryMapPanel.getIns().popIn();
|
||||
}
|
||||
else
|
||||
{
|
||||
CityPanel.getIns().popInWith(this);
|
||||
}
|
||||
}
|
||||
|
||||
public function openCityPanel() : void
|
||||
{
|
||||
if(guidet != null)
|
||||
{
|
||||
guidet.kill();
|
||||
}
|
||||
MasterCenter.getIns().goCity(CityCenter.getIns().curCity.cid);
|
||||
this.showOut();
|
||||
CityPanel.getIns().popInWith(this);
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var con:Object = null;
|
||||
var countryTable:Object = null;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
ui["mc_yun" + i].x = (ui.mc_bg.width - ui["mc_yun" + i].width) * Math.random();
|
||||
ui["mc_yun" + i].y = (ui.mc_bg.height - ui["mc_yun" + i].height) * Math.random();
|
||||
i++;
|
||||
}
|
||||
ui.mc_fly.y = 400 + Math.random() * 600;
|
||||
ui.mc_fly.x = ui.mc_bg.width * Math.random();
|
||||
engineFly.speedX = -flySpeed;
|
||||
engineFly.speedY = -flySpeed * Math.random();
|
||||
EnterFrameDriver.getInstance().regist(step2);
|
||||
activity();
|
||||
var flagid:String = "1";
|
||||
if(Master.curCityId != 0)
|
||||
{
|
||||
flagid = Master.curCityId.toString();
|
||||
}
|
||||
if(Table.game_setting.cityInfo[flagid] == null)
|
||||
{
|
||||
Alert.showMsg(flagid + "不存在的城市");
|
||||
flagid = "1";
|
||||
}
|
||||
if(Table.game_setting.cityInfo[flagid].country != null && Table.game_setting.cityInfo[flagid].country != "1")
|
||||
{
|
||||
ui.mc_q.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_q.x = ui["city_" + flagid].x;
|
||||
ui.mc_q.y = ui["city_" + flagid].y;
|
||||
ui.mc_q.visible = true;
|
||||
}
|
||||
if(ui.btn_country2 != null)
|
||||
{
|
||||
con = Table.activity_info.country2.btn.condition;
|
||||
if(ConditionVo.checkCondition(Table.activity_info.country2.btn.condition))
|
||||
{
|
||||
ui.btn_country2.visible = true;
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
ui.btn_country2.alpha = 1;
|
||||
}
|
||||
}
|
||||
else if(GameMath.ModeTrace)
|
||||
{
|
||||
ui.btn_country2.alpha = 0.6;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.btn_country2.visible = false;
|
||||
}
|
||||
ui.btn_country2.onClick(country2Handler);
|
||||
}
|
||||
StageLocator.setSide(ui);
|
||||
ui.x -= ui.mc_q.x - ui.width / 2;
|
||||
ui.y -= ui.mc_q.y - ui.height / 2;
|
||||
Locator.setInStageRectangleByDisplay(ui,ui.mc_bg);
|
||||
update();
|
||||
addChild(MainMenu.getIns(this));
|
||||
MainMenu.getIns().onIn();
|
||||
MainMenu.getIns().ui.mapMode();
|
||||
addChild(ui.btn_close);
|
||||
PosCenter.activity("map");
|
||||
if(title == null && Table.setting.country_info != null && Table.setting.country_info["1"] != null)
|
||||
{
|
||||
countryTable = Table.setting.country_info["1"];
|
||||
title = new NetBitImg(countryTable.titleImg);
|
||||
addChild(title);
|
||||
StageLocator.setSide(title,"left","top",countryTable.titleImgSpaceLeft,countryTable.titleImgSpaceTop);
|
||||
}
|
||||
guide();
|
||||
ActivityDriver.getIns().regist(activity,deactivity);
|
||||
}
|
||||
|
||||
public function country2Handler(e:Event = null) : void
|
||||
{
|
||||
if(gesture.draging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(guidet != null)
|
||||
{
|
||||
guidet.kill();
|
||||
}
|
||||
this.showOut();
|
||||
CountryMapPanel.openCountry("2");
|
||||
}
|
||||
|
||||
public function activity() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().regist(step2);
|
||||
for each(var m:Object in ui.mcs)
|
||||
{
|
||||
m.play();
|
||||
}
|
||||
}
|
||||
|
||||
public function deactivity() : void
|
||||
{
|
||||
for each(var m:Object in ui.mcs)
|
||||
{
|
||||
m.stop();
|
||||
}
|
||||
EnterFrameDriver.getInstance().remove(step2);
|
||||
}
|
||||
|
||||
public function guide() : void
|
||||
{
|
||||
if(GuideCenter.getIns().checkCur(GMain.goCity2))
|
||||
{
|
||||
GuideCenter.getIns().fin();
|
||||
lockDrag = true;
|
||||
GuideDriver.getIns().guideDisplay(ui.city_1,"ui.guideicon_city1",true);
|
||||
}
|
||||
if(Master.history.passTask["1001013"] != null && !GuideCenter.getIns().checkFin(GSub.PASS_AREA2))
|
||||
{
|
||||
ui.city_2.btn_yes.selected = true;
|
||||
guidet = TweenMax.fromTo(ui.city_2.btn_yes,0.5,{"colorTransform":{"exposure":1.3}},{
|
||||
"colorTransform":{"exposure":1},
|
||||
"repeat":100,
|
||||
"yoyo":true,
|
||||
"ease":Linear.easeIn
|
||||
});
|
||||
GuideCenter.getIns().fin(GSub.PASS_AREA2);
|
||||
}
|
||||
if(!GuideCenter.getIns().checkFin(GSub.GUIDE_COUNTRY2) && ui.btn_country2 != null && ui.btn_country2.visible == true)
|
||||
{
|
||||
GuideCenter.getIns().fin(GSub.GUIDE_COUNTRY2);
|
||||
StageLocator.setSide(ui);
|
||||
ui.x -= ui.btn_country2.x - ui.width / 2;
|
||||
ui.y -= ui.btn_country2.y - ui.height / 2;
|
||||
Locator.setInStageRectangleByDisplay(ui,ui.mc_bg);
|
||||
GuideDriver.getIns().guideDisplay(ui.btn_country2,"ui.guideicon_country2");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.city_2.btn_yes.selected = false;
|
||||
TweenMax.to(ui.city_2.btn_yes,0,{"colorTransform":{"exposure":1}});
|
||||
}
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 1; i <= 5; )
|
||||
{
|
||||
(ui["city_" + i] as CityUI).ondata(CityCenter.getIns().getCity(i));
|
||||
(ui["city_" + i] as CityUI).addEventListener("piselect",clickHandler,false,500);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
deactivity();
|
||||
EnterFrameDriver.getInstance().remove(step2);
|
||||
ActivityDriver.getIns().remove(activity,deactivity);
|
||||
EnterFrameDriver.getInstance().remove(step2);
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
if(!buffMode)
|
||||
{
|
||||
gesture.removeEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesture.removeEventListener(Gesturer.TAP_OVER,dragOverHandler);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package net.pixvi.myr.panel.map
|
||||
{
|
||||
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.PiMovie;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class GlobalMapUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_bg:Sprite;
|
||||
|
||||
public var city_1:CityUI;
|
||||
|
||||
public var city_2:CityUI;
|
||||
|
||||
public var city_3:CityUI;
|
||||
|
||||
public var city_4:CityUI;
|
||||
|
||||
public var city_5:CityUI;
|
||||
|
||||
public var mc_q:MovieClip;
|
||||
|
||||
public var mc_fly:PiMovie;
|
||||
|
||||
public var mc_light1:MovieClip;
|
||||
|
||||
public var mc_light2:MovieClip;
|
||||
|
||||
public var mc_light3:MovieClip;
|
||||
|
||||
public var mc_yun1:MovieClip;
|
||||
|
||||
public var mc_yun2:MovieClip;
|
||||
|
||||
public var mc_yun3:MovieClip;
|
||||
|
||||
public var mc_yun4:MovieClip;
|
||||
|
||||
public var mcs:Array;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var btn_country2:PiLightButton;
|
||||
|
||||
public function GlobalMapUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.GlobalMapUI");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
mcs = [mc_fly,mc_light1,mc_light2,mc_light3,mc_q];
|
||||
mc_q.mouseChildren = mc_q.mouseEnabled = false;
|
||||
for(i = 1; i <= 4; )
|
||||
{
|
||||
this["mc_yun" + i].mouseChildren = this["mc_yun" + i].mouseEnabled = false;
|
||||
i++;
|
||||
}
|
||||
mc_fly.mouseChildren = mc_fly.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user