Exemplo n.º 1
0
 public void InvalidateMaterials()
 {
     foreach (var mesh in Descendants.OfType <Mesh3D>().SelectMany((m) => m.Submeshes))
     {
         mesh.Material.Invalidate();
     }
 }
Exemplo n.º 2
0
 private void ResetLightning()
 {
     foreach (var mesh in Descendants.OfType <Mesh3D>())
     {
         mesh.ProcessLightning = lightningEnabled;
         mesh.RecieveShadow    = recieveShadow;
         mesh.CastShadow       = castShadow;
     }
 }
Exemplo n.º 3
0
        public void RebuildSkeleton()
        {
            var submeshes = Descendants
                            .OfType <Mesh3D>()
                            .SelectMany(m => m.Submeshes);

            foreach (var sm in submeshes)
            {
                sm.RebuildSkeleton(this);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Tries to looks for the specified message type and returns it.
        /// </summary>
        /// <param name="result">The message of the specified type.</param>
        /// <typeparam name="T">The message type that needs to be searched.</typeparam>
        /// <returns><c>true</c>, if the message was found; otherwise <c>false</c>.</returns>
        /// <remarks>
        /// This method is necessary because there can be a hierarchy of messages. In this case the whole stack needs to be searched for the message.
        /// </remarks>
        /// <example>
        /// <code>
        /// protected override void ExecuteCore(Message messageData)
        /// {
        ///     //This will not execute if the message was decorated
        ///     if(messageData is SpecificMessage message)
        ///     {
        ///         //...
        ///     }
        ///
        ///     //This will work either way
        ///     if(messageData.TryGet(out SpecificMessage message))
        ///     {
        ///         //...
        ///     }
        /// }
        /// </code>
        /// </example>
        public bool TryGet <T>(out T result) where T : Message
        {
            result = this as T;
            if (result == null)
            {
                if (this != HeadMessage)
                {
                    HeadMessage.TryGet(out result);
                }
                else
                {
                    result = Descendants.OfType <T>().FirstOrDefault();
                }
            }

            return(result != null);
        }
Exemplo n.º 5
0
 private void ManageFocusOnWindowActivation()
 {
     if (Window.Active)
     {
         if (Widget.Focused != null && Widget.Focused.SameOrDescendantOf(this))
         {
             lastFocused = Widget.Focused;
         }
     }
     if (windowActivated)
     {
         windowActivated = false;
         if (lastFocused == null || !lastFocused.GloballyVisible || !lastFocused.SameOrDescendantOf(this))
         {
             // Looking the first focus scope widget on the window and make it focused.
             lastFocused = Descendants.OfType <Widget>().FirstOrDefault(i => i.FocusScope != null && i.GloballyVisible);
         }
         Widget.SetFocus(lastFocused);
     }
 }