Ejemplo n.º 1
0
        static CommonReflectedTypeInfo()
        {
            RuleManagerType = typeof(RuleManager);
            if (RuleManagerType == null)
            {
                return;
            }

            RuleManagerInstanceField = RuleManagerType.GetField("instance", BindingFlags.NonPublic | BindingFlags.Static);
            GenerateRulesMethod      = RuleManagerType.GetMethod("Initialize", BindingFlags.Public | BindingFlags.Instance);
            CurrentRulesProperty     = RuleManagerType.GetProperty("CurrentRules", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            WireRuleSetGenerator         = new WireRuleGenerator();
            WhosOnFirstRuleSetGenerator  = new WhosOnFirstRuleSetGenerator();
            MemoryRuleSetGenerator       = new MemoryRuleSetGenerator();
            KeypadRuleSetGenerator       = new KeypadRuleSetGenerator();
            NeedyKnobRuleSetGenerator    = new NeedyKnobRuleSetGenerator();
            ButtonRuleSetGenerator       = new ButtonRuleGenerator();
            WireSequenceRuleSetGenerator = new WireSetRuleGenerator();
            PasswordRuleSetGenerator     = new PasswordRuleGenerator();
            //MorseCodeRuleSetGenerator = new MorseCodeRuleSetGenerator();
            MorseCodeRuleSetGenerator    = new MorseCodeRuleGenerator();
            VennWireRuleSetGenerator     = new VennWireGenerator();
            RhythmHeavenRuleSetGenerator = new RhythmHeavenRuleSetGenerator();
            MazeRuleSetGenerator         = new MazeRuleSetGenerator();
            SimonRuleSetGenerator        = new SimonRuleGenerator();
            Seed = -1;
            OriginalBombRules = null;

            BombComponentLogger            = typeof(BombComponent).GetField("logger", BindingFlags.NonPublic | BindingFlags.Instance);
            MorseCodeModuleChosenTermField = typeof(MorseCodeComponent).GetField("chosenTerm", BindingFlags.NonPublic | BindingFlags.Instance);
            MorseCodeModuleChosenWordField = typeof(MorseCodeComponent).GetField("chosenWord", BindingFlags.NonPublic | BindingFlags.Instance);
        }
Ejemplo n.º 2
0
        private static BombRules Initialize(int seed)
        {
            DebugLog("Generating Rules for seed {0}", seed);

            var bombRules = new BombRules
            {
                ManualMetaData = new ManualMetaData
                {
                    BombClassification = ManualMetaData.BOMB_CLASSIFICATION,
                    LockCode           = ManualMetaData.LOCK_CODE
                },
                WireRuleSet         = WireRuleSetGenerator.CreateWireRules(seed),
                WhosOnFirstRuleSet  = (WhosOnFirstRuleSet)WhosOnFirstRuleSetGenerator.GenerateRuleSet(seed),
                MemoryRuleSet       = (MemoryRuleSet)MemoryRuleSetGenerator.GenerateRuleSet(seed),
                KeypadRuleSet       = (KeypadRuleSet)KeypadRuleSetGenerator.GenerateRuleSet(seed),
                NeedyKnobRuleSet    = (NeedyKnobRuleSet)NeedyKnobRuleSetGenerator.GenerateRuleSet(seed),
                ButtonRuleSet       = ButtonRuleSetGenerator.GenerateButtonRules(seed),
                WireSequenceRuleSet = (WireSequenceRuleSet)WireSequenceRuleSetGenerator.GenerateRuleSet(seed),
                PasswordRuleSet     = PasswordRuleSetGenerator.GeneratePasswordRules(seed),
                MorseCodeRuleSet    = MorseCodeRuleSetGenerator.GenerateMorseCodeRuleSet(seed),
                VennWireRuleSet     = VennWireRuleSetGenerator.GenerateVennWireRules(seed),
                RhythmHeavenRuleSet = (RhythmHeavenRuleSet)RhythmHeavenRuleSetGenerator.GenerateRuleSet(seed),
                MazeRuleSet         = (MazeRuleSet)MazeRuleSetGenerator.GenerateRuleSet(seed),
                SimonRuleSet        = SimonRuleSetGenerator.GenerateSimonRuleSet(seed)
            };

            ModRuleSetGenerator.Instance.CreateRules(seed);

            bombRules.PrintRules();
            bombRules.CacheStringValues();

            DebugLog("Done Generating Rules for seed {0}", seed);

            return(bombRules);
        }
Ejemplo n.º 3
0
 protected RuleManager()
 {
     WireRuleSetGenerator         = new WireRuleGenerator();
     WhosOnFirstRuleSetGenerator  = new WhosOnFirstRuleSetGenerator();
     MemoryRuleSetGenerator       = new MemoryRuleSetGenerator();
     KeypadRuleSetGenerator       = new KeypadRuleSetGenerator();
     NeedyKnobRuleSetGenerator    = new NeedyKnobRuleSetGenerator();
     ButtonRuleSetGenerator       = new ButtonRuleGenerator();
     WireSequenceRuleSetGenerator = new WireSequenceRuleSetGenerator();
     PasswordRuleSetGenerator     = new PasswordRuleGenerator();
     MorseCodeRuleSetGenerater    = new MorseCodeRuleGenerator();
     VennWireRuleSetGenerator     = new VennWireGenerator();
     MazeRuleSetGenerator         = new MazeRuleSetGenerator();
     SimonRuleSetGenerator        = new SimonRuleGenerator();
 }
Ejemplo n.º 4
0
        private static BombRules Initialize(int seed)
        {
            DebugLog("Generating Rules for seed {0}", seed);
            var rng       = new System.Random(seed);
            var bombRules = new BombRules
            {
                ManualMetaData = new ManualMetaData
                {
                    ManualVersion = OriginalBombRules.ManualMetaData.ManualVersion,
                    //ManualVersion = $"Rule Seed Modifier {OriginalBombRules.ManualMetaData.LanguageCode}-{seed}",
                    Seed         = seed,
                    LockCode     = OriginalBombRules.ManualMetaData.LockCode,
                    LanguageCode = OriginalBombRules.ManualMetaData.LanguageCode,
                    IsValid      = OriginalBombRules.ManualMetaData.IsValid
                },
                WireRuleSet         = WireRuleSetGenerator.CreateWireRules(seed),
                WhosOnFirstRuleSet  = (WhosOnFirstRuleSet)WhosOnFirstRuleSetGenerator.GenerateRuleSet(seed),
                MemoryRuleSet       = (MemoryRuleSet)MemoryRuleSetGenerator.GenerateRuleSet(seed),
                KeypadRuleSet       = (KeypadRuleSet)KeypadRuleSetGenerator.GenerateRuleSet(seed),
                NeedyKnobRuleSet    = (NeedyKnobRuleSet)NeedyKnobRuleSetGenerator.GenerateRuleSet(seed),
                ButtonRuleSet       = ButtonRuleSetGenerator.GenerateButtonRules(seed),
                WireSequenceRuleSet = WireSequenceRuleSetGenerator.GenerateWireSequenceRules(seed),
                PasswordRuleSet     = PasswordRuleSetGenerator.GeneratePasswordRules(seed),
                MorseCodeRuleSet    = MorseCodeRuleSetGenerator.GenerateMorseCodeRuleSet(seed),
                //MorseCodeRuleSet = (MorseCodeRuleSet) MorseCodeRuleSetGenerator.GenerateRuleSet(seed),
                VennWireRuleSet     = VennWireRuleSetGenerator.GenerateVennWireRules(seed),
                RhythmHeavenRuleSet = (RhythmHeavenRuleSet)RhythmHeavenRuleSetGenerator.GenerateRuleSet(seed),
                MazeRuleSet         = (MazeRuleSet)MazeRuleSetGenerator.GenerateRuleSet(seed),
                SimonRuleSet        = SimonRuleSetGenerator.GenerateSimonRuleSet(seed)
            };

            ModRuleSetGenerator.Instance.CreateRules(seed);

            try
            {
                bombRules.CacheStringValues();
            }
            catch (Exception ex)
            {
                DebugLog("Could not Print rules due to Exception: {0}", ex.Message);
                DebugLog(ex.StackTrace);
            }
            PrintRules(bombRules);

            DebugLog("Done Generating Rules for seed {0}", seed);

            return(bombRules);
        }
Ejemplo n.º 5
0
        public BombRules GenerateBombRules(int seed)
        {
            BombRules bombRules = new BombRules
            {
                WireRuleSet         = (WireRuleSet)WireRuleSetGenerator.CreateWireRules(seed),
                WhosOnFirstRuleSet  = (WhosOnFirstRuleSet)WhosOnFirstRuleSetGenerator.GenerateRuleSet(seed),
                MemoryRuleSet       = (MemoryRuleSet)MemoryRuleSetGenerator.GenerateRuleSet(seed),
                KeypadRuleSet       = (KeypadRuleSet)KeypadRuleSetGenerator.GenerateRuleSet(seed),
                NeedyKnobRuleSet    = (NeedyKnobRuleSet)NeedyKnobRuleSetGenerator.GenerateRuleSet(seed),
                ButtonRuleSet       = (ButtonRuleSet)ButtonRuleSetGenerator.GenerateButtonRules(seed),
                WireSequenceRuleSet = (WireSequenceRuleSet)WireSequenceRuleSetGenerator.GenerateRuleSet(seed),
                PasswordRuleSet     = (PasswordRuleSet)PasswordRuleSetGenerator.GeneratePasswordRules(seed),
                MorseCodeRuleSet    = (MorseCodeRuleSet)MorseCodeRuleSetGenerater.GenerateRuleSet(seed),
                VennWireRuleSet     = (VennWireRuleSet)VennWireRuleSetGenerator.GenerateVennWireRules(seed),
                MazeRuleSet         = (MazeRuleSet)MazeRuleSetGenerator.GenerateRuleSet(seed),
                SimonRuleSet        = (SimonRuleSet)SimonRuleSetGenerator.GenerateSimonRuleSet(seed)
            };

            bombRules.CacheStringValues();
            bombRules.PrintRules();
            return(bombRules);
        }