Esempio n. 1
0
 public override void SetTarget(MGNode node)
 {
     this.FirstTick = true;
     this._isEnd = false;
     this.Target = node;
     this.OrgPos = node.Position;
 }
Esempio n. 2
0
        public MainGameScene()
        {
            _shardMainGame = this;
            MainGameLogic.SharedMainGameLogic().IsGameStart = true;

            CardShow = new MGNode();

            _bg_day_sky = MGSprite.MGSpriteWithSpriteFrameName("白天天空.png");
            AddChild(_bg_day_sky);
            _bg_day_sky.Anchor = new Vector2(.5f, 0);
            _bg_day_sky.Position = new Vector2(1366 / 2f, 768f);

            _bg_night_sky = MGSprite.MGSpriteWithSpriteFrameName("晚上天空.png");
            AddChild(_bg_night_sky);
            _bg_night_sky.Anchor = new Vector2(.5f, 0);
            _bg_night_sky.Position = new Vector2(1366 / 2f, 768f);
            _bg_night_sky.Visible = false;

            sunSprite = MGSprite.MGSpriteWithSpriteFrameName("日.png");
            moonSprite = MGSprite.MGSpriteWithSpriteFrameName("月.png");

            AddChild(sunSprite);
            AddChild(moonSprite);
            sunSprite.Position = new Vector2(1133, 716);
            moonSprite.Position = new Vector2(1133, 536);
            //moonSprite.Visible = false;

            _bg_day = MGSprite.MGSpriteWithFilename("Images/bg_day_main");
            AddChild(_bg_day);
            _bg_day.Anchor = new Vector2(0, 1);
            //_bg_day.Visible = false;

            _bg_night = MGSprite.MGSpriteWithFilename("Images/bg_night_main");
            AddChild(_bg_night);
            _bg_night.Anchor = new Vector2(0, 1);
            _bg_night.Visible = false;

            AddChild(WireShowLayer.SharedWireShow());
            WireShowLayer.SharedWireShow().Init();

            AddChild(Card.CardShowLayer.SharedCardShow());
            Card.CardShowLayer.SharedCardShow().Init();

            AddChild(Zombie.ZombieShowLayer.SharedZombieShow());
            Zombie.ZombieShowLayer.SharedZombieShow().Init();

            CoverLayer = new MGColorLayer(new Rectangle(0, 0, Config.ORI_WIN_HEIGHT, Config.ORI_WIN_WIDTH));
            AddChild(CoverLayer);
            CoverLayer.Opacity = 200;
            CoverLayer.SetColor(150, 150, 150);
            CoverLayer.Visible = false;

            var box = new Box();
            AddChild(box);
            box.Position = new Vector2(0, 768 - 55);
            AddChild(CardShow);

            AddChild(new TouchLayer());
        }
Esempio n. 3
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     StartScale = node.Scale;
     Delta = StartScale - EndScale;
 }
Esempio n. 4
0
 public MGMenuItemSprite()
     : base()
 {
     m_pNormalImage = null;
     m_pSelectedImage = null;
     m_pDisabledImage = null;
     //Anchor = new Vector2(0.5f, 0.5f);
 }
Esempio n. 5
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     OrgPos = node.Position;
     Diff = Pos - OrgPos;
 }
Esempio n. 6
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     OrgFS = (Target as MGSprite).FS;
     ((MGSprite)Target).AddAnimation(Anim);
 }
Esempio n. 7
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     OrgPos = node.Position;
     Delta = new Vector2(Delta.X - OrgPos.X, Delta.Y - OrgPos.Y);
 }
Esempio n. 8
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     this.m_from = node.Color;
     base.SetTarget(node);
 }
Esempio n. 9
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     StartPosition = Target.Position;
     A = (RefPoint.Y/RefPoint.X - Delta.Y/Delta.X)/(RefPoint.X - Delta.X);
     B = Delta.Y/Delta.X - (Delta.X + 2f*StartPosition.X)*A;
     C = StartPosition.Y - A*StartPosition.X*StartPosition.X - B*StartPosition.X;
 }
Esempio n. 10
0
 public override void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
     foreach (MGAction current in ActionList)
     {
         current.SetTarget(Target);
     }
 }
Esempio n. 11
0
        public HelpLayer()
        {
            Help1 = new MGNode();
            AddChild(Help1);
            Help2 = new MGNode();
            AddChild(Help2);
            Help3 = new MGSprite();
            AddChild(Help3);

            var help1Sprite = MGSprite.MGSpriteWithFilename("images/help1");
            Help1.AddChild(help1Sprite);
            help1Sprite.Position = new Vector2(77 + 851 / 2f, 657 - 601 / 2f);
            CreatLamp(Help1, new Vector2(381, 555), new Vector2(238, 555), new Vector2(239, 444), -90);
            CreatLamp(Help1, new Vector2(820, 183), new Vector2(643, 183), new Vector2(640, 312), 90);
            CreatLamp(Help1, new Vector2(442, 212), new Vector2(221, 212));
            CreatLamp(Help1, new Vector2(805, 532), new Vector2(579, 532));
            Help1.Visible = false;

            var help2Sprite = MGSprite.MGSpriteWithFilename("images/help2");
            Help2.AddChild(help2Sprite);
            help2Sprite.Position = new Vector2(77 + 851 / 2f, 657 - 601 / 2f);
            CreatLamp(Help2, new Vector2(328, 411), new Vector2(203, 411), new Vector2(203, 577), 90);
            CreatLamp(Help2, new Vector2(772, 320), new Vector2(674, 320), new Vector2(674, 181), -90);
            CreatLamp(Help2, new Vector2(451, 181), new Vector2(235, 181));
            CreatLamp(Help2, new Vector2(775, 543), new Vector2(557, 543));
            Help2.Visible = false;

            var help3Sprite = MGSprite.MGSpriteWithFilename("images/help3");
            Help3.AddChild(help3Sprite);
            help3Sprite.Position = new Vector2(77 + 851 / 2f, 657 - 601 / 2f);
            CreatLamp(Help3, new Vector2(410, 516), new Vector2(224, 516));
            CreatLamp(Help3, new Vector2(410, 371), new Vector2(230, 371));
            CreatLamp(Help3, new Vector2(424, 209), new Vector2(205, 209));
            CreatLamp(Help3, new Vector2(786, 556), new Vector2(611, 556));
            CreatLamp(Help3, new Vector2(786, 435), new Vector2(611, 435));
            CreatLamp(Help3, new Vector2(810, 315), new Vector2(637, 315));
            CreatLamp(Help3, new Vector2(793, 191), new Vector2(624, 191));
            Help3.Visible = false;

            understand = MGSprite.MGSpriteWithFilename("images/understand");
            AddChild(understand);
            understand.Position = new Vector2(517 + 411 / 2f, 86 - 75 / 2f);
            understand.Visible = false;
        }
Esempio n. 12
0
 public MGNode()
 {
     _parent = null;
     ZOrder = 0;
     Visible = true;
     _position.X = 0f;
     _position.Y = 0f;
     _rotation = 0f;
     _scale.X = 1f;
     _scale.Y = 1f;
     _opacity = 255f;
     Left = 0f;
     Top = 0f;
     Height = 0f;
     Width = 0f;
     _color = new Color(255, 255, 255, 255);
     ActionList = new List<MGAction>();
     ChildList = new List<MGNode>();
     TransformDirty = true;
     _blendState = BlendState.AlphaBlend;
     IsTouchEnable = false;
 }
Esempio n. 13
0
 public void CreatLamp(MGNode basenode, Vector2 point, Vector2 vector1)
 {
     var lamp1 = new LampLayer();
     basenode.AddChild(lamp1);
     lamp1.Position = point;
     var move1 = MGMoveTo.ActionWithDuration(4.4f, vector1);
     lamp1.RunAction(MGRepeatForever.Actions(MGSequence.Actions(move1, MGCallFunc.ActionWithTarget(() =>
     {
         lamp1.Rotation = 0;
         lamp1.Position = point;
     }))));
 }
Esempio n. 14
0
 public PartInstance(MGNode parent, Part part)
 {
     _part = part;
     StateIdx = -1;
     _frame = 0;
     _time = 0f;
     _preFrameTime = 0f;
     _timeInterval = 0f;
     if (_part.Type == Part.PartType.PartTypeImage)
     {
         _node = new MGSprite(part.Images[0].uniqueID);
         parent.AddChild(_node, part.ZAxis);
         if (part.Images.Count > 1)
         {
             var animation = new MGAnimation("P", 0.5f);
             for (int i = 0; i < part.Images.Count; i++)
             {
                 animation.AddFS(part.Images[i].uniqueID);
             }
             ((MGSprite)_node).AddAnimation(animation);
             return;
         }
     }
     else
     {
         if (_part.Type == Part.PartType.PartTypeButton)
         {
             if (part.Images.Count > 1)
             {
                 _node = MGButton.ButtonWithTextureTwinkle(part.Images[0].uniqueID, part.Images[1].uniqueID);
             }
             else
             {
                 _node = MGButton.ButtonWithToggleTwinkle(part.Images[0].uniqueID);
             }
             if ((_node).Width <= 30f || (_node).Height <= 30f)
             {
                 ((MGUIBase)_node).Bold = 10f;
             }
             parent.AddChild(_node, part.ZAxis);
             return;
         }
         if (_part.Type == Part.PartType.PartTypeCheckBox)
         {
             FrameStruct frameStruct = FrameStruct.FrameStructWithImage(part.Images[0]);
             if (part.Images.Count > 1)
             {
                 _node = MGButton.CheckboxWithTexture(part.Images[0].uniqueID, part.Images[1].uniqueID);
                 parent.AddChild(_node, part.ZAxis);
             }
             if (frameStruct.Width <= 30f || frameStruct.Height <= 30f)
             {
                 ((MGUIBase)_node).Bold = 10f;
                 return;
             }
         }
         else
         {
             if (_part.Type == Part.PartType.PartTypeProgressBar)
             {
                 _node = new MGProgressBar(part.Images[0].uniqueID);
                 string[] array = _part.UniqueID.Split(new[]
                                                           {
                                                               '_'
                                                           });
                 if (array[1] == "L")
                 {
                     ((MGProgressBar)_node).SetType(MGProgressBar.BarType.ProgressBarLeft);
                 }
                 else
                 {
                     ((MGProgressBar)_node).SetType(MGProgressBar.BarType.ProgressBarRight);
                 }
                 ((MGProgressBar)_node).Percent = 0.5;
                 parent.AddChild(_node, part.ZAxis);
                 return;
             }
             if (_part.Type == Part.PartType.PartTypeLabelAtlas)
             {
                 string[] array2 = _part.UniqueID.Split(new[]
                                                            {
                                                                '_'
                                                            });
                 MGLabelAtlas.LabelType type;
                 if (array2[3] == "L")
                 {
                     type = MGLabelAtlas.LabelType.TextAlignmentLeft;
                 }
                 else
                 {
                     if (array2[3] == "C")
                     {
                         type = MGLabelAtlas.LabelType.TextAlignmentCenter;
                     }
                     else
                     {
                         type = MGLabelAtlas.LabelType.TextAlignmentRight;
                     }
                 }
                 int charWidth = Convert.ToInt32(array2[1]);
                 int num = Convert.ToInt32(array2[2]);
                 FrameStruct frameStruct2 = FrameStruct.FrameStructWithImage(part.Images[0]);
                 var itemWidth = (int)(frameStruct2.Width / num);
                 var itemHeight = (int)frameStruct2.Height;
                 _node = new MGLabelAtlas(part.Images[0].uniqueID, type, "000", '0', itemWidth, itemHeight,
                                          charWidth);
                 parent.AddChild(_node, part.ZAxis);
                 return;
             }
             if (_part.Type == Part.PartType.PartTypeLabel)
             {
                 string[] array3 = _part.UniqueID.Split(new[]
                                                            {
                                                                '_'
                                                            });
                 MGLabel.LabelType type2;
                 if (array3[5] == "L")
                 {
                     type2 = MGLabel.LabelType.TextAlignmentLeft;
                 }
                 else
                 {
                     if (array3[5] == "C")
                     {
                         type2 = MGLabel.LabelType.TextAlignmentCenter;
                     }
                     else
                     {
                         type2 = MGLabel.LabelType.TextAlignmentRight;
                     }
                 }
                 Convert.ToInt32(array3[4]);
                 Convert.ToInt32(array3[3]);
                 Convert.ToInt32(array3[2]);
                 string arg_44B_0 = array3[1];
                 _node = new MGLabel(part.Content, type2,
                                     MGDirector.SharedDirector().Content.Load<SpriteFont>("SpriteFont1"));
                 parent.AddChild(_node, part.ZAxis);
             }
         }
     }
 }
Esempio n. 15
0
 public void AssignTarget(MGNode node)
 {
     Target = node;
 }
Esempio n. 16
0
 public virtual void SetTarget(MGNode node)
 {
     FirstTick = true;
     _isEnd = false;
     Target = node;
 }
Esempio n. 17
0
 public void RemoveChild(MGNode node)
 {
     foreach (MGNode current in ChildList)
     {
         if (current == node)
         {
             ChildList.Remove(current);
             break;
         }
     }
 }
Esempio n. 18
0
 public void ReorderChild(MGNode node, int newOrder)
 {
     RemoveChild(node);
     AddChild(node, newOrder);
 }
Esempio n. 19
0
 public void AddChild(MGNode node)
 {
     AddChild(node, 0);
 }
Esempio n. 20
0
        public TeachingScene()
        {
            _shardMainGame = this;
            IsTeaching = true;

            CardShow = new MGNode();

            _bg_day_sky = MGSprite.MGSpriteWithSpriteFrameName("白天天空.png");
            AddChild(_bg_day_sky);
            _bg_day_sky.Anchor = new Vector2(.5f, 0);
            _bg_day_sky.Position = new Vector2(1366 / 2f, 768f);

            _bg_day = MGSprite.MGSpriteWithFilename("Images/bg_day_main");
            AddChild(_bg_day);
            _bg_day.Anchor = new Vector2(0, 1);

            List<Wire> wires = new List<Wire>();
            wires.Add(new Wire(new IntVector(0, -1), WireType.WireT, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(0, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(0, -1), WireType.WireL, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(0, -1), WireType.WireL, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(0, -1), WireType.WireT, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(0, -1), WireType.WireL, WireDirection.WireDown));

            wires.Add(new Wire(new IntVector(1, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(1, -1), WireType.WireL, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(1, -1), WireType.WireX, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(1, -1), WireType.WireT, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(1, -1), WireType.WireT, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(1, -1), WireType.WireT, WireDirection.WireLeft));

            wires.Add(new Wire(new IntVector(2, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(2, -1), WireType.WireT, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(2, -1), WireType.WireL, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(2, -1), WireType.WireL, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(2, -1), WireType.WireI, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(2, -1), WireType.WireT, WireDirection.WireDown));

            wires.Add(new Wire(new IntVector(3, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(3, -1), WireType.WireT, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(3, -1), WireType.Wirei, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(3, -1), WireType.Wirei, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(3, -1), WireType.WireX, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(3, -1), WireType.WireT, WireDirection.WireDown));

            wires.Add(new Wire(new IntVector(4, -1), WireType.WireL, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(4, -1), WireType.WireL, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(4, -1), WireType.Wirei, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(4, -1), WireType.WireT, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(4, -1), WireType.WireL, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(4, -1), WireType.WireI, WireDirection.WireLeft));

            wires.Add(new Wire(new IntVector(5, -1), WireType.WireX, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(5, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(5, -1), WireType.WireI, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(5, -1), WireType.WireL, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(5, -1), WireType.WireI, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(5, -1), WireType.WireT, WireDirection.WireRight));

            wires.Add(new Wire(new IntVector(6, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(6, -1), WireType.WireT, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(6, -1), WireType.Wirei, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(6, -1), WireType.WireT, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(6, -1), WireType.WireL, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(6, -1), WireType.WireT, WireDirection.WireLeft));

            wires.Add(new Wire(new IntVector(7, -1), WireType.WireT, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(7, -1), WireType.WireI, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(7, -1), WireType.WireI, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(7, -1), WireType.WireL, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(7, -1), WireType.Wirei, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(7, -1), WireType.WireL, WireDirection.WireUp));

            wires.Add(new Wire(new IntVector(8, -1), WireType.WireL, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(8, -1), WireType.WireL, WireDirection.WireLeft));
            wires.Add(new Wire(new IntVector(8, -1), WireType.WireL, WireDirection.WireUp));
            wires.Add(new Wire(new IntVector(8, -1), WireType.WireL, WireDirection.WireRight));
            wires.Add(new Wire(new IntVector(8, -1), WireType.WireI, WireDirection.WireDown));
            wires.Add(new Wire(new IntVector(8, -1), WireType.Wirei, WireDirection.WireDown));

            AddChild(WireShowLayer.SharedWireShow());
            WireShowLayer.SharedWireShow().Init(wires);

            //AddChild(Card.CardShowLayer.SharedCardShow());
            //Card.CardShowLayer.SharedCardShow().Init();

            AddChild(Zombie.ZombieShowLayer.SharedZombieShow());
            Zombie.ZombieShowLayer.SharedZombieShow().Init();

            CoverLayer = new MGColorLayer(new Rectangle(0, 0, Config.ORI_WIN_HEIGHT, Config.ORI_WIN_WIDTH));
            CoverLayer.Opacity = 200;
            CoverLayer.SetColor(150, 150, 150);
            CoverLayer.Visible = false;
            AddChild(CoverLayer);

            touchLayer = new TeachingLayer();
            AddChild(touchLayer);
            touchLayer.IsTouchEnable = false;

            _tapTip = MGSprite.MGSpriteWithFilename("images/tapTip");
            AddChild(_tapTip, 9);
            _tapTip.Visible = false;

            AddChild(HelpLayer.SharedHelp());
        }
Esempio n. 21
0
 public void AddChild(MGNode node, int z)
 {
     int num = 0;
     bool flag = false;
     for (int i = 0; i < ChildList.Count; i++)
     {
         MGNode mgNode = ChildList[i];
         if (mgNode.ZOrder > z)
         {
             flag = true;
             ChildList.Insert(num, node);
             break;
         }
         num++;
     }
     if (!flag)
     {
         ChildList.Add(node);
     }
     node.ZOrder = z;
     node.ZInsertOrder = num;
     node.Parent = this;
     ChildList.Sort(delegate(MGNode p1, MGNode p2)
     {
         if (p1.ZOrder.CompareTo(p2.ZOrder) == 0)
         {
             return p1.ZInsertOrder.CompareTo(p2.ZInsertOrder);
         }
         return p1.ZOrder.CompareTo(p2.ZOrder);
     });
 }
Esempio n. 22
0
 public static MGMenuItemSprite itemFromNormalSprite(MGNode normalSprite, MGNode selectedSprite)
 {
     return itemFromNormalSprite(normalSprite, selectedSprite, null, null, null);
 }
Esempio n. 23
0
        public bool initFromNormalSprite(MGNode normalSprite, MGNode selectedSprite, MGNode disabledSprite,
                                  ISelectorProtocol target, SelMenuHandler selector)
        {
            if (normalSprite == null)
            {
                throw new ArgumentNullException("normalSprite");
            }

            InitWithTarget(target, selector);

            NormalImage = normalSprite;
            SelectedImage = selectedSprite;
            DisabledImage = disabledSprite;

            ContentSize = m_pNormalImage.ContentSize;

            return true;
        }
Esempio n. 24
0
 public static MGMenuItemSprite itemFromNormalSprite(MGNode normalSprite, MGNode selectedSprite, MGNode disabledSprite,
                                            ISelectorProtocol target, SelMenuHandler selector)
 {
     MGMenuItemSprite pRet = new MGMenuItemSprite();
     pRet.initFromNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
     return pRet;
 }
Esempio n. 25
0
 public static MGMenuItemSprite itemFromNormalSprite(MGNode normalSprite, MGNode selectedSprite,
                                               ISelectorProtocol target, SelMenuHandler selector)
 {
     return itemFromNormalSprite(normalSprite, selectedSprite, null, target, selector);
 }