Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class EquipView extends PiSprite
|
||||
{
|
||||
|
||||
public var typeId:int;
|
||||
|
||||
public var img:NetBitImg;
|
||||
|
||||
public var frameBuided:int = 1;
|
||||
|
||||
private var onBuildViewComplete:Function;
|
||||
|
||||
public function EquipView()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function buildView(onComplete:Function = null) : void
|
||||
{
|
||||
onBuildViewComplete = onComplete;
|
||||
if(img != null)
|
||||
{
|
||||
img.dispose();
|
||||
}
|
||||
frameBuided = 2;
|
||||
img = new NetBitImg();
|
||||
img.addEventListener("complete",buildViewHandler);
|
||||
img.load(ImgCenter.getItemImg(typeId,false,tablePosition().img));
|
||||
}
|
||||
|
||||
private function buildViewHandler(e:Event = null) : void
|
||||
{
|
||||
img.x = tablePosition().floatX;
|
||||
img.y = tablePosition().floatY;
|
||||
img.setScale(tablePosition().scale);
|
||||
img.rotation = tablePosition().rotation;
|
||||
addChild(img);
|
||||
img.removeEventListener("complete",buildViewHandler);
|
||||
frameBuided = 3;
|
||||
if(onBuildViewComplete != null)
|
||||
{
|
||||
onBuildViewComplete();
|
||||
onBuildViewComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function tablePosition() : Object
|
||||
{
|
||||
return Table.item_info[typeId].position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,662 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.events.Event;
|
||||
import flash.geom.Point;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.myr.battle.view.effectmov.BaseMonEffectMov;
|
||||
import net.pixvi.myr.battle.view.effectmov.MonEffectMovType;
|
||||
import net.pixvi.myr.center.Game;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.ground.GroundArea;
|
||||
import net.pixvi.myr.panel.monster.MonsterViewPanel;
|
||||
import net.pixvi.myr.panel.stackground.StackGroundPanel;
|
||||
import net.pixvi.myr.panel.storeground.StoreGroundPanel;
|
||||
import net.pixvi.myr.view.move.type.MoveType;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Colorator;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.Pointer;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class GroundMon extends MonView
|
||||
{
|
||||
|
||||
public static var VIEW_MONSTER:String = "viewMonster";
|
||||
|
||||
public var target:Point;
|
||||
|
||||
public var spd:Number;
|
||||
|
||||
public var freq:Number;
|
||||
|
||||
public var dis:Number;
|
||||
|
||||
public var groundArea:GroundArea;
|
||||
|
||||
public var gesture:Gesturer;
|
||||
|
||||
private var cachePoint:Point;
|
||||
|
||||
public var activity:Boolean = true;
|
||||
|
||||
public var deepMode:Boolean = true;
|
||||
|
||||
public var selecting:Boolean = false;
|
||||
|
||||
private var isEnviroment:Boolean = false;
|
||||
|
||||
public var effectMovs:Array;
|
||||
|
||||
public var buffJumper:Jumper;
|
||||
|
||||
private var growMonmove:MonMov;
|
||||
|
||||
private var faceCache:int;
|
||||
|
||||
private var legStarted:Boolean = false;
|
||||
|
||||
public function GroundMon(vo:MonsterVo, area:GroundArea, isEnviroment:Boolean = false)
|
||||
{
|
||||
super();
|
||||
this.vo = vo;
|
||||
this.groundArea = area;
|
||||
this.isEnviroment = isEnviroment;
|
||||
cachePoint = new Point();
|
||||
effectMovs = [];
|
||||
buffJumper = new Jumper(2);
|
||||
gesture = new Gesturer(this,true);
|
||||
if(!isEnviroment)
|
||||
{
|
||||
gesture.dragLength = 20;
|
||||
gesture.start();
|
||||
gesture.addEventListener(Gesturer.DRAG,dragHandler);
|
||||
gesture.addEventListener(Gesturer.TAP_OVER,clickHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_MODE_CHANGE,modeChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_REMOVE_STACK,removeStackHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_FACE,faceHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_EQUIP_CHANGE,equipChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_EQUIP_HIDEO,equipHideChangeHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public function equipChangeHandler(e:MYREvent = null) : void
|
||||
{
|
||||
if(e.data.mon == vo && e.data.ornamentChange)
|
||||
{
|
||||
monMov.updateEquips(vo.getEquipTypes());
|
||||
rebuildEquipEffectMovs();
|
||||
}
|
||||
}
|
||||
|
||||
public function equipHideChangeHandler(e:MYREvent = null) : void
|
||||
{
|
||||
if(e.data == vo)
|
||||
{
|
||||
monMov.updateEquips(vo.getEquipTypes());
|
||||
rebuildEquipEffectMovs();
|
||||
}
|
||||
}
|
||||
|
||||
override public function buildView() : void
|
||||
{
|
||||
container.setScale(oscale);
|
||||
buildLeg();
|
||||
super.buildView();
|
||||
}
|
||||
|
||||
public function faceHandler(e:MYREvent = null) : void
|
||||
{
|
||||
if(vo.id == e.data.mon.id)
|
||||
{
|
||||
showFace(e.data.face);
|
||||
}
|
||||
else if(e.data.face == 13)
|
||||
{
|
||||
showFace(14);
|
||||
}
|
||||
else if(Math.random() < 0.8)
|
||||
{
|
||||
showFace(13);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeStackHandler(e:PiEvent = null) : void
|
||||
{
|
||||
var p:Point = null;
|
||||
if(e.data.mon == vo)
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_REMOVE_STACK,removeStackHandler);
|
||||
this.mouseEnabled = false;
|
||||
this.mouseChildren = false;
|
||||
this.stopMoveDrag();
|
||||
stop();
|
||||
if(StackGroundPanel.getIns().showing)
|
||||
{
|
||||
TweenMax.to(this,Game.HQ ? 0.5 : 0,{
|
||||
"alpha":0,
|
||||
"onComplete":sendRemove
|
||||
});
|
||||
if(e.data.type == "sell")
|
||||
{
|
||||
p = localToGlobal(new Point());
|
||||
StackGroundPanel.getIns().addMoneyShow(p.x,p.y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendRemove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function sendRemove() : void
|
||||
{
|
||||
dispatchEvent(new Event(MYREvent.REMOVE));
|
||||
}
|
||||
|
||||
public function buildLeg() : void
|
||||
{
|
||||
if(leg != null)
|
||||
{
|
||||
leg.dispose();
|
||||
}
|
||||
target = null;
|
||||
leg = MoveType.getMove(vo.getCurMove().type);
|
||||
leg.init(this.container,oscale);
|
||||
leg.startWithAction();
|
||||
this.spd = vo.getCurMove().spd;
|
||||
this.freq = vo.getCurMove().freq;
|
||||
this.dis = vo.getCurMove().dis;
|
||||
}
|
||||
|
||||
public function rebuildView(show:Boolean = false) : void
|
||||
{
|
||||
curMode = vo.mode;
|
||||
buildLeg();
|
||||
if(show)
|
||||
{
|
||||
if(monMov.scaleX < 0)
|
||||
{
|
||||
faceCache = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceCache = 1;
|
||||
}
|
||||
stop();
|
||||
growMonmove = new MonMov();
|
||||
buildMov(growMonmove);
|
||||
growMonmove.buildFrame(onRebuildMonsterMovComplete);
|
||||
growMonmove.alpha = 0;
|
||||
TweenMax.to(growMonmove,0,{
|
||||
"scaleX":faceCache * 0.5,
|
||||
"scaleY":0.5,
|
||||
"colorTransform":{"exposure":2}
|
||||
});
|
||||
container.addChild(growMonmove);
|
||||
TweenMax.to(container,0.4,{"y":0});
|
||||
TweenMax.to(monMov,0.7,{
|
||||
"colorTransform":{"exposure":2},
|
||||
"onComplete":rebuildViewStep2
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if(monMov != null)
|
||||
{
|
||||
monMov.dispose();
|
||||
}
|
||||
monMov = new MonMov();
|
||||
buildMov();
|
||||
monMov.buildFrame();
|
||||
container.addChild(monMov);
|
||||
container.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function rebuildViewStep2() : void
|
||||
{
|
||||
TweenMax.to(growMonmove,0.6,{
|
||||
"scaleX":faceCache * 1,
|
||||
"scaleY":1,
|
||||
"alpha":1,
|
||||
"colorTransform":{"exposure":1}
|
||||
});
|
||||
TweenMax.to(monMov,0.6,{
|
||||
"scaleX":faceCache * 1.6,
|
||||
"scaleY":1.6,
|
||||
"alpha":0,
|
||||
"onComplete":rebuildViewComplete
|
||||
});
|
||||
}
|
||||
|
||||
private function rebuildViewComplete() : void
|
||||
{
|
||||
monMov.dispose();
|
||||
monMov = growMonmove;
|
||||
resume();
|
||||
}
|
||||
|
||||
override public function buildMov(targetMonMove:MonMov = null) : void
|
||||
{
|
||||
if(targetMonMove == null)
|
||||
{
|
||||
targetMonMove = monMov;
|
||||
}
|
||||
super.buildMov(targetMonMove);
|
||||
if(targetMonMove != null)
|
||||
{
|
||||
targetMonMove.addEquips(vo.getEquipTypes(),vo.ornamentFix);
|
||||
}
|
||||
rebuildEquipEffectMovs();
|
||||
}
|
||||
|
||||
public function rebuildEquipEffectMovs() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
i = 0;
|
||||
for(i = 0; i < effectMovs.length; )
|
||||
{
|
||||
effectMovs[i].dispose();
|
||||
i++;
|
||||
}
|
||||
effectMovs = [];
|
||||
var equips:Array = vo.getEquipTypes();
|
||||
for(i = 0; i < equips.length; )
|
||||
{
|
||||
addEffectMovByEquipType(equips[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function addEffectMovByEquipType(equipType:String) : void
|
||||
{
|
||||
for each(var type:String in Table.item_info[equipType].effectMovs)
|
||||
{
|
||||
if(Table.monster_setting.effectMov[type] != null && Table.monster_setting.effectMov[type].type == "normal")
|
||||
{
|
||||
addEffectMov(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addEffectMov(type:String) : void
|
||||
{
|
||||
effectMovs.push(MonEffectMovType.getMonEffectMovByTypeId(type));
|
||||
}
|
||||
|
||||
public function onRebuildMonsterMovComplete(e:Event = null) : void
|
||||
{
|
||||
var orishadow:Number = shadowScale;
|
||||
onBuildMovComplete();
|
||||
TweenMax.fromTo(this,0.4,{"shadowScale":orishadow},{"shadowScale":shadowScale});
|
||||
}
|
||||
|
||||
override public function onBuildMovComplete() : void
|
||||
{
|
||||
super.onBuildMovComplete();
|
||||
if(vo.isFlying())
|
||||
{
|
||||
leg.start();
|
||||
Caller.delayCall(legStartedHandler,400 + Random.integer(1,100));
|
||||
}
|
||||
else
|
||||
{
|
||||
legStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function legStartedHandler(e:Event = null) : void
|
||||
{
|
||||
legStarted = true;
|
||||
}
|
||||
|
||||
public function buildScale(scale:Number) : void
|
||||
{
|
||||
if(oscale != scale)
|
||||
{
|
||||
oscale = scale;
|
||||
}
|
||||
shadow.scaleX = shadow.scaleY = monMov.scaleX = monMov.scaleY = scale;
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
var curpo:Point = null;
|
||||
var newpo:Point = null;
|
||||
shadow.scaleX = shadow.scaleY = shadowScale * oscale * (200 + container.y) / 200;
|
||||
if(deepMode)
|
||||
{
|
||||
this.scaleX = this.scaleY = Table.setting.farmMonScale * Counter.getAreaByArea(Table.setting.farmDeepMin,Table.setting.farmDeepMax,groundArea.area.y,groundArea.area.y + groundArea.area.height,this.y);
|
||||
shadow.scaleY *= this.scaleX;
|
||||
}
|
||||
shadow.x = container.x;
|
||||
if(!activity || gesture.draging || vo.mode == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(selecting)
|
||||
{
|
||||
target = null;
|
||||
leg.stop();
|
||||
monMov.statusNormal();
|
||||
}
|
||||
if(buffJumper.jump())
|
||||
{
|
||||
if(legStarted && monMov.buildOver() && this.effectMovs != null && this.effectMovs.length > 0)
|
||||
{
|
||||
for each(var effectmov:BaseMonEffectMov in this.effectMovs)
|
||||
{
|
||||
if(effectmov.type == "normal")
|
||||
{
|
||||
effectmov.startEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(target != null)
|
||||
{
|
||||
if(int(this.x) != int(target.x) || int(this.y) != int(target.y))
|
||||
{
|
||||
cachePoint.setTo(this.x,this.y);
|
||||
curpo = cachePoint;
|
||||
newpo = Pointer.Point2Point(curpo,target,spd);
|
||||
this.x = newpo.x;
|
||||
this.y = newpo.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = null;
|
||||
leg.stop();
|
||||
monMov.statusNormal();
|
||||
}
|
||||
}
|
||||
else if(!selecting)
|
||||
{
|
||||
if(Math.random() < 0.05 * freq)
|
||||
{
|
||||
leg.start();
|
||||
monMov.statusWalk();
|
||||
findPointTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function findPointTarget() : void
|
||||
{
|
||||
var lengthX:int = Random.integer(-dis,dis);
|
||||
var lengthY:int = Random.integer(-dis,dis) * 0.8;
|
||||
this.target = new Point(this.x + lengthX,this.y + lengthY);
|
||||
if(groundArea.overFixRule == 1)
|
||||
{
|
||||
if(this.target.x < groundArea.area.left)
|
||||
{
|
||||
this.target.x += Math.abs(lengthX * 2);
|
||||
}
|
||||
if(this.target.x > groundArea.area.right)
|
||||
{
|
||||
this.target.x -= Math.abs(lengthX * 2);
|
||||
}
|
||||
if(this.target.y < groundArea.area.top)
|
||||
{
|
||||
this.target.y += Math.abs(lengthY * 2);
|
||||
}
|
||||
if(this.target.y > groundArea.area.bottom)
|
||||
{
|
||||
this.target.y -= Math.abs(lengthY * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this.target.x < groundArea.area.left)
|
||||
{
|
||||
this.target.x = groundArea.area.x;
|
||||
}
|
||||
if(this.target.x > groundArea.area.right)
|
||||
{
|
||||
this.target.x = groundArea.area.x + groundArea.area.width;
|
||||
}
|
||||
if(this.target.y < groundArea.area.top)
|
||||
{
|
||||
this.target.y = groundArea.area.y;
|
||||
}
|
||||
if(this.target.y > groundArea.area.bottom)
|
||||
{
|
||||
this.target.y = groundArea.area.y + groundArea.area.height;
|
||||
}
|
||||
}
|
||||
if(this.x < this.target.x)
|
||||
{
|
||||
monMov.scaleX = -Math.abs(monMov.scaleX);
|
||||
}
|
||||
else
|
||||
{
|
||||
monMov.scaleX = Math.abs(monMov.scaleX);
|
||||
}
|
||||
}
|
||||
|
||||
public function moveToRandomPoint() : void
|
||||
{
|
||||
this.x = groundArea.area.x + Random.integer(90,groundArea.area.width - 90);
|
||||
this.y = groundArea.area.y + Random.integer(90,groundArea.area.height - 90);
|
||||
}
|
||||
|
||||
public function hitSomeOne(one:MonView) : void
|
||||
{
|
||||
var np2:Point = null;
|
||||
if(curface != 1 && curface != 6)
|
||||
{
|
||||
showFace(int(Random.element([1,6])));
|
||||
}
|
||||
var p:Point = new Point(this.x,this.y);
|
||||
var p2:Point = new Point(one.x,one.y);
|
||||
var np1:Point = Pointer.Point2Point(p,p2,-this.spd);
|
||||
if(!selecting)
|
||||
{
|
||||
this.x = np1.x;
|
||||
this.y = np1.y;
|
||||
}
|
||||
if(one is GroundMon)
|
||||
{
|
||||
np2 = Pointer.Point2Point(p2,p,-(one as GroundMon).spd);
|
||||
if(!one["selecting"])
|
||||
{
|
||||
one.x = np2.x;
|
||||
one.y = np2.y;
|
||||
}
|
||||
}
|
||||
if(Math.random() < 0.01)
|
||||
{
|
||||
findPointTarget();
|
||||
}
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
if(gesture.draging || groundArea.libMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SoundCenter.getIns().play(GameSound.effect_click_mon);
|
||||
dispatchEvent(new PiEvent(GroundMon.VIEW_MONSTER,this));
|
||||
if(vo.process == 3)
|
||||
{
|
||||
groundSelect();
|
||||
}
|
||||
else
|
||||
{
|
||||
MonsterViewPanel.getIns().vo = this.vo;
|
||||
PopCenter.POP(MonsterViewPanel.getIns());
|
||||
}
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
public function dragHandler(e:Event) : void
|
||||
{
|
||||
StoreGroundPanel.getIns().ui.ui_menu.close();
|
||||
GameSound.playMonVoice(this.vo.type.toString(),"drag");
|
||||
this.showFace(4);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_UP,upHandler);
|
||||
this.startMoveDrag(false,groundArea.area);
|
||||
this.transform.colorTransform = PiLightButton.btnTouchLight.downcolor;
|
||||
this.stop();
|
||||
}
|
||||
|
||||
public function upHandler(e:Event) : void
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
this.transform.colorTransform = Colorator.emptyColorTrans;
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_UP,upHandler);
|
||||
this.stopMoveDrag();
|
||||
this.target = null;
|
||||
resume();
|
||||
}
|
||||
|
||||
public function modeChangeHandler(e:PiEvent = null) : void
|
||||
{
|
||||
if(e.data == vo)
|
||||
{
|
||||
if(StackGroundPanel.getIns().showing)
|
||||
{
|
||||
rebuildView(true);
|
||||
if(vo.mode == 2)
|
||||
{
|
||||
GameSound.playMonVoice(this.vo.type.toString(),"growUp",false,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rebuildView(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function get flying() : Boolean
|
||||
{
|
||||
return this.container.y < -20;
|
||||
}
|
||||
|
||||
public function stop() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_FACE,faceHandler);
|
||||
activity = false;
|
||||
if(leg != null)
|
||||
{
|
||||
leg.stop();
|
||||
}
|
||||
for each(var m:BaseMonEffectMov in effectMovs)
|
||||
{
|
||||
m.pause();
|
||||
}
|
||||
monMov.pause();
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
if(leg != null)
|
||||
{
|
||||
leg.pause();
|
||||
}
|
||||
for each(var m:BaseMonEffectMov in effectMovs)
|
||||
{
|
||||
m.pause();
|
||||
}
|
||||
monMov.pause();
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_FACE,faceHandler);
|
||||
activity = true;
|
||||
if(leg != null)
|
||||
{
|
||||
leg.resume();
|
||||
}
|
||||
for each(var m:BaseMonEffectMov in effectMovs)
|
||||
{
|
||||
m.resume();
|
||||
}
|
||||
monMov.resume();
|
||||
}
|
||||
|
||||
public function groundSelect() : void
|
||||
{
|
||||
StoreGroundPanel.getIns().ui.ui_menu.close();
|
||||
StoreGroundPanel.getIns().ui.ui_menu.release();
|
||||
var p:Point = StoreGroundPanel.getIns().ground.groundArea.localToGlobal(new Point(this.x,this.y));
|
||||
var floaty:int = 120;
|
||||
var flyfloat:int = 0;
|
||||
if(this.vo.isFlying())
|
||||
{
|
||||
flyfloat = this.container.y;
|
||||
}
|
||||
StoreGroundPanel.getIns().addChild(StoreGroundPanel.getIns().ui.ui_menu);
|
||||
StoreGroundPanel.getIns().ui.ui_menu.x = p.x;
|
||||
StoreGroundPanel.getIns().ui.ui_menu.y = p.y - this.cacheHeight + floaty + flyfloat;
|
||||
StoreGroundPanel.getIns().ui.ui_menu.curMon = this;
|
||||
GameSound.playMonVoice(this.vo.type.toString(),"click");
|
||||
var over:Boolean = StageDriver.keepInStageEX(StoreGroundPanel.getIns().ui.ui_menu,5);
|
||||
StoreGroundPanel.getIns().ui.ui_menu.showout();
|
||||
var poi:Point = new Point(StoreGroundPanel.getIns().ui.ui_menu.x,StoreGroundPanel.getIns().ui.ui_menu.y);
|
||||
poi = this.parent.globalToLocal(poi);
|
||||
poi.y = poi.y + this.cacheHeight - floaty - flyfloat;
|
||||
if(over)
|
||||
{
|
||||
TweenMax.to(this,0.5,{
|
||||
"x":poi.x,
|
||||
"y":poi.y
|
||||
});
|
||||
}
|
||||
this.showFace(2,2147483647);
|
||||
this.selecting = true;
|
||||
}
|
||||
|
||||
override public function showFace(facetype:int, time:int = 2000) : void
|
||||
{
|
||||
if(isEnviroment || groundArea.libMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!selecting)
|
||||
{
|
||||
super.showFace(facetype,time);
|
||||
}
|
||||
}
|
||||
|
||||
public function groundSelectRelease() : void
|
||||
{
|
||||
this.selecting = false;
|
||||
super.showFaceComplete();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
leg.dispose();
|
||||
monMov.dispose();
|
||||
gesture.dispose();
|
||||
for each(var m:BaseMonEffectMov in effectMovs)
|
||||
{
|
||||
m.dispose();
|
||||
}
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_FACE,faceHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_EQUIP_CHANGE,equipChangeHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_MODE_CHANGE,modeChangeHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_REMOVE_STACK,removeStackHandler);
|
||||
groundArea = null;
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
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.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class GroundMonInfoUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var bar_exp:PiBar;
|
||||
|
||||
public var mc_inteam:MovieClip;
|
||||
|
||||
public var mc_shooter:MovieClip;
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public var mc_entangle:Sprite;
|
||||
|
||||
public function GroundMonInfoUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.StoreMonInfoUIYellow");
|
||||
}
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
text_name.scaleMode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
|
||||
public class MonMov extends PiSprite
|
||||
{
|
||||
|
||||
public var status:int = -1;
|
||||
|
||||
private var movFrames:Object = {};
|
||||
|
||||
public var builded:Boolean = false;
|
||||
|
||||
public var building:int = 0;
|
||||
|
||||
private var onBuildFrameComplete:Function;
|
||||
|
||||
private var t:TweenMax;
|
||||
|
||||
private var currentFrame:MonMovFrame;
|
||||
|
||||
public var walkDelay:int = 500;
|
||||
|
||||
private var curWalkPace:int = 2;
|
||||
|
||||
private var equipViews:Array = [];
|
||||
|
||||
private var monContainer:PiSprite = new PiSprite();
|
||||
|
||||
public var ornamentFix:Object;
|
||||
|
||||
private var cacheBuildOver:Boolean = false;
|
||||
|
||||
public function MonMov()
|
||||
{
|
||||
addChild(monContainer);
|
||||
super();
|
||||
}
|
||||
|
||||
public function statusNormal() : void
|
||||
{
|
||||
killT();
|
||||
status = 1;
|
||||
gotoFrame(MonMovFramesType.NORMAL);
|
||||
}
|
||||
|
||||
public function statusAttack(resetTime:int = 0, skillFrameFirst:Boolean = false) : void
|
||||
{
|
||||
var targetFunction:Function = null;
|
||||
killT();
|
||||
if(status == 3)
|
||||
{
|
||||
targetFunction = statusWalk;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetFunction = statusNormal;
|
||||
}
|
||||
if(skillFrameFirst && movFrames[MonMovFramesType.SKILL] != null)
|
||||
{
|
||||
status = 5;
|
||||
gotoFrame(MonMovFramesType.SKILL);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 2;
|
||||
gotoFrame(MonMovFramesType.ATTACK);
|
||||
}
|
||||
t = TweenMax.delayedCall(resetTime / 1000,targetFunction);
|
||||
}
|
||||
|
||||
public function statusBeforeAtk() : void
|
||||
{
|
||||
killT();
|
||||
status = 4;
|
||||
gotoFrame(MonMovFramesType.BEFOREATK);
|
||||
}
|
||||
|
||||
public function statusWalk(delay:int = 350) : void
|
||||
{
|
||||
if(status != 3 || walkDelay != delay)
|
||||
{
|
||||
killT();
|
||||
walkDelay = delay;
|
||||
status = 3;
|
||||
gotoFrame(MonMovFramesType.WALK);
|
||||
curWalkPace = 2;
|
||||
t = TweenMax.delayedCall(walkDelay / 1000,switchWalkPace);
|
||||
}
|
||||
}
|
||||
|
||||
private function switchWalkPace() : void
|
||||
{
|
||||
if(curWalkPace == 2)
|
||||
{
|
||||
gotoFrame(MonMovFramesType.NORMAL);
|
||||
curWalkPace = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gotoFrame(MonMovFramesType.WALK);
|
||||
curWalkPace = 2;
|
||||
}
|
||||
t = TweenMax.delayedCall(walkDelay / 1000,switchWalkPace);
|
||||
}
|
||||
|
||||
private function killT() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
t = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function gotoFrame(name:String) : void
|
||||
{
|
||||
if(movFrames[name] == null)
|
||||
{
|
||||
name = MonMovFramesType.NORMAL;
|
||||
}
|
||||
if(currentFrame != null)
|
||||
{
|
||||
if(currentFrame.frameName == name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(currentFrame.parent != null)
|
||||
{
|
||||
monContainer.removeChild(currentFrame);
|
||||
}
|
||||
}
|
||||
currentFrame = movFrames[name];
|
||||
monContainer.addChild(movFrames[name]);
|
||||
ornamentGotoFrame(name);
|
||||
}
|
||||
|
||||
public function ornamentGotoFrame(name:String) : void
|
||||
{
|
||||
var equipview:EquipView = null;
|
||||
var i:int = 0;
|
||||
var fix:Object = null;
|
||||
var tag:String = movFrames[name].tag;
|
||||
for(i = 0; i < equipViews.length; )
|
||||
{
|
||||
equipview = equipViews[i] as EquipView;
|
||||
fix = ornamentFix[equipview.tablePosition().position][tag];
|
||||
equipview.x = fix.x;
|
||||
equipview.y = fix.y;
|
||||
if(fix.rotation != null)
|
||||
{
|
||||
equipview.rotation = fix.rotation;
|
||||
}
|
||||
if(fix.hide != null)
|
||||
{
|
||||
equipview.visible = fix.hide == true ? false : true;
|
||||
}
|
||||
else
|
||||
{
|
||||
equipview.visible = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public function addFrameByMon(name:String, type:int, mode:int, tag:String = "") : void
|
||||
{
|
||||
var fix:Object = ImgCenter.getMonQFix(type,mode,tag);
|
||||
if(fix != null && fix.close != true)
|
||||
{
|
||||
addFrame(name,ImgCenter.getMonQImg(type,mode,tag),fix.x,fix.y,mode + tag);
|
||||
}
|
||||
}
|
||||
|
||||
public function addFrame(name:String, imgsrc:String, floatX:int, floatY:int, tag:String) : void
|
||||
{
|
||||
var f:MonMovFrame = new MonMovFrame();
|
||||
f.frameName = name;
|
||||
f.frameSrc = imgsrc;
|
||||
f.x = floatX;
|
||||
f.y = floatY;
|
||||
f.tag = tag;
|
||||
movFrames[name] = f;
|
||||
}
|
||||
|
||||
public function addEquips(equipTypes:Array, ornamentPosition:Object, autoLoad:Boolean = false) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var equipView:EquipView = null;
|
||||
this.ornamentFix = ornamentPosition;
|
||||
for(i = 0; i < equipTypes.length; )
|
||||
{
|
||||
if(Table.item_info[equipTypes[i]].position.position != "0")
|
||||
{
|
||||
equipView = new EquipView();
|
||||
equipView.typeId = equipTypes[i];
|
||||
equipViews.push(equipView);
|
||||
if(autoLoad)
|
||||
{
|
||||
equipView.buildView();
|
||||
}
|
||||
if(equipView.tablePosition().front)
|
||||
{
|
||||
addChild(equipView);
|
||||
}
|
||||
else
|
||||
{
|
||||
addChildAt(equipView,getChildIndex(monContainer));
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function buildFrame(onComplete:Function = null) : void
|
||||
{
|
||||
onBuildFrameComplete = onComplete;
|
||||
buildNext();
|
||||
}
|
||||
|
||||
private function timeout(src:String) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function buildNext() : void
|
||||
{
|
||||
var frame:MonMovFrame = null;
|
||||
for each(var equipview:EquipView in equipViews)
|
||||
{
|
||||
if(equipview.frameBuided != 3)
|
||||
{
|
||||
equipview.buildView(buildNext);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for(var framename:String in movFrames)
|
||||
{
|
||||
frame = movFrames[framename];
|
||||
if(frame.frameBuided != 3)
|
||||
{
|
||||
frame.addEventListener("complete",onFrameBuildedHandler);
|
||||
frame.load(frame.frameSrc);
|
||||
Caller.delayCall(timeout,5000,1,[frame.frameSrc]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(status == -1)
|
||||
{
|
||||
statusNormal();
|
||||
}
|
||||
builded = true;
|
||||
if(onBuildFrameComplete != null)
|
||||
{
|
||||
onBuildFrameComplete();
|
||||
onBuildFrameComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onFrameBuildedHandler(e:Event) : void
|
||||
{
|
||||
Caller.stopCall(timeout,5000);
|
||||
building++;
|
||||
var f:MonMovFrame = e.target as MonMovFrame;
|
||||
f.removeEventListener("complete",onFrameBuildedHandler);
|
||||
f.frameBuided = 3;
|
||||
buildNext();
|
||||
}
|
||||
|
||||
public function updateEquips(arr:Array) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var eqv:EquipView = null;
|
||||
for(i = 0; i < equipViews.length; )
|
||||
{
|
||||
eqv = equipViews[i];
|
||||
eqv.dispose();
|
||||
i++;
|
||||
}
|
||||
equipViews = [];
|
||||
addEquips(arr,ornamentFix,true);
|
||||
ornamentGotoFrame(currentFrame.frameName);
|
||||
}
|
||||
|
||||
public function buildOver() : Boolean
|
||||
{
|
||||
if(cacheBuildOver)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for each(var f:MonMovFrame in movFrames)
|
||||
{
|
||||
if(f.frameBuided < 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
cacheBuildOver = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
|
||||
public class MonMovFrame extends NetBitImg
|
||||
{
|
||||
|
||||
public var frameName:String = "";
|
||||
|
||||
public var frameSrc:String = "";
|
||||
|
||||
public var frameBuided:int = 1;
|
||||
|
||||
public var tag:String;
|
||||
|
||||
public function MonMovFrame(src:String = "", w:Number = 0, h:Number = 0, errorTip:Boolean = true, smooth:Boolean = true, cryptoModeFlag:int = -1)
|
||||
{
|
||||
super(src,w,h,errorTip,smooth,cryptoModeFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
public class MonMovFramesType
|
||||
{
|
||||
|
||||
public static var NORMAL:String = "1";
|
||||
|
||||
public static var ATTACK:String = "2";
|
||||
|
||||
public static var WALK:String = "3";
|
||||
|
||||
public static var BEFOREATK:String = "4";
|
||||
|
||||
public static var SKILL:String = "5";
|
||||
|
||||
public function MonMovFramesType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
public class MonMovStatus
|
||||
{
|
||||
|
||||
public static const NORMAL:int = 1;
|
||||
|
||||
public static const ATTACK:int = 2;
|
||||
|
||||
public static const BEFOREATK:int = 4;
|
||||
|
||||
public static const MOVE:int = 3;
|
||||
|
||||
public static const SKILL:int = 5;
|
||||
|
||||
public function MonMovStatus()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import com.greensock.TimelineMax;
|
||||
import flash.geom.Matrix;
|
||||
import flash.geom.Point;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.view.move.BaseMove;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.BitSprite;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class MonView extends PiSprite
|
||||
{
|
||||
|
||||
public var vo:MonsterVo;
|
||||
|
||||
public var monMov:MonMov;
|
||||
|
||||
public var normalBitmap:NetBitImg;
|
||||
|
||||
public var container:PiSprite;
|
||||
|
||||
public var shadow:BitSprite;
|
||||
|
||||
public var shadowScale:Number = 1;
|
||||
|
||||
public var leg:BaseMove;
|
||||
|
||||
public var hitSpace:Number;
|
||||
|
||||
public var oscale:Number = 1;
|
||||
|
||||
public var cacheHeight:int = -1;
|
||||
|
||||
public var curMode:int;
|
||||
|
||||
public var curface:int = 0;
|
||||
|
||||
public var imgComplete:Boolean = false;
|
||||
|
||||
private var face:NetBitImg;
|
||||
|
||||
public var faceScale:Number = 0.9;
|
||||
|
||||
private var faceLine:TimelineMax;
|
||||
|
||||
public function MonView()
|
||||
{
|
||||
super();
|
||||
hitSpace = Table.setting.hitSpace;
|
||||
container = new PiSprite();
|
||||
addChild(container);
|
||||
}
|
||||
|
||||
public function testUpdate() : void
|
||||
{
|
||||
var globalP:Point = this.localToGlobal(new Point());
|
||||
var c:Number = Counter.getAreaByArea(-0.28,0.28,0,stage.stageWidth,globalP.x,true);
|
||||
var d:Number = Counter.getAreaByArea(-0.08,0.13,0,stage.stageHeight,globalP.y,true);
|
||||
var mtx:Matrix = this.transform.matrix.clone();
|
||||
mtx.c = -c;
|
||||
mtx.d = 1 - d;
|
||||
this.transform.matrix = mtx;
|
||||
}
|
||||
|
||||
public function curFaceto() : int
|
||||
{
|
||||
return monMov.scaleX;
|
||||
}
|
||||
|
||||
public function buildMov(targetMonMove:MonMov = null) : void
|
||||
{
|
||||
if(targetMonMove == null)
|
||||
{
|
||||
targetMonMove = monMov;
|
||||
}
|
||||
targetMonMove.addFrameByMon(MonMovFramesType.NORMAL,vo.skinShowType,curMode);
|
||||
targetMonMove.addFrameByMon(MonMovFramesType.WALK,vo.skinShowType,curMode,"m");
|
||||
}
|
||||
|
||||
public function buildView() : void
|
||||
{
|
||||
if(monMov != null)
|
||||
{
|
||||
monMov.dispose();
|
||||
monMov = null;
|
||||
}
|
||||
if(shadow == null)
|
||||
{
|
||||
shadow = FF.getBS("img.Shadow");
|
||||
}
|
||||
curMode = vo.mode;
|
||||
monMov = new MonMov();
|
||||
buildMov();
|
||||
addChildAt(shadow,0);
|
||||
container.addChild(monMov);
|
||||
monMov.buildFrame(onBuildMovComplete);
|
||||
}
|
||||
|
||||
public function showFace(facetype:int, time:int = 2000) : void
|
||||
{
|
||||
if(!imgComplete)
|
||||
{
|
||||
return;
|
||||
}
|
||||
killFace();
|
||||
face = new NetBitImg("data/img/face/face" + facetype + ".png");
|
||||
curface = facetype;
|
||||
face.x = container.width / 5;
|
||||
face.y = (vo.isFlying() ? container.y : 0) - container.height;
|
||||
if(face.y > -100)
|
||||
{
|
||||
face.y = -100;
|
||||
}
|
||||
faceLine = new TimelineMax();
|
||||
faceLine.fromTo(face,0.2,{
|
||||
"scaleX":0.2,
|
||||
"scaleY":0.2
|
||||
},{
|
||||
"scaleX":faceScale,
|
||||
"scaleY":faceScale,
|
||||
"y":face.y - 70 * faceScale
|
||||
});
|
||||
faceLine.to(face,time / 1000,{});
|
||||
faceLine.to(face,0.2,{
|
||||
"alpha":0,
|
||||
"onComplete":showFaceComplete
|
||||
});
|
||||
addChild(face);
|
||||
}
|
||||
|
||||
public function showFaceComplete() : void
|
||||
{
|
||||
killFace();
|
||||
}
|
||||
|
||||
public function killFace() : void
|
||||
{
|
||||
if(faceLine != null)
|
||||
{
|
||||
faceLine.kill();
|
||||
}
|
||||
if(face != null)
|
||||
{
|
||||
face.dispose();
|
||||
face = null;
|
||||
}
|
||||
curface = 0;
|
||||
}
|
||||
|
||||
public function onBuildMovComplete() : void
|
||||
{
|
||||
updateSize();
|
||||
}
|
||||
|
||||
public function updateSize() : void
|
||||
{
|
||||
if(shadow == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
shadow.setScale(1);
|
||||
if(container.width < shadow.width)
|
||||
{
|
||||
shadowScale = container.width / shadow.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
shadowScale = 1;
|
||||
}
|
||||
shadow.setScale(shadowScale);
|
||||
cacheHeight = container.height;
|
||||
imgComplete = true;
|
||||
}
|
||||
|
||||
public function hittestG(obj:MonView) : Boolean
|
||||
{
|
||||
if(obj != this && obj.flying == this.flying && Math.abs(obj.x - this.x) < hitSpace && Math.abs(obj.y - this.y) < hitSpace / 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get flying() : Boolean
|
||||
{
|
||||
return this.container.y < -40;
|
||||
}
|
||||
|
||||
public function addMovByClass(mov:String, position:int = 0, scaleX:Number = 1, scaleY:Number = 1, fps:int = 0, rotation:int = 0, floatX:Number = 0, floatY:Number = 0, onComplete:Function = null, para:Array = null, top:Boolean = true, loop:int = 1) : BitMovieClip
|
||||
{
|
||||
var bmc:BitMovieClip = FF.getBMC(mov,fps);
|
||||
bmc.scaleX = scaleX;
|
||||
bmc.scaleY = scaleY;
|
||||
bmc.rotation = rotation;
|
||||
switch(position)
|
||||
{
|
||||
case 0:
|
||||
bmc.x = centerX - this.x;
|
||||
bmc.y = centerY - this.y;
|
||||
break;
|
||||
case 1:
|
||||
bmc.x = centerX - this.x;
|
||||
bmc.y = monMov.y - monMov.height;
|
||||
break;
|
||||
case 2:
|
||||
bmc.x = monMov.width / 2;
|
||||
bmc.y = centerY - this.y;
|
||||
break;
|
||||
case 3:
|
||||
bmc.x = centerX - this.x;
|
||||
bmc.y = monMov.y;
|
||||
break;
|
||||
case 4:
|
||||
bmc.x = centerX - monMov.width / 2;
|
||||
bmc.y = centerY - this.y;
|
||||
break;
|
||||
case 5:
|
||||
bmc.x = centerX - this.x;
|
||||
bmc.y = centerY - this.y + monMov.height / 2;
|
||||
break;
|
||||
case 6:
|
||||
bmc.x = centerX - this.x + Random.integer(-40,40);
|
||||
bmc.y = centerY - this.y + Random.integer(-60,60);
|
||||
}
|
||||
bmc.x += floatX;
|
||||
bmc.y += floatY;
|
||||
bmc.mouseChildren = bmc.mouseEnabled = false;
|
||||
if(top)
|
||||
{
|
||||
addChild(bmc);
|
||||
}
|
||||
else
|
||||
{
|
||||
addChildAt(bmc,getChildIndex(shadow) + 1);
|
||||
}
|
||||
Director.playOnce(bmc,onComplete,para,loop);
|
||||
return bmc;
|
||||
}
|
||||
|
||||
public function get containerX() : Number
|
||||
{
|
||||
return x + container.x;
|
||||
}
|
||||
|
||||
public function get containerY() : Number
|
||||
{
|
||||
return y + container.y;
|
||||
}
|
||||
|
||||
public function get centerX() : Number
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public function get centerXSelf() : Number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function get centerY() : Number
|
||||
{
|
||||
return y + container.y - cacheHeight * oscale / 2;
|
||||
}
|
||||
|
||||
public function get centerYSelf() : Number
|
||||
{
|
||||
return container.y - cacheHeight * oscale / 2;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
killFace();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.ground.GroundArea;
|
||||
import net.pixvi.myr.panel.stackground.StackGroundPanel;
|
||||
import net.pixvi.myr.view.stack.StackView;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.Locator;
|
||||
|
||||
public class StackGroundMon extends GroundMon
|
||||
{
|
||||
|
||||
public function StackGroundMon(vo:MonsterVo, area:GroundArea, isEnviroment:Boolean = false)
|
||||
{
|
||||
super(vo,area,isEnviroment);
|
||||
}
|
||||
|
||||
override public function buildView() : void
|
||||
{
|
||||
super.buildView();
|
||||
this.visible = vo.mode != 0;
|
||||
}
|
||||
|
||||
override public function rebuildView(show:Boolean = false) : void
|
||||
{
|
||||
this.visible = vo.mode > 0;
|
||||
super.rebuildView(show);
|
||||
}
|
||||
|
||||
override public function modeChangeHandler(e:PiEvent = null) : void
|
||||
{
|
||||
var stack:StackView = null;
|
||||
if(e.data == vo)
|
||||
{
|
||||
if(vo.preMode == 0)
|
||||
{
|
||||
GameSound.playMonVoice(this.vo.type.toString(),"born",false,true);
|
||||
stack = StackGroundPanel.getIns().ground.groundArea.getStackByMid(vo.id);
|
||||
this.x = stack.x;
|
||||
this.y = stack.y;
|
||||
Locator.setInRect(this,StackGroundPanel.getIns().ground.groundArea.area);
|
||||
}
|
||||
super.modeChangeHandler(e);
|
||||
}
|
||||
}
|
||||
|
||||
override public function hittestG(obj:MonView) : Boolean
|
||||
{
|
||||
if(obj != this && obj.visible == true && obj.flying == this.flying && Math.abs(obj.x - this.x) < hitSpace && Math.abs(obj.y - this.y) < hitSpace / 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package net.pixvi.myr.view.mon
|
||||
{
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.ground.GroundArea;
|
||||
import net.pixvi.myr.panel.storeground.StoreGroundPanel;
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class StoreGroundMon extends GroundMon
|
||||
{
|
||||
|
||||
public var ui:GroundMonInfoUI;
|
||||
|
||||
public var faceJump:Jumper;
|
||||
|
||||
public function StoreGroundMon(vo:MonsterVo, area:GroundArea)
|
||||
{
|
||||
super(vo,area);
|
||||
oscale = 0.8;
|
||||
ui = new GroundMonInfoUI();
|
||||
faceJump = new Jumper(300);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_NUM_CHANGE,monsterNumChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_SKIN_CHANGE,monsterSkinChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_ADD_FIGHTSTACK,monsterStatuChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_REMOVE_TEAM,monsterStatuChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MONSTER_INFO_CHANGE,monsterNumChangeHandler);
|
||||
}
|
||||
|
||||
public function monsterSkinChangeHandler(e:PiEvent = null) : void
|
||||
{
|
||||
if(e.data.mon.id == vo.id)
|
||||
{
|
||||
rebuildView(false);
|
||||
}
|
||||
}
|
||||
|
||||
override public function onBuildMovComplete() : void
|
||||
{
|
||||
super.onBuildMovComplete();
|
||||
updateUI();
|
||||
updateUIPosition();
|
||||
ui.mouseChildren = ui.mouseEnabled = false;
|
||||
addChild(ui);
|
||||
}
|
||||
|
||||
private function monsterNumChangeHandler(e:PiEvent) : void
|
||||
{
|
||||
if(e.data.mon.id == vo.id)
|
||||
{
|
||||
updateUI2();
|
||||
}
|
||||
}
|
||||
|
||||
private function monsterStatuChangeHandler(e:PiEvent) : void
|
||||
{
|
||||
if(e.data.mid == vo.id)
|
||||
{
|
||||
updateUI2();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateUIPosition() : void
|
||||
{
|
||||
ui.y = container.y - cacheHeight - 20;
|
||||
}
|
||||
|
||||
public function updateUI() : void
|
||||
{
|
||||
ui.text_level.text = vo.level.toString();
|
||||
ui.mc_inteam.visible = vo.inteam > 0;
|
||||
ui.bar_exp.setValue(vo.showExp,vo.showExpNext,0,false);
|
||||
ui.mc_shooter.gotoAndStop(vo.isShooter() ? 1 : 2);
|
||||
ui.text_name.text = vo.name;
|
||||
ui.mc_entangle.visible = vo.entangle;
|
||||
}
|
||||
|
||||
public function updateUI2() : void
|
||||
{
|
||||
Caller.delayCall(updateUI,70);
|
||||
}
|
||||
|
||||
override public function step() : void
|
||||
{
|
||||
if(faceJump.jump() && vo.canGift() && Math.random() < 0.4)
|
||||
{
|
||||
showFace(7);
|
||||
}
|
||||
super.step();
|
||||
updateUIPosition();
|
||||
}
|
||||
|
||||
public function updateInfo() : void
|
||||
{
|
||||
ui.visible = StoreGroundPanel.showInfo;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_NUM_CHANGE,monsterNumChangeHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_ADD_FIGHTSTACK,monsterStatuChangeHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_REMOVE_TEAM,monsterStatuChangeHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_ADD_FIGHTSTACK,monsterStatuChangeHandler);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MONSTER_SKIN_CHANGE,monsterSkinChangeHandler);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public function setOScale(scale:Number = 0.9) : void
|
||||
{
|
||||
container.setScale(oscale);
|
||||
oscale = scale;
|
||||
container.setScale(scale);
|
||||
updateSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user