/// <summary> /// The game service start. /// </summary> /// <param name="setting">Environment setting.</param> public static void Start(ZoneSetting setting) { CacheSetting cacheSetting = new CacheSetting(); cacheSetting.ChangedHandle += EntitySyncManger.OnChange; Start(setting, cacheSetting); }
/// <summary> /// The game service start. /// </summary> /// <param name="setting">Environment setting.</param> /// <param name="cacheSetting">Cache setting.</param> public static void Start(ZoneSetting setting, CacheSetting cacheSetting) { if (IsRunning) { return; } TraceLog.WriteLine("{0} Server is starting...", DateTime.Now.ToString("HH:mm:ss")); _setting = setting; //if (!RedisConnectionPool.Ping("127.0.0.1")) //{ // string error = string.Format("Error: NIC is not connected or no network."); // TraceLog.WriteLine(error); // TraceLog.WriteError(error); // return; //} RedisConnectionPool.Initialize(_setting.Serializer); if (!RedisConnectionPool.CheckConnect()) { string error = string.Format("Error: the redis server is not started."); TraceLog.WriteLine(error); TraceLog.WriteError(error); return; } TraceLog.WriteLine("{0} Redis server connect successfully.", DateTime.Now.ToString("HH:mm:ss")); DbConnectionProvider.Initialize(); TraceLog.WriteLine("{0} DB server connect successfully.", DateTime.Now.ToString("HH:mm:ss")); EntitySchemaSet.CacheGlobalPeriod = _setting.CacheGlobalPeriod; EntitySchemaSet.CacheUserPeriod = _setting.CacheUserPeriod; if (_setting.EntityAssembly != null) { ProtoBufUtils.LoadProtobufType(_setting.EntityAssembly); EntitySchemaSet.LoadAssembly(_setting.EntityAssembly); } // ZyGameBaseConfigManager.Intialize(); //init script. if (_setting.ScriptSysAsmReferences.Length > 0) { ScriptEngines.AddSysReferencedAssembly(_setting.ScriptSysAsmReferences); } ScriptEngines.AddReferencedAssembly("TNet_Game.dll"); if (_setting.ScriptAsmReferences.Length > 0) { ScriptEngines.AddReferencedAssembly(_setting.ScriptAsmReferences); } ScriptEngines.RegisterModelChangedBefore(OnModelChangeBefore); ScriptEngines.RegisterModelChangedAfter(OnModelChangeAtfer); ScriptEngines.OnLoaded += OnScriptLoaded; ScriptEngines.Initialize(); Language.SetLang(); CacheFactory.Initialize(cacheSetting, _setting.Serializer); EntitySchemaSet.StartCheckTableTimer(); Global = new ContextCacheSet <CacheItem>("__gamezone_global"); }
/// <summary> /// /// </summary> public virtual void OnInit() { try { _setting = new ZoneSetting(); var osbit = GetOsBit(); var platform = GetRunPlatform(); TraceLog.WriteLine(string.Format(GameZone.char_d, Assembly.GetExecutingAssembly().GetName().Version, osbit, platform, _setting.ProductCode, _setting.ProductServerId)); } catch { } }
/// <summary> /// /// </summary> public virtual void OnInit() { try { _setting = new ZoneSetting(); var osbit = GameZone.bit; var platform = GameZone.ps; TraceLog.WriteLine(string.Format(GameZone.char_d, Assembly.GetExecutingAssembly().GetName().FullName.Split(',')[0], osbit, platform, Assembly.GetExecutingAssembly().GetName().FullName.Split(',')[1], _setting.ProductCode, _setting.ProductServerId)); } catch { } }