Exemplo n.º 1
0
        void ParseTag(List <PartInfo> info, Dictionary <string, HashList <PartInfo> > sinfo)
        {
            foreach (var item2 in info)
            {
                //加入年龄Tag
                Enum <AgeRange> .For(x =>
                {
                    string tagAge = x.ToString();
                    HashList <PartInfo> temp;
                    if (sinfo.ContainsKey(tagAge))
                    {
                        temp = sinfo[tagAge];
                    }
                    else
                    {
                        temp = new HashList <PartInfo>();
                        sinfo.Add(tagAge, temp);
                    }
                    var addtionName = item2.Name + "_" + tagAge;
                    if (GRMgr.Head.IsHave(addtionName))
                    {
                        PartInfo newPartInfo = item2.Clone() as PartInfo;
                        newPartInfo.Name     = addtionName;
                        temp.Add(newPartInfo);
                    }
                });

                //加入自定义Tag
                if (item2.Tag == null)
                {
                    continue;
                }
                foreach (var tag in item2.Tag)
                {
                    HashList <PartInfo> temp;
                    if (sinfo.ContainsKey(tag))
                    {
                        temp = sinfo[tag];
                    }
                    else
                    {
                        temp = new HashList <PartInfo>();
                        sinfo.Add(tag, temp);
                    }
                    temp.Add(item2);

                    if (tag == Const.PTag_Rope)
                    {
                        Rope.Add(item2.Name);
                    }
                }
            }
            info.RemoveAll((x) =>
            {
                return(!x.IsIn);
            });
        }
Exemplo n.º 2
0
        public Dictionary <PHIPart, string> RandHeadIcon(Gender gender, string tag)
        {
            Dictionary <PHIPart, string> ret = new Dictionary <PHIPart, string>();

            RandPart(PHIPart.PBare, ref ret);
            RandPart(PHIPart.PEye, ref ret);
            RandPart(PHIPart.PNose, ref ret);
            RandPart(PHIPart.PHair, ref ret);
            RandPart(PHIPart.PMouse, ref ret);
            RandPart(PHIPart.PBrow, ref ret);
            RandPart(PHIPart.PBeard, ref ret);

            RandPart(PHIPart.PHelmet, ref ret);
            RandPart(PHIPart.PBody, ref ret);
            RandPart(PHIPart.PDecorate, ref ret);
            RandPart(PHIPart.PBG, ref ret);
            RandPart(PHIPart.PFrame, ref ret);
            return(ret);

            void RandPart(PHIPart part, ref Dictionary <PHIPart, string> data)
            {
                List <PartInfo> parts = GetParts(part);
                var             key   = parts.Rand();

                if (key == null)
                {
                    key = new PartInfo();
                }
                data.Add(part, key.Name);
            }

            List <PartInfo> GetParts(PHIPart part)
            {
                var info = GetInfo(gender);

                //Face
                if (part == PHIPart.PBare)
                {
                    return(info.GetSBare(tag));
                }
                else if (part == PHIPart.PEye)
                {
                    return(info.GetSEye(tag));
                }
                else if (part == PHIPart.PHair)
                {
                    return(info.GetSHair(tag));
                }
                else if (part == PHIPart.PNose)
                {
                    return(info.GetSNose(tag));
                }
                else if (part == PHIPart.PMouse)
                {
                    return(info.GetSMouse(tag));
                }
                else if (part == PHIPart.PBrow)
                {
                    return(info.GetSBrow(tag));
                }
                else if (part == PHIPart.PBeard)
                {
                    return(info.GetSBeard(tag));
                }
                //其他
                else if (part == PHIPart.PBG)
                {
                    return(info.GetSBG(tag));
                }
                else if (part == PHIPart.PBody)
                {
                    return(info.GetSBody(tag));
                }
                else if (part == PHIPart.PDecorate)
                {
                    return(info.GetSDecorate(tag));
                }
                else if (part == PHIPart.PFrame)
                {
                    return(info.GetSFrame(tag));
                }
                else if (part == PHIPart.PHelmet)
                {
                    return(info.GetSHelmet(tag));
                }
                return(new List <PartInfo>());
            }
        }