示例#1
0
 private void CreateAndPopulateUpdater()
 {
     if (_updateElement == null)
     {
         GameObject updateElement = GetObject("Updater", this.transform);
         _updateElement = updateElement.AddComponent <UpdateElement>();
     }
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Hud"/> class.
        /// </summary>
        private Hud()
            : base(ControlTag, "Empty")
        {
            renderInfoList = new List<RenderStep>();
            updateQueue = new Queue<UpdateElement>();
            spriteControls = new List<ISpriteObject>();
            hudShapes = new List<ShapeDescription>();
            keyBindings = new SortedList<Keys, KeyBinding>();
            Shapes = new ShapeCollection(1);

            FocusedControl = EnteredControl = this;
            IsInside = true;
            IsFocusable = true;
            //WindowManager = new WindowManager();

            recomputeAction = new UpdateElement(this, UpdateAction.Recompute);
        }
示例#3
0
        /// <summary>
        /// Enqueues a control for update.
        /// </summary>
        /// <remarks>Multiple events in rapid succession may cause a control to update its appearance.
        /// This makes sure that a control is not added multiple times to the queue if it has not yet
        /// been updated.
        /// <para>When a control is updated, the entire vertex buffer is discared and rewritten, for
        /// performance purposes.</para></remarks>
        /// <param name="control">The control to update.</param>
        public void EnqueueForUpdate(BaseControl control, UpdateAction updateAction)
        {
            if (control.IsBeingUpdated)
                return;

            ///TODO
            //Console.WriteLine(string.Format("Enqueing {0} for {1}",control.Id, updateAction));
            UpdateElement updateElement = new UpdateElement(control, updateAction);
            updateQueue.Enqueue(updateElement);
            control.IsBeingUpdated = true;
            uiUCommand.Resume();
        }