示例#1
0
    private void LoadSavedState(string stateString)
    {
        string[] termInfo   = IGC_Utils.SplitString(":", stateString);
        int      vsID       = System.Int32.Parse(termInfo[3]);
        bool     powerstate = (termInfo[2] == "True" ? true : false);
        string
            currentUsername = termInfo[0],
            prevUsername    = termInfo[1],
            rawPrompt       = (termInfo[4] != "null" ? IGC_Utils.UnescapeSaved(termInfo[4]) : ""),
            rawDisplay      = (termInfo[5] != "null" ? IGC_Utils.UnescapeSaved(termInfo[5]) : "");

        screenColor = IGC_Utils.ColorFromString(termInfo [6]);
        textColor   = IGC_Utils.ColorFromString(termInfo [7]);

        //set vs
        if (vsID != this.virtualSystem.instanceID)
        {
            IGC_VirtualSystem tempRef = IGC_VirtualSystem.GetInstanceByID(vsID);
            SwapVirtualSystem(ref tempRef);
        }

        //since comp instances load one at a time, it's possible to swap a terminal's VS for one that's not setup yet.
        //therefore you have to wait for ready before setting current and prev users
        StartCoroutine(SetCurrenUserWhenURReady(virtualSystem.userRegistry, currentUsername, prevUsername));

        //set power state
        PowerActions(powerstate);

        SetTextColor(textColor);         //only text here, screen is already set in MonitorActions

        shell.rawPromptText  = rawPrompt;
        shell.rawDisplayText = rawDisplay;
    }
示例#2
0
    public override string command_function()
    {
        string output = "";

        foreach (string key in flags.Keys)
        {
            if (key != "s" && key != "t")
            {
                continue;
            }

            string[] channels = IGC_Utils.SplitString(",", flags[key]);

            if (channels.Length != 3)
            {
                return(malformed_error + "\n" + usage);
            }

            Color color = IGC_Utils.ColorFromString(flags[key]);

            if (key == "s")
            {
                output += "screen color set to " + flags["s"];
                issuer.terminal.SetScreenColor(color);
                issuer.terminal.screenColor = color;
            }
            if (key == "t")
            {
                output += "text color set to " + flags["t"];
                issuer.terminal.SetTextColor(color);
                issuer.terminal.textColor = color;
            }
        }

        output = output == "" ? "please specify a screen or text color\n" + usage : output;

        InGameComputer term = issuer.terminal;

        if (virtualSystem.networkReady)
        {
            term.GetComponent <NetworkView>().RPC("SetColorsRPC", RPCMode.Others,
                                                  IGC_Utils.ColorString(term.screenColor),
                                                  IGC_Utils.ColorString(term.textColor)
                                                  );
        }

        return(output);
    }
示例#3
0
 [RPC] public void SetColorsRPC(string s, string t)
 {
     SetScreenColor(IGC_Utils.ColorFromString(s));
     SetTextColor(IGC_Utils.ColorFromString(t));
 }