Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package net.pixvi.myr.net
|
||||
{
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class NetPotential
|
||||
{
|
||||
|
||||
public static const ADD_POTENTIAL:String = "monsterService/monsterPotentialUpgrade";
|
||||
|
||||
public static const POTENTIAL_LEVELUP:String = "monsterService/monsterPotentialLevelUpgrade";
|
||||
|
||||
private var onAddPotentialComplete:Function;
|
||||
|
||||
private var onPotentialLevelUpComplete:Function;
|
||||
|
||||
public function NetPotential()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : NetPotential
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(NetPotential) as NetPotential;
|
||||
}
|
||||
|
||||
public function addPotential(mid:Number, itemId:Number, ability:String = "atk", onComplete:Function = null, traceInfo:Object = null) : void
|
||||
{
|
||||
onAddPotentialComplete = onComplete;
|
||||
var para:Object = {
|
||||
"traceInfo":traceInfo,
|
||||
"monId":mid,
|
||||
"itemId":itemId,
|
||||
"monsterAttr":ability
|
||||
};
|
||||
NetCenter.getIns().send("monsterService/monsterPotentialUpgrade",para,addPotentialHandler);
|
||||
}
|
||||
|
||||
private function addPotentialHandler(re:Object) : void
|
||||
{
|
||||
if(onAddPotentialComplete != null)
|
||||
{
|
||||
onAddPotentialComplete(re.pAtk,re.pDef,re.pHp,re.pDex);
|
||||
onAddPotentialComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function potentialLevelUp(mid:Number, itemIds:Array, onComplete:Function) : void
|
||||
{
|
||||
onPotentialLevelUpComplete = onComplete;
|
||||
var para:Object = {
|
||||
"monId":mid,
|
||||
"itemIds":itemIds
|
||||
};
|
||||
NetCenter.getIns().send("monsterService/monsterPotentialLevelUpgrade",para,potentialLevelUpHandler);
|
||||
}
|
||||
|
||||
private function potentialLevelUpHandler(re:Object) : void
|
||||
{
|
||||
if(onPotentialLevelUpComplete != null)
|
||||
{
|
||||
onPotentialLevelUpComplete(re.potentailLevel);
|
||||
onPotentialLevelUpComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user