Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package net.pixvi.myr.net
|
||||
{
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class NetMail
|
||||
{
|
||||
|
||||
private static var CHECK_NEW:String = "mailService/mailQuery";
|
||||
|
||||
private static var DELETE_MAIL:String = "mailService/mailBatchDel";
|
||||
|
||||
private static var GET_REWARD:String = "mailService/mailGetReward";
|
||||
|
||||
private static var READ_MAIL:String = "mailService/mailRead";
|
||||
|
||||
private var onReadMailComplete:Function;
|
||||
|
||||
private var onCheckNewComplelte:Function;
|
||||
|
||||
private var onDeleteMailCompelte:Function;
|
||||
|
||||
private var onGetRewardComplete:Function;
|
||||
|
||||
public function NetMail()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : NetMail
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(NetMail) as NetMail;
|
||||
}
|
||||
|
||||
public function readMail(ids:Array, onComplete:Function = null) : void
|
||||
{
|
||||
onReadMailComplete = onComplete;
|
||||
var para:Object = {"mailIds":ids};
|
||||
NetCenter.getIns().send(READ_MAIL,para,readMailHandler);
|
||||
}
|
||||
|
||||
private function readMailHandler(re:Object) : void
|
||||
{
|
||||
if(onReadMailComplete != null)
|
||||
{
|
||||
onReadMailComplete();
|
||||
onReadMailComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkNew(onComplete:Function) : void
|
||||
{
|
||||
onCheckNewComplelte = onComplete;
|
||||
NetCenter.getIns().send(CHECK_NEW,{},checkNewHandler,false);
|
||||
}
|
||||
|
||||
private function checkNewHandler(re:Object) : void
|
||||
{
|
||||
if(onCheckNewComplelte != null)
|
||||
{
|
||||
onCheckNewComplelte(re.datas);
|
||||
onCheckNewComplelte = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteMail(mailIds:Array, onComplete:Function) : void
|
||||
{
|
||||
onCheckNewComplelte = onComplete;
|
||||
var para:Object = {"mailIds":mailIds};
|
||||
NetCenter.getIns().send(DELETE_MAIL,para,checkNewHandler,false);
|
||||
onDeleteMailCompelte = onComplete;
|
||||
}
|
||||
|
||||
private function deleteMailHandler(re:Object) : void
|
||||
{
|
||||
if(onDeleteMailCompelte != null)
|
||||
{
|
||||
onDeleteMailCompelte();
|
||||
onDeleteMailCompelte = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getReward(mailId:int, onComplete:Function) : void
|
||||
{
|
||||
onGetRewardComplete = onComplete;
|
||||
var para:Object = {"mailId":mailId};
|
||||
NetCenter.getIns().send(GET_REWARD,para,getRewardHandler,false);
|
||||
}
|
||||
|
||||
private function getRewardHandler(re:Object) : void
|
||||
{
|
||||
if(onGetRewardComplete != null)
|
||||
{
|
||||
onGetRewardComplete(re);
|
||||
onGetRewardComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user