void Awake() { parrent = GameObject.Find("Players"); resources = GameObject.Find("Handeler").GetComponent<Resources>(); selected = GameObject.Find("Handeler").GetComponent<Selected>(); gridDrag = GameObject.Find("Handeler").GetComponent<GridDrag>(); Select = GameObject.Find("Handeler").GetComponent<select>(); }
public IHttpActionResult GetMakesByYear(Selected selected) { var yearParam = new SqlParameter("@model_year", selected.year); var retval = db.Database.SqlQuery<string>( "EXEC GetMakesByYear @model_year", yearParam).ToList(); return Ok(retval); }
public IHttpActionResult GetModelsByYearMake(Selected selected) { var carmake = new SqlParameter("@make", selected.make); var yearParam = new SqlParameter("@model_year", selected.year); var retval = db.Database.SqlQuery<string>( "EXEC GetModelsByYearMake @model_year, @make", yearParam, carmake).ToList(); return Ok(retval); }
public IHttpActionResult GetUniqueModelsByMake(Selected selected) { var _make = new SqlParameter("@make", selected.make ?? ""); var returnValue = db.Database.SqlQuery<string>( "EXEC GetUniqueModelsByMake @make", _make).ToList(); return Ok(returnValue); }
public IHttpActionResult GetModelYears(Selected selected) { var _mk = new SqlParameter("@mk", selected.make ?? ""); var retval = db.Database.SqlQuery<string>( "EXEC GetYears4Make @mk", _mk).ToList(); return Ok(retval); }
public IHttpActionResult GetCarsByYearMakeModelTrim(Selected selected) { // Input Parameters var Syear = new SqlParameter("@year", selected.year??""); var Smake = new SqlParameter("@make", selected.make??""); var Smodel = new SqlParameter("@model", selected.model??""); var Strim = new SqlParameter("@trim", selected.trim??""); var retval = db.Database.SqlQuery<Car>( // Run Stored Procedure "exec getCarsByYearMakeModelTrim @year, @make, @model, @trim", Syear, Smake, Smodel, Strim).ToList(); return Ok(retval); }
/// <summary>Assigns all needed attributes to the tag</summary> /// <returns>This instance downcasted to base class</returns> public virtual IndexedTag attr( Selected? selected = null, Disabled? disabled = null, string label = null, string value = null, string id = null, string @class = null, string style = null, string title = null, LangCode lang = null, string xmllang = null, Dir? dir = null, string onclick = null, string ondblclick = null, string onmousedown = null, string onmouseup = null, string onmouseover = null, string onmousemove = null, string onmouseout = null, string onkeypress = null, string onkeydown = null, string onkeyup = null ) { Selected = selected; Disabled = disabled; Label = label; Value = value; Id = id; Class = @class; Style = style; Title = title; Lang = lang; XmlLang = xmllang; Dir = dir; OnClick = onclick; OnDblClick = ondblclick; OnMouseDown = onmousedown; OnMouseUp = onmouseup; OnMouseOver = onmouseover; OnMouseMove = onmousemove; OnMouseOut = onmouseout; OnKeyPress = onkeypress; OnKeyDown = onkeydown; OnKeyUp = onkeyup; return this; }
//-------------------------------------------------------------------------- private void Copy() { var nodeData = new XElement("Nodes"); var selected = Selected.ToList(); foreach (var node in selected) { var root = new XElement("Item"); node.GraphNodeItem.Definition.SaveData(root, node.GraphNodeItem, true); root.SetAttributeValue("Type", node.GraphNodeItem.Definition.Name); nodeData.Add(root); } Clipboard.SetData("NodeCopy", nodeData.ToString()); }
/// <summary> /// Returns a clone of this object. /// </summary> /// <returns>The cloned object.</returns> public override object Clone() { return(new ListBoxTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), BorderTheme = BorderTheme.Clone(), BorderLineStyle = (int[])BorderLineStyle.Clone(), DrawBorder = DrawBorder, ItemTheme = (ListBoxItemTheme)ItemTheme.Clone(), ScrollBarTheme = (ScrollBarTheme)ScrollBarTheme.Clone() }); }
public void BallButtonDown() { if (currentSelected == Selected.Ball) { ShootBall(); } else { //focusSquare.trackingInitialized = false; focusSquare.foundSquare.SetActive(false); focusSquare.findingSquare.SetActive(false); focusSquare.SquareState = FocusSquare.FocusState.Initializing; ResetButtons(); ButtonPressed(Ball); currentSelected = Selected.Ball; } }
/// <summary> /// Internal OnPressed implementation. /// </summary> protected override void OnClicked() { if (m_Menu != null) { ToggleMenu(); } else if (!m_OnStrip) { IsChecked = !IsChecked; if (Selected != null) { Selected.Invoke(this); } GetCanvas().CloseMenus(); } base.OnClicked(); }
/// <summary> /// Internal OnPressed implementation. /// </summary> protected override void OnClicked(int x, int y) { if (m_Menu != null) { ToggleMenu(); } else if (!m_OnStrip) { IsChecked = !IsChecked; if (Selected != null) { Selected.Invoke(this, new ItemSelectedEventArgs(this)); } GetCanvas().CloseMenus(); } base.OnClicked(x, y); }
public CheckerOperatorSelectView2(bool not) { InitializeComponent(); if (not) { listItems.GetItems().Last().Selected = true; } else { listItems.GetItems().First().Selected = true; } listItems.SelectionChanged += (o, e) => { Selected?.Invoke(listItems.GetItems().Last().Selected); }; }
public void ImportOnlineRegistryTest() { IUnityContainer container = new UnityContainer(); IConfig config = new Config { UsernameLocations = new List <string>() { "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache" }, UserRegistryLocations = new List <string>() { "ntuser.dat", "Local Settings\\Application Data\\Microsoft\\Windows\\UsrClass.dat", "AppData\\Local\\Microsoft\\Windows\\UsrClass.dat" }, ShellbagRootLocations = new List <string> { "Software\\Microsoft\\Windows\\Shell\\BagMRU", "Software\\Microsoft\\Windows\\Shell\\Bags", "Software\\Microsoft\\Windows\\ShellNoRoam\\BagMRU", "Software\\Microsoft\\Windows\\ShellNoRoam\\Bags", "Local Settings\\Software\\Microsoft\\Windows\\Shell\\BagMRU", "Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags" }, KnownGuids = new Dictionary <string, string>() }; Selected selected = new Selected(); ShellItemCollection shellItems = new ShellItemCollection(); UserCollection users = new UserCollection(); RegistryHiveCollection registries = new RegistryHiveCollection(); container.RegisterType <IShellItemFactory, ShellItemFactory>(); container.RegisterInstance <IConfig>(config, InstanceLifetime.Singleton); container.RegisterInstance <IShellItemCollection>(shellItems, InstanceLifetime.Singleton); container.RegisterInstance <IUserCollection>(users, InstanceLifetime.Singleton); container.RegisterInstance <IRegistryHiveCollection>(registries, InstanceLifetime.Singleton); container.RegisterInstance <ISelected>(selected, InstanceLifetime.Singleton); IRegistryImporter regImporter = container.Resolve <RegistryImporter>(); (_, IEnumerable <IShellItem> items) = regImporter.ImportRegistry(); Assert.IsTrue(shellItems.Count == items.Count()); }
/// <summary> /// Denna overriden ser till så att allt sker som det ska. Är shoppen flaggad till att /// ignorera köp så kör den selectade itemets interactevent så vi kan lägga på funktionallitet. /// </summary> public override void RunInteractAction() { if (myIgnoreBuy) { Selected.InteractEvent(); return; } if (!Program.Player.RemoveMoney(Selected.Value)) { TextUtils.SendMessage(new Text("Not enough money!"), TextType.ACTION); return; } InventoryManager.PlayerInventory.AddItem(Selected.Clone()); TextUtils.SendMessage(new Text("+1 " + Selected.Name), TextType.ACTION); RunReloadAction(); }
public void CheckInputDevice(InputDevice controller) { var buttonsPressed = controller.ButtonsPressed; if (buttonsPressed.Contains(Buttons.A)) { Selected.Callback(); } if (_selectedIndex < Items.Count - 1 && buttonsPressed.Contains(Buttons.LeftThumbstickDown)) { _selectedIndex++; } if (_selectedIndex > 0 && buttonsPressed.Contains(Buttons.LeftThumbstickUp)) { _selectedIndex--; } }
public void WeaponButtonDown() { if (currentSelected == Selected.Weapon) { axeControl.UseWeapon(); } else { focusSquare.trackingInitialized = false; focusSquare.foundSquare.SetActive(false); focusSquare.findingSquare.SetActive(false); focusSquare.SquareState = FocusSquare.FocusState.Initializing; ResetButtons(); ButtonPressed(Weapon); PickAxeParent.SetActive(true); currentSelected = Selected.Weapon; } }
public void Block4x4ButtonDown() { if (currentSelected == Selected.Block4x4) { if (focusSquare.foundSquare.activeSelf) { GameObject newBlock = Instantiate(Stack4x4x4, focusSquare.foundSquare.transform.position, focusSquare.foundSquare.transform.rotation); } } else { focusSquare.trackingInitialized = true; focusSquare.SquareState = FocusSquare.FocusState.Finding; ResetButtons(); ButtonPressed(Block4x4); currentSelected = Selected.Block4x4; } }
private void OnRollerSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0) { Unselected?.Invoke(this, new EventArgs()); e.Handled = true; return; } var timeSelectorItemModel = e.AddedItems[0] as TimeSelectorItemModel; if (timeSelectorItemModel == null) { return; } Selected?.Invoke(this, new SelectedDateChangedEventArgs(timeSelectorItemModel.Time)); }
public void CheckNiegbourhood() { if (LastSelected != null) { LastSelected.ChangeTexture(2); if (LastSelected.TmpNeighbours.Count <= 0) { Completed.Add(LastSelected); LastSelected.ChangeTexture(3); } } Selected.ChangeTexture(2); if (Selected.TmpNeighbours.Count <= 0) { Completed.Add(Selected); Selected.ChangeTexture(3); } }
/// <summary> /// Returns a clone of this object. /// </summary> /// <returns>The cloned object.</returns> public override object Clone() { return(new ScrollBarTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), StartButtonVerticalGlyph = StartButtonVerticalGlyph, EndButtonVerticalGlyph = EndButtonVerticalGlyph, StartButtonHorizontalGlyph = StartButtonHorizontalGlyph, EndButtonHorizontalGlyph = EndButtonHorizontalGlyph, BarGlyph = BarGlyph, SliderGlyph = SliderGlyph }); }
private void SetProjectileSpeed(Projectile projectile) { Player player = parent as Player; if (player.Selected) { Selected icon = GameWorld.GetObject("selected") as Selected; float dx = icon.Position.X - player.Position.X; float dy = icon.Position.Y - player.Position.Y; float direction = (float)Math.Sqrt(dx * dx + dy * dy); projectile.Velocity = new Vector2((dx / direction) * speed, (dy / direction) * speed); } else { projectile.Velocity = new Vector2(speed * (float)Math.Cos(player.Direction), speed * (float)Math.Sin(player.Direction)); } }
private void Expand() { if (Type == DirectoryType.File) { return; } var children = DirectoryHelper.GetDirectoryContents(FullPath); Children = new ObservableCollection <DirectoryItemViewModel>(children.Select(content => { var viewModel = new DirectoryItemViewModel(content.FullPath); viewModel.Selected += (s, e) => Selected?.Invoke(s, e); return(viewModel); })); RemoveHiddenItems(); }
public virtual bool OnCollision() { if (InputManager.MousePosition.Y > screenPosition.Y + Offset.Y && InputManager.MousePosition.X > screenPosition.X + Offset.X && (InputManager.MousePosition.Y < screenPosition.Y + Offset.Y + dimensions.Y && InputManager.MousePosition.X < screenPosition.X + Offset.X + dimensions.X)) { Collided?.Invoke(this, EventArgs.Empty); Selected?.Invoke(this, EventArgs.Empty); IsSelected = true; return(true); } else { IsSelected = false; } return(false); }
private static Unit ShowMoves(Selected selected) { WriteLine($"Moves for {selected.Piece.ToString()}"); foreach (var sq in selected.Moves()) { if (selected.Piece.IsRokadeMove(selected.Iterator.Iterate().FirstOrDefault().Square, sq)) { ShowRokade(sq); } else { Write($"{sq.ToString()}"); } Write(" "); } WriteLine(); return(Unit()); }
public override void Delete() { if (Selected != null) { try { PartenaireDiffusion toRemove = Selected.ToEntity(); MyDb.PartenaireDiffusion.Remove(toRemove); MyDb.SaveChanges(); ReloadDatas(); return; } catch (Exception e) { MessageBox.Show("Erreur lors de la sauvegarde des données : " + e.Message); } } }
public bool ProcessEvents(Event e) { switch (e.type) { case EventType.MouseDown: if (e.button == 0) { if (BRect.Contains(e.mousePosition)) { _isDragged = true; _isSelected = true; GUI.changed = true; Selected?.Invoke(); } else { _isSelected = false; GUI.changed = true; } } if (e.button == 1 && _isSelected && BRect.Contains(e.mousePosition)) { MouseClicked?.Invoke(e.mousePosition); e.Use(); } break; case EventType.MouseUp: _isDragged = false; break; case EventType.MouseDrag: if (e.button == 0 && _isDragged) { Drag(e.delta); e.Use(); return(true); } break; } return(false); }
public void AddToInterface(PredictionResult predictionResult) { if (SelectedItem != null && predictionResult.Prediction == SelectedItem) { Selected.Add(new OutputPrediction { Prediction = predictionResult.Prediction, Image = new BitmapImage(new Uri(predictionResult.Path)) }); } foreach (var i in Number) { if (i.Label == predictionResult.Prediction) { i.Number++; } } All.Add(new OutputPrediction { Prediction = predictionResult.Prediction, Image = new BitmapImage(new Uri(predictionResult.Path)) }); }
/// <summary> /// 操作订单详情(0新增1删除,2刷新) /// </summary> /// <param name="IsAdd"></param> /// <param name="details"></param> private void OperateDetails(int mode, DetailsModel details) { if (mode == 0) { Selected.AddListToFirst(details); } else if (mode == 1) { Selected.RemoveSelected(details); ProductStateModel productStateModel = Products.ProductList.Where(x => x.Product == details.Product).FirstOrDefault(); if (null != productStateModel && productStateModel.IsSelected) { productStateModel.IsSelected = false; productStateModel.DetailsModel = null; } } RefreshState(); }
private void ConfirmButtonClick(object sender, System.EventArgs e) { var nodeName = Input.Text; if (string.IsNullOrWhiteSpace(nodeName) || nodeName == Tree.ROOT) { return; } var isParse = int.TryParse(InputWeight.Text, out int weight); if (!isParse) { return; } Selected.AddNode(nodeName, weight); Screen.UpdateImage(); }
private void OnCalendarXItemClicked(object sender, RoutedEventArgs e) { var calendarXItem = e.OriginalSource as CalendarXItem; var calendarXItemModel = calendarXItem?.DataContext as CalendarXItemModel; if (calendarXItemModel == null) { return; } if (calendarXItemModel.IsChecked) { Selected?.Invoke(this, new SelectedDateChangedEventArgs(calendarXItemModel.Date)); } else { Unselected?.Invoke(this, new SelectedDateChangedEventArgs(calendarXItemModel.Date)); } }
private void SelectTiles() { Rectangle r = Selection; int w = Width / _tile_w_zoom; Selected.Clear(); for (int y = 0; y < r.Height; ++y) { for (int x = 0; x < r.Width; ++x) { short tile = (short)((r.X + x) + (r.Y + y) * w); if (tile < 0 || tile > Tileset.Tiles.Count - 1) { tile = -1; } Selected.Add(tile); } } }
public void RemoveChampion(ChampionData champion) { if (champion == null) { return; } Selected.AssociatedChampions.Remove(champion.Key); Selected.Champions.Remove(champion); if (Selected.AssociatedChampions.Count == 0) { Selected.IsGlobalForChampions = true; Selected.OnChanged("isGlobalForChampions"); } ItemSetChanged(true); SortItems(); }
public Menu(Font font, int bottomBtns, RenderWindow window) { textFont = font; setupLowerBtns(bottomBtns); selected = Selected.NEW; selectRect = new RectangleShape(); selectRect.FillColor = new Color(255, 255, 255, 32); selectRect.OutlineColor = new Color(128, 128, 128); selectRect.OutlineThickness = 5; windowSize = new Vector2u(window.Size.X, window.Size.Y); white = new Color(Color.White); yellow = new Color(Color.Yellow); buttonList = new List <Components.Button>(); }
protected override Dictionary <string, double> LoadMajorationList() { if (null == Selected || null == _comp) { return(new Dictionary <string, double>()); } if (null == _majorationList) { PPDataContext db = new PPDataContext(); _majorationList = Pic.DAL.SQLite.Component.GetDefaultMajorations( db, _comp.ID, _cardboardProfiles[Selected.ToString()] // rounding to be applied while building majoration dictionary , Pic.DAL.SQLite.Component.IntToMajoRounding(Properties.Settings.Default.MajorationRounding) ); } return(_majorationList); }
public void RemoveSelectedEntity() { Selected icon = GameWorld.GetObject("selected") as Selected; if (icon == null) { return; } Level level = GameWorld as Level; Enemy enemy = GameWorld.GetObject(icon.SelectedEntity) as Enemy; enemy.Selected = false; level.RootList.Remove(icon.Id); Player player = GameWorld.GetObject("player") as Player; player.Selected = false; }
/// <summary> /// On confirmation button clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { List <Peer> selected = new List <Peer>(); // If at least one peer was selected if (thelist.SelectedItems.Count > 0) { /* Triggers the evet */ foreach (ListedPeer p in thelist.SelectedItems.Cast <ListedPeer>().ToList()) { selected.Add(p.Peer); } Selected?.Invoke(selected, filePaths); } else // Otherwise the user must repeat the selection { MessageBox.Show("Devi selezionare almeno un destinatario."); } }
void Awake() { resources = GameObject.Find("Handeler").GetComponent<Resources>(); selected = GameObject.Find("Handeler").GetComponent<Selected>(); upgradeMaxTargetsButton = GameObject.Find("MaxTargetsUpgrade").GetComponent<Button>(); maxTargetsLevel = GameObject.Find("MaxTargtsUpgradeText").GetComponent<Text>(); upgradeRangeButton = GameObject.Find("AttackRangeUpgrade").GetComponent<Button>(); attackRangeLevel = GameObject.Find("AttackRangeUpgradeText").GetComponent<Text>(); upgradeAttackSpeedButton = GameObject.Find("AttackSpeedUpgrade").GetComponent<Button>(); attackSpeedLevel = GameObject.Find("AttackSpeedUpgradeText").GetComponent<Text>(); upgradeHealthButton = GameObject.Find("HealthUpgrade").GetComponent<Button>(); healthUpgradeLevel = GameObject.Find("HealthUpgradeText").GetComponent<Text>(); upgradeUI = GameObject.Find("UpgradeCharacter"); circleReset = GameObject.Find("RangeCircles").GetComponent<RangeCircleScript>(); takeOverButton = GameObject.Find("TakeOver"); }
public IHttpActionResult GetTrimByYearMakeModel(Selected selected) { // Input Parameters var Syear = new SqlParameter("@year", selected.year); var Smake = new SqlParameter("@make", selected.make); var Smodel = new SqlParameter("@model", selected.model); var retval = db.Database.SqlQuery<string>( // Run Stored Procedure "exec getTrimByYearMakeModel @year, @make, @model", Smake, Syear, Smodel).ToList(); // Return Value return Ok(retval); }
void Awake() { editMouse = GameObject.Find("Handeler").GetComponent<GridDrag>(); selectSetter = GameObject.Find("Handeler").GetComponent<Selected>(); }
public IHttpActionResult GetCarsByYearMakeModelTrim(Selected selected) { var carmake = new SqlParameter("@make", selected.make ?? ""); var yearParam = new SqlParameter("@model_year", selected.year ?? ""); var carname = new SqlParameter("@model_name", selected.model ?? ""); var cartrim = new SqlParameter("model_trim", selected.trim ?? ""); var retval = db.Database.SqlQuery<Car>( "EXEC GetCarsByYearMakeModelTrim @model_year, @make, @model_name, @model_trim", yearParam, carmake, carname, cartrim).ToList(); return Ok(retval); }
public static TagOption selected(this TagOption tag, Selected value) { tag.Selected = value; return tag; }
public IHttpActionResult GetUniqueTrimsByMakeModelYear(Selected selected) { var _model_year = new SqlParameter("@model_year", selected.year ?? ""); var _make = new SqlParameter("@make", selected.make ?? ""); var _model_name = new SqlParameter("@model_name", selected.model ?? ""); var returnValue = db.Database.SqlQuery<string>( "EXEC GetUniqueTrimsByMakeModelYear @model_year, @make, @model_name", _model_year, _make, _model_name).ToList(); return Ok(returnValue); }
// Adds to a group of selected units. public void addToGroup(GameObject unit) { this.selectedUnits.Add(unit); if (this.selectedUnits.Count == 1) { this.selected = Selected.Single; } else if (this.selectedUnits.Count > 1) { this.selected = Selected.Group; } }
public IHttpActionResult GetCarMakes4Yr(Selected selected) { var _yr = new SqlParameter("@yr", selected.year ?? ""); var retval = db.Database.SqlQuery<string>( "EXEC GetCarMakes4Yr @yr", _yr).ToList(); return Ok(retval); }
public void AddItem(Drawable item, Selected fcn_ptr, string music_name) { SelectionItem temp = new SelectionItem(); temp.m_sprite = item; m_num_items++; if (++m_x == m_columns) { m_x = 0; } temp.m_sprite.X_Pos = m_xpos + (m_x * item.Width) + (m_x * m_spacing); temp.m_sprite.Y_Pos = m_ypos + (m_y * item.Height) + (m_y * m_spacing); // Make the item selectable m_grid[m_y, m_x].m_selectable = true; m_grid[m_y, m_x].m_list_index = m_num_items - 1; Console.WriteLine("Grid[" + m_y + ", " + m_x + "] Set to true"); // Update rows if (m_y != (int)((m_num_items/ m_columns))) { m_y++; m_rows++; m_grid = HelperUtils.ResizeArray<GridItem>(m_grid, m_rows, m_columns); // Set new constructed row to false for (int i = 0; i < m_columns; i++) { m_grid[m_rows - 1, i] = new GridItem(); m_grid[m_rows - 1, i].m_selectable = false; } } temp.m_music_name = music_name; temp.m_fcn_ptr = fcn_ptr; temp.m_border = HelperUtils.BuildBorder(new Rectangle((int)temp.m_sprite.X_Pos, (int)temp.m_sprite.Y_Pos, temp.m_sprite.Width, temp.m_sprite.Height), m_border_width); if (m_list.Count == 0) { temp.m_selected = true; m_selected_x = 0; m_selected_y = 0; m_cue = m_soundbank.GetCue(music_name); } else { temp.m_selected = false; } m_list.Add(temp); }
void Awake() { selected = GetComponent<Selected>(); }
void Awake() { selected = GameObject.Find("Handeler").GetComponent<Selected>(); lookRange = GameObject.Find("LookRangeCircle"); attackRange = GameObject.Find("RangeCircle"); }
public IHttpActionResult GetMakeByYear(Selected selected) { // Input Parameters var Syear = new SqlParameter("@year", selected.year); var retval = db.Database.SqlQuery<string>( // Run Stored Procedure "exec getMakeByYear @year", Syear).ToList(); // Return Value return Ok(retval); }
public IHttpActionResult GetTrims(Selected selected) { var _yr = new SqlParameter("@yr", selected.year ?? ""); var _mk = new SqlParameter("@mk", selected.make ?? ""); var _mod = new SqlParameter("@mod", selected.model ?? ""); var retval = db.Database.SqlQuery<string>( "EXEC GetTrims4YrMakeModel @yr, @mk, @mod", _yr, _mk, _mod).ToList(); return Ok(retval); }
/// <summary> /// This function processes the input, currently /// adding items and towers (using the towers class). /// We will have specific towers so be sure to use the sub classes. /// The Draw function depends on this function on what item/tower to draw. /// </summary> /// <param name="finger"></param> public void handleInput(Rectangle finger) { if (TouchPanel.IsGestureAvailable) // if or while? { GestureSample sample = TouchPanel.ReadGesture(); switch (selected) { case Selected.None: // Check if user has selected an affordable item to drag. if (sample.GestureType == GestureType.FreeDrag && finger.Intersects(bomb_hitbox) && GameState.Singleton.Money >= BombTower.PRICE) { selected = Selected.Bomb; } else if (sample.GestureType == GestureType.FreeDrag && finger.Intersects(robot1_hitbox) && GameState.Singleton.Money >= BasicTower.PRICE) { selected = Selected.Robot1; } else if (sample.GestureType == GestureType.FreeDrag && finger.Intersects(robot2_hitbox) && GameState.Singleton.Money >= SlowTower.PRICE) { selected = Selected.Robot2; } else if (sample.GestureType == GestureType.FreeDrag && finger.Intersects(robot3_hitbox) && GameState.Singleton.Money >= AOETower.PRICE) { selected = Selected.Robot3; } else if (sample.GestureType == GestureType.FreeDrag && finger.Intersects(robot4_hitbox) && GameState.Singleton.Money >= LaserTower.PRICE) { selected = Selected.Robot4; } break; case Selected.Bomb: // Check if user has dropped the dragged bomb. if (sample.GestureType == GestureType.DragComplete) // Note: GestureType.Position is 0,0 for drag. { // Check if it's been placed in the trash can. if (finger.Intersects(trash_hitbox)) { // Do nothing; item is trashed. } else // Safe to build. { Tower tower = BombTower.FactoryMake(theGame); GameState.Singleton.CurrentLevel.PlaceTower(tower, theGame.fingerPosition, tower.ObjectTexture.Width); GameState.Singleton.Money -= BombTower.PRICE; } selected = Selected.None; // Either way, we can safely discard the item now. } break; case Selected.Robot1: // Check if user has dropped the dragged robot 1. if (sample.GestureType == GestureType.DragComplete) { if (finger.Intersects(trash_hitbox)) { // Do nothing; item is trashed. } else // Safe to build. { Tower tower = BasicTower.FactoryMake(theGame); GameState.Singleton.CurrentLevel.PlaceTower(tower, theGame.fingerPosition, tower.ObjectTexture.Width); GameState.Singleton.Money -= BasicTower.PRICE; } selected = Selected.None; } break; case Selected.Robot2: // Check if user has dropped the dragged robot 2. if (sample.GestureType == GestureType.DragComplete) { if (finger.Intersects(trash_hitbox)) { // Do nothing; item is trashed. } else // Safe to build. { Tower tower = SlowTower.FactoryMake(theGame); GameState.Singleton.CurrentLevel.PlaceTower(tower, theGame.fingerPosition, tower.ObjectTexture.Width); GameState.Singleton.Money -= SlowTower.PRICE; } selected = Selected.None; } break; case Selected.Robot3: // Check if user has dropped the dragged robot 3. if (sample.GestureType == GestureType.DragComplete) { if (finger.Intersects(trash_hitbox)) { // Do nothing; item is trashed. } else // Safe to build. { Tower tower = AOETower.FactoryMake(theGame); GameState.Singleton.CurrentLevel.PlaceTower(tower, theGame.fingerPosition, tower.ObjectTexture.Width); GameState.Singleton.Money -= AOETower.PRICE; } selected = Selected.None; } break; case Selected.Robot4: // Check if user has dropped the dragged robot 4. if (sample.GestureType == GestureType.DragComplete) { if (finger.Intersects(trash_hitbox)) { // Do nothing; item is trashed. } else // Safe to build. { Tower tower = LaserTower.FactoryMake(theGame); GameState.Singleton.CurrentLevel.PlaceTower(tower, theGame.fingerPosition, tower.ObjectTexture.Width); GameState.Singleton.Money -= LaserTower.PRICE; } selected = Selected.None; } break; } } }
// Deselects all currenlty selected units. public void deselectAllUnits() { this.selectedUnits.Clear (); this.selected = Selected.None; }
public IHttpActionResult GetAllMakes(Selected selected) { var retval = db.Database.SqlQuery<string>( "EXEC GetAllMakes").ToList(); return Ok(retval); }
private void searchLocalNetwork_SelectedServerChanged(string hostName, byte[] badress, ushort uiport) { if (m_Selected == null) { m_Selected = new Selected(hostName, badress, uiport); } else { m_Selected.HostName = hostName; m_Selected.bAdress = badress; m_Selected.uiPort = uiport; } if (rdbHostName.Checked) { textBox_SelectedServer.Text = hostName; } else { textBox_SelectedServer.Text = SearchLocalNetwork.StaticFunc.GetComputerFromIP(badress); } }
public IHttpActionResult GetCars(Selected selected) { var _yr = new SqlParameter("@yr", selected.year ?? ""); var _mk = new SqlParameter("@mk", selected.make ?? ""); var _mod = new SqlParameter("@mod", selected.model ?? ""); var _trm = new SqlParameter("@trm", selected.trim ?? ""); var _srt = new SqlParameter("@srt", selected.sort ?? ""); var retval = db.Database.SqlQuery<Car>( "EXEC GetCars4YrMakeModelTrim @yr, @mk, @mod, @trm, @srt", _yr, _mk, _mod, _trm, _srt).ToList(); //return Ok(years); /*StatusCode */ return Ok(retval); }
// Selects one unit, deselects if any other units were currently selected. public void selectUnit(GameObject unit) { // We are discarding all currently selected units. this.deselectAllUnits (); this.selectedUnits.Add(unit); this.selected = Selected.Single; }
public IHttpActionResult GetCarData(Selected selected) { var modelYear = new SqlParameter("@model_year", selected.year ?? ""); var Make = new SqlParameter("@make", selected.make ?? ""); var modelName = new SqlParameter("@model_name", selected.model ?? ""); var modelTrim = new SqlParameter("@model_trim", selected.trim ?? ""); var retval = db.Database.SqlQuery<Car>( "EXEC GetCarData @model_year, @make, @model_name, @model_trim", modelYear, Make, modelName, modelTrim).ToList(); return Ok(retval); }
// Deselect given unit. public void deselectUnit(GameObject unit) { this.selectedUnits.Remove (unit); if (selectedUnits.Count == 0) { this.selected = Selected.None; } else if (selectedUnits.Count == 1) { this.selected = Selected.Single; } // Else still group selected. }
public IHttpActionResult GetTrimByYrMkMod(Selected selected) { var modelYear = new SqlParameter("@model_year", selected.year); var Make = new SqlParameter("@make", selected.make); var modelName = new SqlParameter("@model_name", selected.model); var retval = db.Database.SqlQuery<string>( "EXEC GetTrimByYrMkMod @model_year, @make, @model_name", modelYear, Make, modelName).ToList(); return Ok(retval); }
public IHttpActionResult GetCars(Selected selected) { var _model_year = new SqlParameter("@model_year", selected.year ?? ""); var _make = new SqlParameter("@make", selected.make ?? ""); var _model_name = new SqlParameter("@model_name", selected.model ?? ""); var _model_trim = new SqlParameter("@model_trim", selected.trim ?? ""); var returnValue = db.Database.SqlQuery<Car>( "EXEC GetCars @model_year, @make, @model_name, @model_trim", _model_year, _make, _model_name, _model_trim).ToList(); return Ok(returnValue); }