Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,261 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.myr.element.gacha.GachaVo;
|
||||
import net.pixvi.myr.element.reward.RewardResultVo;
|
||||
import net.pixvi.myr.net.NetActi;
|
||||
import net.pixvi.myr.panel.dailycheck.DailyCheckPanel;
|
||||
import net.pixvi.myr.panel.event.EventClickImgPanel;
|
||||
import net.pixvi.myr.panel.event.EventImgPanel;
|
||||
import net.pixvi.myr.panel.event.dailygift.ActiDailyGiftPanel;
|
||||
import net.pixvi.myr.panel.gacha.GachaPanel;
|
||||
import net.pixvi.myr.panel.mainmenu.MainMenu;
|
||||
import net.pixvi.myr.panel.moncol.MonColPanel;
|
||||
import net.pixvi.myr.panel.paypoint.PayPointPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class ActiCenter extends Singleton
|
||||
{
|
||||
|
||||
private var cacheDailyGet:Object;
|
||||
|
||||
private var onLoopCheckRewardComplete:Function;
|
||||
|
||||
private var onWeekTaskFinishComplete:Function;
|
||||
|
||||
private var onWeekTaskInfoComplete:Function;
|
||||
|
||||
private var onDailyGiftCheckComplete:Function;
|
||||
|
||||
private var updatingDailyGift:Boolean = false;
|
||||
|
||||
private var onVipDailyGiftCheckComplete:Function;
|
||||
|
||||
private var onDailyCheckCheckComplete:Function;
|
||||
|
||||
public function ActiCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : ActiCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(ActiCenter) as ActiCenter;
|
||||
}
|
||||
|
||||
public function startEvent(data:Object = null) : void
|
||||
{
|
||||
var gachavo:GachaVo = null;
|
||||
var action:String = data.action;
|
||||
switch(action)
|
||||
{
|
||||
case "dailyGift":
|
||||
PopCenter.POP(new ActiDailyGiftPanel());
|
||||
break;
|
||||
case "payPoint":
|
||||
PopCenter.POP(new PayPointPanel());
|
||||
break;
|
||||
case "monCol":
|
||||
PopCenter.POP(new MonColPanel());
|
||||
break;
|
||||
case "contentImg":
|
||||
PopCenter.POP(new EventImgPanel(data));
|
||||
break;
|
||||
case "contentBigImg":
|
||||
PopCenter.POP(new EventClickImgPanel(data.data.contentImg));
|
||||
break;
|
||||
case "dailyCheck":
|
||||
PopCenter.POP(new DailyCheckPanel());
|
||||
break;
|
||||
case "gacha":
|
||||
gachavo = new GachaVo();
|
||||
GachaPanel.popInGacha(data.data.gachaId);
|
||||
}
|
||||
}
|
||||
|
||||
public function LoopCheckReward(onComplete:Function) : void
|
||||
{
|
||||
onLoopCheckRewardComplete = onComplete;
|
||||
NetActi.getIns().LoopCheckReward(LoopCheckRewardHandler);
|
||||
}
|
||||
|
||||
private function LoopCheckRewardHandler(re:Object) : void
|
||||
{
|
||||
Master.activityHistory.loopCheckRewardTime = re.param.dailyRewardGetTime / 1000;
|
||||
RewardCenter.getIns().getRewardByData(re.reward,true,"panel");
|
||||
if(onLoopCheckRewardComplete != null)
|
||||
{
|
||||
onLoopCheckRewardComplete(re);
|
||||
onLoopCheckRewardComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function weekTaskFinish(onComplete:Function) : void
|
||||
{
|
||||
onWeekTaskFinishComplete = onComplete;
|
||||
NetActi.getIns().weekTaskFinish(weekTaskFinishHandler);
|
||||
}
|
||||
|
||||
private function weekTaskFinishHandler(re:Object) : void
|
||||
{
|
||||
RewardCenter.getIns().getRewardByData(re.reward,true,"panel");
|
||||
Master.activityHistory.weekTaskStatus["getReward"] = true;
|
||||
if(onWeekTaskFinishComplete != null)
|
||||
{
|
||||
onWeekTaskFinishComplete(re);
|
||||
onWeekTaskFinishComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function weekTaskInfo(onComplete:Function) : void
|
||||
{
|
||||
onWeekTaskInfoComplete = onComplete;
|
||||
NetActi.getIns().weekTaskInfo(weekTaskInfoHandler);
|
||||
}
|
||||
|
||||
private function weekTaskInfoHandler(re:Object) : void
|
||||
{
|
||||
Master.activityHistory.weekTaskStatus = re.data;
|
||||
if(onWeekTaskInfoComplete != null)
|
||||
{
|
||||
onWeekTaskInfoComplete(re);
|
||||
onWeekTaskInfoComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function checkFinish(activityType:String) : Boolean
|
||||
{
|
||||
var checkDay:int = 0;
|
||||
var today:int = 0;
|
||||
var _loc4_:String = activityType;
|
||||
if("dailyCheck" !== _loc4_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
checkDay = Calendar.getDayNumber(Master.activityHistory.dailyCheckTime);
|
||||
today = Calendar.getDayNumber();
|
||||
if(Master.activityHistory.dailyCheckCount < 7 && checkDay != today)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function autoPopActivity() : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var eventdata:Object = null;
|
||||
if(GuideCenter.getIns().checkFreshGuideFinish())
|
||||
{
|
||||
for(i = 0; i < Table.activity_info.events.length; )
|
||||
{
|
||||
eventdata = Table.activity_info.events[i];
|
||||
if(eventdata.autoPop == true && (eventdata.autoPopTimestamp == null || eventdata.autoPopTimestamp > TimeCenter.timestamp) && !checkFinish(eventdata.type))
|
||||
{
|
||||
startEvent(eventdata);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function dailyGiftChecked() : Boolean
|
||||
{
|
||||
var today:Date = MyrCalendar.getShowDate(ClockDriver.timestamp * 1000);
|
||||
var checkDay:Date = MyrCalendar.getShowDate(Master.activityHistory.dailyGiftCheckTime * 1000);
|
||||
if(today.fullYear == checkDay.fullYear && today.month == checkDay.month && today.date == checkDay.date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function dailyVipGiftChecked() : Boolean
|
||||
{
|
||||
return MasterCenter.getIns().getVipChecked();
|
||||
}
|
||||
|
||||
public function dailyGiftCheck(onComplete:Function = null) : void
|
||||
{
|
||||
onDailyGiftCheckComplete = onComplete;
|
||||
NetActi.getIns().dailyGiftCheck(dailyGiftCheckHandler);
|
||||
}
|
||||
|
||||
private function dailyGiftCheckHandler(rewardData:Object, newCount:int, newLevel:int) : void
|
||||
{
|
||||
Master.activityHistory.dailyGiftCheckTime = TimeCenter.timestamp;
|
||||
Master.activityHistory.dailyGiftCount = newCount;
|
||||
Master.activityHistory.dailyGiftLevel = newLevel;
|
||||
Master.activityHistory.dailyGiftSignCount++;
|
||||
MainMenu.getIns().ui.ui_top.update();
|
||||
RewardCenter.getIns().getRewardByData(rewardData,true,"panel");
|
||||
if(onDailyGiftCheckComplete != null)
|
||||
{
|
||||
onDailyGiftCheckComplete();
|
||||
onDailyGiftCheckComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function autoUpdateDailyGift() : void
|
||||
{
|
||||
if(updatingDailyGift)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private function startUpdateDailyGift() : void
|
||||
{
|
||||
updatingDailyGift = true;
|
||||
NetActi.getIns().updateDailyGift(startUpdateDailyGiftHandler);
|
||||
}
|
||||
|
||||
private function startUpdateDailyGiftHandler(newLevel:int, newCount:int) : void
|
||||
{
|
||||
Master.activityHistory.dailyGiftCount = newCount;
|
||||
Master.activityHistory.dailyGiftLevel = newLevel;
|
||||
updatingDailyGift = false;
|
||||
}
|
||||
|
||||
public function vipDailyGiftCheck(onComplete:Function) : void
|
||||
{
|
||||
onVipDailyGiftCheckComplete = onComplete;
|
||||
NetActi.getIns().vipDailyGiftCheck(vipDailyGiftCheckHandler);
|
||||
}
|
||||
|
||||
private function vipDailyGiftCheckHandler(rewardData:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
RewardCenter.getIns().getReward(reward,true,"panel",null,false);
|
||||
Master.activityHistory.vipCheckTime = TimeCenter.timestamp * 1000;
|
||||
if(onVipDailyGiftCheckComplete != null)
|
||||
{
|
||||
onVipDailyGiftCheckComplete(reward);
|
||||
onVipDailyGiftCheckComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function dailyCheckCheck(onComplete:Function) : void
|
||||
{
|
||||
onDailyCheckCheckComplete = onComplete;
|
||||
NetActi.getIns().dailyCheckCheck(dailyCheckCheckHandler);
|
||||
}
|
||||
|
||||
private function dailyCheckCheckHandler(rewardData:Object) : void
|
||||
{
|
||||
var reward:RewardResultVo = RewardCenter.getRewardResultVoByData(rewardData);
|
||||
RewardCenter.getIns().getReward(reward,true,"panel",null,false);
|
||||
Master.activityHistory.dailyCheckTime = TimeCenter.timestamp * 1000;
|
||||
Master.activityHistory.dailyCheckCount++;
|
||||
if(onDailyCheckCheckComplete != null)
|
||||
{
|
||||
onDailyCheckCheckComplete();
|
||||
onDailyCheckCheckComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user