public static void LoadOneDevice(string device_file)
    {
        GameObject device;

        device = GameObject.Find("Device");
        //Debug.Log("user_app_path" + user_app_path + " file [" + computer_file+"]");
        string cdir  = System.IO.Path.Combine(user_app_path, DEVICES);
        string cfile = System.IO.Path.Combine(cdir, device_file);
        //Debug.Log("computer " + cdir);
        GameObject     new_d  = Instantiate(device, new Vector3(1.0F, 0, 0), Quaternion.identity);
        DeviceBehavior script = (DeviceBehavior)new_d.GetComponent(typeof(DeviceBehavior));

        script.SetFilePath(cfile);
        new_d.SetActive(true);
        script.LoadComponent();
        int pos = script.position;

        //Debug.Log("LoadComputers " + script.computer_name + " pos is " + pos);
        if (pos < 0)
        {
            Debug.Log("LoadOneDevice got invalid pos for " + script.component_name);
            return;
        }
        WorkSpaceScript.WorkSpace ws = WorkSpaceScript.GetWorkSpace(pos);
        int   slot = ws.AddDevice(script.component_name);
        float xf, zf;

        ccUtils.GridTo3dPos(ws.x, ws.y, out xf, out zf);
        //Debug.Log(ws.x + " " + ws.y + " " + xf + " " + zf);
        Vector3 v = new Vector3(xf, 0.5f, zf);

        new_d.transform.position = v;
    }
Ejemplo n.º 2
0
    static void LoadItems()
    {
        NetworkBehavior.LoadNetworks(user_app_path);
        procedural_settings = new ProceduralScript("procedural.txt");
        physical_settings   = new ProceduralScript("physical.txt");
        Debug.Log("Calling LoadHardwareTypes");
        CatalogBehavior.LoadHardwareTypes();
        CatalogBehavior.LoadCatalog(user_app_path);
        OrganizationScript.LoadOrganization();
        GameObject      ws        = GameObject.Find("WorkSpace");
        WorkSpaceScript ws_script = (WorkSpaceScript)ws.GetComponent(typeof(WorkSpaceScript));

        WorkSpaceScript.LoadWorkSpace();
        dac_groups = new DACGroups();
        UserBehavior.LoadUsers();
        AssetBehavior.LoadAssets();
        ComputerBehavior.LoadAllComputers();
        DeviceBehavior.LoadDevices(user_app_path);
        ITStaffBehavior.LoadStaffFromFile();
        ZoneBehavior.LoadZones();
        ObjectivesBehavior.LoadObjectives();

        //UserBehavior.UpdateStatus();
        //LoadMainOffice();
    }
    public static void LoadOneDevice(string device_file)
    {
        GameObject device;

        device = GameObject.Find("Device");
        //Debug.Log("user_app_path" + user_app_path + " file [" + computer_file+"]");
        string cdir  = System.IO.Path.Combine(user_app_path, DEVICES);
        string cfile = System.IO.Path.Combine(cdir, device_file);
        //Debug.Log("computer " + cdir);
        GameObject     new_d  = Instantiate(device, new Vector3(1.0F, 0, 0), Quaternion.identity);
        DeviceBehavior script = (DeviceBehavior)new_d.GetComponent(typeof(DeviceBehavior));

        script.SetFilePath(cfile);
        new_d.SetActive(true);
        script.LoadComponent();
        script.LoadDevice();
        script.hw = hw_name;
        SkinnedMeshRenderer this_render = new_d.GetComponent <SkinnedMeshRenderer>();

        try
        {
            this_render.sharedMesh = CatalogBehavior.object_mesh_dict[script.hw];
        } catch (KeyNotFoundException)
        {
            Debug.Log("Key exception in object_mesh_dict caused by " + script.hw);
        }
        try
        {
            this_render.material = CatalogBehavior.object_mat_dict[script.hw];
        } catch (KeyNotFoundException)
        {
            Debug.Log("Key exception in object_mat_dict caused by " + script.hw);
        }
        int pos = script.position;

        //Debug.Log("LoadComputers " + script.computer_name + " pos is " + pos);
        if (pos < 0)
        {
            Debug.Log("LoadOneDevice got invalid pos for " + script.component_name);
            return;
        }
        WorkSpaceScript.WorkSpace ws = WorkSpaceScript.GetWorkSpace(pos);
        int   slot = ws.AddDevice(script.component_name);
        float xf, zf;

        ccUtils.GridTo3dPos(ws.x, ws.y, out xf, out zf);
        //Debug.Log(ws.x + " " + ws.y + " " + xf + " " + zf);
        Vector3 v = new Vector3(xf, 0.5f, zf);

        new_d.transform.position = v;
    }
 // Use this for initialization
 void Start()
 {
     infectTime = Time.time + safeTime;
     if (target == null)
     {
         Debug.Log("WARNING: DOOMBA SPECIFIED FOR INFECTOR IS NULL. WILL NOT ACTIVATE.");
         Destroy(this);
     }
     device = target.GetComponent <DeviceBehavior>();
     if (device == null)
     {
         Debug.Log("WARNING: DOOMBA SPECIFIED FOR INFECTOR HAS NO DEVICE BEHAVIOR. WILL NOT ACTIVATE.");
         Destroy(this);
     }
 }
Ejemplo n.º 5
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            CASMailbox casmailbox = (CASMailbox)this.GetDynamicParameters();

            if (casmailbox.ActiveSyncDebugLoggingSpecified || this.ResetAutoBlockedDevices)
            {
                ADUser            dataObject        = this.DataObject;
                ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(dataObject, RemotingOptions.AllowCrossSite);
                if (exchangePrincipal == null)
                {
                    base.WriteVerbose(Strings.ExchangePrincipalNotFoundException(dataObject.ToString()));
                    TaskLogger.LogExit();
                    return;
                }
                try
                {
                    using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(exchangePrincipal, CultureInfo.InvariantCulture, "Client=Management;Action=Set-CasMailbox"))
                    {
                        if (casmailbox.ActiveSyncDebugLoggingSpecified)
                        {
                            SyncStateStorage.UpdateMailboxLoggingEnabled(mailboxSession, casmailbox.ActiveSyncDebugLogging, null);
                        }
                        if (this.ResetAutoBlockedDevices)
                        {
                            List <Exception> list = DeviceBehavior.ResetAutoBlockedDevices(mailboxSession);
                            foreach (Exception ex in list)
                            {
                                base.WriteVerbose(Strings.ResetAutoBlockedDevicesException(ex.ToString()));
                            }
                        }
                    }
                }
                catch (LocalizedException exception)
                {
                    base.WriteError(exception, (ErrorCategory)1001, this.Identity);
                }
            }
            TaskLogger.LogExit();
        }
    // Update is called once per frame
    void Update()
    {
        float delta = Time.deltaTime;

        elapsed_since_receive += delta;
        if (elapsed_since_receive > 0.1f)
        {
            elapsed_since_receive = 0.0f;
        }
        else
        {
            return;
        }
        //Debug.Log("call receive");
        int len = ReceiveMsg();

        while (len > 0)
        {
            if (!server_ready)
            {
                if (read_string == "ready")
                {
                    Debug.Log("IPCManager got server ready");
                    server_ready = true;
                    GameLoadBehavior.AfterServerReady();
                    SendRequest("begin");
                    SendRequest("on_screen:" + menus.UI_SCREEN_OFFICE);
                }
                return;
            }
            string command = read_string;
            string message = null;
            //Debug.Log("buf [" + read_string + "]");
            if (read_string.IndexOf(':') > 0)
            {
                message = ccUtils.GetCommand(read_string, out command);
            }

            //Debug.Log("IPC update got command " + command + " message [" + message+"]");
            switch (command)
            {
            case "status":
                //Debug.Log("got status %s" + message);
                GameStatusScript.UpdateStatus(message);
                break;

            case "attack_log":
                //Debug.Log("got status %s" + message);
                AttackLogScript.AddEntry(message);
                break;

            case "load_computer":
                ComputerBehavior.LoadOneComputer(message + ".sdf");
                break;

            case "load_device":
                DeviceBehavior.LoadOneDevice(message + ".sdf");
                break;

            case "user_status":
                UserBehavior.UpdateStatus(message);
                break;

            case "ticker":
                scrolling_text.AddTicker(message);
                break;

            case "withdraw_ticker":
                scrolling_text.WithdrawTicker(message);
                break;

            case "message":
                MessageScript message_panel = (MessageScript)menus.menu_panels["MessagePanel"].GetComponent(typeof(MessageScript));
                message_panel.ShowMessage(message);
                break;

            case "yes_no":
                YesNoScript yesno_panel = (YesNoScript)menus.menu_panels["YesNoPanel"].GetComponent(typeof(YesNoScript));
                yesno_panel.ShowMessage(message);
                break;

            case "tool_tip":
                ToolTipScript.AddTip(message);
                break;

            case "objective":
                ObjectivesBehavior.ObjectiveStatus(message);
                break;

            case "phase":
                ObjectivesBehavior.PhaseDone(message);
                break;

            case "lose":
                SendRequest("exit");
                QuitGame();
                break;

            case "remove_computer":
                ComputerBehavior.RemoveComputer(message);
                break;

            default:
                Debug.Log("nothing to do for " + command + " " + message);
                break;
            }
            len = ReceiveMsg();
        }
    }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     menu           = menuPanel.GetComponent <choiceMenu>();
     device         = (DeviceBehavior)GetComponentInParent(typeof(DeviceBehavior));
     scaleFactorTMP = scaleFactor;
 }