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 LoadOneStaff(string user_file) { GameObject user = GameObject.Find("ITStaff"); if (user == null) { Debug.Log("Error: LoadOneStaff got null when finding ITStaff game object."); return; } //Debug.Log("user_app_path" + user_app_path + " file [" + User_file+"]"); string cfile = System.IO.Path.Combine(GameLoadBehavior.user_app_path, user_file); Debug.Log("user " + cfile); GameObject new_c = Instantiate(user, new Vector3(1.0F, 0, 0), Quaternion.identity); ITStaffBehavior script = (ITStaffBehavior)new_c.GetComponent(typeof(ITStaffBehavior)); script.SetFilePath(cfile); new_c.SetActive(true); script.LoadStaff(); int pos = script.position; //Debug.Log("LoadUsers " + script.User_name + " pos is " + pos); if (pos < 0) { Debug.Log("LoadOneStaff got invalid pos for " + script.user_name); return; } if (pos >= 0) { WorkSpaceScript.WorkSpace ws = WorkSpaceScript.GetWorkSpace(pos); if (ws == null) { Debug.Log("ITStaffBehavior got null workspace for pos" + pos); return; } if (!ws.AddUser(script.user_name)) { Debug.Log("ITStaffBehavior AddUser, could not user, already populated " + script.user_name); return; } 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 - 1.0f, 0.5f, zf); new_c.transform.position = v; } else { Debug.Log("no postion for " + script.user_name); } }
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(); } }