public void AddFrame(Frame frame)
 {
     if (ActiveFrame != null)
         ActiveFrame.OnLoseControl(ActiveFrame);
     _frames.Add(frame);
     frame.BindToGUIEngine(this);
     ActiveFrame.OnGainControl(ActiveFrame);
 }
        public void Disconnect()
        {
            Client = null;

            Stop = null;
            Move = null;
            Jump = null;
            Shoot = null;
            SwitchPhysicsGun = null;
            EnterPortal = null;
            ManipulatePhysics = null;
            ChangePhysicsGunSettings = null;
        }
        public void Connect(Frame client)
        {
            Client = client;

            // if Client := Windows Client
            Client.KeyDown += new KeyEventHandler(HandleKeydownEvents);
            Client.KeyUp += new KeyEventHandler(HandleKeyupEvents);
            Client.MouseClick += new MouseEventHandler(HandleMouseClickEvents);
            Client.MouseScroll += new MouseEventHandler(HandleMouseScrollEvents);
            Client.MouseDown += new MouseEventHandler(Client_MouseDown);

            // else if Client := Xbox Client
            //      **Not Yet Implemented**
        }
        private void InitUI()
        {
            var frame = new Frame();
            weaponPowerLabel = new HuntTheWumpus.UICore.Controls.Label(Vector2.Zero, ActiveProfile.PhysicsWeaponInventory.WeaponPower.ToString());
            weaponPowerLabel.Initialize();
            frame.AddControl(weaponPowerLabel);
            UIManager.AddAndLoad(frame);

            foreach (Actor actor in ActiveMap.GameObjects)
            {
                if (actor.NoTexture)
                {
                    PolyBody body = (PolyBody)actor.PolyBody;
                        body.tex = GraphicsGenerator.GenerateTexFromPolygon(body);
                }
            }

            GameControler.Singleton.Connect(UIManager.ActiveFrame);
            UIManager.ActiveFrame.KeyUp += new KeyEventHandler(ActiveFrame_KeyUp);

            GameControler.Singleton.Move += new GameControler.PlayerEventHandler(PlayerMove);
            GameControler.Singleton.Stop += new GameControler.PlayerEventHandler(PlayerStop);
            GameControler.Singleton.EnterPortal += new GameControler.InteractEventHandler(EnterPortal);
            GameControler.Singleton.ChangePhysicsGunSettings += new GameControler.PlayerEventHandler(ChangePhysicsGunSettings);
            GameControler.Singleton.SwitchPhysicsGun += new GameControler.PlayerEventHandler(SwitchPhysicsGun);
            GameControler.Singleton.Jump += new GameControler.PlayerEventHandler(PlayerJump);
            GameControler.Singleton.ManipulatePhysics += new GameControler.ManipulatePhysicsEventHandler(ManipulatePhysics);
        }
        private void InitUI()
        {
            Size currentWindowSize = (Size)Utilities.DefaultSettings.Settings["WindowSize"];
            var frame = new Frame();
            //weaponPowerLabel = new HuntTheWumpus.UICore.Controls.Label(Vector2.Zero, ActiveProfile.PhysicsWeaponInventory.WeaponPower.ToString());
            //weaponPowerLabel.Initialize();
            powerBar = new PowerBar();
            Label powerBarTitle = new Label(new Vector2(0, 35), "Power");
            powerBarTitle.Initialize();
            energyBar = new EnergyBar();
            Label energyBarTitle = new Label(new Vector2(0, 50), "Energy");
            energyBarTitle.Initialize();
            Label playerNameTitle = new Label(new Vector2(currentWindowSize.X/2 - 100, 10),"Player Name: ");
            Label playerName = new Label(new Vector2(currentWindowSize.X/2 + 30, 10), ActiveProfile.ID);

               _backGroundMusic.pickBackgroundMusic(1);

            playerNameTitle.Initialize();
            playerName.Initialize();
            frame.AddControl(playerName);
            frame.AddControl(playerNameTitle);

            //frame.AddControl(weaponPowerLabel);
            UIManager.AddAndLoad(frame);
            frame.AddControl(powerBar);
            frame.AddControl(powerBarTitle);
            frame.AddControl(energyBar);
            frame.AddControl(energyBarTitle);

            GameControler.Singleton.Connect(UIManager.ActiveFrame);
            UIManager.ActiveFrame.KeyUp += new KeyEventHandler(ActiveFrame_KeyUp);

            GameControler.Singleton.Move += new GameControler.PlayerEventHandler(PlayerMove);
            GameControler.Singleton.Stop += new GameControler.PlayerEventHandler(PlayerStop);
            GameControler.Singleton.EnterPortal += new GameControler.InteractEventHandler(EnterPortal);
            GameControler.Singleton.ChangePhysicsGunSettings += new GameControler.PlayerEventHandler(ChangePhysicsGunSettings);
            GameControler.Singleton.SwitchPhysicsGun += new GameControler.PlayerEventHandler(SwitchPhysicsGun);
            GameControler.Singleton.Jump += new GameControler.PlayerEventHandler(PlayerJump);
            GameControler.Singleton.ManipulatePhysics += new GameControler.ManipulatePhysicsEventHandler(ManipulatePhysics);

            GameControler.Singleton.ManipulatePhysicsOn += new GameControler.ManipulatePhysicsEventHandler(Singleton_ManipulatePhysicsOn);
            GameControler.Singleton.ManipulatePhysicsOff += new GameControler.ManipulatePhysicsEventHandler(Singleton_ManipulatePhysicsOff);
        }
Esempio n. 6
0
 public void OnLoseControl(Frame sender)
 {
     if (LoseControl != null)
         LoseControl(sender);
 }
Esempio n. 7
0
 public void OnGainControl(Frame sender)
 {
     if (GainControl != null)
         GainControl(sender);
 }