Esempio n. 1
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("Scale9FrameNameSpriteSheetRotatedSetCapInsetLater ...");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            blocks_scaled_with_insets.InitWithSpriteFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled_with_insets.InsetLeft  = 32;
            blocks_scaled_with_insets.InsetRight = 32;

            blocks_scaled_with_insets.PreferredSize = new CCSize(32 * 5.5f, 32 * 4);
            blocks_scaled_with_insets.Position      = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks_scaled_with_insets);
            CCLog.Log("AddChild");

            CCLog.Log("... Scale9FrameNameSpriteSheetRotatedSetCapInsetLater done.");
        }
Esempio n. 2
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);
            var    rgba    = new CCLayerRGBA();

            rgba.CascadeColorEnabled   = true;
            rgba.CascadeOpacityEnabled = true;
            AddChild(rgba);

            CCLog.Log("S9CascadeOpacityAndColor ...");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            blocks_scaled_with_insets.InitWithSpriteFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            rgba.AddChild(blocks_scaled_with_insets);
            var actions = new CCSequence(new CCFadeIn(1),
                                         new CCTintTo(1, 0, 255, 0),
                                         new CCTintTo(1, 255, 255, 255),
                                         new CCFadeOut(1));
            var repeat = new CCRepeatForever(actions);

            rgba.RunAction(repeat);
            CCLog.Log("AddChild");

            CCLog.Log("... S9CascadeOpacityAndColor done.");
        }
Esempio n. 3
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheetRotatedInsetsScaled ...");

            var blocks_scaled_with_insets = new CCScale9Sprite();

            blocks_scaled_with_insets.InitWithSpriteFrameName("blocks9.png", new CCRect(32, 32, 32, 32));
            CCLog.Log("... created");

            blocks_scaled_with_insets.ContentSize = new CCSize(96 * 4.5f, 96 * 2.5f);
            CCLog.Log("... setContentSize");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks_scaled_with_insets);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
        }
Esempio n. 4
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");

            var blocks_scaled = new CCScale9Sprite();

            blocks_scaled.InitWithSpriteFrameName("blocks9r.png");
            CCLog.Log("... created");

            blocks_scaled.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            blocks_scaled.ContentSize = new CCSize(96 * 4, 96 * 2);
            CCLog.Log("... setContentSize");

            AddChild(blocks_scaled);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
        }
        // Sprite frame name

        // A constructor with argument string already exists (filename), so create this factory method instead
        public static CCScale9Sprite SpriteWithFrameName(string spriteFrameName, CCRect capInsets)
        {
            CCScale9Sprite sprite = new CCScale9Sprite();

            sprite.InitWithSpriteFrameName(spriteFrameName, capInsets);

            return(sprite);
        }
Esempio n. 6
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("Images/ui.plist");

            float x = winSize.Width / 4;
            float y = 0 + (winSize.Height / 2);

            CCLog.Log("S9_TexturePacker ...");

            var s = new CCScale9Sprite();

            s.InitWithSpriteFrameName("button_normal.png");
            CCLog.Log("... created");

            s.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            s.ContentSize = new CCSize(14 * 16, 10 * 16);
            CCLog.Log("... setContentSize");

            AddChild(s);
            CCLog.Log("AddChild");

            x = winSize.Width * 3 / 4;

            var s2 = new CCScale9Sprite();

            s2.InitWithSpriteFrameName("button_actived.png");
            CCLog.Log("... created");

            s2.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            s2.ContentSize = new CCSize(14 * 16, 10 * 16);
            CCLog.Log("... setContentSize");

            AddChild(s2);
            CCLog.Log("AddChild");

            CCLog.Log("... S9_TexturePacker done.");
        }
Esempio n. 7
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);

            CCLog.Log("S9FrameNameSpriteSheet ...");

            var blocks = new CCScale9Sprite();

            blocks.InitWithSpriteFrameName("blocks9.png");
            CCLog.Log("... created");

            blocks.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

            AddChild(blocks);
            CCLog.Log("AddChild");

            CCLog.Log("... S9FrameNameSpriteSheet done.");
        }
        // Sprite frame name

        // A constructor with argument string already exists (filename), so create this factory method instead
        public static CCScale9Sprite SpriteWithFrameName(string spriteFrameName, CCRect capInsets)
        {
            CCScale9Sprite sprite = new CCScale9Sprite();
            sprite.InitWithSpriteFrameName(spriteFrameName, capInsets);

            return sprite;
        }