Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     player                = GameObject.Find("Player");
     playerController      = player.GetComponent <PlayerController>();
     terminalUI            = ui.GetComponent <TerminalUI>();
     terminalUI.terminalId = terminalId;
 }
Ejemplo n.º 2
0
    public void AttemptSolve()
    {
        NetworkDevice   device = TerminalNetwork.GetCurrentDevice();
        NetworkFirewall wall   = device.networkNode.FireWall;

        NetworkFirewall.FirewallLevel level = wall.GetNextClosedFirewall();
        int levelIndex = wall.GetNextClosedFirewallIndex();

        if (level.CurrentGuess == level.Password)
        {
            level.Unlocked = true;

            ModifyLevel(levelIndex, true);

            TerminalCore.AddMessage(
                string.Format("\t- Firewall Cracked:" + TerminalColourScheme.FormatText("{0}/{1}", TerminalStyle.INFO),
                              wall.GetSolvedLevels(),
                              wall.GetTotalLevels()
                              ));


            if (wall.GetSolvedLevels() == wall.GetTotalLevels())
            {
                TerminalCore.AddMessage(TerminalColourScheme.FormatText("\n\t- Firewall Broken.", TerminalStyle.WARNING) + TerminalColourScheme.FormatText("\n\tAccess Granted.", TerminalStyle.INFO));
            }
        }
        else
        {
            TerminalUI.ForceInput("solve ");
        }
    }
Ejemplo n.º 3
0
    internal static void UpdateConsoleLine(CachedConsoleLine cachedConsoleLine)
    {
        TerminalUI ui = FindObjectOfType <TerminalUI>();

        string[] lines = ui.outputText.text.Split('\n');

        if (!cachedConsoleLine.IsAlive())
        {
            return;
        }

        if (cachedConsoleLine.lineNumber > lines.Length)
        {
            return;
        }

        Debug.Log(cachedConsoleLine.lineNumber);
        lines[cachedConsoleLine.lineNumber] = cachedConsoleLine.ConsoleLine;
        string text = lines[0];

        for (int i = 1; i < lines.Length; i++)
        {
            text += "\n" + lines[i];
        }

        FindObjectOfType <TerminalUI>().outputText.text = text;
    }
Ejemplo n.º 4
0
    public void Setup(int id, bool isWallSlot, TerminalUI parent)
    {
        this.id     = id;
        this.isWall = isWallSlot;
        this.parent = parent;

        text.text = string.Format(isWallSlot ? wallSlotFormat : floorSlotFormat, id);
    }
Ejemplo n.º 5
0
    public void PrintDirectory(FSDirectory directory) //c/user/documents
    {
        string message        = directory.Name;
        string preUnused      = FileSystem.GetDirectoryPath(directory);
        int    fileCount      = directory.Files.Count;
        int    dirCount       = directory.Directories.Count;
        int    totalCount     = fileCount + dirCount;
        int    totalFileCount = GetFilesInDirectory(directory).Count;
        int    parentCount    = FileSystem.GetParentCount(directory);

        if (totalFileCount > 0)
        {
            foreach (FSFile file in directory.Files)
            {
                string line = "";
                for (int i = 0; i < parentCount; i++)
                {
                    line += separator;
                }
                line += TerminalUI.ColorText(file.Name, fileColor);
                TerminalCore.AddMessage(line);
            }
            foreach (FSDirectory dir in directory.Directories)
            {
                if (GetFilesInDirectory(dir).Count > 0)
                {
                    string line = "";
                    for (int i = 0; i < parentCount; i++)
                    {
                        line += separator;
                    }
                    line += TerminalUI.ColorText(dir.Name, folderColor);
                    TerminalCore.AddMessage(line);
                    PrintDirectory(dir);
                }
            }
        }

        /*
         * 0 -
         * 1 file - samel line
         * 1 folder - same line
         * file + folder - list
         */
        return;
    }
Ejemplo n.º 6
0
    public void Setup(BaseObject baseObject, TerminalUI parent, bool alreadyInSlot)
    {
        this.baseObject    = baseObject;
        this.parent        = parent;
        this.alreadyInSlot = alreadyInSlot;

        if (baseObject.oreCost == 0)
        {
            oreCost.SetActive(false);
        }
        else
        {
            oreCostText.text = baseObject.oreCost.ToString();
        }

        previewImage.sprite = baseObject.preview;
        nameText.text       = baseObject.name;
    }
Ejemplo n.º 7
0
 void Awake()
 {
     _ui = GetComponent <TerminalUI>();
     EventSystem.current.SetSelectedGameObject(_ui.inputField.gameObject, null);
     _ui.inputField.OnPointerClick(new PointerEventData(EventSystem.current));
 }
Ejemplo n.º 8
0
 protected override void Start()
 {
     base.Start();
     computerUI = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <TerminalUI> ();
 }