示例#1
0
        /// <summary>
        /// Initializes and then adds the given realm to this world instance.
        /// </summary>
        /// <param name="realm">The realm to add.</param>
        /// <returns>Returns an awaitable Task</returns>
        /// <exception cref="MudDesigner.MudEngine.Environment.InvalidRealmException">The realm name can not be null or blank.</exception>
        public async Task AddRealmToWorld(IRealm realm)
        {
            if (this.realms.Contains(realm))
            {
                return;
            }

            if (string.IsNullOrEmpty(realm.Name))
            {
                throw new InvalidRealmException(realm, "The realm name can not be null or blank.");
            }

            realm.Owner = this;
            await realm.Initialize();

            this.realms.Add(realm);
        }
示例#2
0
        /// <summary>
        /// Initializes and then adds the given realm to this world instance.
        /// </summary>
        /// <param name="realm">The realm to add.</param>
        /// <returns>Returns an awaitable Task</returns>
        /// <exception cref="MudDesigner.MudEngine.Environment.InvalidRealmException">The realm name can not be null or blank.</exception>
        public async Task AddRealmToWorld(IRealm realm)
        {
            if (this.realms.Contains(realm))
            {
                return;
            }

            if (string.IsNullOrEmpty(realm.Name))
            {
                throw new InvalidRealmException(realm, "The realm name can not be null or blank.");
            }

            realm.Owner = this;
            await realm.Initialize();
            this.realms.Add(realm);
        }