// pseudo-ctor internal VariantItemView Setup(Action <int> action, Text fulltextobj, SelectModes mode, int index) { _selectaction = action; _fulltextobj = fulltextobj; _mode = mode; _itemindex = index; return(this); }
// fill at leisure (it can take some time) IEnumerator FillGrid(GameObject[] objs, SelectModes mode, int xbase, int xcount) { Util.Trace(3, "fill grid {0} {1} {2} {3}", objs.Length, mode, xbase, xcount); for (int i = 0; i < objs.Length; i++) { objs[i].GetComponent <VariantItemView>().Setup(SelectAction, StatusbarText, mode, xbase + i); objs[i].SetActive(true); yield return(null); } }
public void set(PlotterController pc) { State = pc.State; SelectMode = pc.SelectMode; CreatingFigureType = pc.CreatingFigType; CreatingFigurePointCnt = 0; if (pc.FigureCreator != null) { CreatingFigurePointCnt = pc.FigureCreator.Figure.PointCount; } MeasureMode = pc.MeasureMode; HasSelect = pc.HasSelect(); }
private void InputUtItems() { if (Mathf.RoundToInt(Input.GetAxisRaw("Vertical")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; if (Input.GetAxisRaw("Vertical") > 0) { mode = SelectModes.Weapons; } else { mode = SelectModes.LowerText; } owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); return; } if (Mathf.RoundToInt(Input.GetAxisRaw("Horizontal")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; selectIndex_UtItems.x += Input.GetAxisRaw("Horizontal") > 0 ? 1 : -1; owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); } if (selectIndex_UtItems.x < 0) { mode = SelectModes.RecoveryItems; } selectIndex_UtItems.x = Mathf.Clamp(selectIndex_UtItems.x, 0, (int)GameManager.UtilityItems.Length - 1); if (selectIndex_UtItems.x < selectIndex_UtItems.z) { selectIndex_UtItems.z = selectIndex_UtItems.x; } else if (selectIndex_UtItems.z < selectIndex_UtItems.x - 3) { selectIndex_UtItems.z = selectIndex_UtItems.x - 3; } }
private void InputLowerText() { if (Mathf.RoundToInt(Input.GetAxisRaw("Vertical")) != 0 && inputCooldown <= 0.0f) { if (Input.GetAxisRaw("Vertical") > 0) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; if (selectIndex_LowerText.x > 0) { mode = SelectModes.UtilityItems; } else { mode = SelectModes.RecoveryItems; } owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); return; } } if (Mathf.RoundToInt(Input.GetAxisRaw("Horizontal")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; selectIndex_LowerText.x += Input.GetAxisRaw("Horizontal") > 0 ? 1 : -1; owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); } selectIndex_LowerText.x = Mathf.Clamp(selectIndex_LowerText.x, 0, lowerTexts.Length - 1); }
private void InputPlayer() { if (Mathf.RoundToInt(Input.GetAxisRaw("Vertical")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); if (Input.GetAxisRaw("Vertical") < 0) { mode = SelectModes.Weapons; return; } } if (Mathf.RoundToInt(Input.GetAxisRaw("Horizontal")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; selectIndex_Player.x += Input.GetAxisRaw("Horizontal") > 0 ? 1 : -1; owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); } selectIndex_Player.x = Mathf.Clamp(selectIndex_Player.x, 0, playerData.Length - 1); if (selectIndex_Player.x < selectIndex_Player.z) { selectIndex_Player.z = selectIndex_Player.x; } else if (selectIndex_Player.z < selectIndex_Player.x - 3) { selectIndex_Player.z = selectIndex_Player.x - 3; } }
private void Select(TeamViewModel teamViewModel, SelectModes mode) { foreach (var screen in teamViewModel.Items) { var vm = (GenomeItemViewModel)screen; if (mode == SelectModes.All) vm.IsChecked = true; else if (mode == SelectModes.None) vm.IsChecked = false; else vm.IsChecked = !vm.IsChecked; } }
/// <summary> /// The basic idea of all the Input functions is that they set their own index /// based on the input they receive and make sure it stays within bounds or /// switches to the appropriate segment every time. /// </summary> private void InputWeapon() { if (Mathf.RoundToInt(Input.GetAxisRaw("Vertical")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); if (Input.GetAxisRaw("Vertical") > 0 && selectIndex_Weapon.y == 0) { mode = SelectModes.Players; return; } else if (Input.GetAxisRaw("Vertical") < 0 && selectIndex_Weapon.y * 2 + selectIndex_Weapon.x >= owner.weaponList.Count - 2) { if (selectIndex_Weapon.x == 0) { mode = SelectModes.RecoveryItems; } else { mode = SelectModes.UtilityItems; } return; } selectIndex_Weapon.y += Input.GetAxisRaw("Vertical") > 0 ? -1 : 1; } if (Mathf.RoundToInt(Input.GetAxisRaw("Horizontal")) != 0 && inputCooldown <= 0.0f) { lastInput = new Vector2(Mathf.Round(Input.GetAxisRaw("Horizontal")), Mathf.Round(Input.GetAxisRaw("Vertical"))); inputCooldown = 0.25f; selectIndex_Weapon.x += Input.GetAxisRaw("Horizontal") > 0 ? 1 : -1; owner.audioStage.PlaySound(owner.SFXLibrary.menuMove, true); } if (selectIndex_Weapon.y < 0) { selectIndex_Weapon.y = 0; } else if (selectIndex_Weapon.y > (owner.weaponList.Count + 1) / 2) { selectIndex_Weapon.y = (owner.weaponList.Count + 1) / 2; } if (selectIndex_Weapon.y - selectIndex_Weapon.z < 0) { selectIndex_Weapon.z = selectIndex_Weapon.y; } else if (selectIndex_Weapon.y - selectIndex_Weapon.z >= 6) { selectIndex_Weapon.z = selectIndex_Weapon.y - 5; } if (selectIndex_Weapon.x < 0) { selectIndex_Weapon.x = 0; } else if (selectIndex_Weapon.x > 1) { selectIndex_Weapon.x = 1; } if (selectIndex_Weapon.y * 2 + selectIndex_Weapon.x >= owner.weaponList.Count) { selectIndex_Weapon.x = 0; } }