示例#1
0
    private void StartPatchFileSelection()
    {
        ShowOptions(TechSupportData.PatchFiles, selectPatchFileMessage);

        onSelected = delegate
        {
            ConfirmSelection();

            int correctPatchFile = CorrectPatchFile(errorData);

            TechSupportLog.LogFormat("Patch File: Selected option: {0}; Correct option {1}.",
                                     TechSupportData.PatchFiles[selectedOption],
                                     TechSupportData.PatchFiles[correctPatchFile]);

            if (selectedOption == correctPatchFile || forcePatchFileCorrect)
            {
                console.Show(correctSelectionMessage);
                StartParametersSelection();
            }
            else
            {
                TechSupportLog.Log("STRIKE: Wrong patch file.");
                needyModule.HandleStrike();
                console.Show(incorrectSelectionMessage);
                StartPatchFileSelection();
            }
        };
    }
示例#2
0
    private void StartVersionSelection()
    {
        ShowOptions(TechSupportData.VersionNumbers, selectVersionMessage);

        onSelected = delegate
        {
            ConfirmSelection();

            int correctVersion = CorrectVersion(errorData);

            TechSupportLog.LogFormat("Software Version: Selected option: {0}; Correct option {1}.",
                                     TechSupportData.VersionNumbers[selectedOption],
                                     TechSupportData.VersionNumbers[correctVersion]);

            if (selectedOption == correctVersion || forceVersionCorrect)
            {
                console.Show(correctSelectionMessage);
                StartPatchFileSelection();
            }
            else
            {
                TechSupportLog.Log("STRIKE: Wrong software version.");
                needyModule.HandleStrike();
                console.Show(incorrectSelectionMessage);
                StartVersionSelection();
            }
        };
    }
示例#3
0
    private void OnTimerExpired()
    {
        if (moduleResolved)
        {
            return;
        }

        TechSupportLog.Log("STRIKE: Timer Expired");
        needyModule.HandleStrike();

        for (int i = 0; i < options.Count; i++)
        {
            console.Remove(options[i].B);
        }

        console.Show(timerExpiredMessage);
        StartCoroutine(RebootModule());
    }
示例#4
0
    private void StartParametersSelection()
    {
        ShowOptions(TechSupportData.Parameters, selectParametersMessage);

        onSelected = delegate
        {
            ConfirmSelection();

            int correctParameter = CorrectParameter(errorData);

            TechSupportLog.LogFormat("Parameter: Selected option: {0}; Correct option {1}.",
                                     TechSupportData.Parameters[selectedOption],
                                     TechSupportData.Parameters[correctParameter]);

            if (selectedOption == correctParameter || forceParametersCorrect)
            {
                ReactivateInterruptedModule();
                moduleResolved = true;
                console.Show(correctSelectionMessage);

                if (errorData.ModuleName == null)
                {
                    console.Show(exceptionWithoutModuleResolvedMessage);
                }
                else
                {
                    InterruptableModule module = interruptableModules[interrupted];
                    string message             = string.Format(moduleReleasedFormat, module.BombModule.ModuleDisplayName);
                    console.Show(message);
                }
            }
            else
            {
                TechSupportLog.Log("STRIKE: Wrong parameters.");
                needyModule.HandleStrike();
                console.Show(incorrectSelectionMessage);
                StartParametersSelection();
            }
        };
    }
    private void Serialize(GameObject obj, int i)
    {
        string output = "";

        for (int j = 0; j < i; j++)
        {
            output += "\t";
        }

        output += obj.name;

        TechSupportLog.Log(output);

        output = "";

        Component[] components = obj.GetComponents <Component>();
        foreach (Component c in components)
        {
            output = "";
            for (int j = 0; j < i; j++)
            {
                output += "\t";
            }
            output += " [c] " + c.GetType().ToString();
            TechSupportLog.Log(output);
        }


        int childCount = obj.transform.childCount;

        for (int j = 0; j < childCount; j++)
        {
            GameObject child = obj.transform.GetChild(j).gameObject;
            Serialize(child, i + 1);
        }
    }
示例#6
0
    private IEnumerator DelayedStart()
    {
        TechSupportService mysteryKeyService = GetComponent <TechSupportService>();

        while (!mysteryKeyService.SettingsLoaded)
        {
            yield return(null);
        }

        KMBossModule bossModule = GetComponent <KMBossModule>();

        string[] ignoredModules = bossModule.GetIgnoredModules(needyModule.ModuleDisplayName);

        if (ignoredModules == null || ignoredModules.Length == 0)
        {
            TechSupportLog.Log("Using backup ignorelist.");
            ignoredModules = backUpIgnoreList.text.Split('\n');
        }

        KMBombModule[] bombModules = FindObjectsOfType <KMBombModule>();

        foreach (KMBombModule bombModule in bombModules)
        {
            try
            {
                bool mustNotBeHidden = mysteryKeyService.MustNotBeHidden(bombModule.ModuleType);
                bool isIgnored       = ignoredModules.Contains(bombModule.ModuleDisplayName);

                // Ignored modules are ignored.
                if (mustNotBeHidden || isIgnored)
                {
                    TechSupportLog.LogFormat("Ignored module {0} - Must Not Be Hidden: {1}; Is Ignored {2}",
                                             bombModule.ModuleDisplayName,
                                             mustNotBeHidden,
                                             isIgnored);
                    continue;
                }

                // Collects the module's KMSelectable.
                KMSelectable selectable = bombModule.GetComponent <KMSelectable>();

                GameObject passLight   = TransformUtilities.FindChildIn(bombModule.transform, "Component_LED_PASS").gameObject;
                Transform  statusLight = passLight.transform.parent;
                GameObject strikeLight = TransformUtilities.FindChildIn(statusLight, "Component_LED_STRIKE").gameObject;
                GameObject errorLight  = Instantiate(
                    errorLightPrefab,
                    statusLight.position,
                    statusLight.rotation,
                    statusLight.transform);
                errorLight.SetActive(false);

                // Stores the acquired data.
                InterruptableModule interruptableModule = new InterruptableModule(bombModule, selectable, passLight, strikeLight, errorLight);

                interruptableModules.Add(interruptableModule);
            }
            catch (Exception exception)
            {
                TechSupportLog.LogFormat
                    ("Set-Up Interruptable ({0}) failed with message ({1}), at ({2}).",
                    bombModule.ModuleDisplayName,
                    exception.Message,
                    exception.StackTrace);
            }
        }

        TechSupportLog.LogFormat("Loaded total of {0} interruptable modules", interruptableModules.Count);
    }
示例#7
0
    private void Interrupt()
    {
        moduleResolved = false;

        // Selects module to interrupt.
        InterruptableModule selected = null;

        // The module can no longer reset when too little time is left.
        float bombTime = bombInfo.GetTime();

        if (bombTime >= needyModule.CountdownTime)
        {
            InterruptableModule[] potentials = new InterruptableModule[interruptableModules.Count];
            interruptableModules.CopyTo(potentials);
            potentials.Shuffle();

            foreach (InterruptableModule current in potentials)
            {
                // A module is only interrupted when the off light is on,
                // and it isn't currently used.
                TechSupportLog.Log(!current.PassLight.activeSelf
                                   + " " + !current.StrikeLight.activeSelf
                                   + " " + !current.ErrorLight.activeSelf
                                   + " " + !current.IsFocussed);

                if (!current.PassLight.activeSelf &&
                    !current.StrikeLight.activeSelf &&
                    !current.ErrorLight.activeSelf &&
                    !current.IsFocussed)
                {
                    selected = current;
                    break;
                }
            }

            interrupted = interruptableModules.IndexOf(selected);
        }
        else
        {
            TechSupportLog.Log("Not enough time left, forcing to interrupt without module.");
        }

        // Interrupts that module (if there is one).
        if (selected == null)
        {
            TechSupportLog.Log("Could not find interruptable module. Creating exception without one.");

            errorData = data.GenerateError(null);
            allErrors.Add(errorData);

            string message = exceptionWithoutModuleMessages[Random.Range(0, exceptionWithoutModuleMessages.Length)];
            message = string.Format(message, errorData.Error, errorData.SourceFile, errorData.LineIndex, errorData.ColumnIndex);
            console.Show(message);
        }
        else
        {
            TechSupportLog.LogFormat("Interrupting: {0}", selected.BombModule.ModuleDisplayName);

            // All other lights are disabled, and the error light is enabled.
            Transform parent     = selected.PassLight.transform.parent;
            int       childCount = parent.childCount;
            for (int i = 0; i < childCount; i++)
            {
                parent.GetChild(i).gameObject.SetActive(false);
            }

            selected.ErrorLight.SetActive(true);

            // Disabling all interaction with the module.
            interruptedInteractHandler     = selected.Selectable.OnInteract;
            selected.Selectable.OnInteract = new KMSelectable.OnInteractHandler(delegate
            {
                bombAudio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.NeedyActivated, selected.BombModule.transform);
                return(false);
            });

            // Generating error and Updating the console.
            errorData = data.GenerateError(selected.BombModule.ModuleDisplayName);
            allErrors.Add(errorData);

            string message = string.Format(errorFormat, selected.BombModule.ModuleDisplayName, errorData.Error, errorData.SourceFile, errorData.LineIndex, errorData.ColumnIndex);
            console.Show(message);
        }

        StartVersionSelection();
    }