Example #1
0
 protected override void VisitRenderer(ref CCAffineTransform worldTransform)
 {
     Renderer.PushGroup();
     streakRenderCommand.GlobalDepth    = worldTransform.Tz;
     streakRenderCommand.WorldTransform = worldTransform;
     Renderer.AddCommand(streakRenderCommand);
     Renderer.PopGroup();
 }
Example #2
0
        protected override void VisitRenderer(ref CCAffineTransform worldTransform)
        {
            base.VisitRenderer(ref worldTransform);

            if (debugDraw != null && debugDraw.Flags != 0)
            {
                Renderer.AddCommand(renderDebugCommand);
            }
        }
Example #3
0
 protected override void VisitRenderer(ref CCAffineTransform worldTransform)
 {
     if (Camera != null)
     {
         layerRenderCommand.GlobalDepth    = worldTransform.Tz;
         layerRenderCommand.WorldTransform = worldTransform;
         Renderer.AddCommand(layerRenderCommand);
     }
 }
Example #4
0
        public override void Visit(ref CCAffineTransform parentWorldTransform)
        {
            if (!Visible || GameView == null)
            {
                return;
            }

            // Set camera view/proj matrix even if ChildClippingMode is None
            if (Camera != null)
            {
                var viewMatrix = Camera.ViewMatrix;
                var projMatrix = Camera.ProjectionMatrix;

                Renderer.PushLayerGroup(ref viewMatrix, ref projMatrix);
            }

            if (ChildClippingMode == CCClipMode.None)
            {
                base.Visit(ref parentWorldTransform);

                if (Camera != null)
                {
                    Renderer.PopLayerGroup();
                }

                return;
            }

            beforeDrawCommand.GlobalDepth    = float.MinValue;
            beforeDrawCommand.WorldTransform = parentWorldTransform;
            Renderer.AddCommand(beforeDrawCommand);

            VisitRenderer(ref parentWorldTransform);

            if (!noDrawChildren && Children != null)
            {
                SortAllChildren();
                var elements = Children.Elements;
                for (int i = 0, N = Children.Count; i < N; ++i)
                {
                    var child = elements[i];
                    if (child.Visible)
                    {
                        child.Visit(ref parentWorldTransform);
                    }
                }
            }

            afterDrawCommand.GlobalDepth    = float.MaxValue;
            afterDrawCommand.WorldTransform = parentWorldTransform;
            Renderer.AddCommand(afterDrawCommand);

            if (Camera != null)
            {
                Renderer.PopLayerGroup();
            }
        }
Example #5
0
        protected override void VisitRenderer(ref CCAffineTransform worldTransform)
        {
            if (texQuadDirty)
            {
                UpdateSpriteTextureQuads();
            }

            quadCommand.GlobalDepth    = worldTransform.Tz;
            quadCommand.WorldTransform = worldTransform;
            Renderer.AddCommand(quadCommand);
        }
Example #6
0
        protected override void VisitRenderer(ref CCAffineTransform worldTransform)
        {
            quadCommand.GlobalDepth    = worldTransform.Tz;
            quadCommand.WorldTransform = worldTransform;
            quadCommand.Texture        = Texture;
            quadCommand.BlendType      = BlendFunc;
            quadCommand.QuadCount      = QuadsToDraw;
            quadCommand.Quads          = TextureAtlas.Quads.Elements;

            Renderer.AddCommand(quadCommand);
        }
        protected override void VisitRenderer(ref CCAffineTransform worldTransform)
        {
            if (ParticleCount == 0)
            {
                return;
            }

            renderParticlesCommand.GlobalDepth    = worldTransform.Tz;
            renderParticlesCommand.WorldTransform = worldTransform;

            Renderer.AddCommand(renderParticlesCommand);
        }
Example #8
0
        public override void Visit(ref CCAffineTransform parentWorldTransform)
        {
            if (!Visible || Scene == null)
            {
                return;
            }

            var worldTransform       = CCAffineTransform.Identity;
            var affineLocalTransform = AffineLocalTransform;

            CCAffineTransform.Concat(ref affineLocalTransform, ref parentWorldTransform, out worldTransform);


            if (Grid != null && Grid.Active)
            {
                renderGrid.GlobalDepth = worldTransform.Tz;
                Renderer.AddCommand(renderGrid);

                renderBeginGrid.WorldTransform = worldTransform;

                Renderer.PushGroup();
                Renderer.AddCommand(renderBeginGrid);
            }

            SortAllChildren();

            VisitRenderer(ref worldTransform);

            if (Target != null)
            {
                Target.Visit(ref worldTransform);
            }

            if (Children != null)
            {
                var elements = Children.Elements;
                for (int i = 0, N = Children.Count; i < N; ++i)
                {
                    var child = elements[i];
                    if (child.Visible)
                    {
                        child.Visit(ref worldTransform);
                    }
                }
            }

            if (Grid != null && Grid.Active)
            {
                renderEndGrid.GlobalDepth = worldTransform.Tz;
                Renderer.AddCommand(renderEndGrid);
                Renderer.PopGroup();
            }
        }
Example #9
0
        public override void Visit(ref CCAffineTransform parentWorldTransform)
        {
            if (!Visible || Scene == null)
            {
                return;
            }

            var worldTransform       = CCAffineTransform.Identity;
            var affineLocalTransform = AffineLocalTransform;

            CCAffineTransform.Concat(ref affineLocalTransform, ref parentWorldTransform, out worldTransform);


            if (Grid != null && Grid.Active)
            {
                Grid.BeforeDraw();
            }

            SortAllChildren();

            VisitRenderer(ref worldTransform);

            if (Target != null)
            {
                Target.Visit(ref worldTransform);
            }

            if (Children != null)
            {
                var elements = Children.Elements;
                for (int i = 0, N = Children.Count; i < N; ++i)
                {
                    var child = elements[i];
                    if (child.Visible)
                    {
                        child.Visit(ref worldTransform);
                    }
                }
            }

            if (Grid != null && Grid.Active)
            {
                Grid.AfterDraw(this);
                Renderer.AddCommand(renderGrid);
            }
        }
Example #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="worldTransform"></param>
 protected override void VisitRenderer(ref CCAffineTransform worldTransform)
 {
     base.VisitRenderer(ref worldTransform);
     Renderer.AddCommand(m_renderCommand);
 }
Example #11
0
 protected override void VisitRenderer(ref CCAffineTransform worldTransform)
 {
     Renderer.AddCommand(new CCCustomCommand(worldTransform.Tz, worldTransform, RenderLabel));
 }
Example #12
0
 protected override void VisitRenderer(ref CCAffineTransform worldTransform)
 {
     geomRenderCommand.GlobalDepth    = worldTransform.Tz;
     geomRenderCommand.WorldTransform = worldTransform;
     Renderer.AddCommand(geomRenderCommand);
 }
Example #13
0
 protected override void VisitRenderer(ref CCAffineTransform worldTransform)
 {
     base.VisitRenderer(ref worldTransform);
     Renderer.AddCommand(new CCCustomCommand(worldTransform.Tz, worldTransform, RenderTouchPoint));
 }
        protected override void VisitRenderer(ref CCAffineTransform worldTransform)
        {
            var quadsCommand = new CCQuadCommand(worldTransform.Tz, worldTransform, Texture, BlendFunc, QuadsToDraw, TextureAtlas.Quads.Elements);

            Renderer.AddCommand(quadsCommand);
        }
Example #15
0
        void Init()
        {
            var gesture = CCEventListenerGesture.Create();

            gesture.SetSwipeThreshouldDistance(80);
            gesture.OnSwipeEnded = (swipe) =>
            {
                isSwiped = false;
                switch (swipe)
                {
                case CCEventListenerGesture.SwipeDirection.NONE:
                    break;

                case CCEventListenerGesture.SwipeDirection.UP:
                case CCEventListenerGesture.SwipeDirection.DOWN:
                case CCEventListenerGesture.SwipeDirection.LEFT:       //ふぉーるするー
                case CCEventListenerGesture.SwipeDirection.RIGHT:
                    CCLog.Log($"[OreOreLog]:{nameof(TestLayer)}{this.ZOrder}");

                    var goGame = new CCMenuItemLabel(new CCLabel("ゲームであそぶ", "Arial", 40),
                                                     _ =>
                    {
                        ChangeScene(new Loading(new GameAssetsLoader(new GameAssets())));
                        var dig = GetChildByTag(ModalMenuDialog.TAG) as ModalMenuDialog;
                        dig.Close();
                    });


                    var goTitle = new CCMenuItemLabel(new CCLabel("タイトルにもどる", "Arial", 40),
                                                      _ =>
                    {
                        ChangeScene(new Loading(new TitleAssetsLoader()));
                        var dig = GetChildByTag(ModalMenuDialog.TAG) as ModalMenuDialog;
                        dig.Close();
                    });

                    var cancel = new CCMenuItemLabel(new CCLabel("キャンセル", "Arial", 40),
                                                     _ =>
                    {
                        var dig = GetChildByTag(ModalMenuDialog.TAG) as ModalMenuDialog;
                        dig.Close();
                        RemoveChild(dig);
                        isSwiped = false;
                    });
                    var sns_share = new CCMenuItemLabel(new CCLabel("ランキングのシェア", "Arial", 40),
                                                        _ =>
                    {
                        var dig = GetChildByTag(ModalMenuDialog.TAG) as ModalMenuDialog;
                        dig.Close();
                        RemoveChild(dig);

                        void Share(CCLayer layer)
                        {
                            CCRenderTexture rt = new CCRenderTexture(VisibleBoundsWorldspace.Size, VisibleBoundsWorldspace.Size, CCSurfaceFormat.Color, CCDepthFormat.Depth24Stencil8);
                            rt.BeginWithClear(CCColor4B.Black);
                            layer.Visit();
                            rt.End();
                            rt.Sprite.Position           = VisibleBoundsWorldspace.Center;
                            CCRenderCommand shareCommand = new CCCustomCommand(
                                () => {
                                using (MemoryStream ms = new MemoryStream())
                                {
                                    //rt.Texture.SaveAsPng(ms, (int)layer.VisibleBoundsWorldspace.Size.Width, (int)layer.VisibleBoundsWorldspace.Size.Height);
                                    //ShareControl.ShareImage(ms);
                                    rt.SaveToStream(ms, CCImageFormat.Png);
                                    var _share = Xamarin.Forms.DependencyService.Get <IShareSNS>();

                                    string text = "";
                                    if (_rankingData.IsRankinCurrentPlayData)
                                    {
                                        int score = _rankingData.Ranks[_rankingData.RankinIndex].Score;
                                        if (_rankingData.RankinIndex == 0)
                                        {
                                            text = $"わたしのスコア:{score}点" +
                                                   $"\n" +
                                                   $"ハイスコア更新しました!";
                                        }
                                        else
                                        {
                                            text = $"わたしのスコア:{score}点" +
                                                   $"\n" +
                                                   $"ランキング更新しました!";
                                        }
                                    }
                                    else
                                    {
                                        text = "今のランキングです!";
                                    }

                                    string hashTag = "#撃ち続けろ";

                                    text = text + "\n" + hashTag;
                                    _share.Post(text, ms);
                                }
                            });
                            Renderer.AddCommand(shareCommand);
                        }
                        Share(this);
                        isSwiped = false;
                        return;
                    });

                    var menuItems = new[] { goGame, goTitle, sns_share, cancel };

                    var menu = new ModalMenu(menuItems)
                    {
                        Position = new CCPoint(GlobalGameData.Window_Center_X, GlobalGameData.Window_Center_Y - 30),
                    };

                    menu.AlignItemsVertically(30);

                    var dialog = new ModalMenuDialog(menu);

                    AddChild(dialog, 1, ModalMenuDialog.TAG);


                    isSwiped = true;
                    break;

                default:
                    break;
                }
            };
            AddEventListener(gesture, this.Point.First());

            var touch = new CCEventListenerTouchOneByOne();

            touch.OnTouchBegan = (_, __) =>
            {
                foreach (var label in _rankPointsLabel)
                {
                    if (label.Label.BoundingBoxTransformedToWorld.ContainsPoint(_.Location))
                    {
                        selectedMenuItem = label;
                        label.Selected   = true;
                        return(true);
                    }
                }
                return(false);
            };
            touch.OnTouchMoved = (_, __) =>
            {
                CCMenuItem current = null;
                foreach (var label in _rankPointsLabel)
                {
                    if (label.Label.BoundingBoxTransformedToWorld.ContainsPoint(_.Location))
                    {
                        current = label; break;
                    }
                }
                if (current != selectedMenuItem)
                {
                    if (selectedMenuItem != null)
                    {
                        selectedMenuItem.Selected = false;
                    }

                    if (current != null)
                    {
                        current.Selected = true;
                    }
                    selectedMenuItem = current;
                }
            };
            touch.OnTouchEnded = /*EventListener_TouchEnded*/
                                 (_, __) =>
            {
                if (selectedMenuItem != null)
                {
                    selectedMenuItem.Selected = false;
                    selectedMenuItem.Activate();
                }
            };
            AddEventListener(touch, this);

            if (_rankingData.CurrentPlayData != null)
            {
                var currentScoreLabel = new CCLabel($"あなたのスコア:{_rankingData.CurrentPlayData.Score}点", "arial", 20)
                {
                    Position    = new CCPoint(20, GlobalGameData.Window_Height - 20),
                    AnchorPoint = CCPoint.AnchorMiddleLeft
                };
                AddChild(currentScoreLabel);
                if (_rankingData.IsRankinCurrentPlayData)
                {
                    var omedetoLabel = new CCLabel("ランクインおめでとう!", "arial", 20)
                    {
                        Position = new CCPoint(380, GlobalGameData.Window_Height - 20)
                    };
                    AddChild(omedetoLabel);
                }
            }
            systemLabel = new CCLabel("スワイプ:メニューを開く  スコアを選ぶ:リプレイ", "arial", 20)
            {
                Position    = new CCPoint(20, 20),
                AnchorPoint = CCPoint.AnchorMiddleLeft,
                Visible     = false
            };
            AddChild(systemLabel);
        }