void Catalog_OnSelectionChange(int selection) { Holder.ClearSelected(); var item = CurrentCategory[selection]; if (OldSelection != -1) { Catalog.SetActive(OldSelection, false); } Catalog.SetActive(selection, true); if (LotController.CustomControl != null) { LotController.CustomControl.Release(); LotController.CustomControl = null; } if (item.Special != null) { QueryPanel.Active = false; LotController.CustomControl = (UICustomLotControl)Activator.CreateInstance(item.Special.Control, vm, LotController.World, LotController, item.Special.Parameters); } else { BuyItem = vm.Context.CreateObjectInstance(item.GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true); QueryPanel.SetInfo(BuyItem.Objects[0], false); QueryPanel.Mode = 1; QueryPanel.Tab = 0; QueryPanel.Active = true; Holder.SetSelected(BuyItem); } OldSelection = selection; }
private void HolderPickup(UIObjectSelection holding, UpdateState state) { QueryPanel.Mode = 0; QueryPanel.Active = true; QueryPanel.Tab = 1; QueryPanel.SetInfo(LotController.vm, holding.Group.BaseObject, holding.IsBought); }
void Catalog_OnSelectionChange(int selection) { Holder.ClearSelected(); var item = CurrentCategory[selection]; if (LotController.ActiveEntity != null && item.Price > LotController.ActiveEntity.TSOState.Budget.Value) { TSO.HIT.HITVM.Get().PlaySoundEvent(UISounds.Error); return; } if (OldSelection != -1) { Catalog.SetActive(OldSelection, false); } Catalog.SetActive(selection, true); if (LotController.CustomControl != null) { LotController.CustomControl.Release(); LotController.CustomControl = null; } if (item.Special != null) { var res = item.Special.Res; var resID = item.Special.ResID; QueryPanel.SetInfo(res.GetIcon(resID), res.GetName(resID), res.GetDescription(resID), res.GetPrice(resID)); QueryPanel.Mode = 1; QueryPanel.Tab = 0; QueryPanel.Active = true; LotController.CustomControl = (UICustomLotControl)Activator.CreateInstance(item.Special.Control, vm, LotController.World, LotController, item.Special.Parameters); } else { BuyItem = vm.Context.CreateObjectInstance(item.GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true); if (BuyItem != null) { QueryPanel.SetInfo(LotController.vm, BuyItem.Objects[0], false); QueryPanel.Mode = 1; QueryPanel.Tab = 0; QueryPanel.Active = true; Holder.SetSelected(BuyItem); } } OldSelection = selection; }