67 lines
1.8 KiB
ActionScript
67 lines
1.8 KiB
ActionScript
package net.pixvi.myr.net
|
|
{
|
|
import net.pixvi.pfw.utils.core.Singleton;
|
|
|
|
public class NetTeam
|
|
{
|
|
|
|
private static const SET_MON:String = "monsterService/monsterPlaceBattleTeam";
|
|
|
|
private static const SET_EMPTY:String = "monsterService/monsterWithdrawBattleTeam";
|
|
|
|
private var onMonOnComplete:Function;
|
|
|
|
private var onMonOffComplete:Function;
|
|
|
|
public function NetTeam()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public static function getIns() : NetTeam
|
|
{
|
|
return Singleton.getInstanceOrCreate(NetTeam) as NetTeam;
|
|
}
|
|
|
|
public function monOn(monsterId:Number, battleTeamName:String, position:int, onComplete:Function) : void
|
|
{
|
|
onMonOnComplete = onComplete;
|
|
var para:Object = {
|
|
"monsterId":monsterId,
|
|
"battleTeamName":battleTeamName,
|
|
"position":position
|
|
};
|
|
NetCenter.getIns().send("monsterService/monsterPlaceBattleTeam",para,monOnHandler);
|
|
}
|
|
|
|
private function monOnHandler(re:Object = null) : void
|
|
{
|
|
if(onMonOnComplete != null)
|
|
{
|
|
onMonOnComplete();
|
|
onMonOnComplete = null;
|
|
}
|
|
}
|
|
|
|
public function monOff(battleTeamName:String, position:int, onComplete:Function) : void
|
|
{
|
|
onMonOffComplete = onComplete;
|
|
var para:Object = {
|
|
"battleTeamName":battleTeamName,
|
|
"position":position
|
|
};
|
|
NetCenter.getIns().send("monsterService/monsterWithdrawBattleTeam",para,monOffHandler);
|
|
}
|
|
|
|
private function monOffHandler(re:Object = null) : void
|
|
{
|
|
if(onMonOffComplete != null)
|
|
{
|
|
onMonOffComplete();
|
|
onMonOffComplete = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|