当前位置: 首页>>代码示例>>C#>>正文


C# XmlAttributeCollection.Int方法代码示例

本文整理汇总了C#中System.Xml.XmlAttributeCollection.Int方法的典型用法代码示例。如果您正苦于以下问题:C# XmlAttributeCollection.Int方法的具体用法?C# XmlAttributeCollection.Int怎么用?C# XmlAttributeCollection.Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlAttributeCollection的用法示例。


在下文中一共展示了XmlAttributeCollection.Int方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFromXML

        public static void CreateFromXML(Scene scene, XmlAttributeCollection attributes)
        {
            Brick brick = new Brick();
            brick.SetPosition(attributes.Int("x", 0), attributes.Int("y", 0));
            brick.Graphic = new Image("Assets/Images/grasses.png", new Rectangle(256, 0, Global.GridSize, Global.GridSize));

            scene.Add(brick);
        }
开发者ID:patHyatt,项目名称:Frenemey,代码行数:8,代码来源:Brick.cs

示例2: CreateFromXML

        public static void CreateFromXML(Scene scene, XmlAttributeCollection attributes)
        {
            int playerNumber = attributes.Int("player", 0);

            Session playerSession;
            Color color = Color.None;

            if (playerNumber == 0)
            {
                playerSession = Global.PlayerOneSession;
                color = Color.White;
            }
            else if (playerNumber == 1)
            {
                playerSession = Global.PlayerTwoSession;
                color = Color.Yellow;
            }
            else if (playerNumber == 2)
            {
                playerSession = Global.PlayerThreeSession;
                color = Color.Blue;
            }
            else
            {
                playerSession = Global.PlayerFourSession;
                color = Color.Grey;
            }

            Bomberman player = new Bomberman(playerSession, color);

            player.SetPosition(attributes.Int("x", 0), attributes.Int("y", 0));

            scene.Add(player);
        }
开发者ID:patHyatt,项目名称:Frenemey,代码行数:34,代码来源:Bomberman.cs

示例3: MyCreateEntity

        /// <summary>
        /// This function gets called by the ogmo level loader
        /// </summary>
        public static void MyCreateEntity(Scene scene, XmlAttributeCollection ogmoParameters)
        {
            //ok ogmo gives us the position in x and y, and the list of decorators in DecoratorList
            int x = ogmoParameters.Int("x", -1);
            int y = ogmoParameters.Int("y", -1);

            //this is how you read a string from ogmo
            string decoList = ogmoParameters.GetNamedItem("DecoratorList").Value;

            //create an instance
            Tank t = new Tank(x, y);

            //try and load an id; if there is none, the id will be -1
            t.NetworkId = ogmoParameters.Int("NetworkId", -1);

            //add to the scene because the decorators need that
            scene.Add(t);

            //split the decorators; they are seperated by a ":" in the DecoratorList string
            string[] decoArray = decoList.Split(':');

            //add each decorator
            foreach (string decoratorName in decoArray)
            {
                //parse the name of the decorator to the decorator-enum, and then add to the tank
                t.AddDecorator((Decorators) Enum.Parse(typeof(Decorators), decoratorName));
            }
        }
开发者ID:JOCP9733,项目名称:tank,代码行数:31,代码来源:Tank.cs


注:本文中的System.Xml.XmlAttributeCollection.Int方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。