Esempio n. 1
0
    internal int ApplyRules(int i)
    {
        // These are the rules for when a Voltage Meter widget is on the bomb.
        if (Voltage != null)
        {
            if (Voltage % 1 != 0)
            {
                i = FlipIndexHorizontally(i);
            }

            if (Voltage > 5)
            {
                i = FlipIndexVertically(i);
            }
        }

        // These are the rules for when a Voltage Meter widget is not on the bomb.
        else
        {
            if (Get <KMBombInfo>().GetOnIndicators().Count().ToString().Any(a => Serial.Sum().ToString().Any(b => a == b)) ||
                Serial.Any(a => a == Get <KMBombInfo>().GetOnIndicators().Count()))
            {
                i = FlipIndexHorizontally(i);
            }

            if (Get <KMBombInfo>().GetOffIndicators().Count().ToString().Any(a => Serial.Sum().ToString().Any(b => a == b)) ||
                Serial.Any(a => a == Get <KMBombInfo>().GetOffIndicators().Count()))
            {
                i = FlipIndexVertically(i);
            }
        }

        // We have to increment i by 1 due to an off-by-one error.
        return(++i);
    }
Esempio n. 2
0
        /// <summary>
        /// Checks device against emulation parameters
        /// </summary>
        /// <returns>Returns true for emulated (demo) devices, false for real devices</returns>
        public bool IsEmulatedDevice()
        {
            if (string.IsNullOrEmpty(Serial) || string.IsNullOrEmpty(Name))
            {
                return(true);
            }

            return(Serial.Any(c => !char.IsLetterOrDigit(c)));
        }