public override void OnEnter() { base.OnEnter(); var s = VisibleBoundsWorldspace.Size; menuLeft.Position = new CCPoint(50, s.Height / 2 - 20); menuRight.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20); alignmentLabel = null; horizontalAlign = CCTextAlignment.Left; verticalAlign = CCVerticalTextAlignment.Top; blockSize = new CCSize(s.Width / 3, s.Height / 2); //blockSize = new CCSize(50, 50); var leftPanel = new AlignmentPanel(blockSize, new CCColor4B(100, 100, 100, 255)); var centerPanel = new AlignmentPanel(blockSize, new CCColor4B(200, 100, 100, 255)); var rightPanel = new AlignmentPanel(blockSize, new CCColor4B(100, 100, 200, 255)); leftPanel.IgnoreAnchorPointForPosition = false; centerPanel.IgnoreAnchorPointForPosition = false; rightPanel.IgnoreAnchorPointForPosition = false; leftPanel.AnchorPoint = new CCPoint(0, 0.5f); centerPanel.AnchorPoint = new CCPoint(0, 0.5f); rightPanel.AnchorPoint = new CCPoint(0, 0.5f); leftPanel.Position = new CCPoint(0, s.Height / 2); centerPanel.Position = new CCPoint(blockSize.Width, s.Height / 2); rightPanel.Position = new CCPoint(blockSize.Width * 2, s.Height / 2); AddChild(leftPanel, -1); AddChild(rightPanel, -1); AddChild(centerPanel, -1); updateAlignment(); }
public override void OnEnter() { base.OnEnter(); var s = VisibleBoundsWorldspace.Size; menuLeft.Position = new CCPoint(50, s.Height / 2 - 20); menuRight.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20); alignmentLabel = null; horizontalAlign = CCTextAlignment.Left; verticalAlign = CCVerticalTextAlignment.Top; blockSize = new CCSize(s.Width / 3, s.Height / 2); var leftPanel = new AlignmentPanel(blockSize, new CCColor4B(100, 100, 100, 255)); var centerPanel = new AlignmentPanel(blockSize, new CCColor4B(200, 100, 100, 255)); var rightPanel = new AlignmentPanel(blockSize, new CCColor4B(100, 100, 200, 255)); leftPanel.IgnoreAnchorPointForPosition = false; centerPanel.IgnoreAnchorPointForPosition = false; rightPanel.IgnoreAnchorPointForPosition = false; leftPanel.AnchorPoint = CCPoint.AnchorMiddleLeft; centerPanel.AnchorPoint = CCPoint.AnchorMiddleLeft; rightPanel.AnchorPoint = CCPoint.AnchorMiddleLeft; leftPanel.Position = new CCPoint(0, s.Height / 2); centerPanel.Position = new CCPoint(blockSize.Width, s.Height / 2); rightPanel.Position = new CCPoint(blockSize.Width * 2, s.Height / 2); AddChild(leftPanel, -1); AddChild(rightPanel, -1); AddChild(centerPanel, -1); updateAlignment(); }