RTSEngine.Data.GameState.SendPopup C# (CSharp) Method

SendPopup() public method

public SendPopup ( string texFile, Rectangle destination ) : void
texFile string
destination Microsoft.Xna.Framework.Rectangle
return void
        public void SendPopup(string texFile, Rectangle destination)
        {
            if(OnNewPopup != null)
                OnNewPopup(texFile, destination);
        }

Usage Example

Example #1
0
        public override void Load(GameState s, DirectoryInfo mapDir)
        {
            // Give The Player Team Starting Capital
            pTeam = null;
            for(int i = 0; i < s.activeTeams.Length; i++) {
                var at = s.activeTeams[i];
                if(pTeam == null && at.Team.Type == RTSInputType.Player) {
                    pTeam = at.Team;
                    pTeam.Input.AddEvent(new CapitalEvent(pTeam.Index, 1000));
                    pTeam.PopulationCap = 100;
                }
            }

            float[] heights = new float[s.CGrid.numCells.X * s.CGrid.numCells.Y];
            Vector2[] p = new Vector2[heights.Length];
            for(int y = 0, i = 0; y < s.CGrid.numCells.Y; y++) {
                for(int x = 0; x < s.CGrid.numCells.X; x++) {
                    p[i] = new Vector2(x + 0.5f, y + 0.5f) * s.CGrid.cellSize;
                    heights[i] = s.CGrid.HeightAt(p[i]);
                    i++;
                }
            }
            Array.Sort(heights, p, 0, heights.Length);
            int cS = 1, cE = 1;
            while(cS < heights.Length && heights[cS] == heights[0])
                cS++;
            while(cE < heights.Length && heights[heights.Length - 1 - cE] == heights[heights.Length - 1])
                cE++;
            Random r = new Random();
            Vector2 spawnPos = p[r.Next(cS)];
            int ti = heights.Length - 1 - r.Next(cE);
            targetHeight = heights[ti] - 0.5f;
            fireLocation = new Vector3(p[ti].X, targetHeight, p[ti].Y);

            pTeam.Input.AddEvent(new SpawnUnitEvent(pTeam.Index, 0, spawnPos));
            pTeam.Input.AddEvent(new SpawnUnitEvent(pTeam.Index, 0, spawnPos));
            pTeam.Input.AddEvent(new SpawnUnitEvent(pTeam.Index, 0, spawnPos));
            pTeam.Input.AddEvent(new SpawnUnitEvent(pTeam.Index, 0, spawnPos));
            DevConsole.AddCommand("franz ferdinand");
            pTeam.Input.OnNewSelection += (ic, ns) => {
                if(ns.Count < 1) return;
                s.SendPopup(@"Packs\presets\Tutorial0\2.png", new Rectangle(10, 60, 400, 300));
                System.Threading.Interlocked.Exchange(ref state, 3);
                s.AddParticle(new AlertParticle(fireLocation, 2, Color.Transparent, fireLocation + Vector3.Up * 3, 1, Color.OrangeRed, s.TotalGameTime, 4f));
            };
            state = 0;
        }
All Usage Examples Of RTSEngine.Data.GameState::SendPopup