private void DisconnectList(int id) { Debug.Log("NetworkList len of list is " + network_list.Count); List <string> copy_list = network_list.ToList(); foreach (string network in copy_list) { if (GUILayout.Button(network)) { Debug.Log("selected " + network); menus.clicked = ""; XElement xml = new XElement("componentEvent", new XElement("name", this.component_name), new XElement("networkDisconnect", network)); Debug.Log(xml); network_list.Remove(network); IPCManagerScript.SendRequest(xml.ToString()); } } if (menus.clicked.Length > 0) { if (GUILayout.Button("Close menu")) { menus.clicked = ""; } } }
void Start() { Debug.Log("HI THERE"); /* connect to server*/ IPCManagerScript.ConnectServer(); //AfterServerReady(); Debug.Log("back from wait init server"); //GameObject ticker = GameObject.Find("ScrollText"); //ScrollingTextScript st = (ScrollingTextScript)ticker.GetComponent(typeof(ScrollingTextScript)); //st.AddMessage("the time has come for all brown dogs to come to the aid of their quick brown foxes"); }
public void SetGroupValue(string group_name, Dictionary <string, bool> my_dict, string key, bool value) { my_dict[key] = value; XElement xml = new XElement(this.event_type, new XElement("name", this.the_name), new XElement("procSetting", new XElement("field", group_name + ":" + key), new XElement("value", value))); //Debug.Log(xml); IPCManagerScript.SendRequest(xml.ToString()); }
public void WasPushed() { Debug.Log("was pushed"); if (ppButtonText.text == "play") { ppButtonText.text = "pause"; IPCManagerScript.SendRequest("pause"); } else { ppButtonText.text = "play"; IPCManagerScript.SendRequest("play"); } }
public void ProcChanged(Toggle toggle) { string field = toggle.GetComponentInChildren <Text>().text; Debug.Log("Computer ProcChanged " + field + " to " + toggle.isOn); this.proc_dict[field] = toggle.isOn; XElement xml = new XElement(event_type, new XElement("name", this.the_name), new XElement("procSetting", new XElement("field", field + ":"), new XElement("value", toggle.isOn))); IPCManagerScript.SendRequest(xml.ToString()); }
public void PhysChanged(Toggle toggle) { string field = toggle.GetComponentInChildren <Text>().text; Debug.Log("Zone PhysChanged " + field + " to " + toggle.isOn); this.phys_dict[field] = toggle.isOn; XElement xml = new XElement("zoneEvent", new XElement("name", this.zone.zone_name), new XElement("setting", new XElement("field", field + ":"), new XElement("value", toggle.isOn))); Debug.Log(xml.ToString()); IPCManagerScript.SendRequest(xml.ToString()); }
public static void BuyItHere() { Destroy(buying_object); buying_object = null; //int item_id = catalog_ids[buying_item]; int outx, outy, index; WorkSpaceScript.FindClosestWorkspaceCenter(out outx, out outy, out index); // catalogName position XElement xml = new XElement("componentEvent", new XElement("name", ""), new XElement("buy", new XElement("catalogName", buying_item), new XElement("position", index))); Debug.Log(xml.ToString()); IPCManagerScript.SendRequest(xml.ToString()); menus.clicked = ""; }
public void ClearEntry(string user_group_name) { DACEntry entry = dac_dict[user_group_name]; entry.Clear(); string component_name = this.asset.computer.component_name; string command = "removeGroup"; if (UserBehavior.user_dict.ContainsKey(user_group_name)) { command = "removeUser"; } XElement xml = new XElement("componentEvent", new XElement("name", component_name), new XElement("assetACL", new XElement("assetName", this.asset.asset_name), new XElement(command, user_group_name))); IPCManagerScript.SendRequest(xml.ToString()); }
public void AccessChanged(Toggle toggle) { string field = toggle.GetComponentInChildren <Text>().text; Debug.Log("Zone AccessChanged " + field + " to " + toggle.isOn); string user_or_group = "user"; string add_or_remove = "accessAdd"; if (UserBehavior.user_dict.ContainsKey(field)) { if (toggle.isOn) { this.users_allowed.Add(field); } else { add_or_remove = "accessRemove"; this.users_allowed.Remove(field); } } else { user_or_group = "group"; if (toggle.isOn) { this.groups_allowed.Add(field); } else { add_or_remove = "accessRemove"; this.groups_allowed.Remove(field); } } XElement xml = new XElement("zoneEvent", new XElement("name", this.zone.zone_name), new XElement(add_or_remove, new XElement(user_or_group, field))); IPCManagerScript.SendRequest(xml.ToString()); }
public void AddTraining(int add_amount) { // adjust training based on given amount, using old game engine algorithm // and advise engine of new training value. if (training <= 95) { int hack_cost = add_amount * 250; training = Math.Max(add_amount * 4, 5) + training; if (training > 95) { training = 95; } XElement xml = new XElement("userEvent", new XElement("train", new XElement("name", user_name), new XElement("level", training)), new XElement("cost", hack_cost)); IPCManagerScript.SendRequest(xml.ToString()); } }
private void ConnectList(int id) { List <string> copy_list = NetworkBehavior.network_list.ToList(); bool is_internet = false; if (!bool.TryParse(OrganizationScript.GetValue("Internet"), out is_internet)) { Debug.Log("Error: ConnectList parsing internet " + OrganizationScript.GetValue("Internet")); } if (this.gameObject.name.StartsWith("Device") && is_internet) { copy_list.Add(OrganizationScript.GetValue("InternetName")); } //Debug.Log("NetworkList len of list is " + network_list.Count); foreach (string network in copy_list) { if (!network_list.Contains(network)) { if (GUILayout.Button(network)) { Debug.Log("selected " + network); menus.clicked = ""; XElement xml = new XElement("componentEvent", new XElement("name", this.component_name), new XElement("networkConnect", network)); Debug.Log(xml.ToString()); network_list.Add(network); IPCManagerScript.SendRequest(xml.ToString()); } } } if (menus.clicked.Length > 0) { if (GUILayout.Button("Close menu")) { menus.clicked = ""; } } }
private static void HireMenu(int id) { foreach (string key in staff_dict.Keys) { if (GUILayout.Button(key)) { ITStaffBehavior script = staff_dict[key]; // TBD fix cost / salary to match game XElement xml = new XElement("userEvent", new XElement("hire", new XElement("name", script.user_name), new XElement("salary", script.cost)), new XElement("cost", script.cost)); Debug.Log(xml); IPCManagerScript.SendRequest(xml.ToString()); menus.clicked = ""; } } //Debug.Log("HireMenu clicked now " + menus.clicked); }
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(); } }
public static void ClosedScreen(string screen) { active_screen = "office"; IPCManagerScript.SendRequest("on_screen:" + UI_SCREEN_OFFICE); IPCManagerScript.DialogClosed(); }
public void ACLChanged(string user_group_name, Dropdown dd, ACLConfigure config) { if (this.supress_value_change_hack) { return; } this.supress_value_change_hack = true; Debug.Log("ACL Changed for " + dd.name + " new mode select " + dd.captionText.text); char option = option_map[dd.captionText.text]; DACEntry entry = dac_dict[user_group_name]; char was_option = 'z'; switch (dd.name) { case "ReadDropdown": was_option = entry.read; entry.read = option; break; case "WriteDropdown": was_option = entry.write; entry.write = option; break; case "ControlDropdown": was_option = entry.control; entry.control = option; break; case "ExecuteDropdown": was_option = entry.execute; entry.execute = option; break; } Debug.Log("ACLChanged, was option " + was_option); if (was_option == '-') { Debug.Log("now call CheckDefault"); config.CheckDefault(dd, option); } entry.read = option_map[config.read_dropdown.captionText.text]; entry.write = option_map[config.write_dropdown.captionText.text]; entry.control = option_map[config.control_dropdown.captionText.text]; entry.execute = option_map[config.execute_dropdown.captionText.text]; int mode = entry.GetMode(); string component_name = this.asset.computer.component_name; string command = "changeGroupMask"; string name_string = "groupName"; if (UserBehavior.user_dict.ContainsKey(user_group_name)) { command = "changeUserMask"; name_string = "userName"; } XElement xml = new XElement("componentEvent", new XElement("name", component_name), new XElement("assetACL", new XElement("assetName", this.asset.asset_name), new XElement(command, new XElement(name_string, user_group_name), new XElement("mode", mode)))); IPCManagerScript.SendRequest(xml.ToString()); this.supress_value_change_hack = false; }
public void CloseClicked() { this.gameObject.SetActive(false); IPCManagerScript.DialogClosed(); }
public static void ActiveScreen(string screen) { active_screen = screen; Debug.Log("menues ActiveScreen for " + screen); IPCManagerScript.SendRequest("on_screen:" + screen_dict[screen]); }
// Update is called once per frame void Update() { if (Input.GetKeyDown("h")) { Debug.Log("h key is down"); Vector3 pos = GameLoadBehavior.home_pos; mainCamera.transform.rotation = GameLoadBehavior.home_rot; cameraScript.setPosition(pos); } else if (Input.GetKeyDown("u")) { UserBehavior ub = UserBehavior.GetNextUser(); //Debug.Log("next user is " + ub.user_name); if (ub == null) { Debug.Log("Error: menus, no next user"); return; } GameObject user = ub.gameObject; cameraScript.setPosition(user.transform.position); } else if (Input.GetKeyDown("?")) { Debug.Log("got dump keydown"); IPCManagerScript.SendRequest("dump_conditions"); } else if (Input.GetKeyDown("d")) { Debug.Log("got d keydown"); IPCManagerScript.SendRequest("dump_conditions"); } else if (Input.GetKeyDown("c")) { ComponentBehavior ub = ComponentBehavior.GetNextComponent(); GameObject computer = ub.gameObject; Debug.Log("next component is " + ub.component_name + " pos x" + computer.transform.position.x); cameraScript.setPosition(computer.transform.position); } else if (Input.GetMouseButtonDown(1) && !Input.GetKey(KeyCode.LeftAlt)) { menu_panels["HelpTip"].SetActive(false); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { //Debug.Log("raycast on " + hit.transform.gameObject.name); if (hit.transform.gameObject.name.StartsWith("Computer") || hit.transform.gameObject.name.StartsWith("Device")) { ComponentBehavior bh = (ComponentBehavior)hit.transform.gameObject.GetComponent(typeof(ComponentBehavior)); //computer_canvas.SetActive(true); if (hit.transform.gameObject.gameObject.name.StartsWith("Computer")) { ComputerBehavior computer_script = (ComputerBehavior)hit.transform.gameObject.GetComponent(typeof(ComputerBehavior)); //computer_script.ConfigureCanvas(); //clicked = ""; } clicked = "Component:" + bh.component_name; } else if (hit.transform.gameObject.name.StartsWith("User")) { UserBehavior bh = (UserBehavior)hit.transform.gameObject.GetComponent(typeof(UserBehavior)); clicked = "User:"******"menu"; menu_panels["HelpTip"].SetActive(false); } } } }