public ReportTemplate() { InitializeComponent(); CurrentVM = new HitViewModel(); this.DataContext = CurrentVM; }
protected void Page_Load(object sender, EventArgs e) { HitViewModel hitViewModel = ApplicationIndex.GetHitById(Context.Request.QueryString["id"]); string path = hitViewModel.Path; int revision = hitViewModel.Revision; // getting _properties from the index Title = path.Substring(path.LastIndexOf('/') + 1); _header.InnerText = path; _author.InnerText = hitViewModel.Author; _modified.InnerText = hitViewModel.LastModification; if (hitViewModel.MaxSize > 0) { _size.InnerText = hitViewModel.Size; } else { _sizeRow.Visible = false; } _revisions.InnerText = hitViewModel.RevFirst + " - " + hitViewModel.RevLast; // getting _properties from subversion _message.InnerText = Svn.GetLogMessage(revision); if (path[0] == '$') { return; // Revision Log } bool binary = InitProperties(Svn.GetPathProperties(path, revision)); if (hitViewModel.MaxSize > 512 * 1024) { _contentWarning.InnerText = "Content size is too big to display"; } else if (binary) { _contentWarning.InnerText = "Content type is binary"; } else if (hitViewModel.MaxSize > 0) { _content.InnerText = Svn.GetPathContent(path, revision, hitViewModel.MaxSize); var syntaxHighlighter = new SyntaxHighlightBrushMapper(path); if (syntaxHighlighter.IsAvailable) { AddScriptInclude(syntaxHighlighter.GetScript()); AddStartupScript(); _content.Attributes.Add("class", syntaxHighlighter.GetClass()); } } }
//public AutoCompleteBox /// <summary> /// Constructor, creates the ViewMoedl and set it as its DataContext /// </summary> public New_Hit() { hitViewModel = new HitViewModel(); this.DataContext = hitViewModel; InitializeComponent(); }
public static List <HitViewModel> ProcessMoveHits(Move move) { List <float> frameList = new List <float>(); Script script = move.Script; ObservableCollection <SpeedCommand> speedList = (ObservableCollection <SpeedCommand>)script.CommandLists[(int)CommandListType.SPEED]; if (!speedList.Any() || speedList.First().StartFrame != 0) { speedList.Insert(0, new SpeedCommand { StartFrame = 0, EndFrame = 1, Multiplier = 1 }); } frameList.Add(0); for (int i = 0; i <= script.TotalFrames; i++) { frameList.Add( frameList.LastOrDefault() + Math.Max(0, 1 / speedList.Last(speed => i >= speed.StartFrame).Multiplier)); } List <int> postSpeedFrameList = frameList.ConvertAll <int>(f => (int)Math.Ceiling(f)); List <HitViewModel> hits = new List <HitViewModel>(); ObservableCollection <HitboxCommand> hitBoxList = (ObservableCollection <HitboxCommand>)script.CommandLists[(int)CommandListType.HITBOX]; foreach (HitboxCommand hitBox in hitBoxList) { // Exclude proximity boxes if (hitBox.Type != HitboxCommand.HitboxType.PROXIMITY) { HitBoxData hitBoxDataStanding = hitBox.HitboxDataSet.Data[0]; HitViewModel.BlockTypeEnum tmpBlock; switch (hitBox.HitLevel) { case HitboxCommand.HitLevelType.UNBLOCKABLE: tmpBlock = HitViewModel.BlockTypeEnum.Unblockable; break; case HitboxCommand.HitLevelType.OVERHEAD: tmpBlock = HitViewModel.BlockTypeEnum.Overhead; break; case HitboxCommand.HitLevelType.MID: tmpBlock = HitViewModel.BlockTypeEnum.Mid; break; case HitboxCommand.HitLevelType.LOW: tmpBlock = HitViewModel.BlockTypeEnum.Low; break; default: tmpBlock = HitViewModel.BlockTypeEnum.Mid; break; } int startup = postSpeedFrameList[script.FirstHitboxFrame]; int active = postSpeedFrameList[script.LastHitboxFrame] - postSpeedFrameList[script.FirstHitboxFrame]; int recovery; if (script.IASAFrame != 0 && script.IASAFrame < script.TotalFrames) { recovery = postSpeedFrameList[script.IASAFrame]; } else { recovery = postSpeedFrameList[script.TotalFrames]; } recovery -= postSpeedFrameList[script.LastHitboxFrame] - 1; int onBlock = hitBox.HitboxDataSet.Data[4].TgtHitstop - recovery; int onHit = hitBox.HitboxDataSet.Data[0].OnHit.IASAFrame - active + 1 - recovery; HitViewModel hit = new HitViewModel( tmpBlock, hitBoxDataStanding.Damage, 0, hitBoxDataStanding.Stun, 0, hitBoxDataStanding.SelfMeter, new HitViewModel.CancelAbilityEnum[] { }, startup, active, recovery, onBlock, onHit, string.Empty); hits.Add(hit); } } return(hits); }