Exemple #1
0
 /// <summary>
 /// Adds a hint into the proper place in the list provided.
 /// </summary>
 /// <param name="hints">The hints list.</param>
 /// <param name="hint">The hint to add.</param>
 public static void AddSorted(this List <BetterHint> hints, BetterHint hint)
 {
     if (hints.Count == 0)
     {
         hints.Add(hint);
     }
     else if (hint.Priority == int.MaxValue)
     {
         hints.Insert(0, hint);
     }
     else if (hint.Priority == int.MinValue)
     {
         hint.OverrideHint = false;
         hints.Add(hint);
     }
     else
     {
         if (hints.Count == 1)
         {
             if (hints[0].Priority >= hint.Priority)
             {
                 hints.Add(hint);
             }
             else
             {
                 hints.Insert(0, hint);
             }
         }
         else
         {
             for (int i = 0; i < hints.Count; i++)
             {
                 if (hints[i].Priority < hint.Priority || (hints[i].Priority == hint.Priority && hint.OverrideHint))
                 {
                     if (i != 0)
                     {
                         hint.OverrideHint = false;
                     }
                     hints.Insert(i, hint);
                     return;
                 }
             }
             hint.OverrideHint = false;
             hints.Add(hint);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Sends a hint to the <see cref="Player"/>.
 /// </summary>
 /// <param name="player">The <see cref="Player"/> to send a hint to.</param>
 /// <param name="hint">The <see cref="BetterHint"/> to send to the player.</param>
 public static void SendHint(this Player player, BetterHint hint)
 {
     NetworkServer.SendToClientOfPlayer <HintMessage>(player.HintDisplay.netIdentity, new HintMessage(hint.Hint));
 }