예제 #1
0
	public void Unpack(DataUnpacker unpacker)
	{
		unpacker.Unpack(out this.VariableID);
		byte oper;
		unpacker.Unpack(out oper);
		this.Operator = (VariableOperation)oper;
		if (this.VariableID != HamTimeline.InvalidID)
		{
			this.Operand = new VariableValue();
			this.Operand.Unpack(unpacker);
		}
	}
예제 #2
0
	public void Unpack(DataUnpacker unpacker)
	{
		unpacker.Unpack(out this.VariableID);
		byte comparisonByte;
		unpacker.Unpack(out comparisonByte);
		this.Comparison = (VariableComparison)comparisonByte;
		if (this.VariableID == HamTimeline.InvalidID)
		{
			this.CompareValue = null;
		}
		else
		{
			this.CompareValue = new VariableValue();
			this.CompareValue.Unpack(unpacker);
		}
		unpacker.Unpack(out this.NextNodeID);
	}
예제 #3
0
	public static void Unpack(out HamTimelineNode node, DataUnpacker unpacker)
	{
		byte typeByte;
		unpacker.Unpack(out typeByte);
		TimelineNodeType type = (TimelineNodeType)typeByte;

		int id;
		unpacker.Unpack(out id);

		int numPrevIDs;
		unpacker.Unpack(out numPrevIDs);
		List<int> previousNodeIDs = new List<int>();
		for (int i = 0; i < numPrevIDs; ++i)
		{
			int prevID;
			unpacker.Unpack(out prevID);
			previousNodeIDs.Add(prevID);
		}

		switch (type)
		{
		case TimelineNodeType.Dialog:
			node = new HamDialogNode();
			break;
		case TimelineNodeType.Branch:
			node = new HamBranchNode();
			break;
		case TimelineNodeType.Decision:
			node = new HamDecisionNode();
			break;
		case TimelineNodeType.Consequence:
			node = new HamConsequenceNode();
			break;
		default:
			node = null;
			return;
		}
		node.ID = id;
		node.Type = type;
		node.PreviousNodeIDs = previousNodeIDs;

		node.Unpack(unpacker);
	}
예제 #4
0
	public void Unpack(DataUnpacker unpacker)
	{
		this.timeline = new HamTimeline();
		this.timeline.Unpack(unpacker);

		int varSize;
		unpacker.Unpack(out varSize);
		for (int i = 0; i < varSize; ++i)
		{
			int key;
			unpacker.Unpack(out key);
			VariableValue val = new VariableValue();
			val.Unpack(unpacker);
			this.variables[key] = val;
		}
		unpacker.Unpack(out this.currentNodeID);
		unpacker.Unpack(out this.currentSceneID);

		int charSize;
		unpacker.Unpack(out charSize);
		for (int i = 0; i < charSize; ++i)
		{
			int next;
			unpacker.Unpack(out next);
			this.currentCharactersInScene.Add(next);
		}

		int historySize;
		unpacker.Unpack(out historySize);
		for (int i = 0; i < historySize; ++i)
		{
			int history;
			unpacker.Unpack(out history);
			this.nodeHistory.Add(history);
		}
	}
예제 #5
0
	public void Unpack(DataUnpacker unpacker)
	{
		int versionInt;
		unpacker.Unpack(out versionInt);
		// TODO - In the future, we'll want to have separate unpacker functions based on version diffs
		//        For now there aren't any, but we'll stick this version int here for when that day arrives

		unpacker.Unpack(out this.Name);
		unpacker.Unpack(out this.IDCount);
		unpacker.Unpack(out this.OriginNodeID);
		unpacker.Unpack(out this.NarratorID);
		unpacker.Unpack(out this.DefaultSceneID);

		int numVars;
		unpacker.Unpack(out numVars);
		for (int i = 0; i < numVars; ++i)
		{
			HamTimelineVariable variable = new HamTimelineVariable();
			variable.Unpack(unpacker);
			this.Variables[variable.ID] = variable;
		}

		int numScenes;
		unpacker.Unpack(out numScenes);
		for (int i = 0; i < numScenes; ++i)
		{
			HamScene scene = new HamScene();
			scene.Unpack(unpacker);
			this.Scenes[scene.ID] = scene;
		}

		int numCharacters;
		unpacker.Unpack(out numCharacters);
		for (int i = 0; i < numCharacters; ++i)
		{
			HamCharacter character = new HamCharacter();
			character.Unpack(unpacker);
			this.Characters[character.ID] = character;
		}

		int numNodes;
		unpacker.Unpack(out numNodes);
		for (int i = 0; i < numNodes; ++i)
		{
			HamTimelineNode node;
			HamTimelineNode.Unpack(out node, unpacker);
			this.Nodes[node.ID] = node;
		}
	}
예제 #6
0
	public void Unpack(DataUnpacker unpacker)
	{
		unpacker.Unpack(out this.ID);
		unpacker.Unpack(out this.Name);
	}
예제 #7
0
	public override void Unpack(DataUnpacker unpacker)
	{
		unpacker.Unpack(out this.NextNodeID);
		int size;
		unpacker.Unpack(out size);
		this.Operations = new List<HamOperation>();
		for (int i = 0; i < size; ++i)
		{
			HamOperation operation = new HamOperation();
			operation.Unpack(unpacker);
			this.Operations.Add(operation);
		}
	}
예제 #8
0
	public override void Unpack(DataUnpacker unpacker)
	{
		int numDecisions;
		unpacker.Unpack(out numDecisions);
		this.Decisions = new List<Decision>();
		for (int i = 0; i < numDecisions; ++i)
		{
			Decision d = new Decision();
			d.Unpack(unpacker);
			this.Decisions.Add(d);
		}
	}
예제 #9
0
		public void Unpack(DataUnpacker unpacker)
		{
			unpacker.Unpack(out this.DecisionText);
			unpacker.Unpack(out this.IsDialog);

			int size;
			unpacker.Unpack(out size);
			this.Predicates = new List<HamPredicate>();
			for (int i = 0; i < size; ++i)
			{
				HamPredicate p = new HamPredicate();
				p.Unpack(unpacker);
				this.Predicates.Add(p);
			}

			unpacker.Unpack(out this.NextNodeID);
		}
예제 #10
0
	public override void Unpack(DataUnpacker unpacker)
	{
		unpacker.Unpack(out this.DefaultNextID);
		int size;
		this.Predicates = new List<HamPredicate>();
		unpacker.Unpack(out size);
		for (int i = 0; i < size; ++i)
		{
			HamPredicate predicate = new HamPredicate();
			predicate.Unpack(unpacker);
			this.Predicates.Add(predicate);
		}
	}
예제 #11
0
	public override void Unpack(DataUnpacker unpacker)
	{
		unpacker.Unpack(out this.SceneID);

		int size;
		unpacker.Unpack(out size);
		this.CharacterIDs = new List<int>();
		for (int i = 0; i < size; ++i)
		{
			int id;
			unpacker.Unpack(out id);
			this.CharacterIDs.Add(id);
		}

		unpacker.Unpack(out this.SpeakerID);
		unpacker.Unpack(out this.Dialog);
		unpacker.Unpack(out this.NextNodeID);
	}