SetSelected() public method

public SetSelected ( FSO.SimAntics.Entities.VMMultitileGroup Group ) : void
Group FSO.SimAntics.Entities.VMMultitileGroup
return void
Example #1
0
        void Catalog_OnSelectionChange(int selection)
        {
            var item = CurrentCategory[selection];

            if (LotController.ActiveEntity != null && item.Price > LotController.ActiveEntity.TSOState.Budget.Value)
            {
                HIT.HITVM.Get().PlaySoundEvent(Model.UISounds.Error);
                return;
            }

            if (OldSelection != -1)
            {
                Catalog.SetActive(OldSelection, false);
            }
            Catalog.SetActive(selection, true);
            BuyItem = vm.Context.CreateObjectInstance(item.GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true);
            if (BuyItem == null)
            {
                return;                  //uh
            }
            QueryPanel.SetInfo(LotController.vm, BuyItem.Objects[0], false);
            QueryPanel.Mode   = 1;
            QueryPanel.Tab    = 0;
            QueryPanel.Active = true;
            Holder.SetSelected(BuyItem);
            OldSelection = selection;
        }
Example #2
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;
        }
Example #3
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;
        }
Example #4
0
 void Catalog_OnSelectionChange(int selection)
 {
     if (OldSelection != -1)
     {
         Catalog.SetActive(OldSelection, false);
     }
     Catalog.SetActive(selection, true);
     BuyItem = vm.Context.CreateObjectInstance(CurrentCategory[selection].GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true);
     if (BuyItem == null)
     {
         return;                  //uh
     }
     QueryPanel.SetInfo(BuyItem.Objects[0], false);
     QueryPanel.Mode   = 1;
     QueryPanel.Tab    = 0;
     QueryPanel.Active = true;
     Holder.SetSelected(BuyItem);
     OldSelection = selection;
 }
        protected virtual void Catalog_OnSelectionChange(int selection)
        {
            if (BuyItem != null)
            {
                var baseObj = BuyItem.BaseObject;
                if (baseObj != null)
                {
                    var guid  = (baseObj.MasterDefinition ?? baseObj.Object.OBJ).GUID;
                    var level = (baseObj.PlatformState as VMTSOObjectState)?.UpgradeLevel ?? 0;
                    UpgradeLevelMemory[guid] = level;
                }
            }
            Holder.ClearSelected();
            var item = CurrentCategory[selection];

            if (LotController.ActiveEntity != null && item.CalcPrice > LotController.ActiveEntity.TSOState.Budget.Value)
            {
                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;
                if (res != null && res.GetName(resID) != "")
                {
                    QueryPanel.SetInfo(res.GetThumb(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, LotController.vm, LotController.World, LotController, item.Special.Parameters);
            }
            else
            {
                BuyItem = LotController.vm.Context.CreateObjectInstance(item.Item.GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true);
                if (item.Attributes != null)
                {
                    for (int i = 0; i < item.Attributes.Count; i++)
                    {
                        BuyItem.BaseObject.SetAttribute(i, (short)item.Attributes[i]);
                    }
                }
                byte upgradeLevel = 0;

                float?price = null;
                if (UpgradeLevelMemory.TryGetValue(item.Item.GUID, out upgradeLevel) && upgradeLevel > 0)
                {
                    price = UpgradeBuyItem(item.Item.GUID, upgradeLevel);
                }
                // token objects should not be placable.
                if (item.Item.DisableLevel < 3)
                {
                    Holder.SetSelected(BuyItem);
                }
                QueryPanel.SetInfo(LotController.vm, BuyItem.BaseObject, false);
                QueryPanel.Mode   = 1;
                QueryPanel.Tab    = 0;
                QueryPanel.Active = true;
            }

            OldSelection = selection;
        }