private void LinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (e.Button == MouseButtons.Left) { OnSelected?.Invoke(this, EventArgs.Empty); } }
private void Select() { _buyable.Select(); SetItemState(ShopItemState.Selected); OnSelected?.Invoke(this); }
public Tag Add(AddRequest req) { // None of the requests should have the same ID foreach (var _tag in Tags) { if (_tag.ID == req.id) { return(null); } } // None of the requests should have the same ID as an existing tag if (Tags.Where(x => x.ID == req.id).Count() > 0) { Debug.Log("Tags IDs should be unique"); return(null); } var tag = InstantiateTag(req); Tags.Add(tag); tag.OnSelected += () => { SelectTag(tag); OnSelected?.Invoke(tag); }; return(tag); }
void Awake() { renderer = GetComponent <Renderer>(); defaultMaterial = renderer.material; initialScale = transform.localScale; initialPosition = transform.localPosition; parentPlanetManager = GetComponentInParent <Planet>(); OnSelected.AddListener(() => { renderer.material = selectedMaterial; ScaleRegion(scaleRegion); ContinentDirection direction = GetComponent <ContinentDirection>(); if (direction != null) { transform.localPosition += direction.getWorldDirection().normalized *(-ZoneDisplacement); } else { Debug.Log("Zone does not have Continent Direction Attached"); } }); OnDeselected.AddListener(() => { renderer.material = defaultMaterial; transform.localPosition = initialPosition; transform.localScale = initialScale; }); }
public void TankSelected() { if (_cantBeHeld) { return; } if (_isPlaced) { OnSelected?.Invoke(this.transform); } else { transform.position = _towerHolder.position; _isheld = !_isheld; if (_isheld) { _image.raycastTarget = false; OnHeld(true); OnSelectRingReset?.Invoke(false); } else { _image.raycastTarget = true; } } }
private void Select(List <ISelectable> selectables) { Deselect(); if (selectables.Count == 0) { return; } if (selectables[0] is Unit) { selection.Set(SelectionType.Unit, selectables); } else if (selectables[0] is Structure) { selection.Set(SelectionType.Structure, selectables); OnStructuresSelected?.Invoke(selectables.Select(selectable => selectable as Structure).ToList()); } else if (selectables[0] is IHarvestable) { selection.Set(SelectionType.Harvestable, selectables); } foreach (var selectable in selectables) { selectable.Select(); } OnSelected?.Invoke(selectables); }
void Update() { #if UNITY_EDITOR if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(ray.origin, ray.direction); if (Physics.Raycast(ray, out hit, float.PositiveInfinity)) { OnSelected.Dispatch(hit.collider.gameObject); } } #else if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved) { // Get movement of the finger since last frame Touch touch = Input.GetTouch(0); RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(touch.position); Debug.DrawRay(ray.origin, ray.direction); if (Physics.Raycast(ray, out hit, float.PositiveInfinity)) { OnSelected.Dispatch(hit.collider.gameObject); } } #endif }
void IMixedRealityPointerHandler.OnPointerClicked(MixedRealityPointerEventData eventData) { if ((eventData.MixedRealityInputAction == selectAction) && IsLookedAt) { OnSelected.Invoke(); } }
public void SetItem(BountyInfo info) { BountyInfo = info; var displayName = GetDisplayName(); var canUse = BountyInfo.State == BountyState.Available || BountyInfo.State == BountyState.Complete; NameText.text = displayName; NameText.color = canUse ? Color.white : Color.gray; RewardTextIron.text = BountyInfo.RewardIron.ToString(); RewardTextIron.transform.parent.gameObject.SetActive(BountyInfo.RewardIron > 0); RewardTextGold.text = BountyInfo.RewardGold.ToString(); RewardTextGold.transform.parent.gameObject.SetActive(BountyInfo.RewardGold > 0); RewardTextCoin.text = BountyInfo.RewardCoins.ToString(); RewardTextCoin.transform.parent.gameObject.SetActive(BountyInfo.RewardCoins > 0); Icon.sprite = AdventureDataManager.GetTrophyIconForMonster(BountyInfo.Target.MonsterID, BountyInfo.RewardGold > 0); Icon.color = canUse ? Color.white : new Color(1.0f, 0.0f, 1.0f, 0.0f); RewardLabel.SetActive(BountyInfo.State == BountyState.Available); InProgressLabel.SetActive(BountyInfo.State == BountyState.InProgress); CompleteLabel.SetActive(BountyInfo.State == BountyState.Complete); Button.onClick.RemoveAllListeners(); Button.onClick.AddListener(() => OnSelected?.Invoke(BountyInfo)); if (Tooltip != null) { Tooltip.m_topic = displayName; Tooltip.m_text = Localization.instance.Localize(GetTooltip()); } }
public void Populate() { m_hasCalledPopulate = true; state = FadeShowDestroy.Hidden; m_secondsSincePrevState = 0; m_doUpdate = false; if (m_canvGroup == null) { m_canvGroup = GetComponent <CanvasGroup>(); } if (m_canvGroup) { m_canvGroup.alpha = 0; } m_layoutElem = GetComponent <LayoutElement>(); if (m_layoutElem) { m_startPrefHeight = m_layoutElem.preferredHeight; } OnSelected.AddListener(() => state = FadeShowDestroy.FadeOut); }
private void SelectChange(UIElement source, EventArgs <bool> e) { if (e.Value) { UIRadioButton radio = (UIRadioButton)source; selected.Add(radio); OnSelected?.Invoke(this, new UIRadioButtonEventArgs(radio)); if (!Multiselect) { for (int i = 0; i < selected.Count; i++) { if (selected[i] != radio) { selected[i].Selected = false; } } } } else { UIRadioButton radio = (UIRadioButton)source; selected.Remove(radio); OnDeselected?.Invoke(this, new UIRadioButtonEventArgs(radio)); if (AlwaysSelected && selected.Count < 1) { radio.Selected = true; e.Value = true; } } }
public void SetItem(TreasureMapItemInfo itemInfo, int currentCoins) { ItemInfo = itemInfo; CanAfford = Price <= currentCoins; AlreadyPurchased = itemInfo.AlreadyPurchased; var displayName = Localization.instance.Localize("$mod_epicloot_treasuremap_name", $"$biome_{Biome.ToString().ToLower()}", (itemInfo.Interval + 1).ToString()); Icon.color = (CanAfford && !AlreadyPurchased) ? Color.white : new Color(1.0f, 0.0f, 1.0f, 0.0f); NameText.text = Localization.instance.Localize(displayName); NameText.color = (CanAfford && !AlreadyPurchased) ? Color.white : Color.gray; PriceContainer.SetActive(!AlreadyPurchased); PurchasedLabel.SetActive(AlreadyPurchased); CoinsCostText.text = Price.ToString(); CoinsCostText.transform.parent.gameObject.SetActive(Price > 0); if (!CanAfford) { CoinsCostText.color = Color.grey; } Button.onClick.RemoveAllListeners(); Button.onClick.AddListener(() => OnSelected?.Invoke(ItemInfo)); Tooltip.m_topic = Localization.instance.Localize(displayName); Tooltip.m_text = Localization.instance.Localize(GetTooltip()); }
public void Popup(int selected, string[] items, OnSelected onSelected) { this.items = items; this.selected = selected; this.onSelected = onSelected; this.Show(); }
public override void OnSelect(BaseEventData eventData) { base.OnSelect(eventData); _isSelectable = true; OnSelected?.Invoke(); }
protected void NotifySelected() { if (OnSelected != null) { OnSelected.Invoke(); } }
private void SearchEntry_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e) { var placeId = placeList[(string)e.SelectedItem]; string url = "https://maps.googleapis.com/maps/api/place/details/xml?placeid={0}&key=AIzaSyCEIQNsuPwizWAWUuC68d1RJNONXXFAQlI"; url = string.Format(url, placeId); System.Net.HttpWebRequest request = System.Net.HttpWebRequest.CreateHttp(url); request.BeginGetResponse((iar) => { Device.BeginInvokeOnMainThread(() => { this.searchEntry.ShowHideListbox(false); this.searchEntry.ForceLayout(); }); System.Net.WebResponse response = ((System.Net.HttpWebRequest)iar.AsyncState).EndGetResponse(iar); var xmlDoc = System.Xml.Linq.XDocument.Load(response.GetResponseStream()); var xmlRoot = (System.Xml.Linq.XElement)xmlDoc.FirstNode; if (xmlRoot.Element("status").Value.Equals("OK")) { var loc = xmlRoot.Element("result").Element("geometry").Element("location"); Location = new GeoCoordinate(double.Parse(loc.Element("lat").Value, Utils.EnCulture), double.Parse(loc.Element("lng").Value, Utils.EnCulture)); OnSelected?.Invoke(this, Location); } }, request); this.searchEntry.ForceLayout(); }
private void Title_MouseDown(object sender, MouseButtonEventArgs e) { if (OnSelected != null) { OnSelected.Invoke(this, this.Path); } }
private void OnClick() { if (WasMarked) { return; } OnSelected.Invoke(this); }
public void OnCancel() { Adapter = new ArrayAdapter <string>(Context, Resource.Layout.spinner_text_view, new string[] { Label }); if (selected.Length > 0) { OnSelected?.Invoke(this, selected); } }
public void SetSelectedSphere(Sphere sphere) { SelectedSphere = sphere; OnSelected?.Invoke(sphere); SceneLoader.Load(SceneLoader.THIRD_SCENE); SceneLoader.MoveGameObjectToScene(sphere.transform.root.gameObject, SceneLoader.THIRD_SCENE); }
public void Select() { Selected = true; CaretIndex = GetCaretIndexFromScreenPos(PlayerInput.MousePosition); ClearSelection(); GUI.KeyboardDispatcher.Subscriber = this; OnSelected?.Invoke(this, Keys.None); }
public void OnPointerEnter(PointerEventData eventData) { if (InputManager.Instance.CurrentInputDevice != InputManager.GameInputDevice.KeyboardAndMouse) { gameObject.GetComponent <Toggle>().isOn = true; OnSelected?.Invoke(this); } }
void IMixedRealityPointerHandler.OnPointerClicked(MixedRealityPointerEventData eventData) { if ((eventData.MixedRealityInputAction == selectAction) && IsLookedAt && ((DateTime.UtcNow - lastTimeClicked).TotalMilliseconds > minTimeoutBetweenClicksInMs)) { lastTimeClicked = DateTime.UtcNow; EyeTrackingTarget.SelectedTarget = this.gameObject; OnSelected.Invoke(); } }
public override void OnSelect(BaseEventData eventData) { base.OnSelect(eventData); if (OnSelected != null) { OnSelected.Invoke(); } }
void SelectorSelectable.Select() { if (Selected) { throw new InvalidOperationException(); } Selected = true; OnSelected?.Invoke(); }
public ResumeGameControl(Game game) : base(game) { Text = "Resume Game"; OnSelected = new OnSelected( () => { ScreenManager.Manager.Pop(); }); }
public void HandleSelection() { IsSelected = true; m_Fill.gameObject.SetActive(true); if (!isSilent) { OnSelected?.Invoke(); onSelected?.Invoke(); } }
public QuitGameControl(Game game) : base(game) { Text = "Quit Game"; OnSelected = new OnSelected(() => { TowerAssault.GameInstance.Exit(); }); }
public ChangeMusicVolumeControl(Game game) : base(game) { Text = "Music Volume"; //hackpology: just testing mouse driven behavior OnSelected = new OnSelected(() => { ; }); }
public ChangeMusicVolumeControl(Game game) : base(game) { Text = "Music Volume"; //hackpology: just testing mouse driven behavior OnSelected = new OnSelected(() => { ; }); }
public QuitGameControl(Game game) : base(game) { Text = "Quit Game"; OnSelected = new OnSelected(() => { TowerAssault.GameInstance.Exit(); }); }
private void Awake() { _toggle.onValueChanged.AddListener(check => { if (check) { OnSelected?.Invoke(_index); } }); }
public StartGameControl(Game game) : base(game) { Text = "Start Game"; OnSelected = new OnSelected( () => { ScreenManager.Manager.Push(new BoilerScreen(game)); }); }
public ResumeGameControl(Game game) : base(game) { Text = "Resume Game"; OnSelected = new OnSelected( () => { ScreenManager.Manager.Pop(); }); }
public QuitGameControl(Game game, Vector2 position) : base(game, position) { Text = "Quit Game"; Font = GameInstance.Content.Load<SpriteFont>("Fonts/MenuFont"); OnSelected = new OnSelected(() => { TowerAssault.GameInstance.Exit(); }); }
public AudioMenuControl(Game game) : base(game) { Text = "Audio Options"; Description = "Use <- and -> to control volume"; OnSelected = new OnSelected( () => { ScreenManager.Manager.Push(new AudioMenu(game)); }); }
public PreviousMenuControl(Game game) : base(game) { Text = "Back"; OnSelected = new OnSelected(() => { //remove the parent screen from the stack; returning //player to previous game screen ScreenManager.Manager.Pop(); }); }
public MenuItem(string text, OnSelected onSelected) { this.text = text; this.onSelected = onSelected; }