Exemple #1
0
 internal static Keys CheckIndexAndGetValue(this Dictionary <OsuGameMod, Keys> var, OsuGameMod index)
 {
     try
     {
         var tmp = index;
         if (index.ToString().Contains("Key"))
         {
             tmp = OsuGameMod.Relax;
         }
         if (index == OsuGameMod.NightCore)
         {
             tmp = OsuGameMod.DoubleTime;
         }
         if (index == OsuGameMod.Perfect)
         {
             tmp = OsuGameMod.SuddenDeath;
         }
         if (index == OsuGameMod.FadeIn)
         {
             tmp = OsuGameMod.Hidden;
         }
         if (index == OsuGameMod.Random)
         {
             tmp = OsuGameMod.AutoPilot;
         }
         return(var[tmp]);
     }
     catch (KeyNotFoundException)
     {
         Debug.WriteLine($"不支持的Mod:{index}");
         return((Keys)(-1));
     }
 }
Exemple #2
0
 /// <summary>
 ///     获取指定Mod对应的键位
 /// </summary>
 /// <param name="mod"></param>
 /// <returns></returns>
 public Keys GetKey(OsuGameMod mod)
 {
     if (mod.ToString().Contains("Key"))
     {
         return(_mods.CheckIndexAndGetValue(OsuGameMod.Relax));
     }
     return(_mods.CheckIndexAndGetValue(mod));
 }