public static ActionReturnsDescriptor FromData( JObject data )
        {
            if ( data == null )
            return null;

              return new ActionReturnsDescriptor
              {
            Items = ItemListJsonConverter.FromJson( (JObject) data["Items"] ),
            Building = GameHost.GameRules.GetDataItem<ImmovableDescriptor>( data.GuidValue( "Building" ) ),
              };
        }
示例#2
0
        /// <summary>
        /// 从 JSON 数据中读取
        /// </summary>
        /// <param name="place">活动所处地块</param>
        /// <param name="data">活动数据</param>
        /// <returns>活动对象</returns>
        public static PlaceActing FromData( Place place, JObject data )
        {
            if ( place == null )
            throw new ArgumentNullException( "place" );

              if ( data == null )
            return null;

              var startOn = data.Value<DateTime>( "StartOn" );
              var playerId = data.GuidValue( "PlayerID" );
              var action = GameHost.GameRules.GetDataItem<ActionDescriptorBase>( data.GuidValue( "ActionDescriptor" ) );

              if ( action == null )
            return null;

              return new PlaceActing
              {
            PlayerID = playerId,
            Place = place,
            StartOn = startOn,
            ActionDescriptor = action,
              };
        }
示例#3
0
        /// <summary>
        /// 初始化游戏规则数据
        /// </summary>
        /// <param name="data">游戏规则数据</param>
        protected virtual void Initialize( GameRulesBase rules, JObject data )
        {
            if ( data == null )
            throw new ArgumentNullException( "data" );

              Guid = (Guid) data.GuidValue( "ID" );
              Data = (JObject) data.DeepClone();
        }