Esempio n. 1
0
        public override bool readFromXmlElement(XmlNode pCurNode)
        {
            XmlElement ele = (XmlElement)pCurNode;

            if (ele.Name != "Round")
            {
                s_errorString = "error xml type error for round";
                return(false);
            }

            if (ele.HasAttribute("nCount") == false)
            {
                s_errorString = "error xml type do not have nCount attribute";
                return(false);
            }

            m_nValue = int.Parse(ele.GetAttribute("nCount"));

            XmlNode pchild = pCurNode.FirstChild;

            while (pchild != null)
            {
                NodeCardType pnodeChild = new NodeCardType(0);
                pnodeChild.readFromXmlElement(pchild);
                addChildNode(pnodeChild);
                pchild = pchild.NextSibling;
            }
            return(true);
        }
Esempio n. 2
0
        public override TreeNode doAddChildNode()
        {
            int nIdx     = 0;
            int nFindIdx = -1;

            for (; nIdx < (int)eCardType.eCard_Robot_Max; ++nIdx)
            {
                if (vCardTypeBtn[nIdx] == null || vCardTypeBtn[nIdx].Enabled == false)
                {
                    continue;
                }

                if (vCardTypeBtn[nIdx].Checked)
                {
                    nFindIdx = nIdx;
                    break;
                }
            }

            if (nFindIdx == -1)
            {
                MessageBox.Show("请选择一个要配置的牌型");
                return(null);
            }

            NodeCardType pNodeData = new NodeCardType(nIdx);

            if (m_pCurNodeData.addChildNode(pNodeData) == null)
            {
                MessageBox.Show("add node error , already exist");
                vCardTypeBtn[nIdx].Enabled = false;
                vCardTypeBtn[nIdx].Checked = false;
                return(null);
            }

            TreeNode pnode = new TreeNode();

            pnode.Tag  = pNodeData;
            pnode.Text = pNodeData.desc;

            refreshCurNodeData(m_pCurNodeData);
            return(pnode);
        }
        public override TreeNode doAddChildNode()
        {
            int nIdx = 0;
            int nFindIdx = -1;
            for (; nIdx < (int)eCardType.eCard_Robot_Max; ++nIdx)
            {
                if (vCardTypeBtn[nIdx] == null || vCardTypeBtn[nIdx].Enabled == false)
                {
                    continue;
                }

                if (vCardTypeBtn[nIdx].Checked)
                {
                    nFindIdx = nIdx;
                    break;
                }
            }

            if (nFindIdx == -1)
            {
                MessageBox.Show("请选择一个要配置的牌型");
                return null;
            }

            NodeCardType pNodeData = new NodeCardType(nIdx);
            if (m_pCurNodeData.addChildNode(pNodeData) == null)
            {
                MessageBox.Show("add node error , already exist");
                vCardTypeBtn[nIdx].Enabled = false;
                vCardTypeBtn[nIdx].Checked = false;
                return null;
            }

            TreeNode pnode = new TreeNode();
            pnode.Tag = pNodeData;
            pnode.Text = pNodeData.desc;

            refreshCurNodeData(m_pCurNodeData);
            return pnode;
        }
Esempio n. 4
0
        public override bool readFromXmlElement(XmlNode pCurNode )
        {
            XmlElement ele = (XmlElement)pCurNode;
            if (ele.Name != "Round")
            {
                s_errorString = "error xml type error for round";
                return false;
            }

            if (ele.HasAttribute("nCount") == false)
            {
                s_errorString = "error xml type do not have nCount attribute";
                return false;
            }

            m_nValue = int.Parse(ele.GetAttribute("nCount"));

            XmlNode pchild = pCurNode.FirstChild;
            while ( pchild != null)
            {
                NodeCardType pnodeChild = new NodeCardType(0);
                pnodeChild.readFromXmlElement(pchild);
                addChildNode(pnodeChild);
                pchild = pchild.NextSibling;
            }
            return true;
        }