public static CCControlColourPicker Create() { var pRet = new CCControlColourPicker(); pRet.Init(); return(pRet); }
public override bool Init() { if (base.Init()) { CCSize screenSize = CCDirector.SharedDirector.WinSize; CCNode layer = new CCNode(); layer.Position = new CCPoint(screenSize.Width / 2, screenSize.Height / 2); AddChild(layer, 1); float layer_width = 0; // Create the colour picker CCControlColourPicker colourPicker = new CCControlColourPicker(); colourPicker.Color = new CCColor3B(37, 46, 252); colourPicker.Position = new CCPoint(colourPicker.ContentSize.Width / 2, 0); // Add it to the layer layer.AddChild(colourPicker); // Add the target-action pair colourPicker.AddTargetWithActionForControlEvents(this, ColourValueChanged, CCControlEvent.ValueChanged); layer_width += colourPicker.ContentSize.Width; // Add the black background for the text CCScale9Sprite background = new CCScale9SpriteFile("extensions/buttonBackground.png"); background.ContentSize = new CCSize(150, 50); background.Position = new CCPoint(layer_width + background.ContentSize.Width / 2.0f, 0); layer.AddChild(background); layer_width += background.ContentSize.Width; _colorLabel = new CCLabelTTF("#color", "Arial", 26); _colorLabel.Position = background.Position; layer.AddChild(_colorLabel); // Set the layer size layer.ContentSize = new CCSize(layer_width, 0); layer.AnchorPoint = new CCPoint(0.5f, 0.5f); // Update the color text ColourValueChanged(colourPicker, CCControlEvent.ValueChanged); return true; } return false; }
public static CCControlColourPicker Create() { var pRet = new CCControlColourPicker(); pRet.Init(); return pRet; }