示例#1
0
 private void FormGame_FormClosed(object sender, FormClosedEventArgs e)
 {
     Global.GetReplayManager().End();
     XmlPlayer.WritePlayer(GlobalB.GetRootPath() + @"\Setting\", Global.GetPlayer());
     FormParent.AddTextGame("玩家数据保存成功");
     Global.GetSoundManager().DelRes();
     Global.SetSoundManager(null);
     Global.DelRes();
     FormParent.formGame   = null;
     Global.IsFormGameOpen = false;
 }
        public static void ParseWebUser(IPermissionHandler handler, System.Xml.XmlNode node)
        {
            var player = new XmlPlayer()
            {
                Attributes = new System.Collections.Generic.Dictionary <String, String>()
            };

            if (node.Attributes != null && node.Attributes.Count > 0)
            {
                foreach (System.Xml.XmlAttribute attr in node.Attributes)
                {
                    if (!player.Attributes.ContainsKey(attr.Name))
                    {
                        player.Attributes.Add(attr.Name, attr.Value);
                    }
                }
            }

            foreach (System.Xml.XmlNode child in node)
            {
                switch (child.Name)
                {
                case "Name":
                    player.Name = child.InnerText;
                    break;

                case "Nodes":
                    player.Nodes = handler.ParseNodes(child);
                    break;

                case "Groups":
                    player.Groups = handler.ParseArray(child);
                    break;
                }
            }

            if (_store == null)
            {
                _store = new System.Collections.Generic.List <XmlPlayer>()
                {
                    player
                }
            }
            ;
            else
            {
                _store.Add(player);
            }
        }