Пример #1
0
    public bool worldmap_coords_clicked(MouseEventArgs e, int x, int y)
    {
        int GameX = Display.PixelToGameCoords(x);
        int GameY = Display.PixelToGameCoords(y);

        if (Control.ModifierKeys == Keys.Control && e.Button == MouseButtons.Left)
        {
            ActionDone = true;

            if (Control.MouseButtons == MouseButtons.Right)
            {
                if (CurrentRoute == null)
                {
                    MessageBox.Show("No route currently constructed.");
                    return(false);
                }
                else
                {
                    CurrentRoute.WayPoints = new List <TrainWaypoint>();
                }
            }
            //MessageBox.Show("Left with ctrl.");
            if (CurrentRoute == null)
            {
                TrainRoute route = CreateRoute();
                if (route == null)
                {
                    return(false);
                }
                route.WayPoints = new List <TrainWaypoint>();
                CurrentRoute    = route;
                //Routes.Add(route);
            }
            TrainWaypoint wp = CreateWaypoint(GameX, GameY);
            if (wp == null || CurrentRoute == null)
            {
                return(false);
            }
            CurrentRoute.WayPoints.Add(wp);
            ScriptGlobal.RefreshWorldMap();
            return(true);
        }
        if (Control.ModifierKeys == Keys.Control && e.Button == MouseButtons.Right)
        {
            TrainWaypoint wp = GetWaypoint(GameX, GameY);
            if (wp == null)
            {
                return(false);
            }
            DeleteWaypoint(wp);
            ScriptGlobal.RefreshWorldMap();
            return(true);
        }

        return(false);
    }
Пример #2
0
    public void main_form_loaded()
    {
        FormLoaded = true;
        ToolStripMenuItem SaveMenuItem = new ToolStripMenuItem("Save Train Routes");

        SaveMenuItem.Click += SaveRoutes_Click;

        foreach (ToolStripMenuItem Item in MainForm.MainMenuStrip.Items)
        {
            if (Item.Name == "fileToolStripMenuItem")
            {
                Item.DropDownItems.Insert(2, SaveMenuItem);
            }
        }
        LoadRoutes();

        ScriptGlobal.RefreshWorldMap();
        GetControl("pnlWorldMap").Focus();
    }
Пример #3
0
 public void resources_loaded()
 {
     ScriptGlobal.RefreshWorldMap();
 }