Example #1
0
        //
        //
        //
        private bool suitConfig(ref string[] rRowData)
        {
            string szError = "";
            //子系列ID(xml)
            string szMatherID = rRowData[0];
            string szSubName  = rRowData[4];

            if (szSubName == m_szTempLastSubName)
            {//不去做无效验证 1.首先m_szTempLastSubName初始为 "" 表中内容不可能会和他相同(除非表有问题)
                rRowData[1] = m_nTempLastSubID.ToString();
            }
            else
            {
                m_nTempLastSubID    = this.m_rXmlOperator.getSubNextID(szMatherID) + 1;
                rRowData[1]         = m_nTempLastSubID.ToString();
                m_szTempLastSubName = szSubName;
            }
            //子系列ID(xml) - end
            //道具名
            string szIDMale     = rRowData[5];
            string szIDFemale   = rRowData[7];
            string szNameMale   = this.m_rNameAndIDMap.getName(szIDMale, true, ref szError);
            string szNameFemale = this.m_rNameAndIDMap.getName(szIDFemale, false, ref szError);

            if (szNameFemale != "")
            {
                rRowData[8] = szNameFemale;
            }
            if (szNameMale != "")
            {
                rRowData[6] = szNameMale;
            }
            //道具名 - end
            //计算兑换所需碎片和首次兑换优惠碎片书以及套部件见分数
            int nPrice             = int.Parse(rRowData[9]);
            int nFragmentCount     = X51Math.X51round(nPrice * 0.75);
            int nSaleFragmentCount = X51Math.X51round(nPrice * 0.6);
            int nPartScore         = X51Math.X51round(nPrice * 0.1);

            rRowData[10] = nFragmentCount.ToString();
            if (isNoSale(szIDMale, szIDFemale))
            {
                rRowData[11] = "";
            }
            else
            {
                rRowData[11] = nSaleFragmentCount.ToString();
            }
            rRowData[13] = nPartScore.ToString();
            //计算兑换所需碎片和首次兑换优惠碎片书以及套部件见分数 - end
            return(true);
        }
        private void setNormalExchange(XmlNode rClothNode, Dictionary <string, bool> rNoSaleID)
        {
            //去掉offer_enable字段
            if (rClothNode.Attributes["offer_enable"] != null)
            {
                rClothNode.Attributes.Remove(rClothNode.Attributes["offer_enable"]);
            }
            var rChildren = rClothNode.ChildNodes;

            for (int index = 0; index < rChildren.Count; ++index)
            {
                if (rChildren[index].Name == "Part")
                {
                    //去掉cost = “-1”
                    if (rChildren[index].Attributes["cost"] != null && null != rChildren[index].Attributes["score"])
                    {
                        int nCost = X51Math.X51round(int.Parse(rChildren[index].Attributes["score"].Value) * 7.5);
                        rChildren[index].Attributes["cost"].Value = nCost.ToString();
                    }
                }
            }
        }
        private void setSaleExchange(XmlNode rClothNode, Dictionary <string, bool> rNoSaleID)
        {
            //去掉offer_enable字段
            if (rClothNode.Attributes["offer_enable"] != null)
            {
                rClothNode.Attributes["offer_enable"].Value = "1";
            }
            else
            {
                XmlAttribute rNewAttribute = getDoc().CreateAttribute("offer_enable");
                rNewAttribute.Value = "1";
                rClothNode.Attributes.Append(rNewAttribute);
            }
            var rChildren = rClothNode.ChildNodes;

            for (int index = 0; index < rChildren.Count; ++index)
            {
                if (rChildren[index].Name == "Part")
                {
                    //去掉cost = “-1”
                    if (rChildren[index].Attributes["cost"] != null && null != rChildren[index].Attributes["score"])
                    {
                        int nCost      = X51Math.X51round(int.Parse(rChildren[index].Attributes["score"].Value) * 7.5);
                        int nOfferCost = X51Math.X51round(int.Parse(rChildren[index].Attributes["score"].Value) * 6);
                        rChildren[index].Attributes["cost"].Value = nCost.ToString();
                        if (null == rChildren[index].Attributes["offer_cost"])
                        {
                            XmlAttribute rNewAttribute = getDoc().CreateAttribute("offer_cost");
                            rNewAttribute.Value = nOfferCost.ToString();
                            rChildren[index].Attributes.Append(rNewAttribute);
                        }
                        else
                        {
                            rChildren[index].Attributes["offer_cost"].Value = nOfferCost.ToString();
                        }
                    }
                }
            }
        }
 //
 //获取信息
 //
 public void getXmlData(List <string> rIDlist, ref List <string[]> rResult, Dictionary <string, bool> rNoSale)
 {
     for (int index = 0; index < rIDlist.Count; ++index)
     {
         string  szID       = rIDlist[index];
         XmlNode rClothNode = m_rClothsetMap[szID];
         if (null != rClothNode)
         {
             var rChildren = rClothNode.ChildNodes;
             for (int nLoopCount = 0; nLoopCount < rChildren.Count; ++nLoopCount)
             {
                 if (rChildren[nLoopCount].Name == "Part")
                 {
                     string[] temp = new string[15];
                     if (rClothNode.Attributes["series_id"] != null)
                     {
                         temp[0] = rClothNode.Attributes["series_id"].Value;
                     }
                     if (rClothNode.Attributes["set_id"] != null)
                     {
                         temp[1] = rClothNode.Attributes["set_id"].Value;
                     }
                     if (rClothNode.Attributes["on_shelf_time"] != null)
                     {
                         temp[2] = rClothNode.Attributes["on_shelf_time"].Value.ToString();
                     }
                     if (rClothNode.Attributes["complete_score"] != null)
                     {
                         temp[3] = rClothNode.Attributes["complete_score"].Value;
                     }
                     if (rClothNode.Attributes["set_name"] != null)
                     {
                         temp[4] = rClothNode.Attributes["set_name"].Value;
                     }
                     if (rChildren[nLoopCount].Attributes["male_id"] != null)
                     {
                         temp[6] = rChildren[nLoopCount].Attributes["male_id"].Value;
                     }
                     if (rChildren[nLoopCount].Attributes["female_id"] != null)
                     {
                         temp[8] = rChildren[nLoopCount].Attributes["female_id"].Value;
                     }
                     if (rChildren[nLoopCount].Attributes["score"] != null)
                     {
                         int score = int.Parse(rChildren[nLoopCount].Attributes["score"].Value);
                         temp[9]  = (score * 10).ToString();
                         temp[10] = X51Math.X51round(score * 7.5).ToString();
                         if (rNoSale.Count != 0)
                         {
                             if (!rNoSale.ContainsKey(temp[5]) && !rNoSale.ContainsKey(temp[7]))
                             {
                                 temp[11] = X51Math.X51round(score * 6).ToString();
                             }
                         }
                         else
                         {
                             temp[11] = X51Math.X51round(score * 6).ToString();
                         }
                         temp[13] = score.ToString();
                     }
                     if (rChildren[nLoopCount].ChildNodes.Count != 0)
                     {
                         var partChildren = rChildren[nLoopCount].ChildNodes;
                         for (int partChildrenIndex = 0; partChildrenIndex < partChildren.Count; ++partChildrenIndex)
                         {
                             if (partChildrenIndex == 0 && partChildren[partChildrenIndex].Name == "#comment")
                             {
                                 getPartName(ref temp[5], ref temp[7], partChildren[partChildrenIndex].Value);
                             }
                             if (partChildren[partChildrenIndex].Name == "Obtain" &&
                                 partChildren[partChildrenIndex].Attributes["id"].Value != "1")
                             {
                                 temp[12] = getPieceSource(partChildren[partChildrenIndex].Attributes["id"].Value);
                             }
                         }
                     }
                     temp[14] = "1.00";
                     rResult.Add(temp);
                 }
             }
         }
     }
 }