Example #1
0
	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;
	}
Example #2
0
	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());
	}
Example #3
0
	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());
	}
Example #4
0
	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;
	}	
Example #5
0
	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;
	}
Example #6
0
	public static void Save(HamTimeline timeline, string path)
	{
		DataPacker packer = new BinaryDataPacker();
		timeline.Pack(packer);
		File.WriteAllBytes(path, packer.GetBytes());
	}
Example #7
0
	public HamNodePlacer(HamTimeline timeline, bool attemptReparenting = true)
	{
		this.timeline = timeline;
		this.attemptReparenting = attemptReparenting;
	}
Example #8
0
 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;
 }
Example #9
0
    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();
    }
Example #10
0
 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;
     }
 }