Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,244 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.center.TipCenter;
|
||||
import net.pixvi.common.driver.ActivityDriver;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Cooldowner;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.ActiCenter;
|
||||
import net.pixvi.myr.center.Game;
|
||||
import net.pixvi.myr.center.GameCenter;
|
||||
import net.pixvi.myr.center.MailCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.MasterCenter;
|
||||
import net.pixvi.myr.center.PosCenter;
|
||||
import net.pixvi.myr.center.RandomEventCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.bag.BagPanel;
|
||||
import net.pixvi.myr.panel.event.EventListPanel;
|
||||
import net.pixvi.myr.panel.event.dailygift.ActiDailyGiftPanel;
|
||||
import net.pixvi.myr.panel.home.HomePanel;
|
||||
import net.pixvi.myr.panel.msg.MailPanel;
|
||||
import net.pixvi.myr.panel.pay.PayPanel;
|
||||
import net.pixvi.myr.panel.storeground.StoreGroundPanel;
|
||||
import net.pixvi.myr.panel.task.TaskPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Jumper;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class MainMenu extends Sprite
|
||||
{
|
||||
|
||||
public static var MENU_CLICK:String = "menuClick";
|
||||
|
||||
public var ui:MainMenuUI = new MainMenuUI();
|
||||
|
||||
public var curPanel:PSGPopPanel;
|
||||
|
||||
public var tipstep:int = 0;
|
||||
|
||||
public var liuhaiMode:Boolean = false;
|
||||
|
||||
public var liuhaiUI:Sprite;
|
||||
|
||||
private var checkDailyWorkJumpper:Jumper = new Jumper(10);
|
||||
|
||||
private var checkMailCd:Cooldowner = new Cooldowner(120000);
|
||||
|
||||
private var checkSafeMode:Cooldowner = new Cooldowner(20000);
|
||||
|
||||
public function MainMenu()
|
||||
{
|
||||
addChild(ui);
|
||||
super();
|
||||
ui.ui_top.btn_huodong.onClick(btnHandler);
|
||||
ui.ui_top.btn_dailyGift.onClick(btnHandler);
|
||||
ui.ui_top.container_avatar.addEventListener(MobiEvent.CLICK,btnHandler);
|
||||
ui.ui_top.ui_right.btn_bag.onClick(btnHandler);
|
||||
ui.ui_top.ui_right.btn_mail.onClick(btnHandler);
|
||||
ui.ui_top.ui_right.btn_task.onClick(btnHandler);
|
||||
ui.ui_top.text_ti.mouseEnabled = true;
|
||||
TipCenter.registTextTip(ui.ui_top.text_ti,lang("每2分30秒恢复1点体力"));
|
||||
curPanel = StoreGroundPanel.getIns();
|
||||
Caller.delayCall(ui.ui_top.startRightShow,500);
|
||||
ui.ui_top.btn_pay.onClick(payHandler);
|
||||
ui.ui_top.text_ke.mouseEnabled = true;
|
||||
ui.ui_top.text_ke.addEventListener(MobiEvent.CLICK,payHandler);
|
||||
ui.ui_top.btn_mainMenu.loadByBtnData(Table.activity_info.specialBtn.mainMenuBtn);
|
||||
ui.ui_top.btn_mainMenu2.loadByBtnData(Table.activity_info.specialBtn.mainMenuBtn2);
|
||||
updateLiuhai();
|
||||
ui.ui_top.updateAvatar();
|
||||
}
|
||||
|
||||
public static function getIns(showpanel:PSGPopPanel = null) : MainMenu
|
||||
{
|
||||
if(showpanel != null)
|
||||
{
|
||||
(Singleton.getInstanceOrCreate(MainMenu) as MainMenu).curPanel = showpanel;
|
||||
}
|
||||
return Singleton.getInstanceOrCreate(MainMenu) as MainMenu;
|
||||
}
|
||||
|
||||
public function payHandler(e:Event = null) : void
|
||||
{
|
||||
if(GameMath.OpenPay && Table.setting.closePay != true)
|
||||
{
|
||||
PopCenter.POP(PayPanel.getIns());
|
||||
}
|
||||
}
|
||||
|
||||
public function btnHandler(e:Event) : void
|
||||
{
|
||||
clickBtn(e.currentTarget);
|
||||
}
|
||||
|
||||
public function clickBtn(btn:Object) : void
|
||||
{
|
||||
switch(btn)
|
||||
{
|
||||
case ui.ui_top.btn_huodong:
|
||||
PopCenter.POP(EventListPanel.getIns());
|
||||
StoreGroundPanel.getIns().ground.pause();
|
||||
break;
|
||||
case ui.ui_top.container_avatar:
|
||||
SoundCenter.getIns().play(GameSound.effect_click1);
|
||||
curPanel.showOut();
|
||||
HomePanel.getIns().popInWith(curPanel);
|
||||
onOut();
|
||||
break;
|
||||
case ui.ui_top.btn_dailyGift:
|
||||
PopCenter.POP(new ActiDailyGiftPanel());
|
||||
onOut();
|
||||
break;
|
||||
case ui.ui_top.ui_right.btn_bag:
|
||||
curPanel.showOut();
|
||||
BagPanel.getIns().popInWith(curPanel);
|
||||
onOut();
|
||||
break;
|
||||
case ui.ui_top.ui_right.btn_mail:
|
||||
PopCenter.POP(new MailPanel());
|
||||
break;
|
||||
case ui.ui_top.ui_right.btn_task:
|
||||
curPanel.showOut();
|
||||
TaskPanel.getIns().popInWith(curPanel);
|
||||
onOut();
|
||||
}
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
secondHandler();
|
||||
ui.ui_top.update();
|
||||
}
|
||||
|
||||
public function updateLiuhai() : void
|
||||
{
|
||||
if(liuhaiMode != Game.getIns().setting.liuhaiMode)
|
||||
{
|
||||
liuhaiMode = Game.getIns().setting.liuhaiMode;
|
||||
if(liuhaiMode)
|
||||
{
|
||||
liuhaiUI = FF.getMC("ui.FsMask");
|
||||
liuhaiUI.height = Game.getIns().getLiuHaiAdd();
|
||||
if(StageLocator.MainFixVo.fix[3] < 0)
|
||||
{
|
||||
liuhaiUI.width += StageLocator.MainFixVo.fix[1] * 2;
|
||||
liuhaiUI.x -= StageLocator.MainFixVo.fix[1];
|
||||
}
|
||||
ui.ui_top.addChild(liuhaiUI);
|
||||
StageLocator.setSide(ui.ui_top,"none","top");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(liuhaiUI.parent != null)
|
||||
{
|
||||
liuhaiUI.parent.removeChild(liuhaiUI);
|
||||
}
|
||||
liuhaiUI = null;
|
||||
StageLocator.setSide(ui.ui_top,"none","top");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateNpcList(e:Event = null) : void
|
||||
{
|
||||
PosCenter.getIns().update();
|
||||
}
|
||||
|
||||
public function taskChangeHandler(e:Event = null) : void
|
||||
{
|
||||
updateNpcList();
|
||||
ui.ui_top.updateTask();
|
||||
}
|
||||
|
||||
public function eventChangeHandler(e:Event = null) : void
|
||||
{
|
||||
updateNpcList();
|
||||
}
|
||||
|
||||
public function onIn() : void
|
||||
{
|
||||
update();
|
||||
ActivityDriver.getIns().regist(activity,deactivity);
|
||||
SecondDriver.getInstance().regist(secondHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.TASK_CHANGE,taskChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.RANDOM_EVENT_CHANGE,eventChangeHandler);
|
||||
GlobalBroadcast.addEventListener(MYREvent.MAIL_UPDATE,ui.ui_top.updateMail);
|
||||
ui.ui_top.ui_notice.resume();
|
||||
}
|
||||
|
||||
public function activity() : void
|
||||
{
|
||||
ui.ui_top.ui_notice.resume();
|
||||
}
|
||||
|
||||
public function deactivity() : void
|
||||
{
|
||||
ui.ui_top.ui_notice.pause();
|
||||
}
|
||||
|
||||
public function onOut() : void
|
||||
{
|
||||
GlobalBroadcast.removeEventListener(MYREvent.TASK_CHANGE,updateNpcList);
|
||||
GlobalBroadcast.removeEventListener(MYREvent.MAIL_UPDATE,ui.ui_top.updateMail);
|
||||
ActivityDriver.getIns().remove(activity,deactivity);
|
||||
SecondDriver.getInstance().remove(secondHandler);
|
||||
ui.ui_top.ui_notice.pause();
|
||||
}
|
||||
|
||||
public function secondHandler() : void
|
||||
{
|
||||
MasterCenter.getIns().autoAddTi();
|
||||
if(checkDailyWorkJumpper.jump())
|
||||
{
|
||||
TaskCenter.getIns().autoCheckResetLoopTask();
|
||||
ActiCenter.getIns().autoUpdateDailyGift();
|
||||
RandomEventCenter.getIns().autoCheckFarmEvent();
|
||||
}
|
||||
if(checkMailCd.cooldown)
|
||||
{
|
||||
checkMailCd.activity();
|
||||
MailCenter.getIns().autoGetMailList();
|
||||
}
|
||||
if(checkSafeMode.cooldown)
|
||||
{
|
||||
checkSafeMode.activity();
|
||||
GameCenter.getIns().clickSafeTime(Master.id.toString(),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
|
||||
public class MainMenuBottomUI extends UIComponent
|
||||
{
|
||||
|
||||
public function MainMenuBottomUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Linear;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
|
||||
public class MainMenuNoticeUI extends UIComponent
|
||||
{
|
||||
|
||||
public var mc_mask:Sprite;
|
||||
|
||||
public var text_tip:PiBitTextField;
|
||||
|
||||
public var tips:Array;
|
||||
|
||||
public var flag:int = -1;
|
||||
|
||||
public var starting:Boolean = false;
|
||||
|
||||
public var spaceTime:int = 2;
|
||||
|
||||
public var t:TweenMax;
|
||||
|
||||
public function MainMenuNoticeUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
tips = [];
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
this.visible = false;
|
||||
text_tip.mask = mc_mask;
|
||||
}
|
||||
|
||||
public function resetAllMsg(type:String = "all") : void
|
||||
{
|
||||
var i:int = 0;
|
||||
if(type == "all")
|
||||
{
|
||||
tips = [];
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
while(i < tips.length)
|
||||
{
|
||||
if(tips[i].type == type)
|
||||
{
|
||||
tips.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(msg:String, loop:int = 99999, type:String = "") : void
|
||||
{
|
||||
tips.push({
|
||||
"msg":msg,
|
||||
"loop":loop,
|
||||
"type":type
|
||||
});
|
||||
startShow();
|
||||
}
|
||||
|
||||
public function startShow() : void
|
||||
{
|
||||
if(!starting)
|
||||
{
|
||||
if(tips.length == 0)
|
||||
{
|
||||
this.visible = false;
|
||||
return;
|
||||
}
|
||||
if(flag >= tips.length || flag < 0)
|
||||
{
|
||||
flag = 0;
|
||||
}
|
||||
this.visible = true;
|
||||
text_tip.htmlText = tips[flag].msg;
|
||||
tips[flag].loop--;
|
||||
if(tips[flag].loop <= 0)
|
||||
{
|
||||
tips.splice(flag,1);
|
||||
}
|
||||
starting = true;
|
||||
t = TweenMax.fromTo(text_tip,8,{"x":mc_mask.x + mc_mask.width},{
|
||||
"x":mc_mask.x - text_tip.width,
|
||||
"ease":Linear.easeIn,
|
||||
"onComplete":oneMsgShowOver
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function oneMsgShowOver() : void
|
||||
{
|
||||
starting = false;
|
||||
flag++;
|
||||
t = TweenMax.delayedCall(spaceTime,startShow);
|
||||
}
|
||||
|
||||
public function pause() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public function resume() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.text.TextField;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MainMenuTipUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_bg:PiLightButton;
|
||||
|
||||
public var text_text:TextField;
|
||||
|
||||
public function MainMenuTipUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
text_text.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiLoopMC;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MainMenuTopRightUI extends UIComponent
|
||||
{
|
||||
|
||||
public var btn_mail:PiLightButton;
|
||||
|
||||
public var btn_bag:PiLightButton;
|
||||
|
||||
public var btn_task:PiLightButton;
|
||||
|
||||
public var mc_tipMail:Sprite;
|
||||
|
||||
public var mc_tipTask:PiLoopMC;
|
||||
|
||||
public function MainMenuTopRightUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
mc_tipMail.mouseChildren = mc_tipMail.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import com.greensock.TimelineMax;
|
||||
import com.greensock.TweenMax;
|
||||
import com.greensock.easing.Elastic;
|
||||
import com.greensock.easing.Quint;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.center.AchiCenter;
|
||||
import net.pixvi.myr.center.ActiCenter;
|
||||
import net.pixvi.myr.center.Game;
|
||||
import net.pixvi.myr.center.MailCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.MasterCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.achi.AchiType;
|
||||
import net.pixvi.myr.panel.avatar.AvatarVo;
|
||||
import net.pixvi.myr.panel.stagesp.MYREventButton;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.containers.PiImgContainer;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.ui.controls.PiLoopMC;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class MainMenuTopUI extends UIComponent
|
||||
{
|
||||
|
||||
public var text_name:PiBitTextField;
|
||||
|
||||
public var text_name2:PiBitTextField;
|
||||
|
||||
public var btn_mainMenu:MYREventButton;
|
||||
|
||||
public var btn_mainMenu2:MYREventButton;
|
||||
|
||||
public var text_ti:TextField;
|
||||
|
||||
public var btn_pay:PiLightButton;
|
||||
|
||||
public var text_money:TextField;
|
||||
|
||||
public var text_ke:TextField;
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var text_exp:PiBitTextField;
|
||||
|
||||
public var btn_huodong:PiLightButton;
|
||||
|
||||
public var mc_huodong:PiLoopMC;
|
||||
|
||||
public var mc_huodong2:PiLoopMC;
|
||||
|
||||
public var firstOpen:Boolean = true;
|
||||
|
||||
public var btn_dailyGift:PiLightButton;
|
||||
|
||||
public var mc_frontMask:Sprite;
|
||||
|
||||
public var ui_right:MainMenuTopRightUI;
|
||||
|
||||
public var mc_barExp:Sprite;
|
||||
|
||||
public var container_avatar:PiImgContainer;
|
||||
|
||||
public var mc_avatarMask:Sprite;
|
||||
|
||||
public var mc_tipAchi:PiLoopMC;
|
||||
|
||||
public var ui_notice:MainMenuNoticeUI;
|
||||
|
||||
private var firstUpdate:Boolean = true;
|
||||
|
||||
public var ges:Gesturer;
|
||||
|
||||
private var cacheRightHeight:Number;
|
||||
|
||||
private var rightT:TweenMax;
|
||||
|
||||
private var moneyT:TweenMax;
|
||||
|
||||
public function MainMenuTopUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
var tf:TextFormat = null;
|
||||
text_name.scaleMode = true;
|
||||
mc_frontMask.mouseChildren = mc_frontMask.mouseEnabled = false;
|
||||
ui_right.visible = false;
|
||||
StageLocator.setSide(ui_right,"right","none");
|
||||
StageLocator.setSide(btn_dailyGift,"right","none",-1);
|
||||
PiLightButton.btnTouchLight.setDisplay(container_avatar);
|
||||
ges = new Gesturer(ui_right,true);
|
||||
ges.addEventListener(Gesturer.DRAG,dragRightHandler);
|
||||
ges.start();
|
||||
container_avatar.mask = mc_avatarMask;
|
||||
container_avatar.setSize(109,109);
|
||||
if(Master.money >= 1000000)
|
||||
{
|
||||
tf = text_money.defaultTextFormat;
|
||||
tf.size = 18;
|
||||
text_money.defaultTextFormat = tf;
|
||||
}
|
||||
}
|
||||
|
||||
public function dragRightHandler(e:Event) : void
|
||||
{
|
||||
ui_right.scaleY = 1;
|
||||
if(rightT != null)
|
||||
{
|
||||
rightT.kill();
|
||||
}
|
||||
cacheRightHeight = ui_right.height;
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_MOVE,rightMoveHandler);
|
||||
StageDriver.stage.addEventListener(MobiEvent.MOUSE_UP,rightMoveUpHandler);
|
||||
}
|
||||
|
||||
public function rightMoveHandler(e:Event = null) : void
|
||||
{
|
||||
var uy:Number = NaN;
|
||||
if(this.mouseY - ui_right.y < cacheRightHeight)
|
||||
{
|
||||
uy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
uy = 1 + (this.mouseY - ui_right.y - cacheRightHeight) / 1600;
|
||||
}
|
||||
if(uy < 1)
|
||||
{
|
||||
uy = 1;
|
||||
}
|
||||
if(uy > 1.5)
|
||||
{
|
||||
uy = 1.5;
|
||||
}
|
||||
ui_right.scaleY = uy;
|
||||
}
|
||||
|
||||
public function rightMoveUpHandler(e:Event = null) : void
|
||||
{
|
||||
Master.history.pullMenu++;
|
||||
AchiCenter.getIns().autoCheck(AchiType.PULL_MENU);
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_MOVE,rightMoveHandler);
|
||||
StageDriver.stage.removeEventListener(MobiEvent.MOUSE_UP,rightMoveUpHandler);
|
||||
rightT = TweenMax.to(ui_right,0.8,{
|
||||
"scaleY":1,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var activityDays:Array = null;
|
||||
var date:Date = null;
|
||||
text_name.text = Game.getIns().master.name.toString();
|
||||
if(text_money.text != Game.getIns().master.money.toString())
|
||||
{
|
||||
if(moneyT != null)
|
||||
{
|
||||
moneyT.kill();
|
||||
}
|
||||
if(firstUpdate)
|
||||
{
|
||||
firstUpdate = false;
|
||||
text_money.text = Master.money.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
moneyT = TweenMax.to(text_money,1.5,{
|
||||
"text":Game.getIns().master.money,
|
||||
"roundProps":["text"]
|
||||
});
|
||||
}
|
||||
}
|
||||
text_ke.text = Master.ke.toString();
|
||||
text_ti.htmlText = Master.ti.toString() + Paster.font("/" + Master.tiMax,"#C6B16F",16);
|
||||
btn_dailyGift.visible = !ActiCenter.getIns().dailyGiftChecked() || MasterCenter.getIns().getVipDay() > 0 && !ActiCenter.getIns().dailyVipGiftChecked();
|
||||
text_level.text = Master.level.toString();
|
||||
text_exp.text = Master.showExp + "/" + Master.showNextExp;
|
||||
mc_barExp.scaleX = Master.showExp / Master.showNextExp;
|
||||
if(mc_barExp.scaleX > 1)
|
||||
{
|
||||
mc_barExp.scaleX = 1;
|
||||
}
|
||||
updateTask();
|
||||
updateMail();
|
||||
if(btn_huodong.visible)
|
||||
{
|
||||
activityDays = (Table.activity_info.newDate as String).split("/");
|
||||
date = MyrCalendar.getShowDate();
|
||||
if(firstOpen && date.fullYearUTC <= activityDays[0] && date.monthUTC + 1 <= activityDays[1] && date.date <= activityDays[2])
|
||||
{
|
||||
mc_huodong.visible = mc_huodong2.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_huodong.visible = mc_huodong2.visible = false;
|
||||
}
|
||||
}
|
||||
mc_tipAchi.visible = AchiCenter.getIns().hasCompleteAchi();
|
||||
}
|
||||
|
||||
public function updateAvatar(e:Event = null) : void
|
||||
{
|
||||
var avatarvo:AvatarVo = new AvatarVo();
|
||||
avatarvo.avatarId = Master.avatar;
|
||||
container_avatar.loadNetBitImg(avatarvo.img,true,true,0);
|
||||
}
|
||||
|
||||
public function updateTask(e:Event = null) : void
|
||||
{
|
||||
if(TaskCenter.getIns().hasTaskFinish())
|
||||
{
|
||||
ui_right.mc_tipTask.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_right.mc_tipTask.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateMail(e:Event = null) : void
|
||||
{
|
||||
ui_right.mc_tipMail.visible = MailCenter.getIns().hasNewMail();
|
||||
}
|
||||
|
||||
public function showBtn(vis:Boolean = true) : void
|
||||
{
|
||||
var activityDays:Array = null;
|
||||
var date:Date = null;
|
||||
btn_huodong.visible = vis;
|
||||
btn_mainMenu.visible = vis;
|
||||
if(btn_mainMenu2 != null)
|
||||
{
|
||||
btn_mainMenu2.visible = vis;
|
||||
}
|
||||
if(vis)
|
||||
{
|
||||
activityDays = (Table.activity_info.newDate as String).split("/");
|
||||
date = MyrCalendar.getShowDate();
|
||||
if(firstOpen && date.fullYearUTC <= activityDays[0] && date.monthUTC + 1 <= activityDays[1] && date.date <= activityDays[2])
|
||||
{
|
||||
mc_huodong.visible = mc_huodong2.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_huodong.visible = mc_huodong2.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_huodong.visible = mc_huodong2.visible = false;
|
||||
}
|
||||
if(GameMath.OpenPay && Table.setting.closePay != true)
|
||||
{
|
||||
btn_pay.visible = vis;
|
||||
}
|
||||
else if(GameMath.ModeTrace)
|
||||
{
|
||||
btn_pay.alpha = 0.5;
|
||||
btn_pay.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_pay.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function startRightShow() : void
|
||||
{
|
||||
ui_right.visible = true;
|
||||
var t:TimelineMax = new TimelineMax();
|
||||
t.fromTo(ui_right,1,{"y":-145},{
|
||||
"y":45,
|
||||
"ease":Quint.easeIn
|
||||
});
|
||||
t.fromTo(ui_right,1,{"scaleY":0.4},{
|
||||
"scaleY":1,
|
||||
"ease":Elastic.easeOut
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
package net.pixvi.myr.panel.mainmenu
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.panel.npc.NPCSliderListItem;
|
||||
import net.pixvi.pfw.display.PiSprite;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiSliderList;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
|
||||
public class MainMenuUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_top:MainMenuTopUI;
|
||||
|
||||
public var ui_bottom:MainMenuBottomUI;
|
||||
|
||||
public var list_npc:PiSliderList;
|
||||
|
||||
public var list_npcContainer:PiSprite;
|
||||
|
||||
public var list_npcScaleContainer:PiSprite;
|
||||
|
||||
public var list_shortModeY:int = 110;
|
||||
|
||||
public var list_stagespModeY:int = 130;
|
||||
|
||||
public var list_originalX:int = 0;
|
||||
|
||||
private var t:TweenMax;
|
||||
|
||||
public function MainMenuUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
skin = FF.getMC("ui.MainUI");
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
StageLocator.setSide(ui_top,"none","top");
|
||||
StageLocator.setSide(ui_bottom,"none","bottom",0);
|
||||
StageLocator.setSide(list_npc,"left","bottom",0,240);
|
||||
list_originalX = -StageLocator.MainFixVo.fix[3];
|
||||
list_npc.x = list_originalX;
|
||||
super.onSkinComplete();
|
||||
list_npc.setList(NPCSliderListItem,3,false,170);
|
||||
list_npc.stickInEnd = true;
|
||||
list_npcContainer = new PiSprite();
|
||||
addChild(list_npcContainer);
|
||||
list_npcScaleContainer = new PiSprite();
|
||||
list_npcScaleContainer.x = list_npc.x;
|
||||
list_npcScaleContainer.y = list_npc.y + list_npc.mc_mask.height;
|
||||
list_npc.y = -list_npc.mc_mask.height;
|
||||
list_npc.x = 0;
|
||||
list_npc.originalX = list_npc.x;
|
||||
list_npc.originalY = list_npc.y;
|
||||
list_npcScaleContainer.addChild(list_npc);
|
||||
list_npcContainer.addChild(list_npcScaleContainer);
|
||||
GlobalBroadcast.addEventListener(MYREvent.ROLE_NUM_CHANGE,numChangeHandler);
|
||||
}
|
||||
|
||||
public function numChangeHandler(e:Event = null) : void
|
||||
{
|
||||
ui_top.update();
|
||||
}
|
||||
|
||||
public function showBtn(show:Boolean) : void
|
||||
{
|
||||
ui_top.showBtn(show);
|
||||
}
|
||||
|
||||
public function farmMode() : void
|
||||
{
|
||||
showBtn(true);
|
||||
list_npcContainer.y = 0;
|
||||
ui_top.showBtn(true);
|
||||
}
|
||||
|
||||
public function panelMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
}
|
||||
|
||||
public function mapMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
}
|
||||
|
||||
public function cityMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = 0;
|
||||
}
|
||||
|
||||
public function shopMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = 0;
|
||||
ui_top.btn_pay.visible = true;
|
||||
}
|
||||
|
||||
public function barMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
}
|
||||
|
||||
public function gameRoomMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
}
|
||||
|
||||
public function marketMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
list_npcContainer.x = list_originalX;
|
||||
}
|
||||
|
||||
public function wildMode() : void
|
||||
{
|
||||
cityMode();
|
||||
list_npcContainer.y = 0;
|
||||
}
|
||||
|
||||
public function mineMode() : void
|
||||
{
|
||||
ui_top.showBtn(false);
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
}
|
||||
|
||||
public function stageMode() : void
|
||||
{
|
||||
wildMode();
|
||||
list_npcContainer.y = 55;
|
||||
}
|
||||
|
||||
public function stageSpMode() : void
|
||||
{
|
||||
wildMode();
|
||||
list_npcContainer.y = 32;
|
||||
}
|
||||
|
||||
public function stackGroundMode() : void
|
||||
{
|
||||
ui_top.showBtn(true);
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
ui_top.btn_mainMenu.visible = false;
|
||||
if(ui_top.btn_mainMenu2 != null)
|
||||
{
|
||||
ui_top.btn_mainMenu2.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function alchemyMode() : void
|
||||
{
|
||||
list_npcContainer.y = list_shortModeY - 80 + StageLocator.MainFixVo.fix[0];
|
||||
if(StageLocator.MainFixVo.fix[3] < 0)
|
||||
{
|
||||
list_npcContainer.x = list_originalX + 146.51;
|
||||
}
|
||||
else
|
||||
{
|
||||
list_npcContainer.x = list_originalX + 161;
|
||||
}
|
||||
}
|
||||
|
||||
public function pveMode() : void
|
||||
{
|
||||
list_npcContainer.y = list_shortModeY;
|
||||
list_npcContainer.x = list_originalX;
|
||||
}
|
||||
|
||||
public function storeGroundMode() : void
|
||||
{
|
||||
ui_top.showBtn(true);
|
||||
list_npcContainer.y = 0;
|
||||
}
|
||||
|
||||
public function npcListReshow() : void
|
||||
{
|
||||
if(t != null)
|
||||
{
|
||||
t.kill();
|
||||
}
|
||||
list_npcScaleContainer.setScale(1);
|
||||
if(list_npc.itemDatas.length > 2)
|
||||
{
|
||||
list_npc.process_value = list_npc.process_max;
|
||||
TweenMax.to(list_npc,1,{"process_value":0});
|
||||
}
|
||||
t = TweenMax.to(list_npcScaleContainer,0.5,{
|
||||
"delay":1.5,
|
||||
"scaleX":0.85,
|
||||
"scaleY":0.85
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user