public void ConfigureCanvas(ZoneBehavior zone, ZoneConfigure zone_config_script)
    {
        Debug.Log("PhysicalSettings ConfigureCanvas for " + zone.zone_name + "items in dict: " + this.phys_dict.Count);
        zone_config_script.SetPhys(this.phys_dict, zone);
        Dictionary <string, bool> user_access_dict  = new Dictionary <string, bool>();
        Dictionary <string, bool> group_access_dict = new Dictionary <string, bool>();

        foreach (string key in UserBehavior.user_dict.Keys)
        {
            bool allowed = false;
            if (this.users_allowed.Contains(key))
            {
                allowed = true;
            }
            user_access_dict[key] = allowed;
        }
        foreach (string key in DACGroups.group_dict.Keys)
        {
            bool allowed = false;
            if (this.groups_allowed.Contains(key))
            {
                allowed = true;
            }
            group_access_dict[key] = allowed;
        }

        zone_config_script.SetAccess(user_access_dict, zone);
        zone_config_script.SetAccess(group_access_dict, zone);
        this.zone = zone;
    }
 public void ConfigureCanvas(ZoneBehavior zone, ZoneConfigure zone_config_script)
 {
     zone_config_script.SetProc(this.proc_dict, zone);
     zone_config_script.SetPassword(PWD_LEN, this.pw_len_dict, zone);
     zone_config_script.SetPassword(PWD_CHANGE, this.pw_change_dict, zone);
     zone_config_script.SetPassword(PWD_COMPLEX, this.pw_complex_dict, zone);
 }
Пример #3
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();
    }
Пример #4
0
    public void SetPassword(string group_name, Dictionary <string, bool> dict, ZoneBehavior zone)
    {
        GameObject newText = (GameObject)Instantiate(myTextPrefab);

        newText.transform.SetParent(passwordPanel);
        newText.GetComponent <Text>().text = group_name;

        foreach (KeyValuePair <string, bool> entry in dict)
        {
            //Debug.Log("SetPassword for " + entry.Key);
            GameObject newTog = (GameObject)Instantiate(procPrefab);
            newTog.transform.SetParent(passwordPanel);
            Toggle t = (Toggle)newTog.GetComponent <Toggle>();
            if (t == null)
            {
                Debug.Log("Toggle is null");
                return;
            }
            t.GetComponentInChildren <Text>().text = entry.Key;
            t.isOn = entry.Value;
            t.onValueChanged.AddListener(delegate
            {
                zone.PasswordChanged(group_name, t);
            });
        }
    }
 public PhysicalSettings()
 {
     this.zone = zone;
     foreach (string key in GameLoadBehavior.physical_settings.proc_dict.Keys)
     {
         this.phys_dict[key] = false;
         //Debug.Log("LoadComputer proc key " + key);
     }
 }
Пример #6
0
        protected void HandleBaseBehavior(ZoneBehavior b)
        {
            // storing everything in absolute coordinates
            this.zonePerimeter    = b.ZonePerimeter;
            this.zoneBadRegions   = b.StayOutside;
            this.recommendedSpeed = b.RecommendedSpeed;

            Services.UIService.PushPolygons(b.StayOutside, b.TimeStamp, "zone bad regions", false);
            Services.UIService.PushPolygon(b.ZonePerimeter, b.TimeStamp, "zone perimeter", false);
        }
Пример #7
0
 private static void ZoneMenu(int id)
 {
     foreach (string key in zone_dict.Keys)
     {
         if (GUILayout.Button(key))
         {
             ZoneBehavior script = zone_dict[key];
             menus.clicked = "";
             script.ConfigureCanvas();
         }
     }
 }
Пример #8
0
    public static void LoadOneZone(string zone_file, Color color)
    {
        GameObject zone = GameObject.Find("Zone");
        //Debug.Log("user_app_path" + user_app_path + " file [" + User_file+"]");
        string cfile = System.IO.Path.Combine(GameLoadBehavior.user_app_path, zone_file);
        //Debug.Log("user " + cdir);
        GameObject new_c = Instantiate(zone, new Vector3(1.0F, 0, 0), Quaternion.identity);

        new_c.GetComponent <Renderer>().material.color = color;
        ZoneBehavior script = (ZoneBehavior)new_c.GetComponent(typeof(ZoneBehavior));

        script.SetFilePath(cfile);
        new_c.SetActive(true);
        script.LoadZone();
        script.DoPosition();
    }
Пример #9
0
    public void SetPhys(Dictionary <string, bool> dict, ZoneBehavior zone)
    {
        foreach (KeyValuePair <string, bool> entry in dict)
        {
            GameObject newTog = (GameObject)Instantiate(physPrefab);
            newTog.transform.SetParent(physPanel);

            Toggle t = (Toggle)newTog.GetComponent <Toggle>();
            if (t == null)
            {
                Debug.Log("Toggle is null");
                return;
            }
            t.GetComponentInChildren <Text>().text = entry.Key;
            t.isOn = entry.Value;
            t.onValueChanged.AddListener(delegate
            {
                zone.PhysChanged(t);
            });
        }
    }
Пример #10
0
    private void checkSelect()
    {
        if (clicked_was == "" && clicked != "")
        {
            // new click, advise engine
            IPCManagerScript.DialogUp();
        }
        else if (clicked_was != "" && clicked == "" && active_screen == "office")
        {
            IPCManagerScript.DialogClosed();
        }
        if (clicked_was == "menu" && clicked != "" && clicked != "menu")
        {
            // new click, advise engine
            Debug.Log("clicked is " + clicked);
            if (screen_dict.ContainsKey(clicked))
            {
                IPCManagerScript.SendRequest("on_screen:" + screen_dict[clicked]);
            }
        }
        else if (clicked_was != "menu" && clicked_was != "" && clicked == "" && active_screen == "office")
        {
            if (screen_dict.ContainsKey(clicked_was))
            {
                IPCManagerScript.SendRequest("on_screen:" + UI_SCREEN_OFFICE);
            }
        }
        clicked_was = clicked;
        //Debug.Log("checkSelect");

        //if (clicked == "" && !inHelp && Event.current.type != EventType.MouseDown)
        if (clicked == "" && !inHelp)
        {
            string pplabel = "Pause";
            if (GameStatusScript.isPaused())
            {
                pplabel = "Play";
            }
            //Debug.Log( && Event.current.type == EventType.Layout
            GUILayout.BeginArea(new Rect(5, 5, 150, 100));

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(pplabel))
            {
                //Debug.Log("got button, send " + pplabel);
                IPCManagerScript.SendRequest(pplabel);
                //startup.doUserPause();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
        else if (clicked == "menu")
        {
            WindowRect = GUI.Window(1, WindowRect, MenuItemsFunc, "Menu");
        }
        else if (clicked == "help")
        {
            Debug.Log("asked help");
            //Application.OpenURL("file://" + startup.helpHome + "/README.html");
            clicked = "";
        }
        else if (clicked == "Buy")
        {
            Debug.Log("clicked Buy");
            CatalogBehavior.doMenu();
        }
        else if (clicked == "Hire")
        {
            Debug.Log("clicked Hire");
            ITStaffBehavior.doItems();
        }
        else if (clicked == "Objectives")
        {
            Debug.Log("clicked Objectives");
            ObjectivesBehavior.doItems();
        }
        else if (clicked == "Zones")
        {
            Debug.Log("clicked Zones");
            ZoneBehavior.doItems();
        }
        else if (clicked == "Save")
        {
            Debug.Log("clicked Save");
            string fname = System.IO.Path.Combine(GameLoadBehavior.user_app_path, "debug_save.sdf");
            IPCManagerScript.SendRequest("save:" + fname);
        }
        //else if (clicked == "Servers" || clicked == "Workstations" || clicked == "Devices" ||clicked == "Buying")
        else if (clicked.StartsWith("Catalog:"))
        {
            CatalogBehavior.doItems();
        }
        else if (clicked.StartsWith("Component:"))
        {
            ComponentBehavior.doItems();
        }
        else if (clicked.StartsWith("User:"))
        {
            UserBehavior.doItems();
        }
    }