public override void cleanup()
 {
     if (_releaseBlockAtCleanup)
     {
         _block = null;
     }
     base.cleanup();
 }
示例#2
0
		protected virtual void initWithBlock(CCMenuItemDelegate block){
			if(block!=null)
				_block = block;
			this.anchorPoint = new Vector2 (0.5f, 0.5f);
			_isEnabled = true;
			_isSelected = false;

			// WARNING: Will be disabled in v2.2
			_releaseBlockAtCleanup = true;
		}
        //
        // Designated initializer
        //
        protected void initWithString(string value, CCMenuItemDelegate block)
        {
            NSUtils.Assert(value.Length > 0, "Value length must be greater than 0");

            _fontName = _globalFontName;
            _fontSize = _globalFontSize;

            CCLabelTTF label = new CCLabelTTF(value, _fontName, _fontSize);

            initWithLabel(label, block);
        }
        //
        // Designated initializer
        //
        public void initWithLabel(T label, CCMenuItemDelegate block)
        {
            base.initWithBlock(block);
            _originalScale     = 1;
            _colorBackup       = Color.white;
            this.disabledColor = new Color32(126, 126, 126, 255);
            this.label         = label;

            this.cascadeColorEnabled   = true;
            this.cascadeOpacityEnabled = true;
        }
		void initWithItems(CCMenuItem[] arrayOfItems, CCMenuItemDelegate block)
		{
			base.initWithBlock (block);
			this.subItems = new List<CCMenuItem>(new List<CCMenuItem>(arrayOfItems));
			
			_currentItem = null;
			_selectedIndex = int.MaxValue;
			this.selectedIndex = 0;
			
			this.cascadeColorEnabled = true;
			this.cascadeOpacityEnabled = true;
		}
        void initWithItems(CCMenuItem[] arrayOfItems, CCMenuItemDelegate block)
        {
            base.initWithBlock(block);
            this.subItems = new List <CCMenuItem>(new List <CCMenuItem>(arrayOfItems));

            _currentItem       = null;
            _selectedIndex     = int.MaxValue;
            this.selectedIndex = 0;

            this.cascadeColorEnabled   = true;
            this.cascadeOpacityEnabled = true;
        }
        protected virtual void initWithBlock(CCMenuItemDelegate block)
        {
            if (block != null)
            {
                _block = block;
            }
            this.anchorPoint = new Vector2(0.5f, 0.5f);
            _isEnabled       = true;
            _isSelected      = false;

            // WARNING: Will be disabled in v2.2
            _releaseBlockAtCleanup = true;
        }
示例#8
0
        void init(string normalImage, string selectedImage, string disabledImage, CCMenuItemDelegate block)
        {
            CCSprite normalSprite   = new CCSprite(normalImage);
            CCSprite selectedSprite = null;
            CCSprite disabledSprite = null;

            if (selectedImage != null)
            {
                selectedSprite = new CCSprite(selectedImage);
            }
            if (disabledImage != null)
            {
                disabledSprite = new CCSprite(disabledImage);
            }
            base.init(normalSprite, selectedSprite, disabledSprite, block);
        }
示例#9
0
 public CCMenuItemSprite(T normalSprite, T selectedSprite, T disabledSprite = null, CCMenuItemDelegate block = null)
 {
     init(normalSprite, selectedSprite, disabledSprite, block);
 }
		public CCMenuItemToggle(CCMenuItemDelegate block, params CCMenuItem[] items){
			initWithItems (items, block);
		}
 public CCMenuItemToggle(CCMenuItemDelegate block, params CCMenuItem[] items)
 {
     initWithItems(items, block);
 }
 /** Sets the block that is called when the item is tapped.
  * The block will be "copied".
  */
 public void setBlock(CCMenuItemDelegate block)
 {
     _block = block;
 }
 public CCMenuItem(CCMenuItemDelegate selector)
 {
     initWithBlock(selector);
 }
示例#14
0
		/** Sets the block that is called when the item is tapped.
		 The block will be "copied".
		 */
		public void setBlock(CCMenuItemDelegate block){
			_block = block;
		}
示例#15
0
		public override void cleanup ()
		{
			if( _releaseBlockAtCleanup ) {
				_block = null;
			}
			base.cleanup ();
		}
 public CCMenuItemLabel(T label, CCMenuItemDelegate block = null)
 {
     initWithLabel(label, block);
 }
示例#17
0
 public CCMenuItemImage(string normalImage, string selectedImage, CCMenuItemDelegate block)
 {
     init(normalImage, selectedImage, null, block);
 }
示例#18
0
 public CCMenuItemImage(string normalImage, string selectedImage, string disabledImage = null, CCMenuItemDelegate block = null)
 {
     init(normalImage, selectedImage, disabledImage, block);
 }
 /** creates a menu item from a string with the specified block.
  * The block will be "copied".
  */
 public CCMenuItemFont(string value, CCMenuItemDelegate block)
 {
     initWithString(value, block);
 }
示例#20
0
        protected virtual void init(T normalSprite, T selectedSprite, T disabledSprite = null, CCMenuItemDelegate block = null)
        {
            base.initWithBlock(block);
            this.normalImage   = normalSprite;
            this.selectedImage = selectedSprite;
            this.disabledImage = disabledSprite;

            this.contentSize = _normalImage.contentSize;

            this.cascadeColorEnabled   = true;
            this.cascadeOpacityEnabled = true;
        }
示例#21
0
		public CCMenuItem(CCMenuItemDelegate selector){
			initWithBlock (selector);
		}