ClearSelected() public method

public ClearSelected ( ) : void
return void
示例#1
0
        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;
        }
示例#2
0
        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;
        }
        public override void Removed()
        {
            //clean up loose ends
            Holder.OnPickup  -= HolderPickup;
            Holder.OnDelete  -= HolderDelete;
            Holder.OnPutDown -= HolderPutDown;

            if (LotController.CustomControl != null)
            {
                LotController.CustomControl.Release();
                LotController.CustomControl = null;
            }

            if (Holder.Holding != null)
            {
                //delete object that hasn't been placed yet
                //TODO: all holding objects should obviously just be ghosts.
                //Holder.Holding.Group.Delete(vm.Context);
                Holder.ClearSelected();
                QueryPanel.Active = false;
            }
            base.Removed();
        }