Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
package net.pixvi.myr.panel.roomselect
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.monster.MonCardBigViewUI;
|
||||
import net.pixvi.myr.panel.monster.MonsterViewPanel;
|
||||
import net.pixvi.pfw.event.MobiEvent;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiBitTextField;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class RoomSelectMonUI extends UIComponent
|
||||
{
|
||||
|
||||
public var ui_card:MonCardBigViewUI;
|
||||
|
||||
public var text_level:PiBitTextField;
|
||||
|
||||
public var mc_inteam:MovieClip;
|
||||
|
||||
public var mc_explore:Sprite;
|
||||
|
||||
public var vo:MonsterVo;
|
||||
|
||||
public function RoomSelectMonUI(skin:DisplayObject = null, auto:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
super(skin,auto,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
super.onSkinComplete();
|
||||
PiLightButton.btnTouchLight.setDisplay(this);
|
||||
if(mc_explore != null)
|
||||
{
|
||||
mc_explore.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function onData(value:Object) : void
|
||||
{
|
||||
vo = value as MonsterVo;
|
||||
ui_card.onDataTypeMon(vo);
|
||||
if(vo.process == 1)
|
||||
{
|
||||
mc_inteam.visible = false;
|
||||
text_level.visible = false;
|
||||
this.removeEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
text_level.visible = true;
|
||||
if(vo.inteam > 0)
|
||||
{
|
||||
mc_inteam.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mc_inteam.visible = false;
|
||||
}
|
||||
text_level.htmlText = Paster.font("LV:",null,22) + vo.level;
|
||||
this.addEventListener(MobiEvent.CLICK,clickHandler);
|
||||
}
|
||||
}
|
||||
|
||||
public function clickHandler(e:Event = null) : void
|
||||
{
|
||||
SoundCenter.getIns().play(GameSound.effect_click_mon);
|
||||
MonsterViewPanel.getIns().vo = this.vo;
|
||||
PopCenter.POP(MonsterViewPanel.getIns());
|
||||
}
|
||||
|
||||
override public function dispose() : void
|
||||
{
|
||||
PiLightButton.btnTouchLight.removeDisplay(this);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
package net.pixvi.myr.panel.roomselect
|
||||
{
|
||||
import com.greensock.TweenMax;
|
||||
import flash.events.Event;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.myr.center.GuideCenter;
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.MonsterCenter;
|
||||
import net.pixvi.myr.center.StackCenter;
|
||||
import net.pixvi.myr.element.guide.GMain;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.room.RoomVo;
|
||||
import net.pixvi.myr.panel.room.RoomSliderListItem;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.driver.GuideDriver;
|
||||
import net.pixvi.psg.ui.PSGPopPanel;
|
||||
|
||||
public class RoomSelectPanel extends PSGPopPanel
|
||||
{
|
||||
|
||||
public var ui:RoomSelectPanelUI = new RoomSelectPanelUI();
|
||||
|
||||
public var onComplete:Function;
|
||||
|
||||
public var mode:int = 0;
|
||||
|
||||
public var mons:Array;
|
||||
|
||||
public var save:Boolean = false;
|
||||
|
||||
public var saving:Boolean = false;
|
||||
|
||||
public var moving:int = 0;
|
||||
|
||||
private var cacheRoomAddNum:Object;
|
||||
|
||||
private var cacheRoomMove:Object;
|
||||
|
||||
public function RoomSelectPanel(showTime:Number = -1, hideTime:Number = -1)
|
||||
{
|
||||
addChild(ui);
|
||||
super(showTime,hideTime);
|
||||
ui.btn_close.onClick(closeHandler);
|
||||
ui.list_list.addEventListener("piselect",selectHandler);
|
||||
}
|
||||
|
||||
public static function getIns() : RoomSelectPanel
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(RoomSelectPanel) as RoomSelectPanel;
|
||||
}
|
||||
|
||||
override public function init() : void
|
||||
{
|
||||
ui.btn_close.enabled = true;
|
||||
ui.list_list.setDatas(Master.rooms);
|
||||
saving = false;
|
||||
moving = 0;
|
||||
if(mode == 0)
|
||||
{
|
||||
readyToPush();
|
||||
}
|
||||
ui.list_list.mouseChildren = ui.list_list.mouseEnabled = true;
|
||||
GlobalBroadcast.addEventListener("androidBack",AndroidBackHandler);
|
||||
guide();
|
||||
ImgCenter.addFsMask(this);
|
||||
}
|
||||
|
||||
private function AndroidBackHandler(e:Event = null) : void
|
||||
{
|
||||
if(PopCenter.getIns().topPanel == this)
|
||||
{
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
public function guide() : void
|
||||
{
|
||||
if(GuideCenter.getIns().checkCur(GMain.stackMon85))
|
||||
{
|
||||
GuideDriver.getIns().curGuideComplete();
|
||||
GuideCenter.getIns().fin();
|
||||
GuideDriver.getIns().guideDisplay(ui.list_list.items[0],"",true);
|
||||
}
|
||||
}
|
||||
|
||||
public function closeHandler(e:Event = null) : void
|
||||
{
|
||||
if(moving > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(mode == 0 && save)
|
||||
{
|
||||
startMoveSave();
|
||||
}
|
||||
else
|
||||
{
|
||||
onComplete = null;
|
||||
this.showOut();
|
||||
}
|
||||
}
|
||||
|
||||
override public function showOut() : void
|
||||
{
|
||||
super.showOut();
|
||||
GlobalBroadcast.removeEventListener("androidBack",AndroidBackHandler);
|
||||
}
|
||||
|
||||
private function startMoveSave() : void
|
||||
{
|
||||
var monIds:Array = null;
|
||||
if(saving)
|
||||
{
|
||||
return;
|
||||
}
|
||||
saving = true;
|
||||
ui.btn_close.enabled = false;
|
||||
ui.list_list.mouseChildren = ui.list_list.mouseEnabled = false;
|
||||
var cArr:Array = [];
|
||||
for(var roomId:String in cacheRoomMove)
|
||||
{
|
||||
monIds = cacheRoomMove[roomId];
|
||||
cArr.push({
|
||||
"roomId":roomId,
|
||||
"monsterId":monIds
|
||||
});
|
||||
}
|
||||
var firstMon:MonsterVo = MonsterCenter.getIns().getMonById(cArr[0].monsterId[0]);
|
||||
if(firstMon.process == 3)
|
||||
{
|
||||
MonsterCenter.getIns().moveMonFromRoom(firstMon.id,cArr[0].roomId,startMoveSaveHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
StackCenter.getIns().moveMonsToRoom(cArr,startMoveSaveHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function startMoveSaveHandler() : void
|
||||
{
|
||||
this.showOut();
|
||||
if(onComplete != null)
|
||||
{
|
||||
onComplete();
|
||||
onComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function selectHandler(e:Event = null) : void
|
||||
{
|
||||
var mon:MonsterVo = null;
|
||||
var room:RoomVo = null;
|
||||
var subSpace:int = 0;
|
||||
var img:NetBitImg = null;
|
||||
if(mode == 0)
|
||||
{
|
||||
mon = mons[0];
|
||||
room = ui.list_list.curSelectedItemData as RoomVo;
|
||||
if(mon.roomId == room.id)
|
||||
{
|
||||
Alert.showMsg(lang("魔物已经处在这个牧场啦!"));
|
||||
return;
|
||||
}
|
||||
if(cacheRoomAddNum[room.id] != null)
|
||||
{
|
||||
subSpace = int(cacheRoomAddNum[room.id]);
|
||||
}
|
||||
if(room.curEmptyNum - subSpace > 0)
|
||||
{
|
||||
if(cacheRoomAddNum[room.id] == null)
|
||||
{
|
||||
cacheRoomAddNum[room.id] = 1;
|
||||
cacheRoomMove[room.id] = [mon.id];
|
||||
}
|
||||
else
|
||||
{
|
||||
cacheRoomAddNum[room.id]++;
|
||||
cacheRoomMove[room.id].push(mon.id);
|
||||
}
|
||||
mons.shift();
|
||||
save = true;
|
||||
img = new NetBitImg();
|
||||
img.load(mon.getCurImg());
|
||||
img.x = ui.ui_mon.x;
|
||||
img.y = ui.ui_mon.y;
|
||||
img.scaleX = img.scaleY = 0.8;
|
||||
img.mouseChildren = img.mouseEnabled = false;
|
||||
ui.addChild(img);
|
||||
if(mons.length == 0)
|
||||
{
|
||||
ui.ui_mon.visible = false;
|
||||
moving++;
|
||||
ui.list_list.mouseChildren = ui.list_list.mouseEnabled = false;
|
||||
TweenMax.to(img,0.6,{
|
||||
"alpha":0.5,
|
||||
"x":ui.list_list.x - img.width / 2 + ui.list_list.curSelectedItem.x + 130,
|
||||
"y":100 + ui.list_list.y - img.height / 2 + ui.list_list.curSelectedItem.y + ui.list_list.itemContainer.y,
|
||||
"onComplete":showComplete,
|
||||
"onCompleteParams":[img]
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
moving++;
|
||||
TweenMax.to(img,0.6,{
|
||||
"alpha":0.5,
|
||||
"x":ui.list_list.x - img.width / 2 + ui.list_list.curSelectedItem.x + 130,
|
||||
"y":100 + ui.list_list.y - img.height / 2 + ui.list_list.curSelectedItem.y + ui.list_list.itemContainer.y,
|
||||
"onComplete":imgShowComplete,
|
||||
"onCompleteParams":[img]
|
||||
});
|
||||
readyToPush();
|
||||
}
|
||||
(ui.list_list.curSelectedItem as RoomSliderListItem).setAddRoomNum(cacheRoomAddNum[room.id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.showMsg(lang("目标牧场空间不足。"));
|
||||
}
|
||||
}
|
||||
else if(onComplete != null)
|
||||
{
|
||||
onComplete(room);
|
||||
onComplete = null;
|
||||
this.showOut();
|
||||
}
|
||||
}
|
||||
|
||||
public function showComplete(img:NetBitImg) : void
|
||||
{
|
||||
img.dispose();
|
||||
readyToPush();
|
||||
moving--;
|
||||
}
|
||||
|
||||
public function imgShowComplete(img:NetBitImg) : void
|
||||
{
|
||||
img.dispose();
|
||||
moving--;
|
||||
}
|
||||
|
||||
public function modePushMon(mons:Array, oncomplete:Function = null) : void
|
||||
{
|
||||
this.mons = mons;
|
||||
mode = 0;
|
||||
ui.ui_mon.visible = true;
|
||||
cacheRoomAddNum = {};
|
||||
cacheRoomMove = {};
|
||||
this.onComplete = oncomplete;
|
||||
save = false;
|
||||
}
|
||||
|
||||
public function readyToPush() : void
|
||||
{
|
||||
if(mons.length > 0)
|
||||
{
|
||||
ui.ui_mon.onData(mons[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
save = true;
|
||||
startMoveSave();
|
||||
}
|
||||
}
|
||||
|
||||
public function modeSelectRoom(onComplete:Function) : void
|
||||
{
|
||||
mode = 1;
|
||||
ui.ui_mon.visible = false;
|
||||
this.onComplete = onComplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.pixvi.myr.panel.roomselect
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import net.pixvi.common.view.FF;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.panel.room.RoomListItem;
|
||||
import net.pixvi.myr.panel.room.RoomSliderListItem;
|
||||
import net.pixvi.pfw.ui.UIComponent;
|
||||
import net.pixvi.pfw.ui.controls.PiSliderList;
|
||||
import net.pixvi.psg.ui.controller.PiLightButton;
|
||||
|
||||
public class RoomSelectPanelUI extends UIComponent
|
||||
{
|
||||
|
||||
public var list_list:PiSliderList;
|
||||
|
||||
public var ui_mon:RoomSelectMonUI;
|
||||
|
||||
public var btn_close:PiLightButton;
|
||||
|
||||
public function RoomSelectPanelUI(skin:DisplayObject = null, autoViewSize:Boolean = true, w:Number = 50, h:Number = 50)
|
||||
{
|
||||
if(skin == null)
|
||||
{
|
||||
skin = FF.getMC("ui.RoomSelectPanelUI");
|
||||
}
|
||||
super(skin,autoViewSize,w,h);
|
||||
}
|
||||
|
||||
override public function onSkinComplete() : void
|
||||
{
|
||||
list_list.setList(RoomSliderListItem,6,false,235,2,284);
|
||||
ui_mon.mouseChildren = ui_mon.mouseEnabled = false;
|
||||
btn_close.sound_click = GameSound.effect_click_close1;
|
||||
list_list.itemClass = RoomListItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user