Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
|
||||
public class BaseMiniGame extends PiSprite
|
||||
{
|
||||
|
||||
public var onComplete:Function;
|
||||
|
||||
public var score:PointLocker;
|
||||
|
||||
public var lv:int;
|
||||
|
||||
public function BaseMiniGame()
|
||||
{
|
||||
super();
|
||||
score = new PointLocker();
|
||||
}
|
||||
|
||||
public function gamestart() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function gameover() : void
|
||||
{
|
||||
if(onComplete != null)
|
||||
{
|
||||
onComplete(score.val);
|
||||
onComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class CountDownMov extends PiSprite
|
||||
{
|
||||
|
||||
public var onComplete:Function;
|
||||
|
||||
public var mc:BitMovieClip;
|
||||
|
||||
public var flag:int = 3;
|
||||
|
||||
public function CountDownMov(complete:Function = null)
|
||||
{
|
||||
this.onComplete = complete;
|
||||
super();
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
mc = FF.getBMC("mov.CountDown");
|
||||
mc.stop();
|
||||
flag = 3;
|
||||
addChild(mc);
|
||||
StageLocator.setSide(mc);
|
||||
step();
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
if(flag == 0)
|
||||
{
|
||||
completeHandler();
|
||||
return;
|
||||
}
|
||||
mc.gotoAndStop(flag);
|
||||
TweenMax.fromTo(mc,1,{
|
||||
"scaleX":1.8,
|
||||
"scaleY":1.6
|
||||
},{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Elastic.easeOut,
|
||||
"onComplete":step
|
||||
});
|
||||
flag--;
|
||||
}
|
||||
|
||||
public function completeHandler() : void
|
||||
{
|
||||
if(onComplete != null)
|
||||
{
|
||||
onComplete();
|
||||
onComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.myr.center.MiniGameCenter;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class MiniGamePanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var game:BaseMiniGame;
|
||||
|
||||
public var onComplete:Function;
|
||||
|
||||
public function MiniGamePanel(gameType:int)
|
||||
{
|
||||
super();
|
||||
game = MiniGameCenter.getIns().getMiniGame(gameType);
|
||||
addChild(game);
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
PopCenter.getIns().setMaskAlpha(0);
|
||||
}
|
||||
|
||||
public function gameStart(onComplete:Function) : void
|
||||
{
|
||||
this.onComplete = onComplete;
|
||||
game.onComplete = gameOverHandler;
|
||||
game.gamestart();
|
||||
}
|
||||
|
||||
private function gameOverHandler(point:int = 0) : void
|
||||
{
|
||||
showOut();
|
||||
if(onComplete != null)
|
||||
{
|
||||
onComplete(point);
|
||||
onComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class MiniGameTipPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:MiniGameTipUI;
|
||||
|
||||
public var onComplete:Function;
|
||||
|
||||
public function MiniGameTipPanel(type:int = 1, showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
buffMode = false;
|
||||
ui = new MiniGameTipUI(FF.getMC("ui.Game" + type + "TipPanelUI"));
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
ui.btn_yes.onClick(clickHandler);
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
onComplete();
|
||||
onComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MiniGameTipUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public function MiniGameTipUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.effect.effects.JumpNumEffect;
|
||||
import net.pixvi.myr.center.MiniGameCenter;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class MinigameOverPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:MinigameOverPanelUI = new MinigameOverPanelUI();
|
||||
|
||||
private var maxScore:int = 0;
|
||||
|
||||
private var score:int = 0;
|
||||
|
||||
private var gameType:int = 1;
|
||||
|
||||
public function MinigameOverPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
PopCenter.getIns().setMaskAlpha();
|
||||
}
|
||||
|
||||
public function show(score:int, gameType:int = 1) : void
|
||||
{
|
||||
this.gameType = gameType;
|
||||
this.score = score;
|
||||
this.maxScore = MiniGameCenter.getIns().getRecordScore(gameType);
|
||||
ui.mc_newRecord.visible = false;
|
||||
ui.btn_yes.visible = false;
|
||||
ui.text_score.text = "0";
|
||||
ui.text_record.text = maxScore.toString();
|
||||
ui.showOpen();
|
||||
new JumpNumEffect(score).startEffect(ui.text_score,showoverHandler);
|
||||
}
|
||||
|
||||
public function showoverHandler(e:Event = null) : void
|
||||
{
|
||||
TweenMax.fromTo(ui.btn_yes,1,{"alpha":0},{"alpha":1});
|
||||
ui.btn_yes.visible = true;
|
||||
if(this.score > this.maxScore)
|
||||
{
|
||||
MiniGameCenter.getIns().saveLocalRecordScore(gameType,this.score);
|
||||
ui.mc_newRecord.visible = true;
|
||||
ui.showNewRecord();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package net.pixvi.myr.panel.minigame
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MinigameOverPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_yes:PiLightButton;
|
||||
|
||||
public var text_score:PiBitTextField;
|
||||
|
||||
public var mc_newRecord:Sprite;
|
||||
|
||||
public var mc_gameover:Sprite;
|
||||
|
||||
public var mc_score:Sprite;
|
||||
|
||||
public var text_record:PiBitTextField;
|
||||
|
||||
public function MinigameOverPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MinigamePanelUI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
public function showOpen() : void
|
||||
{
|
||||
TweenMax.from(mc_score,0.6,{
|
||||
"y":mc_score.y - 50,
|
||||
"alpha":0,
|
||||
"delay":0.2
|
||||
});
|
||||
TweenMax.from(mc_gameover,0.6,{
|
||||
"y":mc_gameover.y - 50,
|
||||
"alpha":0
|
||||
});
|
||||
}
|
||||
|
||||
public function showNewRecord() : void
|
||||
{
|
||||
TweenMax.from(mc_newRecord,0.5,{
|
||||
"y":mc_newRecord.y - 40,
|
||||
"alpha":0,
|
||||
"tint":16777215
|
||||
});
|
||||
TweenMax.to(mc_score,0.5,{
|
||||
"y":mc_score.y + 40,
|
||||
"alpha":0
|
||||
});
|
||||
new FlashEffect(600,16777215).startEffect(text_score);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame1
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Linear;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class MiniGame1Block extends PiSprite
|
||||
{
|
||||
|
||||
public var team:int = 1;
|
||||
|
||||
public var mc:BitMovieClip;
|
||||
|
||||
public var spd:Number;
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
public var remove:Boolean = false;
|
||||
|
||||
public function MiniGame1Block()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function buildView(level:int = 1, spd:Number = 90, team:int = 1) : void
|
||||
{
|
||||
this.team = team;
|
||||
mc = FF.getBMC("mov.Game1Block" + level);
|
||||
addChild(mc);
|
||||
this.spd = spd;
|
||||
StageLocator.setPosition(this,"right","none");
|
||||
this.x += this.width;
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
t = TweenMax.to(this,(StageDriver.stageWidth + StageLocator.MainFixVo.fix[1] * 2) / spd,{
|
||||
"x":-this.width,
|
||||
"onComplete":moveComplete,
|
||||
"ease":Linear.easeIn
|
||||
});
|
||||
}
|
||||
|
||||
public function moveComplete() : void
|
||||
{
|
||||
dispose();
|
||||
remove = true;
|
||||
}
|
||||
|
||||
public function stop() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame1
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class MiniGame1GroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_front:MovieClip;
|
||||
|
||||
public var mc_back:MovieClip;
|
||||
|
||||
public var mc_dcr1:MovieClip;
|
||||
|
||||
public var mc_dcr2:MovieClip;
|
||||
|
||||
public var mc_chara1:MiniGame1ManUI;
|
||||
|
||||
public var mc_chara2:MiniGame1ManUI;
|
||||
|
||||
public var mc_chara3:MiniGame1ManUI;
|
||||
|
||||
public var mc_shadow1:Sprite;
|
||||
|
||||
public var mc_shadow2:Sprite;
|
||||
|
||||
public var mc_shadow3:Sprite;
|
||||
|
||||
public var mc_rail1:Sprite;
|
||||
|
||||
public var mc_rail2:Sprite;
|
||||
|
||||
public var mc_rail3:Sprite;
|
||||
|
||||
public var ui_score:MiniGame1ScoreUI;
|
||||
|
||||
public function MiniGame1GroundUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MiniGame1UI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
ui_score.text_score.text = "0m";
|
||||
StageLocator.setSide(mc_front,"none","bottom");
|
||||
StageLocator.setSide(ui_score,"center","top",0,5);
|
||||
mc_dcr2.gotoAndPlay(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame1
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Quart;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
|
||||
public class MiniGame1JumpMan
|
||||
{
|
||||
|
||||
public var team:int = 1;
|
||||
|
||||
public var mc_shadow:Sprite;
|
||||
|
||||
public var mc_man:MiniGame1ManUI;
|
||||
|
||||
public var jumpTime:Number = 0.4;
|
||||
|
||||
public var jumpHight:int = 110;
|
||||
|
||||
public var jumping:Boolean = false;
|
||||
|
||||
public var jumpShadowScale:Number = 0.6;
|
||||
|
||||
private var t:TweenMax;
|
||||
|
||||
private var t2:TweenMax;
|
||||
|
||||
public function MiniGame1JumpMan(mc_shadow:Sprite, mc_man:MiniGame1ManUI)
|
||||
{
|
||||
super();
|
||||
this.mc_man = mc_man;
|
||||
this.mc_shadow = mc_shadow;
|
||||
}
|
||||
|
||||
public function jump() : void
|
||||
{
|
||||
if(!jumping)
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_maochulai);
|
||||
mc_man.modeJump();
|
||||
jumping = true;
|
||||
t = TweenMax.to(mc_man,jumpTime,{
|
||||
"y":mc_man.y - jumpHight,
|
||||
"onComplete":fall,
|
||||
"ease":Quart.easeOut
|
||||
});
|
||||
t2 = TweenMax.to(mc_shadow,jumpTime,{
|
||||
"scaleX":jumpShadowScale,
|
||||
"scaleY":jumpShadowScale,
|
||||
"ease":Quart.easeOut
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function fall() : void
|
||||
{
|
||||
if(jumping)
|
||||
{
|
||||
t = TweenMax.to(mc_man,jumpTime,{
|
||||
"y":mc_man.y + jumpHight,
|
||||
"onComplete":jumpend,
|
||||
"ease":Quart.easeIn
|
||||
});
|
||||
t2 = TweenMax.to(mc_shadow,jumpTime,{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Quart.easeIn
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function stop() : void
|
||||
{
|
||||
mc_man.mc_chara.stop();
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
if(t2 != null)
|
||||
{
|
||||
t2.kill();
|
||||
}
|
||||
}
|
||||
|
||||
public function jumpend() : void
|
||||
{
|
||||
mc_man.modeRun();
|
||||
jumping = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame1
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class MiniGame1ManUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_area:Sprite;
|
||||
|
||||
public var mc_chara:MovieClip;
|
||||
|
||||
public function MiniGame1ManUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_chara.gotoAndPlay("run");
|
||||
}
|
||||
|
||||
public function modeJump() : void
|
||||
{
|
||||
mc_chara.gotoAndStop("jump");
|
||||
}
|
||||
|
||||
public function modeRun() : void
|
||||
{
|
||||
mc_chara.gotoAndPlay("run");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame1
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class MiniGame1ScoreUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_score:TextField;
|
||||
|
||||
public function MiniGame1ScoreUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame1
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.CountDownMov;
|
||||
import net.pixvi.myr.panel.minigame.MiniGameTipPanel;
|
||||
import net.pixvi.myr.panel.minigame.MinigameOverPanel;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class MiniGame1_Runner extends BaseMiniGame
|
||||
{
|
||||
|
||||
public static var GAME_TYPE:int = 1;
|
||||
|
||||
public var maxPoint:int = 1000;
|
||||
|
||||
public var ui:MiniGame1GroundUI;
|
||||
|
||||
public var cd:CountDownMov;
|
||||
|
||||
public var gametime:int = 180;
|
||||
|
||||
public var mans:Array;
|
||||
|
||||
public var blocks:Array;
|
||||
|
||||
public var man1:MiniGame1JumpMan;
|
||||
|
||||
public var man2:MiniGame1JumpMan;
|
||||
|
||||
public var man3:MiniGame1JumpMan;
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public var scoreTimer:Timer;
|
||||
|
||||
public var hitman:MiniGame1JumpMan;
|
||||
|
||||
public var overpanel:MinigameOverPanel;
|
||||
|
||||
public var rewardvo:RewardVo;
|
||||
|
||||
public function MiniGame1_Runner()
|
||||
{
|
||||
super();
|
||||
ui = new MiniGame1GroundUI();
|
||||
addChild(ui);
|
||||
}
|
||||
|
||||
override public function gamestart() : void
|
||||
{
|
||||
var tipPanel:MiniGameTipPanel = new MiniGameTipPanel(1);
|
||||
SoundCenter.getIns().bgmPlay(GameSound.bgm_funny);
|
||||
PopCenter.POP(tipPanel);
|
||||
tipPanel.onComplete = tipOver;
|
||||
}
|
||||
|
||||
public function tipOver() : void
|
||||
{
|
||||
cd = new CountDownMov(realstart);
|
||||
cd.start();
|
||||
addChild(cd);
|
||||
blocks = [];
|
||||
mans = [];
|
||||
}
|
||||
|
||||
public function realstart() : void
|
||||
{
|
||||
removeChild(cd);
|
||||
man1 = new MiniGame1JumpMan(ui.mc_shadow1,ui.mc_chara1);
|
||||
man2 = new MiniGame1JumpMan(ui.mc_shadow2,ui.mc_chara2);
|
||||
man3 = new MiniGame1JumpMan(ui.mc_shadow3,ui.mc_chara3);
|
||||
timer = new Timer(1500,37);
|
||||
timer.addEventListener("timer",timerHandler);
|
||||
timer.start();
|
||||
score.val = 0;
|
||||
scoreTimer = new Timer(150,gametime * 10);
|
||||
scoreTimer.addEventListener("timer",scoreTimerHandler);
|
||||
scoreTimer.addEventListener("timerComplete",timerCompleteHandler);
|
||||
scoreTimer.start();
|
||||
EnterFrameDriver.getIns().regist(enterHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,clickHandler);
|
||||
}
|
||||
|
||||
public function scoreTimerHandler(e:Event = null) : void
|
||||
{
|
||||
score.val += 1;
|
||||
ui.ui_score.text_score.text = score.val + "m";
|
||||
}
|
||||
|
||||
public function enterHandler(e:Event = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var man:MiniGame1JumpMan = null;
|
||||
var block:MiniGame1Block = null;
|
||||
ArrayUtil.removeByValue(blocks,"remove",true);
|
||||
for(i = 0; i < blocks.length; )
|
||||
{
|
||||
man = this["man" + blocks[i].team];
|
||||
block = blocks[i] as MiniGame1Block;
|
||||
if(man.mc_man.mc_area.hitTestObject(block))
|
||||
{
|
||||
hitman = man;
|
||||
SoundCenter.getIns().play(GameSound.effect_damutong1);
|
||||
gamefail();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function gamefail() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
EnterFrameDriver.getIns().remove(enterHandler);
|
||||
timer.stop();
|
||||
scoreTimer.stop();
|
||||
man1.stop();
|
||||
man2.stop();
|
||||
man3.stop();
|
||||
ui.mc_dcr1.stop();
|
||||
ui.mc_dcr2.stop();
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,clickHandler);
|
||||
ui.mc_front.stop();
|
||||
ui.mc_back.stop();
|
||||
Caller.stopCall(addBlock);
|
||||
var rec:Rectangle = hitman.mc_man.mc_area.getRect(StageDriver.stage);
|
||||
addChild(Alert.showOnceBMC("ui.StarShow",rec.left,rec.bottom,30));
|
||||
for(i = 0; i < blocks.length; )
|
||||
{
|
||||
blocks[i].stop();
|
||||
i++;
|
||||
}
|
||||
new FlashEffect(1500,16711680,0.8).startEffect(hitman.mc_man);
|
||||
Caller.delayCall(showOverHandler,1500);
|
||||
}
|
||||
|
||||
public function timerHandler(e:TimerEvent = null) : void
|
||||
{
|
||||
var ran:Number = 0.5;
|
||||
var maxNum:int = 3;
|
||||
if(timer.currentCount < 10)
|
||||
{
|
||||
ran = 0.4;
|
||||
maxNum = 2;
|
||||
}
|
||||
if(timer.currentCount < 20)
|
||||
{
|
||||
ran = 0.5;
|
||||
}
|
||||
if(timer.currentCount < 30)
|
||||
{
|
||||
ran = 0.6;
|
||||
}
|
||||
if(timer.currentCount < 40)
|
||||
{
|
||||
ran = 0.85;
|
||||
}
|
||||
if(timer.currentCount < 60)
|
||||
{
|
||||
ran = 0.9;
|
||||
}
|
||||
if(timer.currentCount < 120)
|
||||
{
|
||||
ran = 0.92;
|
||||
}
|
||||
if(timer.currentCount < 180)
|
||||
{
|
||||
ran = 0.94;
|
||||
}
|
||||
if(Math.random() < ran && maxNum > 0)
|
||||
{
|
||||
maxNum--;
|
||||
Caller.delayCall(addBlock,Math.random() * 700,1,[1]);
|
||||
}
|
||||
if(Math.random() < ran && maxNum > 0)
|
||||
{
|
||||
maxNum--;
|
||||
Caller.delayCall(addBlock,Math.random() * 700,1,[2]);
|
||||
}
|
||||
if(Math.random() < ran && maxNum > 0)
|
||||
{
|
||||
maxNum--;
|
||||
Caller.delayCall(addBlock,Math.random() * 700,1,[3]);
|
||||
}
|
||||
}
|
||||
|
||||
public function addBlock(team:int = 1) : void
|
||||
{
|
||||
var block:MiniGame1Block = new MiniGame1Block();
|
||||
block.buildView(Random.integer(1,3),210,team);
|
||||
block.start();
|
||||
blocks.push(block);
|
||||
ui["mc_rail" + team].addChild(block);
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
if(Math.abs(e["stageY"] - ui.mc_shadow1.y) < 85)
|
||||
{
|
||||
man1.jump();
|
||||
}
|
||||
else if(Math.abs(e["stageY"] - ui.mc_shadow2.y) < 85)
|
||||
{
|
||||
man2.jump();
|
||||
}
|
||||
else if(Math.abs(e["stageY"] - ui.mc_shadow3.y) < 85)
|
||||
{
|
||||
man3.jump();
|
||||
}
|
||||
}
|
||||
|
||||
public function timerCompleteHandler(e:Event = null) : void
|
||||
{
|
||||
Caller.delayCall(showOverHandler,1000);
|
||||
}
|
||||
|
||||
public function showOverHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel = new MinigameOverPanel();
|
||||
PopCenter.POP(overpanel);
|
||||
overpanel.show(score.val,GAME_TYPE);
|
||||
overpanel.ui.btn_yes.onClick(yesHandler);
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
dispose();
|
||||
gameover();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame2
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Cubic;
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class JumpNumMc extends PiSprite
|
||||
{
|
||||
|
||||
public var randomx:int = 40;
|
||||
|
||||
public var wid:int = 0;
|
||||
|
||||
public function JumpNumMc()
|
||||
{
|
||||
super();
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
}
|
||||
|
||||
public function addCenter(mc:String) : void
|
||||
{
|
||||
var dis:DisplayObject = FF.getMC(mc);
|
||||
dis.x = -dis.width / 2;
|
||||
dis.y = -dis.height / 2;
|
||||
addChild(dis);
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
wid = Random.integer(-randomx,randomx);
|
||||
TweenMax.to(this,0.35,{
|
||||
"y":this.y - 70,
|
||||
"x":this.x + wid,
|
||||
"onComplete":step2,
|
||||
"ease":Cubic.easeOut
|
||||
});
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
TweenMax.to(this,0.35,{
|
||||
"y":this.y + 70,
|
||||
"onComplete":complete,
|
||||
"ease":Cubic.easeIn
|
||||
});
|
||||
}
|
||||
|
||||
public function complete() : void
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame2
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MiniGame2GroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_score:TextField;
|
||||
|
||||
public var text_time:PiBitTextField;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var mc_1:MiniGame2Hole;
|
||||
|
||||
public var mc_2:MiniGame2Hole;
|
||||
|
||||
public var mc_3:MiniGame2Hole;
|
||||
|
||||
public var mc_4:MiniGame2Hole;
|
||||
|
||||
public var mc_5:MiniGame2Hole;
|
||||
|
||||
public var mc_6:MiniGame2Hole;
|
||||
|
||||
public var mc_7:MiniGame2Hole;
|
||||
|
||||
public var mc_8:MiniGame2Hole;
|
||||
|
||||
public var mc_9:MiniGame2Hole;
|
||||
|
||||
public function MiniGame2GroundUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MiniGame2UI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
text_score.text = "0";
|
||||
text_time.text = "30";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame2
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.effect.effects.ShakeEffect;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class MiniGame2Hole extends UIComponent
|
||||
{
|
||||
|
||||
private static var scaleYo:Number = 0.6;
|
||||
|
||||
private static var scaleXo:Number = 0.9;
|
||||
|
||||
public var bmc:BitMovieClip;
|
||||
|
||||
public var mc_area:Sprite;
|
||||
|
||||
public var curType:int = 0;
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
private var time:int;
|
||||
|
||||
private var movtime:int;
|
||||
|
||||
public var hasMon:Boolean = false;
|
||||
|
||||
public var isout:Boolean = false;
|
||||
|
||||
public var hitnum:int = 0;
|
||||
|
||||
public function MiniGame2Hole(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
StageLocator.setfull(this);
|
||||
}
|
||||
|
||||
public function showMon(type:int = 1, time:int = 1000, movtime:int = 400) : void
|
||||
{
|
||||
this.time = time;
|
||||
this.movtime = movtime;
|
||||
bmc = FF.getBMC("ui.FarmGame2Mon" + type);
|
||||
bmc.y = bmc.height * scaleYo;
|
||||
bmc.scaleY = scaleYo;
|
||||
bmc.scaleX = scaleXo;
|
||||
bmc.stop();
|
||||
addChild(bmc);
|
||||
curType = type;
|
||||
monin();
|
||||
}
|
||||
|
||||
public function monin() : void
|
||||
{
|
||||
hasMon = true;
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
t = TweenMax.to(bmc,movtime / 1000,{
|
||||
"y":0,
|
||||
"scaleY":1,
|
||||
"scaleX":1,
|
||||
"onComplete":monwait
|
||||
});
|
||||
}
|
||||
|
||||
public function monwait() : void
|
||||
{
|
||||
t = TweenMax.to(bmc,time / 1000,{"onComplete":monOut});
|
||||
}
|
||||
|
||||
public function hitslime() : void
|
||||
{
|
||||
bmc.gotoAndStop(2);
|
||||
new ShakeEffect(5).startEffect(bmc);
|
||||
t.kill();
|
||||
}
|
||||
|
||||
public function shake() : void
|
||||
{
|
||||
new ShakeEffect(0,5).startEffect(bmc);
|
||||
}
|
||||
|
||||
public function hitslimeEnd() : void
|
||||
{
|
||||
isout = true;
|
||||
new ShakeEffect(0,5,0.8).startEffect(bmc,monOut);
|
||||
}
|
||||
|
||||
public function monOut() : void
|
||||
{
|
||||
isout = true;
|
||||
curType = 0;
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
t = TweenMax.to(bmc,movtime / 1000,{
|
||||
"y":bmc.height * scaleYo,
|
||||
"scaleY":scaleYo,
|
||||
"scaleX":scaleXo,
|
||||
"onComplete":outOver
|
||||
});
|
||||
}
|
||||
|
||||
public function outOver() : void
|
||||
{
|
||||
isout = false;
|
||||
hasMon = false;
|
||||
bmc.dispose();
|
||||
bmc = null;
|
||||
}
|
||||
|
||||
public function hit() : void
|
||||
{
|
||||
new ShakeEffect(0,5,0.8).startEffect(bmc);
|
||||
bmc.y += 17;
|
||||
bmc.scaleY -= 0.05;
|
||||
bmc.gotoAndStop(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame2
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.base.mov.Movier;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.CountDownMov;
|
||||
import net.pixvi.myr.panel.minigame.MiniGameTipPanel;
|
||||
import net.pixvi.myr.panel.minigame.MinigameOverPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class MiniGame2_MoleHitter extends BaseMiniGame
|
||||
{
|
||||
|
||||
public static var GAME_TYPE:int = 2;
|
||||
|
||||
public var maxPoint:int = 400;
|
||||
|
||||
public var ui:MiniGame2GroundUI;
|
||||
|
||||
public var cd:CountDownMov;
|
||||
|
||||
public var gametime:int = 30;
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public var level:int = 1;
|
||||
|
||||
public var holes:Array;
|
||||
|
||||
public var mc_ham:Movier;
|
||||
|
||||
public var nian:Boolean = false;
|
||||
|
||||
public var curniantime:int = 0;
|
||||
|
||||
public var niantime:int = 5;
|
||||
|
||||
public var nianhole:MiniGame2Hole;
|
||||
|
||||
public var overpanel:MinigameOverPanel;
|
||||
|
||||
public var rewardvo:RewardVo;
|
||||
|
||||
public var showSpeedUp:Boolean = false;
|
||||
|
||||
public function MiniGame2_MoleHitter()
|
||||
{
|
||||
super();
|
||||
ui = new MiniGame2GroundUI();
|
||||
addChild(ui);
|
||||
}
|
||||
|
||||
override public function gamestart() : void
|
||||
{
|
||||
var tipPanel:MiniGameTipPanel = new MiniGameTipPanel(2);
|
||||
SoundCenter.getIns().bgmPlay(GameSound.bgm_funny);
|
||||
PopCenter.POP(tipPanel);
|
||||
PopCenter.getIns().traceInfo();
|
||||
tipPanel.onComplete = tipOver;
|
||||
}
|
||||
|
||||
public function tipOver() : void
|
||||
{
|
||||
cd = new CountDownMov(realstart);
|
||||
cd.start();
|
||||
addChild(cd);
|
||||
}
|
||||
|
||||
public function realstart() : void
|
||||
{
|
||||
cd.dispose();
|
||||
level = 1;
|
||||
showSpeedUp = false;
|
||||
score.val = 0;
|
||||
holes = [ui.mc_1,ui.mc_2,ui.mc_3,ui.mc_4,ui.mc_5,ui.mc_6,ui.mc_7,ui.mc_8,ui.mc_9];
|
||||
timer = new Timer(500,gametime * 2);
|
||||
timer.addEventListener("timer",timerHandler);
|
||||
timer.addEventListener("timerComplete",gameoverHandler);
|
||||
timer.start();
|
||||
mc_ham = new Movier(FF.getFC("ui.FarmGame2Hammer"));
|
||||
mc_ham.gotoStatus("hide");
|
||||
mc_ham.mouseChildren = mc_ham.mouseEnabled = false;
|
||||
addChild(mc_ham);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
for each(var h:MiniGame2Hole in holes)
|
||||
{
|
||||
h.addEventListener(MobiEvent.MOUSE_DOWN,downHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler,true);
|
||||
gameoverHandler();
|
||||
}
|
||||
|
||||
public function gameoverHandler(e:Event = null) : void
|
||||
{
|
||||
if(mc_ham != null)
|
||||
{
|
||||
mc_ham.removeEventListener("hitend",nianStart);
|
||||
}
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,nianDown);
|
||||
timer.removeEventListener("timerComplete",gameoverHandler);
|
||||
timer.removeEventListener("timer",timerHandler);
|
||||
Caller.delayCall(showOverHandler,2200);
|
||||
}
|
||||
|
||||
public function showOverHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel = new MinigameOverPanel();
|
||||
PopCenter.POP(overpanel);
|
||||
overpanel.show(score.val,GAME_TYPE);
|
||||
overpanel.ui.btn_yes.onClick(yesHandler);
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
dispose();
|
||||
gameover();
|
||||
}
|
||||
|
||||
public function onShowPanelComplete(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
gameover();
|
||||
dispose();
|
||||
}
|
||||
|
||||
public function downHandler(e:Event = null) : void
|
||||
{
|
||||
var num:JumpNumMc = null;
|
||||
if(nian)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var hole:MiniGame2Hole = e.currentTarget as MiniGame2Hole;
|
||||
if(hole.hasMon && !hole.isout)
|
||||
{
|
||||
if(hole.curType == 3)
|
||||
{
|
||||
hole.hitslime();
|
||||
nian = true;
|
||||
nianhole = hole;
|
||||
mc_ham.addEventListener("hitend",nianStart);
|
||||
SoundCenter.getIns().play(GameSound.effect_skill_slice);
|
||||
mc_ham.gotoAction("hit");
|
||||
mc_ham.play();
|
||||
mc_ham.x = hole.x;
|
||||
mc_ham.y = hole.y;
|
||||
}
|
||||
else if(hole.hitnum > 0)
|
||||
{
|
||||
hole.hitnum--;
|
||||
hole.hit();
|
||||
if(hole.hitnum == 1 || Random.direction() == 1)
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_damutong1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_damutong2);
|
||||
}
|
||||
num = new JumpNumMc();
|
||||
if(hole.curType == 1)
|
||||
{
|
||||
num.addCenter("mov.Add1");
|
||||
score.val += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
score.val += 3;
|
||||
num.addCenter("mov.Add3");
|
||||
}
|
||||
ui.text_score.text = score.val.toString();
|
||||
num.x = hole.x;
|
||||
num.y = hole.y - 100;
|
||||
addChild(num);
|
||||
num.start();
|
||||
mc_ham.gotoAction("hit");
|
||||
mc_ham.play();
|
||||
mc_ham.x = hole.x;
|
||||
mc_ham.y = hole.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function nianStart(e:Event = null) : void
|
||||
{
|
||||
mc_ham.removeEventListener("hitend",nianStart);
|
||||
curniantime = niantime;
|
||||
mc_ham.gotoStatus("nian");
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,nianDown);
|
||||
}
|
||||
|
||||
public function nianDown(e:Event = null) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_skill_slice,0.6);
|
||||
mc_ham.gotoAction("nian2");
|
||||
curniantime--;
|
||||
if(curniantime == 0)
|
||||
{
|
||||
nianEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
nianhole.shake();
|
||||
}
|
||||
}
|
||||
|
||||
public function nianEnd() : void
|
||||
{
|
||||
nianhole.hitslimeEnd();
|
||||
nian = false;
|
||||
nianhole = null;
|
||||
mc_ham.gotoStatus("hide");
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,nianDown);
|
||||
}
|
||||
|
||||
public function timerHandler(e:Event = null) : void
|
||||
{
|
||||
var hole:MiniGame2Hole = null;
|
||||
var num:JumpNumMc = null;
|
||||
trace("tiemr",timer.currentCount);
|
||||
ui.text_time.text = (gametime - int(timer.currentCount / 2)).toString();
|
||||
var hasmon:Boolean = false;
|
||||
while(true)
|
||||
{
|
||||
hole = Random.element(holes) as MiniGame2Hole;
|
||||
if(hole.hasMon)
|
||||
{
|
||||
break;
|
||||
}
|
||||
hasmon = true;
|
||||
if(timer.currentCount <= gametime)
|
||||
{
|
||||
hole.showMon(int(Random.element([1,1,2,3,3])));
|
||||
}
|
||||
else
|
||||
{
|
||||
hole.showMon(int(Random.element([1,1,2,3,3])),700,150);
|
||||
}
|
||||
hole.hitnum = 2;
|
||||
}
|
||||
if(!showSpeedUp && timer.currentCount > gametime)
|
||||
{
|
||||
showSpeedUp = true;
|
||||
num = new JumpNumMc();
|
||||
num.randomx = 0;
|
||||
num.addCenter("mov.SpeedUp");
|
||||
num.x = StageDriver.stageWidth / 2;
|
||||
num.y = StageDriver.stageHeight / 2;
|
||||
num.start();
|
||||
addChild(num);
|
||||
}
|
||||
if(hasmon)
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_maochulai);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame3
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class Block2048
|
||||
{
|
||||
|
||||
public var display:Block2048Display;
|
||||
|
||||
private var _level:int;
|
||||
|
||||
public var x:int;
|
||||
|
||||
public var y:int;
|
||||
|
||||
public var n_hide:Boolean;
|
||||
|
||||
public var n_up:Boolean;
|
||||
|
||||
public var n_show:Boolean;
|
||||
|
||||
public function Block2048()
|
||||
{
|
||||
super();
|
||||
display = new Block2048Display();
|
||||
x = 0;
|
||||
y = 0;
|
||||
display = new Block2048Display();
|
||||
n_show = true;
|
||||
resetStatus();
|
||||
}
|
||||
|
||||
public function get level() : int
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
public function set level(val:int) : void
|
||||
{
|
||||
if(val > 15)
|
||||
{
|
||||
val = 15;
|
||||
}
|
||||
_level = val;
|
||||
}
|
||||
|
||||
public function resetStatus() : void
|
||||
{
|
||||
n_hide = false;
|
||||
n_up = false;
|
||||
}
|
||||
|
||||
public function randomCreate() : void
|
||||
{
|
||||
level = int(Random.element([1,1,1,2,2]));
|
||||
}
|
||||
|
||||
public function moveTarget(target:Sprite, moveComplete:Function = null) : void
|
||||
{
|
||||
TweenMax.to(display,0.25,{
|
||||
"x":target.x,
|
||||
"y":target.y,
|
||||
"onComplete":moveComplete
|
||||
});
|
||||
}
|
||||
|
||||
public function show() : void
|
||||
{
|
||||
if(n_show)
|
||||
{
|
||||
TweenMax.fromTo(display,0.2,{"alpha":0},{"alpha":1});
|
||||
display.changePic(this.level);
|
||||
n_show = false;
|
||||
}
|
||||
else if(n_hide)
|
||||
{
|
||||
SoundCenter.getInstance().play(GameSound.effect_hit_slime2);
|
||||
TweenMax.fromTo(display,0.2,{
|
||||
"alpha":1,
|
||||
"scaleX":1,
|
||||
"scaleY":1
|
||||
},{
|
||||
"alpha":0,
|
||||
"scaleX":0.1,
|
||||
"scaleY":0.1,
|
||||
"onComplete":dispose
|
||||
});
|
||||
}
|
||||
else if(n_up)
|
||||
{
|
||||
display.changePic(level);
|
||||
TweenMax.fromTo(display,0.5,{
|
||||
"scaleX":0.3,
|
||||
"scaleY":0.3
|
||||
},{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function dispose() : void
|
||||
{
|
||||
display.dispose();
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "000" + level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame3
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class Block2048Display extends PiSprite
|
||||
{
|
||||
|
||||
public var bm:Bitmap;
|
||||
|
||||
public function Block2048Display()
|
||||
{
|
||||
super();
|
||||
alpha = 0;
|
||||
}
|
||||
|
||||
public function changePic(level:int) : void
|
||||
{
|
||||
if(bm != null)
|
||||
{
|
||||
removeChild(bm);
|
||||
}
|
||||
bm = FF.getBM("game3.pic_" + level,"auto",true);
|
||||
bm.x -= bm.width / 2;
|
||||
bm.y -= bm.height / 2;
|
||||
addChild(bm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame3
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
|
||||
public class Block2048PointShow extends PiSprite
|
||||
{
|
||||
|
||||
public function Block2048PointShow(point:int, target:Sprite)
|
||||
{
|
||||
var bc:BitMovieClip = null;
|
||||
super();
|
||||
addChild(bc = FF.getBMC("mc_break"));
|
||||
Director.playOnce(bc);
|
||||
addChild(FF.getBM("game3.point_" + point));
|
||||
bc.x += 7;
|
||||
bc.y += 36;
|
||||
this.x = target.x - 20;
|
||||
this.y = target.y - target.height / 3;
|
||||
TweenMax.to(this,1.5,{
|
||||
"y":this.y - 50,
|
||||
"alpha":0,
|
||||
"onComplete":onComplete
|
||||
});
|
||||
}
|
||||
|
||||
public function onComplete() : void
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame3
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiButton;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MiniGame3GroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_start:PiButton;
|
||||
|
||||
public var text_maxlevel:TextField;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var container_img:PiImgContainer;
|
||||
|
||||
public var btn_menu:PiButton;
|
||||
|
||||
public var text_point:TextField;
|
||||
|
||||
public var block_11:Sprite;
|
||||
|
||||
public var block_12:Sprite;
|
||||
|
||||
public var block_13:Sprite;
|
||||
|
||||
public var block_14:Sprite;
|
||||
|
||||
public var block_21:Sprite;
|
||||
|
||||
public var block_22:Sprite;
|
||||
|
||||
public var block_23:Sprite;
|
||||
|
||||
public var block_24:Sprite;
|
||||
|
||||
public var block_31:Sprite;
|
||||
|
||||
public var block_32:Sprite;
|
||||
|
||||
public var block_33:Sprite;
|
||||
|
||||
public var block_34:Sprite;
|
||||
|
||||
public var block_41:Sprite;
|
||||
|
||||
public var block_42:Sprite;
|
||||
|
||||
public var block_43:Sprite;
|
||||
|
||||
public var block_44:Sprite;
|
||||
|
||||
public function MiniGame3GroundUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MiniGame3UI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
container_img.setSize(101,101);
|
||||
StageLocator.setSide(btn_close,"left","none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+560
@@ -0,0 +1,560 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame3
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.KeyboardEvent;
|
||||
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.effect.effects.ShakeEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.MiniGameTipPanel;
|
||||
import net.pixvi.myr.panel.minigame.MinigameOverPanel;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.Array2D;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.debug.CT;
|
||||
|
||||
public class MiniGame3_SlimCombiner extends BaseMiniGame
|
||||
{
|
||||
|
||||
public static var GAME_TYPE:int = 3;
|
||||
|
||||
public var ui:MiniGame3GroundUI;
|
||||
|
||||
public var layer_menu:PiSprite;
|
||||
|
||||
public var layer_main:PiSprite;
|
||||
|
||||
public var layer_bg:PiSprite;
|
||||
|
||||
public var layer_top:PiSprite;
|
||||
|
||||
public var arr2d:Array2D;
|
||||
|
||||
public var count:int = 1;
|
||||
|
||||
public var change:int = 0;
|
||||
|
||||
public var mixPoint:Array = [0,1,2,4,8,16,32,64,128,256,512,1024,2048,2048,2048,2048,2048];
|
||||
|
||||
public var eatBlock:Array;
|
||||
|
||||
public var showing:Boolean = false;
|
||||
|
||||
public var maxLevel:int;
|
||||
|
||||
public var startx:Number;
|
||||
|
||||
public var starty:Number;
|
||||
|
||||
public var overpanel:MinigameOverPanel;
|
||||
|
||||
public function MiniGame3_SlimCombiner()
|
||||
{
|
||||
super();
|
||||
addChild(layer_bg = new PiSprite());
|
||||
addChild(layer_main = new PiSprite());
|
||||
addChild(layer_menu = new PiSprite());
|
||||
addChild(layer_top = new PiSprite());
|
||||
layer_menu.addChild(ui = new MiniGame3GroundUI());
|
||||
}
|
||||
|
||||
override public function gamestart() : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
SoundCenter.getIns().bgmPlay(GameSound.bgm_funny);
|
||||
prepareGame();
|
||||
startGame();
|
||||
var tipPanel:MiniGameTipPanel = new MiniGameTipPanel(3);
|
||||
PopCenter.POP(tipPanel);
|
||||
tipPanel.onComplete = tipOver;
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
Alert.yesno(lang("退出游戏"),lang("是否退出当前游戏?"),yesCloseHandler);
|
||||
}
|
||||
|
||||
public function yesCloseHandler(e:Event = null) : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler,true);
|
||||
finishGame();
|
||||
}
|
||||
|
||||
public function tipOver() : void
|
||||
{
|
||||
StageDriver.stage.addEventListener("keyDown",keyHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_UP,touchOverHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,touchHandler);
|
||||
}
|
||||
|
||||
public function prepareGame() : void
|
||||
{
|
||||
score.val = 0;
|
||||
arr2d = new Array2D(4,4);
|
||||
showing = false;
|
||||
count = 1;
|
||||
change = 0;
|
||||
maxLevel = 0;
|
||||
eatBlock = [];
|
||||
joinBlock(2,2,2);
|
||||
joinBlock(3,2,1);
|
||||
joinBlock(3,3,1);
|
||||
maxLevel = 2;
|
||||
fillMaxStone();
|
||||
startShow();
|
||||
ui.text_point.text = "0";
|
||||
}
|
||||
|
||||
public function joinRandomBlock() : void
|
||||
{
|
||||
var block:Block2048 = new Block2048();
|
||||
block.level = count % 4 == 0 ? 2 : 1;
|
||||
count++;
|
||||
var p:Point = arr2d.getRandomVoid();
|
||||
if(p == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
block.x = p.x;
|
||||
block.y = p.y;
|
||||
layer_top.addChild(block.display);
|
||||
block.n_show = true;
|
||||
block.display.x = ui["block_" + block.x + "" + block.y].x;
|
||||
block.display.y = ui["block_" + block.x + "" + block.y].y;
|
||||
arr2d.set(p.x,p.y,block);
|
||||
}
|
||||
|
||||
public function joinBlock(x:int, y:int, level:int = 1) : void
|
||||
{
|
||||
var block:Block2048 = new Block2048();
|
||||
block.level = level;
|
||||
count++;
|
||||
block.x = x;
|
||||
block.y = y;
|
||||
layer_top.addChild(block.display);
|
||||
block.n_show = true;
|
||||
block.display.x = ui["block_" + block.x + "" + block.y].x;
|
||||
block.display.y = ui["block_" + block.x + "" + block.y].y;
|
||||
arr2d.set(x,y,block);
|
||||
}
|
||||
|
||||
public function resetAll() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var b:Block2048 = null;
|
||||
change = 0;
|
||||
for(i = 0; i < arr2d.length; )
|
||||
{
|
||||
b = arr2d.arr[i];
|
||||
if(b != null)
|
||||
{
|
||||
b.resetStatus();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function moveAll(direct:int) : void
|
||||
{
|
||||
var fun:Function = null;
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
CT.scan();
|
||||
resetAll();
|
||||
var trr:Array = [];
|
||||
eatBlock = [];
|
||||
switch(direct - 1)
|
||||
{
|
||||
case 0:
|
||||
fun = up;
|
||||
for(i = 0; i < arr2d.length; )
|
||||
{
|
||||
trr.push(arr2d.arr[i]);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
fun = right;
|
||||
for(i = arr2d.width; i >= 1; )
|
||||
{
|
||||
for(j = 1; j <= arr2d.height; )
|
||||
{
|
||||
trr.push(arr2d.get(i,j));
|
||||
j++;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
fun = down;
|
||||
for(i = arr2d.length - 1; i >= 0; )
|
||||
{
|
||||
trr.push(arr2d.arr[i]);
|
||||
i--;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
fun = left;
|
||||
for(i = 1; i <= arr2d.height; )
|
||||
{
|
||||
for(j = 1; j <= arr2d.height; )
|
||||
{
|
||||
trr.push(arr2d.get(i,j));
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < arr2d.length; )
|
||||
{
|
||||
if(trr[i] != null)
|
||||
{
|
||||
fun.call(null,trr[i] as Block2048);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(change > 0)
|
||||
{
|
||||
joinRandomBlock();
|
||||
startMove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(checkGameOver())
|
||||
{
|
||||
finishGame();
|
||||
}
|
||||
roundOver();
|
||||
}
|
||||
}
|
||||
|
||||
public function checkGameOver() : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var b:Block2048 = null;
|
||||
if(arr2d.getRandomVoid() != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i = 0;
|
||||
while(i < arr2d.length)
|
||||
{
|
||||
b = arr2d.arr[i];
|
||||
if(b.x - 1 > 0 && arr2d.get(b.x - 1,b.y).level == b.level)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(b.x + 1 <= arr2d.width && arr2d.get(b.x + 1,b.y).level == b.level)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(b.y - 1 > 0 && arr2d.get(b.x,b.y - 1).level == b.level)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(b.y + 1 <= arr2d.height && arr2d.get(b.x,b.y + 1).level == b.level)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function traceBox() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function up(block:Block2048) : void
|
||||
{
|
||||
arr2d.set(block.x,block.y,null);
|
||||
var y:int = block.y;
|
||||
while(checkBlockToBlock(block,arr2d.get(block.x,y - 1) as Block2048) && y > 1)
|
||||
{
|
||||
y--;
|
||||
}
|
||||
if(block.y != y)
|
||||
{
|
||||
change++;
|
||||
}
|
||||
block.y = y;
|
||||
if(!block.n_hide)
|
||||
{
|
||||
arr2d.set(block.x,block.y,block);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(block:Block2048) : void
|
||||
{
|
||||
arr2d.set(block.x,block.y,null);
|
||||
var y:int = block.y;
|
||||
while(checkBlockToBlock(block,arr2d.get(block.x,y + 1) as Block2048) && y < arr2d.height)
|
||||
{
|
||||
y++;
|
||||
}
|
||||
if(block.y != y)
|
||||
{
|
||||
change++;
|
||||
}
|
||||
block.y = y;
|
||||
if(!block.n_hide)
|
||||
{
|
||||
arr2d.set(block.x,block.y,block);
|
||||
}
|
||||
}
|
||||
|
||||
public function left(block:Block2048) : void
|
||||
{
|
||||
arr2d.set(block.x,block.y,null);
|
||||
var x:int = block.x;
|
||||
while(checkBlockToBlock(block,arr2d.get(x - 1,block.y) as Block2048) && x > 1)
|
||||
{
|
||||
x--;
|
||||
}
|
||||
if(block.x != x)
|
||||
{
|
||||
change++;
|
||||
}
|
||||
block.x = x;
|
||||
if(!block.n_hide)
|
||||
{
|
||||
arr2d.set(block.x,block.y,block);
|
||||
}
|
||||
}
|
||||
|
||||
public function right(block:Block2048) : void
|
||||
{
|
||||
arr2d.set(block.x,block.y,null);
|
||||
for(var x:int = block.x; true; )
|
||||
{
|
||||
if(!(checkBlockToBlock(block,arr2d.get(x + 1,block.y) as Block2048) && x < arr2d.width))
|
||||
{
|
||||
break;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
if(block.x != x)
|
||||
{
|
||||
change++;
|
||||
}
|
||||
block.x = x;
|
||||
if(!block.n_hide)
|
||||
{
|
||||
arr2d.set(block.x,block.y,block);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkBlockToBlock(b1:Block2048, b2:Block2048) : Boolean
|
||||
{
|
||||
if(b2 == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(b2.level == b1.level && !b2.n_up)
|
||||
{
|
||||
layer_top.addChild(b1.display);
|
||||
b2.level++;
|
||||
b2.n_up = true;
|
||||
b1.n_hide = true;
|
||||
eatBlock.push(b1);
|
||||
if(b2.level > maxLevel)
|
||||
{
|
||||
maxLevel = b2.level;
|
||||
fillMaxStone();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getTarget(x:int, y:int) : Sprite
|
||||
{
|
||||
return ui["block_" + x + "" + y];
|
||||
}
|
||||
|
||||
public function startMove() : void
|
||||
{
|
||||
showing = true;
|
||||
var a:Boolean = true;
|
||||
for each(var b:Block2048 in arr2d.arr)
|
||||
{
|
||||
if(b != null)
|
||||
{
|
||||
if(a)
|
||||
{
|
||||
b.moveTarget(getTarget(b.x,b.y),startShow);
|
||||
a = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
b.moveTarget(getTarget(b.x,b.y));
|
||||
}
|
||||
}
|
||||
}
|
||||
for each(var b2:Block2048 in eatBlock)
|
||||
{
|
||||
b2.moveTarget(getTarget(b2.x,b2.y));
|
||||
}
|
||||
}
|
||||
|
||||
public function startShow() : void
|
||||
{
|
||||
var p:Block2048PointShow = null;
|
||||
var a:Boolean = true;
|
||||
for each(var b:Block2048 in arr2d.arr)
|
||||
{
|
||||
if(b != null)
|
||||
{
|
||||
if(b.n_up)
|
||||
{
|
||||
p = new Block2048PointShow(mixPoint[b.level],getTarget(b.x,b.y));
|
||||
score.val += mixPoint[b.level];
|
||||
ui.text_point.text = score.val.toString();
|
||||
layer_top.addChild(p);
|
||||
}
|
||||
b.show();
|
||||
}
|
||||
}
|
||||
for each(var b2:Block2048 in eatBlock)
|
||||
{
|
||||
b2.show();
|
||||
}
|
||||
showing = false;
|
||||
}
|
||||
|
||||
public function roundOver() : void
|
||||
{
|
||||
showing = false;
|
||||
}
|
||||
|
||||
public function startGame() : void
|
||||
{
|
||||
maxLevel = 1;
|
||||
}
|
||||
|
||||
public function touchHandler(e:Event) : void
|
||||
{
|
||||
startx = MobiEvent.getStageX(e);
|
||||
starty = MobiEvent.getStageY(e);
|
||||
}
|
||||
|
||||
public function touchOverHandler(e:Object) : void
|
||||
{
|
||||
if(showing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var w:Number = e.stageX - startx;
|
||||
var h:Number = e.stageY - starty;
|
||||
if(Math.abs(w) < 60 && Math.abs(h) < 60)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(Math.abs(w) > Math.abs(h))
|
||||
{
|
||||
if(e.stageX > startx)
|
||||
{
|
||||
moveAll(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveAll(4);
|
||||
}
|
||||
}
|
||||
else if(e.stageY > starty)
|
||||
{
|
||||
moveAll(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveAll(1);
|
||||
}
|
||||
}
|
||||
|
||||
public function keyHandler(e:KeyboardEvent) : void
|
||||
{
|
||||
if(showing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch(e.keyCode)
|
||||
{
|
||||
case 87:
|
||||
case 38:
|
||||
moveAll(1);
|
||||
break;
|
||||
case 68:
|
||||
case 39:
|
||||
moveAll(2);
|
||||
break;
|
||||
case 83:
|
||||
case 40:
|
||||
moveAll(3);
|
||||
break;
|
||||
case 65:
|
||||
case 37:
|
||||
moveAll(4);
|
||||
}
|
||||
}
|
||||
|
||||
public function fillMaxStone() : void
|
||||
{
|
||||
var targetLevel:int = maxLevel + 1;
|
||||
if(targetLevel > 15)
|
||||
{
|
||||
targetLevel = 15;
|
||||
}
|
||||
ui.container_img.loadImg(FF.getBM("game3.pic_" + targetLevel,"auto",true));
|
||||
ui.text_maxlevel.text = "LV:" + targetLevel;
|
||||
}
|
||||
|
||||
public function finishGame(e:Event = null) : void
|
||||
{
|
||||
StageDriver.stage.removeEventListener("keyDown",keyHandler);
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_UP,touchOverHandler);
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,touchHandler);
|
||||
maxLevel = maxLevel;
|
||||
new ShakeEffect(10,0,0.9).startEffect(this);
|
||||
SoundCenter.getIns().play(GameSound.effect_damutong2);
|
||||
Caller.delayCall(showOverHandler,2200);
|
||||
}
|
||||
|
||||
public function showOverHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel = new MinigameOverPanel();
|
||||
PopCenter.POP(overpanel);
|
||||
overpanel.show(score.val,GAME_TYPE);
|
||||
overpanel.ui.btn_yes.onClick(yesHandler);
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
removeGame();
|
||||
dispose();
|
||||
gameover();
|
||||
}
|
||||
|
||||
public function removeGame() : void
|
||||
{
|
||||
StageDriver.stage.removeEventListener("keyDown",keyHandler);
|
||||
StageDriver.stage.removeEventListener("touchEnd",touchOverHandler);
|
||||
StageDriver.stage.removeEventListener("touchBegin",touchHandler);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
removeGame();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame4
|
||||
{
|
||||
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.PiBitTextField;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MiniGame4GroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_point:PiBitTextField;
|
||||
|
||||
public var text_stage:PiBitTextField;
|
||||
|
||||
public var mc_hero:MovieClip;
|
||||
|
||||
public var mc_rmv:MovieClip;
|
||||
|
||||
public var mc_lmv:MovieClip;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var mc_roleContainer:Sprite;
|
||||
|
||||
public function MiniGame4GroundUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MiniGame4UI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame4
|
||||
{
|
||||
import flash.geom.Point;
|
||||
import net.pixvi.common.effect.effects.AlphaEffect;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Pointer;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class MiniGame4Ren extends PiSprite
|
||||
{
|
||||
|
||||
public var sex:int;
|
||||
|
||||
public var speed:Number;
|
||||
|
||||
public var image:BitMovieClip;
|
||||
|
||||
public var target:Point;
|
||||
|
||||
public var final:int = -1;
|
||||
|
||||
public var money:int = 0;
|
||||
|
||||
public function MiniGame4Ren(sex:int, speed:Number)
|
||||
{
|
||||
super();
|
||||
if(sex == -1)
|
||||
{
|
||||
sex = 0;
|
||||
}
|
||||
this.sex = sex;
|
||||
this.speed = speed;
|
||||
build();
|
||||
this.x = Random.integer(246,425);
|
||||
this.y = -30;
|
||||
target = new Point(Random.integer(203,440),650);
|
||||
}
|
||||
|
||||
public function build() : void
|
||||
{
|
||||
if(sex == 1)
|
||||
{
|
||||
addChild(image = FF.getBMC("minigame4.Blue",3));
|
||||
}
|
||||
else
|
||||
{
|
||||
addChild(image = FF.getBMC("minigame4.Red",3));
|
||||
}
|
||||
image.scaleX = Random.direction();
|
||||
this.setScale(0.7);
|
||||
}
|
||||
|
||||
public function gameover() : void
|
||||
{
|
||||
image.stop();
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
var myPoint:Point = null;
|
||||
var newP:Point = null;
|
||||
var nscale:Number = NaN;
|
||||
if(target != null)
|
||||
{
|
||||
myPoint = new Point(this.x,this.y);
|
||||
newP = Pointer.Point2Point(myPoint,target,speed);
|
||||
this.x = newP.x;
|
||||
this.y = newP.y;
|
||||
nscale = this.scaleX;
|
||||
nscale += 0.0017;
|
||||
if(nscale > 1)
|
||||
{
|
||||
nscale = 1;
|
||||
}
|
||||
setScale(nscale);
|
||||
if(Point.distance(myPoint,target) <= 10)
|
||||
{
|
||||
if(final == -1)
|
||||
{
|
||||
this.final = MiniGame4_WCCommander.GP.side;
|
||||
if(this.final == 1)
|
||||
{
|
||||
target = new Point(41,775);
|
||||
image.scaleX = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
image.scaleX = -1;
|
||||
target = new Point(601,775);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function complete() : void
|
||||
{
|
||||
if(this.sex == this.final)
|
||||
{
|
||||
MiniGame4_WCCommander.GP.manInAtHome(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
MiniGame4_WCCommander.GP.endgame(this);
|
||||
}
|
||||
}
|
||||
|
||||
public function showOut() : void
|
||||
{
|
||||
image.stop();
|
||||
new AlphaEffect().startEffect(image,dispose);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame4
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.MiniGameTipPanel;
|
||||
import net.pixvi.myr.panel.minigame.MinigameOverPanel;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.Sorter;
|
||||
|
||||
public class MiniGame4_WCCommander extends BaseMiniGame
|
||||
{
|
||||
|
||||
public static var GAME_TYPE:int = 4;
|
||||
|
||||
public static var GP:MiniGame4_WCCommander;
|
||||
|
||||
public var ui:MiniGame4GroundUI;
|
||||
|
||||
public var roleContainer:Sprite;
|
||||
|
||||
public var level:PointLocker;
|
||||
|
||||
public var side:int = 1;
|
||||
|
||||
public var jummper:Jumper = new Jumper(4);
|
||||
|
||||
public var addOneTimer:Timer;
|
||||
|
||||
public var levelTimer:Timer = new Timer(5000);
|
||||
|
||||
public var cd:Cooldowner;
|
||||
|
||||
public var rens:Array;
|
||||
|
||||
public var overpanel:MinigameOverPanel;
|
||||
|
||||
public function MiniGame4_WCCommander()
|
||||
{
|
||||
super();
|
||||
level = new PointLocker();
|
||||
GP = this;
|
||||
cd = new Cooldowner(400);
|
||||
cd.quickCooldown();
|
||||
ui = new MiniGame4GroundUI();
|
||||
addChild(ui);
|
||||
prepareGame();
|
||||
roleContainer = ui.mc_roleContainer;
|
||||
rens = [];
|
||||
}
|
||||
|
||||
override public function gamestart() : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
SoundCenter.getIns().bgmPlay(GameSound.bgm_funny);
|
||||
prepareGame();
|
||||
var tipPanel:MiniGameTipPanel = new MiniGameTipPanel(4);
|
||||
PopCenter.POP(tipPanel);
|
||||
tipPanel.onComplete = realStart;
|
||||
}
|
||||
|
||||
public function realStart(e:Event = null) : void
|
||||
{
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,touchHandler);
|
||||
addOneTimer.addEventListener("timer",addOneTimerHandler);
|
||||
addOneTimer.start();
|
||||
levelTimer.start();
|
||||
EnterFrameDriver.getInstance().regist(step);
|
||||
levelTimer.addEventListener("timer",levelUp);
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
if(jummper.jump())
|
||||
{
|
||||
Sorter.sortContainerByY(roleContainer);
|
||||
}
|
||||
for each(var ren:MiniGame4Ren in rens)
|
||||
{
|
||||
ren.step();
|
||||
}
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
pause();
|
||||
Alert.yesno(lang("退出游戏"),lang("是否退出当前游戏?"),yesCloseHandler,noCloseHandler);
|
||||
}
|
||||
|
||||
public function yesCloseHandler(e:Event = null) : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler,true);
|
||||
endgame();
|
||||
}
|
||||
|
||||
public function noCloseHandler(e:Event = null) : void
|
||||
{
|
||||
resume();
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,touchHandler);
|
||||
EnterFrameDriver.getIns().remove(step);
|
||||
levelTimer.removeEventListener("timer",levelUp);
|
||||
addOneTimer.removeEventListener("timer",addOneTimerHandler);
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,touchHandler);
|
||||
EnterFrameDriver.getInstance().regist(step);
|
||||
levelTimer.addEventListener("timer",levelUp);
|
||||
addOneTimer.addEventListener("timer",addOneTimerHandler);
|
||||
}
|
||||
|
||||
protected function addOneTimerHandler(event:TimerEvent) : void
|
||||
{
|
||||
if(!cd.cooldown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var speed:Number = 2 + level.val / 10;
|
||||
var ren:MiniGame4Ren = new MiniGame4Ren(Random.direction(),speed);
|
||||
rens.push(ren);
|
||||
SoundCenter.getIns().play(GameSound.soundName("effect_maochulai"));
|
||||
roleContainer.addChild(ren);
|
||||
}
|
||||
|
||||
public function manInAtHome(ren:MiniGame4Ren) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.soundName("click_mon"));
|
||||
score.val += int(5 * ren.speed);
|
||||
ui.text_point.text = score.val.toString();
|
||||
ren.showOut();
|
||||
ArrayUtil.remove(rens,ren);
|
||||
}
|
||||
|
||||
public function levelUp(e:Event = null) : void
|
||||
{
|
||||
level.val++;
|
||||
refreshInfo();
|
||||
addOneTimer.stop();
|
||||
var tdelay:int = 1400 - level.val * 100;
|
||||
cd.activity();
|
||||
addOneTimer.start();
|
||||
if(tdelay < 500)
|
||||
{
|
||||
addOneTimer.delay = 400;
|
||||
}
|
||||
else
|
||||
{
|
||||
addOneTimer.delay = tdelay;
|
||||
}
|
||||
}
|
||||
|
||||
public function endgame(ren:MiniGame4Ren = null) : void
|
||||
{
|
||||
for each(var rren:MiniGame4Ren in rens)
|
||||
{
|
||||
rren.gameover();
|
||||
}
|
||||
EnterFrameDriver.getInstance().remove(step);
|
||||
addOneTimer.stop();
|
||||
addOneTimer.removeEventListener("timer",addOneTimerHandler);
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,touchHandler);
|
||||
levelTimer.stop();
|
||||
levelTimer.removeEventListener("timer",levelUp);
|
||||
if(ren != null)
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_damutong1);
|
||||
SoundCenter.getIns().play(GameSound.soundName("juuuu"));
|
||||
TweenMax.to(ren,1,{
|
||||
"scaleX":1.3,
|
||||
"scaleY":1.3,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
}
|
||||
Caller.delayCall(showOverHandler,1000);
|
||||
}
|
||||
|
||||
public function prepareGame() : void
|
||||
{
|
||||
score.val = 0;
|
||||
addOneTimer = new Timer(1400);
|
||||
side = 1;
|
||||
level.val = 1;
|
||||
refreshInfo();
|
||||
ui.mc_hero.gotoAndStop(1);
|
||||
ui.text_point.text = score.val.toString();
|
||||
}
|
||||
|
||||
private function touchHandler(e:Object = null) : void
|
||||
{
|
||||
var x:Number = Number(e.stageX);
|
||||
SoundCenter.getIns().play(GameSound.soundName("hit_start1"));
|
||||
if(x < StageDriver.stageWidth / 2)
|
||||
{
|
||||
side = 1;
|
||||
ui.mc_lmv.gotoAndPlay(1);
|
||||
ui.mc_hero.gotoAndStop(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
side = 0;
|
||||
ui.mc_rmv.gotoAndPlay(1);
|
||||
ui.mc_hero.gotoAndStop(2);
|
||||
}
|
||||
}
|
||||
|
||||
public function refreshInfo(e:Event = null) : void
|
||||
{
|
||||
ui.text_point.text = score.val.toString();
|
||||
ui.text_stage.text = level.val.toString();
|
||||
}
|
||||
|
||||
public function showOverHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel = new MinigameOverPanel();
|
||||
PopCenter.POP(overpanel);
|
||||
overpanel.show(score.val,GAME_TYPE);
|
||||
overpanel.ui.btn_yes.onClick(yesOverHandler);
|
||||
}
|
||||
|
||||
public function yesOverHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
dispose();
|
||||
gameover();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame5
|
||||
{
|
||||
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.PiBitTextField;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MiniGame5GroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_point:PiBitTextField;
|
||||
|
||||
public var text_time:PiBitTextField;
|
||||
|
||||
public var mc_bg:Sprite;
|
||||
|
||||
public var mc_hand:MovieClip;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public var mc_container:Sprite;
|
||||
|
||||
public function MiniGame5GroundUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MiniGame5UI");
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_hand.visible = false;
|
||||
mc_hand.mouseChildren = mc_hand.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame5
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import com.greensock.easing.Linear;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.center.EffectCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
import net.pixvi.pfw.utils.Locator;
|
||||
import net.pixvi.pfw.utils.Pointer;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class MiniGame5_Dae extends PiSprite
|
||||
{
|
||||
|
||||
public static var GameSetting:Object = {
|
||||
"1":{
|
||||
"idleTime":400,
|
||||
"movLen":100,
|
||||
"movSpd":0.6,
|
||||
"scoreMov":"game3.point_1",
|
||||
"spdRandom":0.005,
|
||||
"score":1
|
||||
},
|
||||
"2":{
|
||||
"idleTime":250,
|
||||
"movLen":80,
|
||||
"movSpd":1.2,
|
||||
"scoreMov":"game3.point_2",
|
||||
"spdRandom":0.01,
|
||||
"score":2
|
||||
},
|
||||
"3":{
|
||||
"idleTime":100,
|
||||
"movLen":90,
|
||||
"movSpd":1.8,
|
||||
"scoreMov":"game3.point_4",
|
||||
"spdRandom":0.015,
|
||||
"score":4
|
||||
}
|
||||
};
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var bmc:BitMovieClip;
|
||||
|
||||
public var fla:BitMovieClip;
|
||||
|
||||
public var targetPoint:Point;
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var idleCd:Cooldowner;
|
||||
|
||||
public var status:int = 0;
|
||||
|
||||
public var addSpd:Number = 0;
|
||||
|
||||
public var movet:TweenMax;
|
||||
|
||||
public function MiniGame5_Dae(type:int, rec:Rectangle)
|
||||
{
|
||||
var shadow:BitMovieClip = null;
|
||||
super();
|
||||
bmc = FF.getBMC("mov.Dae");
|
||||
var fla:BitMovieClip = FF.getBMC("ui.Game2Flash");
|
||||
if(type == 0)
|
||||
{
|
||||
type = Random.integer(1,3);
|
||||
}
|
||||
this.type = type;
|
||||
bmc.gotoAndStop(type);
|
||||
addChild(shadow = FF.getBMC("mc.minigame5_shadow"));
|
||||
bmc.x += 7;
|
||||
shadow.x += 7;
|
||||
addChild(bmc);
|
||||
this.rec = rec;
|
||||
if(Random.direction() == 1)
|
||||
{
|
||||
this.x = rec.x;
|
||||
this.y = Random.number(rec.y,rec.y + rec.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.x = rec.x + rec.width;
|
||||
this.y = Random.number(rec.y,rec.y + rec.height);
|
||||
}
|
||||
idleCd = new Cooldowner(idleTime);
|
||||
movet = TweenMax.to(bmc,0.2,{
|
||||
"scaleY":0.9,
|
||||
"repeat":9999,
|
||||
"yoyo":true,
|
||||
"ease":Linear.easeOut
|
||||
});
|
||||
}
|
||||
|
||||
public function stop() : void
|
||||
{
|
||||
movet.kill();
|
||||
}
|
||||
|
||||
public function beCatch() : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.soundName("mon_e" + Random.integer(1,3)));
|
||||
movet.kill();
|
||||
TweenMax.fromTo(bmc,1,{
|
||||
"scaleX":1.4,
|
||||
"scaleY":0.7
|
||||
},{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Elastic.easeOut,
|
||||
"onComplete":dispose
|
||||
});
|
||||
var score:BitMovieClip = FF.getBMC(GameSetting[type].scoreMov);
|
||||
new FlashEffect(900,16763904,1).startEffect(bmc);
|
||||
score.y = -155;
|
||||
score.x = -30;
|
||||
score.setScale(2);
|
||||
if(this.scaleX < 0)
|
||||
{
|
||||
score.scaleX *= -1;
|
||||
}
|
||||
if(type == 3)
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.soundName("effect_stars"));
|
||||
EffectCenter.open_effect(this.x,this.y - 70,40,1,1);
|
||||
}
|
||||
addChild(score);
|
||||
TweenMax.to(score,1,{
|
||||
"y":score.y - 30,
|
||||
"onComplete":score.dispose
|
||||
});
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
var thisP:Point = null;
|
||||
var nP:Point = null;
|
||||
var scale:Number = NaN;
|
||||
if(targetPoint != null)
|
||||
{
|
||||
if(Locator.getPow(this.x,this.y,targetPoint.x,targetPoint.y) < 100)
|
||||
{
|
||||
targetPoint = null;
|
||||
idleCd.activity();
|
||||
movet.pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
thisP = new Point(this.x,this.y);
|
||||
nP = Pointer.Point2Point(thisP,targetPoint,moveSpd);
|
||||
scale = Counter.getAreaByArea(0.6,1,rec.y,rec.y + rec.height,this.y,true);
|
||||
if(this.x < nP.x)
|
||||
{
|
||||
this.scaleY = scale;
|
||||
this.scaleX = -scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scaleY = scale;
|
||||
this.scaleX = scale;
|
||||
}
|
||||
this.x = nP.x;
|
||||
this.y = nP.y;
|
||||
movet.resume();
|
||||
}
|
||||
}
|
||||
else if(idleCd.cooldown)
|
||||
{
|
||||
targetPoint = findRandomPoint();
|
||||
}
|
||||
if(Math.random() < spdRandom)
|
||||
{
|
||||
addSpd = 3;
|
||||
if(fla == null)
|
||||
{
|
||||
fla = FF.getBMC("ui.Game2Flash");
|
||||
}
|
||||
fla.alpha = 1;
|
||||
fla.visible = true;
|
||||
fla.y = -165;
|
||||
fla.x = 32;
|
||||
fla.scaleX = -1;
|
||||
addChild(fla);
|
||||
TweenMax.to(fla,0.5,{
|
||||
"x":45,
|
||||
"alpha":0,
|
||||
"visible":false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function findRandomPoint() : Point
|
||||
{
|
||||
return Random.pointWithRectangle(rec);
|
||||
}
|
||||
|
||||
public function get spdRandom() : Number
|
||||
{
|
||||
return GameSetting[type].spdRandom;
|
||||
}
|
||||
|
||||
public function get moveSpd() : Number
|
||||
{
|
||||
var spd:Number = Number(GameSetting[type].movSpd);
|
||||
if(addSpd > 0)
|
||||
{
|
||||
spd += addSpd;
|
||||
addSpd -= 0.2;
|
||||
}
|
||||
return spd;
|
||||
}
|
||||
|
||||
public function get score() : int
|
||||
{
|
||||
return GameSetting[type].score;
|
||||
}
|
||||
|
||||
public function get idleTime() : Number
|
||||
{
|
||||
return GameSetting[type].idleTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame5
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
|
||||
public class MiniGame5_Hole extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_shadow:Sprite;
|
||||
|
||||
public var mc_hole:MovieClip;
|
||||
|
||||
public var speedX:Number;
|
||||
|
||||
public var speedY:Number;
|
||||
|
||||
public var speedHeight:Number;
|
||||
|
||||
public var holeHeight:Number;
|
||||
|
||||
public var isOver:Boolean = false;
|
||||
|
||||
public function MiniGame5_Hole(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("mc.minigame5_hole");
|
||||
super(skin,autoViewSize,w,h);
|
||||
this.mouseChildren = this.mouseEnabled = false;
|
||||
}
|
||||
|
||||
public function start(speedX:Number, speedY:Number, speedHeight:Number, startHeight:*) : void
|
||||
{
|
||||
startHeight = 300;
|
||||
this.speedX = speedX;
|
||||
this.speedY = speedY;
|
||||
this.speedHeight = speedHeight;
|
||||
this.holeHeight = startHeight;
|
||||
update();
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
this.x += this.speedX * 0.05;
|
||||
this.y += this.speedY * 0.12;
|
||||
holeHeight += this.speedHeight * 0.1;
|
||||
speedHeight -= 2;
|
||||
update();
|
||||
if(holeHeight <= 0)
|
||||
{
|
||||
over();
|
||||
}
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
if(holeHeight < 0)
|
||||
{
|
||||
holeHeight = 0;
|
||||
}
|
||||
mc_hole.y = -holeHeight;
|
||||
if(this.y < 240)
|
||||
{
|
||||
speedY = Math.abs(speedY);
|
||||
}
|
||||
mc_hole.scaleX = mc_hole.scaleY = mc_shadow.scaleX = mc_shadow.scaleY = Counter.getAreaByArea(0.6,1,331,864,this.y,true) * Counter.getAreaByArea(0.8,1,0,200,-mc_hole.y,true);
|
||||
if(mc_hole.y >= 0)
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.soundName("effect_gachaTouch"));
|
||||
over();
|
||||
}
|
||||
}
|
||||
|
||||
public function checking() : Boolean
|
||||
{
|
||||
if(mc_hole.y < -45 && mc_hole.y > -135)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function over() : void
|
||||
{
|
||||
isOver = true;
|
||||
trace(1);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
mc_hole.stop();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
super.reset();
|
||||
mc_shadow.scaleX = mc_shadow.scaleY = 1;
|
||||
mc_hole.scaleX = mc_hole.scaleY = 1;
|
||||
mc_hole.x = mc_shadow.x = mc_hole.y = mc_shadow.y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame5
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.CountDownMov;
|
||||
import net.pixvi.myr.panel.minigame.MiniGameTipPanel;
|
||||
import net.pixvi.myr.panel.minigame.MinigameOverPanel;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.Sorter;
|
||||
|
||||
public class MiniGame5_TaoDaE extends BaseMiniGame
|
||||
{
|
||||
|
||||
public static var GAME_TYPE:int = 5;
|
||||
|
||||
public var ui:MiniGame5GroundUI;
|
||||
|
||||
public var cd:CountDownMov;
|
||||
|
||||
public var gametime:PointLocker;
|
||||
|
||||
public var gesture:Gesturer;
|
||||
|
||||
public var holes:Array = [];
|
||||
|
||||
public var es:Array = [];
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var sortJump:Jumper;
|
||||
|
||||
public var hitJump:Jumper;
|
||||
|
||||
public var eJump:Jumper;
|
||||
|
||||
public var etype:int = 0;
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public var level:int = 1;
|
||||
|
||||
public var overpanel:MinigameOverPanel;
|
||||
|
||||
public var rewardvo:RewardVo;
|
||||
|
||||
public function MiniGame5_TaoDaE()
|
||||
{
|
||||
super();
|
||||
ui = new MiniGame5GroundUI();
|
||||
addChild(ui);
|
||||
rec = new Rectangle(0,249,640,500);
|
||||
sortJump = new Jumper(3);
|
||||
eJump = new Jumper(20);
|
||||
gametime = new PointLocker(20);
|
||||
}
|
||||
|
||||
override public function gamestart() : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
var tipPanel:MiniGameTipPanel = new MiniGameTipPanel(5);
|
||||
SoundCenter.getIns().bgmPlay(GameSound.bgm_funny2);
|
||||
PopCenter.POP(tipPanel);
|
||||
PopCenter.getIns().traceInfo();
|
||||
tipPanel.onComplete = tipOver;
|
||||
}
|
||||
|
||||
public function tipOver() : void
|
||||
{
|
||||
cd = new CountDownMov(realstart);
|
||||
cd.start();
|
||||
addChild(cd);
|
||||
}
|
||||
|
||||
public function realstart() : void
|
||||
{
|
||||
cd.dispose();
|
||||
score.val = 0;
|
||||
gesture = new Gesturer(this,true);
|
||||
gesture.start();
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,downHandler);
|
||||
EnterFrameDriver.getIns().regist(enterHandler);
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
public function updateInfo() : void
|
||||
{
|
||||
ui.text_point.text = score.val.toString();
|
||||
ui.text_time.text = gametime.val.toString();
|
||||
}
|
||||
|
||||
public function enterHandler(e:Event = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var hole:MiniGame5_Hole = null;
|
||||
var type:int = 0;
|
||||
var lunType:int = 0;
|
||||
var dae:MiniGame5_Dae = null;
|
||||
if(sortJump.jump())
|
||||
{
|
||||
Sorter.sortContainerByY(ui.mc_container);
|
||||
}
|
||||
if(gametime.val <= 0 && holes.length == 0)
|
||||
{
|
||||
gameoverHandler();
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
while(i < holes.length)
|
||||
{
|
||||
hole = holes[i];
|
||||
if(!hole.isOver)
|
||||
{
|
||||
hole.step();
|
||||
if(hole.checking())
|
||||
{
|
||||
for each(var de:MiniGame5_Dae in es)
|
||||
{
|
||||
if(Math.abs(de.x - hole.x) < 15 && Math.abs(de.y - hole.y) < 24)
|
||||
{
|
||||
holes.splice(i,1);
|
||||
if(--i < 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
TweenMax.to(hole,0.5,{
|
||||
"scaleX":0.3,
|
||||
"alpha":0,
|
||||
"onComplete":hole.dispose
|
||||
});
|
||||
de.beCatch();
|
||||
ArrayUtil.remove(es,de);
|
||||
for each(dae in es)
|
||||
{
|
||||
dae.addSpd += 5;
|
||||
}
|
||||
score.val += de.score;
|
||||
if(de.type == 3)
|
||||
{
|
||||
gametime.val++;
|
||||
}
|
||||
new FlashEffect(900,16777215).startEffect(ui.text_point);
|
||||
updateInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
de.step();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
holes.splice(i,1);
|
||||
i--;
|
||||
(hole.mc_hole as MovieClip).stop();
|
||||
TweenMax.to(hole,0.5,{
|
||||
"alpha":0,
|
||||
"onComplete":hole.dispose,
|
||||
"x":hole.speedX * 0.5 + hole.x,
|
||||
"y":hole.speedY * 0.5 + hole.y
|
||||
});
|
||||
}
|
||||
i++;
|
||||
}
|
||||
var type3Num:int = 0;
|
||||
for each(de in es)
|
||||
{
|
||||
if(de.type == 3)
|
||||
{
|
||||
type3Num++;
|
||||
}
|
||||
de.step();
|
||||
}
|
||||
if(es.length < 10 && eJump.jump())
|
||||
{
|
||||
type = 0;
|
||||
etype++;
|
||||
lunType = etype % 6;
|
||||
if(lunType == 0)
|
||||
{
|
||||
type = 3;
|
||||
}
|
||||
else if(lunType == 2 || lunType == 4)
|
||||
{
|
||||
type = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = 1;
|
||||
}
|
||||
if(type3Num == 0)
|
||||
{
|
||||
type = 3;
|
||||
}
|
||||
dae = new MiniGame5_Dae(type,rec);
|
||||
es.push(dae);
|
||||
TweenMax.from(dae,0.5,{"alpha":0});
|
||||
ui.mc_container.addChild(dae);
|
||||
}
|
||||
}
|
||||
|
||||
public function downHandler(e:Object = null) : void
|
||||
{
|
||||
if(e.stageY < 749 || gametime.val <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ui.mc_hand.visible = true;
|
||||
ui.mc_hand.gotoAndPlay("prepare");
|
||||
ui.mc_hand.x = e.stageX;
|
||||
ui.mc_hand.y = e.stageY;
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,downHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_UP,upHandler);
|
||||
}
|
||||
|
||||
public function upHandler(e:Object = null) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.soundName("hit_start1"));
|
||||
ui.mc_hand.gotoAndPlay("start");
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_UP,upHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_DOWN,downHandler);
|
||||
var holeh:Number = 0.2 * (1136 - e.stageY);
|
||||
var hole:MiniGame5_Hole = new MiniGame5_Hole();
|
||||
hole.x = ui.mc_hand.x;
|
||||
hole.y = ui.mc_hand.y + holeh;
|
||||
holes.push(hole);
|
||||
ui.mc_container.addChild(hole);
|
||||
hole.start(gesture.speedX,gesture.speedY,-gesture.speedY * 0.3,holeh);
|
||||
gametime.val--;
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
ui.btn_close.onClick(closeHandler,true);
|
||||
gameoverHandler();
|
||||
}
|
||||
|
||||
public function gameoverHandler(e:Event = null) : void
|
||||
{
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_UP,upHandler);
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_DOWN,downHandler);
|
||||
EnterFrameDriver.getIns().remove(enterHandler);
|
||||
for each(var de:MiniGame5_Dae in es)
|
||||
{
|
||||
de.stop();
|
||||
}
|
||||
Caller.delayCall(showOverHandler,2200);
|
||||
}
|
||||
|
||||
public function showOverHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel = new MinigameOverPanel();
|
||||
PopCenter.POP(overpanel);
|
||||
overpanel.show(score.val,GAME_TYPE);
|
||||
overpanel.ui.btn_yes.onClick(yesHandler);
|
||||
}
|
||||
|
||||
public function yesHandler(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
dispose();
|
||||
gameover();
|
||||
}
|
||||
|
||||
public function onShowPanelComplete(e:Event = null) : void
|
||||
{
|
||||
overpanel.showOut();
|
||||
gameover();
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
|
||||
public class BrickGame
|
||||
{
|
||||
|
||||
public static var name:String = "BlockBreakEveryDayv2";
|
||||
|
||||
public static var id:String = "BlockBreakEveryDayv2";
|
||||
|
||||
public static var version:String = "1.0.0";
|
||||
|
||||
public static var slot:String = "0";
|
||||
|
||||
public static var mobi:Boolean = true;
|
||||
|
||||
public function BrickGame()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function save(name:String, obj:Object) : void
|
||||
{
|
||||
Saver.save(BrickGame.id + "_" + slot,name,obj);
|
||||
}
|
||||
|
||||
public static function get(name:String) : Object
|
||||
{
|
||||
return Saver.get(BrickGame.id + "_" + slot,name);
|
||||
}
|
||||
|
||||
public static function get sound() : Boolean
|
||||
{
|
||||
if(get("sound") == null)
|
||||
{
|
||||
save("sound",true);
|
||||
}
|
||||
return get("sound");
|
||||
}
|
||||
|
||||
public static function set sound(val:Boolean) : void
|
||||
{
|
||||
save("sound",val);
|
||||
}
|
||||
|
||||
public static function soundOn() : void
|
||||
{
|
||||
SoundCenter.getInstance().bgmVolume = 1;
|
||||
SoundCenter.getInstance().effectVolume = 1;
|
||||
sound = true;
|
||||
}
|
||||
|
||||
public static function soundOff() : void
|
||||
{
|
||||
SoundCenter.getInstance().bgmVolume = 0;
|
||||
SoundCenter.getInstance().effectVolume = 0;
|
||||
sound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.system.AppLayer;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.myr.net.NetMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.BaseMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.CountDownMov;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.panel.BrickStartMenuPanel;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class MiniGame6_BrickHero extends BaseMiniGame
|
||||
{
|
||||
|
||||
public static var GAME_TYPE:int = 6;
|
||||
|
||||
public var cd:CountDownMov;
|
||||
|
||||
public var gametime:PointLocker;
|
||||
|
||||
public var gesture:Gesturer;
|
||||
|
||||
public var holes:Array = [];
|
||||
|
||||
public var es:Array = [];
|
||||
|
||||
public var rec:Rectangle;
|
||||
|
||||
public var sortJump:Jumper;
|
||||
|
||||
public var hitJump:Jumper;
|
||||
|
||||
public var eJump:Jumper;
|
||||
|
||||
public var etype:int = 0;
|
||||
|
||||
public function MiniGame6_BrickHero()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function gamestart() : void
|
||||
{
|
||||
BrickDataCenter.getInstance().loadBrickGame(realstart);
|
||||
GlobalBroadcast.addEventListener("brickGameOver",saveGame);
|
||||
}
|
||||
|
||||
public function saveGame(e:Event) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener("brickGameOver",saveGame);
|
||||
var saveData:String = BrickGameCenter.getInstance().master.getData();
|
||||
NetMiniGame.getIns().saveData("brickGame",saveData,"","",saveGameComplete);
|
||||
}
|
||||
|
||||
public function saveGameComplete(re:Object) : void
|
||||
{
|
||||
score.val = BrickGameCenter.getInstance().getScore();
|
||||
while(AppLayer.app.LAYER_BG.numChildren > 0)
|
||||
{
|
||||
AppLayer.app.LAYER_BG.removeChildAt(0);
|
||||
}
|
||||
BrickStartMenuPanel.getInstance().showOut();
|
||||
dispose();
|
||||
gameover();
|
||||
}
|
||||
|
||||
public function tipOver() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function realstart() : void
|
||||
{
|
||||
BrickDataCenter.getInstance().startup();
|
||||
BrickGameCenter.getInstance().startup();
|
||||
BrickStartMenuPanel.getInstance().popIn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.LoaderCenter;
|
||||
import net.pixvi.common.manager.resource.RM;
|
||||
import net.pixvi.myr.net.NetMiniGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.element.BrickMasterVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickHeroVo;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class BrickDataCenter
|
||||
{
|
||||
|
||||
public static var data:Object;
|
||||
|
||||
public static var mon:Object;
|
||||
|
||||
public static var loaded:Boolean = false;
|
||||
|
||||
public var playerNum:int;
|
||||
|
||||
public var heros:Array;
|
||||
|
||||
public var p2:Boolean = false;
|
||||
|
||||
private var onLoadBrickGameComplete:Function;
|
||||
|
||||
public function BrickDataCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickDataCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickDataCenter) as BrickDataCenter;
|
||||
}
|
||||
|
||||
public function get money() : PointLocker
|
||||
{
|
||||
return BrickGameCenter.master().money;
|
||||
}
|
||||
|
||||
public function loadBrickGame(onComplete:Function) : void
|
||||
{
|
||||
this.onLoadBrickGameComplete = onComplete;
|
||||
if(loaded)
|
||||
{
|
||||
loadBrickGameHandler();
|
||||
return;
|
||||
}
|
||||
LoaderCenter.getIns().loadTeam("brickGame",loadBrickGameHandler);
|
||||
}
|
||||
|
||||
public function loadBrickGameHandler(e:Event = null) : void
|
||||
{
|
||||
NetMiniGame.getIns().loadData("brickGame",loadBrickDataComplete);
|
||||
}
|
||||
|
||||
public function save() : void
|
||||
{
|
||||
var saveData:String = BrickGameCenter.getInstance().master.getData();
|
||||
NetMiniGame.getIns().saveData("brickGame",saveData,"","",null);
|
||||
}
|
||||
|
||||
public function loadBrickDataComplete(re:Object) : void
|
||||
{
|
||||
if(re == null)
|
||||
{
|
||||
re = {};
|
||||
}
|
||||
loadBrickDataHandler(re.data);
|
||||
this.onLoadBrickGameComplete();
|
||||
onLoadBrickGameComplete = null;
|
||||
BrickDataCenter.loaded = true;
|
||||
}
|
||||
|
||||
public function loadBrickDataHandler(data:Object) : void
|
||||
{
|
||||
BrickGameCenter.getInstance().master = new BrickMasterVo();
|
||||
if(data is String)
|
||||
{
|
||||
data = Json.decode(data as String);
|
||||
}
|
||||
BrickGameCenter.getInstance().master.loadData(data);
|
||||
}
|
||||
|
||||
public function startup() : void
|
||||
{
|
||||
data = RM.TXT.getJson("brick_data");
|
||||
mon = RM.TXT.getJson("brick_mon");
|
||||
heros = [];
|
||||
for(var herotype:String in BrickDataCenter.data.hero)
|
||||
{
|
||||
heros.push(new BrickHeroVo(int(herotype)));
|
||||
}
|
||||
}
|
||||
|
||||
public function getHero(type:int) : BrickHeroVo
|
||||
{
|
||||
return new BrickHeroVo(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.center
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.element.BrickGameLevel;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.element.BrickMasterVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.LevelCol;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class BrickGameCenter extends Singleton
|
||||
{
|
||||
|
||||
public var levels:LevelCol;
|
||||
|
||||
public var curLevel:BrickGameLevel;
|
||||
|
||||
public var bg:DisplayObject;
|
||||
|
||||
public var master:BrickMasterVo;
|
||||
|
||||
public function BrickGameCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function master() : BrickMasterVo
|
||||
{
|
||||
return getInstance().master;
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickGameCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickGameCenter) as BrickGameCenter;
|
||||
}
|
||||
|
||||
public function startup() : void
|
||||
{
|
||||
BrickDataCenter.getInstance().startup();
|
||||
FF.getBMC("mov.boom1");
|
||||
FF.getBMC("mov.boomboom");
|
||||
FF.getBMC("mov.gedang");
|
||||
FF.getBMC("mov.hit");
|
||||
FF.getBMC("mon.hitHero");
|
||||
BrickGroundCenter.getInstance();
|
||||
}
|
||||
|
||||
public function getScore() : Number
|
||||
{
|
||||
return master.getPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.center
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickGround;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickStage;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickChapterVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickHeroVo;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class BrickGroundCenter extends Singleton
|
||||
{
|
||||
|
||||
public static var ground:BrickGround;
|
||||
|
||||
public static var StageNum:int = 48;
|
||||
|
||||
public var point:PointLocker;
|
||||
|
||||
public var selectStage:BrickStage;
|
||||
|
||||
public var selectChapter:BrickChapterVo;
|
||||
|
||||
public var p1:BrickHeroVo;
|
||||
|
||||
public var p2:BrickHeroVo;
|
||||
|
||||
public var hp:int;
|
||||
|
||||
public var hpmax:int;
|
||||
|
||||
public var def:int;
|
||||
|
||||
public var win:Boolean;
|
||||
|
||||
private var _stages:Array;
|
||||
|
||||
public function BrickGroundCenter()
|
||||
{
|
||||
super();
|
||||
point = new PointLocker();
|
||||
}
|
||||
|
||||
public static function get ChapterStageNum() : int
|
||||
{
|
||||
return BrickDataCenter.data.chapterStageNum;
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickGroundCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickGroundCenter);
|
||||
}
|
||||
|
||||
public function stageMoney() : int
|
||||
{
|
||||
return BrickDataCenter.data.stageMoneyStart + selectStage.level * BrickDataCenter.data.stageMoneyAdd;
|
||||
}
|
||||
|
||||
public function getCompleteNum() : int
|
||||
{
|
||||
var com:int = 0;
|
||||
for each(var k:String in BrickGameCenter.master().stageData)
|
||||
{
|
||||
if(BrickGameCenter.master().stageData[k].point > 0)
|
||||
{
|
||||
com++;
|
||||
}
|
||||
}
|
||||
return com;
|
||||
}
|
||||
|
||||
public function getStage(level:int) : BrickStage
|
||||
{
|
||||
return new BrickStage(level);
|
||||
}
|
||||
|
||||
public function getStages() : Array
|
||||
{
|
||||
if(_stages != null)
|
||||
{
|
||||
return _stages;
|
||||
}
|
||||
var arr:Array = [];
|
||||
for(var key:String in BrickDataCenter.mon.stages)
|
||||
{
|
||||
arr.push(new BrickStage(int(key)));
|
||||
}
|
||||
_stages = arr;
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.element
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.BrickGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
|
||||
public class BrickGameLevel
|
||||
{
|
||||
|
||||
public var level:int;
|
||||
|
||||
public var point:Array = [1,2,3];
|
||||
|
||||
public var para:Object;
|
||||
|
||||
public function BrickGameLevel()
|
||||
{
|
||||
super();
|
||||
para = {};
|
||||
}
|
||||
|
||||
public function get maxPoint() : int
|
||||
{
|
||||
if(BrickGame.get("maxpoint" + level) != null)
|
||||
{
|
||||
return int(BrickGame.get("maxpoint" + level));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public function setMaxPoint(val:int) : Boolean
|
||||
{
|
||||
if(val > maxPoint)
|
||||
{
|
||||
BrickGame.save("maxpoint" + level,val);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get pass() : Boolean
|
||||
{
|
||||
if(maxPoint > point[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get unlock() : Boolean
|
||||
{
|
||||
if(this.level == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(BrickGameCenter.getInstance().levels.getLevel(this.level - 1).pass)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get star() : int
|
||||
{
|
||||
return getStar(maxPoint);
|
||||
}
|
||||
|
||||
public function getStar(pt:int) : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var ms:int = 0;
|
||||
for(i = 0; i < point.length; )
|
||||
{
|
||||
if(point[i] < pt)
|
||||
{
|
||||
ms = i + 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.element
|
||||
{
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.GuideCenter;
|
||||
import net.pixvi.pfw.utils.ObjectUtil;
|
||||
import net.pixvi.pfw.utils.PointLocker;
|
||||
import net.pixvi.pfw.utils.json.Json;
|
||||
|
||||
public class BrickMasterVo
|
||||
{
|
||||
|
||||
public var money:PointLocker = new PointLocker();
|
||||
|
||||
public var heroData:Object;
|
||||
|
||||
public var stageData:Object;
|
||||
|
||||
public function BrickMasterVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function loadData(data:Object) : void
|
||||
{
|
||||
if(data == null || data.heroData == null)
|
||||
{
|
||||
creatNew();
|
||||
Alert.showMsg("创建游戏数据");
|
||||
return;
|
||||
}
|
||||
Alert.showMsg("读取游戏数据");
|
||||
heroData = data.heroData;
|
||||
stageData = data.stageData;
|
||||
money.val = data.money;
|
||||
}
|
||||
|
||||
public function creatNew() : void
|
||||
{
|
||||
money.val = 100;
|
||||
heroData = {
|
||||
"1":{
|
||||
"atk":1,
|
||||
"def":1,
|
||||
"hp":1,
|
||||
"spd":1,
|
||||
"unlock":true
|
||||
},
|
||||
"2":{
|
||||
"atk":1,
|
||||
"def":1,
|
||||
"hp":1,
|
||||
"spd":1,
|
||||
"unlock":false
|
||||
},
|
||||
"3":{
|
||||
"atk":1,
|
||||
"def":1,
|
||||
"hp":1,
|
||||
"spd":1,
|
||||
"unlock":false
|
||||
},
|
||||
"4":{
|
||||
"atk":1,
|
||||
"def":1,
|
||||
"hp":1,
|
||||
"spd":1,
|
||||
"unlock":false
|
||||
}
|
||||
};
|
||||
stageData = {"1":{"pt":0}};
|
||||
}
|
||||
|
||||
public function checkStageUnlock(stage:int) : Boolean
|
||||
{
|
||||
if(stageData[stage] != null || stageData[stage - 1] != null && checkStageFinish(stage - 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkStageFinish(stage:int) : Boolean
|
||||
{
|
||||
if(getStagePoint(stage) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getStagePoint(stage:int) : int
|
||||
{
|
||||
if(stageData[stage] == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return stageData[stage].pt;
|
||||
}
|
||||
|
||||
public function getPoint() : int
|
||||
{
|
||||
var num:int = 0;
|
||||
for(var key:String in stageData)
|
||||
{
|
||||
if(stageData[key].pt != null)
|
||||
{
|
||||
num += stageData[key].pt;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public function passStage(stage:int, pt:int) : int
|
||||
{
|
||||
var stg:int = stage;
|
||||
if(stageData[stg] == null)
|
||||
{
|
||||
stageData[stg] = {"pt":pt};
|
||||
if(stage % 6 == 0)
|
||||
{
|
||||
if(GuideCenter.getIns().checkFin("brick" + stage))
|
||||
{
|
||||
GuideCenter.getIns().fin("brick" + stage,true);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if(stageData[stg].pt < pt)
|
||||
{
|
||||
stageData[stg] = {"pt":pt};
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function heroUnlock(type:int) : Boolean
|
||||
{
|
||||
return heroData[type].unlock;
|
||||
}
|
||||
|
||||
public function getData() : String
|
||||
{
|
||||
var data:Object = ObjectUtil.deepClone(this);
|
||||
data.money = money.val;
|
||||
return Json.encode(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.event
|
||||
{
|
||||
import net.pixvi.pfw.event.PiEvent;
|
||||
|
||||
public class BrickEvent extends PiEvent
|
||||
{
|
||||
|
||||
public static const LEVEL_GROUP_ENTER:String = "levelGroupEnter";
|
||||
|
||||
public static const LEVEL_GROUP_OUT:String = "levelGroupOut";
|
||||
|
||||
public static const LEVEL_REPLAY:String = "levelReplay";
|
||||
|
||||
public static const LEVEL_BACK:String = "levelBack";
|
||||
|
||||
public function BrickEvent(type:String, data:Object = null, bubbles:Boolean = false, cancelable:Boolean = false)
|
||||
{
|
||||
super(type,data,bubbles,cancelable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,652 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.events.Event;
|
||||
import flash.events.TouchEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.effect.effects.ShakeEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.LogoShow;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.utils.global;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.utils.BaseKeytroller;
|
||||
import net.pixvi.myr.center.TimeCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.BrickGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.JumpNumber;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickMonsterVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view.TipShow;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.panel.BrickGameOverPanel;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.panel.BrickGamingMenuPanel;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.utils.ArrayUtil;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class BrickGround extends PiSprite
|
||||
{
|
||||
|
||||
public static var left:Number = 0;
|
||||
|
||||
public static var right:Number = 0;
|
||||
|
||||
public static var top:Number = 0;
|
||||
|
||||
public static var bottom:Number = 0;
|
||||
|
||||
public static var bottomLine:Number = 73;
|
||||
|
||||
public var ui:BrickGroundUI;
|
||||
|
||||
public var layer_menu:PiSprite;
|
||||
|
||||
public var layer_main:PiSprite;
|
||||
|
||||
public var layer_bg:PiSprite;
|
||||
|
||||
public var layer_top:PiSprite;
|
||||
|
||||
public var start:Boolean = false;
|
||||
|
||||
public var gs:BrickStage;
|
||||
|
||||
public var key1:BaseKeytroller;
|
||||
|
||||
public var key2:BaseKeytroller;
|
||||
|
||||
public var heros:Array;
|
||||
|
||||
public var p1:BrickHeroView;
|
||||
|
||||
public var p2:BrickHeroView;
|
||||
|
||||
public var monsters:Array;
|
||||
|
||||
public var monsterRemove:Array;
|
||||
|
||||
public var balls:Array;
|
||||
|
||||
public var ballRemove:Array;
|
||||
|
||||
public var bullets:Array;
|
||||
|
||||
public var bulletRemove:Array;
|
||||
|
||||
public var supTimer:Timer;
|
||||
|
||||
public var sound:Boolean;
|
||||
|
||||
public var lTouchPointID:int = -1;
|
||||
|
||||
public var rTouchPointID:int = -1;
|
||||
|
||||
public var gameOver:Boolean = false;
|
||||
|
||||
public function BrickGround()
|
||||
{
|
||||
bottom = StageDriver.stageHeight - 40;
|
||||
right = StageDriver.stageWidth;
|
||||
super();
|
||||
if(BrickGameCenter.getInstance().bg != null)
|
||||
{
|
||||
BrickGameCenter.getInstance().bg.visible = false;
|
||||
}
|
||||
heros = [];
|
||||
monsters = [];
|
||||
monsterRemove = [];
|
||||
balls = [];
|
||||
ballRemove = [];
|
||||
bullets = [];
|
||||
bulletRemove = [];
|
||||
addChild(layer_bg = new PiSprite());
|
||||
addChild(layer_main = new PiSprite());
|
||||
addChild(layer_menu = new PiSprite());
|
||||
addChild(layer_top = new PiSprite());
|
||||
var bm:Bitmap = FF.getBM("bg.bg" + BrickGroundCenter.getInstance().selectChapter.chapter,"auto",true);
|
||||
ui = new BrickGroundUI();
|
||||
ui.bg.addChild(bm);
|
||||
layer_menu.addChild(ui);
|
||||
layer_bg.addChild(ui.bg);
|
||||
supTimer = new Timer(10000);
|
||||
supTimer.addEventListener("timer",supTimerHandler);
|
||||
sound = BrickGame.sound;
|
||||
}
|
||||
|
||||
public function updateInfo() : void
|
||||
{
|
||||
ui.ui_info.update();
|
||||
ui.text_hp.text = BrickGroundCenter.getInstance().hp.toString();
|
||||
ui.bar_hp.setValue(BrickGroundCenter.getInstance().hp,BrickGroundCenter.getInstance().hpmax,0);
|
||||
}
|
||||
|
||||
public function updateCd() : void
|
||||
{
|
||||
ui.text_p1skill.text = this.p1.cd.toString();
|
||||
if(this.p1.cd > 0)
|
||||
{
|
||||
ui.text_p1skill.visible = true;
|
||||
ui.mc_p1skill.alpha = 0.5;
|
||||
if(BrickGame.mobi)
|
||||
{
|
||||
ui.mc_skill.alpha = 0.2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.text_p1skill.visible = false;
|
||||
ui.mc_p1skill.alpha = 1;
|
||||
if(BrickGame.mobi)
|
||||
{
|
||||
ui.mc_skill.alpha = 0.6;
|
||||
}
|
||||
}
|
||||
if(BrickGroundCenter.getInstance().p2 != null)
|
||||
{
|
||||
ui.text_p2skill.text = this.p2.cd.toString();
|
||||
if(this.p2.cd > 0)
|
||||
{
|
||||
ui.mc_p2skill.alpha = 0.5;
|
||||
ui.text_p2skill.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_p2skill.alpha = 1;
|
||||
ui.text_p2skill.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function prepareGame() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var monVo:BrickMonsterVo = null;
|
||||
var monview:BrickMonsterView = null;
|
||||
var ball2:BrickBallView = null;
|
||||
BrickGroundCenter.getInstance().hpmax = BrickGroundCenter.getInstance().p1.all_hp;
|
||||
BrickGroundCenter.getInstance().def = BrickGroundCenter.getInstance().p1.all_def;
|
||||
trace(BrickGroundCenter.getInstance().hpmax,"hp",BrickGroundCenter.getInstance().p1.all_hp);
|
||||
BrickGroundCenter.getInstance().hp = BrickGroundCenter.getInstance().hpmax;
|
||||
ui.text_def.text = BrickGroundCenter.getInstance().def.toString();
|
||||
ui.btn_back.onClick(backHandler);
|
||||
SoundCenter.getInstance().bgmStop();
|
||||
if(Random.direction() == 1)
|
||||
{
|
||||
SoundCenter.getInstance().bgmPlay(GameSound.bgm_brickBattle);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getInstance().bgmPlay(GameSound.bgm_brickStart);
|
||||
}
|
||||
if(BrickGame.mobi)
|
||||
{
|
||||
ui.mc_skill.addEventListener("touchBegin",skillTouchHandler);
|
||||
StageDriver.stage.addEventListener("touchBegin",touchBeginHandler);
|
||||
StageDriver.stage.addEventListener("touchEnd",touchEndHandler);
|
||||
ui.mc_skill.gotoAndStop(BrickGroundCenter.getInstance().p1.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.mc_skill.stop();
|
||||
ui.mc_skill.parent.removeChild(ui.mc_skill);
|
||||
}
|
||||
supTimer.start();
|
||||
gs = BrickGroundCenter.getInstance().selectStage;
|
||||
for(i = 0; i < gs.monsters.length; )
|
||||
{
|
||||
monVo = new BrickMonsterVo(gs.monsters[i].type);
|
||||
monview = new BrickMonsterView(monVo);
|
||||
monview.x = gs.monsters[i].x;
|
||||
monview.y = gs.monsters[i].y;
|
||||
monsters.push(monview);
|
||||
if(BrickGroundCenter.getInstance().p2 == null)
|
||||
{
|
||||
monview.vo.hpmax -= 2;
|
||||
monview.vo.hp = monview.vo.hpmax;
|
||||
}
|
||||
if(BrickGame.mobi)
|
||||
{
|
||||
if(monview.vo.skillcd > 0)
|
||||
{
|
||||
monview.vo.skillcd += 500 + Random.integer(500,1500);
|
||||
}
|
||||
monview.vo.hpmax -= 4;
|
||||
monview.vo.hp = monview.vo.hpmax;
|
||||
}
|
||||
monview.startUp();
|
||||
layer_main.addChild(monview);
|
||||
i++;
|
||||
}
|
||||
p1 = new BrickHeroView(BrickGroundCenter.getInstance().p1);
|
||||
p1.y = StageDriver.stageHeight - 80;
|
||||
p1.x = StageDriver.stageWidth / 2 - p1.rect.width / 2;
|
||||
layer_main.addChild(p1);
|
||||
heros.push(p1);
|
||||
var ball1:BrickBallView = p1.getBall();
|
||||
layer_main.addChild(ball1);
|
||||
ball1.tikHero = p1;
|
||||
balls.push(ball1);
|
||||
if(BrickGroundCenter.getInstance().p2 != null)
|
||||
{
|
||||
p2 = new BrickHeroView(BrickGroundCenter.getInstance().p2);
|
||||
StageLocator.setSide(p2,"center","bottom",0,bottomLine);
|
||||
p2.x += p2.width - 60;
|
||||
layer_main.addChild(p2);
|
||||
heros.push(p2);
|
||||
p1.x -= p1.width - 60;
|
||||
ball2 = p2.getBall();
|
||||
layer_main.addChild(ball2);
|
||||
ball2.tikHero = p2;
|
||||
balls.push(ball2);
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = p1;
|
||||
}
|
||||
key1 = new BaseKeytroller();
|
||||
key1.setCharCode("W","S","A","D","R","T","F","G");
|
||||
key1.key_up.addEventListener("keyDown",p1.startSkill);
|
||||
key1.key_down.addEventListener("keyDown",p1.sendball);
|
||||
key1.lock();
|
||||
ui.mc_p1skill.gotoAndStop(BrickGroundCenter.getInstance().p1.type);
|
||||
if(BrickGroundCenter.getInstance().p2 != null)
|
||||
{
|
||||
key2 = new BaseKeytroller();
|
||||
key2.setCharCode("UP","DOWN","LEFT","RIGHT","K","L","U","I");
|
||||
key2.key_up.addEventListener("keyDown",p2.startSkill);
|
||||
key2.key_down.addEventListener("keyDown",p2.sendball);
|
||||
key2.lock();
|
||||
ui.mc_p2skill.gotoAndStop(BrickGroundCenter.getInstance().p2.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
key2 = new BaseKeytroller();
|
||||
key2.setCharCode("UP","DOWN","LEFT","RIGHT","K","L","U","I");
|
||||
key2.key_up.addEventListener("keyDown",p1.startSkill);
|
||||
key2.key_down.addEventListener("keyDown",p1.sendball);
|
||||
key2.lock();
|
||||
ui.mc_p2skill.stop();
|
||||
ui.mc_p2skill.parent.removeChild(ui.mc_p2skill);
|
||||
ui.text_p2skill.parent.removeChild(ui.text_p2skill);
|
||||
}
|
||||
updateCd();
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
public function touchBeginHandler(e:TouchEvent) : void
|
||||
{
|
||||
if(e.stageX < StageDriver.stageWidth / 2)
|
||||
{
|
||||
key1.key_left.isdown = true;
|
||||
lTouchPointID = e.touchPointID;
|
||||
trace("down","left",e.touchPointID);
|
||||
}
|
||||
else
|
||||
{
|
||||
key1.key_right.isdown = true;
|
||||
rTouchPointID = e.touchPointID;
|
||||
trace("down","right",e.touchPointID);
|
||||
}
|
||||
}
|
||||
|
||||
public function touchEndHandler(e:TouchEvent) : void
|
||||
{
|
||||
if(e.touchPointID == lTouchPointID)
|
||||
{
|
||||
key1.key_left.isdown = false;
|
||||
trace("up","left",e.touchPointID);
|
||||
lTouchPointID = -1;
|
||||
}
|
||||
else if(e.touchPointID == rTouchPointID)
|
||||
{
|
||||
key1.key_right.isdown = false;
|
||||
trace("up","right",e.touchPointID);
|
||||
rTouchPointID = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public function skillTouchHandler(e:TouchEvent) : void
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
p1.sendball();
|
||||
p1.startSkill();
|
||||
}
|
||||
|
||||
public function startGame() : void
|
||||
{
|
||||
var logoshow:LogoShow = null;
|
||||
BrickGameOverPanel.startTime = TimeCenter.timestamp;
|
||||
if(BrickGroundCenter.getInstance().selectStage.level < 4)
|
||||
{
|
||||
logoshow = new LogoShow(startGame2,"ui.tech" + BrickGroundCenter.getInstance().selectStage.level);
|
||||
layer_top.addChild(logoshow);
|
||||
logoshow.time_wait = 7000;
|
||||
logoshow.time_in = logoshow.time_out = 500;
|
||||
Caller.delayCall(logoshow.start,50);
|
||||
}
|
||||
else
|
||||
{
|
||||
startGame2();
|
||||
}
|
||||
}
|
||||
|
||||
public function startGame2() : void
|
||||
{
|
||||
trace("startgame2");
|
||||
var ts:TipShow = new TipShow(BrickGroundCenter.getInstance().selectStage.level);
|
||||
layer_menu.addChild(ts);
|
||||
ts.start();
|
||||
gameRun();
|
||||
}
|
||||
|
||||
public function checkGameOver() : void
|
||||
{
|
||||
if(gameOver)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(BrickGroundCenter.getInstance().hp <= 0)
|
||||
{
|
||||
BrickGroundCenter.getInstance().win = false;
|
||||
finishGame();
|
||||
}
|
||||
var monnum:int = 0;
|
||||
for each(var mon:BrickMonsterView in BrickGroundCenter.ground.monsters)
|
||||
{
|
||||
if(!mon.vo.wall)
|
||||
{
|
||||
monnum++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(monnum == 0)
|
||||
{
|
||||
BrickGroundCenter.getInstance().win = true;
|
||||
finishGame();
|
||||
}
|
||||
}
|
||||
|
||||
public function supTimerHandler(e:Event = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var bb:BrickMonsterView = null;
|
||||
var b:BrickBulletView = null;
|
||||
var monnum:int = 0;
|
||||
var len:int = int(monsters.length);
|
||||
for(i = 0; i < len; )
|
||||
{
|
||||
if((monsters[i] as BrickMonsterView).vo.mon)
|
||||
{
|
||||
monnum++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(monnum == 0)
|
||||
{
|
||||
bb = new BrickMonsterView(new BrickMonsterVo(20));
|
||||
b = bb.getBulletView();
|
||||
b.buffType = int(Random.element([1,6]));
|
||||
b.atk = 0;
|
||||
b.startup(false);
|
||||
b.rotation = 0;
|
||||
addBullet(b);
|
||||
b.x = Random.integer(1,StageDriver.stageWidth);
|
||||
b.y = -80;
|
||||
}
|
||||
}
|
||||
|
||||
public function gameRun() : void
|
||||
{
|
||||
supTimer.start();
|
||||
trace("game start!!!");
|
||||
key1.unlock();
|
||||
if(key2 != null)
|
||||
{
|
||||
key2.unlock();
|
||||
}
|
||||
EnterFrameDriver.getInstance().regist(mainEnterHandler);
|
||||
}
|
||||
|
||||
public function gamePause() : void
|
||||
{
|
||||
key1.lock();
|
||||
supTimer.stop();
|
||||
if(key2 != null)
|
||||
{
|
||||
key2.lock();
|
||||
}
|
||||
EnterFrameDriver.getInstance().remove(mainEnterHandler);
|
||||
}
|
||||
|
||||
public function mainEnterHandler() : void
|
||||
{
|
||||
heroStep();
|
||||
ballStep();
|
||||
bulletStep();
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
public function hitBullet(bullet:BrickBulletView) : void
|
||||
{
|
||||
if(bullet.buffType > 0 && bullet.monster.vo.skillcd == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
hurt(bullet.atk,bullet.x,bullet.y);
|
||||
}
|
||||
|
||||
public function hitBall(ball:BrickBallView) : void
|
||||
{
|
||||
hurt(ball.hero.vo.all_atk,ball.x,ball.y);
|
||||
}
|
||||
|
||||
public function hurt(num:int, x:Number, y:Number) : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.hurt,0.7);
|
||||
ui.onHurt();
|
||||
num -= BrickGroundCenter.getInstance().def;
|
||||
if(num < 1)
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
new ShakeEffect(5).startEffect(this);
|
||||
JumpNumber.showNum(num,x,y - 40);
|
||||
BrickGroundCenter.getInstance().hp = BrickGroundCenter.getInstance().hp - num;
|
||||
if(BrickGroundCenter.getInstance().hp < 0)
|
||||
{
|
||||
BrickGroundCenter.getInstance().hp = 0;
|
||||
}
|
||||
updateInfo();
|
||||
checkGameOver();
|
||||
}
|
||||
|
||||
public function cleanUp() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
if(monsterRemove.length > 0)
|
||||
{
|
||||
for(i = 0; i < monsterRemove.length; )
|
||||
{
|
||||
ArrayUtil.remove(monsters,monsterRemove[i]);
|
||||
i++;
|
||||
}
|
||||
monsterRemove = [];
|
||||
}
|
||||
if(bulletRemove.length > 0)
|
||||
{
|
||||
for(i = 0; i < bulletRemove.length; )
|
||||
{
|
||||
ArrayUtil.remove(bullets,bulletRemove[i]);
|
||||
i++;
|
||||
}
|
||||
bulletRemove = [];
|
||||
}
|
||||
if(ballRemove.length > 0)
|
||||
{
|
||||
for(i = 0; i < ballRemove.length; )
|
||||
{
|
||||
ArrayUtil.remove(balls,ballRemove[i]);
|
||||
i++;
|
||||
}
|
||||
ballRemove = [];
|
||||
}
|
||||
}
|
||||
|
||||
public function running() : Boolean
|
||||
{
|
||||
return EnterFrameDriver.getInstance().has(mainEnterHandler);
|
||||
}
|
||||
|
||||
public function ballStep() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var rm:Array = [];
|
||||
for each(var b:BrickBallView in balls)
|
||||
{
|
||||
if(b.step())
|
||||
{
|
||||
rm.push(b);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < rm.length; )
|
||||
{
|
||||
ArrayUtil.remove(balls,rm[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function bulletStep() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var rm:Array = [];
|
||||
for each(var b:BrickBulletView in bullets)
|
||||
{
|
||||
if(b.step())
|
||||
{
|
||||
rm.push(b);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < rm.length; )
|
||||
{
|
||||
ArrayUtil.remove(bullets,rm[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function heroStep() : void
|
||||
{
|
||||
var mov2:Number = NaN;
|
||||
var mov1:Number = key1.key_left.isdown ? -p1.speed : 0;
|
||||
mov1 += key1.key_right.isdown ? p1.speed : 0;
|
||||
p1.x += mov1;
|
||||
if(p1.x < left)
|
||||
{
|
||||
p1.x = left;
|
||||
}
|
||||
if(p1.x > right - p1.hitrect.width)
|
||||
{
|
||||
p1.x = right - p1.hitrect.width;
|
||||
}
|
||||
p1.step();
|
||||
if(BrickGroundCenter.getInstance().p2 != null || p2 != null && mov1 == 0)
|
||||
{
|
||||
mov2 = key2.key_left.isdown ? -p2.speed : 0;
|
||||
mov2 += key2.key_right.isdown ? p2.speed : 0;
|
||||
p2.x += mov2;
|
||||
p2.step();
|
||||
if(p2.x < left)
|
||||
{
|
||||
p2.x = left;
|
||||
}
|
||||
if(p2.x > right - p2.hitrect.width)
|
||||
{
|
||||
p2.x = right - p2.hitrect.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addBall(ball:BrickBallView) : void
|
||||
{
|
||||
layer_main.addChild(ball);
|
||||
balls.push(ball);
|
||||
}
|
||||
|
||||
public function addBullet(bullet:BrickBulletView) : void
|
||||
{
|
||||
layer_main.addChild(bullet);
|
||||
bullets.push(bullet);
|
||||
}
|
||||
|
||||
public function menuHandler(e:Event = null) : void
|
||||
{
|
||||
PopCenter.POP(BrickGamingMenuPanel.getInstance());
|
||||
}
|
||||
|
||||
public function finishGame(e:Event = null) : void
|
||||
{
|
||||
gameOver = true;
|
||||
gamePause();
|
||||
EnterFrameDriver.getInstance().remove(mainEnterHandler);
|
||||
Caller.delayCall(realFinishGame,500);
|
||||
}
|
||||
|
||||
public function realFinishGame() : void
|
||||
{
|
||||
if(BrickGameCenter.getInstance().bg != null)
|
||||
{
|
||||
BrickGameCenter.getInstance().bg.visible = true;
|
||||
}
|
||||
GlobalBroadcast.dispatchEvent(new Event("hideOut"));
|
||||
PopCenter.POP(BrickGameOverPanel.getInstance());
|
||||
}
|
||||
|
||||
public function removeGame() : void
|
||||
{
|
||||
key1.dispose();
|
||||
if(key2 != null)
|
||||
{
|
||||
key2.dispose();
|
||||
}
|
||||
if(BrickGame.mobi)
|
||||
{
|
||||
ui.mc_skill.removeEventListener("touchBegin",skillTouchHandler);
|
||||
StageDriver.stage.removeEventListener("touchBegin",touchBeginHandler);
|
||||
StageDriver.stage.removeEventListener("touchEnd",touchEndHandler);
|
||||
}
|
||||
EnterFrameDriver.getInstance().remove(mainEnterHandler);
|
||||
}
|
||||
|
||||
public function backHandler(e:Event = null) : void
|
||||
{
|
||||
gamePause();
|
||||
Alert.yesno(lang("退出关卡"),lang("确定要退出游戏中的关卡?"),backGame,gameRun);
|
||||
}
|
||||
|
||||
public function backGame() : void
|
||||
{
|
||||
BrickGroundCenter.getInstance().win = false;
|
||||
global.back = true;
|
||||
finishGame();
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
removeGame();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.view.panel.AlphaPopPanel;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.panel.BrickStageSelectPanel;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class BrickGroundPanel extends AlphaPopPanel
|
||||
{
|
||||
|
||||
public var ground:BrickGround = new BrickGround();
|
||||
|
||||
public function BrickGroundPanel()
|
||||
{
|
||||
BrickGroundCenter.ground = ground;
|
||||
addChild(ground);
|
||||
ground.prepareGame();
|
||||
ground.startGame();
|
||||
GlobalBroadcast.addEventListener("returnToMenu",groupOutHandler);
|
||||
GlobalBroadcast.addEventListener("hideOut",hideOutHandler);
|
||||
super();
|
||||
}
|
||||
|
||||
public function groupOutHandler(e:Event) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener("returnToMenu",groupOutHandler);
|
||||
GlobalBroadcast.removeEventListener("hideOut",hideOutHandler);
|
||||
this.showOut();
|
||||
PopCenter.POP(BrickStageSelectPanel.getInstance());
|
||||
}
|
||||
|
||||
public function hideOutHandler(e:Event) : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener("returnToMenu",groupOutHandler);
|
||||
GlobalBroadcast.removeEventListener("hideOut",hideOutHandler);
|
||||
this.showOut();
|
||||
}
|
||||
|
||||
override protected function stageResizeAndKeepInCenter() : void
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Linear;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.BrickGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view.StatusInfoUI;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.MonInfoUI;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBar;
|
||||
import net.pixvi.pfw.ui.controls.PiButton;
|
||||
|
||||
public class BrickGroundUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_start:PiButton;
|
||||
|
||||
public var btn_back:PiButton;
|
||||
|
||||
public var bar_hp:PiBar;
|
||||
|
||||
public var ui_moninfo:MonInfoUI;
|
||||
|
||||
public var mc_hurt:MovieClip;
|
||||
|
||||
public var mc_top:Sprite;
|
||||
|
||||
public var mc_bottom:Sprite;
|
||||
|
||||
public var text_hp:TextField;
|
||||
|
||||
public var text_def:TextField;
|
||||
|
||||
public var text_stage:TextField;
|
||||
|
||||
public var ui_info:StatusInfoUI;
|
||||
|
||||
public var mc_skill:MovieClip;
|
||||
|
||||
public var mc_p1skill:MovieClip;
|
||||
|
||||
public var mc_p2skill:MovieClip;
|
||||
|
||||
public var text_p1skill:TextField;
|
||||
|
||||
public var text_p2skill:TextField;
|
||||
|
||||
public var bg:Sprite;
|
||||
|
||||
private var hurtT:TweenMax;
|
||||
|
||||
public function BrickGroundUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.BrickScoreGroundUI");
|
||||
}
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
ui_info.visible = false;
|
||||
var level:int = BrickGroundCenter.getInstance().selectStage.level;
|
||||
var chapter:int = BrickGroundCenter.getInstance().selectChapter.chapter;
|
||||
mc_top.height = mc_bottom.height = (StageDriver.fixStageHeight - 960) / 2;
|
||||
text_stage.text = "STAGE-" + level;
|
||||
mc_hurt.visible = false;
|
||||
}
|
||||
|
||||
public function onHurt() : void
|
||||
{
|
||||
if(hurtT != null)
|
||||
{
|
||||
hurtT.kill();
|
||||
}
|
||||
mc_hurt.y = 900;
|
||||
mc_hurt.visible = true;
|
||||
hurtT = TweenMax.fromTo(mc_hurt,0.5,{
|
||||
"y":mc_hurt.y,
|
||||
"visible":true
|
||||
},{
|
||||
"y":mc_hurt.y + mc_hurt.height,
|
||||
"visible":false,
|
||||
"ease":Linear.easeIn
|
||||
});
|
||||
}
|
||||
|
||||
public function soundHandler(e:Event = null) : void
|
||||
{
|
||||
if(BrickGame.sound)
|
||||
{
|
||||
BrickGame.soundOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
BrickGame.soundOn();
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
if(hurtT != null)
|
||||
{
|
||||
hurtT.kill();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
|
||||
public class BrickStage
|
||||
{
|
||||
|
||||
public var level:int;
|
||||
|
||||
public function BrickStage(level:int)
|
||||
{
|
||||
super();
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public function get unlock() : Boolean
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.checkStageUnlock(level);
|
||||
}
|
||||
|
||||
public function get finish() : Boolean
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.checkStageFinish(level);
|
||||
}
|
||||
|
||||
public function get point() : int
|
||||
{
|
||||
return BrickGameCenter.master().getStagePoint(level);
|
||||
}
|
||||
|
||||
public function get monsters() : Array
|
||||
{
|
||||
return BrickDataCenter.mon.stages[level];
|
||||
}
|
||||
|
||||
public function get dataName() : String
|
||||
{
|
||||
return "stage_" + level;
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return [this.level,this.unlock,this.finish].join("-");
|
||||
}
|
||||
|
||||
public function isFinalStage() : Boolean
|
||||
{
|
||||
return BrickDataCenter.mon.stages[level + 1] == null;
|
||||
}
|
||||
|
||||
public function isChapeterEnd() : Boolean
|
||||
{
|
||||
return level % BrickDataCenter.data.chapterStageNum == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+353
@@ -0,0 +1,353 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground.view
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.effect.effects.ShakeEffect;
|
||||
import net.pixvi.common.utils.Engine2D;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.base.hitobj.StageObj;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickGround;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class BrickBallView extends StageObj
|
||||
{
|
||||
|
||||
public var hero:BrickHeroView;
|
||||
|
||||
public var isBullet:Boolean = false;
|
||||
|
||||
private var _speed:Number;
|
||||
|
||||
private var speed0_7:Number;
|
||||
|
||||
private var speed0_6:Number;
|
||||
|
||||
private var speed0_5:Number;
|
||||
|
||||
public var engine:Engine2D;
|
||||
|
||||
public var ui:Bitmap;
|
||||
|
||||
public var boom:Boolean = false;
|
||||
|
||||
public var smallboom:Boolean = false;
|
||||
|
||||
public var boomui:BitMovieClip;
|
||||
|
||||
public var tikHero:BrickHeroView;
|
||||
|
||||
public var maxlock:int = 250;
|
||||
|
||||
public var hitherolock:int = 0;
|
||||
|
||||
public function BrickBallView(hero:BrickHeroView, uii:String = null)
|
||||
{
|
||||
this.hero = hero;
|
||||
this.speed = hero.vo.ball_spd;
|
||||
if(uii == null)
|
||||
{
|
||||
ui = FF.getBM("ball.Type" + hero.vo.type,"auto",true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui = FF.getBM(uii,"auto",true);
|
||||
}
|
||||
ui.x = -ui.width / 2;
|
||||
ui.y = -ui.height / 2;
|
||||
ui.scaleX = ui.scaleY = 1.2;
|
||||
this.rotation = -90;
|
||||
addChild(ui);
|
||||
super(new Rectangle(-13,-13,26,26));
|
||||
startup();
|
||||
}
|
||||
|
||||
public function get speed() : Number
|
||||
{
|
||||
return _speed;
|
||||
}
|
||||
|
||||
public function installBoom(small:Boolean = false) : void
|
||||
{
|
||||
if(boomui == null)
|
||||
{
|
||||
boomui = FF.getBMC("mov.boom",30);
|
||||
boomui.x = this.rect.x + this.rect.width / 2 + 10;
|
||||
boomui.y = this.rect.y + this.rect.height / 2;
|
||||
addChild(boomui);
|
||||
}
|
||||
if(!small)
|
||||
{
|
||||
boomui.scaleX = boomui.scaleY = 1.4;
|
||||
}
|
||||
smallboom = small;
|
||||
boom = true;
|
||||
}
|
||||
|
||||
public function uninstallBoom() : void
|
||||
{
|
||||
if(boomui != null)
|
||||
{
|
||||
removeChild(boomui);
|
||||
boomui.stop();
|
||||
boomui = null;
|
||||
}
|
||||
boom = false;
|
||||
}
|
||||
|
||||
public function set speed(value:Number) : void
|
||||
{
|
||||
_speed = value;
|
||||
speed0_5 = _speed * 0.5;
|
||||
speed0_6 = _speed * 0.65;
|
||||
speed0_7 = _speed * 0.7;
|
||||
}
|
||||
|
||||
public function startup() : void
|
||||
{
|
||||
engine = new Engine2D();
|
||||
engine.setBoard(BrickGround.top,BrickGround.bottom,BrickGround.left,BrickGround.right - this.width / 2);
|
||||
engine.speedX = Random.number(-speed0_5,speed0_5);
|
||||
getYSpeed();
|
||||
engine.speedYDirection(-1);
|
||||
this.updateRect();
|
||||
}
|
||||
|
||||
public function getYSpeed() : void
|
||||
{
|
||||
this.engine.speedY = Math.pow(speed * speed - Math.pow(this.engine.speedX,2),0.5);
|
||||
}
|
||||
|
||||
public function step() : Boolean
|
||||
{
|
||||
var ballnum:int = 0;
|
||||
var horiValue:Number = NaN;
|
||||
var hitmon:BrickMonsterView = null;
|
||||
var dis:Number = NaN;
|
||||
var i:int = 0;
|
||||
if(!BrickGroundCenter.ground.running())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(tikHero != null)
|
||||
{
|
||||
maxlock--;
|
||||
if(maxlock <= 0)
|
||||
{
|
||||
tikHero.sendball();
|
||||
return false;
|
||||
}
|
||||
this.x = tikHero.hitrect.x + tikHero.hitrect.width / 2;
|
||||
this.y = tikHero.y - 5;
|
||||
this.visible = false;
|
||||
return false;
|
||||
}
|
||||
var ox:Number = this.hitrect.x;
|
||||
var oy:Number = this.hitrect.y;
|
||||
if(engine.step(this,true,true))
|
||||
{
|
||||
this.rotation = engine.valueAng;
|
||||
sendHit();
|
||||
SoundCenter.getInstance().play(BrickGameSound.hitWall);
|
||||
if(this.y > StageDriver.stageHeight - BrickGround.bottomLine)
|
||||
{
|
||||
ballnum = 0;
|
||||
for each(var ba:BrickBallView in BrickGroundCenter.ground.balls)
|
||||
{
|
||||
if(!ba.isBullet && ba.hero.vo.type == this.hero.vo.type)
|
||||
{
|
||||
ballnum++;
|
||||
}
|
||||
}
|
||||
for each(ba in BrickGroundCenter.ground.ballRemove)
|
||||
{
|
||||
if(!ba.isBullet && ba.hero.vo.type == this.hero.vo.type)
|
||||
{
|
||||
ballnum--;
|
||||
}
|
||||
}
|
||||
if(ballnum > 1)
|
||||
{
|
||||
this.ballDestroy();
|
||||
return false;
|
||||
}
|
||||
BrickGroundCenter.ground.hitBall(this);
|
||||
}
|
||||
}
|
||||
this.updateRect();
|
||||
hitherolock--;
|
||||
if(!isBullet)
|
||||
{
|
||||
for each(var hero:BrickHeroView in BrickGroundCenter.ground.heros)
|
||||
{
|
||||
if(hero.hittestObj(this))
|
||||
{
|
||||
if(hitherolock <= 0)
|
||||
{
|
||||
hitherolock = 10;
|
||||
hero.cd--;
|
||||
BrickGroundCenter.ground.updateCd();
|
||||
horiValue = (hero.hitrect.x + hero.hitrect.width - this.hitrect.x) / (hero.hitrect.width + this.hitrect.width);
|
||||
this.engine.speedX -= Counter.getScaleArea(horiValue,-speed0_6,speed0_6);
|
||||
if(this.engine.speedX < -speed0_7)
|
||||
{
|
||||
this.engine.speedX = -speed0_7;
|
||||
}
|
||||
if(this.engine.speedX > speed0_7)
|
||||
{
|
||||
this.engine.speedX = speed0_7;
|
||||
}
|
||||
sendHitHero();
|
||||
SoundCenter.getInstance().play(BrickGameSound.hitHero);
|
||||
getYSpeed();
|
||||
engine.speedYDirection(-1);
|
||||
this.rotation = engine.valueAng;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var hitmons:Array = [];
|
||||
for each(var monsterEver:BrickMonsterView in BrickGroundCenter.ground.monsters)
|
||||
{
|
||||
if(monsterEver.hittestObj(this))
|
||||
{
|
||||
hitmon = monsterEver;
|
||||
hitmons.push(monsterEver);
|
||||
}
|
||||
}
|
||||
if(hitmons.length > 1)
|
||||
{
|
||||
hitmon = hitmons[0];
|
||||
dis = hitmon.getCenterDis(this);
|
||||
for(i = 1; i < hitmons.length; )
|
||||
{
|
||||
if(this.getCenterDis(hitmons[i]) < dis)
|
||||
{
|
||||
dis = this.getCenterDis(hitmons[i]);
|
||||
hitmon = hitmons[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(hitmon != null)
|
||||
{
|
||||
if(ox + this.hitrect.width < hitmon.hitrect.x)
|
||||
{
|
||||
this.engine.speedXDirection(-1);
|
||||
}
|
||||
else if(ox > hitmon.hitrect.x + hitmon.hitrect.width)
|
||||
{
|
||||
this.engine.speedXDirection(1);
|
||||
}
|
||||
else if(oy + this.hitrect.height < hitmon.hitrect.y)
|
||||
{
|
||||
this.engine.speedYDirection(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.engine.speedYDirection(1);
|
||||
}
|
||||
this.rotation = engine.valueAng;
|
||||
if(!boom)
|
||||
{
|
||||
hitmon.hit(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendBoom();
|
||||
}
|
||||
sendHit();
|
||||
if(isBullet)
|
||||
{
|
||||
ballDestroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(isBullet && this.engine.speedY > 0)
|
||||
{
|
||||
ballDestroy();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getBoomRect() : Rectangle
|
||||
{
|
||||
var w:int = 100;
|
||||
var h:int = 100;
|
||||
if(smallboom)
|
||||
{
|
||||
w = h = 60;
|
||||
}
|
||||
return new Rectangle(this.hitrect.x + this.hitrect.width / 2 - w / 2,this.hitrect.y + this.hitrect.height / 2 - h / 2,w,h);
|
||||
}
|
||||
|
||||
public function sendBoom() : void
|
||||
{
|
||||
uninstallBoom();
|
||||
addBoomMov();
|
||||
var rectb:Rectangle = getBoomRect();
|
||||
for each(var mon:BrickMonsterView in BrickGroundCenter.ground.monsters)
|
||||
{
|
||||
if(mon.hittestRect(rectb))
|
||||
{
|
||||
mon.hit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function sendHit() : void
|
||||
{
|
||||
var mv:BitMovieClip = FF.getBMC("mov.hit");
|
||||
mv.smoothing = true;
|
||||
mv.x = this.hitrect.width / 2 + this.hitrect.x;
|
||||
mv.y = this.hitrect.height / 2 + this.hitrect.y;
|
||||
mv.rotation = engine.valueAng;
|
||||
Director.playOnce(mv);
|
||||
BrickGroundCenter.ground.layer_main.addChild(mv);
|
||||
}
|
||||
|
||||
public function addBoomMov() : void
|
||||
{
|
||||
new ShakeEffect(0,6).startEffect(BrickGroundCenter.ground.layer_main);
|
||||
var mv:BitMovieClip = FF.getBMC("mov.boomboom");
|
||||
if(smallboom)
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.small_boom);
|
||||
mv.scaleX = mv.scaleY = 0.7;
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.big_boom);
|
||||
}
|
||||
mv.smoothing = true;
|
||||
mv.x = this.hitrect.width / 2 + this.hitrect.x;
|
||||
mv.y = this.hitrect.height / 2 + this.hitrect.y;
|
||||
Director.playOnce(mv);
|
||||
BrickGroundCenter.ground.layer_main.addChild(mv);
|
||||
}
|
||||
|
||||
public function sendHitHero() : void
|
||||
{
|
||||
var mv:BitMovieClip = FF.getBMC("mon.hitHero",40);
|
||||
mv.smoothing = true;
|
||||
mv.x = this.hitrect.width / 2 + this.hitrect.x;
|
||||
mv.y = this.hitrect.height / 2 + this.hitrect.y;
|
||||
Director.playOnce(mv);
|
||||
BrickGroundCenter.ground.layer_main.addChild(mv);
|
||||
}
|
||||
|
||||
public function ballDestroy() : void
|
||||
{
|
||||
BrickGroundCenter.ground.ballRemove.push(this);
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground.view
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.utils.Engine2D;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.base.hitobj.StageObj;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickGround;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class BrickBulletView extends StageObj
|
||||
{
|
||||
|
||||
public var atk:int;
|
||||
|
||||
public var skill:int;
|
||||
|
||||
public var buffType:int = 0;
|
||||
|
||||
public var speed:Number;
|
||||
|
||||
public var engine:Engine2D;
|
||||
|
||||
public var monster:BrickMonsterView;
|
||||
|
||||
public var ui:Bitmap;
|
||||
|
||||
public function BrickBulletView(monster:BrickMonsterView)
|
||||
{
|
||||
this.monster = monster;
|
||||
this.atk = monster.vo.atk;
|
||||
this.ui = monster.getBulletUI();
|
||||
this.ui.x = -this.ui.width / 2;
|
||||
this.ui.y = -this.ui.height / 2;
|
||||
addChild(ui);
|
||||
this.speed = monster.vo.skillspeed;
|
||||
super(new Rectangle(-10,-10,20,20));
|
||||
}
|
||||
|
||||
public function startup(randomRotation:Boolean = true) : void
|
||||
{
|
||||
engine = new Engine2D();
|
||||
engine.setBoard(BrickGround.top,BrickGround.bottom,BrickGround.left,BrickGround.right);
|
||||
if(randomRotation)
|
||||
{
|
||||
engine.speedX = Random.number(-speed * 0.7,speed * 0.7);
|
||||
}
|
||||
getYSpeed();
|
||||
this.rotation = engine.valueAng;
|
||||
}
|
||||
|
||||
public function getYSpeed() : void
|
||||
{
|
||||
this.engine.speedY = Math.pow(speed * speed - Math.pow(this.engine.speedX,2),0.5);
|
||||
}
|
||||
|
||||
public function step() : Boolean
|
||||
{
|
||||
var buff:BaseBuff = null;
|
||||
var mv:BitMovieClip = null;
|
||||
if(!BrickGroundCenter.ground.running())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(engine.step(this,true,true))
|
||||
{
|
||||
this.rotation = engine.valueAng;
|
||||
if(this.y > StageDriver.stageHeight - BrickGround.bottomLine)
|
||||
{
|
||||
BrickGroundCenter.ground.hitBullet(this);
|
||||
sendHit();
|
||||
this.destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
updateRect();
|
||||
for each(var hero:BrickHeroView in BrickGroundCenter.ground.heros)
|
||||
{
|
||||
if(hero.hittestObj(this))
|
||||
{
|
||||
if(buffType > 0)
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.getbuff);
|
||||
buff = BaseBuff.getBuff(buffType,hero);
|
||||
buff.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.gedang);
|
||||
mv = FF.getBMC("mov.gedang",40);
|
||||
mv.x = this.hitrect.x + this.hitrect.width / 2;
|
||||
mv.y = this.hitrect.y + this.hitrect.height / 2;
|
||||
BrickGroundCenter.ground.layer_main.addChild(mv);
|
||||
Director.playOnce(mv);
|
||||
}
|
||||
if(BrickGroundCenter.getInstance().p2 == null || Math.random() < 0.4)
|
||||
{
|
||||
hero.cd--;
|
||||
BrickGroundCenter.ground.updateCd();
|
||||
}
|
||||
this.destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(engine.speedY < 0)
|
||||
{
|
||||
this.destroy();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
BrickGroundCenter.ground.bulletRemove.push(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public function sendHit() : void
|
||||
{
|
||||
var mv:BitMovieClip = FF.getBMC("mov.hit");
|
||||
mv.smoothing = true;
|
||||
mv.x = this.hitrect.width / 2 + this.hitrect.x;
|
||||
mv.y = this.hitrect.height / 2 + this.hitrect.y;
|
||||
mv.rotation = engine.valueAng;
|
||||
Director.playOnce(mv);
|
||||
BrickGroundCenter.ground.layer_main.addChild(mv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground.view
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.base.hitobj.StageObj;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseSkill;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickHeroVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view.HeroUI;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class BrickHeroView extends StageObj
|
||||
{
|
||||
|
||||
public var vo:BrickHeroVo;
|
||||
|
||||
public var ui:HeroUI;
|
||||
|
||||
public var hp:int;
|
||||
|
||||
public var _cd:int;
|
||||
|
||||
public var _speed:Number;
|
||||
|
||||
public var speedBuff:Number = 1;
|
||||
|
||||
public var skill:BrickBaseSkill;
|
||||
|
||||
public var mc_skill:BitMovieClip;
|
||||
|
||||
public function BrickHeroView(hero:BrickHeroVo)
|
||||
{
|
||||
var rec:Rectangle = null;
|
||||
vo = hero;
|
||||
_speed = vo.all_spd;
|
||||
ui = vo.getUI();
|
||||
addChild(ui);
|
||||
skill = BrickBaseSkill.getSkill(vo.skill,this);
|
||||
_cd = skill.cd;
|
||||
var scalexs:Number = 0.8;
|
||||
if(BrickGroundCenter.getInstance().p2 != null)
|
||||
{
|
||||
rec = ui.getArea(scalexs);
|
||||
this.scaleX = this.scaleY = scalexs;
|
||||
}
|
||||
else
|
||||
{
|
||||
rec = ui.getArea();
|
||||
}
|
||||
super(rec);
|
||||
mc_skill = FF.getBMC("hero.skillReady" + vo.type,30);
|
||||
mc_skill.stop();
|
||||
if(BrickGroundCenter.getInstance().p2 != null)
|
||||
{
|
||||
mc_skill.x = rect.x + rect.width / scalexs / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_skill.x = rect.x + rect.width / 2;
|
||||
}
|
||||
mc_skill.y = rect.y + rect.height / 2 - 10;
|
||||
SecondDriver.getInstance().regist(secondHandler);
|
||||
}
|
||||
|
||||
public function skillReady(b:Boolean = true) : void
|
||||
{
|
||||
if(b)
|
||||
{
|
||||
mc_skill.rotation = Random.integer(0,360);
|
||||
mc_skill.gotoAndPlay(1);
|
||||
addChild(mc_skill);
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_skill.stop();
|
||||
if(this.contains(mc_skill))
|
||||
{
|
||||
removeChild(mc_skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
this.updateRect();
|
||||
}
|
||||
|
||||
public function get speed() : Number
|
||||
{
|
||||
return _speed * speedBuff;
|
||||
}
|
||||
|
||||
public function set speed(val:Number) : void
|
||||
{
|
||||
_speed = speed;
|
||||
}
|
||||
|
||||
public function startSkill(e:Event = null) : Boolean
|
||||
{
|
||||
if(_cd == 0)
|
||||
{
|
||||
skill.start();
|
||||
_cd = skill.cd;
|
||||
skillReady(false);
|
||||
BrickGroundCenter.ground.updateCd();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get cd() : int
|
||||
{
|
||||
return _cd;
|
||||
}
|
||||
|
||||
public function set cd(val:int) : void
|
||||
{
|
||||
if(val < 0)
|
||||
{
|
||||
val = 0;
|
||||
}
|
||||
_cd = val;
|
||||
}
|
||||
|
||||
public function secondHandler() : void
|
||||
{
|
||||
if(cd <= 0)
|
||||
{
|
||||
if(cd <= 0)
|
||||
{
|
||||
skillReady(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function sendball(e:Event = null) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
for(i = 0; i < BrickGroundCenter.ground.balls.length; )
|
||||
{
|
||||
if(BrickGroundCenter.ground.balls[i].tikHero == this)
|
||||
{
|
||||
BrickGroundCenter.ground.balls[i].tikHero = null;
|
||||
BrickGroundCenter.ground.balls[i].visible = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBall() : BrickBallView
|
||||
{
|
||||
return new BrickBallView(this);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
SecondDriver.getInstance().remove(secondHandler);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.ground.view
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.events.Event;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.effect.effects.ShakeEffect;
|
||||
import net.pixvi.common.pool.BasePool;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.gamelib.base.hitobj.StageObj;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.JumpNumber;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickMonsterVo;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
|
||||
public class BrickMonsterView extends StageObj
|
||||
{
|
||||
|
||||
public var vo:BrickMonsterVo;
|
||||
|
||||
public var ui:BitMovieClip;
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public var monskill:BrickBaseMonskill;
|
||||
|
||||
public var dieskill:BrickBaseMonskill;
|
||||
|
||||
public var boom1Pool:BasePool = new BasePool(BitMovieClip);
|
||||
|
||||
public function BrickMonsterView(vo:BrickMonsterVo)
|
||||
{
|
||||
this.vo = vo;
|
||||
ui = vo.getui();
|
||||
ui.stopFrame = 1;
|
||||
ui.stop();
|
||||
addChild(ui);
|
||||
updateView();
|
||||
super(vo.rect);
|
||||
}
|
||||
|
||||
public function startUp() : void
|
||||
{
|
||||
if(vo.skill > 0 && vo.skillcd > 0)
|
||||
{
|
||||
monskill = BrickBaseMonskill.getMonskill(vo.skill,this);
|
||||
timer = new Timer(vo.skillcd);
|
||||
timer.addEventListener("timer",skill);
|
||||
timer.start();
|
||||
}
|
||||
if(vo.dsk > 0)
|
||||
{
|
||||
dieskill = BrickBaseMonskill.getMonskill(vo.dsk,this);
|
||||
}
|
||||
updateRect();
|
||||
}
|
||||
|
||||
public function hit(ball:BrickBallView) : Boolean
|
||||
{
|
||||
if(this.vo.wall)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var ht:int = ball.hero.vo.all_atk - vo.def;
|
||||
if(this.vo.mon)
|
||||
{
|
||||
new ShakeEffect(0,4).startEffect(this);
|
||||
}
|
||||
if(ht < 1)
|
||||
{
|
||||
ht = 1;
|
||||
}
|
||||
vo.hp -= ht;
|
||||
if(vo.mon)
|
||||
{
|
||||
JumpNumber.showNum(ht,ball.hitrect.x,ball.hitrect.y);
|
||||
BrickGroundCenter.ground.ui.ui_moninfo.showHurt(this,ht);
|
||||
SoundCenter.getInstance().play(BrickGameSound.hitMonster,0.7);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.hitWall);
|
||||
}
|
||||
if(vo.hp <= 0)
|
||||
{
|
||||
vo.hp = 0;
|
||||
die();
|
||||
return true;
|
||||
}
|
||||
updateView();
|
||||
return false;
|
||||
}
|
||||
|
||||
public function skill(e:Event = null) : void
|
||||
{
|
||||
if(ui.totalFrames > 1)
|
||||
{
|
||||
ui.gotoAndPlay(2);
|
||||
}
|
||||
if(BrickGroundCenter.ground.running())
|
||||
{
|
||||
monskill.start();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateView() : void
|
||||
{
|
||||
var frame:int = 0;
|
||||
if(!vo.mon)
|
||||
{
|
||||
frame = 1 + int(ui.totalFrames * (vo.hpmax - vo.hp) / vo.hpmax);
|
||||
frame = int(frame > ui.totalFrames ? frame - 1 : frame);
|
||||
ui.gotoAndStop(frame);
|
||||
}
|
||||
}
|
||||
|
||||
public function die() : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.monsterDie);
|
||||
try
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound["monsterdie_" + vo.type]);
|
||||
}
|
||||
catch(error:Error)
|
||||
{
|
||||
}
|
||||
if(dieskill != null)
|
||||
{
|
||||
dieskill.start();
|
||||
}
|
||||
var bmc:BitMovieClip = FF.getBMC("mov.boom1");
|
||||
bmc.smoothing = true;
|
||||
bmc.scaleX = bmc.scaleY = this.width / 100;
|
||||
bmc.x = this.hitrect.x + this.hitrect.width / 2;
|
||||
bmc.y = this.hitrect.y + this.hitrect.height / 2;
|
||||
BrickGroundCenter.ground.layer_main.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
BrickGroundCenter.ground.monsterRemove.push(this);
|
||||
Caller.delayCall(dispose,200);
|
||||
}
|
||||
|
||||
public function getBulletView() : BrickBulletView
|
||||
{
|
||||
return new BrickBulletView(this);
|
||||
}
|
||||
|
||||
public function getBulletUI() : Bitmap
|
||||
{
|
||||
return FF.getBM("mon.skill" + this.vo.skill,"auto",true);
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
if(timer != null)
|
||||
{
|
||||
timer.stop();
|
||||
}
|
||||
super.dispose();
|
||||
BrickGroundCenter.ground.checkGameOver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils
|
||||
{
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
|
||||
public class BrickGameSound
|
||||
{
|
||||
|
||||
public static var small_boom:String = "data/snd/game6/sound/boom3.mp3";
|
||||
|
||||
public static var big_boom:String = "data/snd/game6/sound/boom3.mp3";
|
||||
|
||||
public static var win:String = "data/snd/game6/sound/win.mp3";
|
||||
|
||||
public static var levelup:String = "data/snd/game6/sound/level_up.mp3";
|
||||
|
||||
public static var buyHero:String = "data/snd/game6/sound/level_up.mp3";
|
||||
|
||||
public static var getbuff:String = "";
|
||||
|
||||
public static var gedang:String = "data/snd/game6/sound/hitwall2.mp3";
|
||||
|
||||
public static var newStage:String = "data/snd/game6/sound/unlock.mp3";
|
||||
|
||||
public static var lose:String = "data/snd/game6/sound/fail.mp3";
|
||||
|
||||
public static var hurt:String = "data/snd/game6/sound/hitAnimal2.mp3";
|
||||
|
||||
public static var hitWall:String = "data/snd/game6/sound/hitwall.mp3";
|
||||
|
||||
public static var hitHero:String = "data/snd/game6/sound/hitwall.mp3";
|
||||
|
||||
public static var hitMonster:String = "data/snd/game6/sound/hitAnimal2.mp3";
|
||||
|
||||
public static var skill1_start:String = "data/snd/game6/sound/skill1.mp3";
|
||||
|
||||
public static var skill1_hit:String = "";
|
||||
|
||||
public static var skill2_start:String = "data/snd/game6/sound/skill2.mp3";
|
||||
|
||||
public static var skill2_hit:String = "";
|
||||
|
||||
public static var skill3_start:String = "data/snd/game6/sound/skill3.mp3";
|
||||
|
||||
public static var skill3_hit:String = "";
|
||||
|
||||
public static var skill4_start:String = "data/snd/game6/sound/skill4.mp3";
|
||||
|
||||
public static var skill4_hit:String = "";
|
||||
|
||||
public static var monsterdie_5:String = "data/snd/game6/sound/monster2_die.mp3";
|
||||
|
||||
public static var monsterdie_6:String = "data/snd/game6/sound/monster3_die.mp3";
|
||||
|
||||
public static var monsterdie_7:String = "data/snd/game6/sound/monster2_die.mp3";
|
||||
|
||||
public static var monsterdie_8:String = "data/snd/game6/sound/monster3_die.mp3";
|
||||
|
||||
public static var monsterdie_9:String = "data/snd/game6/sound/monster3_die.mp3";
|
||||
|
||||
public static var monsterdie_10:String = "data/snd/game6/sound/monster10_die.mp3";
|
||||
|
||||
public static var monsterdie_11:String = "data/snd/game6/sound/monster10_die.mp3";
|
||||
|
||||
public static var monsterdie_12:String = "data/snd/game6/sound/monster3_die.mp3";
|
||||
|
||||
public static var monsterdie_13:String = "data/snd/game6/sound/monster10_die.mp3";
|
||||
|
||||
public static var monsterdie_14:String = "data/snd/game6/sound/monster2_die.mp3";
|
||||
|
||||
public static var monsterdie_15:String = "data/snd/game6/sound/monster10_die.mp3";
|
||||
|
||||
public static var monsterdie_16:String = "data/snd/game6/sound/monster10_die.mp3";
|
||||
|
||||
public static var yao:String = "data/snd/game6/sound/yao.mp3";
|
||||
|
||||
public static var monsterDie:String = "data/snd/game6/sound/wallbreak.mp3";
|
||||
|
||||
public static var click:String = GameSound.effect_click1;
|
||||
|
||||
public function BrickGameSound()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import net.pixvi.common.pool.BasePool;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.common.view.font.BitNumber;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.pfw.display.struct.FrameCollector;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class JumpNumber extends BitNumber
|
||||
{
|
||||
|
||||
public static var pool:BasePool;
|
||||
|
||||
public function JumpNumber(fontSpace:int = 0, textAlign:String = "center")
|
||||
{
|
||||
var frameCollector:FrameCollector = FF.getFC("BIT_NUMBER");
|
||||
super(frameCollector,fontSpace,textAlign);
|
||||
}
|
||||
|
||||
public static function showNum(num:int, x:Number, y:Number) : void
|
||||
{
|
||||
if(pool == null)
|
||||
{
|
||||
pool = new BasePool(JumpNumber);
|
||||
}
|
||||
var nb:JumpNumber = pool.get();
|
||||
nb.x = x;
|
||||
nb.y = y;
|
||||
nb.init(num);
|
||||
BrickGroundCenter.ground.layer_main.addChild(nb);
|
||||
}
|
||||
|
||||
public function init(num:int) : void
|
||||
{
|
||||
this.value = num;
|
||||
TweenMax.to(this,1,{
|
||||
"y":this.y - 20,
|
||||
"x":this.x + Random.integer(-20,20),
|
||||
"onComplete":dispose
|
||||
});
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
Director.removeMovie(this);
|
||||
pool.drop(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.element.BrickGameLevel;
|
||||
|
||||
public class LevelCol
|
||||
{
|
||||
|
||||
public var levels:Array;
|
||||
|
||||
public function LevelCol()
|
||||
{
|
||||
super();
|
||||
levels = [];
|
||||
}
|
||||
|
||||
public function getLevel(level:int) : BrickGameLevel
|
||||
{
|
||||
return levels[level - 1];
|
||||
}
|
||||
|
||||
public function pushLevel(level:BrickGameLevel) : void
|
||||
{
|
||||
levels[level.level - 1] = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff1;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff2;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff3;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff4;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff5;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff6;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff7;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.Buff8;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff.BuffMov;
|
||||
|
||||
public class BaseBuff
|
||||
{
|
||||
|
||||
private static var buffs:Array;
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var hero:BrickHeroView;
|
||||
|
||||
public var buffMovType:String;
|
||||
|
||||
public function BaseBuff(heroview:BrickHeroView)
|
||||
{
|
||||
super();
|
||||
this.hero = heroview;
|
||||
}
|
||||
|
||||
public static function getBuff(type:int, hero:BrickHeroView) : BaseBuff
|
||||
{
|
||||
if(buffs == null)
|
||||
{
|
||||
buffs = [Buff1,Buff2,Buff3,Buff4,Buff5,Buff6,Buff7,Buff8];
|
||||
}
|
||||
var buff:BaseBuff = new (buffs[type - 1] as Class)(hero);
|
||||
buff.type = type;
|
||||
return buff;
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
var buffmov:BuffMov = null;
|
||||
SoundCenter.getInstance().play(BrickGameSound.yao);
|
||||
if(buffMovType == null)
|
||||
{
|
||||
buffmov = new BuffMov(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffmov = new BuffMov(int(buffMovType));
|
||||
}
|
||||
hero.setInCenter(buffmov);
|
||||
buffmov.y -= 10;
|
||||
buffmov.start();
|
||||
BrickGroundCenter.ground.layer_main.addChild(buffmov);
|
||||
}
|
||||
|
||||
public function stop() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill.*;
|
||||
|
||||
public class BrickBaseMonskill
|
||||
{
|
||||
|
||||
private static var skills:Array;
|
||||
|
||||
public var mon:BrickMonsterView;
|
||||
|
||||
public function BrickBaseMonskill(mon:BrickMonsterView)
|
||||
{
|
||||
super();
|
||||
this.mon = mon;
|
||||
}
|
||||
|
||||
public static function getMonskill(type:int, mon:BrickMonsterView) : BrickBaseMonskill
|
||||
{
|
||||
if(skills == null)
|
||||
{
|
||||
skills = [Monskill1,Monskill2,Monskill3,Monskill4,Monskill5,Monskill6,Monskill7,Monskill8,Monskill9,Monskill10,Monskill11];
|
||||
}
|
||||
return new (skills[type - 1] as Class)(mon);
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.skill.*;
|
||||
|
||||
public class BrickBaseSkill
|
||||
{
|
||||
|
||||
private static var skills:Array;
|
||||
|
||||
public var hero:BrickHeroView;
|
||||
|
||||
public var cd:int;
|
||||
|
||||
public function BrickBaseSkill(hero:BrickHeroView)
|
||||
{
|
||||
super();
|
||||
this.hero = hero;
|
||||
}
|
||||
|
||||
public static function getSkill(type:int, hero:BrickHeroView) : BrickBaseSkill
|
||||
{
|
||||
if(skills == null)
|
||||
{
|
||||
skills = [BrickSkill1,BrickSkill2,BrickSkill3,BrickSkill4];
|
||||
}
|
||||
return new (skills[type - 1] as Class)(hero);
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
|
||||
public class BrickChapterVo
|
||||
{
|
||||
|
||||
public var chapter:int;
|
||||
|
||||
public function BrickChapterVo(cpt:int = 1)
|
||||
{
|
||||
super();
|
||||
chapter = cpt;
|
||||
}
|
||||
|
||||
public function unlock() : Boolean
|
||||
{
|
||||
return BrickGroundCenter.getInstance().getStage((chapter - 1) * BrickGroundCenter.ChapterStageNum + 1).unlock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view.HeroUI;
|
||||
|
||||
public class BrickHeroVo
|
||||
{
|
||||
|
||||
private static var typenames:Object = {
|
||||
1:"勇者",
|
||||
2:"弓箭手",
|
||||
3:"战士",
|
||||
4:"魔法师"
|
||||
};
|
||||
|
||||
private var _type:int = 1;
|
||||
|
||||
public function BrickHeroVo(type:int)
|
||||
{
|
||||
super();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public function get lv_atk() : int
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.heroData[type].atk;
|
||||
}
|
||||
|
||||
public function set lv_atk(val:int) : void
|
||||
{
|
||||
BrickGameCenter.getInstance().master.heroData[type].atk = val;
|
||||
}
|
||||
|
||||
public function get lv_def() : int
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.heroData[type].def;
|
||||
}
|
||||
|
||||
public function set lv_def(val:int) : void
|
||||
{
|
||||
BrickGameCenter.getInstance().master.heroData[type].def = val;
|
||||
}
|
||||
|
||||
public function get lv_hp() : int
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.heroData[type].hp;
|
||||
}
|
||||
|
||||
public function set lv_hp(val:int) : void
|
||||
{
|
||||
BrickGameCenter.getInstance().master.heroData[type].hp = val;
|
||||
}
|
||||
|
||||
public function get lv_spd() : int
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.heroData[type].spd;
|
||||
}
|
||||
|
||||
public function set lv_spd(val:int) : void
|
||||
{
|
||||
BrickGameCenter.getInstance().master.heroData[type].spd = val;
|
||||
}
|
||||
|
||||
public function get skill() : int
|
||||
{
|
||||
return data.skill;
|
||||
}
|
||||
|
||||
public function get atk() : int
|
||||
{
|
||||
return data.atk;
|
||||
}
|
||||
|
||||
public function get hp() : int
|
||||
{
|
||||
return data.hp;
|
||||
}
|
||||
|
||||
public function get def() : int
|
||||
{
|
||||
return data.def;
|
||||
}
|
||||
|
||||
public function get spd() : Number
|
||||
{
|
||||
return data.spd;
|
||||
}
|
||||
|
||||
public function get money() : int
|
||||
{
|
||||
return data.money;
|
||||
}
|
||||
|
||||
public function get ball_spd() : Number
|
||||
{
|
||||
return data.ballSpd;
|
||||
}
|
||||
|
||||
public function set type(val:int) : void
|
||||
{
|
||||
this._type = val;
|
||||
}
|
||||
|
||||
public function get unlock() : Boolean
|
||||
{
|
||||
return BrickGameCenter.getInstance().master.heroUnlock(type);
|
||||
}
|
||||
|
||||
public function set unlock(val:Boolean) : void
|
||||
{
|
||||
BrickGameCenter.master().heroData[_type].unlock = true;
|
||||
}
|
||||
|
||||
public function get type() : int
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public function get typeName() : String
|
||||
{
|
||||
return typenames[type];
|
||||
}
|
||||
|
||||
public function get data() : Object
|
||||
{
|
||||
return BrickDataCenter.data.hero[_type];
|
||||
}
|
||||
|
||||
public function get all_atk() : int
|
||||
{
|
||||
return atk + BrickDataCenter.data.level.atk[lv_atk - 1];
|
||||
}
|
||||
|
||||
public function get all_hp() : int
|
||||
{
|
||||
return hp + BrickDataCenter.data.level.hp[lv_hp - 1];
|
||||
}
|
||||
|
||||
public function get all_spd() : Number
|
||||
{
|
||||
return spd + BrickDataCenter.data.level.spd[lv_spd - 1];
|
||||
}
|
||||
|
||||
public function get all_def() : int
|
||||
{
|
||||
return def + BrickDataCenter.data.level.def[lv_def - 1];
|
||||
}
|
||||
|
||||
public function getBM() : Bitmap
|
||||
{
|
||||
return ImgCenter.getBrickHeroImg(type);
|
||||
}
|
||||
|
||||
public function getUI() : HeroUI
|
||||
{
|
||||
return new HeroUI(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero
|
||||
{
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
|
||||
public class BrickMonsterVo
|
||||
{
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var hp:int;
|
||||
|
||||
public var hpmax:int;
|
||||
|
||||
public var atk:int;
|
||||
|
||||
public var dsk:int;
|
||||
|
||||
public var def:int;
|
||||
|
||||
public var skill:int;
|
||||
|
||||
public var skillcd:int;
|
||||
|
||||
public var skillspeed:Number;
|
||||
|
||||
public var ui:String;
|
||||
|
||||
public var mon:Boolean;
|
||||
|
||||
public var wall:Boolean;
|
||||
|
||||
public var rect:Rectangle;
|
||||
|
||||
public var des:String;
|
||||
|
||||
public function BrickMonsterVo(type:int)
|
||||
{
|
||||
super();
|
||||
this.type = type;
|
||||
hp = hpmax = BrickDataCenter.mon.monster[type].hp;
|
||||
atk = BrickDataCenter.mon.monster[type].atk;
|
||||
des = BrickDataCenter.mon.monster[type].des;
|
||||
def = BrickDataCenter.mon.monster[type].def;
|
||||
skill = BrickDataCenter.mon.monster[type].skill;
|
||||
skillcd = int(BrickDataCenter.mon.monster[type].cd);
|
||||
skillspeed = BrickDataCenter.mon.monster[type].speed;
|
||||
if(BrickDataCenter.mon.monster[type].dsk != null)
|
||||
{
|
||||
dsk = BrickDataCenter.mon.monster[type].dsk;
|
||||
}
|
||||
else
|
||||
{
|
||||
dsk = 0;
|
||||
}
|
||||
wall = BrickDataCenter.mon.monster[type].wall == 1;
|
||||
var uiobj:Object = BrickDataCenter.mon.monsterUI[BrickDataCenter.mon.monster[type].ui];
|
||||
ui = uiobj.ui;
|
||||
mon = uiobj.mon == "1";
|
||||
rect = new Rectangle(uiobj.area[0],uiobj.area[1],uiobj.area[2],uiobj.area[3]);
|
||||
}
|
||||
|
||||
public function getui() : BitMovieClip
|
||||
{
|
||||
return FF.getBMC(ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
|
||||
public class Buff1 extends BaseBuff
|
||||
{
|
||||
|
||||
public static var buff1:BaseBuff;
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public function Buff1(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
timer = new Timer(200,50);
|
||||
timer.addEventListener("timer",timerComplete);
|
||||
if(buff1 != null)
|
||||
{
|
||||
buff1.stop();
|
||||
}
|
||||
buff1 = this;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
timer.start();
|
||||
}
|
||||
|
||||
public function timerComplete(e:TimerEvent) : void
|
||||
{
|
||||
for each(var b:BrickBallView in BrickGroundCenter.ground.balls)
|
||||
{
|
||||
if(!b.boom)
|
||||
{
|
||||
b.installBoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
timer.stop();
|
||||
hero = null;
|
||||
buff1 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class Buff2 extends BaseBuff
|
||||
{
|
||||
|
||||
public function Buff2(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
BrickDataCenter.getInstance().money.val = BrickDataCenter.getInstance().money.val + Random.integer(10,100);
|
||||
BrickGroundCenter.ground.updateInfo();
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class Buff3 extends BaseBuff
|
||||
{
|
||||
|
||||
public function Buff3(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
var addhp:int = Random.integer(BrickGroundCenter.getInstance().hpmax * 0.2,BrickGroundCenter.getInstance().hpmax * 0.8);
|
||||
BrickGroundCenter.getInstance().hp = BrickGroundCenter.getInstance().hp + addhp;
|
||||
if(BrickGroundCenter.getInstance().hp > BrickGroundCenter.getInstance().hpmax)
|
||||
{
|
||||
BrickGroundCenter.getInstance().hp = BrickGroundCenter.getInstance().hpmax;
|
||||
}
|
||||
BrickGroundCenter.ground.updateInfo();
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
|
||||
public class Buff4 extends BaseBuff
|
||||
{
|
||||
|
||||
public static var buff:BaseBuff;
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public function Buff4(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
timer = new Timer(10000,1);
|
||||
timer.addEventListener("timerComplete",timerComplete);
|
||||
if(buff != null)
|
||||
{
|
||||
buff.stop();
|
||||
}
|
||||
buff = this;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
hero.speedBuff = 1.4;
|
||||
timer.start();
|
||||
}
|
||||
|
||||
public function timerComplete(e:TimerEvent) : void
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
timer.stop();
|
||||
hero.speedBuff = 1;
|
||||
hero = null;
|
||||
buff = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
|
||||
public class Buff5 extends BaseBuff
|
||||
{
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public function Buff5(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
timer = new Timer(4000,1);
|
||||
timer.addEventListener("timerComplete",timerComplete);
|
||||
if(Buff4.buff != null)
|
||||
{
|
||||
Buff4.buff.stop();
|
||||
}
|
||||
Buff4.buff = this;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
hero.speedBuff = 0.6;
|
||||
timer.start();
|
||||
}
|
||||
|
||||
public function timerComplete(e:TimerEvent) : void
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
timer.stop();
|
||||
hero.speedBuff = 1;
|
||||
hero = null;
|
||||
Buff4.buff = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
|
||||
public class Buff6 extends BaseBuff
|
||||
{
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public function Buff6(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
timer = new Timer(200,50);
|
||||
timer.addEventListener("timer",timerComplete);
|
||||
if(Buff1.buff1 != null)
|
||||
{
|
||||
Buff1.buff1.stop();
|
||||
}
|
||||
Buff1.buff1 = this;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
timer.start();
|
||||
}
|
||||
|
||||
public function timerComplete(e:TimerEvent) : void
|
||||
{
|
||||
for each(var b:BrickBallView in BrickGroundCenter.ground.balls)
|
||||
{
|
||||
if(!b.boom)
|
||||
{
|
||||
b.installBoom(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
timer.stop();
|
||||
hero = null;
|
||||
Buff1.buff1 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
|
||||
public class Buff7 extends BaseBuff
|
||||
{
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public function Buff7(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
timer = new Timer(4000,1);
|
||||
timer.addEventListener("timerComplete",timerComplete);
|
||||
this.buffMovType = "5";
|
||||
if(Buff4.buff != null)
|
||||
{
|
||||
Buff4.buff.stop();
|
||||
}
|
||||
Buff4.buff = this;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
super.start();
|
||||
hero.speedBuff = 0.8;
|
||||
timer.start();
|
||||
}
|
||||
|
||||
public function timerComplete(e:TimerEvent) : void
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
timer.stop();
|
||||
hero.speedBuff = 1;
|
||||
hero = null;
|
||||
Buff4.buff = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BaseBuff;
|
||||
|
||||
public class Buff8 extends BaseBuff
|
||||
{
|
||||
|
||||
public var timer:Timer;
|
||||
|
||||
public function Buff8(heroview:BrickHeroView)
|
||||
{
|
||||
super(heroview);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var ball:BrickBallView = null;
|
||||
super.start();
|
||||
for each(var b:BrickBallView in BrickGroundCenter.ground.balls)
|
||||
{
|
||||
if(b.hero == this.hero)
|
||||
{
|
||||
ball = new BrickBallView(this.hero);
|
||||
ball.x = b.x;
|
||||
ball.y = b.y;
|
||||
if(b.boom)
|
||||
{
|
||||
ball.installBoom(b.smallboom);
|
||||
}
|
||||
BrickGroundCenter.ground.addBall(ball);
|
||||
ball.startup();
|
||||
ball.engine.speedY = b.engine.speedY;
|
||||
ball.engine.speedX = -b.engine.speedX;
|
||||
ball.rotation = ball.engine.valueAng;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function stop() : void
|
||||
{
|
||||
timer.stop();
|
||||
hero = null;
|
||||
Buff1.buff1 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.buff
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.Bitmap;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class BuffMov extends PiSprite
|
||||
{
|
||||
|
||||
public var img:Bitmap;
|
||||
|
||||
public function BuffMov(type:int)
|
||||
{
|
||||
super();
|
||||
img = FF.getBM("buff.type" + type);
|
||||
img.x -= img.width / 2;
|
||||
img.y -= img.height / 2;
|
||||
addChild(img);
|
||||
}
|
||||
|
||||
public function start() : void
|
||||
{
|
||||
TweenMax.to(this,2,{
|
||||
"y":this.y - 100,
|
||||
"alpha":0,
|
||||
"onComplete":dispose
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill1 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill1(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup();
|
||||
b.x = mon.hitrect.x + mon.hitrect.width / 2;
|
||||
b.y = mon.hitrect.y + mon.hitrect.height / 2;
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class Monskill10 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill10(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.buffType = int(Random.element([1,1,6,6,8]));
|
||||
b.atk = 0;
|
||||
b.startup(false);
|
||||
b.rotation = 90;
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.BrickGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill11 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill11(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
b = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
b = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
b = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
b = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
if(!BrickGame.mobi)
|
||||
{
|
||||
b = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class Monskill2 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill2(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.atk = 0;
|
||||
b.buffType = int(Random.element([1,2,3,4,5,6,8,8]));
|
||||
b.startup(false);
|
||||
b.rotation = 0;
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill3 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill3(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup(false);
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill4 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill4(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup(false);
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill5 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill5(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
b = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill6 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill6(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill7 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill7(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup();
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill8 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill8(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup(false);
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.monskill
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseMonskill;
|
||||
|
||||
public class Monskill9 extends BrickBaseMonskill
|
||||
{
|
||||
|
||||
public function Monskill9(mon:BrickMonsterView)
|
||||
{
|
||||
super(mon);
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var b:BrickBulletView = mon.getBulletView();
|
||||
b.startup(false);
|
||||
b.buffType = 7;
|
||||
mon.setInCenter(b);
|
||||
BrickGroundCenter.ground.layer_main.addChild(b);
|
||||
BrickGroundCenter.ground.bullets.push(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.skill
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseSkill;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
|
||||
public class BrickSkill1 extends BrickBaseSkill
|
||||
{
|
||||
|
||||
public function BrickSkill1(hero:BrickHeroView)
|
||||
{
|
||||
super(hero);
|
||||
cd = 2;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.skill1_start);
|
||||
var bmc:BitMovieClip = FF.getBMC("ball.shoot1",40);
|
||||
bmc.x = hero.rect.x + hero.rect.width / 2;
|
||||
bmc.y = hero.rect.y - 10;
|
||||
hero.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
var ball:BrickBallView = new BrickBallView(hero,"ball.Type1_1");
|
||||
ball.x = hero.hitrect.x + hero.hitrect.width / 2 - 10;
|
||||
ball.y = hero.hitrect.y;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
ball.engine.speedX = -4;
|
||||
ball.engine.speedY = -ball.speed * 2;
|
||||
ball.rotation = ball.engine.valueAng;
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
ball = new BrickBallView(hero,"ball.Type1_1");
|
||||
ball.x = hero.hitrect.x + hero.hitrect.width / 2 + 10;
|
||||
ball.y = hero.hitrect.y;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
ball.engine.speedX = 4;
|
||||
ball.engine.speedY = -ball.speed * 2;
|
||||
ball.rotation = ball.engine.valueAng;
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
ball = new BrickBallView(hero,"ball.Type1_1");
|
||||
ball.x = hero.hitrect.x + hero.hitrect.width / 2 + 10;
|
||||
ball.y = hero.hitrect.y;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
ball.engine.speedX = 0;
|
||||
ball.engine.speedY = -ball.speed * 2;
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.skill
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseSkill;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
|
||||
public class BrickSkill2 extends BrickBaseSkill
|
||||
{
|
||||
|
||||
private var flag:int = 0;
|
||||
|
||||
public function BrickSkill2(hero:BrickHeroView)
|
||||
{
|
||||
super(hero);
|
||||
cd = 3;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
flag = 0;
|
||||
Caller.delayCall(shoo,300,5);
|
||||
}
|
||||
|
||||
public function shoo() : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.skill2_start);
|
||||
var bmc:BitMovieClip = FF.getBMC("ball.shoot1",40);
|
||||
bmc.x = hero.rect.x + hero.rect.width / 2;
|
||||
bmc.y = hero.rect.y + hero.rect.height / 2;
|
||||
hero.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
var ball:BrickBallView = new BrickBallView(hero,"ball.Type2");
|
||||
ball.x = hero.hitrect.x + hero.hitrect.width / 2;
|
||||
ball.y = hero.hitrect.y;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
ball.engine.speedX = 0;
|
||||
ball.engine.speedY = -ball.speed * 2;
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
if(flag == 0)
|
||||
{
|
||||
ball.installBoom();
|
||||
}
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.skill
|
||||
{
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBulletView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseSkill;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
|
||||
public class BrickSkill3 extends BrickBaseSkill
|
||||
{
|
||||
|
||||
public function BrickSkill3(hero:BrickHeroView)
|
||||
{
|
||||
super(hero);
|
||||
cd = 3;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
var k:int = 0;
|
||||
var b:BrickBulletView = null;
|
||||
var ball:BrickBallView = null;
|
||||
var bmc:BitMovieClip = FF.getBMC("mov.hit14",30);
|
||||
bmc.rotation = -100;
|
||||
bmc.x = hero.x + hero.rect.x + hero.rect.width / 2;
|
||||
bmc.y = hero.y + hero.rect.y - 130;
|
||||
bmc.setScale(2.4);
|
||||
BrickGroundCenter.ground.layer_top.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
var posi:Array = [];
|
||||
for(k = 0; k < BrickGroundCenter.ground.bullets.length; )
|
||||
{
|
||||
b = BrickGroundCenter.ground.bullets[k];
|
||||
if(Math.abs(b.x - hero.x - hero.width) < 225 && Math.abs(b.y - hero.y) < 220)
|
||||
{
|
||||
posi.push({
|
||||
"x":b.x,
|
||||
"y":b.y,
|
||||
"sx":b.engine.speedX,
|
||||
"sy":b.engine.speedY
|
||||
});
|
||||
b.destroy();
|
||||
}
|
||||
k++;
|
||||
}
|
||||
if(posi.length == 0)
|
||||
{
|
||||
posi.push({
|
||||
"x":hero.x + hero.rect.x + hero.rect.width / 2,
|
||||
"y":hero.y + hero.rect.y
|
||||
});
|
||||
}
|
||||
for each(var o:Object in posi)
|
||||
{
|
||||
ball = new BrickBallView(hero,"ball.Type3_1");
|
||||
ball.x = o.x;
|
||||
ball.y = o.y;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
if(ball.x < hero.x + hero.width / 2)
|
||||
{
|
||||
ball.engine.speedX = -Math.abs(o.sx);
|
||||
}
|
||||
else
|
||||
{
|
||||
ball.engine.speedX = Math.abs(o.sx);
|
||||
}
|
||||
ball.engine.speedY = -10;
|
||||
ball.installBoom();
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
}
|
||||
}
|
||||
|
||||
public function shoo() : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.skill3_start);
|
||||
var bmc:BitMovieClip = FF.getBMC("ball.shoot3",40);
|
||||
bmc.x = hero.rect.x + hero.rect.width / 2;
|
||||
bmc.y = hero.rect.y + hero.rect.height / 2;
|
||||
hero.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
var ball:BrickBallView = new BrickBallView(hero,"ball.Type3");
|
||||
ball.x = hero.hitrect.x + hero.hitrect.width / 2;
|
||||
ball.y = hero.hitrect.y;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
ball.engine.speedX = 0;
|
||||
ball.engine.speedY = -ball.speed * 2;
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
ball.installBoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.skill
|
||||
{
|
||||
import flash.geom.Point;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickBallView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickHeroView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.view.BrickMonsterView;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickBaseSkill;
|
||||
import net.pixvi.pfw.display.BitMovieClip;
|
||||
import net.pixvi.pfw.utils.Angler;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Director;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class BrickSkill4 extends BrickBaseSkill
|
||||
{
|
||||
|
||||
private var num:int = 0;
|
||||
|
||||
public var small:Boolean = false;
|
||||
|
||||
public function BrickSkill4(hero:BrickHeroView)
|
||||
{
|
||||
super(hero);
|
||||
cd = 8;
|
||||
}
|
||||
|
||||
override public function start() : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.skill4_start);
|
||||
var bmc:BitMovieClip = FF.getBMC("ball.shoot4",40);
|
||||
bmc.x = hero.rect.x + hero.rect.width / 2;
|
||||
bmc.y = hero.rect.y + hero.rect.height / 2 - 10;
|
||||
hero.addChild(bmc);
|
||||
Director.playOnce(bmc);
|
||||
num = 0;
|
||||
Caller.delayCall(shoo,200,5);
|
||||
}
|
||||
|
||||
public function shoo() : void
|
||||
{
|
||||
var p1:Point = null;
|
||||
var p2:Point = null;
|
||||
var ball:BrickBallView = new BrickBallView(hero,"ball.Type4_1");
|
||||
ball.x = hero.hitrect.x + hero.hitrect.width / 2;
|
||||
ball.y = hero.hitrect.y - 14;
|
||||
ball.isBullet = true;
|
||||
ball.startup();
|
||||
var mon:BrickMonsterView = Random.element(BrickGroundCenter.ground.monsters) as BrickMonsterView;
|
||||
if(mon != null && mon.vo.wall && BrickGroundCenter.ground.monsters.length > 1)
|
||||
{
|
||||
mon = Random.element(BrickGroundCenter.ground.monsters) as BrickMonsterView;
|
||||
}
|
||||
if(mon != null)
|
||||
{
|
||||
p1 = new Point(ball.x,ball.y);
|
||||
p2 = new Point(mon.hitrect.x + mon.hitrect.width / 2,mon.hitrect.y + mon.hitrect.height / 2);
|
||||
ball.engine.setRotationSpeed(ball.speed * 2,Angler.getP2P(p2.x,p2.y,p1.x,p1.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
ball.engine.setRotationSpeed(ball.speed * 2,-90);
|
||||
}
|
||||
ball.rotation = ball.engine.valueAng;
|
||||
if(num < 2)
|
||||
{
|
||||
ball.installBoom();
|
||||
}
|
||||
else
|
||||
{
|
||||
ball.installBoom(true);
|
||||
}
|
||||
small = !small;
|
||||
num++;
|
||||
BrickGroundCenter.ground.balls.push(ball);
|
||||
BrickGroundCenter.ground.layer_main.addChild(ball);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import net.pixvi.common.view.tip.base.BaseTip;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
|
||||
public class BrickSkillTip extends BaseTip
|
||||
{
|
||||
|
||||
public var ui:BrickSkillTipUI;
|
||||
|
||||
public function BrickSkillTip()
|
||||
{
|
||||
super();
|
||||
ui = new BrickSkillTipUI();
|
||||
addChild(ui);
|
||||
}
|
||||
|
||||
public function setSkill(type:int) : void
|
||||
{
|
||||
ui.text_title.text = BrickDataCenter.data.skill["type" + type].name;
|
||||
ui.text_content.text = BrickDataCenter.data.skill["type" + type].des;
|
||||
}
|
||||
|
||||
override public function importData(data:Object) : void
|
||||
{
|
||||
setSkill(data.skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class BrickSkillTipUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_title:TextField;
|
||||
|
||||
public var text_content:TextField;
|
||||
|
||||
public function BrickSkillTipUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.skilltip");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.driver.TipDriver;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickHeroVo;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
|
||||
public class HeroInfoUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_hp:TextField;
|
||||
|
||||
public var text_hplv:TextField;
|
||||
|
||||
public var text_hpadd:TextField;
|
||||
|
||||
public var text_atk:TextField;
|
||||
|
||||
public var text_atklv:TextField;
|
||||
|
||||
public var text_atkadd:TextField;
|
||||
|
||||
public var text_def:TextField;
|
||||
|
||||
public var text_deflv:TextField;
|
||||
|
||||
public var text_defadd:TextField;
|
||||
|
||||
public var text_spd:TextField;
|
||||
|
||||
public var text_spdlv:TextField;
|
||||
|
||||
public var text_spdadd:TextField;
|
||||
|
||||
public var mc_type:MovieClip;
|
||||
|
||||
public var mc_unlock:MovieClip;
|
||||
|
||||
public var mc_skill:MovieClip;
|
||||
|
||||
public var img:PiImgContainer;
|
||||
|
||||
public var tip:BrickSkillTip;
|
||||
|
||||
public var heroVo:BrickHeroVo;
|
||||
|
||||
public function HeroInfoUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_type.stop();
|
||||
mc_skill.stop();
|
||||
mc_unlock.stop();
|
||||
tip = new BrickSkillTip();
|
||||
}
|
||||
|
||||
public function fillHero(herovo:BrickHeroVo) : void
|
||||
{
|
||||
heroVo = herovo;
|
||||
mc_type.gotoAndStop(heroVo.type);
|
||||
mc_skill.gotoAndStop(heroVo.skill);
|
||||
var bm:Bitmap = heroVo.getBM();
|
||||
img.loadImg(bm,true,false,0);
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
public function fillHeroType(type:int = 1) : void
|
||||
{
|
||||
heroVo = BrickDataCenter.getInstance().getHero(type);
|
||||
fillHero(heroVo);
|
||||
}
|
||||
|
||||
public function updateInfo() : void
|
||||
{
|
||||
TipDriver.getInstance().regist(mc_skill,tip,heroVo,3,true,false);
|
||||
if(heroVo.unlock)
|
||||
{
|
||||
mc_unlock.gotoAndStop(1);
|
||||
img.alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
img.alpha = 0.5;
|
||||
mc_unlock.gotoAndStop(2);
|
||||
}
|
||||
text_atk.text = heroVo.all_atk + "";
|
||||
text_def.text = heroVo.all_def + "";
|
||||
text_spd.text = heroVo.all_spd + "";
|
||||
text_hp.text = heroVo.all_hp + "";
|
||||
text_atkadd.text = "(+" + BrickDataCenter.data.level.atk[heroVo.lv_atk - 1] + ")";
|
||||
text_defadd.text = "(+" + BrickDataCenter.data.level.def[heroVo.lv_def - 1] + ")";
|
||||
text_spdadd.text = "(+" + BrickDataCenter.data.level.spd[heroVo.lv_spd - 1] + ")";
|
||||
text_hpadd.text = "(+" + BrickDataCenter.data.level.hp[heroVo.lv_hp - 1] + ")";
|
||||
text_atklv.text = "lv" + heroVo.lv_atk + "";
|
||||
text_deflv.text = "lv" + heroVo.lv_def + "";
|
||||
text_spdlv.text = "lv" + heroVo.lv_spd + "";
|
||||
text_hplv.text = "lv" + heroVo.lv_hp + "";
|
||||
}
|
||||
|
||||
public function nextHero() : void
|
||||
{
|
||||
var nt:int = heroVo.type + 1;
|
||||
if(nt > BrickDataCenter.getInstance().heros.length)
|
||||
{
|
||||
nt = 1;
|
||||
}
|
||||
heroVo = BrickDataCenter.getInstance().getHero(nt);
|
||||
fillHero(heroVo);
|
||||
}
|
||||
|
||||
public function prevHero() : void
|
||||
{
|
||||
var nt:int = heroVo.type - 1;
|
||||
if(nt <= 0)
|
||||
{
|
||||
nt = int(BrickDataCenter.getInstance().heros.length);
|
||||
}
|
||||
heroVo = BrickDataCenter.getInstance().getHero(nt);
|
||||
fillHero(heroVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.geom.Rectangle;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class HeroUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_area:Sprite;
|
||||
|
||||
public function HeroUI(type:int)
|
||||
{
|
||||
super(FF.getMC("hero.Type" + type,true));
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_area.parent.removeChild(mc_area);
|
||||
}
|
||||
|
||||
public function setWidth(width:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function getArea(scale:Number = 1) : Rectangle
|
||||
{
|
||||
mc_area.width *= scale;
|
||||
return new Rectangle(mc_area.x,mc_area.y,mc_area.width,mc_area.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class StatusInfoUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_money:TextField;
|
||||
|
||||
public var text_point:TextField;
|
||||
|
||||
public function StatusInfoUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
GlobalBroadcast.addEventListener("money",update);
|
||||
}
|
||||
|
||||
public function update(e:Event = null) : void
|
||||
{
|
||||
text_point.text = BrickGameCenter.master().getPoint().toString();
|
||||
text_money.text = BrickDataCenter.getInstance().money.val.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
|
||||
public class TipShow extends PiSprite
|
||||
{
|
||||
|
||||
public var onComplate:Function;
|
||||
|
||||
public var data:Array;
|
||||
|
||||
public var flag:int = 0;
|
||||
|
||||
public function TipShow(stage:int = 1)
|
||||
{
|
||||
super();
|
||||
data = BrickDataCenter.mon.stageTips[stage];
|
||||
}
|
||||
|
||||
public function start(on:Function = null) : void
|
||||
{
|
||||
flag = 0;
|
||||
onComplate = on;
|
||||
step();
|
||||
}
|
||||
|
||||
public function step() : void
|
||||
{
|
||||
trace("data",data);
|
||||
if(data != null && flag < data.length)
|
||||
{
|
||||
var tip:TipsUI = TipsUI.getTip();
|
||||
var vo:Object = data[flag];
|
||||
tip.x = vo.x;
|
||||
tip.y = vo.y;
|
||||
tip.text_text.text = vo.text;
|
||||
tip.start(step);
|
||||
addChild(tip);
|
||||
flag++;
|
||||
return;
|
||||
}
|
||||
trace("overtip");
|
||||
if(onComplate != null)
|
||||
{
|
||||
onComplate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.pool.BasePool;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class TipsUI extends UIComponent
|
||||
{
|
||||
|
||||
public static var pool:BasePool;
|
||||
|
||||
public var text_text:TextField;
|
||||
|
||||
public var onCom:Function;
|
||||
|
||||
public function TipsUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.tips");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
public static function getTip() : TipsUI
|
||||
{
|
||||
if(pool == null)
|
||||
{
|
||||
pool = new BasePool(TipsUI);
|
||||
}
|
||||
return pool.get();
|
||||
}
|
||||
|
||||
public function setText(text:String) : void
|
||||
{
|
||||
text_text.text = text;
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
onCom = null;
|
||||
pool.drop(this);
|
||||
}
|
||||
|
||||
public function start(oncom:Function = null) : void
|
||||
{
|
||||
this.onCom = oncom;
|
||||
this.alpha = 0;
|
||||
TweenMax.to(this,0.6,{
|
||||
"alpha":1,
|
||||
"onComplete":step2
|
||||
});
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
TweenMax.to(this,2,{"onComplete":step3});
|
||||
}
|
||||
|
||||
public function step3() : void
|
||||
{
|
||||
TweenMax.to(this,0.6,{
|
||||
"alpha":0,
|
||||
"onComplete":step4
|
||||
});
|
||||
}
|
||||
|
||||
public function step4() : void
|
||||
{
|
||||
if(onCom != null)
|
||||
{
|
||||
onCom();
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.other
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.BrickGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.pfw.ui.controls.PiButton;
|
||||
import net.pixvi.pfw.utils.Filter;
|
||||
|
||||
public class BrickSoundButton extends PiButton
|
||||
{
|
||||
|
||||
public function BrickSoundButton(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
onClick(sndclick);
|
||||
}
|
||||
|
||||
private function sndclick(e:Event = null) : void
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.click);
|
||||
}
|
||||
|
||||
public function set colorEnabled(val:Boolean) : void
|
||||
{
|
||||
this.enabled = val;
|
||||
if(val)
|
||||
{
|
||||
trace("aaaaaaa");
|
||||
if(BrickGame.mobi)
|
||||
{
|
||||
this.alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.filters = [];
|
||||
}
|
||||
}
|
||||
else if(BrickGame.mobi)
|
||||
{
|
||||
this.alpha = 0.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Filter.discoloration(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.other
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickChapterVo;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiListItem;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class ChapterItem extends PiListItem
|
||||
{
|
||||
|
||||
public var text_text:PiBitTextField;
|
||||
|
||||
public var btn_stage:PiLightButton;
|
||||
|
||||
public function ChapterItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
var vo:BrickChapterVo = value as BrickChapterVo;
|
||||
trace(vo.chapter,vo.unlock());
|
||||
btn_stage.onClick(sendSelectHandler);
|
||||
btn_stage.enabled = vo.unlock();
|
||||
if(btn_stage.enabled == false && GameMath.ModeTrace)
|
||||
{
|
||||
this.alpha = 0.6;
|
||||
btn_stage.enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.alpha = 1;
|
||||
}
|
||||
text_text.text = lang("-第{0}层-",vo.chapter.toString());
|
||||
}
|
||||
|
||||
private function sendSelectHandler(e:Event = null) : void
|
||||
{
|
||||
sendSelect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickChapterVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.BrickChapterSelectUI;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickChapterSelectPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:BrickChapterSelectUI;
|
||||
|
||||
public var page:int = 1;
|
||||
|
||||
public function BrickChapterSelectPanel()
|
||||
{
|
||||
super();
|
||||
buffMode = true;
|
||||
ui = new BrickChapterSelectUI();
|
||||
addChild(ui);
|
||||
ui.btn_back.onClick(backHandler);
|
||||
ui.btn_shop.onClick(openShopHandler);
|
||||
ui.list_stage.addEventListener("piselect",chapterSelectHandler);
|
||||
}
|
||||
|
||||
public static function openShopHandler(e:Event = null) : void
|
||||
{
|
||||
PopCenter.POP(BrickShopPanel.getIns());
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickChapterSelectPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickChapterSelectPanel) as BrickChapterSelectPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var vo:BrickChapterVo = null;
|
||||
ui.ui_info.update();
|
||||
var chapters:Array = [];
|
||||
for(i = 1; i <= BrickDataCenter.data.chapterNum; )
|
||||
{
|
||||
vo = new BrickChapterVo(i);
|
||||
chapters.push(vo);
|
||||
i++;
|
||||
}
|
||||
ui.list_stage.setDatas(chapters);
|
||||
ui.list_stage.page = page;
|
||||
}
|
||||
|
||||
public function chapterSelectHandler(e:Event = null) : void
|
||||
{
|
||||
BrickGroundCenter.getInstance().selectChapter = ui.list_stage.curSelectedItemData as BrickChapterVo;
|
||||
showOut();
|
||||
PopCenter.POP(BrickHeroSelectPanel.getIns());
|
||||
}
|
||||
|
||||
public function backHandler(e:Event = null) : void
|
||||
{
|
||||
showOut();
|
||||
PopCenter.POP(BrickStartMenuPanel.getInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import flash.display.Bitmap;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.effect.effects.JumpToNumEffect;
|
||||
import net.pixvi.common.utils.global;
|
||||
import net.pixvi.myr.center.TimeCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickStage;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickChapterVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.BrickGameOverUI;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickGameOverPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public static var startTime:int;
|
||||
|
||||
public static var endTime:int;
|
||||
|
||||
public static var saveJump:Jumper;
|
||||
|
||||
public var ui:BrickGameOverUI;
|
||||
|
||||
public var curvo:BrickStage;
|
||||
|
||||
public var myMoney:int;
|
||||
|
||||
public var timeMoney:int;
|
||||
|
||||
public var hpMoney:int;
|
||||
|
||||
public var loseTime:Number;
|
||||
|
||||
public var winTime:Number;
|
||||
|
||||
public var hpp:Number;
|
||||
|
||||
public var heroimg:Bitmap;
|
||||
|
||||
public function BrickGameOverPanel()
|
||||
{
|
||||
super();
|
||||
buffMode = true;
|
||||
ui = new BrickGameOverUI();
|
||||
addChild(ui);
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickGameOverPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickGameOverPanel) as BrickGameOverPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
endTime = TimeCenter.timestamp;
|
||||
ui.text_tishi.text = Random.element(strarr) + "";
|
||||
SoundCenter.getInstance().bgmStop();
|
||||
if(heroimg != null)
|
||||
{
|
||||
ui.container_hero.removeChild(heroimg);
|
||||
}
|
||||
heroimg = BrickGroundCenter.getInstance().p1.getBM();
|
||||
heroimg.scaleX = heroimg.scaleY = 0.6;
|
||||
ui.container_hero.addChild(heroimg);
|
||||
curvo = BrickGroundCenter.getInstance().selectStage;
|
||||
ui.mc_unlock.gotoAndStop(1);
|
||||
ui.btn_back.visible = false;
|
||||
ui.btn_back.onClick(backHandler);
|
||||
var totalMoney:int = BrickGroundCenter.getInstance().stageMoney();
|
||||
loseTime = 1 - (120 - (endTime - startTime)) / 120;
|
||||
winTime = (120 - (endTime - startTime)) / 120;
|
||||
trace(loseTime,winTime,"lwtime");
|
||||
if(global.back == true)
|
||||
{
|
||||
totalMoney = 0;
|
||||
loseTime = 0;
|
||||
}
|
||||
global.back = false;
|
||||
if(BrickGroundCenter.getInstance().win)
|
||||
{
|
||||
SoundCenter.getInstance().play(BrickGameSound.win);
|
||||
ui.mc_winlose.gotoAndStop(1);
|
||||
ui.mc_yanhua.gotoAndPlay(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
totalMoney *= 0.35;
|
||||
totalMoney *= loseTime;
|
||||
SoundCenter.getInstance().play(BrickGameSound.lose);
|
||||
ui.mc_winlose.gotoAndStop(2);
|
||||
ui.mc_yanhua.gotoAndStop(1);
|
||||
}
|
||||
TweenMax.fromTo(ui.mc_winlose,1,{"alpha":0},{"alpha":1});
|
||||
TweenMax.fromTo(ui.mc_winlose,1,{"y":ui.mc_winlose.y - 100},{
|
||||
"y":ui.mc_winlose.y,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
if(loseTime < 0 || BrickGroundCenter.getInstance().hp > 0)
|
||||
{
|
||||
loseTime = 0;
|
||||
}
|
||||
hpp = int(100 * BrickGroundCenter.getInstance().hp / BrickGroundCenter.getInstance().hpmax);
|
||||
if(BrickGroundCenter.getInstance().win)
|
||||
{
|
||||
myMoney = totalMoney * 0.6;
|
||||
winTime = 1;
|
||||
timeMoney = 0.2 * totalMoney * winTime;
|
||||
hpMoney = 0.2 * totalMoney * (BrickGroundCenter.getInstance().hp / BrickGroundCenter.getInstance().hpmax);
|
||||
}
|
||||
else
|
||||
{
|
||||
myMoney = totalMoney * 0.5;
|
||||
hpMoney = 0;
|
||||
timeMoney = 0.5 * totalMoney;
|
||||
}
|
||||
ui.text_money.text = "0";
|
||||
ui.text_time.text = "0";
|
||||
ui.text_stagemoney.text = "0";
|
||||
ui.text_hp.text = "0";
|
||||
var level:int = BrickGroundCenter.getInstance().selectStage.level;
|
||||
ui.text_stage.text = "关卡 " + level;
|
||||
new JumpToNumEffect(1000,myMoney).startEffect(ui.text_stagemoney);
|
||||
new JumpToNumEffect(1000,myMoney).startEffect(ui.text_money,step2);
|
||||
}
|
||||
|
||||
public function get strarr() : Array
|
||||
{
|
||||
return BrickDataCenter.data.tips;
|
||||
}
|
||||
|
||||
public function step2() : void
|
||||
{
|
||||
if(timeMoney == 0)
|
||||
{
|
||||
step3();
|
||||
return;
|
||||
}
|
||||
new JumpToNumEffect(1000,timeMoney).startEffect(ui.text_time);
|
||||
myMoney += timeMoney;
|
||||
new JumpToNumEffect(1000,myMoney).startEffect(ui.text_money,step3);
|
||||
}
|
||||
|
||||
public function step3() : void
|
||||
{
|
||||
if(hpMoney == 0)
|
||||
{
|
||||
complete();
|
||||
return;
|
||||
}
|
||||
new JumpToNumEffect(1000,hpMoney).startEffect(ui.text_hp);
|
||||
myMoney += hpMoney;
|
||||
new JumpToNumEffect(1000,myMoney).startEffect(ui.text_money,complete);
|
||||
}
|
||||
|
||||
public function complete() : void
|
||||
{
|
||||
if(saveJump == null)
|
||||
{
|
||||
saveJump = new Jumper(1);
|
||||
}
|
||||
if(BrickGroundCenter.getInstance().win)
|
||||
{
|
||||
if(!BrickGroundCenter.getInstance().selectStage.finish)
|
||||
{
|
||||
ui.mc_unlock.gotoAndPlay(2);
|
||||
SoundCenter.getInstance().play(BrickGameSound.newStage);
|
||||
}
|
||||
BrickGameCenter.master().passStage(BrickGroundCenter.getInstance().selectStage.level,myMoney);
|
||||
if(saveJump.jump())
|
||||
{
|
||||
BrickDataCenter.getInstance().save();
|
||||
}
|
||||
}
|
||||
BrickGameCenter.master().money.val = BrickGameCenter.master().money.val + myMoney;
|
||||
ui.btn_back.visible = true;
|
||||
TweenMax.fromTo(ui.btn_back,1.2,{"y":StageDriver.stageHeight + 5},{
|
||||
"y":ui.btn_back.y,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
}
|
||||
|
||||
public function backHandler(e:Event) : void
|
||||
{
|
||||
var nextchapter:BrickChapterVo = null;
|
||||
SoundCenter.getInstance().bgmPlay("bgm.mp3");
|
||||
showOut();
|
||||
if(BrickGroundCenter.getInstance().win && !BrickGroundCenter.getInstance().selectStage.isFinalStage() && BrickGroundCenter.getInstance().selectStage.isChapeterEnd())
|
||||
{
|
||||
nextchapter = new BrickChapterVo(BrickGroundCenter.getInstance().selectChapter.chapter + 1);
|
||||
BrickGroundCenter.getInstance().selectChapter = nextchapter;
|
||||
}
|
||||
PopCenter.POP(BrickStageSelectPanel.getInstance());
|
||||
}
|
||||
|
||||
public function submitHandler(e:Event) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.events.MouseEvent;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.BrickGame;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.event.BrickEvent;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.BrickGamingMenuUI;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickGamingMenuPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:BrickGamingMenuUI = new BrickGamingMenuUI();
|
||||
|
||||
public function BrickGamingMenuPanel()
|
||||
{
|
||||
addChild(ui);
|
||||
this.buffMode = true;
|
||||
ui.btn_return.onClick(btnHandler);
|
||||
ui.btn_replay.onClick(btnHandler);
|
||||
ui.btn_sound.onClick(btnHandler);
|
||||
ui.btn_back.onClick(btnHandler);
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickGamingMenuPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickGamingMenuPanel);
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
ui.btn_sound.selected = !BrickGame.sound;
|
||||
}
|
||||
|
||||
public function btnHandler(e:MouseEvent) : void
|
||||
{
|
||||
switch(e.target)
|
||||
{
|
||||
case ui.btn_back:
|
||||
Alert.yesno("提示","确定要放弃当前关卡?",backLevel);
|
||||
break;
|
||||
case ui.btn_return:
|
||||
this.showOut();
|
||||
break;
|
||||
case ui.btn_sound:
|
||||
if(BrickGame.sound)
|
||||
{
|
||||
BrickGame.soundOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
BrickGame.soundOn();
|
||||
}
|
||||
ui.btn_sound.selected = !BrickGame.sound;
|
||||
break;
|
||||
case ui.btn_replay:
|
||||
Alert.yesno("提示","确定要重新开始游戏?",replayLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public function backLevel() : void
|
||||
{
|
||||
this.showOut();
|
||||
GlobalBroadcast.dispatchEvent(new BrickEvent("levelBack"));
|
||||
}
|
||||
|
||||
public function replayLevel() : void
|
||||
{
|
||||
this.showOut();
|
||||
GlobalBroadcast.dispatchEvent(new BrickEvent("levelReplay"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.HelpPanelUI;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickHelpPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:HelpPanelUI = new HelpPanelUI();
|
||||
|
||||
public function BrickHelpPanel()
|
||||
{
|
||||
addChild(ui);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
super();
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
this.showOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.BrickHeroVo;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.BrickHeroSelectPanelUI;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickHeroSelectPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:BrickHeroSelectPanelUI = new BrickHeroSelectPanelUI();
|
||||
|
||||
public var selectNum:int = 1;
|
||||
|
||||
public var p1:BrickHeroVo;
|
||||
|
||||
public function BrickHeroSelectPanel()
|
||||
{
|
||||
addChild(ui);
|
||||
ui.btn_back.onClick(backHandler);
|
||||
ui.btn_select.onClick(selectHandler);
|
||||
ui.btn_next.onClick(mouseHandler);
|
||||
ui.btn_prev.onClick(mouseHandler);
|
||||
buffMode = true;
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : BrickHeroSelectPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickHeroSelectPanel) as BrickHeroSelectPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
p1 = null;
|
||||
if(BrickGroundCenter.getInstance().p1 != null)
|
||||
{
|
||||
ui.ui_hero.fillHeroType(BrickGroundCenter.getInstance().p1.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_hero.fillHeroType();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public function mouseHandler(e:Event) : void
|
||||
{
|
||||
if(e.target == ui.btn_next)
|
||||
{
|
||||
ui.ui_hero.nextHero();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_hero.prevHero();
|
||||
}
|
||||
ui.text_selected.text = "";
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
if(this.p1 == ui.ui_hero.heroVo)
|
||||
{
|
||||
ui.btn_select.colorEnabled = false;
|
||||
ui.text_selected.text = "玩家1";
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.text_selected.text = "";
|
||||
ui.btn_select.colorEnabled = true;
|
||||
}
|
||||
if(ui.btn_select.enabled)
|
||||
{
|
||||
ui.btn_select.colorEnabled = ui.ui_hero.heroVo.unlock;
|
||||
}
|
||||
}
|
||||
|
||||
public function selectHandler(e:Event) : void
|
||||
{
|
||||
p1 = ui.ui_hero.heroVo;
|
||||
levelStart();
|
||||
}
|
||||
|
||||
public function levelStart() : void
|
||||
{
|
||||
Caller.delayCall(realstart,100);
|
||||
}
|
||||
|
||||
public function realstart() : void
|
||||
{
|
||||
BrickGroundCenter.getInstance().p1 = this.p1;
|
||||
this.showOut();
|
||||
PopCenter.POP(BrickStageSelectPanel.getInstance());
|
||||
}
|
||||
|
||||
public function backHandler(e:Event) : void
|
||||
{
|
||||
this.showOut();
|
||||
PopCenter.POP(BrickChapterSelectPanel.getInstance());
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.effect.effects.FlashEffect;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.center.EffectCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickDataCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.BrickGameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.BrickShopPanelUI;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickShopPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:BrickShopPanelUI = new BrickShopPanelUI();
|
||||
|
||||
public var newdata:Boolean = false;
|
||||
|
||||
private var namepara:Array = ["","hp","def","atk","spd"];
|
||||
|
||||
public function BrickShopPanel()
|
||||
{
|
||||
addChild(ui);
|
||||
ui.btn_back.onClick(backHandler);
|
||||
ui.btn_next.onClick(btnHandler);
|
||||
ui.btn_prev.onClick(btnHandler);
|
||||
ui.btn_buy.onClick(upgradeHandler);
|
||||
ui.btn_buyHero.onClick(buyHeroHandler);
|
||||
buffMode = true;
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : BrickShopPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickShopPanel) as BrickShopPanel;
|
||||
}
|
||||
|
||||
public function upgradeHandler(e:Event = null) : void
|
||||
{
|
||||
newdata = true;
|
||||
var curlv:int = int(ui.ui_hero.heroVo["lv_" + namepara[ui.switch_para.value]]);
|
||||
var moneyneed:int = int(BrickDataCenter.data.levelCost[curlv]);
|
||||
BrickDataCenter.getInstance().money.val = BrickDataCenter.getInstance().money.val - moneyneed;
|
||||
ui.ui_hero.heroVo["lv_" + namepara[ui.switch_para.value]] += 1;
|
||||
new FlashEffect(600,16776960,0.6).startEffect(ui.ui_hero.img);
|
||||
SoundCenter.getInstance().play(BrickGameSound.levelup);
|
||||
update();
|
||||
GlobalBroadcast.dispatchEvent(new Event("money"));
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
newdata = false;
|
||||
ui.switch_para.selectFlag(1);
|
||||
ui.switch_para.addEventListener("piselect",paraselectHandler);
|
||||
if(BrickGroundCenter.getInstance().p1 != null)
|
||||
{
|
||||
ui.ui_hero.fillHeroType(BrickGroundCenter.getInstance().p1.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_hero.fillHeroType();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public function paraselectHandler(e:Event) : void
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
public function btnHandler(e:Event) : void
|
||||
{
|
||||
if(e.target == ui.btn_next)
|
||||
{
|
||||
ui.ui_hero.nextHero();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ui_hero.prevHero();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public function buyHeroHandler(e:Event) : void
|
||||
{
|
||||
newdata = true;
|
||||
new FlashEffect(600,16777215,1).startEffect(ui.ui_hero.img);
|
||||
EffectCenter.open_effect(138 + ui.ui_hero.x + ui.ui_hero.img.x,190 + ui.ui_hero.y + ui.ui_hero.img.y,40,2,2);
|
||||
SoundCenter.getInstance().play(BrickGameSound.buyHero);
|
||||
ui.ui_hero.heroVo.unlock = true;
|
||||
BrickGameCenter.master().money.val = BrickGameCenter.master().money.val - ui.ui_hero.heroVo.money;
|
||||
update();
|
||||
ui.ui_hero.updateInfo();
|
||||
GlobalBroadcast.dispatchEvent(new Event("money"));
|
||||
}
|
||||
|
||||
private function get namearr() : Array
|
||||
{
|
||||
return BrickDataCenter.data.paraName;
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var paraname:String = null;
|
||||
var curlv:int = 0;
|
||||
var moneyneed:int = 0;
|
||||
ui.btn_buyHero.visible = !ui.ui_hero.heroVo.unlock;
|
||||
ui.btn_buy.visible = ui.ui_hero.heroVo.unlock;
|
||||
if(ui.ui_hero.heroVo.unlock)
|
||||
{
|
||||
paraname = namearr[ui.switch_para.value];
|
||||
curlv = int(ui.ui_hero.heroVo["lv_" + namepara[ui.switch_para.value]]);
|
||||
moneyneed = int(BrickDataCenter.data.levelCost[curlv]);
|
||||
ui.text_msg.text = lang("升级 {0} {1} 金币",paraname,moneyneed);
|
||||
if(moneyneed > BrickDataCenter.getInstance().money.val)
|
||||
{
|
||||
ui.btn_buy.colorEnabled = false;
|
||||
}
|
||||
else if(curlv < 9)
|
||||
{
|
||||
ui.btn_buy.colorEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.btn_buy.colorEnabled = false;
|
||||
ui.text_msg.text = "" + paraname + lang(" 已达到最高等级!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.text_msg.text = lang("解锁 {0} {1} 金币",ui.ui_hero.heroVo.typeName,ui.ui_hero.heroVo.money);
|
||||
if(BrickDataCenter.getInstance().money.val < ui.ui_hero.heroVo.money)
|
||||
{
|
||||
ui.btn_buyHero.colorEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.btn_buyHero.colorEnabled = true;
|
||||
}
|
||||
}
|
||||
ui.ui_info.update();
|
||||
ui.ui_hero.updateInfo();
|
||||
}
|
||||
|
||||
public function backHandler(e:Event) : void
|
||||
{
|
||||
if(newdata)
|
||||
{
|
||||
BrickDataCenter.getInstance().save();
|
||||
}
|
||||
this.showOut();
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGroundCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickGroundPanel;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickStage;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.LevelColUI;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickStageSelectPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:LevelColUI;
|
||||
|
||||
public var page:int = 1;
|
||||
|
||||
public function BrickStageSelectPanel()
|
||||
{
|
||||
super();
|
||||
buffMode = true;
|
||||
ui = new LevelColUI();
|
||||
addChild(ui);
|
||||
ui.btn_back.onClick(backHandler);
|
||||
ui.btn_shop.onClick(BrickChapterSelectPanel.openShopHandler);
|
||||
ui.list_level.addEventListener("piselect",stageSelectHandler);
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickStageSelectPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickStageSelectPanel) as BrickStageSelectPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
ui.ui_info.update();
|
||||
ui.list_level.setDatas(BrickGroundCenter.getInstance().getStages());
|
||||
ui.list_level.page = BrickGroundCenter.getInstance().selectChapter.chapter;
|
||||
}
|
||||
|
||||
public function stageSelectHandler(e:Event = null) : void
|
||||
{
|
||||
BrickGroundCenter.getInstance().selectStage = ui.list_level.curSelectedItemData as BrickStage;
|
||||
this.showOut();
|
||||
PopCenter.POP(new BrickGroundPanel());
|
||||
}
|
||||
|
||||
public function backHandler(e:Event = null) : void
|
||||
{
|
||||
showOut();
|
||||
PopCenter.POP(BrickChapterSelectPanel.getInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.panel
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.system.AppLayer;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.center.BrickGameCenter;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.ui.BrickStartMenuUI;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class BrickStartMenuPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:BrickStartMenuUI = new BrickStartMenuUI();
|
||||
|
||||
public function BrickStartMenuPanel()
|
||||
{
|
||||
addChild(ui);
|
||||
ui.btn_exit.onClick(buttonHandler);
|
||||
ui.btn_help.onClick(buttonHandler);
|
||||
ui.btn_start.onClick(buttonHandler);
|
||||
buffMode = false;
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getInstance() : BrickStartMenuPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(BrickStartMenuPanel) as BrickStartMenuPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
ui.startYoyo();
|
||||
var bg:DisplayObject = AppLayer.app.LAYER_BG.addChild(FF.getMC("ui.BrickBgUI"));
|
||||
BrickGameCenter.getInstance().bg = bg;
|
||||
SoundCenter.getInstance().bgmPlay(GameSound.bgm_brickStart);
|
||||
}
|
||||
|
||||
override public function reset() : void
|
||||
{
|
||||
ui.stopYoyo();
|
||||
}
|
||||
|
||||
public function buttonHandler(e:Event = null) : void
|
||||
{
|
||||
switch(e.target)
|
||||
{
|
||||
case ui.btn_start:
|
||||
showOut();
|
||||
PopCenter.POP(BrickChapterSelectPanel.getInstance());
|
||||
break;
|
||||
case ui.btn_exit:
|
||||
GlobalBroadcast.dispatchEvent(new Event("brickGameOver"));
|
||||
break;
|
||||
case ui.btn_help:
|
||||
PopCenter.POP(new BrickHelpPanel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.ui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view.StatusInfoUI;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.other.BrickSoundButton;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.other.ChapterItem;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiDataList;
|
||||
import net.pixvi.pfw.ui.controls.PiListStepper;
|
||||
|
||||
public class BrickChapterSelectUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_back:BrickSoundButton;
|
||||
|
||||
public var btn_shop:BrickSoundButton;
|
||||
|
||||
public var list_stage:PiDataList;
|
||||
|
||||
public var text_money:TextField;
|
||||
|
||||
public var stepper_stage:PiListStepper;
|
||||
|
||||
public var ui_info:StatusInfoUI;
|
||||
|
||||
public function BrickChapterSelectUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.BrickScoreStageSelect");
|
||||
}
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
list_stage.itemClass = ChapterItem;
|
||||
}
|
||||
|
||||
public function update(page:int, pageSize:int) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.ui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiButton;
|
||||
|
||||
public class BrickGameOverUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_back:PiButton;
|
||||
|
||||
public var mc_winlose:MovieClip;
|
||||
|
||||
public var text_money:TextField;
|
||||
|
||||
public var text_stagemoney:TextField;
|
||||
|
||||
public var text_time:TextField;
|
||||
|
||||
public var text_tishi:TextField;
|
||||
|
||||
public var text_hp:TextField;
|
||||
|
||||
public var text_stage:TextField;
|
||||
|
||||
public var container_hero:MovieClip;
|
||||
|
||||
public var mc_unlock:MovieClip;
|
||||
|
||||
public var mc_yanhua:MovieClip;
|
||||
|
||||
public function BrickGameOverUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.BrickGameOverUIMobi");
|
||||
}
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.ui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiButton;
|
||||
|
||||
public class BrickGamingMenuUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_return:PiButton;
|
||||
|
||||
public var btn_back:PiButton;
|
||||
|
||||
public var btn_sound:PiButton;
|
||||
|
||||
public var btn_replay:PiButton;
|
||||
|
||||
public var text_level:TextField;
|
||||
|
||||
public function BrickGamingMenuUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.BrickGamingMenuUI");
|
||||
}
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.ui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.utils.breakhero.view.HeroInfoUI;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.view.other.BrickSoundButton;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class BrickHeroSelectPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_select:BrickSoundButton;
|
||||
|
||||
public var btn_back:BrickSoundButton;
|
||||
|
||||
public var btn_next:BrickSoundButton;
|
||||
|
||||
public var btn_prev:BrickSoundButton;
|
||||
|
||||
public var ui_hero:HeroInfoUI;
|
||||
|
||||
public var text_selected:TextField;
|
||||
|
||||
public function BrickHeroSelectPanelUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.BrickHeroSelectUI");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package net.pixvi.myr.panel.minigame.minigame6.view.ui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.panel.minigame.minigame6.ground.BrickStage;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.controls.PiListItem;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class BrickLevelListItem extends PiListItem
|
||||
{
|
||||
|
||||
public var mc_star:MovieClip;
|
||||
|
||||
public var text_level:TextField;
|
||||
|
||||
public var mc_lock:MovieClip;
|
||||
|
||||
public var text_point:TextField;
|
||||
|
||||
public var vo:BrickStage;
|
||||
|
||||
public function BrickLevelListItem(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
this.addEventListener(MobiEvent.CLICK,sendSelectHandler);
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
}
|
||||
|
||||
private function sendSelectHandler(e:Event = null) : void
|
||||
{
|
||||
if(vo.unlock || GameMath.ModeTrace)
|
||||
{
|
||||
sendSelect();
|
||||
}
|
||||
}
|
||||
|
||||
override public function onData(value:Object) : void
|
||||
{
|
||||
vo = value as BrickStage;
|
||||
if(vo.unlock || GameMath.ModeTrace)
|
||||
{
|
||||
if(!vo.unlock)
|
||||
{
|
||||
this.alpha = 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.alpha = 1;
|
||||
}
|
||||
mc_lock.gotoAndStop(1);
|
||||
text_level.text = vo.level.toString();
|
||||
text_point.text = vo.point.toString();
|
||||
text_point.visible = true;
|
||||
text_level.visible = text_point.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_level.visible = text_point.visible = false;
|
||||
text_point.visible = false;
|
||||
mc_lock.gotoAndStop(2);
|
||||
}
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user