Exemplo n.º 1
0
    /// <summary>
    /// Creates a new MainWindow.
    /// </summary>
    /// <param name="manager">The AuthoredEventManager responsible for managing EventStubs.</param>
    /// <param name="parent">The parent window.</param>
    /// <param name="renderer">The renderer for drawing lines.</param>
    public MainWindow(AuthoredEventManager manager, CrowdAuthoringEditor parent, AbstractLineRenderer renderer)
    {
        this.renderer = renderer;
        this.parent = parent;
        this.colorGradient = new Gradient();
        this.colorGradient.colorKeys = new GradientColorKey[] { new GradientColorKey(Color.red, 0.0f), new GradientColorKey(Color.blue, 0.2f), 
            new GradientColorKey(Color.green, 0.4f), new GradientColorKey(Color.yellow, 0.6f), new GradientColorKey(Color.white, 0.8f), new GradientColorKey(Color.magenta, 1.0f)};
        this.colorGradient.alphaKeys = new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(1.0f, 1.0f) };
        this.manager = manager;
        this.onObjectLeftClick.Add(StartDrawParticipantLine);
        this.onObjectRightClick.Add((SmartObject obj) => parent.onRepaint.Add(() => AddObjectContextMenu(obj)));
        this.onEventRightClick.Add((EventStub evnt) => parent.onRepaint.Add(() => AddEventContextMenu(evnt)));
        this.onEventMouseOver.Add(OnEventMouseOver);
        this.onEventMouseOut.Add(OnEventMouseOut);

        AddButtons();
		stateSpaceManager = new StateSpaceManager ();
	}
Exemplo n.º 2
0
    /// <summary>
    /// Create a new CrowdAuthoringEditor with the given line renderer.
    /// </summary>
    /// <param name="renderer">The line renderer for rendering lines in the main window.</param>
    public CrowdAuthoringEditor(AbstractLineRenderer renderer)
    {
        try
        {
            highlighter = Highlighter.Instance;

            objectSidebar = new Sidebar<SmartObject>(true, ObjectContentString);
            objectSidebar.RegisterLeftClickAction(highlighter.HighlightAfterUnhighlight);
            objectSidebar.RegisterLeftClickAction(OnParticipantDragStart);
            eventSidebar = new Sidebar<EventStub>(true, (EventStub e) => new GUIContent(e.Name));
            eventSidebar.RegisterLeftClickAction(OnEventDragStart);
            eventSidebar.allObjects.UnionWith(AllEvents());
            PeriodicMethodCaller.GetInstance().StartCallPeriodically(FindAllSmartObjects, 1.0f);

            actionBars = new List<ActionBar>();
            notificationBar = new NotificationBar("This is the main view, where you can see all your upcoming events");

            defaultBar = DefaultBar();
            selectCrowdBar = SelectCrowdBar();
            optionsBar = OptionsBar();

            actionBars.Add(defaultBar);

            mainArea = mainWindow = new MainWindow(AuthoredEventManager.Instance, this, renderer);
            mainWindow.RegisterLeftClickAction(highlighter.HighlightAfterUnhighlight);

            positionSelectAction = new MouseHandler.ClickActions((RaycastHit hit) => { }, TryCreateWaypoint);
            MouseHandler.GetInstance().RegisterClickEvents(positionSelectAction);

            RectanglePainter painter = RectanglePainter.GetWithColor(Color.blue);
            drawRectangleAction = new MouseHandler.DragActions(painter.StartPainting, painter.ContinuePainting, (Vector3 pos) => painter.StopPainting());
            crowdRectangleSelectAction = new MouseHandler.DragActions(OnSelectionStart, (Vector3 pos) => { }, OnSelectionStopped);
            EventCollectionManager.Instance.SetAllCollections(EventCollectionSerializer.Instance.Load());

        }
        catch (Exception e)
        {
            Debug.Log(e.StackTrace);
            Debug.Log(e.Message);
            Debug.Log(e.Source);
            mustClose = true;
        }
    }