160 lines
5.0 KiB
ActionScript
160 lines
5.0 KiB
ActionScript
package net.pixvi.myr.net
|
|
{
|
|
import net.pixvi.pfw.utils.core.Singleton;
|
|
|
|
public class NetActi
|
|
{
|
|
|
|
public static const DAILYGIFT_CHECK:String = "dailyGiftService/dailyGiftSign";
|
|
|
|
public static const DAILYGIFT_UPDATE:String = "dailyGiftService/dailyGiftUpdate";
|
|
|
|
public static const DAILYCHECK_CHECK:String = "dailyCheckService/dailyCheck";
|
|
|
|
public static const VIP_DAILYGIFT_CHECK:String = "vipService/getReward";
|
|
|
|
public static const WEEK_TASK_FINISH:String = "weekActivityService/getWeekActivityReward";
|
|
|
|
public static const WEEK_TASK_INFO:String = "weekActivityService/queryWeekActivityInfo";
|
|
|
|
public static const LOOP_CHECK_REWARD:String = "dailyGiftService/dailyLoopReward";
|
|
|
|
private var onWeekTaskFinishComplete:Function;
|
|
|
|
private var onLoopCheckRewardComplete:Function;
|
|
|
|
private var onWeekTaskInfoComplete:Function;
|
|
|
|
private var onDailyGiftCheckComplete:Function;
|
|
|
|
private var onUpdateDailyGiftComplete:Function;
|
|
|
|
private var onVipDailyGiftCheckComplete:Function;
|
|
|
|
private var onDailyCheckCheckComplete:Function;
|
|
|
|
public function NetActi()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public static function getIns() : NetActi
|
|
{
|
|
return Singleton.getInstanceOrCreate(NetActi) as NetActi;
|
|
}
|
|
|
|
public function weekTaskFinish(onComplete:Function) : void
|
|
{
|
|
onWeekTaskFinishComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("weekActivityService/getWeekActivityReward",para,weekTaskFinishHandler);
|
|
}
|
|
|
|
private function weekTaskFinishHandler(re:Object) : void
|
|
{
|
|
if(onWeekTaskFinishComplete != null)
|
|
{
|
|
onWeekTaskFinishComplete(re);
|
|
onWeekTaskFinishComplete = null;
|
|
}
|
|
}
|
|
|
|
public function LoopCheckReward(onComplete:Function) : void
|
|
{
|
|
onLoopCheckRewardComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("dailyGiftService/dailyLoopReward",para,LoopCheckRewardHandler);
|
|
}
|
|
|
|
private function LoopCheckRewardHandler(re:Object) : void
|
|
{
|
|
if(onLoopCheckRewardComplete != null)
|
|
{
|
|
onLoopCheckRewardComplete(re);
|
|
onLoopCheckRewardComplete = null;
|
|
}
|
|
}
|
|
|
|
public function weekTaskInfo(onComplete:Function) : void
|
|
{
|
|
onWeekTaskInfoComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("weekActivityService/queryWeekActivityInfo",para,weekTaskInfoHandler);
|
|
}
|
|
|
|
private function weekTaskInfoHandler(re:Object) : void
|
|
{
|
|
if(onWeekTaskInfoComplete != null)
|
|
{
|
|
onWeekTaskInfoComplete(re);
|
|
onWeekTaskInfoComplete = null;
|
|
}
|
|
}
|
|
|
|
public function dailyGiftCheck(onComplete:Function) : void
|
|
{
|
|
onDailyGiftCheckComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("dailyGiftService/dailyGiftSign",para,dailyGiftCheckHandler);
|
|
}
|
|
|
|
private function dailyGiftCheckHandler(re:Object) : void
|
|
{
|
|
if(onDailyGiftCheckComplete != null)
|
|
{
|
|
onDailyGiftCheckComplete(re.reward,re.dailyGift.dailyGiftCount,re.dailyGift.dailyGiftLevel);
|
|
onDailyGiftCheckComplete = null;
|
|
}
|
|
}
|
|
|
|
public function updateDailyGift(onComplete:Function) : void
|
|
{
|
|
onUpdateDailyGiftComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("dailyGiftService/dailyGiftUpdate",para,dailyGiftCheckHandler);
|
|
}
|
|
|
|
private function startUpdateDailyGiftHandler(re:Object) : void
|
|
{
|
|
if(onUpdateDailyGiftComplete != null)
|
|
{
|
|
onUpdateDailyGiftComplete(re.dailyGift.dailyGiftLevel,re.dailyGift.dailyGiftCount);
|
|
onUpdateDailyGiftComplete = null;
|
|
}
|
|
}
|
|
|
|
public function vipDailyGiftCheck(onComplete:Function) : void
|
|
{
|
|
onVipDailyGiftCheckComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("vipService/getReward",para,vipDailyGiftCheckHandler);
|
|
}
|
|
|
|
private function vipDailyGiftCheckHandler(re:Object) : void
|
|
{
|
|
if(onVipDailyGiftCheckComplete != null)
|
|
{
|
|
onVipDailyGiftCheckComplete(re.reward);
|
|
onVipDailyGiftCheckComplete = null;
|
|
}
|
|
}
|
|
|
|
public function dailyCheckCheck(onComplete:Function) : void
|
|
{
|
|
onDailyCheckCheckComplete = onComplete;
|
|
var para:Object = {};
|
|
NetCenter.getIns().send("dailyCheckService/dailyCheck",para,dailyCheckCheckHandler);
|
|
}
|
|
|
|
private function dailyCheckCheckHandler(re:Object) : void
|
|
{
|
|
if(Boolean(onDailyCheckCheckComplete))
|
|
{
|
|
onDailyCheckCheckComplete(re.reward);
|
|
onDailyCheckCheckComplete = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|