/// <summary> /// Parses the update.xml into ApplicationUpdateXml object /// </summary> /// <param name="location">Uri of update.xml on server</param> /// <param name="appID">The application's ID</param> /// <returns>The ApplicationUpdateXml object with the data, or null of any errors</returns> public static ApplicationUpdateXml Parse(Uri location) { Version version = null; string launchArgs = "", md5 = ""; List <UpdateApplication> applications = new List <UpdateApplication>(); ServicePointManager.ServerCertificateValidationCallback = (s, ce, ch, ssl) => true; XmlDocument doc = new XmlDocument(); try { // Load the document doc.Load(location.AbsoluteUri); // Gets the appId's node with the update info // This allows you to store all program's update nodes in one file XmlNode updateNode = doc.DocumentElement.SelectSingleNode("//update"); // If the node doesn't exist, there is no update if (updateNode == null) { return(null); } // Parse data version = Version.Parse(updateNode["version"].InnerText); md5 = updateNode["md5"].InnerText; foreach (XmlNode application in doc.DocumentElement.SelectNodes("//update//application")) { List <UpdateFile> files = new List <UpdateFile>(); string type = application["type"].InnerText; foreach (XmlNode file in application.SelectSingleNode("files").SelectNodes("file")) { files.Add(new UpdateFile() { Name = file["name"].InnerText, destination = file["destination"].InnerText, md5 = file["md5"].InnerText }); } applications.Add(new UpdateApplication() { Name = application.Attributes["appID"].InnerText, Type = type, Files = files }); } launchArgs = updateNode["launchArgs"].InnerText; return(new ApplicationUpdateXml(version, md5, applications, launchArgs)); } catch (Exception ex) { UpdateEvents.WriteEntry(ex.ToString()); return(null); } }
void OnClickSpinButton() { if (angVelocity == 0) { spinTimer = 0f; Events += StartSpinEvent; Events += RotateWheelEvent; maxVelocity = Random.Range(5f, 8.2f); } }
void EndSpinEvent() { angVelocity -= Time.deltaTime * 4; if (angVelocity < 0) { angVelocity = 0; cm.SetNumsToScoreBoard(prizeValuesTexts[GetCurrentWinSectorIndex()].text, lastWin, sumWin); cm.SpinResult(prizeValuesTexts[GetCurrentWinSectorIndex()].text); Events -= EndSpinEvent; Events -= RotateWheelEvent; } }
public BasicAction(UpdateEvents _updates) { updates = _updates; if (updates.HasFlag(UpdateEvents.BeforeRender) || updates.HasFlag(UpdateEvents.Once)) { Application.onBeforeRender += this.UpdateAction; } if (updates.HasFlag(UpdateEvents.FixedUpdate)) { EventCaller.AddFixedUpdate(this.UpdateAction); } //UpdateAction(); }
void StartSpinEvent() { if (angVelocity < maxVelocity) { angVelocity += Time.deltaTime * 4; } spinTimer += Time.deltaTime; if (spinTimer > spinTime) { Events += EndSpinEvent; Events -= StartSpinEvent; } }
internal void WriteToFile(string fileName) { using (StreamWriter writer = new StreamWriter(fileName, false)) { writer.WriteLine("frame,update,draw,instances"); for (int i = 0; i < Count; i++) { writer.WriteLine(string.Format("{0},{1},{2},{3}", i, UpdateEvents.ElementAtOrDefault(i), DrawEvents.ElementAtOrDefault(i), InstanceCounter.ElementAtOrDefault(i))); } writer.Flush(); } }
/// <summary> /// Checks the Uri to make sure file exist /// </summary> /// <param name="location">The Uri of the update.xml</param> /// <returns>If the file exists</returns> public static bool ExistsOnServer(Uri location) { try { // Request the update.xml HttpWebRequest req = (HttpWebRequest)WebRequest.Create(location.AbsoluteUri); // Read for response HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); resp.Close(); return(resp.StatusCode == HttpStatusCode.OK); } catch (Exception ex) { UpdateEvents.WriteEntry(ex.ToString()); return(false); } }
public void back(bool update = true) { mShow = false; Sequence seq = DOTween.Sequence(); seq.Insert(0, transform.DOLocalMoveX(-270, 0.1f).SetEase(Ease.Linear)); seq.InsertCallback(0.1f, () => { transform.localPosition = new Vector2(-1100, 0); }); seq.Play(); if (update && UpdateEvents != null) { UpdateEvents.Invoke(); } UpdateEvents = null; onBack(); }
public FollowAction(GameObject _target, GameObject _source, UpdateEvents whenToUpdate, Transform _offset = null, bool useScale = false) : base(whenToUpdate) { target = _target.transform; source = _source.transform; if (_offset) { offset = _offset.transform; /* ? new OrentationHandle(_offset, _target) : new OrentationHandle();*/ } else { offset = new GameObject("Auto Follow Offset").transform; offset.parent = target; offset.localPosition = Vector3.zero; offset.localRotation = Quaternion.identity; offset.localScale = Vector3.one; } scale = useScale; Enable(); }
public void Put(UpdateEvents request) { try { var keys = request.Events.Select(x => x.Id).ToArray(); if (eventRepository.ContainsKeys(keys)) { eventRepository.SaveAll(request.Events); var cacheKey = keyBuilder.Build(request, x => keys).ToString(); RequestContext.RemoveFromCache(Cache, cacheKey); } } catch (InvalidOperationException ex) { logger.Error(ex.ToString()); throw; } catch (ApplicationException ex) { logger.Error(ex.ToString()); throw; } catch (Exception ex) { logger.Error(ex.ToString()); throw; } }
public LookAtAction(InteractableRaw interactable, InteractorRaw interactor, Transform primearyOffset, bool preventZ, UpdateEvents updates) : base(interactor, updates) { target = interactable; lookAt = interactor.transform; pivot = primearyOffset; PreventLookAtZRotation = preventZ; SaveOrientation(false); }
public SecondaryAction(InteractorRaw interactor, UpdateEvents updates) : base(updates) => grabHand = interactor;