private void Pic_Click(object sender, EventArgs e) { PictureBox pic = (PictureBox)sender; MouseEventArgs Mouse_e = (MouseEventArgs)e; if (Mouse_e.Button == MouseButtons.Left) { String str = (String)pic.Tag; Hero hero = HeroFactory.create(str); hero.Key = ++key; hero.Level = 1; hero.Attach(this.form.chooseMatchObserver); hero.Attach(this.form.heroPoolObserver); hero.Attach(this.form.currentAttrObserver); hero.Attach(this.form.fightObserver); hero.Get(); people++; } else { Hero hero = HeroFactory.create(pic.Tag + ""); this.form6.Add_Rec_Pic_Box(hero); if (this.form6.Visible == false) { this.form6.Show(); } } }
private void Pic_Match_Click(object sender, EventArgs e) { PictureBox pic = (PictureBox)sender; Hero hero = HeroFactory.create(pic.Tag + ""); this.form.form6.Add_Rec_Pic_Box(hero); if (this.form.form6.Visible == false) { this.form.form6.Show(); } }
public void Show_ToolTip(object sender, EventArgs e) { PictureBox pic = (PictureBox)sender; String str = (String)pic.Tag; Hero hero = HeroFactory.create(str); this.toolTip1.ToolTipTitle = "爆率:"; this.toolTip1.IsBalloon = false; this.toolTip1.UseFading = true; this.toolTip1.Show(Global.Rate[people - 1, hero.Cost - 1], pic); this.Opacity = 1; }
private void initdesk(String heroKey, int i) { int width = Litle_Util.Properties.Settings.Default.IconSize; int height = Litle_Util.Properties.Settings.Default.IconSize; int x = i % 10 * width; int y = i / 10 * height; Hero hero = HeroFactory.create(heroKey); hero.Key = ++key; hero.Level = 1; Add_Pic_Box(hero, x, y, "Init", Pic_Click, Mouse_Enter, Mouse_Leave); }
private void setNext(ref LinkStack <Hero> replaceStack, HashSet <String> hSet) { foreach (String str in hSet) { Hero temp = HeroFactory.create(str); LinkStack <Hero> node = new LinkStack <Hero>(); node.Node = temp; replaceStack.Next = node; replaceStack = node; } LinkStack <Hero> head = new LinkStack <Hero>(); replaceStack.Head = head; replaceStack = replaceStack.Head; }
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; }
private void Macth_HeroType() { List <Hero> hero_list = new List <Hero>(); foreach (String code in set) { Hero hero = HeroFactory.create(code); hero_list.Add(hero); } Hashtable hashTable = new Hashtable(); foreach (Hero hero in hero_list) { foreach (HeroType heroType in hero.TypeCodes) { if (hashTable.Contains(heroType)) { int count = (int)hashTable[heroType]; count++; hashTable[heroType] = count; } else { hashTable.Add(heroType, 1); } } } String str = ""; foreach (DictionaryEntry de in hashTable) { if (str.Length > 0) { str += ","; } str += Global.Type_Name[de.Key] + ":(" + de.Value + ")"; } this.label2.Text = "羁绊:" + str; }