public Player_Status(Hand_State init_state) { enhanceCost = 2; morale = 0; hand[0] = new select_type(0, Force_Base, (Sprite)Resources.Load("Material/fire", typeof(Sprite)), init_state); hand[1] = new select_type(1, Force_Base, (Sprite)Resources.Load("Material/freeze", typeof(Sprite)), init_state); hand[2] = new select_type(2, Force_Base, (Sprite)Resources.Load("Material/rock", typeof(Sprite)), init_state); hand[3] = new select_type(3, Force_Base, (Sprite)Resources.Load("Material/thunder", typeof(Sprite)), init_state); hand[4] = new select_type(4, Force_Base, (Sprite)Resources.Load("Material/water", typeof(Sprite)), init_state); wait_sel.Add(hand[0]); wait_sel.Add(hand[1]); wait_sel.Add(hand[2]); }
public void go_to_closest_line(int line_idx, select_type notify) { if (filter_.match_count < 1) return; var closest = model_.binary_search_closest(line_idx); if (closest.Item2 >= 0) go_to_row(closest.Item2, notify); }
public void go_to_row(int row_idx, select_type notify) { if (row_idx < 0) return; if (row_idx >= item_count) return; select_row_idx(row_idx, notify); if (is_row_visible(row_idx)) // already visible return; // 1.3.30+ use RowHeightEffective (don't manually set RowHeight) int rows = list.Height / list.RowHeightEffective; int bottom_idx = row_idx + rows / 2; if (bottom_idx >= item_count) bottom_idx = item_count - 1; int top_idx = bottom_idx - rows; if (top_idx < 0) top_idx = 0; // we want to show the line in the *middle* of the control (height-wise) if (top_idx < list.GetItemCount()) ensure_row_visible(top_idx); if (bottom_idx < list.GetItemCount()) ensure_row_visible(bottom_idx); }
private void select_row_idx(int row_idx, select_type notify) { if (sel_row_idx == row_idx) return; // already selected // 1.0.67+ - there's a bug in objectlistview - if we're not the current view, we can't really select a row if (!is_current_view && !is_full_log && list.SelectedIndex == -1) return; select_nofify_ = notify; if (row_idx >= 0 && row_idx < item_count) { logger.Debug("[view] " + name + " sel=" + row_idx); list.SelectedIndex = row_idx; update_x_of_y(); } select_nofify_ = select_type.notify_parent; }
public void go_to_line(int line_idx, select_type notify) { if (line_idx >= list.GetItemCount()) return; select_idx( line_idx, notify); //list.EnsureVisible(line_idx); int rows = list.Height / list.RowHeight; int bottom_idx = line_idx + rows / 2; if (bottom_idx >= list.GetItemCount()) bottom_idx = list.GetItemCount() - 1; int top_idx = bottom_idx - rows; if (top_idx < 0) top_idx = 0; // we want to show the line in the *middle* of the control (height-wise) list.EnsureVisible(top_idx); list.EnsureVisible(bottom_idx); }
public void go_to_closest_line(int line_idx, select_type notify) { if (list.GetItemCount() < 1) return; // note: yeah - i could do binary search, but it's not that big of a time increase int last_line_idx = (list.GetItem(0).RowObject as item).match.line_idx; int found_idx = 0; for (int idx = 1; idx < list.GetItemCount(); ++idx) { var cur_line_idx = (list.GetItem(idx).RowObject as item).match.line_idx; int last_dist = Math.Abs(line_idx - last_line_idx); int cur_dist = Math.Abs(cur_line_idx - line_idx); if (cur_dist < last_dist) { last_line_idx = cur_line_idx; found_idx = idx; } else // we found it break; } go_to_line(found_idx, notify); }
private void select_idx(int idx, select_type notify) { select_nofify_ = notify; if (idx >= 0 && idx < list.GetItemCount()) { logger.Debug("[view] " + name + " sel=" + idx); list.SelectedIndex = idx; update_line_highlight_color(idx); update_x_of_y(); } select_nofify_ = select_type.notify_parent; }