Пример #1
0
        public override bool TouchesBegan(Microsoft.Xna.Framework.Input.MouseState touch, Point point)
        {
            if (_gameStart)
            {
                for (int i = 0; i < WireShowLayer.SharedWireShow().RevolutionAnchors.Count; i++)
                {
                    RevolutionAnchor revolution = WireShowLayer.SharedWireShow().RevolutionAnchors[i];
                    if (revolution.Sprite.InTapInside(point))
                    {
                        revolution.ClockwiseRotate();
                        return false;
                    }
                }
                for (int i = 0; i < WireShowLayer.SharedWireShow().Wires.Count; i++)
                {
                    var wire = WireShowLayer.SharedWireShow().Wires[i];
                    if (wire.Sprite.InTapInside(point))
                    {
                        wire.ChangeWireDirection();
                    }
                }
            }
            else
            {
                if (!_isfirst)
                {
                    if (_fistRect.Contains(point))
                    {
                        var wire = WireShowLayer.SharedWireShow().WireDictionary[new IntVector(8, 3)];
                        wire.ChangeWireDirection();
                        if (wire.WireDir == WireDirection.WireRight)
                        {
                            TeachingScene.ShardMainGame()._tapTip.Visible = false;
                            for (int i = 0; i < ZombieShowLayer.SharedZombieShow().Actors.Count; i++)
                            {
                                ZombieShowLayer.SharedZombieShow().Actors[i].GoRun();
                            }
                            IsTouchEnable = false;
                            _isfirst = true;
                        }
                    }
                }

                if (!_issecond)
                {
                    if (_secondRect.Contains(point))
                    {
                        var wire = WireShowLayer.SharedWireShow().WireDictionary[new IntVector(4, 4)];
                        wire.ChangeWireDirection();
                        if (wire.WireDir == WireDirection.WireRight)
                        {
                            TeachingScene.ShardMainGame()._tapTip.Visible = false;
                            for (int i = 0; i < ZombieShowLayer.SharedZombieShow().Actors.Count; i++)
                            {
                                ZombieShowLayer.SharedZombieShow().Actors[i].GoRun();
                            }
                            IsTouchEnable = false;
                            _issecond = true;
                        }
                        else
                        {
                            TeachingScene.ShardMainGame()._tapTip.Position = new Vector2(415, 533);
                            TeachingScene.ShardMainGame()._tapTip.RunAction(MGJumpBy.ActionWithDuration(.8f, new Vector2(0, 10), 10, 3));
                        }
                    }
                }

                if (!_isthird)
                {
                    if (_thirdRect.Contains(point))
                    {
                        var wire = WireShowLayer.SharedWireShow().WireDictionary[new IntVector(0, 5)];
                        wire.ChangeWireDirection();
                        if (wire.WireDir == WireDirection.WireUp)
                        {
                            TeachingScene.ShardMainGame()._tapTip.Visible = false;

                            TeachingScene.ShardMainGame().ActorStopTipChangeWire(new Vector2(560, 491));
                            _isfourth = false;
                            _isthird = true;
                        }
                        else
                        {
                            TeachingScene.ShardMainGame()._tapTip.Position = new Vector2(415, 533);
                            TeachingScene.ShardMainGame()._tapTip.RunAction(MGJumpBy.ActionWithDuration(.8f, new Vector2(0, 10), 10, 3));
                        }
                    }
                }

                if (!_isfourth)
                {
                    if (_fourthRect.Contains(point))
                    {
                        for (int i = 0; i < WireShowLayer.SharedWireShow().RevolutionAnchors.Count; i++)
                        {
                            RevolutionAnchor revolution = WireShowLayer.SharedWireShow().RevolutionAnchors[i];
                            if (revolution.Sprite.InTapInside(point))
                            {
                                revolution.ClockwiseRotate();
                                TeachingScene.ShardMainGame()._tapTip.Visible = false;
                                Actor actor = new ActorNormal();
                                ZombieShowLayer.SharedZombieShow().AddChild(actor);
                                actor.Run();
                                MGSprite sprite = MGSprite.MGSpriteWithFilename("images/go");
                                AddChild(sprite);
                                sprite.Anchor = new Vector2(.5f, 1);
                                sprite.Position = new Vector2(491, 0);

                                MGSprite txt = MGSprite.MGSpriteWithFilename("images/tiptxt1");
                                sprite.AddChild(txt);
                                txt.Position = new Vector2(0, 239);

                                MGSprite go = MGSprite.MGSpriteWithFilename("images/txtgo");
                                sprite.AddChild(go);
                                go.Position = new Vector2(0, 71);

                                sprite.RunAction(MGSequence.Actions(MGMoveTo.ActionWithDuration(.4f, new Vector2(491, 209)), MGDelay.ActionWithDuration(2.1f), MGMoveTo.ActionWithDuration(.2f, new Vector2(491, 1000)), MGCallFunc.ActionWithTarget(() => RemoveChild(sprite))));
                                _gameStart = true;
                                _isfourth = true;
                                return false;
                            }
                        }
                    }
                }

                if (TeachingScene.ShardMainGame()._actorIsMoveing && !TeachingScene.ShardMainGame().ShowHelp)
                {
                    if (_helpRect.Contains(point))
                    {
                        _isShowHelpTouch = true;
                    }
                }
            }

            return base.TouchesBegan(touch, point);
        }
Пример #2
0
        public override void Update(float time)
        {
            if (!_fist)
            {
                if ((_timeLeft1 -= time) < 0)
                {
                    _fist = true;

                    MGSprite sprite = MGSprite.MGSpriteWithFilename("images/go");
                    AddChild(sprite);
                    sprite.Anchor = new Vector2(.5f, 1);
                    sprite.Position = new Vector2(491, 0);
                    MGSprite txt = MGSprite.MGSpriteWithFilename("images/tiptxt2");
                    sprite.AddChild(txt);
                    txt.Position = new Vector2(0, 264);

                    MGSprite go = MGSprite.MGSpriteWithFilename("images/txtgo");
                    sprite.AddChild(go);
                    go.Position = new Vector2(0, 131);

                    sprite.RunAction(MGSequence.Actions(MGMoveTo.ActionWithDuration(.4f, new Vector2(491, 209)), MGDelay.ActionWithDuration(4.1f), MGMoveTo.ActionWithDuration(.2f, new Vector2(491, 1000)), MGCallFunc.ActionWithTarget(() =>
                    {
                        RemoveChild(sprite);

                        var tip = MGSprite.MGSpriteWithFilename("Images/tipZombie");
                        AddChild(tip);
                        tip.Position = new Vector2(GameConfig.WidthX + .3f, 3.5f) * 94 + GameConfig.RelativeOrigin;
                        var scale = MGSequence.Actions(MGScaleTo.ActionWithDuration(.2f, 1.1f), MGDelay.ActionWithDuration(.2f), MGScaleTo.ActionWithDuration(.2f, .95f), MGDelay.ActionWithDuration(.2f));
                        tip.RunAction(MGSequence.Actions(MGRepeat.Actions(scale, 8), new MGHide(), MGCallFunc.ActionWithTarget(() => { RemoveChild(tip); })));

                    })));

                    Zombie.Actor actor = new ActorNormal(3);
                    actor.Vector = new IntVector();
                    ZombieShowLayer.SharedZombieShow().AddChild(actor);
                    actor.Run();
                    actors.Add(actor);
                }
            }
            if (!_actorIsComeing)
            {
                for (int i = 0; i < actors.Count; i++)
                {
                    if (actors[i].Position.X <= 1024)
                    {
                        ActorStopTipChangeWire(new Vector2(794, 445));
                        _actorIsComeing = true;
                    }
                }
            }

            if (_actorIsComeing && !_actorIsMoveing)
            {
                for (int i = 0; i < actors.Count; i++)
                {
                    if (actors[i].Vector == new IntVector(5, 4))
                    {
                        _actorIsMoveing = true;
                        actors[i].Stop();
                        HelpLayer.SharedHelp().ChangeHelpShow();
                        touchLayer.IsTouchEnable = true;
                    }
                }
            }

            if (_fist && !_second)
            {
                for (int i = 0; i < actors.Count; i++)
                {
                    if (actors[i].AtVector == new IntVector(5, 4))
                    {
                        actors[i].Stop();
                        ActorStopTipChangeWire(new Vector2(415, 533));
                        _second = true;
                        touchLayer.IsTouchEnable = true;
                    }
                }
            }

            if (!_third && _second)
            {
                for (int i = 0; i < actors.Count; i++)
                {
                    if (actors[i].AtVector == new IntVector(2, 5))
                    {
                        actors[i].Stop();
                        ActorStopTipChangeWire(new Vector2(36, 633));
                        _third = true;
                        touchLayer.IsTouchEnable = true;
                    }
                }
            }

            base.Update(time);
        }