Пример #1
0
        public object ShowTrades(bool giveControl = true)
        {
            Dictionary <string, PairValue> options = new Dictionary <string, PairValue>();
            bool empty = true;

            foreach (ITrader t in ActiveTraders)
            {
                foreach (IPhysical s in t.Trades.Keys)
                {
                    options.Add(string.Format("│{0,-15}│{1,-10}│{2,-15}│{3,10} $│", t.Name, s.GetType().Name, s.GetSpecs(), t.Trades[s]),
                                new PairValue(new TraderItem(t, s, t.Trades[s])));
                    empty = false;
                }
            }
            if (!empty)
            {
                OptionTable ot = new OptionTable(options, new System.Drawing.Point(0, 0), 100, 18);
                ot.Draw();
                if (giveControl)
                {
                    return(ot.GiveControl());
                }
            }
            else
            {
                var popup = new g.Popup("No trades here!");
                popup.GiveControl();
            }
            return(null);
        }
Пример #2
0
        public static object ShowPlanets(bool giveControl = true)
        {
            Dictionary <string, PairValue> options = new Dictionary <string, PairValue>();

            foreach (PlanetarySystem ps in Systems)
            {
                for (int i = 0; i < ps.Planets.Count; i++)
                {
                    options.Add(string.Format("│{0,-15}│{1,-15}│{2,7} ly│", ps[i].Name, ps.Name, ((ILocatable)ps).GetDistanceFrom(Player.MainSpaceship.Location)),
                                new PairValue(ps[i]));
                }
            }
            OptionTable ot = new OptionTable(options, new Point(0, 0), 100, 40);

            ot.Draw();
            if (giveControl)
            {
                return(ot.GiveControl());
            }
            return(null);
        }