Exemplo n.º 1
0
        /// <summary>
        /// Method that handles the Property XML element.
        /// </summary>
        /// <param name="attributes"></param>
        private void ElementPropertyStart(XMLAttributes attributes)
        {
            // get property name
            var propertyName = attributes.GetValueAsString(Property.NameXMLAttributeName);

            // get property value string
            var propertyValue = String.Empty;

            if (attributes.Exists(Property.ValueXMLAttributeName))
            {
                propertyValue = attributes.GetValueAsString(Property.ValueXMLAttributeName);
            }

            // Short property
            if (!String.IsNullOrEmpty(propertyValue))
            {
                d_stringItemName = String.Empty;
                try
                {
                    // need a window to be able to set properties!
                    if (d_stack.Count != 0)
                    {
                        // get current window being defined.
                        var curwindow = d_stack[d_stack.Count - 1].Item1;

                        var useit = true;

                        // if client defined a callback, call it and discover if we should
                        // set the property.
                        if (d_propertyCallback != null)
                        {
                            useit = d_propertyCallback(curwindow,
                                                       propertyName,
                                                       propertyValue,
                                                       d_userData);
                        }
                        // set the property as needed
                        if (useit)
                        {
                            curwindow.SetProperty(propertyName, propertyValue);
                        }
                    }
                }
                catch (Exception)
                {
                    // Don't do anything here, but the error will have been logged.
                }
            }
            // Long property
            else
            {
                // Store name for later use
                d_stringItemName = propertyName;
                // reset the property value buffer
                d_stringItemValue = String.Empty;
            }
        }
Exemplo n.º 2
0
        //! Function that handles the LookNFeel XML element.
        private void elementLookNFeelStart(XMLAttributes attributes)
        {
            var lnf = new Scheme.LoadableUIElement();

            lnf.filename      = attributes.GetValueAsString(FilenameAttribute);
            lnf.resourceGroup = attributes.GetValueAsString(ResourceGroupAttribute);

            d_scheme.d_looknfeels.Add(lnf);
        }
Exemplo n.º 3
0
        //! Function that handles the Font XML element.
        private void elementFontStart(XMLAttributes attributes)
        {
            var font = new Scheme.LoadableUIElement();

            font.name          = attributes.GetValueAsString(NameAttribute);
            font.filename      = attributes.GetValueAsString(FilenameAttribute);
            font.resourceGroup = attributes.GetValueAsString(ResourceGroupAttribute);

            d_scheme.d_fonts.Add(font);
        }
Exemplo n.º 4
0
        //! Function that handles the ImagesetFromImage XML element.
        private void elementImagesetFromImageStart(XMLAttributes attributes)
        {
            var imageset = new Scheme.LoadableUIElement();

            imageset.filename      = attributes.GetValueAsString(FilenameAttribute);
            imageset.name          = attributes.GetValueAsString(NameAttribute, imageset.filename);
            imageset.resourceGroup = attributes.GetValueAsString(ResourceGroupAttribute);

            d_scheme.d_imagesetsFromImages.Add(imageset);
        }
Exemplo n.º 5
0
 public override void ElementStart(string element, XMLAttributes attributes)
 {
     if (element == WindowAliasElement)
     {
         elementWindowAliasStart(attributes);
     }
     else if (element == ImagesetElement)
     {
         elementImagesetStart(attributes);
     }
     else if (element == ImagesetFromImageElement)
     {
         elementImagesetFromImageStart(attributes);
     }
     else if (element == FontElement)
     {
         elementFontStart(attributes);
     }
     else if (element == WindowSetElement)
     {
         elementWindowSetStart(attributes);
     }
     else if (element == WindowFactoryElement)
     {
         elementWindowFactoryStart(attributes);
     }
     else if (element == WindowRendererSetElement)
     {
         elementWindowRendererSetStart(attributes);
     }
     else if (element == WindowRendererFactoryElement)
     {
         elementWindowRendererFactoryStart(attributes);
     }
     else if (element == GUISchemeElement)
     {
         elementGUISchemeStart(attributes);
     }
     else if (element == FalagardMappingElement)
     {
         elementFalagardMappingStart(attributes);
     }
     else if (element == LookNFeelElement)
     {
         elementLookNFeelStart(attributes);
     }
     // anything else is a non-fatal error.
     else
     {
         System.GetSingleton().Logger
         .LogEvent("Scheme_xmlHandler::elementStart: Unknown element encountered: <" + element + ">",
                   LoggingLevel.Errors);
     }
 }
Exemplo n.º 6
0
        //! Function that handles the WindowRendererSet XML element.
        private void elementWindowRendererSetStart(XMLAttributes attributes)
        {
            var module = new Scheme.UIModule
            {
                name          = attributes.GetValueAsString(FilenameAttribute),
                dynamicModule = null,
                factoryModule = null
            };

            d_scheme.d_windowRendererModules.Add(module);
        }
Exemplo n.º 7
0
        private void OnStartElement(XmlReader reader, XmlHandler handler)
        {
            var element    = reader.Name;
            var attributes = new XMLAttributes();

            while (reader.MoveToNextAttribute())
            {
                attributes.Add(reader.Name, reader.Value);
            }
            handler.ElementStart(element, attributes);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="attributes"></param>
        /// <param name="anim"></param>
        public AnimationSubscriptionHandler(XMLAttributes attributes, Animation anim)
        {
            Logger.LogInsane("\tAdding subscription to event: " +
                             attributes.GetValueAsString(EventAttribute) +
                             "  Action: " +
                             attributes.GetValueAsString(ActionAttribute));

            anim.DefineAutoSubscription(attributes.GetValueAsString(EventAttribute),
                                        attributes.GetValueAsString(ActionAttribute));

            d_completed = true;
        }
Exemplo n.º 9
0
        //! Function that handles the FalagardMapping XML element.
        private void elementFalagardMappingStart(XMLAttributes attributes)
        {
            var fmap = new Scheme.FalagardMapping();

            fmap.windowName   = attributes.GetValueAsString(WindowTypeAttribute);
            fmap.targetName   = attributes.GetValueAsString(TargetTypeAttribute);
            fmap.lookName     = attributes.GetValueAsString(LookNFeelAttribute);
            fmap.rendererName = attributes.GetValueAsString(WindowRendererAttribute);
            fmap.effectName   = attributes.GetValueAsString(RenderEffectAttribute);

            d_scheme.d_falagardMappings.Add(fmap);
        }
Exemplo n.º 10
0
        //! Function that handles the opening GUIScheme XML element.
        private void elementGUISchemeStart(XMLAttributes attributes)
        {
            var name   = attributes.GetValueAsString(NameAttribute);
            var logger = System.GetSingleton().Logger;

            logger.LogEvent("Started creation of Scheme from XML specification:");
            logger.LogEvent("---- CEGUI GUIScheme name: " + name);

            validateSchemeFileVersion(attributes);

            // create empty scheme with desired name
            d_scheme = new Scheme(name);
        }
 protected override void ElementStartLocal(string element, XMLAttributes attributes)
 {
     if (element == AnimationKeyFrameHandler.ElementName)
     {
         ChainedHandler = new AnimationKeyFrameHandler(attributes, _affector);
     }
     else
     {
         System.GetSingleton().Logger
         .LogEvent(
             "AnimationAffectorHandler.ElementStartLocal: " + "<" + element +
             "> is invalid at this location.", LoggingLevel.Errors);
     }
 }
Exemplo n.º 12
0
        public const string GuiLayoutVersionAttribute = "version"; //!< Attribute name that stores the xml file version.

        /// <summary>
        /// Method that handles the opening GUILayout XML element.
        /// </summary>
        /// <param name="attributes"></param>
        /// <remarks>
        /// This method just checks the version attribute and there is no equivalent
        /// elementGUILayoutEnd method, because it would be just NOOP anyways
        /// </remarks>
        private void ElementGUILayoutStart(XMLAttributes attributes)
        {
            var version = attributes.GetValueAsString(GuiLayoutVersionAttribute, "unknown");

            if (version != NativeVersion)
            {
                throw new InvalidRequestException(
                          "You are attempting to load a layout of version '" + version +
                          "' but this CEGUI version is only meant to load layouts of " +
                          "version '" + NativeVersion + "'. Consider using the " +
                          "migrate.py script bundled with CEGUI Unified Editor to " +
                          "migrate your data.");
            }
        }
Exemplo n.º 13
0
        //! throw exception if file version is not supported.
        private void validateSchemeFileVersion(XMLAttributes attrs)
        {
            var version = attrs.GetValueAsString(SchemeVersionAttribute, "unknown");

            if (version == NativeVersion)
            {
                return;
            }

            throw new InvalidRequestException("You are attempting to load a GUI scheme of version '" + version +
                                              "' but this CEGUI version is only meant to load GUI schemes of version '" +
                                              NativeVersion + "'. Consider using the migrate.py script bundled with " +
                                              "CEGUI Unified Editor to migrate your data.");
        }
Exemplo n.º 14
0
        /// <summary>
        /// Method that handles the opening Window XML element.
        /// </summary>
        /// <param name="attributes"></param>
        private void ElementWindowStart(XMLAttributes attributes)
        {
            // get type of window to create
            var windowType = attributes.GetValueAsString(Window.WindowTypeXMLAttributeName);

            // get name for new window
            var windowName = attributes.GetValueAsString(Window.WindowNameXMLAttributeName);

            // attempt to create window
            try
            {
                var wnd = WindowManager.GetSingleton().CreateWindow(windowType, windowName);

                // add this window to the current parent (if any)
                if (d_stack.Count != 0)
                {
                    d_stack[d_stack.Count - 1].Item1.AddChild(wnd);
                }
                else
                {
                    d_root = wnd;
                }

                // make this window the top of the stack
                d_stack.Add(new Tuple <Window, bool>(wnd, true));

                // tell it that it is being initialised
                wnd.BeginInitialisation();
            }
            catch (AlreadyExistsException)
            {
                // delete all windows created
                CleanupLoadedWindows();

                // signal error - with more info about what we have done.
                throw new InvalidRequestException("layout loading has been aborted since Window named '" + windowName +
                                                  "' already exists.");
            }
            catch (UnknownObjectException)
            {
                // delete all windows created
                CleanupLoadedWindows();

                // signal error - with more info about what we have done.
                throw new InvalidRequestException(
                          "layout loading has been aborted since no WindowFactory is available for '" + windowType +
                          "' objects.");
            }
        }
Exemplo n.º 15
0
        // XML parsing helper functions.
        private void ElementImagesetStart(XMLAttributes attributes)
        {
            // get name of the imageset.
            string name = attributes.GetValueAsString(ImagesetNameAttribute);

            // get name of the imageset.
            s_imagesetType = attributes.GetValueAsString(ImagesetTypeAttribute, ImageTypeAttributeDefault);
            // get texture image filename
            string filename = attributes.GetValueAsString(ImagesetImageFileAttribute);
            // get resource group to use for image file.
            string resource_group = attributes.GetValueAsString(ImagesetResourceGroupAttribute);

            var logger = System.GetSingleton().Logger;

            logger.LogEvent("[ImageManager] Started creation of Imageset from XML specification:");
            logger.LogEvent("[ImageManager] ---- CEGUI Imageset name: " + name);
            logger.LogEvent("[ImageManager] ---- Source texture file: " + filename);
            logger.LogEvent("[ImageManager] ---- Source texture resource group: " +
                            (String.IsNullOrEmpty(resource_group) ? "(Default)" : resource_group));

            ValidateImagesetFileVersion(attributes);

            var renderer = System.GetSingleton().GetRenderer();

            // if the texture already exists,
            if (renderer.IsTextureDefined(name))
            {
                System.GetSingleton().Logger
                .LogEvent("[ImageManager] WARNING: Using existing texture: " + name);
                s_texture = renderer.GetTexture(name);
            }
            else
            {
                // create texture from image
                s_texture = renderer.CreateTexture(name, filename,
                                                   String.IsNullOrEmpty(resource_group)
                                                       ? d_imagesetDefaultResourceGroup
                                                       : resource_group);
            }

            // set native resolution for imageset
            s_nativeResolution = new Sizef(attributes.GetValueAsFloat(ImagesetNativeHorzResAttribute, 640),
                                           attributes.GetValueAsFloat(ImagesetNativeVertResAttribute, 480));

            // set auto-scaling as needed
            s_autoScaled =
                PropertyHelper.FromString <AutoScaledMode>(attributes.GetValueAsString(ImagesetAutoScaledAttribute,
                                                                                       "false"));
        }
        public AnimationKeyFrameHandler(XMLAttributes attributes, Affector affector)
        {
            //throw new NotImplementedException();
            var progressionStr = attributes.GetValueAsString(ProgressionAttribute);

            var logEvent = new StringBuilder("\t\tAdding KeyFrame at position: " +
                                             attributes.GetValueAsString(PositionAttribute) +
                                             "  Value: " +
                                             attributes.GetValueAsString(ValueAttribute));

            if (!string.IsNullOrEmpty(progressionStr))
            {
                logEvent.Append("  Progression: " + attributes.GetValueAsString(ProgressionAttribute, ProgressionLinear));
            }

            Logger.LogInsane(logEvent.ToString());

            KeyFrame.Progression progression;
            if (progressionStr == ProgressionDiscrete)
            {
                progression = KeyFrame.Progression.Discrete;
            }
            else if (progressionStr == ProgressionQuadraticAccelerating)
            {
                progression = KeyFrame.Progression.QuadraticAccelerating;
            }
            else if (progressionStr == ProgressionQuadraticDecelerating)
            {
                progression = KeyFrame.Progression.QuadraticDecelerating;
            }
            else
            {
                progression = KeyFrame.Progression.Linear;
            }

            affector.CreateKeyFrame(
                attributes.GetValueAsFloat(PositionAttribute),
                attributes.GetValueAsString(ValueAttribute),
                progression,
                attributes.GetValueAsString(SourcePropertyAttribute));

            if (affector.GetNumKeyFrames() == 1 && !string.IsNullOrEmpty(progressionStr))
            {
                System.GetSingleton().Logger
                .LogEvent("WARNING: progression type specified for first keyframe in animation will be ignored.");
            }

            d_completed = true;
        }
Exemplo n.º 17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attributes"></param>
 public BitmapImage(XMLAttributes attributes)
     : this(attributes.GetValueAsString(ImageNameAttribute),
            System.GetSingleton().GetRenderer()
            .GetTexture(attributes.GetValueAsString(ImageTextureAttribute)),
            new Rectf(new Lunatics.Mathematics.Vector2(attributes.GetValueAsInteger(ImageXPosAttribute),
                                                       attributes.GetValueAsInteger(ImageYPosAttribute)),
                      new Sizef(attributes.GetValueAsInteger(ImageWidthAttribute),
                                attributes.GetValueAsInteger(ImageHeightAttribute))),
            new Lunatics.Mathematics.Vector2(attributes.GetValueAsInteger(ImageXOffsetAttribute),
                                             attributes.GetValueAsInteger(ImageYOffsetAttribute)),
            PropertyHelper.FromString <AutoScaledMode>(attributes.GetValueAsString(ImageAutoScaledAttribute)),
            new Sizef(attributes.GetValueAsInteger(ImageNativeHorzResAttribute, 640),
                      attributes.GetValueAsInteger(ImageNativeVertResAttribute, 480)))
 {
 }
Exemplo n.º 18
0
        /// <summary>
        /// throw exception if file version is not supported.
        /// </summary>
        /// <param name="attrs"></param>
        private void ValidateFontFileVersion(XMLAttributes attrs)
        {
            string version = (attrs.GetValueAsString(FontVersionAttribute, "unknown"));

            if (version == NativeVersion)
            {
                return;
            }

            throw new InvalidRequestException(
                      "You are attempting to load a font of version '" + version + "' but " +
                      "this CEGUI version is only meant to load fonts of version '" +
                      NativeVersion + "'. Consider using the migrate.py script bundled with " +
                      "CEGUI Unified Editor to migrate your data.");
        }
Exemplo n.º 19
0
        private void CreateFntFont(XMLAttributes attributes)
        {
            var name          = attributes.GetValueAsString(FontNameAttribute);
            var filename      = attributes.GetValueAsString(FontFilenameAttribute);
            var resourceGroup = attributes.GetValueAsString(FontResourceGroupAttribute);

            Logger.LogInsane("---- CEGUI font name: " + name);
            Logger.LogInsane("----       Font type: Fnt");
            Logger.LogInsane("----     Source file: " + filename + " in resource group: " + (String.IsNullOrEmpty(resourceGroup) ? "(Default)" : resourceGroup));

            _font = new FntFont(
                name, filename, resourceGroup,
                PropertyHelper.FromString <AutoScaledMode>(attributes.GetValueAsString(FontAutoScaledAttribute)),
                new Sizef(attributes.GetValueAsFloat(FontNativeHorzResAttribute, 640.0f),
                          attributes.GetValueAsFloat(FontNativeVertResAttribute, 480.0f)));
        }
Exemplo n.º 20
0
        // TODO ...
        ////! container type used to hold the images.
        //typedef std::map<String, std::pair<Image*, ImageFactory*>,
        //                 StringFastLessCompare
        //                 CEGUI_MAP_ALLOC(String, Image*)> ImageMap;

        ////! ConstBaseIterator type definition.
        //typedef ConstMapIterator<ImageMap> ImageIterator;

        ///*!
        //\brief
        //    Return a ImageManager::ImageIterator object to iterate over the available
        //    Image objects.
        //*/
        //ImageIterator getIterator() const {
        // return ImageIterator(d_images.begin(), d_images.end());
        //}

        // implement chained xml handler abstract interface
        protected override void ElementStartLocal(string element, XMLAttributes attributes)
        {
            if (element == ImageElement)
            {
                ElementImageStart(attributes);
            }
            else if (element == ImagesetElement)
            {
                ElementImagesetStart(attributes);
            }
            else
            {
                System.GetSingleton().Logger.LogEvent(
                    "[ImageManager] Unknown XML element encountered: <" + element + ">", LoggingLevel.Errors);
            }
        }
Exemplo n.º 21
0
 public override void ElementStart(string element, XMLAttributes attributes)
 {
     // chained handler gets first crack at this element
     if (ChainedHandler != null)
     {
         ChainedHandler.ElementStart(element, attributes);
         // clean up if completed
         if (ChainedHandler.Completed())
         {
             CleanupChainedHandler();
         }
     }
     else
     {
         ElementStartLocal(element, attributes);
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// document processing (only care about elements, schema validates format)
 /// </summary>
 /// <param name="element"></param>
 /// <param name="attributes"></param>
 public override void ElementStart(string element, XMLAttributes attributes)
 {
     // handle root GUILayoutElement element
     if (element == GuiLayoutElement)
     {
         ElementGUILayoutStart(attributes);
     }
     // handle Window element (create window and make an entry on our "window stack")
     else if (element == Window.WindowXMLElementName)
     {
         ElementWindowStart(attributes);
     }
     // handle AutoWindow element (get an auto child from the window on top of the "window stack")
     else if (element == Window.AutoWindowXMLElementName)
     {
         ElementAutoWindowStart(attributes);
     }
     // handle UserString element (set user string for window at top of stack)
     else if (element == Window.UserStringXMLElementName)
     {
         ElementUserStringStart(attributes);
     }
     // handle Property element (set property for window at top of stack)
     else if (element == Property.XMLElementName)
     {
         ElementPropertyStart(attributes);
     }
     // handle layout import element (attach a layout to the window at the top of the stack)
     else if (element == LayoutImportElement)
     {
         elementLayoutImportStart(attributes);
     }
     // handle event subscription element
     else if (element == EventElement)
     {
         elementEventStart(attributes);
     }
     // anything else is an error which *should* have already been caught by XML validation
     else
     {
         System.GetSingleton().Logger
         .LogEvent(
             "GuiLayoutXmlHandler::startElement - Unexpected data was found while parsing the gui-layout file: '" +
             element + "' is unknown.", LoggingLevel.Errors);
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Method that handles the UserString XML element.
        /// </summary>
        /// <param name="attributes"></param>
        private void ElementUserStringStart(XMLAttributes attributes)
        {
            // Get user string name
            var userStringName = attributes.GetValueAsString(Window.UserStringNameXMLAttributeName);

            // Get user string value
            var userStringValue = String.Empty;

            if (attributes.Exists(Window.UserStringValueXMLAttributeName))
            {
                userStringValue = attributes.GetValueAsString(Window.UserStringValueXMLAttributeName);
            }

            // Short user string
            if (!String.IsNullOrEmpty(userStringValue))
            {
                d_stringItemName = null;
                try
                {
                    // need a window to be able to set properties!
                    if (d_stack.Count != 0)
                    {
                        // get current window being defined.
                        var curwindow = d_stack[d_stack.Count - 1].Item1;

                        curwindow.SetUserString(userStringName, userStringValue);
                    }
                }
                catch (Exception)
                {
                    // Don't do anything here, but the error will have been logged.
                }
            }
            // Long user string
            else
            {
                // Store name for later use
                d_stringItemName = userStringName;
                // reset the property (user string) value buffer
                d_stringItemValue = null;
            }
        }
Exemplo n.º 24
0
 public override void ElementStart(string element, XMLAttributes attributes)
 {
     // handle root Font element
     if (element == FontElement)
     {
         ElementFontStart(attributes);
     }
     // handle a Mapping element
     else if (element == MappingElement)
     {
         ElementMappingStart(attributes);
     }
     // anything else is a non-fatal error.
     else
     {
         System.GetSingleton().Logger.LogEvent("Font_xmlHandler.ElementStart: " +
                                               "Unknown element encountered: <" + element + ">",
                                               LoggingLevel.Errors);
     }
 }
Exemplo n.º 25
0
        public Image Create(XMLAttributes attributes)
        {
            var name = attributes.GetValueAsString(ImageNameAttribute);

            if (String.IsNullOrEmpty(name))
            {
                throw new InvalidRequestException("Invalid (empty) image name passed to create.");
            }

            if (d_images.ContainsKey(name))
            {
                throw new AlreadyExistsException("Image already exists: " + name);
            }

            if (!d_factories.ContainsKey(s_imagesetType))
            {
                throw new UnknownObjectException("Unknown Image type: " + s_imagesetType);
            }

            var factory = d_factories[s_imagesetType];
            var image   = factory.Create(attributes);

            // sanity check that the created image uses the name specified in the
            // attributes block
            if (image.GetName() != name)
            {
                var message = "Factory for type: " + s_imagesetType + " created Image named: " + image.GetName() +
                              ".  Was expecting name: " + name;

                factory.Destroy(image);

                throw new InvalidRequestException(message);
            }

            d_images[name] = new Tuple <Image, ImageFactory>(image, factory);

            System.GetSingleton().Logger
            .LogEvent(String.Format("[ImageManager] Created image: '{0}' (0x{1:X8}) of type: {2}", name, image.GetHashCode(), s_imagesetType));

            return(image);
        }
Exemplo n.º 26
0
        private void ElementImageStart(XMLAttributes attributes)
        {
            var image_name = s_texture.GetName() + '/' + attributes.GetValueAsString(ImageNameAttribute);

            if (IsDefined(image_name))
            {
                System.GetSingleton().Logger.LogEvent("[ImageManager] WARNING: Using existing image :" + image_name);
                return;
            }

            XMLAttributes rwAttrs = attributes;

            // rewrite the name attribute to include the texture name
            rwAttrs.Add(ImageNameAttribute, image_name);

            if (!rwAttrs.Exists(ImageTextureAttribute))
            {
                rwAttrs.Add(ImageTextureAttribute, s_texture.GetName());
            }

            if (!rwAttrs.Exists(ImagesetAutoScaledAttribute))
            {
                rwAttrs.Add(ImagesetAutoScaledAttribute, s_autoScaled.ToString());
            }

            if (!rwAttrs.Exists(ImagesetNativeHorzResAttribute))
            {
                rwAttrs.Add(ImagesetNativeHorzResAttribute,
                            s_nativeResolution.Width.ToString(CultureInfo.InvariantCulture));
            }

            if (!rwAttrs.Exists(ImagesetNativeVertResAttribute))
            {
                rwAttrs.Add(ImagesetNativeVertResAttribute,
                            s_nativeResolution.Height.ToString(CultureInfo.InvariantCulture));
            }

            DeleteChaniedHandler = false;
            ChainedHandler       = Create(rwAttrs);
        }
Exemplo n.º 27
0
        /// <summary>
        /// handles the opening Mapping XML element.
        /// </summary>
        /// <param name="attributes"></param>
        private void ElementMappingStart(XMLAttributes attributes)
        {
            if (_font == null)
            {
                throw new InvalidRequestException("Attempt to access null object.");
            }

            // double-check font type just in case - report issues as 'soft' errors
            if (_font.GetTypeName() != FontTypePixmap)
            {
                System.GetSingleton().Logger.LogEvent(
                    "Imageset_xmlHandler::elementMappingStart: <Mapping> element is " +
                    "only valid for Pixmap type fonts.", LoggingLevel.Errors);
            }
            else
            {
                ((PixmapFont)_font).DefineMapping(
                    (char)attributes.GetValueAsInteger(MappingCodepointAttribute),
                    attributes.GetValueAsString(MappingImageAttribute),
                    attributes.GetValueAsFloat(MappingHorzAdvanceAttribute, -1.0f));
            }
        }
        public AnimationDefinitionHandler(XMLAttributes attributes, string namePrefix)
        {
            _anim = null;

            var animName = namePrefix + attributes.GetValueAsString(NameAttribute);

            Logger.LogInsane(
                "Defining animation named: " +
                animName +
                "  Duration: " +
                attributes.GetValueAsString(DurationAttribute) +
                "  Replay mode: " +
                attributes.GetValueAsString(ReplayModeAttribute) +
                "  Auto start: " +
                attributes.GetValueAsString(AutoStartAttribute, "false"));

            _anim = AnimationManager.GetSingleton().CreateAnimation(animName);

            _anim.SetDuration(attributes.GetValueAsFloat(DurationAttribute));

            var replayMode = attributes.GetValueAsString(ReplayModeAttribute, ReplayModeLoop);

            if (replayMode == ReplayModeOnce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Once);
            }
            else if (replayMode == ReplayModeBounce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Bounce);
            }
            else
            {
                _anim.SetReplayMode(Animation.ReplayMode.Loop);
            }

            _anim.SetAutoStart(attributes.GetValueAsBool(AutoStartAttribute));
        }
Exemplo n.º 29
0
 //! Function that handles the WindowAlias XML element.
 private void elementWindowAliasStart(XMLAttributes attributes)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 30
0
 protected override void ElementStartLocal(string element, XMLAttributes attributes)
 {
     System.GetSingleton().Logger.LogEvent("    [Image] Unknown XML tag encountered: " + element);
 }