protected virtual void HoverItem(PsionicSelectorItem item) { if (item != null) { this._moduleInfo.SetPsionic(item.Psionic); } else { this._moduleInfo.SetPsionic((LogicalPsionic)null); } }
protected virtual void SelectItem(string panelID, bool eventCallback, bool rightClicked) { PsionicSelectorItem psionicSelectorItem; if (panelID == null || !this._items.TryGetValue(panelID, out psionicSelectorItem) || this._selectedItem == psionicSelectorItem) { return; } this._selectedItem = psionicSelectorItem; if (!eventCallback || this.SelectedPsionicChanged == null) { return; } this.SelectedPsionicChanged((object)this, rightClicked); }
public void SetAvailablePsionics( IEnumerable <LogicalPsionic> modules, LogicalPsionic selected, bool enableSelection = true) { if (enableSelection) { this._page.DetachItems(); } this.DisposeItems(); this._items.Clear(); foreach (PsionicSelectorItem psionicSelectorItem in modules.Select <LogicalPsionic, PsionicSelectorItem>((Func <LogicalPsionic, PsionicSelectorItem>)(module => new PsionicSelectorItem(this.UI, Guid.NewGuid().ToString(), module)))) { this._items[psionicSelectorItem.ID] = psionicSelectorItem; } if (enableSelection) { PsionicSelectorItem psionicSelectorItem1 = new PsionicSelectorItem(this.UI, Guid.NewGuid().ToString(), new LogicalPsionic() { Name = "No Psionic", PsionicTitle = "No Psionic", Description = "The selected psionic slot will be empty.", Icon = "moduleicon_no_selection" }); this._items[psionicSelectorItem1.ID] = psionicSelectorItem1; bool flag = false; if (selected != null) { PsionicSelectorItem psionicSelectorItem2 = this._items.Values.FirstOrDefault <PsionicSelectorItem>((Func <PsionicSelectorItem, bool>)(x => x.Psionic == selected)); if (psionicSelectorItem2 != null) { this.HoverItem(psionicSelectorItem2); flag = true; } } if (!flag) { this.HoverItem(psionicSelectorItem1); } } this._page.ReplaceItems((IEnumerable <PsionicSelectorItem>) this._items.Values, enableSelection); }