Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,300 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.StatusEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.utils.Timer;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.driver.TimerDriver;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.mobi.MobiTools;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.event.MYREvent;
|
||||
import net.pixvi.myr.net.NetMaster;
|
||||
import net.pixvi.myr.panel.login.PressStartPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.driver.EnterFrameDriver;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.broadcast.GlobalBroadcast;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.pse.file.FileTools;
|
||||
import net.pixvi.psg.driver.GuideDriver;
|
||||
|
||||
public class GameCenter extends Singleton
|
||||
{
|
||||
|
||||
public static var tf:TextField;
|
||||
|
||||
private var heartbeatTimer:Timer;
|
||||
|
||||
private var gameStart:Boolean = false;
|
||||
|
||||
public var inGameDay:Number;
|
||||
|
||||
public var safeModeAge:int = 0;
|
||||
|
||||
public var endcheck:Boolean = false;
|
||||
|
||||
public var checkNum:int = 0;
|
||||
|
||||
public function GameCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function traceMode(txt:String, err:Boolean = false) : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function getIns() : GameCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(GameCenter) as GameCenter;
|
||||
}
|
||||
|
||||
public function startGame() : void
|
||||
{
|
||||
heartbeatTimer = new Timer(240000);
|
||||
gameStart = true;
|
||||
TimerDriver.getInstance().regist(NetMaster.getIns().heartBeating,heartbeatTimer,true);
|
||||
SecondDriver.getIns().regist(checkDayChange);
|
||||
SecondDriver.getIns().regist(BossCenter.getIns().secondCheck);
|
||||
NetMaster.getIns().heartBeating();
|
||||
GuideDriver.getIns().traceMode = GameMath.ModeTrace;
|
||||
}
|
||||
|
||||
public function userAuth(e:Object) : void
|
||||
{
|
||||
var idcard:String = null;
|
||||
if(e is Event)
|
||||
{
|
||||
if(e is StatusEvent)
|
||||
{
|
||||
idcard = (e as StatusEvent).code;
|
||||
}
|
||||
else
|
||||
{
|
||||
idcard = e.data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
idcard = e.toString();
|
||||
}
|
||||
var year:int = int(idcard.substr(6,4));
|
||||
var month:int = int(idcard.substr(10,2)) - 1;
|
||||
var day:int = int(idcard.substr(12,2));
|
||||
var date:Date = new Date(year,month,day);
|
||||
var birthday:int = MyrCalendar.getDayNumber(date.time);
|
||||
var curday:int = MyrCalendar.getDayNumber(new Date().time);
|
||||
var age:int = (curday - birthday) / 365;
|
||||
if(idcard.length < 16)
|
||||
{
|
||||
age = 100;
|
||||
}
|
||||
safeModeAge = age;
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.yes("实名","实名认证年龄:" + age);
|
||||
}
|
||||
if(age < 18 && MyrCenter.channel == "DYD")
|
||||
{
|
||||
Alert.yes("实名认证完成","请重新进入游戏并登录。",MobiTools.getIns().exit);
|
||||
}
|
||||
}
|
||||
|
||||
public function returnLogin() : void
|
||||
{
|
||||
while(PopCenter.getIns().topPanel != null)
|
||||
{
|
||||
PopCenter.getIns().topPanel.showOut();
|
||||
}
|
||||
GameCenter.getIns().resetGame();
|
||||
PressStartPanel.getIns().reload();
|
||||
PressStartPanel.getIns().popIn();
|
||||
}
|
||||
|
||||
public function clickSafeTime(id:String, add:Boolean = false) : void
|
||||
{
|
||||
var prevClick:Number = NaN;
|
||||
var countTime:int = 0;
|
||||
var prevDay:int = 0;
|
||||
var curDay:int = 0;
|
||||
if(endcheck)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!GameMath.ModeTrace && GameMath.ModeRealName && Table.setting.safeModeAge != null && safeModeAge < Table.setting.safeModeAge && Table.setting.safeModeTime != null && Table.setting.safeModeTime > 0)
|
||||
{
|
||||
prevClick = 0;
|
||||
if(Saver.getAuto(id + "clickTime") != null)
|
||||
{
|
||||
prevClick = Number(Saver.getAuto(id + "clickTime"));
|
||||
}
|
||||
if(MyrCalendar.getShowDate().hours > Table.setting.safeModeTimeClose || MyrCalendar.getShowDate().hours < Table.setting.safeModeTimeOpen)
|
||||
{
|
||||
Alert.yes("防沉迷系统","今日游戏时间已结束,还是休息一下吧!",MobiTools.getIns().exit);
|
||||
return;
|
||||
}
|
||||
countTime = 0;
|
||||
if(Saver.getAuto(id + "countTime") != null)
|
||||
{
|
||||
countTime = Number(Saver.getAuto(id + "countTime"));
|
||||
}
|
||||
prevDay = MyrCalendar.getDayNumber(prevClick * 1000);
|
||||
curDay = MyrCalendar.getDayNumber();
|
||||
if(prevDay != curDay && !AccountCenter.getIns().isVisitor)
|
||||
{
|
||||
Saver.saveAuto(id + "countTime",0);
|
||||
countTime = 0;
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.showMsg("防沉迷调试:跨天清零");
|
||||
}
|
||||
}
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(countTime > Table.setting.safeModeTime)
|
||||
{
|
||||
endcheck = true;
|
||||
Alert.yes("防沉迷系统","今日游戏时间:" + int(Table.setting.safeModeTime / 60) + "分钟,已超过未成年人每日游戏时间,还是休息一下吧!",MobiTools.getIns().exit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(add)
|
||||
{
|
||||
countTime += 20;
|
||||
}
|
||||
Saver.saveAuto(id + "countTime",countTime);
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
Alert.showMsg("防沉累加:60s 今日:" + countTime + "s");
|
||||
}
|
||||
}
|
||||
Saver.saveAuto(id + "clickTime",TimeCenter.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
public function countSafeTime(id:String, add:Boolean = false) : Number
|
||||
{
|
||||
var countTime:int = 0;
|
||||
if(GameMath.ModeRealName && Table.setting.safeModeTime != null && Table.setting.safeModeTime > 0)
|
||||
{
|
||||
clickSafeTime(id,add);
|
||||
countTime = 0;
|
||||
if(Saver.getAuto(id + "countTime") != null)
|
||||
{
|
||||
countTime = Number(Saver.getAuto(id + "countTime"));
|
||||
}
|
||||
return countTime;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function countSafeTimePass(id:String, add:Boolean = false) : Boolean
|
||||
{
|
||||
var todaySafetime:int = 0;
|
||||
var safetime:int = 0;
|
||||
trace("check",GameMath.ModeRealName,Table.setting.safeModeTime,Table.setting.safeModeTime);
|
||||
if(!GameMath.ModeTrace && GameMath.ModeRealName && Table.setting.safeModeAge != null && safeModeAge < Table.setting.safeModeAge && Table.setting.safeModeTime != null && Table.setting.safeModeTime > 0)
|
||||
{
|
||||
todaySafetime = countSafeTime(id,add);
|
||||
safetime = int(Table.setting.safeModeTime);
|
||||
return todaySafetime <= safetime;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function resetGame() : void
|
||||
{
|
||||
MonsterCenter.getIns().reset();
|
||||
TimerDriver.getInstance().remove(NetMaster.getIns().heartBeating,heartbeatTimer,true);
|
||||
SecondDriver.getIns().remove(checkDayChange);
|
||||
SecondDriver.getIns().remove(BossCenter.getIns().secondCheck);
|
||||
}
|
||||
|
||||
public function inFunction() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().resume();
|
||||
SecondDriver.getInstance().resume();
|
||||
TimeCenter.getIns().startTimeSynchro();
|
||||
}
|
||||
|
||||
public function outFunction() : void
|
||||
{
|
||||
EnterFrameDriver.getInstance().pause();
|
||||
SecondDriver.getInstance().pause();
|
||||
}
|
||||
|
||||
public function userChangeInGame(e:Object = null) : void
|
||||
{
|
||||
Alert.yes("提示","账号已切换,请重新进入游戏。",MobiTools.getIns().exit);
|
||||
}
|
||||
|
||||
public function checkDayChange() : void
|
||||
{
|
||||
var day:int = Calendar.getDayNumber();
|
||||
if(inGameDay != day)
|
||||
{
|
||||
inGameDay = day;
|
||||
Master.history.payTypeDayCount = {};
|
||||
BossCenter.getIns().dayPass();
|
||||
GlobalBroadcast.dispatchEvent(new MYREvent(MYREvent.DAY_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
public function roboCheck() : void
|
||||
{
|
||||
if(GameMath.ModeTrace || true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FileTools.silentSaveTextFile(FileTools.applicationStorageDirectory.resolvePath("autosystem.txt"),"1");
|
||||
Alert.yes("警告","疑似脚本账号,账号将被加入监控范围,请回答以下问题。",roboCheck1);
|
||||
}
|
||||
|
||||
public function roboCheck1() : void
|
||||
{
|
||||
switch(Random.integer(1,5) - 1)
|
||||
{
|
||||
case 0:
|
||||
Alert.yesno("调查","是否正在使用挂机脚本?",roboCheckFalse,roboCheckRight,"确定","取消",false);
|
||||
break;
|
||||
case 1:
|
||||
Alert.yesno("调查","是否正常游戏而没有使用挂机脚本?",roboCheckRight,roboCheckFalse,"确定","取消",false);
|
||||
break;
|
||||
case 2:
|
||||
Alert.yesno("调查","是否购买自其他平台出售的初始账号?",roboCheckFalse,roboCheckRight,"确定","取消",false);
|
||||
break;
|
||||
case 3:
|
||||
Alert.yesno("调查",Random.integer(1,45) + "是否大于" + Random.integer(49,100),roboCheckFalse,roboCheckRight,"确定","取消",false);
|
||||
break;
|
||||
case 4:
|
||||
Alert.yesno("调查",Random.integer(1,45) + "是否小于" + Random.integer(49,100),roboCheckRight,roboCheckFalse,"确定","取消",false);
|
||||
}
|
||||
}
|
||||
|
||||
public function roboCheckRight() : void
|
||||
{
|
||||
checkNum++;
|
||||
if(checkNum > 6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
roboCheck1();
|
||||
}
|
||||
|
||||
public function roboCheckFalse() : void
|
||||
{
|
||||
checkNum = 0;
|
||||
roboCheck1();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user