コード例 #1
0
 public void OnLoad(DictionaryAtom data)
 {
     Username   = data.GetString("Username");
     ID         = data.GetInt("UserID");
     PreHashId  = data.GetInt("PreHashID");
     PostHashId = data.GetInt("PostHashID");
 }
コード例 #2
0
ファイル: Channel.cs プロジェクト: 12-South-Studios/realmmud
        /// <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");
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        ///  <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);
        }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
        /// <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);
        }