public BehaviorState(int behv, StartDel startDel,
                      UpdateDel updateDel, EndDel endDel, string name)
 {
     mBehaviorType      = behv;
     mBehaviorStartDel  = startDel;
     mBehaviorUpdateDel = updateDel;
     mBehaviorEndDel    = endDel;
     //mName = name;
 }
        public HelloWorldOverlay()
        {
            InitializeComponent();
            DataContext = this;

            TextLocations = new ObservableCollection<TextBlockRect>();
            BackgroundOverlayImage = new WriteableBitmap((int)System.Windows.SystemParameters.VirtualScreenWidth * 2,
                            (int)System.Windows.SystemParameters.VirtualScreenHeight * 2, 96, 96, PixelFormats.Bgra32, null);
            _backgroundBitmap = Bitmap.FromDimensions((int)SystemParameters.VirtualScreenHeight, (int)SystemParameters.VirtualScreenWidth);
            _update = new UpdateDel(UIThreadUpdate);
        }
Exemple #3
0
        public HelloWorldOverlay()
        {
            InitializeComponent();
            DataContext = this;

            TextLocations          = new ObservableCollection <TextBlockRect>();
            BackgroundOverlayImage = new WriteableBitmap((int)System.Windows.SystemParameters.VirtualScreenWidth * 2,
                                                         (int)System.Windows.SystemParameters.VirtualScreenHeight * 2, 96, 96, PixelFormats.Bgra32, null);
            _backgroundBitmap = Bitmap.FromDimensions((int)SystemParameters.VirtualScreenHeight, (int)SystemParameters.VirtualScreenWidth);
            _update           = new UpdateDel(UIThreadUpdate);
        }
Exemple #4
0
 private void SafeUpdate(int result)
 {
     if (textBox1.InvokeRequired)
     {
         UpdateDel del = SafeUpdate;
         textBox1.Invoke(del, new object[] { result });
     }
     else
     {
         textBox1.Text = result.ToString();
     }
 }
Exemple #5
0
    void GridSetter2()
    {
        //initializing at zero and nonsolid
        for (int i = 0; i < gridSize.x; i++)
        {
            for (int j = 0; j < gridSize.y; j++)
            {
                SetSlot(new Vector2Int(i, j), 0, null, false);
            }
        }

        //setting the goal slots, and goalExists
        if (TileSetter2("goal", 3, false).Length > 0)
        {
            goalExists = true;
        }

        //setting coin slots and coinCount
        currentCoins = TileSetter2("coin", 7, false).Length;

        //setting bomb slots
        TileSetter2("bomb", 6, false);

        //setting buttin slots
        TileSetter2("button", 10, false);

        //setting door slots
        TileSetter2("door", 9, true);

        //setting block slots
        TileSetter2("block", 1, true);

        //setting cannon slots
        GameObject[] gos = TileSetter2("cannon", 4, true);


        //add cannon delegates
        foreach (var g in gos)
        {
            updateDelegate += g.GetComponent <Cannon>().PassTime;
        }

        //setting tripwire slots
        gos = TileSetter2("tripwire", 4, true);


        //add tripwire slots
        foreach (var g in gos)
        {
            updateDelegate += g.GetComponent <TripWire>().PassTime;
        }
    }
        /// <summary>
        /// Independent thread that runs a search.
        /// </summary>
        private void SearchThread()
        {
            DateTime  m_start = DateTime.Now;
            DataTable dt      = m_proc.Execute();

            if (InvokeRequired)
            {
                UpdateDel update = UpdateResults;
                Invoke(update, dt);
            }
            else
            {
                UpdateResults(dt);
            }
        }
Exemple #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _windowGetter         = new BackgroundWorker();
            _windowGetter.DoWork += new DoWorkEventHandler(_windowGetter_DoWork);
            _windowGetter.RunWorkerAsync();

            _windowHiglight       = new WindowHighlight();
            _windowHiglight.Owner = this;


            _updateUI               = new UpdateDel(UpdateUI);
            _mousehook              = new LowLevelMouseHook("low level mouse hook");
            _mousehook.OnMouseMove += new EventHandler <System.Windows.Forms.MouseEventArgs>(_mousehook_OnMouseMove);
            _mousehook.OnMouseDown += new EventHandler <System.Windows.Forms.MouseEventArgs>(_mousehook_OnMouseDown);
            _mousehook.Install();
        }
Exemple #8
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _windowGetter = new BackgroundWorker();
            _windowGetter.DoWork += new DoWorkEventHandler(_windowGetter_DoWork);
            _windowGetter.RunWorkerAsync();

            _windowHiglight = new WindowHighlight();
            _windowHiglight.Owner = this;


            _updateUI = new UpdateDel(UpdateUI);
            _mousehook = new LowLevelMouseHook("low level mouse hook");
            _mousehook.OnMouseMove += new EventHandler<System.Windows.Forms.MouseEventArgs>(_mousehook_OnMouseMove);
            _mousehook.OnMouseDown += new EventHandler<System.Windows.Forms.MouseEventArgs>(_mousehook_OnMouseDown);
            _mousehook.Install();

        }
Exemple #9
0
        public TableViewer(frmMain owner, DataTable dt, UpdateDel u)
        {
            #if (DEBUG_1||DEBUG_2||DEBUG_3)
            debugLogger = new DebugLogger("frmTable.log");
            #endif
            debugLogger.WriteDebug_3("Begin Method: frmTable.frmTable(frmMain,DataTable,UpdateDel) (" + owner.ToString() + ","
                + dt.ToString() + "," + u.ToString() + ")");

            this.owner = owner;
            local=true;
            InitializeComponent();
            dataGrid.ReadOnly = false;
            dbTable = dt;
            dataGrid.SetDataBinding(dbTable,"");
            update = u;
            this.dbTable.RowChanged += new DataRowChangeEventHandler(dbTable_Changed);
            this.dbTable.RowDeleted += new DataRowChangeEventHandler(dbTable_Changed);

            debugLogger.WriteDebug_3("End Method: frmTable.frmTable()");
        }
Exemple #10
0
        /// <summary>
        /// Independent thread that runs a search.
        /// </summary>
        private void SearchThread()
        {
            DateTime m_start = DateTime.Now;

            try
            {
                DataTable dt = m_proc.Execute();
                if (InvokeRequired)
                {
                    UpdateDel update = UpdateResults;
                    Invoke(update, dt);
                }
                else
                {
                    UpdateResults(dt);
                }
            }
            catch (Exception ex)
            {
                Scout.Core.UserInteraction.Dialog.ShowMessage(
                    "There was an error during the execution of this query. Please wait two minutes and re-run.", UserMessageType.Exception);
            }
        }
Exemple #11
0
 public Form1()
 {
     InitializeComponent();
     udel = new UpdateDel(UpdateLabel);
 }
Exemple #12
0
        public EditorWindow()
        {
            InitializeComponent();

            _annotationUndoStack = new Stack<AnnotationOperation>();
            _currState = State.Inspecting;
            CapturedWindow = new WriteableBitmap((int)System.Windows.SystemParameters.VirtualScreenWidth * 2,
                (int)System.Windows.SystemParameters.VirtualScreenHeight * 2, 96, 96, PixelFormats.Bgra32, null);

            _updateThread = new UpdateDel(UpdateUI);


            
            UserDrawnRectangleControl.StyleTemplate = RectangleViewer.StyleType.UserDrawn;
            SelectedNodes = new BindingList<PropertiesControl>();
            _invalidated = new HashSet<TextEditor>();
            
        }
Exemple #13
0
        // ***************************************************************************
        // Update für das eigentliche spiel
        public void UpdateGame()
        {
            updateGamePlayDelegator();

            var newState = Keyboard.GetState();

            if ( newState.IsKeyDown( Keys.I ) && !oldKeyState.IsKeyDown( Keys.I ) && !constructorPanel.NameIsActive )
            {
                if ( constructorPanel.Visible )
                {
                    constructorPanel.Visible = false;
                }
                if ( inventarPanel.Visible )
                {
                    updateGamePlayDelegator = UpdateGamePlay;
                    inventarPanel.Visible = false;
                }
                else
                {
                    updateGamePlayDelegator = UpdateGui;
                    inventarPanel.Visible = true;
                }
            }
            if ( newState.IsKeyDown( Keys.K ) && !oldKeyState.IsKeyDown( Keys.K ) && !constructorPanel.NameIsActive )
            {
                if ( inventarPanel.Visible )
                {
                    inventarPanel.Visible = false;
                }
                if ( constructorPanel.Visible )
                {
                    updateGamePlayDelegator = UpdateGamePlay;
                    constructorPanel.Visible = false;
                }
                else
                {
                    updateGamePlayDelegator = UpdateGui;
                    constructorPanel.Visible = true;
                }
            }
            oldKeyState = newState;
        }
Exemple #14
0
        // ***************************************************************************
        // Läd den ganzen Stuff, den der GameManager benötigt
        public void Load()
        {
            Debug.WriteLine( "Läd das eigentliche Spiel" );

            // Update Delegator setzen
            updateDelegater = UpdateGame;
            updateGamePlayDelegator = UpdateGamePlay;

            // Variablen initialisiwerung
            GameState = new GameState();

            // Renderer laden
            Main.MainObject.MenuManager.LoadingText = "Loading images..";
            LoadRenderer();

            // Sounds laden
            Main.MainObject.MenuManager.LoadingText = "Loading sounds..";
            Sound.LoadSounds();

            // GameState initialisieren
            Main.MainObject.MenuManager.LoadingText = "Initialize objects..";

            GameState.MapSize = new Vector2( 10000, 10000 ); // TODO: Mapgröße hier mitgeben
            GameState.QuadTreeEnemies = new QuadTree<Enemy>( 0, 0, ( int ) GameState.MapSize.X, ( int ) GameState.MapSize.Y );
            GameState.QuadTreeSpawnPoints = new QuadTree<SpawnPoint>( 0, 0, ( int ) GameState.MapSize.X, ( int ) GameState.MapSize.Y );
            GameState.QuadTreeStaticObjects = new QuadTree<StaticObject>( 0, 0, ( int ) GameState.MapSize.X, ( int ) GameState.MapSize.Y );
            GameState.QuadTreeItems = new QuadTree<Item>( 0, 0, ( int ) GameState.MapSize.X, ( int ) GameState.MapSize.Y );

            GameState.ShotListVsEnemies = new List<Shot>(); // Shots als Liste, da diese nur eine kurze Lebenszeit haben
            GameState.ShotListVsPlayer = new List<Shot>(); // Shots als Liste, da diese nur eine kurze Lebenszeit haben

            Main.MainObject.MenuManager.LoadingText = "Loading map..";
            GameState.Karte = new Karte();
            GameState.Karte.LoadMap( GameState, "testmap" );

            GameState.GameStatistic = new GameStatistic();

            // Werte für Runde
            GameState.RoundDelay = 1;
            GameState.GameStatistic.Round = 1;
            GameState.RoundIsRunning = false;
            GameState.TimeToRoundStart = GameState.RoundDelay;

            // Buffs laden
            Buff.Load();

            // Items laden
            Main.MainObject.MenuManager.LoadingText = "Loading items..";
            Item.LoadItems();

            // Player
            MapLocation playerPosition = new MapLocation( GameState.Karte.PlayerStart );

            GameState.Player = new Player( playerPosition, 100, 100, 200 );
            Weapon w1 = Item.DefaultWeapon[ 8 ].Clone();
            w1.Munition = Item.DefaultMunition[ 200 ].Clone();
            //GameState.Player.AddItemToInventar(w1);
            GameState.Player.AddWeaponToShortcutList( 1, w1 );

            Weapon w2 = Item.DefaultWeapon[ 15 ].Clone();
            w2.Munition = Item.DefaultMunition[ 201 ].Clone();
            //GameState.Player.AddItemToInventar(w2);
            GameState.Player.AddWeaponToShortcutList( 2, w2 );

            CalculateMapOffset();

            // Keybelegung
            keyMoveUp = ( Keys ) Enum.Parse( typeof( Keys ), Configuration.Get( "keyMoveUp" ) );
            keyMoveDown = ( Keys ) Enum.Parse( typeof( Keys ), Configuration.Get( "keyMoveDown" ) );
            keyMoveLeft = ( Keys ) Enum.Parse( typeof( Keys ), Configuration.Get( "keyMoveLeft" ) );
            keyMoveRight = ( Keys ) Enum.Parse( typeof( Keys ), Configuration.Get( "keyMoveRight" ) );

            // Background laden
            background = Main.ContentManager.Load<Texture2D>( "images/background" );
            PixelWhite = Main.ContentManager.Load<Texture2D>( "images/pixelWhite" );
            PixelTransparent = Main.ContentManager.Load<Texture2D>( "images/pixelTransparent" );

            // GUI elemente
            gui_overlay = Main.ContentManager.Load<Texture2D>( "images/gui/gui_overlay" );
            health_bar = Main.ContentManager.Load<Texture2D>( "images/gui/health_bar" );
            gui_backlayer = Main.ContentManager.Load<Texture2D>( "images/gui/gui_backlayer" );

            gameoverTexture = Main.ContentManager.Load<Texture2D>( "images/gameover" );

            defaultFont = Main.ContentManager.Load<SpriteFont>( Configuration.Get( "defaultFont" ) );
            defaultFontBig = Main.ContentManager.Load<SpriteFont>( Configuration.Get( "defaultFontBig" ) );
            defaultFontSmall = Main.ContentManager.Load<SpriteFont>( Configuration.Get( "defaultFontSmall" ) );

            // Posi für Gui
            DrawHelper.AddDimension( "HealthBar_Position", 184, 425 );
            DrawHelper.AddDimension( "HealthBar_Size", 33, 153 );

            DrawHelper.AddDimension( "Munition_Position", 235, 535 );

            DrawHelper.AddDimension( "BuffIcon_Position", 16, 365 );
            DrawHelper.AddDimension( "BuffIcon_Size", 32, 32 );

            DrawHelper.AddDimension( "Minimap_Size", 181, 170 );
            DrawHelper.AddDimension( "Minimap_Position", 0, 407 );

            DrawHelper.AddDimension( "IconOnTheFloor_Size", 32, 32 );

            // AI Thread starten
            new Thread( new ThreadStart( AIThread.UpdateAI ) ).Start();

            //User Interface erstellen
            InitGui();

            // Enemies laden
            Enemy.Load();

            // Maus auf fadenkreuz setzten
            MouseCursor.CurrentCursor = MouseCursor.Cross_01;

            // ################################################################################
            // ################################################################################
            // ################################################################################
            // TEST

            Item it1 = Item.Get( 100 );
            it1.LocationBehavior.Position = new Vector2( 1100, 4150 );
            it1.LocationBehavior.Size = DrawHelper.Get( "IconOnTheFloor_Size" );
            //it1.LocationSizing();

            Item it2 = Item.Get( 200 );
            it2.LocationBehavior.Position = new Vector2( 1200, 4150 );
            it2.LocationBehavior.Size = DrawHelper.Get( "IconOnTheFloor_Size" );
            //it2.LocationSizing();

            Item it3 = Item.Get( 300 );
            it3.LocationBehavior.Position = new Vector2( 1300, 4150 );
            it3.LocationBehavior.Size = DrawHelper.Get( "IconOnTheFloor_Size" );
            //it3.LocationSizing();

            Item it4 = Item.Get( 400 );
            it4.LocationBehavior.Position = new Vector2( 1400, 4150 );
            it4.LocationBehavior.Size = DrawHelper.Get( "IconOnTheFloor_Size" );
            //it4.LocationSizing();

            Item it5 = Item.Get( 700 );
            it5.LocationBehavior.Position = new Vector2( 1500, 4150 );
            it5.LocationBehavior.Size = DrawHelper.Get( "IconOnTheFloor_Size" );
            //it5.LocationSizing();

            GameState.QuadTreeItems.Add( it1 );
            GameState.QuadTreeItems.Add( it2 );
            GameState.QuadTreeItems.Add( it3 );
            GameState.QuadTreeItems.Add( it4 );
            GameState.QuadTreeItems.Add( it5 );

            //peng = Main.ContentManager.Load<SoundEffect>("test/Skorpion-Kibblesbob-1109158827");
            headshot = Main.ContentManager.Load<SoundEffect>( "test/headshot2" );

            monster3 = Main.ContentManager.Load<Texture2D>( "test/red_monster_angry" );
            shot = Main.ContentManager.Load<Texture2D>( "test/shot" );
            blood = Main.ContentManager.Load<Texture2D>( "test/blood" );
            shot_01 = Main.ContentManager.Load<Texture2D>( "images/shots/shot_01" );

            // Testtextur
            test = Main.ContentManager.Load<Texture2D>( "images/pixelWhite" );
            testFont = Main.ContentManager.Load<SpriteFont>( "fonts/arialSmall" );

            // TEST-ENDE
            // ################################################################################

            // Wenn ladevorgang fertig => Switch von MenuManager auf GameManager
            Main.MainObject.CurrentManager = this;
            MusicPlayer.Stop();
        }
Exemple #15
0
        // ***************************************************************************
        // Player stirbt
        private void PlayerDied()
        {
            // Update umbiegen
            updateDelegater = UpdatePlayerIsDead;

            // AiThread beenden
            AIThread.Running = false;

            // maus verstecken
            MouseCursor.CurrentCursor = MouseCursor.NoCursor;

            // player füße verstecken
            GameState.Player.IsMoving = false;

            // Gameover setzten
            gameover = true;
        }