コード例 #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            var leftColor = new Background(blockSize, new CCColor4B(100, 100, 100, 255));
            var centerColor = new Background(blockSize, new CCColor4B(200, 100, 100, 255));
            var rightColor = new Background(blockSize, new CCColor4B(100, 100, 200, 255));

            leftColor.IgnoreAnchorPointForPosition = false;
            centerColor.IgnoreAnchorPointForPosition = false;
            rightColor.IgnoreAnchorPointForPosition = false;

            leftColor.AnchorPoint = new CCPoint(0, 0.5f);
            centerColor.AnchorPoint = new CCPoint(0, 0.5f);
            rightColor.AnchorPoint = new CCPoint(0, 0.5f);

            leftColor.Position = new CCPoint(0, visibleRect.Height / 2);
            centerColor.Position = new CCPoint(blockSize.Width, visibleRect.Height / 2);
            rightColor.Position = new CCPoint(blockSize.Width * 2, visibleRect.Height / 2);

            AddChild(leftColor, -1);
            AddChild(rightColor, -1);
            AddChild(centerColor, -1);

            showFont(SystemFontTestScene.restartAction());
        }
コード例 #2
0
ファイル: FontTest.cs プロジェクト: kkarol93/CocosSharp
        public override void OnEnter()
        {
            base.OnEnter();

            var s = VisibleBoundsWorldspace.Size;

            var blockSize = new CCSize(s.Width / 3, s.Height / 2);
            //blockSize = new CCSize(50, 50);
            var leftColor = new Background(blockSize, new CCColor4B(100, 100, 100, 255));
            var centerColor = new Background(blockSize, new CCColor4B(200, 100, 100, 255));
            var rightColor = new Background(blockSize, new CCColor4B(100, 100, 200, 255));

            leftColor.IgnoreAnchorPointForPosition = false;
            centerColor.IgnoreAnchorPointForPosition = false;
            rightColor.IgnoreAnchorPointForPosition = false;

            leftColor.AnchorPoint = new CCPoint(0, 0.5f);
            centerColor.AnchorPoint = new CCPoint(0, 0.5f);
            rightColor.AnchorPoint = new CCPoint(0, 0.5f);

            leftColor.Position = new CCPoint(0, s.Height / 2);
            centerColor.Position = new CCPoint(blockSize.Width, s.Height / 2);
            rightColor.Position = new CCPoint(blockSize.Width * 2, s.Height / 2);

            AddChild(leftColor, -1);
            AddChild(rightColor, -1);
            AddChild(centerColor, -1);

            showFont(FontTestScene.restartAction());
        }