Ejemplo n.º 1
0
    static int getGender(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            FashionShopConfigItem obj = (FashionShopConfigItem)LuaScriptMgr.GetNetObjectSelf(L, 1, "FashionShopConfigItem");
            uint o = obj.getGender();
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(uint)))
        {
            uint arg0 = (uint)LuaDLL.lua_tonumber(L, 1);
            uint o    = FashionShopConfigItem.getGender(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: FashionShopConfigItem.getGender");
        }

        return(0);
    }
Ejemplo n.º 2
0
 public void init(FashionShopConfigItem item)
 {
     _gender    = item.getGender();
     _isDressOn = item.isDressOn();
     _isTry     = false;
     _isExpired = item.isInDate();
     _fashionID = item._fashionID;
 }
Ejemplo n.º 3
0
    //public HidePart MappingPart(uint hide_id)
    //{
    //    HidePart data = null;
    //    mapHideParts.TryGetValue(hide_id, out data);
    //    return data;
    //}

    public void ReadConfig()
    {
        if (isLoadFinish == false || GameSystem.Instance.GoodsConfigData.isReadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; }

        string text = ResourceLoadManager.Instance.GetConfigText(name);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name);
            return;
        }

        //读取以及处理XML文本的类
        XmlDocument doc = CommonFunction.LoadXmlConfig(name, text);

        XmlNode node_data = doc.SelectSingleNode("Data");

        foreach (XmlNode node_line in node_data.SelectNodes("Line"))
        {
            if (node_line.SelectSingleNode("switch").InnerText == "#")
            {
                continue;
            }

            FashionShopConfigItem data           = new FashionShopConfigItem();
            FashionShopConfigItem reputationData = new FashionShopConfigItem();
            int storeID = int.Parse(node_line.SelectSingleNode("store_id").InnerText);
            if (storeID == (int)StoreType.ST_FASHION)
            {
                data._fashionID = uint.Parse(node_line.SelectSingleNode("id").InnerText);

                string   theValues = node_line.SelectSingleNode("time_dur").InnerText;
                string[] tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint timeDur;
                    if (uint.TryParse(token, out timeDur))
                    {
                        data._timeDur.Add(timeDur);
                    }
                }


                theValues = node_line.SelectSingleNode("cost_type").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costType;
                    if (uint.TryParse(token, out costType))
                    {
                        data._costType.Add(costType);
                    }
                }

                theValues = node_line.SelectSingleNode("cost_num").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costNum;
                    if (uint.TryParse(token, out costNum))
                    {
                        data._costNum.Add(costNum);
                    }
                }


                data._isDiscount = uint.Parse(node_line.SelectSingleNode("is_discount").InnerText);


                theValues = node_line.SelectSingleNode("discount_cost").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint discountCost;
                    if (uint.TryParse(token, out discountCost))
                    {
                        data._discountCost.Add(discountCost);
                    }
                }


                data._isNew     = uint.Parse(node_line.SelectSingleNode("is_new").InnerText);
                data._vip       = uint.Parse(node_line.SelectSingleNode("vip").InnerText);
                data._sortValue = int.Parse(node_line.SelectSingleNode("sort_value").InnerText);



                theValues = node_line.SelectSingleNode("renew_time_dur").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint timeDur;
                    if (uint.TryParse(token, out timeDur))
                    {
                        data._renewTimeDur.Add(timeDur);
                    }
                }


                theValues = node_line.SelectSingleNode("renew_cost_type").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costType;
                    if (uint.TryParse(token, out costType))
                    {
                        data._renewCostType.Add(costType);
                    }
                }

                theValues = node_line.SelectSingleNode("renew_cost_num").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costNum;
                    if (uint.TryParse(token, out costNum))
                    {
                        data._renewCostNum.Add(costNum);
                    }
                }


                List <uint> types  = data.getFashionType();
                uint        gender = data.getGender();
                if (types.Count == 1)
                {
                    uint type = types[0];
                    if (type == 1)
                    {
                        if (gender == 0)
                        {
                            cHeadSort.Add(data);
                            cHeadSort_w.Add(data);
                        }
                        else if (gender == 1)
                        {
                            cHeadSort.Add(data);
                        }
                        else if (gender == 2)
                        {
                            cHeadSort_w.Add(data);
                        }
                    }
                    else if (type == 2)
                    {
                        if (gender == 0)
                        {
                            cClothesSort.Add(data);
                            cClothesSort_w.Add(data);
                        }
                        else if (gender == 1)
                        {
                            cClothesSort.Add(data);
                        }
                        else if (gender == 2)
                        {
                            cClothesSort_w.Add(data);
                        }
                    }
                    else if (type == 3)
                    {
                        if (gender == 0)
                        {
                            cTrouserseSort.Add(data);
                            cTrouserseSort_w.Add(data);
                        }
                        else if (gender == 1)
                        {
                            cTrouserseSort.Add(data);
                        }
                        else if (gender == 2)
                        {
                            cTrouserseSort_w.Add(data);
                        }
                    }
                    else if (type == 4)
                    {
                        if (gender == 0)
                        {
                            cShoesSort.Add(data);
                            cShoesSort_w.Add(data);
                        }
                        else if (gender == 1)
                        {
                            cShoesSort.Add(data);
                        }
                        else if (gender == 2)
                        {
                            cShoesSort_w.Add(data);
                        }
                    }
                    else if (type == 5)
                    {
                        if (gender == 0)
                        {
                            cBackSort.Add(data);
                            cBackSort_w.Add(data);
                        }
                        else if (gender == 1)
                        {
                            cBackSort.Add(data);
                        }
                        else if (gender == 2)
                        {
                            cBackSort_w.Add(data);
                        }
                    }
                }
                else
                {
                    if (gender == 0)
                    {
                        cSuiteSort.Add(data);
                        cSuiteSort_w.Add(data);
                    }
                    else if (gender == 1)
                    {
                        cSuiteSort.Add(data);
                    }
                    else if (gender == 2)
                    {
                        cSuiteSort_w.Add(data);
                    }
                }



                if (gender == 0)
                {
                    configsSort_m.Add(data);
                    configsSort_w.Add(data);
                }
                else if (gender == 1)
                {
                    configsSort_m.Add(data);
                }
                else if (gender == 2)
                {
                    configsSort_w.Add(data);
                }

                configs.Add(data._fashionID, data);
                configsSort.Add(data);
            }
            else if (storeID == (int)StoreType.ST_REPUTATION)
            {
                reputationData._fashionID = uint.Parse(node_line.SelectSingleNode("id").InnerText);

                string   theValues = node_line.SelectSingleNode("time_dur").InnerText;
                string[] tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint timeDur;
                    if (uint.TryParse(token, out timeDur))
                    {
                        reputationData._timeDur.Add(timeDur);
                    }
                }


                theValues = node_line.SelectSingleNode("cost_type").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costType;
                    if (uint.TryParse(token, out costType))
                    {
                        reputationData._costType.Add(costType);
                    }
                }

                theValues = node_line.SelectSingleNode("cost_num").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costNum;
                    if (uint.TryParse(token, out costNum))
                    {
                        reputationData._costNum.Add(costNum);
                    }
                }


                reputationData._isDiscount = uint.Parse(node_line.SelectSingleNode("is_discount").InnerText);


                theValues = node_line.SelectSingleNode("discount_cost").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint discountCost;
                    if (uint.TryParse(token, out discountCost))
                    {
                        reputationData._discountCost.Add(discountCost);
                    }
                }


                reputationData._isNew     = uint.Parse(node_line.SelectSingleNode("is_new").InnerText);
                reputationData._vip       = uint.Parse(node_line.SelectSingleNode("vip").InnerText);
                reputationData._sortValue = int.Parse(node_line.SelectSingleNode("sort_value").InnerText);



                theValues = node_line.SelectSingleNode("renew_time_dur").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint timeDur;
                    if (uint.TryParse(token, out timeDur))
                    {
                        reputationData._renewTimeDur.Add(timeDur);
                    }
                }


                theValues = node_line.SelectSingleNode("renew_cost_type").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costType;
                    if (uint.TryParse(token, out costType))
                    {
                        reputationData._renewCostType.Add(costType);
                    }
                }

                theValues = node_line.SelectSingleNode("renew_cost_num").InnerText;
                tokens    = theValues.Split('&');
                foreach (string token in tokens)
                {
                    uint costNum;
                    if (uint.TryParse(token, out costNum))
                    {
                        reputationData._renewCostNum.Add(costNum);
                    }
                }


                List <uint> types  = reputationData.getFashionType();
                uint        gender = reputationData.getGender();
                if (types.Count == 1)
                {
                    uint type = types[0];
                    if (type == 1)
                    {
                        if (gender == 0)
                        {
                            reputationHeadSort.Add(reputationData);
                            reputationHeadSort_w.Add(reputationData);
                        }
                        else if (gender == 1)
                        {
                            reputationHeadSort.Add(reputationData);
                        }
                        else if (gender == 2)
                        {
                            reputationHeadSort_w.Add(reputationData);
                        }
                    }
                    else if (type == 2)
                    {
                        if (gender == 0)
                        {
                            reputationClothesSort.Add(reputationData);
                            reputationClothesSort_w.Add(reputationData);
                        }
                        else if (gender == 1)
                        {
                            reputationClothesSort.Add(reputationData);
                        }
                        else if (gender == 2)
                        {
                            reputationClothesSort_w.Add(reputationData);
                        }
                    }
                    else if (type == 3)
                    {
                        if (gender == 0)
                        {
                            reputationTrouserseSort.Add(reputationData);
                            reputationTrouserseSort_w.Add(reputationData);
                        }
                        else if (gender == 1)
                        {
                            reputationTrouserseSort.Add(reputationData);
                        }
                        else if (gender == 2)
                        {
                            reputationTrouserseSort_w.Add(reputationData);
                        }
                    }
                    else if (type == 4)
                    {
                        if (gender == 0)
                        {
                            reputationShoesSort.Add(reputationData);
                            reputationShoesSort_w.Add(reputationData);
                        }
                        else if (gender == 1)
                        {
                            reputationShoesSort.Add(reputationData);
                        }
                        else if (gender == 2)
                        {
                            reputationShoesSort_w.Add(reputationData);
                        }
                    }
                    else if (type == 5)
                    {
                        if (gender == 0)
                        {
                            reputationBackSort.Add(reputationData);
                            reputationBackSort_w.Add(reputationData);
                        }
                        else if (gender == 1)
                        {
                            reputationBackSort.Add(reputationData);
                        }
                        else if (gender == 2)
                        {
                            reputationBackSort_w.Add(reputationData);
                        }
                    }
                }
                else
                {
                    if (gender == 0)
                    {
                        reputationSuiteSort.Add(reputationData);
                        reputationSuiteSort_w.Add(reputationData);
                    }
                    else if (gender == 1)
                    {
                        reputationSuiteSort.Add(reputationData);
                    }
                    else if (gender == 2)
                    {
                        reputationSuiteSort_w.Add(reputationData);
                    }
                }



                if (gender == 0)
                {
                    reputationConfigsSort_m.Add(reputationData);
                    reputationConfigsSort_w.Add(reputationData);
                }
                else if (gender == 1)
                {
                    reputationConfigsSort_m.Add(reputationData);
                }
                else if (gender == 2)
                {
                    reputationConfigsSort_w.Add(reputationData);
                }

                reputationConfigs.Add(reputationData._fashionID, reputationData);
                reputationConfigsSort.Add(reputationData);
            }

            //时装
            configsSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            configsSort_m.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            configsSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            cHeadSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cClothesSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cTrouserseSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cShoesSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cBackSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cSuiteSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            cHeadSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cClothesSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cTrouserseSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cShoesSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cBackSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            cSuiteSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            //声望
            reputationConfigsSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            reputationConfigsSort_m.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationConfigsSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            reputationHeadSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationClothesSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationTrouserseSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationShoesSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationBackSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationSuiteSort.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));

            reputationHeadSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationClothesSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationTrouserseSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationShoesSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationBackSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
            reputationSuiteSort_w.Sort(new Comparison <FashionShopConfigItem>(new FashionComparison().Compare));
        }
    }