//private static Button ReturnToGame; //private static Button QuitAndReturnToTitle; protected override IEnumerator Start() { if (Inst != null) { Destroy(gameObject); yield break; } Inst = this; groupButton = GameObject.Find("PausingCanvas/target_pause/Pausing/Buttons").GetComponent <GroupButton>(); //ReturnToGame = GameObject.Find("PausingCanvas/target_pause/Pausing/Buttons/ReturnToGame_Button").GetComponent<Button>(); //QuitAndReturnToTitle = GameObject.Find("PausingCanvas/target_pause/Pausing/Buttons/QuitAndReturnToTitle_Button").GetComponent<Button>(); GroupButton gb = new GroupButton(); foreach (Transform x in transform.GetChild(0).GetComponentInChildren <Transform>()) { if (x.name == "Buttons") { gb = x.GetComponent <GroupButton>(); break; } } yield return(new WaitUntil(() => gb.MyProc.started)); transform.GetChild(0).gameObject.SetActive(false); MyProc.started = true; yield return(null); }
public void Spawn(int filter) { //instantiates all the icons that represent an inventory slot bool foundHand = false; //if any item in inventory is being held foreach (IndividualItem i in inventory.Items) { GameObject prefabIcon = itemFunctionality.GetIconItemPrefab((ItemFunctionality.ItemIds)i.Id); if ((int)prefabIcon.GetComponent <ItemScript>().type == filter || (int)ItemFunctionality.ItemType.all == filter) //filters for items of specified type { GameObject newIcon = Instantiate(prefabIcon, gameObject.transform); newIcon.GetComponent <ItemScript>().SetIndividualItem(i); //set icons individual item reference, individual items do not have references to icons GroupButton button = newIcon.GetComponent <GroupButton>(); //make the icon apart of the button group buttonGroup.buttons.Add(button); button.buttonGroup = buttonGroup; button.onSelected.AddListener(itemDescription.UpdateDescription); //find hand and set it to the selected button in button group if (i == inventory.Hand) { buttonGroup.OnSelected(button); foundHand = true; } } } //if nothing is held, nothing will be selected when icons instantiate if (!foundHand) { buttonGroup.selectedButton = null; itemDescription.UpdateDescription(); } }
public void OnSelected(GroupButton button) { if (selectedButton != null) //calls previously selected buttons deselect method { selectedButton.Deselect(); } selectedButton = button; selectedButton.Select(); //calls selected buttons select method ResetButtons(); button.background.color = active; int selectedIndex = button.transform.GetSiblingIndex(); for (int i = 0; i < objectsToSwap.Count; i++) //show or hide if its button is selected or deselected { if (i == selectedIndex) { objectsToSwap[i].SetActive(true); } else { objectsToSwap[i].SetActive(false); } } }
public void OnEnter(GroupButton button) { ResetButtons(); if (selectedButton == null || button != selectedButton) //set button to hover state if not selected { button.background.color = hover; } }
public GroupForm(ref Tuple <GroupDetails, TaskCollection> groupTuppleObject, ref GroupButton groupButtonObject) { InitializeComponent(); GroupExisting = true; GroupSaved = false; GroupTuppleObject = groupTuppleObject; GroupButtonObject = groupButtonObject; LoadGroupData(); }
public void OnActivate() { if (startSelected) { if (selectedButton == null) //if a button is not already selected set it to the firt in the button list { selectedButton = buttons[0]; } OnSelected(selectedButton); ResetButtons(); } }
void ReleaseDesignerOutlets() { if (TotalFacesLabel != null) { TotalFacesLabel.Dispose(); TotalFacesLabel = null; } if (GroupButton != null) { GroupButton.Dispose(); GroupButton = null; } }
public GroupForm() { InitializeComponent(); GroupExisting = false; GroupSaved = false; TaskCollectionObject = new TaskCollection(); GroupButtonObject = null; this.Text = "Create Group"; CreateSaveGroupButton.Text = "Create Group"; CancelCloseButton.Text = "Cancel"; PathChangeEnabled(false); GroupID = Options.LastGroupID + 1; GroupIDLabel.Text = "ID : " + GroupID.ToString(); EnabledComboBox.SelectedIndex = 0; OccurrenceComboBox.SelectedIndex = 0; DayComboBox.SelectedIndex = 0; IntervalComboBox.SelectedIndex = 0; DeleteGroup.Visible = false; }
void GroupButton_Click(object sender, RoutedEventArgs e) { GroupButton presenter = sender as GroupButton; if ((presenter != null) && !_excel.IsEditing) { var sheet = _excel.ActiveSheet; int index = presenter.Index; if ((sheet != null) && (index >= 0)) { _rowOrColStartIndex = -1; _rowOrColCount = -1; InvalidateMeasure(); if (Orientation == Windows.UI.Xaml.Controls.Orientation.Horizontal) { bool collapsed = sheet.RowRangeGroup.Data.GetCollapsed(index); RowGroupExpandExtent rowExpandExtent = new RowGroupExpandExtent(index, presenter.Level, ViewportIndex, !collapsed); RowGroupExpandUndoAction command = new RowGroupExpandUndoAction(sheet, rowExpandExtent); int num2 = (_excel.ActiveSheet.RowRangeGroup.Direction == RangeGroupDirection.Forward) ? (index - 1) : (index + 1); _excel.ActiveSheet.RowRangeGroup.Find(num2, presenter.Level); if (!_excel.RaiseRangeGroupStateChanging(true, num2, presenter.Level)) { _excel.DoCommand(command); _excel.RaiseRangeGroupStateChanged(true, num2, presenter.Level); } } else if (Orientation == Windows.UI.Xaml.Controls.Orientation.Vertical) { bool flag3 = sheet.ColumnRangeGroup.Data.GetCollapsed(index); ColumnGroupExpandExtent columnExpandExtent = new ColumnGroupExpandExtent(index, presenter.Level, ViewportIndex, !flag3); ColumnGroupExpandUndoAction action2 = new ColumnGroupExpandUndoAction(sheet, columnExpandExtent); int num3 = (_excel.ActiveSheet.RowRangeGroup.Direction == RangeGroupDirection.Forward) ? (index - 1) : (index + 1); if (!_excel.RaiseRangeGroupStateChanging(false, num3, presenter.Level)) { _excel.DoCommand(action2); _excel.RaiseRangeGroupStateChanged(false, num3, presenter.Level); } } } } }
public void PopulateGroups(object groupTupleObject) { try { if (GroupsFlowPanel.InvokeRequired) { GroupsFlowPanel.Invoke((MethodInvoker) delegate { PopulateGroups(groupTupleObject); }); } else { Tuple <GroupDetails, TaskCollection> GroupTupleObject = (Tuple <GroupDetails, TaskCollection>)groupTupleObject; GroupDetails GroupDetailsObject = GroupTupleObject.Item1; GroupButton GroupButtonObject = new GroupButton(ref GroupDetailsObject); GroupButtonObject.Width = GroupsFlowPanel.Width - 30; GroupButtonObject.Height = 70; GroupButtonObject.Padding = new Padding(5, 5, 5, 5); GroupButtonObject.MouseClick += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { try { if (e.Button == MouseButtons.Left) { GroupForm GroupFormObject = new GroupForm(ref GroupTupleObject, ref GroupButtonObject); GroupFormObject.ShowDialog(); } else if (e.Button == MouseButtons.Right && GroupTupleObject.Item1.Enabled && GroupTupleObject.Item2.TaskList.Count > 0) { GroupRunner GroupRunnerFormObject = new GroupRunner(ref GroupTupleObject); GroupRunnerFormObject.ShowDialog(); } } catch { } }); GroupsFlowPanel.Controls.Add(GroupButtonObject); if (++GroupsLoadedCount == NumberOfGroups) { GroupButtonList = GroupsFlowPanel.Controls.OfType <GroupButton>().Cast <GroupButton>().ToList(); SortByChangeEnabled(true); SortByComboBox.SelectedIndex = 0; } } } catch { GroupsFlowPanel.Invoke((MethodInvoker) delegate { PopulateGroups(groupTupleObject); }); } }
public void RemoveGroup(GroupButton groupButton) { int groupIndex = wave.Groups.IndexOf(groupButton.Group); //dont let user delete the last group if (groupIndex == 0 && wave.Groups.Count == 1) { return; } #region substitute the currently selected group in the groupPanel(which will be deleted) by another GroupSelectionButton nextSelectedButton; //check if group with next index exists if (groupIndex + 1 < groupButtons.Count && (nextSelectedButton = groupButtons[groupIndex + 1]) != null) { //just wait } else //there must be a group with previous index { nextSelectedButton = groupButtons[groupIndex - 1]; } groupPanel.OnSelectedGroupChange(nextSelectedButton); #endregion GroupSelectionButton btn = groupButtons[groupIndex]; groupButtons.Remove(btn); Destroy(btn.gameObject); PauseInputField pauseBtn = pauseInputFields[groupIndex]; pauseInputFields.Remove(pauseBtn); Destroy(pauseBtn.gameObject); wave.Groups.RemoveAt(groupIndex); }
public void AddGroup(Tuple <GroupDetails, TaskCollection> groupTuppleObject) { GroupDetails GroupDetailsObject = groupTuppleObject.Item1; GroupButton GroupButtonObject = new GroupButton(ref GroupDetailsObject); GroupButtonObject.Width = GroupsFlowPanel.Width - 30; GroupButtonObject.Height = 70; GroupButtonObject.Padding = new Padding(5, 5, 5, 5); GroupButtonObject.MouseClick += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { GroupForm GroupFormObject = new GroupForm(ref groupTuppleObject, ref GroupButtonObject); GroupFormObject.ShowDialog(); } else if (e.Button == MouseButtons.Right && groupTuppleObject.Item1.Enabled && groupTuppleObject.Item2.TaskList.Count > 0) { GroupRunner GroupRunnerFormObject = new GroupRunner(ref groupTuppleObject); GroupRunnerFormObject.ShowDialog(); } }); GroupsFlowPanel.Controls.Add(GroupButtonObject); GroupButtonList.Add(GroupButtonObject); }
public void OnExit(GroupButton button) { ResetButtons(); }
void ArrangeRowGroups(double buttonSize) { double num4; double y; double num3 = Math.Max((double)0.0, (double)((buttonSize - 6.0) / 2.0)) + 2.0; _excel.GetSheetLayout(); RowLayoutModel rowLayoutModel = _excel.GetRowLayoutModel(ViewportIndex, SheetArea.Cells); foreach (GroupDotInfo info in _groupDotInfos) { RowLayout layout = rowLayoutModel.Find(info.Index); if ((layout != null) && (layout.Height >= 2.0)) { num4 = (base.Location.X + (info.Level * buttonSize)) + num3; y = layout.Y + Math.Max((double)0.0, (double)((layout.Height - 2.0) / 2.0)); info.Dot.Arrange(new Rect(base.PointToClient(new Point(num4, y)), _dotSize)); } } RangeGroupDirection direction = _excel.ActiveSheet.RowRangeGroup.Direction; foreach (GroupLineInfo info2 in _groupLineInfos) { RowLayout layout2 = rowLayoutModel.FindRow(info2.Start); RowLayout layout3 = rowLayoutModel.FindRow(info2.End); if ((layout2 != null) && (layout3 != null)) { Rectangle line = info2.Line; num4 = (base.Location.X + (info2.Level * buttonSize)) + num3; y = layout2.Y; switch (direction) { case RangeGroupDirection.Forward: y++; break; case RangeGroupDirection.Backward: y--; break; } double num8 = 2.0; double num9 = Math.Max((double)0.0, (double)(((layout3.Y + layout3.Height) - layout2.Y) - 1.0)); line.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num8, num9))); Rectangle startLine = info2.StartLine; if (startLine != null) { double num10 = Math.Min((double)6.0, (double)(buttonSize - 2.0)); if (num10 > 0.0) { if (direction == RangeGroupDirection.Backward) { y = (y + num9) - 2.0; } if ((y >= layout2.Y) && (y < (layout3.Y + layout3.Height))) { startLine.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num10, 2.0))); } } } } } foreach (GroupButtonInfo info3 in _groupButtonInfos) { RowLayout layout4 = rowLayoutModel.FindRow(info3.Button.Index); if (layout4 != null) { GroupButton button = info3.Button; double num11 = Math.Max((double)0.0, (double)((layout4.Height - buttonSize) / 2.0)); num4 = (base.Location.X + (button.Level * buttonSize)) + 2.0; y = layout4.Y + num11; double num12 = buttonSize; double num13 = Math.Min(buttonSize, layout4.Height); button.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num12, num13))); Rectangle rectangle3 = info3.Line; if ((rectangle3 != null) && (num13 < layout4.Height)) { num4 = (base.Location.X + (button.Level * buttonSize)) + num3; y = layout4.Y; double num14 = 2.0; double num15 = num11; if (info3.LineDirection == RangeGroupDirection.Backward) { y += num11 + num13; num15 = (layout4.Height - num13) - num11; } rectangle3.Arrange(new Rect(base.PointToClient(new Point(num4, y)), new Size(num14, num15))); } } } }
void ArrangeColumnGroups(double buttonSize) { double x; double num5; double num3 = Math.Max((double)0.0, (double)((buttonSize - 6.0) / 2.0)) + 2.0; ColumnLayoutModel columnLayoutModel = _excel.GetColumnLayoutModel(ViewportIndex, SheetArea.Cells); foreach (GroupDotInfo info in _groupDotInfos) { ColumnLayout layout = columnLayoutModel.FindColumn(info.Index); if ((layout != null) && (layout.Width >= 2.0)) { x = layout.X + Math.Max((double)0.0, (double)((layout.Width - 2.0) / 2.0)); num5 = (Location.Y + (info.Level * buttonSize)) + num3; info.Dot.Arrange(new Rect(PointToClient(new Point(x, num5)), _dotSize)); } } RangeGroupDirection direction = _excel.ActiveSheet.ColumnRangeGroup.Direction; foreach (GroupLineInfo info2 in _groupLineInfos) { ColumnLayout layout2 = columnLayoutModel.FindColumn(info2.Start); ColumnLayout layout3 = columnLayoutModel.FindColumn(info2.End); if ((layout2 != null) && (layout3 != null)) { Rectangle line = info2.Line; x = layout2.X; switch (direction) { case RangeGroupDirection.Forward: x++; break; case RangeGroupDirection.Backward: x--; break; } num5 = (base.Location.Y + (info2.Level * buttonSize)) + num3; double num8 = Math.Max((double)0.0, (double)(((layout3.X + layout3.Width) - layout2.X) - 1.0)); double num9 = 2.0; line.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(num8, num9))); Rectangle startLine = info2.StartLine; if (startLine != null) { double num10 = Math.Min((double)6.0, (double)(buttonSize - 2.0)); if (num10 > 0.0) { if (direction == RangeGroupDirection.Backward) { x = (x + num8) - 2.0; } if ((x >= layout2.X) && (x < (layout3.X + layout3.Width))) { startLine.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(2.0, num10))); } } } } } foreach (GroupButtonInfo info3 in _groupButtonInfos) { GroupButton button = info3.Button; ColumnLayout layout4 = columnLayoutModel.FindColumn(button.Index); if (layout4 != null) { double num11 = Math.Max((double)0.0, (double)((layout4.Width - buttonSize) / 2.0)); x = layout4.X + num11; num5 = (base.Location.Y + (button.Level * buttonSize)) + 2.0; double num12 = Math.Min(buttonSize, layout4.Width); double num13 = buttonSize; button.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(num12, num13))); Rectangle rectangle3 = info3.Line; if ((rectangle3 != null) && (num12 < layout4.Width)) { x = layout4.X; num5 = (base.Location.Y + (button.Level * buttonSize)) + num3; double num14 = num11; double num15 = 2.0; if (info3.LineDirection == RangeGroupDirection.Backward) { x += num11 + num12; num14 = (layout4.Width - num12) - num11; } rectangle3.Arrange(new Rect(base.PointToClient(new Point(x, num5)), new Size(num14, num15))); } } } }
public void SetGroupButton(GroupButton button) { m_button = button; }
public GroupButtonInfo(GroupButton button) { Button = button; }
//delegating method for buttons public void OnSelectedGroupChange(GroupButton selectedButton) { OnSelectedGroupChange(selectedButton.Group, selectedButton.GroupIndex); }
void MeasureGroups(Size availableSize, RangeGroupInfo group, double buttonSize) { RangeGroupDirection groupDirection = GetGroupDirection(); int viewportStartIndex = GetViewportStartIndex(); int viewportEndIndex = GetViewportEndIndex(); int start = group.Start; int end = group.End; if (group.State == GroupState.Collapsed) { // 折叠状态 GroupButton button = new GroupButton(); button.Click += GroupButton_Click; button.IsExpanded = false; button.Level = group.Level; GroupButtonInfo info6 = new GroupButtonInfo(button); switch (groupDirection) { case RangeGroupDirection.Forward: { int num13 = end + 1; if ((num13 >= viewportStartIndex) && (num13 <= viewportEndIndex)) { Children.Add(button); button.Measure(new Size(buttonSize, buttonSize)); button.Index = num13; info6.LineDirection = RangeGroupDirection.Forward; _groupButtonInfos.Add(info6); return; } break; } case RangeGroupDirection.Backward: { int num14 = start - 1; if ((num14 >= viewportStartIndex) && (num14 <= viewportEndIndex)) { Children.Add(button); button.Measure(new Size(buttonSize, buttonSize)); button.Index = num14; info6.LineDirection = RangeGroupDirection.Backward; _groupButtonInfos.Add(info6); } break; } } } else { // 展开状态 bool flag = true; RangeGroupInfo parent = group.Parent; if ((parent != null) && (((groupDirection == RangeGroupDirection.Backward) && (group.Start == parent.Start)) || ((groupDirection == RangeGroupDirection.Forward) && (group.End == parent.End)))) { flag = false; } if (flag) { GroupButton presenter = new GroupButton(); presenter.Click += GroupButton_Click; presenter.IsExpanded = true; presenter.Level = group.Level; GroupButtonInfo info2 = new GroupButtonInfo(presenter); Rectangle rectangle = new Rectangle(); rectangle.Fill = PaintedBrush; info2.Line = rectangle; switch (groupDirection) { case RangeGroupDirection.Forward: { int num5 = end + 1; if ((num5 >= viewportStartIndex) && (num5 <= viewportEndIndex)) { presenter.Index = num5; info2.LineDirection = RangeGroupDirection.Forward; Children.Add(presenter); presenter.Measure(new Size(buttonSize, buttonSize)); Children.Add(rectangle); rectangle.Measure(new Size(availableSize.Width, availableSize.Height)); _groupButtonInfos.Add(info2); } break; } case RangeGroupDirection.Backward: { int num6 = start - 1; if ((num6 >= viewportStartIndex) && (num6 <= viewportEndIndex)) { presenter.Index = num6; info2.LineDirection = RangeGroupDirection.Backward; Children.Add(presenter); presenter.Measure(new Size(buttonSize, buttonSize)); Children.Add(rectangle); rectangle.Measure(new Size(availableSize.Width, availableSize.Height)); _groupButtonInfos.Add(info2); } break; } } } if ((start <= viewportEndIndex) && (end >= viewportStartIndex)) { int num7 = Math.Max(viewportStartIndex, start); int num8 = Math.Min(viewportEndIndex, end); if (flag) { Rectangle line = new Rectangle(); line.Fill = PaintedBrush; GroupLineInfo info3 = new GroupLineInfo(line) { Start = num7, End = num8, Level = group.Level }; Children.Add(line); line.Measure(new Size(2.0, availableSize.Height)); if (((groupDirection == RangeGroupDirection.Forward) && (num7 == start)) || ((groupDirection == RangeGroupDirection.Backward) && (num8 == end))) { Rectangle rectangle3 = new Rectangle(); rectangle3.Fill = PaintedBrush; info3.StartLine = rectangle3; Children.Add(rectangle3); rectangle3.Measure(new Size(availableSize.Width, availableSize.Height)); } _groupLineInfos.Add(info3); } List <int> list = new List <int>(); for (int i = num7; i <= num8; i++) { list.Add(i); } foreach (RangeGroupInfo info4 in group.Children) { if (info4.State == GroupState.Collapsed) { for (int j = info4.Start; j <= info4.End; j++) { list.Remove(j); } } switch (groupDirection) { case RangeGroupDirection.Forward: list.Remove(info4.End + 1); break; case RangeGroupDirection.Backward: list.Remove(info4.Start - 1); break; } MeasureGroups(availableSize, info4, buttonSize); if (((groupDirection == RangeGroupDirection.Backward) && (group.Start == info4.Start)) || ((groupDirection == RangeGroupDirection.Forward) && (group.End == info4.End))) { for (int k = info4.Start; k <= info4.End; k++) { list.Remove(k); } } } if (list.Count > 0) { foreach (int num12 in list) { Ellipse ellipse = new Ellipse(); ellipse.Fill = PaintedBrush; GroupDotInfo info5 = new GroupDotInfo(ellipse) { Index = num12, Level = group.Level + 1 }; Children.Add(ellipse); ellipse.Measure(_dotSize); _groupDotInfos.Add(info5); } } } } }