Ejemplo n.º 1
0
        private void Match_Hero()
        {
            StreamReader sr = new StreamReader("Data.txt", Encoding.Default);  //path为文件路径
            String       line;
            int          bracher = 0;

            formatter.Clear();
            while ((line = sr.ReadLine()) != null)//按行读取 line为每行的数据
            {
                if (bracher % 2 == 0)
                {
                    List <Hero> list = new List <Hero>();
                    String[]    strs = line.Split(new char[1] {
                        ','
                    });
                    HashSet <String> srcSet = new HashSet <string>(strs);

                    List <Hero> tempList = new List <Hero>();
                    foreach (String tempStr in strs)
                    {
                        tempList.Add(HeroFactory.create(tempStr));
                    }

                    AttrFilter attrFilter = new AttrFilter();

                    foreach (Hero hero in tempList)
                    {
                        attrFilter.Filter(hero);
                    }
                    List <AttrFilter.Node> nodes     = attrFilter.Fecth();
                    HashSet <HeroType>     resultSet = new HashSet <HeroType>();

                    foreach (AttrFilter.Node tempNode in nodes)
                    {
                        resultSet.Add(tempNode.heroType);
                    }

                    if (set.IsSubsetOf(resultSet))
                    {
                        formatter.Add(tempList);
                    }
                }
                else if (bracher % 2 == 1)
                {
                }
                bracher++;
            }
        }
        private void setNodes(HashSet <String> srcSet, LinkStack <Hero> replaceStack)
        {
            List <Hero> heros = new List <Hero>();

            foreach (String str in srcSet)
            {
                Hero temp = HeroFactory.create(str);
                heros.Add(temp);
            }
            AttrFilter attrFilter = new AttrFilter();

            foreach (Hero hero in heros)
            {
                attrFilter.Filter(hero);
            }
            List <AttrFilter.Node> nodes = attrFilter.Fecth();

            replaceStack.Nodes = nodes;
        }
Ejemplo n.º 3
0
        private void Draw_Attr_Pic()
        {
            AttrFilter attrFilter = new AttrFilter();

            foreach (Hero hero in hero_list)
            {
                attrFilter.Filter(hero);
            }
            nodes = attrFilter.Fecth();

            int count = 0;

            foreach (AttrFilter.Node node in nodes)
            {
                node.key = ++key;
                this.form.Add_Pic_Box(node, count * Litle_Util.Properties.Settings.Default.IconSize,
                                      Litle_Util.Properties.Settings.Default.IconSize * 8, "CurrentAttr", Pic_Current_Attr_Click, this.form.Show_Node_ToolTip, this.form.Hide_ToolTip);
                count++;
            }
        }