104 lines
2.9 KiB
ActionScript
104 lines
2.9 KiB
ActionScript
package net.pixvi.myr.net
|
|
{
|
|
import net.pixvi.myr.element.battle.BattleData;
|
|
import net.pixvi.pfw.utils.core.Singleton;
|
|
|
|
public class NetPve
|
|
{
|
|
|
|
public static const START_PVE:String = "pveService/startPVE";
|
|
|
|
public static const FINISH_PVE:String = "pveService/finishPVE";
|
|
|
|
public static const WEEK_REWARD:String = "pveService/getPVEWeekReward";
|
|
|
|
public static const GET_PVE_INFO:String = "pveService/queryPVEInfo";
|
|
|
|
private var onStartPveComplete:Function;
|
|
|
|
private var onFinishPveComplete:Function;
|
|
|
|
private var onWeekRewardComplete:Function;
|
|
|
|
private var onGetPveInfoComplete:Function;
|
|
|
|
public function NetPve()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public static function getIns() : NetPve
|
|
{
|
|
return Singleton.getInstanceOrCreate(NetPve) as NetPve;
|
|
}
|
|
|
|
public function startPve(pveAreaName:String, onComplete:Function) : void
|
|
{
|
|
onStartPveComplete = onComplete;
|
|
var para:Object = {"pveAreaName":pveAreaName};
|
|
NetCenter.getIns().send("pveService/startPVE",para,startPveHandler);
|
|
}
|
|
|
|
private function startPveHandler(re:Object) : void
|
|
{
|
|
if(onStartPveComplete != null)
|
|
{
|
|
onStartPveComplete(re);
|
|
onStartPveComplete = null;
|
|
}
|
|
}
|
|
|
|
public function finishPve(pveAreaName:String, battleData:BattleData, onComplete:Function) : void
|
|
{
|
|
onFinishPveComplete = onComplete;
|
|
var para:Object = {
|
|
"battleDataReq":battleData,
|
|
"pveAreaName":pveAreaName
|
|
};
|
|
NetCenter.getIns().send("pveService/finishPVE",para,finishPveHandler);
|
|
}
|
|
|
|
private function finishPveHandler(re:Object) : void
|
|
{
|
|
if(onFinishPveComplete != null)
|
|
{
|
|
onFinishPveComplete(re);
|
|
onFinishPveComplete = null;
|
|
}
|
|
}
|
|
|
|
public function weekReward(pveAreaName:String, onComplete:Function) : void
|
|
{
|
|
onWeekRewardComplete = onComplete;
|
|
var para:Object = {"pveAreaName":pveAreaName};
|
|
NetCenter.getIns().send("pveService/getPVEWeekReward",para,weekRewardHandler);
|
|
}
|
|
|
|
private function weekRewardHandler(re:Object) : void
|
|
{
|
|
if(onWeekRewardComplete != null)
|
|
{
|
|
onWeekRewardComplete(re);
|
|
onWeekRewardComplete = null;
|
|
}
|
|
}
|
|
|
|
public function getPveInfo(onComplete:Function) : void
|
|
{
|
|
onGetPveInfoComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("pveService/queryPVEInfo",para,getPveInfoHandler);
|
|
}
|
|
|
|
private function getPveInfoHandler(re:Object) : void
|
|
{
|
|
if(onGetPveInfoComplete != null)
|
|
{
|
|
onGetPveInfoComplete(re.pveInfo);
|
|
onGetPveInfoComplete = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|