コード例 #1
0
    private IEnumerable <object> ProcessBlueArrows(KMBombModule module)
    {
        var comp      = GetComponent(module, "BlueArrowsScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");
        var fldCoord  = GetField <string>(comp, "coord");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_BlueArrows);

        string[] letters = { "CA", "C1", "CB", "C8", "CF", "C4", "CE", "C6", "3A", "31", "3B", "38", "3F", "34", "3E", "36", "GA", "G1", "GB", "G8", "GF", "G4", "GE", "G6", "7A", "71", "7B", "78", "7F", "74", "7E", "76", "DA", "D1", "DB", "D8", "DF", "D4", "DE", "D6", "5A", "51", "5B", "58", "5F", "54", "5E", "56", "HA", "H1", "HB", "H8", "HF", "H4", "HE", "H6", "2A", "21", "2B", "28", "2F", "24", "2E", "26" };
        string   coord   = fldCoord.Get(v => !letters.Contains(v) ? string.Format("expected one of: [{0}]", letters.JoinString(", ")) : null);

        addQuestion(module, Question.BlueArrowsInitialLetters, correctAnswers: new[] { coord });
    }
コード例 #2
0
    private IEnumerable <object> ProcessBreakfastEgg(KMBombModule module)
    {
        var comp      = GetComponent(module, "breakfastEggScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_BreakfastEgg);

        string[] colors = new[] { "Crimson", "Orange", "Pink", "Beige", "Cyan", "Lime", "Petrol" };
        int      yolkA  = GetIntField(comp, "yolkNumA").Get(min: 0, max: 7);
        int      yolkB  = GetIntField(comp, "yolkNumB").Get(min: 0, max: 7);

        addQuestion(module, Question.BreakfastEggColor, correctAnswers: new[] { colors[yolkA], colors[yolkB] });
    }
コード例 #3
0
    private IEnumerable <object> ProcessBartending(KMBombModule module)
    {
        var comp             = GetComponent(module, "Maker");
        var fldSolved        = GetField <bool>(comp, "_IsSolved");
        var fldIngredientIxs = GetArrayField <int>(comp, "ingIndices");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Bartending);

        var ingIxs          = fldIngredientIxs.Get(expectedLength: 5, validator: ing => ing < 0 || ing > 4 ? "expected 0–4" : null);
        var ingredientNames = new[] { "Powdered Delta", "Flanergide", "Adelhyde", "Bronson Extract", "Karmotrine" };

        addQuestions(module, ingIxs.Select((ingIx, pos) => makeQuestion(Question.BartendingIngredients, _Bartending, formatArgs: new[] { ordinal(pos + 1) }, correctAnswers: new[] { ingredientNames[ingIx] })));
    }
コード例 #4
0
    private IEnumerable <object> Process3DTapCode(KMBombModule module)
    {
        var comp      = GetComponent(module, "ThreeDTapCodeScript");
        var fldSolved = GetField <bool>(comp, "_moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_3DTapCode);

        var uncapitalizedWord = GetField <string>(comp, "_chosenWord").Get();
        var word     = uncapitalizedWord[0] + uncapitalizedWord.Substring(1).ToLowerInvariant();
        var allWords = GetArrayField <string>(comp, "_chosenWordList").Get(expectedLength: 125).Select(x => x[0] + x.Substring(1).ToLowerInvariant()).ToArray();

        addQuestion(module, Question._3DTapCodeWord, correctAnswers: new[] { word }, preferredWrongAnswers: allWords);
    }
コード例 #5
0
    private IEnumerable <object> ProcessForgetMe(KMBombModule module)
    {
        var comp      = GetComponent(module, "NotForgetMeNotScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_ForgetMe);

        string[] positions = { "top-left", "top-middle", "top-right", "middle-left", "center", "middle-right", "bottom-left", "bottom-middle", "bottom-right" };
        int[]    initState = GetArrayField <int>(comp, "givenPuzzle").Get(expectedLength: 9);
        addQuestions(module,
                     Enumerable.Range(0, 9).Where(ix => initState[ix] != 0).Select(ix =>
                                                                                   makeQuestion(Question.ForgetMeInitialState, _ForgetMe, formatArgs: new[] { positions[ix] }, correctAnswers: new[] { initState[ix].ToString() })));
    }
コード例 #6
0
    private IEnumerable <object> ProcessNumbers(KMBombModule module)
    {
        var comp      = GetComponent(module, "WAnumbersScript");
        var fldSolved = GetField <bool>(comp, "isSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Numbers);

        var numberValue1 = GetField <int>(comp, "numberValue1").Get();
        var numberValue2 = GetField <int>(comp, "numberValue2").Get();
        var answer       = numberValue1.ToString() + numberValue2.ToString();

        addQuestions(module, makeQuestion(Question.NumbersTwoDigit, _Numbers, formatArgs: null, correctAnswers: new[] { answer }));
    }
コード例 #7
0
    private IEnumerable <object> ProcessRetirement(KMBombModule module)
    {
        var comp      = GetComponent(module, "retirementScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Retirement);

        string[] homes     = GetArrayField <string>(comp, "retirementHomeOptions", isPublic: true).Get();
        string[] available = GetArrayField <string>(comp, "selectedHomes").Get();
        string   correct   = GetField <string>(comp, "correctHome").Get(str => str == "" ? "empty" : null);

        addQuestion(module, Question.RetirementHouses, correctAnswers: available.Where(x => x != correct).ToArray(), preferredWrongAnswers: homes);
    }
コード例 #8
0
    private IEnumerable <object> ProcessCritters(KMBombModule module)
    {
        var comp       = GetComponent(module, "CrittersScript");
        var fldSolved  = GetField <bool>(comp, "_isModuleSolved");
        var fldColorIx = GetIntField(comp, "_randomiser");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Critters);

        var colorNames = new[] { "Yellow", "Pink", "Blue" };
        var colorIx    = fldColorIx.Get(min: 0, max: 2);

        addQuestions(module, makeQuestion(Question.CrittersAlterationColor, _Critters, correctAnswers: new[] { colorNames[colorIx] }));
    }
コード例 #9
0
    private IEnumerable <object> ProcessColourFlash(KMBombModule module)
    {
        var comp = GetComponent(module, "ColourFlashModule");

        var fldSolved = GetField <bool>(comp, "_solved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_ColourFlash);

        var fldColorSequence = GetArrayField <object>(comp, "_colourSequence").Get(ar => ar.Length != 8 ? "expected length 8" : null);
        var colorValue       = GetField <object>(fldColorSequence.GetValue(7), "ColourValue", isPublic: true).Get();

        addQuestion(module, Question.ColourFlashLastColor, correctAnswers: new[] { colorValue.ToString() });
    }
コード例 #10
0
    public MonoRandom GetRNG()
    {
        if (Application.isEditor)
        {
            return(new MonoRandom(_seed));
        }

        GameObject ruleSeedModifierAPIGameObject = GameObject.Find("RuleSeedModifierProperties");

        if (ruleSeedModifierAPIGameObject == null) // Rule Seed Modifer is not installed
        {
            return(new MonoRandom(1));
        }

        IDictionary <string, object> ruleSeedModifierAPI = ruleSeedModifierAPIGameObject.GetComponent <IDictionary <string, object> >();

        if (!ruleSeedModifierAPI.ContainsKey("RuleSeed"))
        {
            return(new MonoRandom(1));
        }

        // Add the module to the list of supported modules if possible.
        if (ruleSeedModifierAPI.ContainsKey("AddSupportedModule"))
        {
            string        key;
            KMBombModule  bombModule  = GetComponent <KMBombModule>();
            KMNeedyModule needyModule = GetComponent <KMNeedyModule>();

            if (bombModule != null)
            {
                key = bombModule.ModuleType;
            }
            else if (needyModule != null)
            {
                key = needyModule.ModuleType;
            }
            else
            {
                key = Regex.Replace(gameObject.name, @"\(Clone\)$", "");
            }

            ruleSeedModifierAPI["AddSupportedModule"] = key;
        }

        return(new MonoRandom((ruleSeedModifierAPI["RuleSeed"] as int?) ?? 1));
    }
コード例 #11
0
    private IEnumerable <object> ProcessCodenames(KMBombModule module)
    {
        var comp      = GetComponent(module, "codenames");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Codenames);

        var words         = GetArrayField <string>(comp, "grid").Get(expectedLength: 25);
        var solution      = GetArrayField <bool>(comp, "solution").Get(expectedLength: 25);
        var solutionWords = words.Where((w, i) => solution[i]).ToArray();

        addQuestion(module, Question.CodenamesAnswers, correctAnswers: solutionWords, preferredWrongAnswers: words.Where(x => !solutionWords.Contains(x)).ToArray());
    }
コード例 #12
0
    private IEnumerable <object> ProcessCube(KMBombModule module)
    {
        var comp      = GetComponent(module, "theCubeScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Cube);

        var rotations     = GetListField <int>(comp, "selectedRotations").Get(expectedLength: 6);
        var rotationNames = new[] { "rotate cw", "tip left", "tip backwards", "rotate ccw", "tip right", "tip forwards" };
        var allRotations  = rotations.Select(r => rotationNames[r]).ToArray();

        addQuestions(module, rotations.Select((rot, ix) => makeQuestion(Question.CubeRotations, _Cube, formatArgs: new[] { ordinal(ix + 1) }, correctAnswers: new[] { rotationNames[rot] }, preferredWrongAnswers: allRotations)));
    }
コード例 #13
0
    private IEnumerable <object> ProcessRoger(KMBombModule module)
    {
        var comp   = GetComponent(module, "rogerScript");
        var solved = false;

        module.OnPass += delegate { solved = true; return(false); };

        while (!solved)
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Roger);

        var seededAnswer = GetField <int>(comp, "seed").Get().ToString().PadLeft(4, '0');

        addQuestions(module, makeQuestion(Question.RogerSeed, _Roger, formatArgs: null, correctAnswers: new[] { seededAnswer }));
    }
コード例 #14
0
    private IEnumerable <object> ProcessPixelCipher(KMBombModule module)
    {
        var comp      = GetComponent(module, "pixelcipherScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_PixelCipher);

        var keywords      = GetArrayField <string>(comp, "pixelKeyword").Get();
        var pickedKeyword = GetIntField(comp, "pickedKeyword").Get(0, keywords.Length - 1);

        addQuestions(module,
                     makeQuestion(Question.PixelCipherKeyword, _PixelCipher, correctAnswers: new[] { keywords[pickedKeyword] }));
    }
コード例 #15
0
    private IEnumerable <object> ProcessKeypadMagnified(KMBombModule module)
    {
        var comp      = GetComponent(module, "KeypadMagnifiedScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        var LEDPos = GetIntField(comp, "chosenPosition").Get(min: 0, max: 3);

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(0.1f));
        }
        _modulesSolved.IncSafe(_KeypadMagnified);

        var posNames = new[] { "Top-left", "Top-right", "Bottom-left", "Bottom-right" };

        addQuestion(module, Question.KeypadMagnifiedLED, correctAnswers: new[] { posNames[LEDPos] });
    }
コード例 #16
0
    private IEnumerable <object> ProcessCreation(KMBombModule module)
    {
        var comp       = GetComponent(module, "CreationModule");
        var fldSolved  = GetField <bool>(comp, "Solved");
        var fldDay     = GetIntField(comp, "Day");
        var fldWeather = GetField <string>(comp, "Weather");

        var weatherNames = GetAnswers(Question.CreationWeather);

        while (!_isActivated)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        var currentDay     = fldDay.Get(min: 1, max: 1);
        var currentWeather = fldWeather.Get(cw => !weatherNames.Contains(cw) ? "unknown weather" : null);
        var allWeather     = new List <string>();

        while (true)
        {
            while (fldDay.Get() == currentDay && !fldSolved.Get() && currentWeather == fldWeather.Get())
            {
                yield return(new WaitForSeconds(0.1f));
            }

            if (fldSolved.Get())
            {
                break;
            }

            if (fldDay.Get() <= currentDay)
            {
                allWeather.Clear();
            }
            else
            {
                allWeather.Add(currentWeather);
            }

            currentDay     = fldDay.Get(min: 1, max: 6);
            currentWeather = fldWeather.Get(cw => !weatherNames.Contains(cw) ? "unknown weather" : null);
        }

        _modulesSolved.IncSafe(_Creation);
        addQuestions(module, allWeather.Select((t, i) => makeQuestion(Question.CreationWeather, _Creation, formatArgs: new[] { ordinal(i + 1) }, correctAnswers: new[] { t })));
    }
コード例 #17
0
    private IEnumerable <object> ProcessLasers(KMBombModule module)
    {
        var comp      = GetComponent(module, "LasersModule");
        var fldSolved = GetField <bool>(comp, "_isSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Lasers);

        var laserOrder     = GetListField <int>(comp, "_laserOrder").Get(expectedLength: 9);
        var hatchesPressed = GetListField <int>(comp, "_hatchesAlreadyPressed").Get(expectedLength: 7);
        var hatchNames     = new[] { "top-left", "top-middle", "top-right", "middle-left", "center", "middle-right", "bottom-left", "bottom-middle", "bottom-right" };

        addQuestions(module, hatchesPressed.Select((hatch, ix) => makeQuestion(Question.LasersHatches, _Lasers, formatArgs: new[] { hatchNames[hatch] }, correctAnswers: new[] { laserOrder[hatch].ToString() }, preferredWrongAnswers: hatchesPressed.Select(number => laserOrder[number].ToString()).ToArray())));
    }
コード例 #18
0
    private IEnumerable <object> ProcessAlfaBravo(KMBombModule module)
    {
        var comp      = GetComponent(module, "AlfaBravoModule");
        var fldSolved = GetProperty <bool>(comp, "solved", true);

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_AlfaBravo);

        if (GetProperty <bool>(comp, "forceSolved", true).Get())
        {
            Debug.LogFormat("[Souvenir #{0}] No question for Alfa-Bravo because the module was force-solved.", _moduleId);
            _legitimatelyNoQuestions.Add(module);
            yield break;
        }

        var questions = new List <QandA>();

        var pressedLetter = GetProperty <char>(comp, "souvenirPressedLetter", true).Get();

        if (pressedLetter != 0)
        {
            questions.Add(makeQuestion(Question.AlfaBravoPressedLetter, _AlfaBravo, correctAnswers: new[] { pressedLetter.ToString() }));
        }

        var letterToTheLeftOfPressedOne = GetProperty <char>(comp, "souvenirLetterToTheLeftOfPressedOne", true).Get();

        if (letterToTheLeftOfPressedOne != 0)
        {
            questions.Add(makeQuestion(Question.AlfaBravoLeftPressedLetter, _AlfaBravo, correctAnswers: new[] { letterToTheLeftOfPressedOne.ToString() }));
        }

        var letterToTheRightOfPressedOne = GetProperty <char>(comp, "souvenirLetterToTheRightOfPressedOne", true).Get();

        if (letterToTheRightOfPressedOne != 0)
        {
            questions.Add(makeQuestion(Question.AlfaBravoRightPressedLetter, _AlfaBravo, correctAnswers: new[] { letterToTheRightOfPressedOne.ToString() }));
        }

        questions.Add(makeQuestion(Question.AlfaBravoDigit, _AlfaBravo, correctAnswers: new[] { GetProperty <int>(comp, "souvenirDisplayedDigit", true).Get().ToString() }));

        addQuestions(module, questions);
    }
コード例 #19
0
    private IEnumerable <object> ProcessRegularCrazyTalk(KMBombModule module)
    {
        var comp      = GetComponent(module, "RegularCrazyTalkModule");
        var fldSolved = GetField <bool>(comp, "_isSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_RegularCrazyTalk);

        var phrases  = GetField <IList>(comp, "_phraseActions").Get();
        var selected = GetField <int>(comp, "_selectedPhraseIx").Get();

        var selectedPhrase = phrases[selected];
        var phraseText     = GetField <string>(selectedPhrase, "Phrase", isPublic: true).Get(v => string.IsNullOrEmpty(v) ? "‘Phrase’ is empty" : null);
        var displayDigit   = GetField <int>(selectedPhrase, "ExpectedDigit", isPublic: true).Get();

        string modifier = "[PHRASE]";

        if (phraseText.Length >= 10 && phraseText.Substring(0, 10) == "It says: “")
        {
            modifier = "It says: “[PHRASE]”";
        }
        else if (phraseText.Length >= 9 && phraseText.Substring(0, 9) == "“It says:")
        {
            modifier = "“It says: [PHRASE]”";
        }
        else if (phraseText.Length >= 8 && phraseText.Substring(0, 8) == "It says:")
        {
            modifier = "It says: [PHRASE]";
        }
        else if (phraseText.Length >= 6 && phraseText.Substring(0, 6) == "Quote:")
        {
            modifier = "Quote: [PHRASE] End quote";
        }
        else if (phraseText.Substring(0, 1) == "“")
        {
            modifier = "“[PHRASE]”";
        }

        addQuestions(module,
                     makeQuestion(Question.RegularCrazyTalkDigit, _RegularCrazyTalk, correctAnswers: new[] { displayDigit.ToString() }),
                     makeQuestion(Question.RegularCrazyTalkModifier, _RegularCrazyTalk, correctAnswers: new[] { modifier }));
    }
コード例 #20
0
    private IEnumerable <object> ProcessObjectShows(KMBombModule module)
    {
        var comp      = GetComponent(module, "objectShows");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_ObjectShows);

        var contestantNames = GetArrayField <string>(comp, "charnames", isPublic: true).Get();
        var solutionObjs    = GetField <Array>(comp, "solution").Get(ar => ar.Length != 5 ? "expected length 5" : ar.Cast <object>().Any(obj => obj == null) ? "contains null" : null).Cast <object>().ToArray();
        var fldId           = GetIntField(solutionObjs[0], "id", isPublic: true);
        var solutionNames   = solutionObjs.Select(c => contestantNames[fldId.GetFrom(c, min: 0, max: contestantNames.Length - 1)]).ToArray();

        addQuestion(module, Question.ObjectShowsContestants, correctAnswers: solutionNames, preferredWrongAnswers: contestantNames);
    }
コード例 #21
0
    private IEnumerable <object> ProcessUSACycle(KMBombModule module)
    {
        var comp            = GetComponent(module, "USACycle");
        var fldSolved       = GetField <bool>(comp, "ModuleSolved");
        var fldStateIndices = GetListField <int>(comp, "StateIndexes");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_USACycle);

        int[] stateIndices = fldStateIndices.Get(minLength: 4).Where(ix => ix != 5 && ix != 49).ToArray();
        //Colorado and Wyoming are practically indistinguishable
        addQuestion(module, Question.USACycleDisplayed,
                    correctAnswers: stateIndices.Select(ix => USACycleSprites[ix]).ToArray(),
                    preferredWrongAnswers: USACycleSprites.Where((_, pos) => pos != 5 && pos != 49).ToArray());
    }
コード例 #22
0
ファイル: ModulesD.cs プロジェクト: rocket0634/KtaneSouvenir
    private IEnumerable <object> ProcessDiscoloredSquares(KMBombModule module)
    {
        var comp      = GetComponent(module, "DiscoloredSquaresModule");
        var fldSolved = GetField <bool>(comp, "_isSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_DiscoloredSquares);

        var colorsRaw = GetField <Array>(comp, "_rememberedColors").Get(arr => arr.Length != 4 ? "expected length 4" : null);
        var positions = GetArrayField <int>(comp, "_rememberedPositions").Get(expectedLength: 4);
        var colors    = colorsRaw.Cast <object>().Select(obj => obj.ToString()).ToArray();

        addQuestions(module, Enumerable.Range(0, 4).Select(color =>
                                                           makeQuestion(Question.DiscoloredSquaresRememberedPositions, _DiscoloredSquares, formatArgs: new[] { colors[color] }, correctAnswers: new[] { new Coord(4, 4, positions[color]) })));
    }
コード例 #23
0
    private IEnumerable <object> ProcessKudosudoku(KMBombModule module)
    {
        var comp      = GetComponent(module, "KudosudokuModule");
        var fldSolved = GetField <bool>(comp, "_isSolved");
        var shown     = GetArrayField <bool>(comp, "_shown").Get(expectedLength: 16).ToArray(); // Take a copy of the array because the module changes it

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_Kudosudoku);

        addQuestions(module,
                     makeQuestion(Question.KudosudokuPrefilled, _Kudosudoku, formatArgs: new[] { "pre-filled" },
                                  correctAnswers: Enumerable.Range(0, 16).Where(ix => shown[ix]).Select(coord => new Coord(4, 4, coord)).ToArray()),
                     makeQuestion(Question.KudosudokuPrefilled, _Kudosudoku, formatArgs: new[] { "not pre-filled" },
                                  correctAnswers: Enumerable.Range(0, 16).Where(ix => !shown[ix]).Select(coord => new Coord(4, 4, coord)).ToArray()));
    }
コード例 #24
0
 private void SolveModule(Module module)
 {
     if (!Leaderboardoff)
     {
         ChangeLeaderboard(true);
         Debug.Log("[Command Line] Disabling leaderboard.");
     }
     try {
         KMBombModule KMmodule = module.BombComponent.GetComponent <KMBombModule>();
         CommonReflectedTypeInfo.HandlePassMethod.Invoke(module.BombComponent, null);
         foreach (MonoBehaviour behavior in module.BombComponent.GetComponentsInChildren <MonoBehaviour>(true))
         {
             behavior.StopAllCoroutines();
         }
     } catch (Exception ex) {
         Log($"Exception while force solving module: {ex}");
     }
 }
コード例 #25
0
    private IEnumerable <object> ProcessTouchTransmission(KMBombModule module)
    {
        var comp      = GetComponent(module, "TouchTransmissionScript");
        var fldSolved = GetField <bool>(comp, "moduleSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_TouchTransmission);

        var fldGenWord = GetField <string>(comp, "generatedWord");
        var fldOrder   = GetField <object>(comp, "chosenOrder");

        addQuestions(module,
                     makeQuestion(Question.TouchTransmissionWord, _TouchTransmission, correctAnswers: new[] { fldGenWord.Get().ToLowerInvariant() }),
                     makeQuestion(Question.TouchTransmissionOrder, _TouchTransmission, correctAnswers: new[] { fldOrder.Get().ToString().Replace('_', ' ') }));
    }
コード例 #26
0
    private IEnumerable <object> ProcessIPA(KMBombModule module)
    {
        var comp      = GetComponent(module, "ipa");
        var fldSolved = GetField <bool>(comp, "moduleSolved");
        var symbols   = GetStaticField <string[]>(comp.GetType(), "symbols").Get();

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_IPA);

        var soundIx  = GetIntField(comp, "soundPresent").Get(0, symbols.Length - 1);
        var textMesh = GetArrayField <TextMesh>(comp, "buttonTexts", isPublic: true).Get(expectedLength: 9)[0];

        addQuestions(module, makeQuestion(Question.IpaSymbol, _IPA, textMesh.font, textMesh.GetComponent <MeshRenderer>().sharedMaterial.mainTexture,
                                          correctAnswers: new[] { symbols[soundIx] }, preferredWrongAnswers: symbols));
    }
コード例 #27
0
ファイル: ModulesD.cs プロジェクト: rocket0634/KtaneSouvenir
    private IEnumerable <object> ProcessDecoloredSquares(KMBombModule module)
    {
        var comp      = GetComponent(module, "DecoloredSquaresModule");
        var fldSolved = GetField <bool>(comp, "_isSolved");

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_DecoloredSquares);

        var colColor = GetField <string>(comp, "_color1").Get();
        var rowColor = GetField <string>(comp, "_color2").Get();

        addQuestions(module,
                     makeQuestion(Question.DecoloredSquaresStartingPos, _DecoloredSquares, formatArgs: new[] { "column" }, correctAnswers: new[] { colColor }),
                     makeQuestion(Question.DecoloredSquaresStartingPos, _DecoloredSquares, formatArgs: new[] { "row" }, correctAnswers: new[] { rowColor }));
    }
コード例 #28
0
    private IEnumerable <object> ProcessiPhone(KMBombModule module)
    {
        var comp      = GetComponent(module, "iPhoneScript");
        var fldSolved = GetField <string>(comp, "solved");
        var digits    = GetListField <string>(comp, "pinDigits", isPublic: true).Get(expectedLength: 4);

        while (fldSolved.Get() != "solved")
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_iPhone);

        addQuestions(module,
                     makeQuestion(Question.iPhoneDigits, _iPhone, formatArgs: new[] { "first" }, correctAnswers: new[] { digits[0] }, preferredWrongAnswers: new[] { digits[1], digits[2], digits[3] }),
                     makeQuestion(Question.iPhoneDigits, _iPhone, formatArgs: new[] { "second" }, correctAnswers: new[] { digits[1] }, preferredWrongAnswers: new[] { digits[0], digits[2], digits[3] }),
                     makeQuestion(Question.iPhoneDigits, _iPhone, formatArgs: new[] { "third" }, correctAnswers: new[] { digits[2] }, preferredWrongAnswers: new[] { digits[1], digits[0], digits[3] }),
                     makeQuestion(Question.iPhoneDigits, _iPhone, formatArgs: new[] { "fourth" }, correctAnswers: new[] { digits[3] }, preferredWrongAnswers: new[] { digits[1], digits[2], digits[0] }));
    }
コード例 #29
0
    private IEnumerable <object> ProcessGreenButton(KMBombModule module)
    {
        var comp      = GetComponent(module, "GreenButtonScript");
        var fldSolved = GetField <bool>(comp, "_moduleSolved");
        var words     = GetStaticField <List <string> >(comp.GetType(), "_words").Get().Select(w => w[0] + w.Substring(1).ToLowerInvariant()).ToArray();

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_GreenButton);

        var displayedString = GetField <string>(comp, "_displayedString").Get(validator: str => str.Length != 7 ? "expected length 7" : null);
        var submission      = GetArrayField <bool>(comp, "_submission").Get(expectedLength: 7);
        var submittedWord   = Enumerable.Range(0, displayedString.Length).Select(ix => submission[ix] ? displayedString.Substring(ix, 1) : "").JoinString();

        addQuestions(module, makeQuestion(Question.GreenButtonWord, _GreenButton, correctAnswers: new[] { submittedWord[0] + submittedWord.Substring(1).ToLowerInvariant() }, preferredWrongAnswers: words));
    }
コード例 #30
0
    private IEnumerable <object> Process1DChess(KMBombModule module)
    {
        var comp      = GetComponent(module, "OneDimensionalChessScript");
        var fldSolved = GetProperty <bool>(comp, "IsSolved", isPublic: true);

        while (!fldSolved.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_1DChess);

        var moves = GetListField <string>(comp, "souvenirPositions").Get();

        addQuestions(module, moves.Select((move, ix) =>
                                          makeQuestion(Question._1DChessMoves, _1DChess,
                                                       formatArgs: new[] { new[] { "your first move", "Rustmate’s first move", "your second move", "Rustmate’s second move", "your third move", "Rustmate’s third move", "your fourth move", "Rustmate’s fourth move", "your fifth move", "Rustmate’s fifth move", "your sixth move", "Rustmate’s sixth move", "your seventh move", "Rustmate’s seventh move", "your eighth move", "Rustmate’s eighth move" }[ix] },
                                                       correctAnswers: new[] { move })));
    }