Example #1
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;
        }
Example #2
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);
             }
         }
     }
 }
Example #3
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;
     }))));
 }