コード例 #1
0
 static void TooltipFactory_ItemCommons_Postfix(StringBuilder sb, TechType techType, GameObject obj)
 {
     if (techType == TechType.Beacon)
     {
         TooltipFactory.WriteDescription(sb, $"{L10n.str(L10n.ids_beaconName)}: \"{obj.GetComponent<Beacon>().label}\"");
     }
 }
コード例 #2
0
 static void TooltipFactory_ItemActions_Postfix(StringBuilder sb, InventoryItem item)
 {
     if (item.item.GetTechType() == TechType.MetalDetector && item.item.GetComponent <MetalDetector>()?.energyMixin?.charge > 0)
     {
         TooltipFactory.WriteAction(sb, buttons, L10n.str("ids_metalDetectorSwitchTarget"));
     }
 }
コード例 #3
0
 static void Postfix(StringBuilder sb, TechType techType, GameObject obj)
 {
     if (techType == TechType.Flare && obj.GetComponent <Flare>().hasBeenThrown)
     {
         TooltipFactory.WriteDescription(sb, "[lighted]");
     }
 }
コード例 #4
0
 static void Postfix(StringBuilder sb, InventoryItem item)
 {
     if (item.item.GetTechType() == TechType.Beacon)
     {
         TooltipFactory.WriteAction(sb, Strings.Mouse.middleButton, L10n.str(L10n.ids_rename));
     }
 }
コード例 #5
0
        public static PaneQueryable getRicettaPane()
        {
            List <ImageNode> images = new List <ImageNode>();

            images.Add(new InsertNode((a, b) =>
            {
                MainPaneGestor.getInstance().setPanel(InsertPaneFactory.getInsertRicetta());
                MainPaneGestor.getInstance().disableShowingSearch();
            }));
            ToolTip ricettaTip = TooltipFactory.createBasicTooltip("Ricetta");

            (from c in RicettarioDB.getInstance().Ricetta
             select c).ToList().ForEach(x =>
            {
                images.Add(getImageNode(x, new Bitmap(x.Immagine), ricettaTip));
            });
            searchElement action = x =>
            {
                List <Ricetta> list = (from c in RicettarioDB.getInstance().Ricetta
                                       where SqlMethods.Like(c.Nome, "%" + x + "%")
                                       select c).ToList();
                List <Control> result = new List <Control>();

                list.ForEach(z =>
                {
                    result.Add((getImageNode(z, new Bitmap(z.Immagine), ricettaTip)).getImage());
                });
                return(result);
            };

            return(new SimplePaneImage(images, nodeFactory.createNodeFilter(), action));
        }
コード例 #6
0
 static void TooltipFactory_ItemActions_Postfix(StringBuilder sb, InventoryItem item)
 {
     if (item == getTankInSlot())
     {
         TooltipFactory.WriteAction(sb, Strings.Mouse.rightButton, L10n.str("ids_ToggleTankUsage"));
     }
 }
コード例 #7
0
 static void TooltipFactory_ItemCommons_Postfix(StringBuilder sb, GameObject obj)
 {
     if (getTankInSlot()?.item.gameObject == obj && !isTankUsed(obj.GetComponent <Oxygen>()))
     {
         TooltipFactory.WriteDescription(sb, L10n.str("ids_TankIsNotUsed"));
     }
 }
コード例 #8
0
 static void Postfix(StringBuilder sb, InventoryItem item)
 {
     if (item.item.GetTechType().isGravTrap())
     {
         TooltipFactory.WriteAction(sb, buttons, L10n.str("ids_switchObjectsType"));
     }
 }
コード例 #9
0
        public MenuSelection(int idMenu)
        {
            InitializeComponent();
            this.Icon   = Properties.Resources.iconmain;
            this.idMenu = idMenu;
            this.tableLayoutPanel1.Dock = DockStyle.Fill;
            this.menu.TextAlign         = ContentAlignment.MiddleCenter;
            this.StartPosition          = FormStartPosition.CenterParent;
            Menù menu = (from m in RicettarioDB.getInstance().Menù
                         where m.idMenù == idMenu
                         select m).First();

            this.menu.Text         = menu.Nome;
            this.tipo.Text         = "Tipo :" + menu.Tipo;
            this.immageGestor.Dock = DockStyle.Top;
            ToolTip ricettaTip = TooltipFactory.createBasicTooltip("Ricette");

            menu.Assemblaggio.ToList().ForEach(x =>
            {
                PictureBox picture = new PictureBox();
                picture.Size       = new Size(100, 100);
                picture.Image      = new Bitmap(x.Ricetta.Immagine);
                picture.SizeMode   = PictureBoxSizeMode.StretchImage;
                this.immageGestor.Controls.Add(picture);
                ricettaTip.SetToolTip(picture, "Nome " + x.Ricetta.Nome +
                                      "\nPortata " + x.Ricetta.portata +
                                      "\nPersone = " + x.Ricetta.Persone);
                picture.Click += (obj, arg) => new RicettaVisualizzation(x.Ricetta.idRicetta).ShowDialog();
            });
        }
コード例 #10
0
        internal static void ItemActions_Postfix(StringBuilder sb, InventoryItem item)
        {
            TechType itemTechType  = item.item.GetTechType();
            bool     hasLeftAction = false;

            if (LeftClickActions.TryGetValue(itemTechType, out CustomItemAction action))
            {
                if (action.Condition(item))
                {
                    sb.Append("\n");
                    TooltipFactory.WriteAction(sb, LeftClickMouseIcon, Language.main.Get(action.LanguageLineKey));
                    hasLeftAction = true;
                }
            }

            if (MiddleClickActions.TryGetValue(itemTechType, out action))
            {
                if (action.Condition(item))
                {
                    if (!hasLeftAction)
                    {
                        sb.Append("\n");
                    }
                    TooltipFactory.WriteAction(sb, MiddleClickMouseIcon, Language.main.Get(action.LanguageLineKey));
                }
            }
        }
コード例 #11
0
        private static void ItemCommonsPrefix(StringBuilder sb, TechType techType, GameObject obj)
        {
            IBattery component4 = obj.GetComponent <IBattery>();

            if (component4 != null)
            {
                TooltipFactory.WriteDescription(sb, Language.main.Get(TooltipFactory.techTypeTooltipStrings.Get(techType)));
            }
        }
コード例 #12
0
 public static void Postfix(bool locked, ref TooltipData data)
 {
     if (locked && GameModeUtils.RequiresBlueprints())
     {
         data.prefix.Clear();
         TooltipFactory.WriteTitle(data.prefix, Main.Config.UnKnownTitle);
         TooltipFactory.WriteDescription(data.prefix, Main.Config.UnKnownDescription);
     }
 }
コード例 #13
0
        public static bool GetInventoryDescription(StringBuilder sb, GameObject obj)
        {
            var component = obj.GetComponent <IInventoryDescriptionSN1>();

            if (component != null)
            {
                TooltipFactory.WriteDescription(sb, component.GetInventoryDescription());
                return(false);
            }
            return(true);
        }
コード例 #14
0
            static void Postfix(StringBuilder sb, TechType techType, GameObject obj)
            {
                if (!techType.isGravTrap())
                {
                    return;
                }

                var objectsType = GravTrapObjectsType.getFrom(obj);

                objectsType.techTypeListIndex += TypeListSwitcher.getChangeListDir();
                TooltipFactory.WriteDescription(sb, objectsType.techTypeListName);
            }
        public static void Postfix(ref StringBuilder sb, TechType techType)
        {
            PDAScanner.EntryData entryData = PDAScanner.GetEntryData(techType);
            if (entryData == null || PDAScanner.ContainsCompleteEntry(techType) || CrafterLogic.IsCraftRecipeUnlocked(techType))
            {
                return;
            }

            sb.Clear();
            TooltipFactory.WriteTitle(sb, Main.config.UnKnownTitle);
            TooltipFactory.WriteDescription(sb, Main.config.UnKnownDescription);
        }
コード例 #16
0
        public static void Postfix(bool locked, ref string tooltipText)
        {
            var stringBuilder = new StringBuilder();

            if (!locked || !GameModeUtils.RequiresBlueprints())
            {
                return;
            }
            TooltipFactory.WriteTitle(stringBuilder, Main.Config.UnKnownTitle);
            TooltipFactory.WriteDescription(stringBuilder, Main.Config.UnKnownDescription);
            tooltipText = stringBuilder.ToString();
        }
コード例 #17
0
            static void TooltipFactory_ItemCommons_Postfix(StringBuilder sb, TechType techType, GameObject obj)
            {
                if (techType != TechType.MetalDetector)
                {
                    return;
                }

                if (obj.GetComponent <MetalDetector>() is MetalDetector md && md.energyMixin?.charge > 0)
                {
                    changeTarget(md, InputHelper.getMouseWheelDir());
                    TooltipFactory.WriteDescription(sb, L10n.str("ids_metalDetectorTarget") + getCurrentTarget(md));
                }
            }
コード例 #18
0
            static void Postfix(StringBuilder sb, TechType techType, GameObject obj)
            {
                if (!techType.isGravTrap())
                {
                    return;
                }

                if (Main.config.useWheelScroll && InputHelper.getMouseWheelValue() != 0f)                 // not exactly right to do it here, but I didn't find a better way
                {
                    GravTrapObjectsType.getFrom(obj).techTypeListIndex += Math.Sign(InputHelper.getMouseWheelValue());
                }

                TooltipFactory.WriteDescription(sb, GravTrapObjectsType.getFrom(obj).techTypeListName);
            }
コード例 #19
0
            static void TooltipFactory_ItemActions_Postfix(StringBuilder sb, InventoryItem item)
            {
                if (item.item.GetTechType() != TechType.Beacon)
                {
                    return;
                }

                string btn = Main.config.renameBeaconsKey == default? Strings.Mouse.middleButton: KeyCodeUtils.KeyCodeToString(Main.config.renameBeaconsKey);

                TooltipFactory.WriteAction(sb, btn, L10n.str(L10n.ids_beaconRename));

                if (Main.config.renameBeaconsKey != default && Input.GetKeyDown(Main.config.renameBeaconsKey))
                {
                    renameBeacon(item.item.GetComponent <Beacon>());
                }
            }
コード例 #20
0
        public RicettaVisualizzation(int idRicetta)
        {
            InitializeComponent();
            this.Icon = Properties.Resources.iconmain;
            //modifica stile schermata : pulsanti
            this.idRicetta         = idRicetta;
            this.forward.BackColor = Color.Transparent;
            this.back.BackColor    = Color.Transparent;
            this.forward.FlatStyle = FlatStyle.Flat;
            this.back.FlatStyle    = FlatStyle.Flat;
            this.StartPosition     = FormStartPosition.CenterParent;
            //descrizione
            //prendo la ricetta selezionata
            Ricetta ricetta = new Ricetta();

            ricetta                   = (from r in db.Ricetta where r.idRicetta == idRicetta select r).First();
            this.desc.Text            = ricetta.Descrizione;
            this.desc.ReadOnly        = true;
            this.descrizione.ReadOnly = true;
            this.back.Enabled         = false;
            this.forward.Enabled      = false;
            this.ricettaNome.Text     = ricetta.Nome;
            this.immagine.SizeMode    = PictureBoxSizeMode.StretchImage;
            List <RicettaStrumento> rsRicetta = ricetta.RicettaStrumento.ToList();
            int count = 0;

            //Creazione tabella ricetta strumento
            rsData.AutoGenerateColumns       = false;
            rsData.RowHeadersVisible         = false;
            rsData.MultiSelect               = false;
            rsData.SelectionMode             = DataGridViewSelectionMode.FullRowSelect;
            rsData.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.AllCells;
            rsData.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            rsRicetta.ForEach(x =>
            {
                String ricettaStrumento = "Strumenti utilizzati:\n";
                x.Utilizzo.ToList().ForEach(z => ricettaStrumento = ricettaStrumento + z.Strumento.Nome + "\n");
                ricettaStrumento = ricettaStrumento + "Kcal = " + x.Kcal;
                ricettaStrumento = ricettaStrumento + "\nCaratteristiche: \n";
                x.Definito.ToList().ToList().ForEach(z => ricettaStrumento = ricettaStrumento + z.Caratteristica.Nome + " ,");
                ListViewItem item = new ListViewItem(ricettaStrumento);
                this.rsData.Rows.Add();
                this.rsData.Rows[count++].Cells[0].Value = ricettaStrumento;
            });
            this.ingrTot.View            = View.List;
            this.rsData.RowStateChanged += (obj, args) =>
            {
                this.ingrTot.Items.Clear();
                if (args.StateChanged == DataGridViewElementStates.Selected && args.Row.Index != count)
                {
                    rsRicetta[args.Row.Index].Presenta.ToList().ForEach(x => {
                        String ingr = (from ing in db.Ingrediente where ing.idIngrediente == x.idIngrediente select ing.Nome).First();
                        ingr       += " " + x.NomeUDM;
                        ingr       += " " + x.Quantità;
                        this.ingrTot.Items.Add(ingr);
                    });
                    stepToShow = rsRicetta[args.Row.Index].Step.ToList();
                    this.stepToShow.Sort((x, y) => x.NumOrdine - y.NumOrdine);
                    this.indexStep = 0;
                    this.refreshStep();
                }
            };

            this.strumStep.SelectedIndexChanged += (obj, arg) =>
            {
                if (this.strumStep.SelectedItem != null)
                {
                    new StrumentoVisualizzation(this.strumenti[this.strumStep.SelectedIndex]).ShowDialog();
                }
            };

            ToolTip tip = TooltipFactory.createBasicTooltip("Alternative:");

            this.ingrStep.SelectedIndexChanged += (obj, arg) =>
            {
                if (this.ingrStep.SelectedItem != null)
                {
                    string alternative = "";
                    (from alt in db.Alternativo
                     where alt.idIngrediente == idRicette[this.ingrStep.SelectedIndex]
                     select alt.Ingrediente1).ToList().ForEach(z => alternative += z.Nome + ",");
                    Point p = ingrStep.FindForm().PointToClient(
                        ingrStep.Parent.PointToScreen(ingrStep.Location));

                    tip.Show(alternative, this, new Point(p.X, p.Y));
                }
            };
            this.ingrStep.MouseLeave          += (obj, args) => tip.Hide(this);
            this.ingrStep.HorizontalScrollbar  = true;
            this.strumStep.HorizontalScrollbar = true;
            this.forward.Click += (obj, args) => { this.indexStep++; this.refreshStep(); };
            this.back.Click    += (obj, args) => { this.indexStep--; this.refreshStep(); };
        }