Beispiel #1
0
        public override bool readFromXmlElement(XmlNode pCurNode)
        {
            XmlElement ele = (XmlElement)pCurNode;

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

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

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

            XmlNode pchild = pCurNode.FirstChild;

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

            for (; nIdx < 15; ++nIdx)
            {
                if (vCardFaceValue[nIdx] == null || vCardFaceValue[nIdx].Enabled == false)
                {
                    continue;
                }

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

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

            NodeCardValue pNodeData = new NodeCardValue(nFindIdx);

            if (m_pCurNodeData.addChildNode(pNodeData) == null)
            {
                MessageBox.Show("add node error , already exist");
                vCardFaceValue[nFindIdx].Enabled = false;
                vCardFaceValue[nFindIdx].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, nFindIdx = -1 ;
            for (; nIdx < 15; ++nIdx)
            {
                if (vCardFaceValue[nIdx] == null || vCardFaceValue[nIdx].Enabled == false)
                {
                    continue;
                }

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

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

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

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

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

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

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

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