public void OnLoad(DictionaryAtom data) { Username = data.GetString("Username"); ID = data.GetInt("UserID"); PreHashId = data.GetInt("PreHashID"); PostHashId = data.GetInt("PostHashID"); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="data"></param> /// <param name="def"></param> public Channel(long id, string name, DictionaryAtom data, Definition def) : base(id, name, def) { MemberRepository = new ChannelMemberRepository(); Data = data; OwnerId = data.GetInt("OwnerID"); ChannelType = EnumerationExtensions.GetEnum <Globals.ChannelTypes>(data.GetInt("ChannelTypeID")); Bits = data.GetInt("Bits"); }
/// <summary> /// /// </summary> /// <param name="initAtom"></param> public void OnInit(DictionaryAtom initAtom) { var cacheDuration = initAtom.GetInt("PathCacheDuration"); MaxMobileMovementCost = initAtom.GetInt("MaxMobileMovementCost"); _pathRepository = new CachedObjectRepository <KeyValuePair <long, long>, Path>(cacheDuration); _pathBuilder = new PathBuilder(initAtom, EntityManager); Log.DebugFormat("PathManager initialized with PathCacheDuration of {0} and MaxMobileMovementCost of {1}", cacheDuration, MaxMobileMovementCost); EventManager.RegisterListener(this, typeof(OnGameInitialize), Instance_OnGameInitialize); }
private void OnLoadGameStateComplete(RealmEventArgs args) { CurrentGameState = args.GetValue("GameState").CastAs <GameState>() ?? new GameState( new MudTime { Year = _initAtom.GetInt("DefaultGameYear"), Month = _initAtom.GetInt("DefaultGameMonth"), Day = _initAtom.GetInt("DefaultGameDay"), Hour = _initAtom.GetInt("DefaultGameHour"), Minute = _initAtom.GetInt("DefaultGameMinute") }); Log.Debug("GameStateLoad completed. Loading the Year."); _loader.LoadYear(OnLoadYearComplete); }
public void CopyConstructorTest() { const string key = "test"; const int value = 25; var atom = new DictionaryAtom(); atom.Set(key, value); var newAtom = new DictionaryAtom(atom); newAtom.Count.Should().Be(1); newAtom.GetInt(key).Should().Be(value); }
/// <summary> /// /// </summary> /// <param name="initAtom"></param> /// <param name="entityInitializer"></param> public void OnInit(DictionaryAtom initAtom, IEntityInitializer entityInitializer) { EntityInitializer = entityInitializer; InitializationAtom = initAtom; var recycleFrequency = initAtom.GetInt("RecycleFrequency"); Validation.Validate <ArgumentOutOfRangeException>(recycleFrequency > 0); Log.DebugFormat("EntityManager initialized with Recycle Frequency of {0}", recycleFrequency); _recycler.Timer.Interval = recycleFrequency; EventManager.RegisterListener(this, typeof(OnGameInitialize), Instance_OnGameInitialize); }
/// <summary> /// /// </summary> /// <param name="initAtom"></param> public void OnInit(DictionaryAtom initAtom) { Validation.IsNotNull(initAtom, "initAtom"); _numberVMs = initAtom.GetInt("NumberLuaVMs"); Validation.Validate <ArgumentOutOfRangeException>(_numberVMs >= 1); _dataPath = initAtom.GetString("DataPath"); Log.DebugFormat("{0} asked to initialize {1} LuaVMs.", GetType(), _numberVMs); var kernel = (IKernel)initAtom.GetObject("Ninject.Kernel"); EventManager.RegisterListener(this, kernel.Get <IGame>(), typeof(OnGameInitialize), Instance_OnGameInitialize); }
/// <summary> /// Do initialization that cannot be done at construction /// </summary> public void OnInit(DictionaryAtom args) { Validation.IsNotNull(args, "args"); _connectionString = args.GetString("ConnectionString"); Validation.IsNotNullOrEmpty(_connectionString, "_connectionString"); _numberServers = args.GetInt("NumberDBServers"); Validation.Validate <ArgumentOutOfRangeException>(_numberServers >= 1); _log.DebugFormat("{0} asked to spin up {1} database servers.", GetType(), _numberServers); InitDatabaseLoaders(args); _loaderArgs = args.GetAtom <ListAtom>("Loaders"); _eventManager.RegisterListener(this, typeof(OnGameInitialize), Instance_OnGameInitialize); }