Exemplo n.º 1
0
 public IntroLayer()
 {
     // setup our color for the background
     Color         = new CCColor3B(CCColor4B.Red);
     Opacity       = 0;
     renderCommand = new CCCustomCommand(RenderUI);
 }
Exemplo n.º 2
0
        public IntroLayer()
            : base(CCColor4B.Blue)
        {
            renderDebugCommand = new CCCustomCommand(RenderDebug);

            InitPhysics();

            StartDebugging();

            Schedule(Run);
        }
Exemplo n.º 3
0
        private void StartDebugging()
        {
            _renderDebugCommand = new CCCustomCommand(RenderDebug);
            var debugNode = new CCDrawNode();

            AddChild(debugNode, 1000);
            _debugDraw = new Box2DDebug(debugNode, App.PTM_RATIO);

            _debugDraw.Flags = b2DrawFlags.e_shapeBit | b2DrawFlags.e_aabbBit | b2DrawFlags.e_centerOfMassBit | b2DrawFlags.e_jointBit;
            _world.SetDebugDraw(_debugDraw);
        }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 public WrappedHUD()
 {
     Opacity         = 0;
     m_rootUI        = new TRootUI();
     m_renderCommand = new CCCustomCommand(RenderUI);
 }
Exemplo n.º 5
0
        // Define a label variable

        public IntroLayer() : base(CCColor4B.Blue)
        {
            Color         = new CCColor3B(CCColor4B.Red);
            Opacity       = 0;
            renderCommand = new CCCustomCommand(RenderUI);
        }
Exemplo n.º 6
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);
        }