Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        var timer = new System.Diagnostics.Stopwatch();
        var temp2 = this.gameObject.AddComponent <BlackboardNode>();
        var temp3 = this.gameObject.AddComponent <PlainBlackboard>();

        var temp1 = new SimpleBlackboard();
        Dictionary <Type, IBlackboard> lookup = new Dictionary <Type, IBlackboard> ();

        lookup.Add(typeof(SimpleBlackboard), temp1);
        lookup.Add(typeof(PlainBlackboard), temp3);

        timer.Start();
        for (int i = 0; i < 1000; ++i)
        {
            foreach (BlackboardRequest request in temp2.Requests)
            {
                request.Blackboard = lookup[request.Key];

                request.IsPopulated = true;
            }
        }
        timer.Stop();

        Debug.Log(timer.Elapsed.TotalMilliseconds);
    }
Esempio n. 2
0
	// Use this for initialization
	void Start () {
		var timer = new System.Diagnostics.Stopwatch();
		var temp2 = this.gameObject.AddComponent<BlackboardNode>();		
		var temp3 = this.gameObject.AddComponent<PlainBlackboard>();	

		var temp1 = new SimpleBlackboard();	
		Dictionary<Type, IBlackboard> lookup = new Dictionary<Type, IBlackboard> ();
		lookup.Add (typeof(SimpleBlackboard), temp1);
		lookup.Add (typeof(PlainBlackboard), temp3);

		timer.Start ();
		for(int i = 0; i < 1000; ++i)
		{
			foreach (BlackboardRequest request in temp2.Requests)
			{
				request.Blackboard = lookup[request.Key];

				request.IsPopulated = true;
			}
		}
		timer.Stop ();

		Debug.Log(timer.Elapsed.TotalMilliseconds);
	}
        public SimpleGraphView(SimpleGraphViewWindow simpleGraphViewWindow, bool withWindowedTools)
        {
            m_SimpleGraphViewWindow = simpleGraphViewWindow;

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            // FIXME: add a coordinator so that ContentDragger and SelectionDragger cannot be active at the same time.
            this.AddManipulator(new ContentDragger());
            m_HackedSelectionDragger = new HackedSelectionDragger();
            this.AddManipulator(m_HackedSelectionDragger);
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());

            Insert(0, new GridBackground());

            focusable = true;

            serializeGraphElements = SerializeGraphElementsImplementation;
            canPasteSerializedData = CanPasteSerializedDataImplementation;
            unserializeAndPaste    = UnserializeAndPasteImplementation;

            m_Blackboard = new SimpleBlackboard(simpleGraphViewWindow.mathBook, this);
            StyleSheet sheetAsset = Resources.Load("SimpleGraph", typeof(StyleSheet)) as StyleSheet;

            m_Blackboard.styleSheets.Add(sheetAsset);

            if (!withWindowedTools)
            {
                Add(m_Blackboard);
            }

            m_SimpleGraphViewWindow.mathBook.inputOutputs.changed += OnInputOutputsChanged;

            RegisterCallback <AttachToPanelEvent>(OnAttachToPanel);
            RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel);
        }