/// <summary> /// Permet de détecter quoi faire en fonction de la position de la souris. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void panelIn_MouseUp(object sender, MouseEventArgs e) { foreach (TalentEntry t in listTalents.Items) { if ((e.X > 37 + 35 + 64 * t.Col) && (e.X < 47 + 35 + 64 * t.Col) && (e.Y > 16 + 60 * t.Row) && (e.Y < 25 + 60 * t.Row)) { talentMouseDown = null; if (talentMouseDown != null) return; DBCStores.Talent.RemoveEntry(t.Id); if (icons.ContainsKey("SpellIcon." + t.Row.ToString() + "." + t.Col.ToString())) icons.Remove("SpellIcon." + t.Row.ToString() + "." + t.Col.ToString()); listTalents.Items.Remove(t); listTalents.SelectedIndex = 0; LoadTalentTab(); return; } else if ((e.X > 35 + 64 * t.Col) && (e.X < 35 + 35 + 64 * t.Col) && (e.Y > 20 + 60 * t.Row) && (e.Y < 35 + 20 + 60 * t.Row)) { talentMouseDown = null; listTalents.SelectedItem = t; return; } } for (uint i = 0; i < 4; ++i) { for (uint j = 0; j < 11; ++j) { if ((e.X > 35 + 64 * i) && (e.X < 35 + 35 + 64 * i) && (e.Y > 20 + 60 * j) && (e.Y < 35 + 20 + 60 * j)) { if (talentMouseDown != null) { if (icons.ContainsKey("SpellIcon." + talentMouseDown.Row.ToString() + "." + talentMouseDown.Col.ToString()) && (talentMouseDown.Row != j || talentMouseDown.Col != i)) { if (icons.ContainsKey("SpellIcon." + j.ToString() + "." + i.ToString())) icons["SpellIcon." + j.ToString() + "." + i.ToString()] = icons["SpellIcon." + talentMouseDown.Row.ToString() + "." + talentMouseDown.Col.ToString()]; else icons.Add("SpellIcon." + j.ToString() + "." + i.ToString(), icons["SpellIcon." + talentMouseDown.Row.ToString() + "." + talentMouseDown.Col.ToString()]); icons.Remove("SpellIcon." + talentMouseDown.Row.ToString() + "." + talentMouseDown.Col.ToString()); } talentMouseDown.Row = j; talentMouseDown.Col = i; LoadTalentTab(); talentMouseDown = null; return; } TalentTabEntry tb = (TalentTabEntry)listTalentTab.SelectedItem; TalentEntry newTalent = new TalentEntry { Id = DBCStores.Talent.MaxKey + 1, TabId = tb.Id, Row = j, Col = i, RankId = new uint[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, ReqTalent = new uint[] { 0, 0, 0 }, ReqRank = new uint[] { 0, 0, 0 }, AllowForPetFlags = new uint[] { 0, 0 }, }; DBCStores.Talent.AddEntry(newTalent.Id, newTalent); listTalents.Items.Add(newTalent); LoadTalentTab(); listTalents.SelectedItem = newTalent; return; } } } }
private uint TalentRanks(TalentEntry t) { for (uint i = 0; i < 6; ++i) if (t.RankId[i] == 0) return i; return 0; }
private void panelIn_MouseDown(object sender, MouseEventArgs e) { foreach (TalentEntry t in listTalents.Items) { if ((e.X > 35 + 64 * t.Col) && (e.X < 35 + 35 + 64 * t.Col) && (e.Y > 20 + 60 * t.Row) && (e.Y < 35 + 20 + 60 * t.Row)) { talentMouseDown = t; return; } } }