Пример #1
0
        /// <summary>
        /// Creates a new gui switch object.
        /// </summary>
        /// <param name="textureOn">Texture to use if switch is turned on.</param>
        /// <param name="textureOff">Texture to use if switch is turned off.</param>
        /// <param name="textureHoverOn">Texture to use if switch is hovered and turned on.</param>
        /// <param name="textureHoverOff">Texture to use if switch is hovered and turned off.</param>
        /// <param name="textureDisabledOn">Texture to use if switch is disabled and turned on.</param>
        /// <param name="textureDisabledOff">Texture to use if switch is disabled and turned off.</param>
        public GuiSwitch(ITexture2d textureOn, ITexture2d textureOff, ITexture2d textureHoverOn,
                         ITexture2d textureHoverOff, ITexture2d textureDisabledOn, ITexture2d textureDisabledOff)
            : base(textureOn)
        {
            if (textureOn == null)
            {
                throw new ArgumentNullException("textureOn");
            }
            if (textureOff == null)
            {
                throw new ArgumentNullException("textureOff");
            }

            this.textureOn           = textureOn;
            this.textureOff          = textureOff;
            this.textureDisabledOn   = textureDisabledOn;
            this.textureDissabledOff = textureDisabledOff;
            this.textureHoverOn      = textureHoverOn;
            this.textureHoverOff     = textureHoverOff;

            buttonLogic  = new ButtonLogic();
            checkedValue = true;
        }