本文整理匯總了C#中Newtonsoft.Json.Linq.JObject.GuidValue方法的典型用法代碼示例。如果您正苦於以下問題:C# JObject.GuidValue方法的具體用法?C# JObject.GuidValue怎麽用?C# JObject.GuidValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.GuidValue方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FromData
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: FromData
/// <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: Initialize
/// <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();
}