示例#1
0
        static MountainVoxel()
        {
            // load color palettes
            XmlDocument doc = new XmlDocument();

            doc.Load(ResourceUtil.FindSystemResource("mountainPalette.xml"));
            mountainColors[0] = loadColors((XmlElement)doc.SelectSingleNode("/*/spring"));
            mountainColors[1] = loadColors((XmlElement)doc.SelectSingleNode("/*/summer"));
            mountainColors[2] = loadColors((XmlElement)doc.SelectSingleNode("/*/autumn"));
            mountainColors[3] = loadColors((XmlElement)doc.SelectSingleNode("/*/winter"));
            waterColors       = loadColors((XmlElement)doc.SelectSingleNode("/*/water"));

            initCliffSprites();

            // pre-draw pictures

            for (int tdiff = 0; tdiff <= 8; tdiff++)
            {// tdiff= difference between top and bottom
                int u = Math.Min(tdiff + 2, 6);

                images[tdiff]        = new Surface(32 * (5 - (Math.Abs(tdiff - 4) + 1) / 2), tdiff * 4 + 1 + 2 * 4);
                flippedImages[tdiff] = new Surface(32 * (5 - (Math.Abs(tdiff - 4) + 1) / 2), tdiff * 4 + 1 + 2 * 4);

                int idx = 0;
                for (; u >= tdiff - u; u--, idx++)
                {
                    int offset = idx * 32;
                    // clear the sprite
                    images[tdiff].Fill(new Rectangle(new Point(offset, 0), new Size(32, images[tdiff].Size.Height)), Color.Magenta);
                    flippedImages[tdiff].Fill(new Rectangle(new Point(offset, 0), new Size(32, flippedImages[tdiff].Size.Height)), Color.Magenta);

                    Point[] pts = new Point[] { new Point(offset + 16, 0),
                                                new Point(offset + 32, u * 4),
                                                new Point(offset + 16, tdiff * 4),
                                                new Point(offset + 16, tdiff * 4),
                                                new Point(offset, u * 4),
                                                new Point(offset + 16, 0) };

                    images[tdiff].FillPolygon(mountainColors[0][4], pts);
                    images[tdiff].DrawLines(Color.Black, pts);
                }
                flippedImages[tdiff] = images[tdiff].CreateFlippedVerticalSurface();

                //flippedImages[tdiff].blt(new Point(0,0),tmpSurface);
                //flippedImages[tdiff].sourceColorKey = Color.Magenta;

                //images[tdiff].sourceColorKey = Color.Magenta;
            }
        }
示例#2
0
        private BalanceSheetForm()
        {
            //			this.MdiParent = MainWindowMDI.mainWindow;
            InitializeComponent();

            //            object flags = 0;
            //            object targetFrame = String.Empty;
            //            object postData = String.Empty;
            //            object headers = String.Empty;
            //            webBrowser.Navigate("about:hello", ref flags, ref targetFrame, ref postData, ref headers);

            webBrowser.Navigate("about:blank");
            //webBrowser.docHostUIHandler = new DocHostUIHandlerImpl(this);
            webBrowser.Navigate(ResourceUtil.FindSystemResource("balanceSheet.html"));
        }
示例#3
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            // buy trains
            for (int i = 0; i < (int)count.Value; i++)
            {
                new Train(WorldDefinition.World.RootTrainGroup,
                          (int)length.Value, selectedTrain);
            }

            FreeTrain.Framework.Sound.SoundEffectManager
            .PlaySynchronousSound(ResourceUtil.FindSystemResource("vehiclePurchase.wav"));

            AccountManager.theInstance.spend(getTotalPrice(), AccountGenre.RailService);

            // set count to 0 to avoid accidental purchase
            count.Value = 0;
        }
 private void playSound()
 {
     SoundEffectManager.PlayAsynchronousSound(
         ResourceUtil.FindSystemResource("vehiclePurchase.wav"));
 }