public static HamTimeline Load(string path) { byte[] data = File.ReadAllBytes(path); DataUnpacker unpacker = new BinaryDataUnpacker(data); HamTimeline timeline = new HamTimeline(); timeline.Unpack(unpacker); return timeline; }
public string Label(HamTimeline timeline) { if (this.VariableID == HamTimeline.InvalidID) { return "No Comparison"; } HamTimelineVariable variable = timeline.Variables[this.VariableID]; return String.Format("{0} {1} {2}", variable.Name, this.Comparison.ToString(), this.CompareValue.Label()); }
public string Label(HamTimeline timeline) { if (this.VariableID == HamTimeline.InvalidID) { return "No Operation"; } HamTimelineVariable variable = timeline.Variables[this.VariableID]; return String.Format("{0} {1} {2}", this.Operator.ToString(), variable.Name, this.Operand.Label()); }
public void SetVariable(HamTimeline timeline, int id) { if (id == HamTimeline.InvalidID) { this.Operand = null; } else { this.Operand = new VariableValue(timeline.Variables[id]); } this.VariableID = id; }
public HamTimelineInstance(string timelinePath, TimelineEvent onTimelineEvent) { this.timeline = HamTimeline.Load(timelinePath); this.currentNodeID = HamTimeline.InvalidID; this.variables = new Dictionary<int, VariableValue>(); this.nodeHistory = new List<int>(); this.currentNodeID = HamTimeline.InvalidID; this.currentCharactersInScene = new List<int>(); InitializeVariables(); this.OnTimelineEvent = onTimelineEvent; }
public static void Save(HamTimeline timeline, string path) { DataPacker packer = new BinaryDataPacker(); timeline.Pack(packer); File.WriteAllBytes(path, packer.GetBytes()); }
public HamNodePlacer(HamTimeline timeline, bool attemptReparenting = true) { this.timeline = timeline; this.attemptReparenting = attemptReparenting; }
private void ResetEditorWindow() { this.activeTimeline = null; this.activeEditingTab = EditingTab.NodeEditing; this.selection = new SelectionContext(); this.selectedCharacter = HamTimeline.InvalidID; this.selectedScene = HamTimeline.InvalidID; this.overviewOffset = Vector2.zero; }
private void LoadTimeline(string name) { ResetEditorWindow(); string path = Path.Combine(HamTimeline.GetTimelinePath(), name); if (!File.Exists(path)) { this.activeTimeline = new HamTimeline(); this.activeTimeline.Name = name; this.activeTimeline.DefaultInit(); SaveTimeline(); } else { try { this.activeTimeline = HamTimeline.Load(path); } catch(Exception e) { Debug.LogError("Failed to load timeline " + name + ": " + e.Message); Debug.LogError(e.StackTrace); } } this.lastAutoSave = GetEpochTime(); }
public void ClickedNode(HamTimeline timeline, HamTimelineNode node) { switch (this.Mode) { case SelectionMode.SelectNode: this.Node = node; break; case SelectionMode.LinkNodes: if (this.Node != node) { if (timeline.CanLinkCleanly(this.Node, node, this.DescendantIndex)) { timeline.LinkNodes(this.Node, node, this.DescendantIndex); } else { EditorUtility.DisplayDialog("Node Linking Failed", "No clean way was found to reparent the currently linked node", "OK"); } } this.Mode = SelectionMode.SelectNode; break; } }