public void Bind( DemoLeaderboardDataItem data ) { var control = GetComponent<dfControl>(); if( !control.enabled ) return; control.Find<dfLabel>( "Rank" ).Text = data.Rank.ToString(); control.Find<dfLabel>( "Gamertag" ).Text = data.GamerTag; control.Find<dfLabel>( "Score" ).Text = string.Format( "{0:N0}", data.Score ); control.Find<dfLabel>( "Kills" ).Text = string.Format( "{0:N0}", data.Kills ); control.Find<dfLabel>( "Deaths" ).Text = string.Format( "{0:N0}", data.Deaths ); control.Find<dfLabel>( "KDR" ).Text = formatKDR( data.Kills, data.Deaths ); }
private void initializeRowEvents( DemoLeaderboardDataItem item, dfControl row, int itemIndex ) { row.MouseEnter += ( sender, args ) => { row.Focus(); }; row.EnterFocus += ( sender, args ) => { this.SelectedItem = item; if( SelectionChanged != null ) SelectionChanged( item ); if( SelectedItemProxy != null ) SelectedItemProxy.Data = item; }; row.KeyDown += ( sender, args ) => { if( args.Used ) return; if( args.KeyCode == KeyCode.DownArrow ) { selectNext( itemIndex ); args.Use(); } else if( args.KeyCode == KeyCode.UpArrow ) { selectPrevious( itemIndex ); args.Use(); } else if( args.KeyCode == KeyCode.Home ) { selectFirst(); args.Use(); } else if( args.KeyCode == KeyCode.End ) { selectLast(); args.Use(); } }; }