void Awake() { publicFunctions = new PublicFunctions(); }
public void ApplyUpdate(string expression, Func <DataStorage.WarewolfAtom, DataStorage.WarewolfAtom> clause, int update) { var temp = PublicFunctions.EvalUpdate(expression, _env, update, clause); _env = temp; }
public static bool IsValidRecordSetIndex(string exp) => PublicFunctions.IsValidRecsetExpression(exp);
public void EvalDelete(string exp, int update) { _env = PublicFunctions.EvalDelete(exp, update, _env); }
public void SortRecordSet(string sortField, bool descOrder, int update) { _env = PublicFunctions.SortRecset(sortField, descOrder, update, _env); }
public ExecutionEnvironment() { _env = PublicFunctions.CreateEnv(@""); Errors = new HashSet <string>(); AllErrors = new HashSet <string>(); }
public IList <int> EvalRecordSetIndexes(string recordsetName, int update) => PublicFunctions.GetIndexes(recordsetName, update, _env).ToList();
// Use this for initialization void Start() { Destroy(gameObject, 3); PublicFunctions.PhaseThruTag(gameObject, new string[] { "Player", "Friendly" }); }
protected override void CalcBar() { var m_newswingprice = m_swinghigh1[0]; if ((m_newswingprice != (-1))) { if ((PublicFunctions.DoubleLessEquals(m_tldir.Value, 0) && PublicFunctions.DoubleGreaterEquals(m_newswingprice, (m_swingprice.Value + retracepnts)))) { m_saveswing.Value = true; m_addtl.Value = true; m_tldir.Value = 1; } else { if (((m_tldir.Value == 1) && PublicFunctions.DoubleGreaterEquals(m_newswingprice, m_swingprice.Value))) { m_saveswing.Value = true; m_updatetl.Value = true; } } } else { m_newswingprice = m_swinglow1[0]; if ((m_newswingprice != (-1))) { if ((PublicFunctions.DoubleGreaterEquals(m_tldir.Value, 0) && PublicFunctions.DoubleLessEquals(m_newswingprice, (m_swingprice.Value - retracepnts)))) { m_saveswing.Value = true; m_addtl.Value = true; m_tldir.Value = (-1); } else { if (((m_tldir.Value == (-1)) && PublicFunctions.DoubleLessEquals(m_newswingprice, m_swingprice.Value))) { m_saveswing.Value = true; m_updatetl.Value = true; } } } } if (m_saveswing.Value) { m_swingprice.Value = m_newswingprice; m_swingtime.Value = Bars.Time[1]; m_saveswing.Value = false; } if (m_addtl.Value) { m_tlref.Value = DrwTrendLine.Create(new ChartPoint(m_swingtime.Value, m_swingprice.Value), new ChartPoint(m_swingtime[1], m_swingprice[1])); m_tlref.Value.ExtLeft = false; m_tlref.Value.ExtRight = false; m_tlref.Value.Size = ((int)(linewidth)); m_tlref.Value.Color = linecolor; m_addtl.Value = false; } else { if (m_updatetl.Value) { m_tlref.Value.End = new ChartPoint(m_swingtime.Value, m_swingprice.Value); m_updatetl.Value = false; } } }
void OnCollisionEnter2D(Collision2D contact) { PublicFunctions.DamageEnemy(contact, damage); Destroy(gameObject); }
// Update is called once per frame void Update() { transform.Translate(new Vector3(1, 0, 0) * speed * Time.deltaTime); PublicFunctions.PhaseThruTag(gameObject, new string[] { "Player", "Friendly" }); }
protected override void CalcBar() { var m_barnum = m_barnumber1[0]; if ((m_swinghighbar1[0] == swhistrength)) { for (var m_value1 = 9; m_value1 >= 0; m_value1 = (m_value1 - 1)) { m_swhitime[0][(((m_value1 + 1)))] = m_swhitime[0][((m_value1))]; m_swhival[0][(((m_value1 + 1)))] = m_swhival[0][((m_value1))]; } m_swhitime[0][0] = Bars.Time[swhistrength]; m_swhival[0][0] = Bars.High[swhistrength]; var m_value2 = 1; for (; m_value2 <= 10; m_value2 = (m_value2 + 1)) { if ((m_swhival[0][((m_value2))] > m_swhival[0][0])) { m_index.Value = m_value2; m_value2 = 11; } } if ((m_value2 == 12)) { if (m_dntlref[0] != null && m_dntlref[0].Exist) { if ((m_historytf && (m_dntlbreak.Value == false))) { m_dntlref.Value.End = new ChartPoint(Bars.Time[0], m_dntlref.Value.PriceValue(Bars.Time[0])); m_dntlref.Value.ExtRight = false; } else { if (!m_historytf) { m_dntlref.Value.Delete(); } } } m_dntlref.Value = DrwTrendLine.Create( new ChartPoint(m_swhitime[0][((m_index.Value))], m_swhival[0][((m_index.Value))]), new ChartPoint(m_swhitime[0][0], m_swhival[0][0])); if (m_dntlbreak.Value) { m_dntlbreak.Value = false; } m_dntlendbar.Value = (m_barnum - swhistrength); m_dntlref.Value.ExtLeft = false; m_dntlref.Value.ExtRight = true; m_dntlref.Value.Color = dntlcolor; if ((m_alerttypecaps == "ONCLOSE")) { m_dntlref.Value.Alert = EAlertType.BreakoutOnClose; } else { if ((m_alerttypecaps == "INTRABAR")) { m_dntlref.Value.Alert = EAlertType.BreakoutIntrabar; } else { m_dntlref.Value.Alert = EAlertType.Disabled; } } } } if ((m_swinglowbar1[0] == swlostrength)) { for (var m_value1 = 9; m_value1 >= 0; m_value1 = (m_value1 - 1)) { m_swlotime[0][(((m_value1 + 1)))] = m_swlotime[0][((m_value1))]; m_swloval[0][(((m_value1 + 1)))] = m_swloval[0][((m_value1))]; } m_swlotime[0][0] = Bars.Time[swlostrength]; m_swloval[0][0] = Bars.Low[swlostrength]; var m_value2 = 1; for (; m_value2 <= 10; m_value2 = (m_value2 + 1)) { if ((m_swloval[0][((m_value2))] < m_swloval[0][0])) { m_index.Value = m_value2; m_value2 = 11; } } if ((m_value2 == 12)) { if (m_uptlref.Value != null && m_uptlref.Value.Exist) { if (m_historytf && !m_uptlbreak.Value) { m_uptlref.Value.End = new ChartPoint(Bars.Time[0], m_uptlref.Value.PriceValue(Bars.Time[0])); m_uptlref.Value.ExtRight = false; } else { if (!m_historytf) { m_uptlref.Value.Delete(); } } } m_uptlref.Value = DrwTrendLine.Create( new ChartPoint(m_swlotime[0][((m_index.Value))], m_swloval[0][((m_index.Value))]), new ChartPoint(m_swlotime[0][0], m_swloval[0][0])); if (m_uptlbreak.Value) { m_uptlbreak.Value = false; } m_uptlendbar.Value = (m_barnum - swlostrength); m_uptlref.Value.ExtLeft = false; m_uptlref.Value.ExtRight = true; m_uptlref.Value.Color = uptlcolor; if ((m_alerttypecaps == "ONCLOSE")) { m_uptlref.Value.Alert = EAlertType.BreakoutOnClose; } else { m_uptlref.Value.Alert = (m_alerttypecaps == "INTRABAR") ? EAlertType.BreakoutIntrabar : EAlertType.Disabled; } } } if ((((m_dntlref.Value != null && m_dntlref.Value.Exist) && (m_dntlbreak.Value == false)) && m_barnum > (m_dntlendbar.Value + swhistrength) + barspast) && PublicFunctions.DoubleGreater(Bars.Close[barspast], m_dntlref.Value.PriceValue(Bars.Time[0]))) { m_dntlref.Value.End = new ChartPoint(Bars.Time[0], m_dntlref.Value.PriceValue(Bars.Time[0])); m_dntlref.Value.ExtRight = false; m_dntlbreak.Value = true; } if ((((m_uptlref.Value != null && m_uptlref.Value.Exist && (m_uptlbreak.Value == false)) && m_barnum > (m_uptlendbar.Value + swlostrength) + barspast) && PublicFunctions.DoubleLess(Bars.Close[barspast], m_uptlref.Value.PriceValue(Bars.Time[0])))) { m_uptlref.Value.End = new ChartPoint(Bars.Time[0], m_uptlref.Value.PriceValue(Bars.Time[0])); m_uptlref.Value.ExtRight = false; m_uptlbreak.Value = true; } }
public ActionResult UpdateSurgicalHistory(SurgicalHistoryViewModel model) { var userId = User.Claims.SingleOrDefault(x => x.Type == "UserId") != null?User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null; int UserId = 0; Int32.TryParse(userId, out UserId); //new ExceptionLog().WriteException(JsonConvert.SerializeObject(model).ToString()); APIJsonResult result = new APIJsonResult(); result.Access = true; if (UserId == 0 || model == null) { result.success = false; result.Msg.Add("NoUser"); return(Ok(result)); } try { if (model.Id < 1) { //add mode PastSurgicalHistory entity = new PastSurgicalHistory(); entity.Name = model.Name; entity.SurgicalDate = PublicFunctions.ConvertTimestampToDateTime(model.SurgicalDate); entity.UserId = UserId; entity.CreatedBy = UserId; entity.CreatedDate = DateTime.Now; _PastSurgicalHistory.Add(entity); _context.SaveChanges(); if (model.Images != null && model.Images.Count() > 0) { model.Images.ToList().ForEach(a => { var CoverImagetPath = _paths.SurgicalHistoryImages + UserId + @"\"; if (!Directory.Exists(CoverImagetPath)) { Directory.CreateDirectory(CoverImagetPath); } using (var fileStream = new FileStream(CoverImagetPath + a.FileName, FileMode.Create)) { a.CopyTo(fileStream); } PastSurgicalHistoryImage images = new PastSurgicalHistoryImage(); images.Image = a.FileName; images.SurgicalId = entity.Id; _PastSurgicalHistoryImage.Add(images); _context.SaveChanges(); }); } } else { PastSurgicalHistory entity = _PastSurgicalHistory.Where(a => a.Id == model.Id).FirstOrDefault(); entity.Name = model.Name; entity.SurgicalDate = PublicFunctions.ConvertTimestampToDateTime(model.SurgicalDate); entity.UpdateBy = UserId; entity.UserId = UserId; entity.UpdateDate = DateTime.Now; _PastSurgicalHistory.Update(entity); _context.SaveChanges(); //Delete the Images var oldImages = _PastSurgicalHistoryImage.Where(a => a.SurgicalId == model.Id).ToList(); if (oldImages != null && oldImages.Count() > 0) { oldImages.ForEach(a => { _PastSurgicalHistoryImage.Remove(a); _context.SaveChanges(); }); } //Add new Images if (model.Images != null && model.Images.Count() > 0) { model.Images.ToList().ForEach(a => { var CoverImagetPath = _paths.SurgicalHistoryImages + UserId + "/"; if (!Directory.Exists(CoverImagetPath)) { Directory.CreateDirectory(CoverImagetPath); } using (var fileStream = new FileStream(CoverImagetPath + a.FileName, FileMode.Create)) { a.CopyToAsync(fileStream); } PastSurgicalHistoryImage images = new PastSurgicalHistoryImage(); images.Image = a.FileName; images.SurgicalId = entity.Id; _PastSurgicalHistoryImage.Add(images); _context.SaveChanges(); }); } } } catch (Exception e) { result.data = e.Message; } return(Ok(result)); }
// Use this for initialization void Start() { PublicFunctions.PhaseThruTag(gameObject, new string[] { "Weapon", "Tower" }); rigidBody = GetComponent <Rigidbody2D> (); }
protected override void StartCalc() { SE_Condition = new Lambda <Boolean>( _bb => PublicFunctions.DoubleLess(Bars.Close[_bb], Bars.Open[_bb])); }
public override void LogicUpdate() { base.LogicUpdate(); //Get the AimDirection from InputHandler weaponAimInput = weapon.InputHandler.RawAimDirectionInput; shootInput = weapon.InputHandler.ShootInput; notJammed = weapon.InputHandler.NotJammed; #region WeaponAiming //If weaponAimInput is not zero //If we're not getting any input, this if statement won't run. if (weaponAimInput != Vector2.zero) { //Set the weaponAim and then normalize weaponAim = weaponAimInput; weaponAim.Normalize(); } //Returns the angle in degrees between the 2 vectors float angle = Vector2.SignedAngle(Vector2.right, weaponAim); //Subtract 90 degrees from the angle to get correct angle to face the mouse angle -= 90f; //Set the new rotation of the weapon, to point towards the mouse weapon.WeaponPivotPoint.rotation = Quaternion.Euler(0f, 0f, angle); //Call function to check weapon placement weapon.CheckWeaponPlacement(); #endregion //if(GameManagement.debug == true) //{ // GameManagement.debug = false; //} #region PlayerRotation //Wrap the angle angle = PublicFunctions.UnwrapAngle(angle); //For i is less than the number of BodyAngles for (int i = 0; i < player.numOfBodyAngles; i++) { //If the angle is within a 36 degree gap... if (angle >= (0 + (36 * i)) && angle < (36 * (i + 1))) { //Set the new current body angle to the numOfBodyAngles minus (i + 1) GameManagement.currentHeadBodyAngle = player.numOfBodyAngles - (i + 1); //If currentHeadBody angle is not the same as the previous if (GameManagement.currentHeadBodyAngle != GameManagement.previousHeadBodyAngle) { //Set the previousHeadBodyAngle to the new one GameManagement.previousHeadBodyAngle = GameManagement.currentHeadBodyAngle; //Then call the SetBodyAngle function, to update the sprite player.SetBodyAngleActive(); } } } #endregion #region WeaponShooting //If the player has pressed the shoot button... if (shootInput) { //If the weapon is not jammed, and the shot is on beat if (notJammed && weapon.BeatDetector.CheckIfOnBeat()) { //Change state to ShootState stateMachine.ChangeState(weapon.ShootState); } //If the weapon is not jammed, but the shot is not on beat else if (notJammed && !weapon.BeatDetector.CheckIfOnBeat()) { //Change state to JamState stateMachine.ChangeState(weapon.JamState); } //If the weapon is Jammed else if (!notJammed) { //Do Nothing return; } } #endregion }
protected override void StartCalc() { m_criteria = new Lambda <Boolean>( _bb => PublicFunctions.DoubleGreater(Bars.Close[_bb], Bars.High[(1 + _bb)])); }
/// <summary> /// 发布新帖时接受处理方法 /// </summary> /// <param name="FC">提交的Form表单</param> /// <returns>返回原页面(如果存在)或返回首页</returns> public ActionResult PulishNewContent(FormCollection FC) { //接受并验证Form表单提交过来的字段值 int ForumClassifyID, IntIsRecommend; bool IsRecommend; string Title, Content; if (int.TryParse(FC["ForumClassifyID"], out ForumClassifyID) && ForumClassifyID > 0 && (Title = FC["mainTitle"]) != null && (Content = FC["content"]) != null && Title != "" && Content != "") { int.TryParse(FC["IsRecommend"], out IntIsRecommend); IsRecommend = Convert.ToBoolean(IntIsRecommend); //Base64解码发布的内容 Content = Encoding.UTF8.GetString(Convert.FromBase64String(Content)); //查找出该贴所属的大专区板块 int ForumAreaID = 0; using (DB_BBSEntities db = new DB_BBSEntities()) { ForumAreaID = db.tb_ForumClassify.Where(W => W.ID == ForumClassifyID).Select(S => S.ForumAreaID).First(); } if (ForumAreaID > 0) { //取出当前用户ID int CurrentUserID = new LoginStatus().LoginStatusEntity.ID; tb_ForumMain ForumMain = new tb_ForumMain(); ForumMain.Title = Title; ForumMain.ForumAreaID = ForumAreaID; ForumMain.ForumClassifyID = ForumClassifyID; ForumMain.CreateUserID = CurrentUserID; ForumMain.CreateTime = DateTime.Now; ForumMain.Content = Content; ForumMain.IsRecommend = IsRecommend; ForumMain.IsExamine = 0; ForumMain.Isdelete = false; ForumMain.Zan = 0; //创建一条与该贴对应的帖子状态表数据 ForumMain.tb_ForumInfoStatus = new List <tb_ForumInfoStatus> { new tb_ForumInfoStatus { ForumMainID = ForumMain.ID, ReplyNumber = 0, SeeNumber = 0, LastReplyUserID = CurrentUserID, LastReplytime = DateTime.Now } }; //保存数据到数据库 using (DB_BBSEntities db = new DB_BBSEntities()) { db.tb_ForumMain.Add(ForumMain); if (db.SaveChanges() > 0) { //如果保存成功返回原页面 return(Redirect(Request.UrlReferrer.AbsolutePath)); } } } } //在保存失败或者参数验证未通过时,返回原页面(如果存在)或返回首页,并发送失败消息 return(PublicFunctions.ToRedirect(this, "PulishNewContentError", "未能成功发表帖子,请检查输入信息!", (Url) => { return Redirect(Url); }, (Url) => { return RedirectToAction("Index", "Home"); })); }
public void AssignWithFrameAndList(string assignValue, IEnumerable <DataStorage.WarewolfAtom> item, bool shouldUseLast, int update) { _env = PublicFunctions.EvalAssignFromList(assignValue, item, _env, update, shouldUseLast); }
protected override void CalcBar() { m_adx.Set(PublicFunctions.Average(Bars.Close, Length), m_plot_color); }
public void EvalAssignFromNestedStar(string exp, CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult recsetResult, int update) { _env = PublicFunctions.EvalAssignFromList(exp, recsetResult.Item, _env, update, false); }
void update() { PublicFunctions.PhaseThruTag(gameObject, new string[] { "Player", "Friendly" }); }
public void CommitAssign() { _env = PublicFunctions.RemoveFraming(_env); }
// Use this for initialization void Start() { PublicFunctions.PhaseThruTag(gameObject, new string[] { "PlayerCharacter" }); }
public IEnumerable <int> EvalWhere(string expression, Func <DataStorage.WarewolfAtom, bool> clause, int update) => PublicFunctions.EvalWhere(expression, _env, update, clause);
public FileResult Download(string filePath) { return(File(filePath, PublicFunctions.GetFileExtension(Path.GetExtension(filePath)))); }
public void AssignDataShape(string p) { var env = PublicFunctions.EvalDataShape(p, _env); _env = env; }
public virtual bool IsPublicFunction(APIFunction function) { return(PublicFunctions.Contains(function)); }
protected override void CalcBar() { EResolution resolution = Bars.Info.Resolution.Type; if (resolution < EResolution.Day || EResolution.Volume == resolution || EResolution.Second == resolution || resolution > EResolution.Quarter) { if (((Bars.TimeValue.Date != Bars.Time[1].Date) && (Bars.Status == EBarState.Close))) { if (m_haveprevlines.Value) { m_tlopen.Value.End = new ChartPoint(Bars.Time[1], m_dayopen.Value); m_tlhigh.Value.End = new ChartPoint(Bars.Time[1], m_dayhigh.Value); m_tllow.Value.End = new ChartPoint(Bars.Time[1], m_daylow.Value); m_tlopen.Value.ExtRight = false; m_tlhigh.Value.ExtRight = false; m_tllow.Value.ExtRight = false; } m_dayopen.Value = Bars.Open[0]; m_dayhigh.Value = Bars.High[0]; m_daylow.Value = Bars.Low[0]; m_currbartime.Value = Bars.Time[0]; m_lastdiffbartime.Value = Bars.Time[1]; m_tlopen.Value = DrwTrendLine.Create(new ChartPoint(Bars.Time[1], m_dayopen.Value), new ChartPoint(Bars.Time[0], m_dayopen.Value)); m_tlhigh.Value = DrwTrendLine.Create(new ChartPoint(Bars.Time[1], m_dayhigh.Value), new ChartPoint(Bars.Time[0], m_dayhigh.Value)); m_tllow.Value = DrwTrendLine.Create(new ChartPoint(Bars.Time[1], m_daylow.Value), new ChartPoint(Bars.Time[0], m_daylow.Value)); m_tlopen.Value.Color = opencolor; m_tlhigh.Value.Color = highcolor; m_tllow.Value.Color = lowcolor; m_tlopen.Value.ExtLeft = false; m_tlhigh.Value.ExtLeft = false; m_tllow.Value.ExtLeft = false; m_tlopen.Value.ExtRight = true; m_tlhigh.Value.ExtRight = true; m_tllow.Value.ExtRight = true; if ((m_haveprevlines.Value == false)) { m_haveprevlines.Value = true; } } else { if (m_haveprevlines.Value) { if ((Bars.Time[0] != m_currbartime.Value)) { m_lastdiffbartime.Value = m_currbartime.Value; m_currbartime.Value = Bars.Time[0]; } if (PublicFunctions.DoubleGreater(Bars.High[0], m_dayhigh.Value)) { m_dayhigh.Value = Bars.High[0]; m_tlhigh.Value.End = new ChartPoint(Bars.Time[0], m_dayhigh.Value); m_tlhigh.Value.Begin = new ChartPoint(m_lastdiffbartime.Value, m_dayhigh.Value); } if (PublicFunctions.DoubleLess(Bars.Low[0], m_daylow.Value)) { m_daylow.Value = Bars.Low[0]; m_tllow.Value.End = new ChartPoint(Bars.Time[0], m_daylow.Value); m_tllow.Value.Begin = new ChartPoint(m_lastdiffbartime.Value, m_daylow.Value); } } } } else { PublicFunctions.RaiseRunTimeError("Day Open-Hi-Lo Lines requires intraday bars."); } }
// Use this for initialization void Start() { Destroy(gameObject, stay); PublicFunctions.PhaseThruTag(gameObject, new string[] { "Enemy", "Friendly", "Danger" }); }