public void InitScopingControl() { var parent = transform.parent; if (parent == null) { Debug.LogError("Parent GameObject is not found"); return; } var camera = transform.parent.GetComponentInChildren <Camera>(); if (camera == null) { Debug.LogError("Camera is not found"); return; } var firstPersonController = transform.parent.GetComponent <FirstPersonController>(); if (firstPersonController == null) { Debug.LogError("FirstPersonController is not found"); return; } WalkSpeed.Subscribe(walkSpeed => { firstPersonController.m_WalkSpeed = walkSpeed; }).AddTo(gameObject); FieldOfView.Subscribe(fieldOfView => { var beforeFieldOfView = camera.fieldOfView; var hash = new Hashtable { { "from", beforeFieldOfView }, { "to", fieldOfView }, { "time", scopeZoomDuration }, { "easyType", iTween.EaseType.easeOutQuart }, { "onupdate", "ChangeCameraView" }, { "onupdatetarget", gameObject } }; iTween.ValueTo(gameObject, hash); }).AddTo(gameObject); CameraSpeed.Subscribe(cameraSpeed => { firstPersonController.m_MouseLook.XSensitivity = cameraSpeed; firstPersonController.m_MouseLook.YSensitivity = cameraSpeed; }).AddTo(gameObject); }
private string XsltTripRequest2Uri(Location from, Location via, Location to, DateTime date, bool dep, string products, WalkSpeed walkSpeed, bool forceReload) { string dateFormat = "yyyyMMdd"; string timeFormat = "HHmm"; StringBuilder uri = new StringBuilder(this._apiBase); uri.Append("XSLT_TRIP_REQUEST2"); this.AppendCommonRequestParams(uri); uri.Append("&sessionID=0"); uri.Append("&requestID=0"); uri.Append("&language=de"); if (forceReload) uri.Append("&guid=" + Guid.NewGuid().ToString()); AbstractEfaProvider.AppendCommonXsltTripRequest2Params(uri); this.AppendLocation(uri, from, "origin"); this.AppendLocation(uri, to, "destination"); if (via != null) this.AppendLocation(uri, via, "via"); uri.Append("&itdDate=").Append(Uri.EscapeUriString(date.ToString(dateFormat))); uri.Append("&itdTime=").Append(Uri.EscapeUriString(date.ToString(timeFormat))); uri.Append("&itdTripDateTimeDepArr=").Append(dep ? "dep" : "arr"); uri.Append("&ptOptionsActive=1"); uri.Append("&changeSpeed=").Append(AbstractEfaProvider.WALKSPEED_MAP[walkSpeed]); if (products != null) { uri.Append("&includedMeans=checkbox"); bool flag = false; foreach (char ch in products.ToCharArray()) { if ((int)ch == 73 || (int)ch == 82) { uri.Append("&inclMOT_0=on"); if ((int)ch == 73) flag = true; } if ((int)ch == 83) uri.Append("&inclMOT_1=on"); if ((int)ch == 85) uri.Append("&inclMOT_2=on"); if ((int)ch == 84) uri.Append("&inclMOT_3=on&inclMOT_4=on"); if ((int)ch == 66) uri.Append("&inclMOT_5=on&inclMOT_6=on&inclMOT_7=on"); if ((int)ch == 80) uri.Append("&inclMOT_10=on"); if ((int)ch == 70) uri.Append("&inclMOT_9=on"); if ((int)ch == 67) uri.Append("&inclMOT_8=on"); uri.Append("&inclMOT_11=on"); } if (!flag) uri.Append("&lineRestriction=403"); } uri.Append("&locationServerActive=1"); uri.Append("&useRealtime=1"); uri.Append("&useProxFootSearch=1"); return uri.ToString(); }
public void QueryConnections(Action<QueryConnectionsResult> callback, Location from, Location via, Location to, DateTime date, bool dep, string products, WalkSpeed walkSpeed, bool forceReload) { string uri = this.XsltTripRequest2Uri(from, via, to, date, dep, products, walkSpeed, forceReload); new FileDownloader().Download(uri, (Action<string>)(result => { if (string.IsNullOrEmpty(result)) { if (callback == null) return; callback((QueryConnectionsResult)null); } else AsyncHelper.SafeExecute((Action)(() => { try { QueryConnectionsResult queryConnectionsResult = this.QueryConnections(uri, result); if (callback == null) return; callback(queryConnectionsResult); } catch (Exception ex) { throw ex; } })); }), false); }
public abstract Task <TripRequest> QueryConnectionsAsync(Location from, Location via, Location to, DateTime date, bool dep, int numConnections, List <Product> products, WalkSpeed walkSpeed, Accessibility accessibility, HashSet <Option> options);