Ejemplo n.º 1
0
        private void NewButtonClicked(EntitySpawnSelectButton sender, EntityTemplate template, string templateName)
        {
            if (sender.selected)
            {
                sender.selected = false;
                _placementManager.Clear();
                return;
            }

            foreach (
                GuiComponent curr in
                _entityList.components.Where(curr => curr.GetType() == typeof(EntitySpawnSelectButton)))
            {
                ((EntitySpawnSelectButton)curr).selected = false;
            }

            string overrideMode = "";

            if (_lstOverride.CurrentlySelected != null)
            {
                if (_lstOverride.CurrentlySelected.Text.Text != "None")
                {
                    overrideMode = _lstOverride.CurrentlySelected.Text.Text;
                }
            }

            var newObjInfo = new PlacementInformation
            {
                PlacementOption = overrideMode.Length > 0 ? overrideMode : template.PlacementMode,
                EntityType      = templateName,
                Range           = -1,
                IsTile          = false
            };

            _placementManager.BeginPlacing(newObjInfo);

            sender.selected = true; //This needs to be last.
        }
Ejemplo n.º 2
0
        private void NewButtonClicked(EntitySpawnSelectButton sender, EntityTemplate template, string templateName)
        {
            if (sender.selected)
            {
                sender.selected = false;
                _placementManager.Clear();
                return;
            }

            foreach (
                GuiComponent curr in
                    _entityList.components.Where(curr => curr.GetType() == typeof (EntitySpawnSelectButton)))
                ((EntitySpawnSelectButton) curr).selected = false;

            string overrideMode = "";
            if (_lstOverride.CurrentlySelected != null)
                if (_lstOverride.CurrentlySelected.Text.Text != "None")
                    overrideMode = _lstOverride.CurrentlySelected.Text.Text;

            var newObjInfo = new PlacementInformation
                                 {
                                     PlacementOption = overrideMode.Length > 0 ? overrideMode : template.PlacementMode,
                                     EntityType = templateName,
                                     Range = -1,
                                     IsTile = false
                                 };

            _placementManager.BeginPlacing(newObjInfo);

            sender.selected = true; //This needs to be last.
        }