Exemplo n.º 1
0
        public EntityClassAttribute(string name = "", string category = "Game", string helper = null, IconType icon = IconType.None, bool hide = false)
        {
            Name       = name;
            EditorPath = category;
            Helper     = helper;
            Hide       = hide;
            //get icon path attribute bounded to the icon path enum (if available)
            var enumType          = icon.GetType();
            var enumMemberInfo    = enumType.GetMember(icon.ToString());
            var iconPathAttribute = (IconPathAttribute)enumMemberInfo[0].GetCustomAttributes(typeof(IconPathAttribute), true)[0];

            Icon = iconPathAttribute == null ? "": iconPathAttribute.Path;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Used to specify specific parameters for entity components. If a parameter is not set, a default value will be set by the engine.
        /// The <paramref name="icon"/> parameter is not optionally and should be set to a value of <see cref="IconType"/>.
        /// If it is set to <see cref="IconType.None"/> it will still receive an icon in the Sandbox by default.
        /// Default name is the entity component class name.
        /// Default category is General.
        /// Default description will be empty.
        /// Default guid will be retrieved from a GUID-attribute if available. Otherwise it will be generated based on the class's fullname.
        /// </summary>
        /// <param name="icon"></param>
        /// <param name="uiName">The name of the component as it will be shown in the Sandbox.</param>
        /// <param name="category">The category in the Create Object and Add Component menu of the Sandbox that this component will be shown in.</param>
        /// <param name="description">Description of the component that will be shown in tooltips.</param>
        /// <param name="guid">GUID in the format of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX</param>
        public EntityComponentAttribute(IconType icon, string uiName = "", string category = "", string description = "", string guid = "")
        {
            Name        = uiName;
            Category    = category;
            Description = description;
            Guid        = guid;

            // Get the icon path attribute bounded to the icon path enum (if available)
            var enumType          = icon.GetType();
            var enumMemberInfo    = enumType.GetMember(icon.ToString());
            var iconPathAttribute = (IconPathAttribute)enumMemberInfo[0].GetCustomAttributes(typeof(IconPathAttribute), true)[0];

            Icon = iconPathAttribute == null ? "" : (iconPathAttribute.Path ?? "");
        }
Exemplo n.º 3
0
        public VectorGraphicBuilder SetTwoToneColors(string color1, string color2)
        {
            if (iconType.GetType() != typeof(IconType.TwoTone))
            {
                return(this);
            }

            var primaryColor   = DeterminePrimaryColor(color1);
            var secondaryColor = DetermineSecondaryColor(color2);

            foreach (XElement element in xdoc.Root.Elements())
            {
                var color = element.Attribute("fill");
                if (color is null || color?.Value == "#333")
                {
                    element.SetAttributeValue("fill", primaryColor);
                }
Exemplo n.º 4
0
        /// <summary>
        /// Plays the given system sound.
        /// </summary>
        /// <param name="iconType"></param>
        public static void PlaySound(IconType iconType)
        {
            switch (iconType)
            {
            case IconType.Warning:
                PlaySound(SystemSound.Warning);
                break;

            case IconType.Error:
                PlaySound(SystemSound.Error);
                break;

            default:
                throw new NotSupportedException(string.Format("Cannot handle '{0}' ({1}).", iconType, iconType.GetType()));
            }
        }