Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package net.pixvi.myr.center
|
||||
{
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.myr.net.NetSystem;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
|
||||
public class TimeCenter
|
||||
{
|
||||
|
||||
private var onStartTimeSynchroComplete:Function;
|
||||
|
||||
public function TimeCenter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIns() : TimeCenter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(TimeCenter);
|
||||
}
|
||||
|
||||
public static function get timestamp() : Number
|
||||
{
|
||||
return ClockDriver.getInstance().timestamp;
|
||||
}
|
||||
|
||||
public function startTimeSynchro(onsynchroComplete:Function = null) : void
|
||||
{
|
||||
onStartTimeSynchroComplete = onsynchroComplete;
|
||||
NetSystem.getIns().synchroTime(startTimeSynchroHandler);
|
||||
}
|
||||
|
||||
private function startTimeSynchroHandler(timeSecond:Number) : void
|
||||
{
|
||||
ClockDriver.getInstance().timestamp = timeSecond;
|
||||
if(onStartTimeSynchroComplete != null)
|
||||
{
|
||||
onStartTimeSynchroComplete();
|
||||
onStartTimeSynchroComplete = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user