コード例 #1
0
        private void BuildButtonToggled(BaseButton.ButtonToggledEventArgs args)
        {
            if (args.Pressed)
            {
                if (_selected == null)
                {
                    return;
                }

                var constructSystem = EntitySystem.Get <ConstructionSystem>();

                if (_selected.Type == ConstructionType.Item)
                {
                    constructSystem.TryStartItemConstruction(_selected.ID);
                    _buildButton.Pressed = false;
                    return;
                }

                _placementManager.BeginPlacing(new PlacementInformation()
                {
                    IsTile          = false,
                    PlacementOption = _selected.PlacementMode,
                }, new ConstructionPlacementHijack(constructSystem, _selected));
            }
            else
            {
                _placementManager.Clear();
            }

            _buildButton.Pressed = args.Pressed;
        }
コード例 #2
0
        private void OnItemButtonToggled(BaseButton.ButtonToggledEventArgs args)
        {
            var item = (TileSpawnButton)args.Button.Parent;

            if (SelectedButton == item)
            {
                SelectedButton = null;
                placementManager.Clear();
                return;
            }
            else if (SelectedButton != null)
            {
                SelectedButton.ActualButton.Pressed = false;
            }

            SelectedButton = null;

            var newObjInfo = new PlacementInformation
            {
                PlacementOption = "AlignTileAny",
                TileType        = tileDefinitionManager[item.TileDef].TileId,
                Range           = 400,
                IsTile          = true
            };

            placementManager.BeginPlacing(newObjInfo);
            SelectedButton = item;
        }
コード例 #3
0
        private void OnOverrideMenuItemSelected(OptionButton.ItemSelectedEventArgs args)
        {
            OverrideMenu.SelectId(args.Id);

            if (placementManager.CurrentMode != null)
            {
                var newObjInfo = new PlacementInformation
                {
                    PlacementOption = initOpts[args.Id],
                    EntityType      = placementManager.CurrentPermission.EntityType,
                    Range           = 2,
                    IsTile          = placementManager.CurrentPermission.IsTile
                };

                placementManager.Clear();
                placementManager.BeginPlacing(newObjInfo);
            }
        }
コード例 #4
0
        private void TileListOnOnItemDeselected(ItemList.ItemListDeselectedEventArgs args)
        {
            if (_clearingSelections)
            {
                return;
            }

            _placementManager.Clear();
        }
コード例 #5
0
        private void _lstOverride_ItemSelected(Label item, Listbox sender)
        {
            var pMan = (PlacementManager)_placementManager;

            if (pMan.CurrentMode != null)
            {
                var newObjInfo = new PlacementInformation
                {
                    PlacementOption = item.Text.Text,
                    EntityType      = pMan.CurrentPermission.EntityType,
                    Range           = -1,
                    IsTile          = pMan.CurrentPermission.IsTile
                };

                _placementManager.Clear();
                _placementManager.BeginPlacing(newObjInfo);
            }
        }