示例#1
0
        //show tooltip about talent
        public string Tooltip(Talent talent, int points)
        {
            string text;

            if (talent.Rank == 0)
            {
                text = "Rank " + talent.Rank.ToString() + "/" + talent.Ranks.Count().ToString() + "\n";
                if (Dependancy(talent))
                {
                    text += "Requires " + talent.Points + " points in " + talent.Dependancy + "\n";
                }
                if ((talent.Tier - 1) * 5 > Spent.Sum())
                {
                    text += "Requires " + (talent.Tier - 1) * 5 + " points in " + Name + " Talents\n";
                }
                text += talent.Ranks[talent.Rank].Description + "\n";
                if (Availability(talent, points))
                {
                    text += "Left click to learn\n";
                }
            }
            else if (talent.Rank == talent.Ranks.Count())
            {
                text  = "Rank " + talent.Rank.ToString() + "/" + talent.Ranks.Count().ToString() + "\n";
                text += talent.Ranks[talent.Rank - 1].Description + "\n";
                text += "Right click to unlearn";
            }
            else
            {
                text  = "Rank " + talent.Rank.ToString() + "/" + talent.Ranks.Count().ToString() + "\n";
                text += talent.Ranks[talent.Rank - 1].Description + "\n\n";
                text += "Next rank:\n";
                text += talent.Ranks[talent.Rank].Description + "\n";
                text += "Left click to learn\n";
                text += "Right click to unlearn";
            }
            return(text);
        }
示例#2
0
 //check if talent is now available
 public bool Availability(Talent talent, int points)
 {
     if (talent.Rank == talent.Ranks.Count())
     {
         talent.BackColor = Color.Gold;
         return(false);
     }
     else if ((talent.Tier - 1) * 5 > Spent.Sum())
     {
         talent.BackColor = Color.Gray;
         return(false);
     }
     else
     {
         if (points == 0)
         {
             if (talent.Rank == 0)
             {
                 talent.BackColor = Color.Gray;
             }
             else
             {
                 talent.BackColor = Color.Green;
             }
             return(false);
         }
         else if (!Dependancy(talent))
         {
             talent.BackColor = Color.Green;
             return(true);
         }
         else
         {
             talent.BackColor = Color.Gray;
             return(false);
         }
     }
 }