protected override void HandleInput(UserInput button, InputState state) { //First we need to define if we are inside the ingame screen if (state == InputState.Ingame) { //If the pressed button equals Start we open the menu screen and disable ingame input if (button == UserInput.Start) { StopAllCoroutines(); StartCoroutine(OpenPauseMenu()); } } //If we are not then maybe we are inside the menus screen? else if (state == InputState.PauseMenu) { switch (button) { case UserInput.Start: StopAllCoroutines(); StartCoroutine(ClosePauseMenu()); break; case UserInput.Up: Up(); break; case UserInput.Down: Down(); break; case UserInput.A: selectedButton.Invoke(); break; } } }
private void HandleInput(UserInput button, InputState state) { if (button == UserInput.A && state == InputState.Ingame) { m_Jump = true; } }
public void Run(UserInput CurrentInput) { if(CurrentInput.Args.Length < 2) { CurrentInput.User.WriteLine(".name <new name>"); return; } //TODO: password User userObj = Server.FindClientByName(CurrentInput.Args[1]); if (userObj != null && userObj != CurrentInput.User) {//user already logged in userObj.WriteLine("Logging in from Another Location"); //remove the user object of the newest logged in //but overwrite with the newest data //if (userObj.Logon > CurrentInput.User.Logon) { //input user logged on first //TODO: always copy over connections but sign the logon data from the oldest... CurrentInput.User.JoinUser(userObj); //} userObj.Room.Users.Remove(userObj); Server.ClientList.Remove(userObj); } if(CurrentInput.User.Login(CurrentInput.Args[1]) == User.LoginResult.ValidLogin) { CurrentInput.User.WriteLine("You are now logged in as \"" + CurrentInput.User.Name + "\""); } else if(CurrentInput.User.Login(CurrentInput.Args[1]) == User.LoginResult.OpenUserName) { //TODO: save user after name change CurrentInput.User.Name = CurrentInput.Args[1]; CurrentInput.User.WriteLine("Your name has been changed to \"" + CurrentInput.User.Name + "\""); } }
// POST: api/User public string Post(UserInput model) { string guid = Jobcenter.ResurceKit.RecurceKit.GenereteString(32); while (db.Companies.Any(c => c.GUID == guid)) { guid = Jobcenter.ResurceKit.RecurceKit.GenereteString(32); } Company CompanyToBeCreated = new Company(); CompanyToBeCreated.CompanySize_FK = model.numberOfEmployees; CompanyToBeCreated.CompanyType_FK = model.workType; CompanyToBeCreated.CreatedDate = DateTime.Now; CompanyToBeCreated.EMail = model.email; CompanyToBeCreated.FirstName = model.firstName; CompanyToBeCreated.LastName = model.lastName; CompanyToBeCreated.Name = model.companyName; CompanyToBeCreated.P_Number = model.pno; CompanyToBeCreated.Telephone = model.phone; CompanyToBeCreated.Cvr = model.cvr; CompanyToBeCreated.GUID = guid; db.Companies.Add(CompanyToBeCreated); db.SaveChanges(); return CompanyToBeCreated.GUID; }
public DraggableItem(Level a_Level, int newSlot) { m_Input = a_Level.Input; currState = State.Static; m_bButtonPressedOnMe = false; slot = newSlot; }
public void SendInput(UserInput input) { if(isLocalPlayer) { CmdSendInputToServer(input); } }
// Use this for initialization void Start() { showingPauseMenu = false; pauseMenu.SetActive(false); p1Input = playerOne.GetComponent<UserInput>(); p2Input = playerTwo.GetComponent<UserInput>(); soundList = GameObject.FindGameObjectsWithTag("Pausable Sound"); }
public ActionResult Post(UserInput SendInfo) { User newUser = new User(); newUser.Email = SendInfo.Email; newUser.SetPassword(SendInfo.Password); RavenSession.Store(newUser); return Json(new { success = true }); }
protected void btnSave_Click(object sender, EventArgs e) { Label lblId = modalDialog.FindControl("lblId") as Label; TextBox txtFullName = modalDialog.FindControl("txtFullName") as TextBox; TextBox txtEmail = modalDialog.FindControl("txtEmail") as TextBox; TextBox txtComment = modalDialog.FindControl("txtComment") as TextBox; TextBox txtPhone = modalDialog.FindControl("txtPhone") as TextBox; DropDownList ddlRoleType = modalDialog.FindControl("ddlRoleType") as DropDownList; DropDownList ddlRegion = modalDialog.FindControl("ddlRegion") as DropDownList; DropDownList ddlArea = modalDialog.FindControl("ddlArea") as DropDownList; DropDownList ddlCategory = modalDialog.FindControl("ddlCategory") as DropDownList; DropDownList ddlSchool = modalDialog.FindControl("ddlSchool") as DropDownList; Label labCustomError = modalDialog.FindControl("labCustomError") as Label; UserInput input = new UserInput(); input.Id = Convert.ToInt32(lblId.Text); input.FullName = txtFullName.Text; input.EMail = txtEmail.Text; input.Comment = txtComment.Text; input.Phone = txtPhone.Text; input.Role = (RoleType)Convert.ToInt32(ddlRoleType.SelectedValue); if (input.Role == RoleType.RegionAdministrator) { Region region = RegionService.GetRegion(ddlRegion.SelectedValue); input.Area = RegionService.GetArea(region, ddlArea.SelectedValue); } if (input.Role == RoleType.AreaJudge | input.Role == RoleType.RegionJudge) { input.Area = RegionService.GetArea(ddlArea.SelectedValue); input.Category = CategoryService.GetCategory(input.Area.Region, ddlCategory.SelectedValue); } else if (input.Role == RoleType.Coordinator | input.Role == RoleType.Principal | input.Role == RoleType.Nominee) { input.School = RegionService.GetSchool(ddlSchool.SelectedValue); if (input.Role == RoleType.Nominee) { input.Category = CategoryService.GetCategory(input.Area.Region, ddlCategory.SelectedValue); } } MembershipCreateStatus status = UserService.AddNewUser(input); if (status == MembershipCreateStatus.DuplicateEmail) { labCustomError.Text = "The email address is a duplicate, please enter a different email address"; labCustomError.Visible = true; } else { User user = UserService.GetUser(input.EMail); if (input.Id <= 0) { UserService.SendUserEmail(user, "Sterling Scholar Registration Request", System.Web.HttpContext.Current.Server.MapPath("~/") + "/assets/NewUserTemplate.html"); } modalDialog.HideModal(); } }
public void Run(UserInput CurrentInput) { if(CurrentInput.Args.Length < 2) { CurrentInput.User.WriteLine("Usage: emote <text>\n"); return; } string output = CurrentInput.User.Name + "" + CurrentInput.Message; CurrentInput.User.Room.Review.Add(new UserCommuncationBuffer(DateTime.UtcNow, output, CurrentInput.User)); CurrentInput.User.Room.Write(output); }
public void Run(UserInput currentInput) { string output = "\n"; foreach(KeyValuePair<string, string> colorCode in Server.ColorCodes) { //TODO: an escape code to show the color code output += String.Format("{1} VIDEO TEST ~RS\n" ,colorCode.Key, colorCode.Value); } currentInput.User.WriteLine(output); }
public void Run(UserInput CurrentInput) { //This assumes that the user has already changed rooms when the look is performed string output = String.Format("\nRoom: {0}\n\n{1}\n\n", CurrentInput.User.Room.Name, CurrentInput.User.Room.Desc); if(String.IsNullOrEmpty(CurrentInput.User.Room.Topic)) { output += "No topic has been set yet."; } else { output += String.Format("Current topic: {0}", CurrentInput.User.Room.Topic); } CurrentInput.User.WriteLine(output); }
public void Run(UserInput currentInput) { string output = "+----- Files ----------------------------------------------------------------+\n\n"; output += "Use these files to find out more about the talker.\n\n"; TalkerFile.GetFiles("files").ForEach(delegate(TalkerFile currentFile) { output += string.Format("* {0, -10} - {1}", currentFile.FileName, currentFile.Description); }); output += "\n\n+----------------------------------------------------------------------------+"; currentInput.User.WriteLine(output); }
// Use this for initialization void Start() { userInput = GetComponent<UserInput>(); boostStrength = boostStrength * Physics.gravity.magnitude; moveStrength = moveStrength * Physics.gravity.magnitude; maxEnergy = boostStrength * maxBoosts; if (isDebug) { energy = 500f; rigidbody.useGravity = false; }else{ energy = boostStrength * startBoosts; } }
public UIButton(Vector2 position, ContentManager content, Button button, bool bDisableOnPause, int index) { this.position = position; this.input = UserInput.GetUserInput(); this.buttonType = button; this.slot = index; m_bPaused = false; SageGame.OnPause += Game_OnPause; SageGame.OnUnpause += Game_OnUnpause; LoadContent(content); //the offsets make up for drop-shaddow on most buttons mouseSelectionArea = new Rectangle((int)position.X + 11, (int)position.Y, currentTexture.Width - 11, currentTexture.Height - 12); }
public static UserInput GetUserInput() { if( s_manager == null ) { UserInput ui = Component.FindObjectOfType(typeof(UserInput)) as UserInput; if(ui) { s_manager = ui; } else { GameObject go = new GameObject("UserInput"); ui = go.AddComponent<UserInput>() as UserInput; s_manager = ui; } } return s_manager; }
void Start () { players = FindObjectsOfType(typeof(Player)) as Player[]; //ideally this would be from a player selection menu //but that is beyond what is needed for this demo foreach(Player player in players) { if(player.isHuman) humanPlayer = player; } hud = transform.root.GetComponent<HUD>(); if(hud) hud.SetHumanPlayer(humanPlayer); userInput = transform.root.GetComponent<UserInput>(); if(userInput) userInput.enabled = false; soundManager = FindObjectOfType(typeof(SoundManager)) as SoundManager; turnManager = transform.root.GetComponent<TurnManager>(); if(turnManager) turnManager.SetPlayers(players); }
private void ResetIdealPosition(UserInput button, InputState state) { if (button == UserInput.L1 && state == InputState.Ingame) { Vector3 flatVector = transform.position; flatVector.y = rotationPivot.position.y; float magnitude = Vector3.Distance(flatVector, rotationPivot.position); flatVector = -rotationPivot.forward.normalized; flatVector *= magnitude; flatVector.y = transform.position.y - rotationPivot.position.y; transform.position = rotationPivot.position + flatVector; } }
public void Run(UserInput CurrentInput) { DateTime currentTime = DateTime.UtcNow; TimeSpan upTime = currentTime - Server.TalkerBooted; string output="+----------------------------------------------------------------------------+\n"; output +="| Talker times |\n"; output +="+----------------------------------------------------------------------------+\n"; output += String.Format("| The current system time is : {0,-45} |\n",currentTime); output += String.Format("| System booted : {0,-45} |\n", Server.TalkerBooted); output += String.Format("| Uptime : {0,6} days, {1,2} hours, {2,2} minutes, {3,2} seconds |\n", upTime.Days, upTime.Hours, upTime.Minutes, upTime.Seconds); output +="+----------------------------------------------------------------------------+\n"; CurrentInput.User.WriteLine(output); }
public void Run(UserInput currentInput) { Room newRoom = Server.LoginRoom; if(currentInput.Args.Length > 1) { newRoom = Server.FindRoomByName(currentInput.Args[1]); if(newRoom == null) { newRoom = Server.LoginRoom; } } currentInput.User.Room.WriteAllBut(String.Format("{0} {1}\n", currentInput.User.Name, currentInput.User.OutMsg), new List<User> { currentInput.User }); currentInput.User.ChangeRoom(newRoom); currentInput.User.Room.WriteAllBut(String.Format("{0} {1}\n", currentInput.User.Name, currentInput.User.InMsg ), new List<User> { currentInput.User }); }
void ApplyInput(UserInput input) { switch(input) { case UserInput.Jump: heroAnimator.Jump(); break; case UserInput.Dash: heroAnimator.Dash(); break; case UserInput.Crouch: heroAnimator.Crouch(-10.0f); break; case UserInput.CrouchStop: heroAnimator.Crouch(10.0f); break; case UserInput.Attack1: heroAnimator.Attack(0); break; case UserInput.Attack2: heroAnimator.Attack(1); break; case UserInput.Attack3: heroAnimator.Attack(2); break; /* * case UserInput.ToggleSword: heroStatus.ToggleSwordFromNetwork(); break; */ case UserInput.ToggleSwordON: heroStatus.ToggleSwordFromNetwork(true); break; case UserInput.ToggleSwordOFF: heroStatus.ToggleSwordFromNetwork(false); break; case UserInput.WallJump: Debug.Log("wall jump"); break; default: Debug.LogWarning("Input not recognized"); break; } }
//For each individual menu there is another override HandleInput function protected virtual void HandleInput(UserInput button, InputState state) { //Although this is obsolete, we check for the title screen input state if (state == InputState.Title) { switch (button) { case UserInput.Up: Up(); break; case UserInput.Down: Down(); break; case UserInput.A: selectedButton.Invoke(); break; } } }
public static void LogInAs(string username, string password ) { string currentUser = ""; try { currentUser = WebBrowser.CurrentBrowser.Actions.InvokeScript("currentUser"); } catch (ExecuteCommandException) { } if (!string.Equals(currentUser, username, StringComparison.InvariantCultureIgnoreCase)) { WebBrowser.CleanUp(); var nav = new Navigation(); nav.GivenIAmOnSomePage("sign in"); var input = new UserInput(); input.GivenIHaveEnteredSomeTestInSomeField(username, "username"); input.GivenIHaveEnteredSomeTestInSomeField(password, "password"); input.WhenIPressSomeButton("sign in"); WebBrowser.CurrentBrowser.WaitForElement(10000, "class=~navbar"); //Give it 5seconds to find header } }
public string[] Show_Options(ItemHandler itemH, int ID, Rectangle rect, UserInput user) { int Item_Type = itemH.Get_Type(ID); //Find and store the item type of the passed in item ID Menu = rect; //Initialize the menu to the passed in rectangle if(Item_Type == 1) //If the type is 1 { return Gear_Item_Uses; //Return the item uses string array } else if (Item_Type == 2) //If the type is 2 { return Consumables_Item_Uses; //Return the consumable item uses string array } else if (Item_Type == 3) //If the type is 3 { return Quest_Item_Uses; //Return the quest item uses string array } else //For error handling purposes return quest item uses if it has an 'invalid' item type { return Quest_Item_Uses; //Return the quest item uses string array } }
TP4() { gp.pnt3d1 = Pub.pnt3dO; gp.pnt3d2 = Pub.pnt3dO; ps = PromptStatus.Cancel; object mode = 0; BaseObjs.acadActivate(); Vector3d v3d = Vector3d.XAxis; try { elev = UserInput.getCogoPoint("\nPick Cogo Point 1: ", out idCgPnt1, ObjectId.Null, osMode: 8); if (elev == "") { return; } else { gp.pnt3d1 = idCgPnt1.getCogoPntCoordinates(); } elev = UserInput.getCogoPoint("\nPick Cogo Point 2: ", out idCgPnt2, ObjectId.Null, osMode: 8); if (elev == "") { return; } else { gp.pnt3d2 = idCgPnt2.getCogoPntCoordinates(); } mode = SnapMode.getOSnap(); SnapMode.setOSnap(8); gp.pnt3dX = Pub.pnt3dO; gp.pnt3dT = Pub.pnt3dO; System.Windows.Forms.Keys mods = System.Windows.Forms.Control.ModifierKeys; bool shift = (mods & System.Windows.Forms.Keys.Shift) > 0; bool control = (mods & System.Windows.Forms.Keys.Control) > 0; gp.shift = shift; gp.pnt3dT = gPnt.getPoint("\nSelect Target location (CogoPoint for xSlope and distance / pick side to enter xSlope and distance: ", "cmdTP"); if (gp.pnt3dT == Pub.pnt3dO) { return; } else if (gp.pnt3dT.Z == 0) { gp.pnt3dX = gc.calcBasePnt3d(gp.pnt3dT, gp.pnt3d1, gp.pnt3d2); if (gp.pnt3dX == Pub.pnt3dO) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Cross Slope (+ or -): ", out xSlope, xSlope); if (escaped) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Width: ", out width, width); if (escaped) { return; } double dist = gp.pnt3d1.getDistance(gp.pnt3d2); double distX = gp.pnt3d1.getDistance(gp.pnt3dX); Point2d pnt2dX = gp.pnt3dX.Convert2d(BaseObjs.xyPlane); Point2d pnt2dT = gp.pnt3dT.Convert2d(BaseObjs.xyPlane); double distT = pnt2dX.GetDistanceTo(pnt2dT); gp.pnt3dT = new Point3d(gp.pnt3dT.X, gp.pnt3dT.Y, gp.pnt3dX.Z + distT * double.Parse(xSlope)); v3d = gp.pnt3dT - gp.pnt3dX; v3d *= double.Parse(width) / distT; } else { gp.pnt3dX = gc.calcBasePnt3d(gp.pnt3dT, gp.pnt3d1, gp.pnt3d2); if (gp.pnt3dX == Pub.pnt3dO) { return; } CgPnt.setPoint(gp.pnt3dX, out pntNum, "CPNT-ON"); v3d = gp.pnt3dT - gp.pnt3dX; } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdTP.cs: line: 336"); } finally { SnapMode.setOSnap((int)mode); } ObjectId idPoly = ObjectId.Null; Point3d pnt3d3 = idCgPnt2.getCogoPntCoordinates() + v3d; ObjectId idCgPnt3 = pnt3d3.setPoint(out pntNum); Point3d pnt3d4 = idCgPnt1.getCogoPntCoordinates() + v3d; ObjectId idCgPnt4 = pnt3d4.setPoint(out pntNum); List <ObjectId> idCgPnts = new List <ObjectId> { idCgPnt1, idCgPnt2 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt2, idCgPnt3 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt3, idCgPnt4 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt4, idCgPnt1 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); }
private static async Task Main() { string[] args = Environment.GetCommandLineArgs(); Console.WriteLine("SafeNetwork Console Application"); try { if (IsApplicationFirstInstance()) { Console.Write("Press Y/y to use mock safe-browser for authentication otherwise a random mock account will be used : "); var input = Console.ReadLine(); if (input.Equals("Y") || input.Equals("y")) { // args[0] is always the path to the application // update system registry Helpers.RegisterAppProtocol(args[0]); // Authentication with the SAFE browser await Authentication.AuthenticationWithBrowserAsync(); // Start named pipe server and listen for message var authResponse = PipeComm.ReceiveNamedPipeServerMessage(); if (!string.IsNullOrEmpty(authResponse)) { // Create session from response await Authentication.ProcessAuthenticationResponse(authResponse); // Show user menu UserInput userInput = new UserInput(); await userInput.ShowUserOptions(); } } else { // Create session from mock authentication var session = await Authentication.MockAuthenticationAsync(); // Initialise session for Mutable Data operations DataOperations.InitialiseSession(session); // Show user menu UserInput userInput = new UserInput(); await userInput.ShowUserOptions(); } } else { // We are not the first instance, send the named pipe message with our payload and stop loading if (args.Length >= 2) { var namedPipePayload = new NamedPipePayload { SignalQuit = false, Arguments = args[1] }; // Send the message PipeComm.SendNamedPipeClient(namedPipePayload); } // Close app return; } } catch (Exception ex) { Console.WriteLine("Exception: " + ex.Message); } Console.ReadLine(); }
/// <summary> /// /// </summary> public async Task <Result <CommandResult> > UpdateAsync(UserInput input) { var updateCommand = _mapper.Map <UpdateUserCommand>(input); return(await SendCommandAsync(updateCommand)); }
void Awake() { sound = GetComponent <AudioSource>(); userInput = player.GetComponent <UserInput>(); }
public static NDarray GradientTask(UserInput userInput, NDarray X0) { return(np.add(np.dot(userInput.A.T + userInput.A, X0), userInput.B)); }
public void tokenTest() { UserInput userInput = new UserInput(); Assert.Equal("", userInput.getToken()); }
public override int Execute(params string[] parameters) { //Obtain user Input for Focus Zone (calls UserInput Form) UserInput UIReturn = new UserInput(); UIReturn.ShowDialog(); string fz = UIReturn.Returnfz; Dictionary <string, string> trade = UIReturn.Returnpd; if (fz == "" || trade == null) { //MessageBox.Show("Cancelled Operation"); return(0); } //Initialize Objects List <string> testName = new List <string>(); List <int> resultNew = new List <int>(); List <int> resultActive = new List <int>(); List <int> resultReviewed = new List <int>(); List <int> resultApproved = new List <int>(); List <int> resultResolved = new List <int>(); List <string> testDate = new List <string>(); List <string> fileName = new List <string>(); List <string> sumTestDate = new List <string>(); List <string> tradeStatus = new List <string>(); List <string> tradeClash = new List <string>(); List <string> tradeDiscipline1 = new List <string>(); List <string> tradeDiscipline2 = new List <string>(); List <string> tradeDate = new List <string>(); List <string> tradeFile = new List <string>(); List <string> tradeAll = new List <string>(); List <string> clashAssignTo = new List <string>(); List <string> clashApprovedBy = new List <string>(); List <string> clashApproveTime = new List <string>(); List <string> clashDescription = new List <string>(); List <string> discipline = new List <string>(); List <string> indiTest = new List <string>(); List <double> indiCoordX = new List <double>(); List <double> indiCoordY = new List <double>(); List <double> indiCoordZ = new List <double>(); List <string> focusZone = new List <string>(); List <string> level = new List <string>(); List <double> lvlElev = new List <double>(); List <string> clashLevel = new List <string>(); List <double> gridXMinCoord = new List <double>(); List <double> gridXMaxCoord = new List <double>(); List <double> gridYMinCoord = new List <double>(); List <double> gridYMaxCoord = new List <double>(); string tradeName1 = ""; string tradeName2 = ""; int countNew = 0; int countActive = 0; int countReviewed = 0; int countApproved = 0; int countResolved = 0; try { Document document = Autodesk.Navisworks.Api.Application.ActiveDocument; DocumentClash documentClash = document.GetClash(); DocumentClashTests allTests = documentClash.TestsData; DocumentModels docModel = document.Models; DocumentGrids docGrids = document.Grids; GridSystem docGridSys = docGrids.ActiveSystem; foreach (GridLevel lvl in docGridSys.Levels) { level.Add(lvl.DisplayName); lvlElev.Add(lvl.Elevation); } //-----------------------------------------------------------------------------------------// //Check if Clash Test have even been created //If no clash tests created, exit program int check = allTests.Tests.Count; if (check == 0) { MessageBox.Show("No clash tests currently exist!"); return(0); } //-----------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------// //Begin storing clash data by created tests foreach (ClashTest test in allTests.Tests) { testName.Add(test.DisplayName); //Reset Clash Status counts per test in Clash Detective Summary. Matches Results tab in Clash Detective (ungrouped clashes) countNew = 0; countActive = 0; countReviewed = 0; countApproved = 0; countResolved = 0; if (test.LastRun == null) { sumTestDate.Add("No Test Runs"); } else { sumTestDate.Add(test.LastRun.Value.ToShortDateString()); } //Count number of instances per Clash Status //(based on how user grouped clashes) foreach (SavedItem issue in test.Children) { ClashResultGroup group = issue as ClashResultGroup; //Check if clash groups exist. If null, clash result is not grouped if (null != group) { foreach (SavedItem subissue in group.Children) { ClashResult item = subissue as ClashResult; //Checking if Item1 is null (due to resolved) and need to use Selection-A if (item.Item1 != null) { List <ModelItem> lItem1 = item.Item1.Ancestors.ToList(); tradeName1 = ClashDiscipline_Search(lItem1, trade); //go to line 808 - searches for appropriate discipline by discipline code } else { ModelItemCollection oSelA = test.SelectionA.Selection.GetSelectedItems(); List <ModelItem> lItemA = new List <ModelItem>(); if (oSelA.First.HasModel == true) { lItemA.Add(oSelA.First); } else { lItemA = oSelA.First.Ancestors.ToList(); } tradeName1 = ClashDiscipline_Search(lItemA, trade);//go to line 808 - searches for appropriate discipline by discipline code } //Checking if Item2 is null (due to resolved) and need to use Selection-B if (item.Item2 != null) { List <ModelItem> lItem2 = item.Item2.Ancestors.ToList(); tradeName2 = ClashDiscipline_Search(lItem2, trade);//go to line 808 - searches for appropriate discipline by discipline code } else { ModelItemCollection oSelB = test.SelectionB.Selection.GetSelectedItems(); List <ModelItem> lItemB = new List <ModelItem>(); //MessageBox.Show(oSelB.First.DisplayName); if (oSelB.First.HasModel == true) { lItemB.Add(oSelB.First); } else { //MessageBox.Show("flag 2B"); lItemB = oSelB.First.Ancestors.ToList(); } tradeName2 = ClashDiscipline_Search(lItemB, trade); } //Prompt User when no Discipline match found //User may be missing a discipline/trade in initial input if (tradeName1 == "" || tradeName2 == "") { MessageBox.Show("Discipline Missing. Check Project Disciplines Input File (.txt)." + "\n" + "Clash Test: " + test.DisplayName + "\n" + "Clash Name: " + item.DisplayName + "\n" + "Discipline 1: " + tradeName1 + "\n" + "Discipline 2: " + tradeName2); return(0); } //Store Individual Clash Data testDate.Add(test.LastRun.Value.ToShortDateString()); indiTest.Add(test.DisplayName); focusZone.Add(fz); tradeDiscipline1.Add(tradeName1); tradeDiscipline2.Add(tradeName2); tradeClash.Add(item.DisplayName.ToString()); tradeStatus.Add(item.Status.ToString()); indiCoordX.Add(item.Center.X); indiCoordY.Add(item.Center.Y); indiCoordZ.Add(item.Center.Z); fileName.Add(document.CurrentFileName.ToString()); clashAssignTo.Add(item.AssignedTo); clashApprovedBy.Add(item.ApprovedBy); clashApproveTime.Add(item.ApprovedTime.ToString()); clashDescription.Add(item.Description); if (test.LastRun == null) { testDate.Add("Test Not Run"); } else { tradeDate.Add(test.LastRun.Value.ToShortDateString()); } tradeFile.Add(document.CurrentFileName.ToString()); //for Clash Summary if (null != item && item.Status.ToString() == "New") { countNew = countNew + 1; } else if (null != item && item.Status.ToString() == "Active") { countActive = countActive + 1; } else if (null != item && item.Status.ToString() == "Reviewed") { countReviewed = countReviewed + 1; } else if (null != item && item.Status.ToString() == "Approved") { countApproved = countApproved + 1; } else { countResolved = countResolved + 1; } } } else { ClashResult rawItem = issue as ClashResult; //Checking if Item1 is null (due to resolved) and need to use Selection-A if (rawItem.Item1 != null) { List <ModelItem> lItem1 = rawItem.Item1.Ancestors.ToList(); tradeName1 = ClashDiscipline_Search(lItem1, trade); //go to line 808 - searches for appropriate discipline by discipline code } else { ModelItemCollection oSelA = test.SelectionA.Selection.GetSelectedItems(); List <ModelItem> lItemA = new List <ModelItem>(); if (oSelA.First.HasModel == true) { lItemA.Add(oSelA.First); } else { lItemA = oSelA.First.Ancestors.ToList(); } tradeName1 = ClashDiscipline_Search(lItemA, trade); //go to line 808 - searches for appropriate discipline by discipline code } //Checking if Item1 is null (due to resolved) and need to use Selection-B if (rawItem.Item2 != null) { List <ModelItem> lItem2 = rawItem.Item2.Ancestors.ToList(); tradeName2 = ClashDiscipline_Search(lItem2, trade); //go to line 808 - searches for appropriate discipline by discipline code } else { ModelItemCollection oSelB = test.SelectionB.Selection.GetSelectedItems(); List <ModelItem> lItemB = new List <ModelItem>(); if (oSelB.First.HasModel == true) { lItemB.Add(oSelB.First); } else { lItemB = oSelB.First.Ancestors.ToList(); } tradeName2 = ClashDiscipline_Search(lItemB, trade); //go to line 808 - searches for appropriate discipline by discipline code } if (tradeName1 == "" || tradeName2 == "") { MessageBox.Show("Discipline Missing. Check Project Disciplines Input File (.txt)." + "\n" + "Clash Test: " + test.DisplayName + "\n" + "Clash Name: " + rawItem.DisplayName + "\n" + "Discipline 1: " + tradeName1 + "\n" + "Discipline 2: " + tradeName2); return(0); } //write to second sheet by discipline involvement testDate.Add(test.LastRun.Value.ToShortDateString()); indiTest.Add(test.DisplayName); focusZone.Add(fz); tradeDiscipline1.Add(tradeName1); tradeDiscipline2.Add(tradeName2); tradeClash.Add(rawItem.DisplayName.ToString()); tradeStatus.Add(rawItem.Status.ToString()); tradeFile.Add(document.CurrentFileName.ToString()); indiCoordX.Add(rawItem.Center.X); indiCoordY.Add(rawItem.Center.Y); indiCoordZ.Add(rawItem.Center.Z); fileName.Add(document.CurrentFileName.ToString()); clashAssignTo.Add(rawItem.AssignedTo); clashApprovedBy.Add(rawItem.ApprovedBy); clashApproveTime.Add(rawItem.ApprovedTime.ToString()); clashDescription.Add(rawItem.Description); if (test.LastRun == null) { testDate.Add("Test Not Run"); } else { tradeDate.Add(test.LastRun.Value.ToShortDateString()); } if (rawItem.Status.ToString() == "New") { countNew = countNew + 1; } else if (rawItem.Status.ToString() == "Active") { countActive = countActive + 1; } else if (rawItem.Status.ToString() == "Reviewed") { countReviewed = countReviewed + 1; } else if (rawItem.Status.ToString() == "Approved") { countApproved = countApproved + 1; } else { countResolved = countResolved + 1; } } } //inputs values into Clash Status List by Test resultNew.Add(countNew); resultActive.Add(countActive); resultReviewed.Add(countReviewed); resultApproved.Add(countApproved); resultResolved.Add(countResolved); } //-----------------------------------------------------------------------------------------// //call grid intersection function to return min and max grid coordinate values GridIntersectCoord gridValueReturn = new GridIntersectCoord(); var gridCoordValues = gridValueReturn.GridCoord(); double gridXMin = gridCoordValues.gridXMin; double gridXMax = gridCoordValues.gridXMax; double gridYMin = gridCoordValues.gridYMin; double gridYMax = gridCoordValues.gridYMax; foreach (string clash in tradeClash) { gridXMinCoord.Add(gridXMin); gridXMaxCoord.Add(gridXMax); gridYMinCoord.Add(gridYMin); gridYMaxCoord.Add(gridYMax); } //-----------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------// //Record level clashes occur for Clash Level //lvlElev = actual level elevation of level name (level) int clashIdx = 0; while (clashIdx < indiCoordZ.Count) //indiCoordZ = List of clash elevations { int lvlIdx = 0; //resets level to lowest bool lvlAssign = false; //flag for if clash elevation assigned a level identity while (lvlIdx < level.Count && lvlAssign == false) { //determines if clash on intermediate level if (lvlIdx != level.Count - 1 && indiCoordZ[clashIdx] >= lvlElev[lvlIdx] && indiCoordZ[clashIdx] < lvlElev[lvlIdx + 1]) { clashLevel.Add(level[lvlIdx]); lvlAssign = true; } //determines if clash occurs highest level else if (lvlIdx == level.Count - 1 && indiCoordZ[clashIdx] >= lvlElev[lvlIdx]) { clashLevel.Add(level[lvlIdx]); lvlAssign = true; } //determines if clash occurs below lowest level else if (lvlIdx == 0 && indiCoordZ[clashIdx] < lvlElev[lvlIdx]) { clashLevel.Add("UNDERGROUND"); lvlAssign = true; } lvlIdx++; } clashIdx++; } //-----------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------// //Totals current Open(New + Active), Closed(Resolved + Approved), Field Coordinate(Reviewed) int totOpen = resultNew.Aggregate((a, b) => a + b) + resultActive.Aggregate((a, b) => a + b); int totClosed = resultResolved.Aggregate((a, b) => a + b) + resultApproved.Aggregate((a, b) => a + b); int totReviewed = resultReviewed.Aggregate((a, b) => a + b); int totNew = resultNew.Aggregate((a, b) => a + b); int totActive = resultActive.Aggregate((a, b) => a + b); int totApproved = resultApproved.Aggregate((a, b) => a + b); int totResolved = resultResolved.Aggregate((a, b) => a + b); //-----------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------// //Launch or access Excel via COM Interop: Excel.Application xlApp = new Excel.Application(); Excel.Workbook xlWorkbook; if (xlApp == null) { MessageBox.Show("Excel is not properly installed!"); } //Create New Workbook & Worksheets xlWorkbook = xlApp.Workbooks.Add(Missing.Value); Excel.Worksheet xlWorksheet = (Excel.Worksheet)xlWorkbook.Worksheets.get_Item(1); Excel.Worksheet xlWorksheet_trade = (Excel.Worksheet)xlWorkbook.Worksheets.Add(); xlWorksheet.Name = "Clash Detective Summary"; xlWorksheet_trade.Name = "Individual Clashes"; //Label Column Headers - Summary Worksheet xlWorksheet.Cells[1, 1] = "Test Date"; xlWorksheet.Cells[1, 2] = "Test Name"; xlWorksheet.Cells[1, 3] = "New"; xlWorksheet.Cells[1, 4] = "Active"; xlWorksheet.Cells[1, 5] = "Reviewed"; xlWorksheet.Cells[1, 6] = "Approved"; xlWorksheet.Cells[1, 7] = "Resolved"; xlWorksheet.Cells[1, 9] = "Total New"; xlWorksheet.Cells[1, 10] = "Total Active"; xlWorksheet.Cells[1, 11] = "Total Reviewed"; xlWorksheet.Cells[1, 12] = "Total Approved"; xlWorksheet.Cells[1, 13] = "Total Resolved"; xlWorksheet.Cells[1, 15] = "Total Open (New + Active)"; xlWorksheet.Cells[1, 16] = "Total Closed (Approved + Resolved)"; xlWorksheet.Cells[1, 17] = "Total Deferred to Field Coordination (Reviewed)"; //Label Column Headers - Worksheet By Trade Involvement xlWorksheet_trade.Cells[1, 1] = "Date"; xlWorksheet_trade.Cells[1, 2] = "Focus Zone"; xlWorksheet_trade.Cells[1, 3] = "Test Name"; xlWorksheet_trade.Cells[1, 4] = "Discipline 1"; xlWorksheet_trade.Cells[1, 5] = "Discipline 2"; xlWorksheet_trade.Cells[1, 6] = "Clash"; xlWorksheet_trade.Cells[1, 7] = "Clash Level"; xlWorksheet_trade.Cells[1, 8] = "Status"; xlWorksheet_trade.Cells.Cells[1, 9] = "Clash Location (X)"; xlWorksheet_trade.Cells.Cells[1, 10] = "Clash Location (Y)"; xlWorksheet_trade.Cells.Cells[1, 11] = "Clash Location (Z)"; xlWorksheet_trade.Cells.Cells[1, 12] = "Min X Grid Coordinate"; xlWorksheet_trade.Cells.Cells[1, 13] = "Min Y Grid Coordinate"; xlWorksheet_trade.Cells.Cells[1, 14] = "Max X Grid Coordinate"; xlWorksheet_trade.Cells.Cells[1, 15] = "Max Y Grid Coordinate"; xlWorksheet_trade.Cells.Cells[1, 16] = "File Path"; xlWorksheet_trade.Cells.Cells[1, 17] = "Assigned To"; xlWorksheet_trade.Cells.Cells[1, 18] = "Approved By"; xlWorksheet_trade.Cells.Cells[1, 19] = "Approved Time"; xlWorksheet_trade.Cells.Cells[1, 20] = "Description"; //write clash statuses to excel file by Test int counterSumDate = 2; foreach (string name in sumTestDate) { string cellName = "A" + counterSumDate.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = name; counterSumDate++; } int counterTest = 2; foreach (string name in testName) { string cellName = "B" + counterTest.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = name; counterTest++; } int counterNew = 2; foreach (int valueNew in resultNew) { string cellName = "C" + counterNew.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = valueNew; counterNew++; } int counterActive = 2; foreach (int valueActive in resultActive) { string cellName = "D" + counterActive.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = valueActive; counterActive++; } int counterReviewed = 2; foreach (int valueReviewed in resultReviewed) { string cellName = "E" + counterReviewed.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = valueReviewed; counterReviewed++; } int counterApproved = 2; foreach (int valueApproved in resultApproved) { string cellName = "F" + counterApproved.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = valueApproved; counterApproved++; } int counterResolved = 2; foreach (int valueResolved in resultResolved) { string cellName = "G" + counterResolved.ToString(); var range = xlWorksheet.get_Range(cellName, cellName); range.Value2 = valueResolved; counterResolved++; } //write totals Open, Closed, Field Coordinate to Cells xlWorksheet.Cells[2, 9] = totNew; xlWorksheet.Cells[2, 10] = totActive; xlWorksheet.Cells[2, 11] = totReviewed; xlWorksheet.Cells[2, 12] = totApproved; xlWorksheet.Cells[2, 13] = totResolved; xlWorksheet.Cells[2, 15] = totOpen; xlWorksheet.Cells[2, 16] = totClosed; xlWorksheet.Cells[2, 17] = totReviewed; //Complete Data on Worksheet (per Discipline Clash Involvement) int tradeDateCount = 2; foreach (string date in tradeDate) { string cellName = "A" + tradeDateCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = date; tradeDateCount++; } int counterFz = 2; foreach (string valueFz in focusZone) { string cellName = "B" + counterFz.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = valueFz; counterFz++; } int testNameCount = 2; foreach (string tn in indiTest) { string cellName = "C" + testNameCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = tn; testNameCount++; } int dis1Count = 2; foreach (string dis1 in tradeDiscipline1) { string cellName = "D" + dis1Count.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = dis1; dis1Count++; } int dis2Count = 2; foreach (string dis2 in tradeDiscipline2) { string cellName = "E" + dis2Count.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = dis2; dis2Count++; } int tradeClashCount = 2; foreach (string clash in tradeClash) { string cellName = "F" + tradeClashCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = clash; tradeClashCount++; } int levelCount = 2; foreach (string lvl in clashLevel) { string cellName = "G" + levelCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = lvl; levelCount++; } int tradeStatusCount = 2; foreach (string status in tradeStatus) { string cellName = "H" + tradeStatusCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = status; tradeStatusCount++; } int coordXCount = 2; foreach (double x in indiCoordX) { string cellName = "I" + coordXCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = x; coordXCount++; } int coordYCount = 2; foreach (double y in indiCoordY) { string cellName = "J" + coordYCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = y; coordYCount++; } int coordZCount = 2; foreach (double z in indiCoordZ) { string cellName = "K" + coordZCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = z; coordZCount++; } int xMinCount = 2; foreach (double xMin in gridXMinCoord) { string cellName = "L" + xMinCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = xMin; xMinCount++; } int yMinCount = 2; foreach (double yMin in gridYMinCoord) { string cellName = "M" + yMinCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = yMin; yMinCount++; } int xMaxCount = 2; foreach (double xMax in gridXMaxCoord) { string cellName = "N" + xMaxCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = xMax; xMaxCount++; } int yMaxCount = 2; foreach (double yMax in gridYMaxCoord) { string cellName = "O" + yMaxCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = yMax; yMaxCount++; } int tradeFileCount = 2; foreach (string file in tradeFile) { string cellName = "P" + tradeFileCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = file; tradeFileCount++; } int assignToCount = 2; foreach (string assign in clashAssignTo) { string cellName = "Q" + assignToCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = assign; assignToCount++; } int approvedByCount = 2; foreach (string approve in clashApprovedBy) { string cellName = "R" + approvedByCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = approve; approvedByCount++; } int approveTimeCount = 2; foreach (string time in clashApproveTime) { string cellName = "S" + approveTimeCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = time; approveTimeCount++; } int descriptionCount = 2; foreach (string description in clashDescription) { string cellName = "T" + descriptionCount.ToString(); var range = xlWorksheet_trade.get_Range(cellName, cellName); range.Value2 = description; descriptionCount++; } //Locate file save location string[] clashDate = tradeDate[0].Split('/'); string modDate = ""; if (clashDate[0].Length == 1) { clashDate[0] = "0" + clashDate[0]; } if (clashDate[1].Length == 1) { clashDate[1] = "0" + clashDate[1]; } modDate = clashDate[2] + clashDate[0] + clashDate[1]; SaveFileDialog saveClashData = new SaveFileDialog(); saveClashData.Title = "Save to..."; saveClashData.Filter = "Excel Workbook | *.xlsx|Excel 97-2003 Workbook | *.xls"; saveClashData.FileName = modDate + "-Clash_Test_Data-" + focusZone[0].ToString(); if (saveClashData.ShowDialog() == DialogResult.OK) { string path = saveClashData.FileName; xlWorkbook.SaveCopyAs(path); xlWorkbook.Saved = true; xlWorkbook.Close(true, Missing.Value, Missing.Value); xlApp.Quit(); } xlApp.Visible = false; //-----------------------------------------------------------------------------------------// } catch (Exception exception) { MessageBox.Show("Error! Check if clash test(s) exist or previously run. Original Message: " + exception.Message); } return(0); }
// Update is called once per frame void Update() { // If Jump-button is just pressed down and Mario is standing on ground if (UserInput.JumpDown() && IsGrounded()) { Jump(); } if (IsGrounded() && state == STATE.JUMPING) { _audio.PlayOneShot(LandClip); } if (IsGrounded()) { //if(WalkClip){ // If Mario is moving other way and player steeres other way, Mario skids and decellerates faster if (IsBraking()) { Decellerate(skiddingDecelleration * Time.deltaTime); SetState(STATE.SKIDDING); } else if (Mathf.Abs(body.velocity.x) < minWalkSpeed) { SetState(STATE.STANDING); } else { SetState(STATE.RUNNING); _audio.clip = WalkClip; if (!_audio.isPlaying) { _audio.Play(); } } //} } if (!IsGrounded() && IsBraking()) { Decellerate(jumpXDecelleration * Time.deltaTime); } if (UserInput.Right() && body.velocity.x >= 0.0f) { if (UserInput.RunOrFire()) { body.velocity.x += runAccelleration * Time.deltaTime; if (body.velocity.x > maxRunSpeed) { body.velocity.x = maxRunSpeed; } } else { body.velocity.x += walkAccelleration * Time.deltaTime; if (body.velocity.x > maxWalkSpeed) { body.velocity.x = maxWalkSpeed; } } } if (UserInput.Left() && body.velocity.x <= 0.0f) { if (UserInput.RunOrFire()) { body.velocity.x -= runAccelleration * Time.deltaTime; if (body.velocity.x < -maxRunSpeed) { body.velocity.x = -maxRunSpeed; } } else { body.velocity.x -= walkAccelleration * Time.deltaTime; if (body.velocity.x < -maxWalkSpeed) { body.velocity.x = -maxWalkSpeed; } } } // If player let's go of controller, Mario decellerates slowly if grounded if (!UserInput.Left() && !UserInput.Right() && IsGrounded()) { Decellerate(releaseDecelleration * Time.deltaTime); } // Mario is facing the direction it's moving if (body.velocity.x > 1.0f) { direction = DIRECTION.RIGHT; // The sprite is flipped using x-scale of tranformation Vector3 scale = transform.localScale; scale.x = 1; transform.localScale = scale; } if (body.velocity.x < -1.0f) { direction = DIRECTION.LEFT; Vector3 scale = transform.localScale; scale.x = -1; transform.localScale = scale; } // FIRING if (UserInput.RunOrFire() && Time.time > nextFire && gameObject.GetComponent <FirePower>() != null) { GameObject shot = Instantiate(shotPrefab, transform.position, transform.rotation) as GameObject; _audio.PlayOneShot(FireClip); Rigidbody2D shotRB = shot.GetComponent <Rigidbody2D>(); if (direction == DIRECTION.RIGHT) { shotRB.velocity = new Vector2(800.0f, 0.0f); shot.transform.position = transform.position + new Vector3(60.0f, 50.0f, 0.0f); } else { shotRB.velocity = new Vector2(-800.0f, 0.0f); shot.transform.position = transform.position + new Vector3(-60.0f, 50.0f, 0.0f); } _audio.PlayOneShot(FireClip); SetState(STATE.JUMPING); nextFire = Time.time + fireRate; } // If jump-button is being held down, gravity is lower making jump higher if (UserInput.Jump()) { body.marioGravity = 2250.0f; } else { body.marioGravity = 7875.0f; } if (UserInput.Exit()) { Application.LoadLevel("StartScreen"); } }
public Task Action(UserInput input) { var provider = providers.FirstOrDefault(el => el.Type == SmsProvider); }
/* * Init - setup non-bullet vars */ private void Init() { nextFire = 0f; input = new UserInput(); }
private void Start() { _input = UserInput.Instance; _rigidbody = GetComponent <Rigidbody2D>(); }
GD() { ObjectId idPoly = ObjectId.Null; const string nameLayer = "CPNT-BRKLINE"; double dblAngDock = 0; double dblLenDock = 0; Point3d pnt3dA = Pub.pnt3dO; //point AHEAD Point3d pnt3dB; //point BACK int intSlopeSign = 0; const double pi = System.Math.PI; bool exists = false; ObjectId idDictGRADEDOCK = Dict.getNamedDictionary("GRADEDOCK", out exists); if (!exists) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("Run AVG - exiting ....."); } List <Point3d> pnts3dLim = getDockLimits(); //use 0 as dock number i.e. do one dock at a time bool escape = false; double width = 60; escape = UserInput.getUserInput(string.Format("Enter dock width: <{0}>:", width), out width, width); if (escape) { return; } double height = 4.04; escape = UserInput.getUserInput(string.Format("Enter dock height: <{0}>:", height), out height, height); if (escape) { return; } ObjectId idDictBLDG = Dict.getSubDict(idDictGRADEDOCK, bldgNum); //bldgNum obtained @ getDockLimits ObjectId idDictDOCKS = ObjectId.Null; TypedValue[] tvs; using (BaseObjs._acadDoc.LockDocument()) { try { using (Transaction tr = BaseObjs.startTransactionDb()) { ResultBuffer rb = Dict.getXRec(idDictBLDG, "HANDLE3D"); if (rb == null) { return; } tvs = rb.AsArray(); rb = Dict.getXRec(idDictBLDG, "SLOPE"); if (rb == null) { return; } tvs = rb.AsArray(); double dblSlope = (double)tvs[0].Value; rb = Dict.getXRec(idDictBLDG, "CENTROID"); if (rb == null) { return; } tvs = rb.AsArray(); Point3d pnt3dCEN = new Point3d((double)tvs[0].Value, (double)tvs[1].Value, (double)tvs[2].Value); rb = Dict.getXRec(idDictBLDG, "TARGET"); if (rb == null) { return; } tvs = rb.AsArray(); Point3d pnt3dTAR = new Point3d((double)tvs[0].Value, (double)tvs[1].Value, (double)tvs[2].Value); double dblAngBase = pnt3dCEN.getDirection(pnt3dTAR); ObjectIdCollection idsPoly3dX = new ObjectIdCollection(); List <Point3d> pnts3d = new List <Point3d>(); List <ObjectId> idsCgPnts = new List <ObjectId>(); try { Point3d pnt3dBEG = pnts3dLim[0]; Point3d pnt3dEND = pnts3dLim[1]; dblAngDock = Measure.getAzRadians(pnt3dBEG, pnt3dEND); dblLenDock = pnt3dBEG.getDistance(pnt3dEND); pnt3dB = pnt3dBEG; if (pnt3dTAR != Pub.pnt3dO) { pnt3dA = new Point3d(pnt3dBEG.X, pnt3dBEG.Y, pnt3dTAR.Z + Geom.getCosineComponent(pnt3dCEN, pnt3dTAR, pnt3dBEG) * (dblSlope * -1) - height); } else { pnt3dA = new Point3d(pnt3dBEG.X, pnt3dBEG.Y, pnt3dCEN.Z - height); //assuming flat floor if pnt3dTAR is -1,-1,-1 } pnts3d.Add(pnt3dA); //CgPnt 1 } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdGD_old.cs: line: 113"); } ObjectId idPoly3d = ObjectId.Null; if (dblSlope != 0) { double angDock2 = System.Math.Round(dblAngDock, 2); double angBase2 = System.Math.Round(dblAngBase, 2); double modAngles = 0; double angDiff = System.Math.Round(angBase2 - angDock2, 2); if (angDiff == 0) { intSlopeSign = 1; } else { if (angBase2 > angDock2) { modAngles = angBase2.mod(angDock2); } else { modAngles = angDock2.mod(angBase2); } if (modAngles == 0) { if (angDiff > 0) { intSlopeSign = 1; } else if (angDiff < 0) { intSlopeSign = -1; } } if (System.Math.Abs(angDiff) == System.Math.Round(pi / 2, 2)) { intSlopeSign = 0; } } } if (intSlopeSign != 0) { // sloped floor dblAngDock = dblAngDock - pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, -0.01); pnts3d.Add(pnt3dA); //CgPnt 2 dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, dblLenDock, dblSlope * intSlopeSign * 1); pnts3d.Add(pnt3dA); //Pnt3 dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, 0.01); pnts3d.Add(pnt3dA); //CgPnt 4 dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, dblLenDock, dblSlope * intSlopeSign * -1); pnts3d.Add(pnt3dA); //Pnt5 idPoly3d = pnts3d.build3dPolyDockApron("CPNT-ON", nameLayer, "GD", out idsCgPnts); idsPoly3dX.Add(idPoly3d); } else { dblAngDock = dblAngDock - pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, -0.005); pnts3d.Add(pnt3dA); //Pnt2 int intDivide = (int)System.Math.Truncate(dblLenDock / 84) + 1; if (intDivide % 2 != 0) { intDivide = intDivide + 1; } int x = 0; dblAngDock = dblAngDock + pi / 2; double seg = dblLenDock / intDivide; int updown = 1; for (x = 0; x <= intDivide - 1; x++) { updown = -updown; pnt3dA = pnt3dA.traverse(dblAngDock, seg, 0.005 * updown); pnts3d.Add(pnt3dA); } dblAngDock = dblAngDock + pi / 2; pnt3dA = pnt3dA.traverse(dblAngDock, width, 0.005); pnts3d.Add(pnt3dA); dblAngDock = dblAngDock + pi / 2; for (x = 0; x <= intDivide - 1; x++) { pnt3dA = pnt3dA.traverse(dblAngDock, dblLenDock / intDivide, 0.0); pnts3d.Add(pnt3dA); } idPoly3d = pnts3d.build3dPolyDockApron("CPNT-ON", nameLayer, "GD", out idsCgPnts); idsPoly3dX.Add(idPoly3d); List <ObjectId> idCgPntsX = new List <ObjectId>(); idCgPntsX.Add(idsCgPnts[1]); //CgPnt 2 at dock limit away from building int intUBnd = idsCgPnts.Count; x = -1; int n = 1; int k = intUBnd / 2; for (int j = 1; j <= k - 1; j++) { x = -x; n = n + (intUBnd - 2 * j) * x; System.Diagnostics.Debug.Print(string.Format("{0},{1}", j, n)); idCgPntsX.Add(idsCgPnts[n]); } for (int i = 1; i < idCgPntsX.Count; i++) { List <ObjectId> idsCogoPnts = new List <ObjectId> { idCgPntsX[i - 1], idCgPntsX[i - 0] }; idPoly3d = BrkLine.makeBreakline(apps.lnkBrks, "GD", out idPoly, idsCogoPnts); idsPoly3dX.Add(idPoly3d); } } Grading_Floor.modSurface("CPNT-ON", "Finish Surface", idsPoly3dX, false); tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " cmdGD_old.cs: line: 238"); } } }
public EducationClass Create(IDataStore <EducationClass> dataStore, EducationClass existingClass = null) { EducationClass newClass = new EducationClass(); UserStore userStore = new UserStore(); bool keepLooping = true; do { Console.Clear(); Console.WriteLine("Skapa ny klass"); Console.WriteLine(); string classId = UserInput.GetInput <string>("Klass-id:"); existingClass = dataStore.FindById(classId); if (existingClass != null && keepLooping) { Console.WriteLine("Klass-id redan använt"); UserInput.WaitForContinue(); } else { Console.Write("Klassbeskrivning: "); string classDescription = UserInput.GetInput <string>(); string input; User user; bool isSupervisor = false; do { Console.WriteLine("Utbildningsledare: "); do { input = UserInput.GetInput <string>(); if (input == string.Empty) { Console.WriteLine("Kan inte lämna namnet tomt"); } } while (input == string.Empty); user = userStore.FindById(input); if (user != null) { isSupervisor = user.HasLevel(UserLevel.EducationSupervisor); if (!isSupervisor) { Console.WriteLine("Användaren är inte utbildningsledare"); } } else { Console.WriteLine("Användaren finns inte"); } } while (user == null || !isSupervisor); string newStudent; List <string> studentList = new List <string>(); do { Console.WriteLine("Lägg till student-id: "); newStudent = UserInput.GetInput <string>(); User student = userStore.FindById(newStudent); if (student != null && student.HasLevel(UserLevel.Student)) { studentList.Add(student.UserName); } else { Console.WriteLine("Användaren är inte student"); } } while (newStudent.Length > 0); newClass = new EducationClass { ClassId = classId, Description = classDescription, EducationSupervisorId = input, }; newClass.SetStudentList(studentList); keepLooping = false; } } while (keepLooping); EducationClass klass = dataStore.AddItem(newClass); dataStore.Save(); return(klass); }
private bool IsAccelerating() { return(UserInput.Right() && body.velocity.x >= 0.0f || UserInput.Left() && body.velocity.x <= 0.0f); }
TP2() { Point3d pnt3d1 = UserInput.getPoint("\nPick Corner 1: ", Pub.pnt3dO, out escaped, out ps, osMode: 0); if (pnt3d1 == Pub.pnt3dO) { return; } Point3d pnt3d2 = UserInput.getPoint("\nPick Baseline direction: ", pnt3d1, out escaped, out ps, osMode: 0); if (pnt3d1 == Pub.pnt3dO) { return; } Vector2d v2dX = pnt3d2.Convert2d(BaseObjs.xyPlane) - pnt3d1.Convert2d(BaseObjs.xyPlane); Vector2d v2dY = v2dX.RotateBy(System.Math.PI / 2); Vector3d v3dY = new Vector3d(v2dY.X, v2dY.Y, 0); Point3d pnt3dY = pnt3d1 + v3dY; Matrix3d m3d = UCsys.addUCS(pnt3d1, pnt3d2, "temp"); Point3d pnt3d0 = Db.wcsToUcs(pnt3d1); Polyline poly = jigPolylineArea(pnt3d0); UCsys.setUCS2World(); poly.ObjectId.transformToWcs(BaseObjs._db); escaped = UserInput.getUserInputDoubleAsString("\nEnter Elevation: ", out elev, elev); if (escaped) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Slope: ", out slope, slope); if (escaped) { return; } double dblSlope = double.Parse(slope); Point3d pnt3dCEN = poly.getCentroid(); Point3d pnt3dTAR = UserInput.getPoint("\nPick edge of polygon in the Direction of Increasing Slope: ", pnt3dCEN, out escaped, out ps, osMode: 641); if (pnt3dTAR == Pub.pnt3dO) { return; } ObjectIdCollection idspoly3d = new ObjectIdCollection(); double dblDist = 0.0; ObjectId idPoly3d = ObjectId.Null; pnt3dCEN = pnt3dCEN.addElevation(double.Parse(elev)); if (pnt3dTAR != Pub.pnt3dO) { dblDist = pnt3dCEN.getDistance(pnt3dTAR); } string nameLayer = string.Format("{0}-BORDER", "BASIN"); Layer.manageLayers(nameLayer); int numObj = 0; bool exists = false; ObjectId idDict = Dict.getNamedDictionary(apps.lnkBrks, out exists); if (exists) { numObj = idDict.getDictEntries().Count; } string nameSurf = string.Format("{0}{1}", "BASIN", numObj.ToString("00")); ObjectId idDictObj = Dict.addSubDict(idDict, nameSurf); using (BaseObjs._acadDoc.LockDocument()) { if (pnt3dTAR != Pub.pnt3dO) { pnt3dTAR = new Point3d(pnt3dTAR.X, pnt3dTAR.Y, pnt3dCEN.Z + dblDist * dblSlope); idPoly3d = Base_Tools45.C3D.DrawBasinBot.build3dPolyBasinBot(poly.ObjectId, pnt3dCEN, pnt3dTAR, dblSlope, nameLayer, apps.lnkBrks); } else { idPoly3d = Conv.poly_Poly3d(poly.ObjectId, double.Parse(elev), nameLayer); } idspoly3d.Add(idPoly3d); TinSurface surf = Surf.addTinSurface(nameSurf, out exists); if (exists) { Application.ShowAlertDialog(string.Format("Surface Name conflict - surface \"{0}\" already exists. Exiting...", nameSurf)); return; } surf.BreaklinesDefinition.AddStandardBreaklines(idspoly3d, 1.0, 0.0, 0.0, 0.0); surf.Rebuild(); } using (BaseObjs._acadDoc.LockDocument()) { BaseObjs.regen(); } }
static void Main(string[] args) { while (true) { Menu globalMenu = new Menu(); int menuItem = globalMenu.AdminMenuI(); if (menuItem == 0) { Environment.Exit(0); } else if (menuItem == 1) { Expenses expenses = new Expenses(); bool isInputFinished = false; Console.Clear(); while (!isInputFinished) { expenses.CategoryId = UserInput.InputCatalog("категории", CatalogType.GoodsCategory, "Категория"); expenses.GoodsId = UserInput.InputCatalog("товара", CatalogType.Goods, "Товар"); expenses.UnitId = UserInput.InputCatalog("единицы измерения", CatalogType.Unit, "Единица измерения"); expenses.Price = UserInput.InputNumber("цену товара", "цены"); expenses.Quantity = UserInput.InputNumber("количество", "количества"); UserInput.InputDate(expenses); isInputFinished = true; } Data.AddExpense("Expenses", expenses); } else if (menuItem == 2) { bool isInputFinished = false; Console.Clear(); while (!isInputFinished) { int menuCatalog = new Menu().СatalogsMenu(); if (menuCatalog >= 1 && menuCatalog <= 3) { UserInput.AddRecord(menuCatalog); isInputFinished = true; Console.Clear(); } else if (menuCatalog == 0) { isInputFinished = true; Console.Clear(); } } } else if (menuItem == 3) { bool isInputFinished = false; Console.Clear(); while (!isInputFinished) { int deleteMenu = new Menu().DeleteMenu(); if (deleteMenu >= 1 && deleteMenu <= 3) { UserInput.DeleteRecord(deleteMenu); isInputFinished = true; } else if (deleteMenu == 4) { UserInput.DeletePurchase(); isInputFinished = true; } else if (deleteMenu == 0) { isInputFinished = true; Console.Clear(); } } } else if (menuItem == 4) { bool isInputFinished = false; Console.Clear(); while (!isInputFinished) { int viewRecordMenu = new Menu().ViewRecordMenu(); if (viewRecordMenu >= 1 && viewRecordMenu <= 4) { ConsoleKeyInfo userChoose = Console.ReadKey(); if (viewRecordMenu == 4) { UserOutput.TableExpensesDynamic(((pageCounter - 1) * pageSize), pageCounter * pageSize); int maxId = Data.GetMaxId("Expenses.csv"); while (userChoose.Key != ConsoleKey.D0) { UserOutput.TableExpensesDynamic(((pageCounter - 1) * pageSize), pageCounter * pageSize); if (userChoose.Key == ConsoleKey.PageDown || userChoose.Key == ConsoleKey.DownArrow || userChoose.Key == ConsoleKey.RightArrow) { if (pageCounter * pageSize <= maxId) { pageCounter += 1; } } if (userChoose.Key == ConsoleKey.PageUp || userChoose.Key == ConsoleKey.UpArrow || userChoose.Key == ConsoleKey.LeftArrow) { if (pageCounter > 1) { pageCounter -= 1; } } userChoose = Console.ReadKey(); } pageCounter = 1; } else { CatalogType catalog = (CatalogType)viewRecordMenu; UserOutput.TableCatalogs(catalog, ((pageCounter - 1) * pageSize), pageCounter * pageSize); int maxId = Data.GetMaxId(catalog + ".csv"); while (userChoose.Key != ConsoleKey.D0) { UserOutput.TableCatalogs(catalog, ((pageCounter - 1) * pageSize), pageCounter * pageSize); if (userChoose.Key == ConsoleKey.PageDown || userChoose.Key == ConsoleKey.DownArrow || userChoose.Key == ConsoleKey.RightArrow) { if (pageCounter * pageSize <= maxId) { pageCounter += 1; } } if (userChoose.Key == ConsoleKey.PageUp || userChoose.Key == ConsoleKey.UpArrow || userChoose.Key == ConsoleKey.LeftArrow) { if (pageCounter > 1) { pageCounter -= 1; } } userChoose = Console.ReadKey(); } } pageCounter = 1; Console.ReadKey(); } else if (viewRecordMenu == 0) { isInputFinished = true; Console.Clear(); } } } else if (menuItem == 5) { bool isInputFinished = false; Console.Clear(); while (!isInputFinished) { int editMenu = new Menu().EditMenu(); if (editMenu >= 1 && editMenu <= 3) { UserInput.EditRecord(editMenu); isInputFinished = true; } else if (editMenu == 0) { isInputFinished = true; Console.Clear(); } } } } }
stakeMISC(string strCommand) { TinSurface objSurface = fStake.SurfaceCPNT; string strLayer = fMisc.tbxLayer.Text; string strDesc = fMisc.tbxDesc0.Text + fMisc.tbxDescription.Text; PromptStatus ps; bool escape; switch (strCommand) { case "InLine_Center": BaseObjs.acadActivate(); Point3d pnt3dTar = UserInput.getPoint("\nSelect Target Point for Staking: ", out ps, osMode: 8); Point3d pnt3dPick = UserInput.getPoint("\nSelect Directional Point(any XY location): ", pnt3dTar, out escape, out ps, osMode: 8); double dblAngDir1 = pnt3dTar.getDirection(pnt3dPick); Point3d pnt3dPolar = pnt3dTar.traverse(dblAngDir1, double.Parse(fMisc.cbxOffset.Text)); double dblElev = objSurface.FindElevationAtXY(pnt3dTar.X, pnt3dTar.Y); Point3d pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); pnt3dPolar = pnt3dTar.traverse(dblAngDir1 + PI, double.Parse(fMisc.cbxOffset.Text)); pnt3dPolar = pnt3dTar.traverse(dblAngDir1, double.Parse(fMisc.cbxOffset.Text)); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); break; case "InLine_Direction": BaseObjs.acadActivate(); pnt3dTar = UserInput.getPoint("\nSelect Target Point for Staking: ", out ps, osMode: 8); pnt3dPick = UserInput.getPoint("\nSelect Directional Point(any XY location): ", pnt3dTar, out escape, out ps, osMode: 8); dblAngDir1 = pnt3dTar.getDirection(pnt3dPick); pnt3dPolar = pnt3dTar.traverse(dblAngDir1, double.Parse(fMisc.cbxOffset.Text)); dblElev = objSurface.FindElevationAtXY(pnt3dTar.X, pnt3dTar.Y); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); if (double.Parse(fMisc.cbxOffsetDir.Text) == 0) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Direction Offset is 0 - revise....exiting"); return; } pnt3dPolar = pnt3dTar.traverse(dblAngDir1, double.Parse(fMisc.cbxOffset.Text) + double.Parse(fMisc.cbxOffsetDir.Text)); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); strDesc = string.Format("{0}' O/S {1} @", double.Parse(fMisc.cbxOffset.Text) + double.Parse(fMisc.cbxOffsetDir.Text), fMisc.cbxObjType.Text); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); break; case "Proj2Curb": BaseObjs.acadActivate(); pnt3dTar = UserInput.getPoint("\nSelect Target Point for Staking: ", out ps, osMode: 8); string xRefPath = ""; Entity ent = xRef.getEntity("\nSelect Adjacent Curb:", out escape, out xRefPath); Point3d pnt3dInt0 = getRadial_Perpendicular(pnt3dTar, ent); ent.ObjectId.delete(); dblAngDir1 = pnt3dTar.getDirection(pnt3dInt0); pnt3dPolar = pnt3dInt0.traverse(dblAngDir1 + PI / 2, double.Parse(fMisc.cbxOffset.Text)); dblElev = objSurface.FindElevationAtXY(pnt3dInt0.X, pnt3dInt0.Y); dblElev = dblElev + double.Parse(fMisc.cbxCurbHeight.Text) / 12; pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); pnt3dPolar = pnt3dInt0.traverse(dblAngDir1 - PI / 2, double.Parse(fMisc.cbxOffset.Text)); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); break; case "Proj2Bldg": BaseObjs.acadActivate(); pnt3dTar = UserInput.getPoint("\nSelect Target Point for Staking: ", out ps, osMode: 8); Point3d pnt3dRef1 = UserInput.getPoint("Pick Point Perpendicular to Building: ", pnt3dTar, out escape, out ps, osMode: 8); dblAngDir1 = pnt3dTar.getDirection(pnt3dRef1); pnt3dPolar = pnt3dRef1.traverse(dblAngDir1 + PI / 2, double.Parse(fMisc.cbxOffset.Text)); dblElev = objSurface.FindElevationAtXY(pnt3dRef1.X, pnt3dRef1.Y); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); pnt3dPolar = pnt3dRef1.traverse(dblAngDir1 - PI / 2, double.Parse(fMisc.cbxOffset.Text)); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); break; case "AP": BaseObjs.acadActivate(); pnt3dTar = UserInput.getPoint("\nSelect Target Point for Staking: ", out ps, osMode: 8); pnt3dRef1 = UserInput.getPoint("\nSelect Adjacent Angle Point1: ", out ps, osMode: 1); Point3d pnt3dRef2 = UserInput.getPoint("\nSelect Adjacent Angle Point2: ", out ps, osMode: 1); Point3d varPntPick = UserInput.getPoint("\nSelect Side: ", out ps, osMode: 0); double dblAngDelta = Geom.getAngle3Points(pnt3dRef1, pnt3dTar, pnt3dRef2); dblAngDir1 = pnt3dRef1.getDirection(pnt3dTar); double dblAngDir2 = pnt3dTar.getDirection(pnt3dRef2); bool isRightHand = (pnt3dTar.isRightSide(pnt3dRef1, pnt3dRef2)) ? true : false; pnt3dPolar = varPntPick.traverse(dblAngDir1 + PI / 2, 10); List <Point3d> pnts3d1 = new List <Point3d> { pnt3dRef1, pnt3dTar }; List <Point3d> pnts3d2 = new List <Point3d> { varPntPick, pnt3dPolar }; List <Point3d> pnts3dInt = pnts3d1.intersectWith(pnts3d2, false, extend.both); if (pnts3dInt.Count == 0) { return; } bool boolHit = false, boolIN = false; int intSide = 0; //PICK POINT ADJACENT TO FIRST SEGMENT if (pnt3dTar.isRightSide(pnt3dRef1, varPntPick)) { //CCW if (isRightHand) { boolIN = true; intSide = -1; //CW } else { boolIN = false; intSide = -1; } boolHit = true; } else { //RIGHT SIDE OF FIRST SEGMENT //CCW if (isRightHand) { boolIN = false; intSide = 1; } else { boolIN = true; //CW intSide = 1; } boolHit = true; } if (!boolHit) { pnt3dPolar = varPntPick.traverse(dblAngDir2 + PI / 2, 10); pnts3d1 = new List <Point3d> { pnt3dRef2, pnt3dTar }; pnts3d2 = new List <Point3d> { varPntPick, pnt3dPolar }; List <Point3d> pnts3dInt2 = pnts3d1.intersectWith(pnts3d2, false, extend.both); //PICK POINT ADJACENT TO SECOND SEGMENT //LEFT SIDE OF SECOND SEGMENT if (pnt3dRef2.isRightSide(pnt3dTar, varPntPick)) { //CCW if (isRightHand) { boolIN = true; intSide = -1; //CW } else { boolIN = false; intSide = -1; } //RIGHT SIDE OF SECOND SEGMENT } else { //CCW if (isRightHand) { boolIN = false; intSide = 1; //CW } else { boolIN = true; intSide = 1; } } } if (boolIN) { pnt3dPolar = pnt3dTar.traverse(dblAngDir2 + dblAngDelta / 2 * intSide * -1, Convert.ToDouble(fMisc.cbxOffset.Text) / System.Math.Sin(dblAngDelta / 2)); dblElev = objSurface.FindElevationAtXY(pnt3dTar.X, pnt3dTar.Y); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); } else { pnt3dPolar = pnt3dTar.traverse(dblAngDir2 + ((3 * PI / 2 - dblAngDelta) * intSide * -1), Convert.ToDouble((fMisc.cbxOffset).Text)); //point opposite begin point of next segment dblElev = objSurface.FindElevationAtXY(pnt3dTar.X, pnt3dTar.Y); pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); pnt3dPolar = pnt3dTar.traverse(dblAngDir2 + (PI / 2 * intSide * -1), Convert.ToDouble((fMisc.cbxOffset).Text)); //point opposite begin point of next segment pnt3d = new Point3d(pnt3dPolar.X, pnt3dPolar.Y, dblElev); Stake_Calc.setOffsetPointMISC(pnt3d, strLayer, strDesc); } break; } }
static void Main(string[] args) { bool memory; bool loop = false; PersonManager personManager; MonitorConsole.PrintMemoryChoise(); string input = Console.ReadLine(); if (input == "r") { try { personManager = new PersonManager(new MemoryStorage()); } catch (Exception ex) { Console.WriteLine($"eccezione in add person in memoria {ex.Message} {ex.GetType()}"); throw; }//tryc } else { try { personManager = new PersonManager(new FileStorage()); } catch (Exception ex) { Console.WriteLine($"eccezione in add person su file {ex.Message} {ex.GetType}"); throw; } //tryc } //endif if (input == "r") { memory = false; } if (input == "d") { memory = true; } Console.WriteLine("Impostazioni salvate"); loop = true; int id = 0; while (loop) { MonitorConsole.PrintMenu(); input = Console.ReadLine(); List <Person> PersonList = new List <Person>(); UserInput result = GetInput(input); //PersonManager personManager = new PersonManager(); if (result == UserInput.Exit) { break; } if (result == UserInput.AddPerson) { AddDataPerson(personManager, id); } if (result == UserInput.DelPerson) { DelDataPerson(personManager); } if (result == UserInput.PrintPersons) { PrintPersonList(personManager); } if (result == UserInput.Error) { Console.WriteLine("Attenzione il comando inserito non corrisponde ad un numero"); } } Console.WriteLine("Uscita in corso..."); }
public static NDarray Gradient2ndOrderTask(UserInput userInput) { return(np.linalg.inv(np.add(userInput.A, userInput.A.T))); }
/// <summary> Setter used to define which keys correspond to which inputs. </summary> /// <param name="input"> The button to define. </param> /// <param name="key"> The key to attach to it. </param> public static void setKeyBoardKey(UserInput input, KeyCode key, int playerNumber = 0) { if (keyBoard == null) throw new System.AccessViolationException(UnitializedMessage); keyBoard[(int)input, playerNumber] = key; }
// Use this for initialization void Awake() { getRythmInput = gameObject.AddComponent <UserInput>(); }
private void _AddOnGameMenuActions(UserInput ui) { ui.AddToItemMenuEvent(_ItemMenuButton_OnGame); ui.AddToActionMenuEvent(_ActionMenuButton_OnGame); ui.AddToStatusMenuEvent(_StatusMenuButton_OnGame); ui.AddToJumpEvent(_JumpButton_OnGame); }
TP3() { elev = UserInput.getCogoPoint("\nPick Cogo Point 1: ", out idCgPnt1, ObjectId.Null, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt1); elev = UserInput.getCogoPoint("\nPick Cogo Point 2: ", out idCgPnt2, idCgPnt1, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt3); elev = UserInput.getCogoPoint("\nPick Cogo Point 3: ", out idCgPnt3, idCgPnt2, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt3); Point3d pnt3d1 = idCgPnt1.getCogoPntCoordinates(); Point3d pnt3d2 = idCgPnt2.getCogoPntCoordinates(); Point3d pnt3d3 = idCgPnt3.getCogoPntCoordinates(); Vector2d v2d12 = (pnt3d2 - pnt3d1).Convert2d(BaseObjs.xyPlane); Vector2d v2d21 = (pnt3d1 - pnt3d2).Convert2d(BaseObjs.xyPlane); Vector2d v2d23 = (pnt3d3 - pnt3d2).Convert2d(BaseObjs.xyPlane); Vector2d v2d32 = (pnt3d2 - pnt3d3).Convert2d(BaseObjs.xyPlane); ObjectId idCgPnt4 = ObjectId.Null; Point3d pnt3d4 = Pub.pnt3dO; double dir = 0.0; double len = 0.0; double slp = 0.0; double delta = pi - v2d12.GetAngleTo(v2d23); double diff = System.Math.Abs(delta - pi / 2); if (diff < 0.01) { dir = v2d21.Angle; len = pnt3d2.getDistance(pnt3d1); slp = pnt3d2.getSlope(pnt3d1); pnt3d4 = pnt3d3.traverse(dir, len, slp); idCgPnt4 = pnt3d4.setPoint(out pntNum); idsCgPnt.Add(idCgPnt4); } else { dir = v2d23.Angle; len = pnt3d2.getDistance(pnt3d3); len = len * System.Math.Cos(delta); slp = pnt3d2.getSlope(pnt3d3); slp = slp * System.Math.Cos(delta); double testRight = Geom.testRight(pnt3d1, pnt3d2, pnt3d3); dir = v2d12.Angle; len = pnt3d1.getDistance(pnt3d2); pnt3d4 = pnt3d3.traverse(dir, len, slp); idCgPnt4 = pnt3d4.setPoint(out pntNum); idsCgPnt.Insert(2, idCgPnt4); } idsCgPnt.Add(idsCgPnt[0]); ObjectId idPoly = ObjectId.Null; for (int n = 0; n < idsCgPnt.Count - 1; n++) { List <ObjectId> idCgPnts = new List <ObjectId> { idsCgPnt[n], idsCgPnt[n + 1] }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP3", out idPoly, idCgPnts); } }
public void Run(UserInput currentInput) { string output = "+----------------------------------------------------------------------------+\n"; output += "| name - topic |\n"; output += "+----------------------------------------------------------------------------+\n"; Server.RoomList.ForEach(delegate(Room currentRoom) { output += string.Format(" {0,-17} - {1}\n", currentRoom.Name, currentRoom.Topic); }); output += "+----------------------------------------------------------------------------+\n"; output += String.Format("| There is a total of {0} rooms. All are public |\n", Server.RoomList.Count); output += "+----------------------------------------------------------------------------+\n"; currentInput.User.WriteLine(output); }
void Awake() { userInput = GetComponentInParent <UserInput> (); }
TP1() { elev = UserInput.getCogoPoint("\nPick Cogo Point 1: ", out idCgPnt1, ObjectId.Null, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt1); elev = UserInput.getCogoPoint("\nPick Cogo Point 2: ", out idCgPnt2, idCgPnt1, osMode: 8); if (elev == "") { return; } idsCgPnt.Add(idCgPnt2); escaped = UserInput.getUserInputDoubleAsString("\nEnter Cross Slope (+ or -): ", out xSlope, xSlope); if (escaped) { return; } escaped = UserInput.getUserInputDoubleAsString("\nEnter Width: ", out width, width); if (escaped) { return; } Point3d pnt3d1 = idCgPnt1.getCogoPntCoordinates(); Point3d pnt3d2 = idCgPnt2.getCogoPntCoordinates(); List <Point3d> pnts3d = new List <Point3d> { pnt3d1, pnt3d2 }; int side = Geom.getSide(pnts3d); double dir = pnt3d1.getDirection(pnt3d2); double len = pnt3d1.getDistance(pnt3d2); Point3d pnt3d3 = pnt3d2.traverse(dir + pi / 2 * -side, double.Parse(width), double.Parse(xSlope)); ObjectId idCgPnt3 = pnt3d3.setPoint(out pntNum); idsCgPnt.Add(idCgPnt3); BaseObjs.updateGraphics(); Point3d pnt3d4 = pnt3d1.traverse(dir + pi / 2 * -side, double.Parse(width), double.Parse(xSlope)); ObjectId idCgPnt4 = pnt3d4.setPoint(out pntNum); idsCgPnt.Add(idCgPnt4); BaseObjs.updateGraphics(); idsCgPnt.Add(idCgPnt1); ObjectId idPoly = ObjectId.Null; List <ObjectId> idCgPnts = new List <ObjectId> { idCgPnt1, idCgPnt2 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt2, idCgPnt3 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt3, idCgPnt4 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); idCgPnts = new List <ObjectId> { idCgPnt4, idCgPnt1 }; BrkLine.makeBreakline(apps.lnkBrks, "cmdTP4", out idPoly, idCgPnts); }
private bool ConfirmUpdateOrder(OrderInfo newOrder) { bool userChoice = UserInput.PromptAndValidate("Do you want to save these changes? Y/N"); return(userChoice); }
public async Task <JsonResult> SaveUserModel([FromBody] UserInput model) { var ajaxResponse = await _userInfoAppService.SaveUserModel(model); return(Json(ajaxResponse)); }
public void Run(UserInput currentInput) { if(currentInput.User.Room.Review.Count > 0 ) { currentInput.User.WriteLine("*** Room conversation buffer ***\n"); string output = ""; currentInput.User.Room.Review.ForEach(delegate(UserCommuncationBuffer currentMessage) { //TODO: what if the line doesn't have a new line at the end? output += String.Format("{0} {1}", currentMessage.Send.ToShortTimeString(), currentMessage.Message); }); currentInput.User.WriteLine(output); currentInput.User.WriteLine("*** End ***"); } else { currentInput.User.WriteLine("Review buffer is empty."); } }
//RaycastHit2D[] info; public override void UpdateState(Character c, UserInput input, RaycastHit2D[] info) { this.info = info; //Debug.Log("Jumping state updating"); //c.currentLinearSpeed = input.xInput * c.maxSpeed * GameManager.Instance.DeltaTime * GameManager.Instance.DeltaTime; if (input.jumpPressed && input.jumpReleased && !jumping) { //sound must only be played once c.SetSoundEffect(c.playerAudio.jump, false, false); jumping = true; c.currentJumpSpeed = c.maxJumpSpeed * GameManager.Instance.stepSize * GameManager.Instance.stepSize; //This is set so that the jump in the next frame is not detected input.jumpReleased = false; } //setting the animation AnimateState(c); if (input.jumpPressed) { if (jumpDamper > 0.25f) { jumpDamper -= c.jumpMultiplier * GameManager.Instance.DeltaTime; } else { jumpDamper = 0.25f; } } //There has to be a default downwardforce acting all the time, which is gravity c.currentJumpSpeed += c.gravity * 4.5f * jumpDamper * GameManager.Instance.DeltaTime * GameManager.Instance.DeltaTime; //Debug.Log("Current jump speed: " + c.currentJumpSpeed); if (c.StateList.Count == index) { Collider2D upwardCollision = Physics2D.OverlapCircle(c.ceilingCheck.transform.position, c.groundCheckCircleRadius, LayerMask.GetMask("Platform")); //Debug.Log("upward collision: " + upwardCollision); if (upwardCollision != null && c.currentJumpSpeed > 0 && !upwardCollision.isTrigger) { Debug.Log("Upward collision is not null"); c.currentJumpSpeed = 0; //c.State = null; //c.State = new FallingState(1); c.StateList.RemoveAt(c.StateList.Count - 1); States nextState = new FallingState(1); nextState.index = c.StateList.Count + 1; c.StateList.Add(nextState); } else if (c.currentJumpSpeed < 0) { //c.State = null; //c.State = new FallingState(1); c.StateList.RemoveAt(c.StateList.Count - 1); States nextState = new FallingState(1); nextState.index = c.StateList.Count + 1; c.StateList.Add(nextState); } } }
public void Run(UserInput currentInput) { if(currentInput.Args.Length < 2) { currentInput.User.WriteLine(String.Format("The current topic is: {0}", currentInput.User.Room.Topic)); } else { currentInput.User.Room.Topic = currentInput.Message; currentInput.User.WriteLine(String.Format("Topic set to: {0}", currentInput.Message)); currentInput.User.Room.WriteAllBut(String.Format("{0} has set the topic to: {1}\n", currentInput.User.Name, currentInput.Message), new System.Collections.Generic.List<User> { currentInput.User }); } }
public override void UpdateState(Character c, UserInput input, RaycastHit2D[] info) { this.info = info; //Debug.Log("Falling state updating"); //base.UpdateState(c, input); fallTimer += GameManager.Instance.DeltaTime; if (jumpDamper < 1) { jumpDamper += c.jumpMultiplier * 5 * GameManager.Instance.DeltaTime; } else { jumpDamper = 1; } c.currentJumpSpeed += c.gravity * 11.5f * jumpDamper * GameManager.Instance.DeltaTime * GameManager.Instance.DeltaTime; if (Mathf.Sign(c.currentJumpSpeed) < 0 && Mathf.Abs(c.currentJumpSpeed) > 0.65f) { c.currentJumpSpeed = -0.65f; } //c.currentLinearSpeed = input.xInput * c.maxSpeed * GameManager.Instance.DeltaTime * GameManager.Instance.DeltaTime; //Debug.Log("Fall timer: " + fallTimer); //float angle = 0; //float yCorr = 0; //CharacterUtility.CastRayAndOrientPlayer(c, out angle, out yCorr); //Debug.Log("Angle: " + angle); if (c.StateList.Count == index) { //animation AnimateState(c); //Music c.SetSoundEffect(c.playerAudio.fall, true, false, 1.5f); } if (info.Length > 0) { int count = 0; for (int i = 0; i < info.Length; i++) { if (info[i].collider.gameObject.layer != LayerMask.NameToLayer("Platform")) { count++; } else if (info[i].collider.tag == "tag_ladder") { count++; } } if (count == info.Length) { return; } if (angle < 65) { //Pause player movement for a while if (fallTimer > 0.08f) { c.BlockInputs(); //Debug.Log("blocking inputs"); } //c.State = null; //c.State = new LandState(); if (c.StateList.Count == index) { c.currentJumpSpeed = yCorr; c.StateList.RemoveAt(c.StateList.Count - 1); States nextState = new LandState(); nextState.index = c.StateList.Count + 1; c.StateList.Add(nextState); } if (Mathf.Abs(c.currentJumpSpeed) > 0) { c.currentJumpSpeed = 0; } } } //If the angle with the collider is greater than 65, then set the state as falling cuz player wont be able to walk on it }
public void Run(UserInput currentInput) { currentInput.User.Room.Review.Clear(); currentInput.User.WriteLine("You clear the review buffer."); currentInput.User.Room.WriteAllBut(String.Format("{0} clears the review buffer.\n", currentInput.User.Name), new System.Collections.Generic.List<User> { currentInput.User }); }
public UserInputParser(UserInput userInput, UserOutput userOutput) { _userInput = userInput; _userOutput = userOutput; }
private bool IsBraking() { return(UserInput.Right() && body.velocity.x < 0.0f || UserInput.Left() && body.velocity.x > 0.0f); }
internal static void ApplyInput(GameModel model, UserInput userInput) { }