本文整理汇总了C#中Serializer.GetDataItem方法的典型用法代码示例。如果您正苦于以下问题:C# Serializer.GetDataItem方法的具体用法?C# Serializer.GetDataItem怎么用?C# Serializer.GetDataItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serializer
的用法示例。
在下文中一共展示了Serializer.GetDataItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public void Deserialize(XElement serializedData)
{
Serializer serializer = new Serializer(serializedData);
Profile.CurrentAreaData.LastSelectedLevel = serializer.GetDataItem<int>("level-index");
CurrentPlayState = serializer.GetDataItem<PlayState>("play-state");
PointsScoredThisLevel = serializer.GetDataItem<int>("accrued-score");
TotalCandiesOnLevel = serializer.GetDataItem<int>("total-candies");
RankACandyFraction = serializer.GetDataItem<int>("rank-a-fraction");
RankBCandyFraction = serializer.GetDataItem<int>("rank-b-fraction");
_candiesCollected = serializer.GetDataItem<int>("candies-collected");
AttemptsAtLevel = serializer.GetDataItem<int>("attempts-count");
}
示例2: Deserialize
protected virtual Serializer Deserialize(Serializer serializer)
{
Bones.Clear();
PrimaryBoneID = "";
List<XElement> subObjects = (from el
in serializer.SerializedData.Elements("dataitem").Elements("object")
select el).ToList();
for (int i = 0; i < subObjects.Count; i++)
{
if ((Type.GetType((string)subObjects[i].Attribute("type")) != null) &&
(Type.GetType((string)subObjects[i].Attribute("type")).GetInterfaces().Contains(typeof(IBone))))
{
ReinstateBone(subObjects[i]);
}
}
WorldPosition = serializer.GetDataItem<Vector2>("world-position");
Rotation = serializer.GetDataItem<float>("rotation");
Scale = serializer.GetDataItem<float>("scale");
Mirror = serializer.GetDataItem<bool>("mirror");
Tint = serializer.GetDataItem<Color>("tint");
RenderDepth = serializer.GetDataItem<float>("render-depth");
RenderLayer = serializer.GetDataItem<int>("render-layer");
Visible = serializer.GetDataItem<bool>("visible");
return serializer;
}
示例3: Deserialize
protected override Serializer Deserialize(Serializer serializer)
{
base.Deserialize(serializer);
CheckpointIndex = serializer.GetDataItem<int>("checkpoint-index");
return serializer;
}
示例4: Deserialize
protected override Serializer Deserialize(Serializer serializer)
{
base.Deserialize(serializer);
SpeedRange = serializer.GetDataItem<Range>("speed-range");
return serializer;
}
示例5: Deserialize
protected override Serializer Deserialize(Serializer serializer)
{
base.Deserialize(serializer);
ScoreValue = serializer.GetDataItem<int>("score-value");
return serializer;
}
示例6: Deserialize
public void Deserialize(XElement serializedData)
{
Serializer serializer = new Serializer(serializedData);
_smashedBlockWorldPositions.Clear();
for (int i = 0; i < serializer.GetDataItem<int>("smashed-block-count"); i++)
{
Vector2 blockWorldPosition = serializer.GetDataItem<Vector2>(string.Concat("smashed-block-",i));
Point blockMapPosition = new Point(
(int)(blockWorldPosition.X / Definitions.Grid_Cell_Pixel_Size), (int)(blockWorldPosition.Y / Definitions.Grid_Cell_Pixel_Size));
_smashedBlockWorldPositions.Add(blockWorldPosition);
SurvivalModeItemSmashBlock block = GetTile(blockMapPosition.X, blockMapPosition.Y) as SurvivalModeItemSmashBlock;
if (block != null)
{
block.ReadyForDisposal = true;
block.Visible = false;
block.Collidable = false;
}
}
}
示例7: Deserialize
protected override void Deserialize(Serializer serializer)
{
_startingTint = serializer.GetDataItem<Color>("start-tint");
base.Deserialize(serializer);
}
示例8: HandleTombstoneRecovery
public Type HandleTombstoneRecovery(Type startingSceneType)
{
XDocument stateData = FileManager.LoadXMLFile(_tombstoneFileName);
Serializer serializer = new Serializer(stateData.Element("gamestatedata").Element("object"));
string recoveringSceneID = stateData.Element("gamestatedata").Element("object").Attribute("id").Value;
string recoveringSceneTypeName = stateData.Element("gamestatedata").Element("object").Attribute("type").Value;
string recoveringSceneNextSceneTypeName = "";
if (serializer.GetDataItem<Scene.Status>("state") == Scene.Status.Deactivating)
{
recoveringSceneNextSceneTypeName = serializer.GetDataItem<string>("nextscene");
}
Scene startingScene = null;
Scene sceneToRecover = null;
Type recoveringSceneType = null;
foreach (KeyValuePair<Type, Scene> kvp in _scenes)
{
if ((kvp.Key.ToString() == recoveringSceneTypeName) && (kvp.Value is StorableScene) && (((StorableScene)kvp.Value).ID == recoveringSceneID))
{
sceneToRecover = kvp.Value;
recoveringSceneType = kvp.Key;
}
else if (kvp.Key == startingSceneType)
{
startingScene = kvp.Value;
}
}
if (!string.IsNullOrEmpty(recoveringSceneNextSceneTypeName))
{
recoveringSceneType = Type.GetType(recoveringSceneNextSceneTypeName);
}
else if (sceneToRecover != null)
{
((StorableScene)sceneToRecover).TombstoneRecoveryData = stateData.Element("gamestatedata").Element("object");
}
if ((startingScene != null) && (startingScene is AssetLoaderScene) && (recoveringSceneType != null))
{
((AssetLoaderScene)startingScene).PostLoadTargetSceneType = recoveringSceneType;
}
else
{
startingSceneType = recoveringSceneType;
}
FileManager.DeleteFile(_tombstoneFileName);
return startingSceneType;
}
示例9: Deserialize
protected override Serializer Deserialize(Serializer serializer)
{
base.Deserialize(serializer);
Collidable = serializer.GetDataItem<bool>("collidable");
_collisionBoundingBox = serializer.GetDataItem<Rectangle>("collision-box");
return serializer;
}
示例10: Deserialize
public void Deserialize(XElement serializedData)
{
Serializer serializer = new Serializer(serializedData);
_settings = serializer.GetDataItem<PhoneSettings>("config-settings");
_hasRated = serializer.GetDataItem<bool>("has-rated");
if (serializedData.Elements("dataitem").Any(x => x.Attribute("name").Value == "reminder-plays"))
{
_playsBeforeNextReminder = serializer.GetDataItem<int>("reminder-plays");
}
else
{
_playsBeforeNextReminder = Initial_Plays_Before_Rating_Reminder;
}
_nextReminderDate = serializer.GetDataItem<DateTime>("next-reminder");
_livesElementAdded = serializer.GetDataItem<bool>("lives-added");
_livesRemaining = serializer.GetDataItem<int>("lives-remaining");
_lastLivesUpdateTime = serializer.GetDataItem<DateTime>("lives-updated");
_goldenTicketCount = serializer.GetDataItem<int>("golden-tickets");
_currentArea = serializer.GetDataItem<string>("last-area");
LoadAreaDataFromXml(serializer.GetDataElement("survival-area-data"));
LoadAvatarComponentDataFromXml(serializer.GetDataElement("avatar-component-data"));
}
示例11: Deserialize
public void Deserialize(XElement serializedData)
{
Serializer serializer = new Serializer(serializedData);
LevelCompleted = serializer.GetDataItem<bool>("level-complete");
}
示例12: Deserialize
protected override Serializer Deserialize(Serializer serializer)
{
base.Deserialize(serializer);
Collidable = serializer.GetDataItem<bool>("collidable");
_lifeCycleState = serializer.GetDataItem<LifeCycleStateValue>("life-cycle-state");
ReadyForDisposal = serializer.GetDataItem<bool>("ready-for-disposal");
if (_lifeCycleState == LifeCycleStateValue.Exiting)
{
Visible = false;
UpdateLifeCycleState(LifeCycleStateValue.ReadyForRemoval);
}
return serializer;
}
示例13: Deserialize
protected virtual void Deserialize(Serializer serializer)
{
_currentKeyframeIndex = serializer.GetDataItem<int>("current-frame-index");
_currentKeyframeMillisecondsElapsed = serializer.GetDataItem<float>("current-frame-elapsed");
_sequence = new AnimationSequence(serializer.GetDataItem<AnimationSequence.AnimationSequenceType>("sequence-type"));
_sequence.Loops = serializer.GetDataItem<bool>("loop-sequence");
XElement frames = serializer.GetDataElement("keyframes");
if (frames != null)
{
foreach (XElement frame in frames.Elements("keyframe")) { _sequence.Keyframes.Add(DeserializeKeyframe(frame)); }
}
}
示例14: Deserialize
protected virtual void Deserialize(Serializer serializer)
{
RaceName = serializer.GetDataItem<string>("race-name");
ControlSensitivity = serializer.GetDataItem<float>("control-sensitivity");
SelectedAvatarSlot = serializer.GetDataItem<int>("selected-avatar");
MusicManager.Muted = serializer.GetDataItem<bool>("music-off");
SoundEffectManager.Muted = serializer.GetDataItem<bool>("sound-off");
ShowPowerUpHelpers = serializer.GetDataItem<bool>("powerup-helpers-on");
DeserializeAvatarCustomisations(serializer.GetDataElement("avatar-customisations"));
}
示例15: Deserialize
protected override Serializer Deserialize(Serializer serializer)
{
serializer.KnownSerializedObjects.Add(_animationEngine);
base.Deserialize(serializer);
Collidable = serializer.GetDataItem<bool>("collidable");
_collisionBoundingBox = serializer.GetDataItem<Rectangle>("collision-box");
_animationEngine = serializer.GetDataItem<SpriteSheetAnimationEngine>("animation-engine");
_poleWorldPosition = serializer.GetDataItem<Vector2>("pole-position");
return serializer;
}