66 lines
1.7 KiB
ActionScript
66 lines
1.7 KiB
ActionScript
package net.pixvi.myr.net
|
|
{
|
|
import net.pixvi.pfw.utils.core.Singleton;
|
|
|
|
public class NetEquip
|
|
{
|
|
|
|
private static const EQUIP_ON:String = "itemService/itemEquipUsed";
|
|
|
|
private static const EQUIP_OFF:String = "itemService/itemEquipUnfix";
|
|
|
|
private var onEquipOnComplete:Function;
|
|
|
|
private var onEquipOffComplete:Function;
|
|
|
|
public function NetEquip()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public static function getIns() : NetEquip
|
|
{
|
|
return Singleton.getInstanceOrCreate(NetEquip) as NetEquip;
|
|
}
|
|
|
|
public function equipOn(monsterId:Number, itemId:Number, onComplete:Function) : void
|
|
{
|
|
onEquipOnComplete = onComplete;
|
|
var para:Object = {
|
|
"monsterId":monsterId,
|
|
"itemId":itemId
|
|
};
|
|
NetCenter.getIns().send("itemService/itemEquipUsed",para,equipOnHandler);
|
|
}
|
|
|
|
private function equipOnHandler(re:Object) : void
|
|
{
|
|
if(onEquipOnComplete != null)
|
|
{
|
|
onEquipOnComplete(re.monAdd);
|
|
onEquipOnComplete = null;
|
|
}
|
|
}
|
|
|
|
public function equipOff(monsterId:Number, part:int, onComplete:Function) : void
|
|
{
|
|
onEquipOffComplete = onComplete;
|
|
var para:Object = {
|
|
"monsterId":monsterId,
|
|
"part":part
|
|
};
|
|
NetCenter.getIns().send("itemService/itemEquipUnfix",para,equipOffHandler);
|
|
}
|
|
|
|
private function equipOffHandler(re:Object) : void
|
|
{
|
|
if(onEquipOffComplete != null)
|
|
{
|
|
onEquipOffComplete(re.monAdd);
|
|
onEquipOffComplete = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|