Example #1
0
        void initDraw()
        {
            var cent = 0.5f * world.TileGrid.UVToScreen(new Point(world.TileGrid.U_length - 1, world.TileGrid.V_length - 1));

            activeCam = new Camera(graphicsDevice.Viewport);
            //ActiveCam.Target = Vector2.Zero;
            activeCam.Target = cent; //target camera on center of tile grid
            activeCam.Zoom   = 85f;

            Vector2 bounds = new Vector2(graphicsDevice.PresentationParameters.BackBufferWidth, graphicsDevice.PresentationParameters.BackBufferHeight);

            miniMapRect = ResourceManager.Resources["Settings"]["Minimap"];
            miniMapRect = new Rectangle(graphicsDevice.PresentationParameters.BackBufferWidth - miniMapRect.Width -
                                        miniMapRect.X,
                                        graphicsDevice.PresentationParameters.BackBufferHeight - miniMapRect.Height - miniMapRect.Y,
                                        miniMapRect.Width,
                                        miniMapRect.Height);

            miniMapCam = new Camera(new Viewport(miniMapRect));

            UISettings.ResourceInfoOffset += bounds;

            SolidButton miniMapButton = new SolidButton(new Vector2(miniMapRect.X, miniMapRect.Y), miniMapRect.Width, miniMapRect.Height);

            miniMapButton.ActiveColor   = Color.Transparent;
            miniMapButton.InactiveColor = Color.Transparent;
            miniMapButton.MouseDrag    += new MouseOverEventHandler(miniMapButton_MouseDrag);
            UIMan.AddControl(miniMapButton);
        }
Example #2
0
        void but_ButtonPressed(SolidButton sender)
        {
            int index = buts.IndexOf(sender);

            if (ItemPressed != null && index != -1)
            {
                ItemPressed(index);
            }
        }
Example #3
0
        void addHost(IPEndPoint server)
        {
            SolidButton newHostBut = new SolidButton(hlistStart, 400, 50);

            newHostBut.Text           = server.ToString();
            newHostBut.MouseLeftDown += new MouseClickEventHandler(mPos => tryConnect(server));
            UIMan.AddControl(newHostBut);

            hlistStart += Vector2.UnitY * (newHostBut.Height + 0);
        }
Example #4
0
        public override void Init()
        {
            ResourceManager.BaseGame.IsMouseVisible = true;

            spriteBatch = new SpriteBatch(this.GraphicsDevice);

            cent = new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth / 2, GraphicsDevice.PresentationParameters.BackBufferHeight / 2);

            //
            //UI
            //

            UIMan.KeyDown += new KeyPressEventHandler(UIMan_KeyDown);

            SolidButton b1 = new SolidButton(new Vector2(100, 100), 300, 100);

            b1.Text           = "map test state";
            b1.MouseLeftDown += new MouseClickEventHandler(b1_MouseLeftDown);

            SolidButton b2 = new SolidButton(new Vector2(100, 250), 300, 100);

            b2.Text           = "test LOS state";
            b2.MouseLeftDown += new MouseClickEventHandler(b2_MouseLeftDown);

            SolidButton mainBut = new SolidButton(new Vector2(100, 400), 330, 100);

            mainBut.Text           = "god mode";
            mainBut.ButtonPressed += new ButtonPressedEventHandler(mainBut_ButtonPressed);

            SolidButton sBut = new SolidButton(new Vector2(100, 550), 100, 100);

            sBut.Text           = "server";
            sBut.MouseLeftDown += new MouseClickEventHandler(sBut_MouseLeftDown);

            SolidButton cBut = new SolidButton(new Vector2(250, 550), 100, 100);

            cBut.Text           = "lobby";
            cBut.MouseLeftDown += new MouseClickEventHandler(cBut_MouseLeftDown);


            UIMan.AddControl(b2);
            UIMan.AddControl(mainBut);
            UIMan.AddControl(b1);
            UIMan.AddControl(sBut);
            UIMan.AddControl(cBut);
        }
Example #5
0
        public override void Init()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            UIMan          = new UIManager();
            UIMan.KeyDown += new KeyPressEventHandler(UIMan_KeyDown);

            text       = new Text(new Vector2(50, GraphicsDevice.PresentationParameters.BackBufferHeight - 50), "find and select a host");
            text.Color = Color.Red;
            UIMan.AddControl(text);

            SolidButton hostsBut = new SolidButton(Vector2.One * 50, 200, 75);

            hostsBut.Text           = "find hosts";
            hostsBut.MouseLeftDown += new MouseClickEventHandler(hostsBut_MouseLeftDown);

            UIMan.AddControl(hostsBut);
            hlistStart = hostsBut.Position + Vector2.UnitY * (hostsBut.Height + 100);

            SolidButton jHuman = new SolidButton(new Vector2(500, 50), 200, 100);

            jHuman.Text           = "reg as Human";
            jHuman.MouseLeftDown += new MouseClickEventHandler(jHuman_MouseLeftDown);
            UIMan.AddControl(jHuman);

            SolidButton jWumpus = new SolidButton(new Vector2(750, 50), 200, 100);

            jWumpus.Text           = "reg as Wumpus";
            jWumpus.MouseLeftDown += new MouseClickEventHandler(jWumpus_MouseLeftDown);
            UIMan.AddControl(jWumpus);

            SolidButton fBut = new SolidButton(new Vector2(750, 250), 200, 100);

            fBut.Text           = "start!";
            fBut.MouseLeftDown += new MouseClickEventHandler(fBut_MouseLeftDown);
            UIMan.AddControl(fBut);

            NetPeerConfiguration config = new NetPeerConfiguration("omron");

            config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
            client = new NetClient(config);
            client.Start();
        }
Example #6
0
        public void SetItems(string[] items)
        {
            if (shown)
            {
                Hide();
            }
            buts.Clear();
            Vector2 lSize    = new Vector2(iW, iH);
            int     interval = 10;
            Vector2 nextLoc  = new Vector2(X, Y);

            foreach (string lab in items)
            {
                SolidButton but = new SolidButton(nextLoc, lSize.X, lSize.Y, "UnitMenuFont");
                but.Text           = lab;
                but.ButtonPressed += new ButtonPressedEventHandler(but_ButtonPressed);
                buts.Add(but);
                nextLoc.X += interval + lSize.X;
            }
        }
Example #7
0
 void mainBut_ButtonPressed(SolidButton sender)
 {
     GameEngine.PushState(new OmronMainStageV1());
 }