void GeometryService_GeneralizeCompleted(object sender, GraphicsEventArgs e)
        {
            GraphicsLayer generalizedGraphicsLayer = MyMap.Layers["GeneralizedLineGraphicsLayer"] as GraphicsLayer;
            generalizedGraphicsLayer.ClearGraphics();

            foreach (Graphic g in e.Results)
            {
                g.Symbol = LayoutRoot.Resources["NewLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                generalizedGraphicsLayer.Graphics.Add(g);

                ESRI.ArcGIS.Client.Geometry.Polyline p = g.Geometry as ESRI.ArcGIS.Client.Geometry.Polyline;

                foreach (ESRI.ArcGIS.Client.Geometry.PointCollection pc in p.Paths)
                {
                    foreach (MapPoint point in pc)
                    {
                        Graphic vertice = new Graphic()
                        {
                            Symbol = LayoutRoot.Resources["NewMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,
                            Geometry = point
                        };
                        generalizedGraphicsLayer.Graphics.Add(vertice);
                    }
                }
            }
            generalizedGraphicsLayer.Opacity = 0.75;
            SliderStackPanel.Visibility = Visibility.Visible;
            GeneralizeButton.IsEnabled = true;
        }
 public void geometryService_ProjectCompleted(object sender, GraphicsEventArgs e)
 {
   if (e.Results.Count == 1)
     _callback(null, new GeometryEventArgs() { Geometry = e.Results[0].Geometry });
   else
     _callback(null, new GeometryEventArgs());
 }
        public static void Process(object sender, GraphicsEventArgs e)
        {
            timerBarPool.Draw();

            if (Game.IsKeyDown(Keys.F5))
            {
                GameFiber.StartNew(delegate
                {
                    for (float i = 0f; i < 1f; i += 0.001f)
                    {
                        barTimerBar.Percentage = i;
                        GameFiber.Sleep(10);
                    }
                });
            }

            if (Game.IsKeyDown(Keys.F6))
            {
                barTimerBar.ForegroundColor = Color.FromArgb(MathHelper.GetRandomInteger(256), MathHelper.GetRandomInteger(256), MathHelper.GetRandomInteger(256));
                barTimerBar.BackgroundColor = ControlPaint.Dark(barTimerBar.ForegroundColor);
            }

            textTimerBar.Text = World.TimeOfDay.ToString("c");

            textTimerBar2.Text = MathHelper.ConvertMetersPerSecondToKilometersPerHourRounded(Game.LocalPlayer.Character.Speed) + " km/h";

        }
        private void Client_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.Pixel;
            float yoffset = heightToPx(15);
            for (int i = 0; i < client.chatController.chatconsole.Count; i++)
            {
                e.Graphics.DrawText(client.chatController.chatconsole.ToArray()[i], widthToPx(10.0f), yoffset, font);
                yoffset += heightToPx(24);
            }
            /*
            yoffset = 100;
            for (int i = 0; i < client.chatController.debugconsole.Count; i++)
            {
                e.Graphics.DrawText(client.chatController.debugconsole.ToArray()[i], new RectangleF(0, yoffset, Game.Resolution.Width, 40), TextAlignment.Right, font);
                yoffset += 18;
            }*/

            if (client.keyboardHandler.inKeyboardTypingMode)
            {
                int cpos = client.keyboardHandler.cursorpos;
                string prefix = client.nick + ": ";
                string currenttext = prefix + client.chatController.currentTypedText;

                e.Graphics.DrawText(currenttext, widthToPx(10.0f), yoffset, font_consolas);
                if (DateTime.Now.Millisecond < 500)
                {
                    StringBuilder cstr = new StringBuilder();
                    cstr.Append(' ', cpos + prefix.Length);
                    cstr.Append('|');
                    e.Graphics.DrawText(cstr.ToString(), widthToPx(10.0f), yoffset, font_consolas);
                }
            }
            DrawBase.renderAll(e.Graphics);
        }
Example #5
0
        private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            try
            {
                if (!player.isAlive)
                {
                    e.Graphics.Scaling = FontScaling.ScreenUnits; // size on screen will always be the same, regardless of resolution
                    RectangleF rect = new RectangleF(0.70F, 0.85F, 0.3F, 0.1F);
                    e.Graphics.DrawText(string.Format("{0:f1}", dist), rect, TextAlignment.Center | TextAlignment.VerticalCenter, screenFont);

                    //謎のメーター
            /*        float haba;
                    screenBoxColor = Color.FromArgb(127, 0, 0, 255);
                    haba = dist / 400.0f;
                    rect = new RectangleF(0.05F, 0.85F, haba, 0.2f);
                    e.Graphics.DrawRectangle(rect, screenBoxColor);

                    */
                }
            }
            catch
            {
                //描画に失敗したとき
                return;
            }
        }
 void GeometryService_TrimExtendCompleted(object sender, GraphicsEventArgs e)
 {
     foreach (Graphic g in e.Results)
     {
         g.Symbol = LayoutRoot.Resources["ResultsLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
         resultsLayer.Graphics.Add(g);
     }
 }
 void GeometryService_OffsetCompleted(object sender, GraphicsEventArgs e)
 {
     foreach (Graphic g in e.Results)
     {
         g.Symbol = LayoutRoot.Resources["CyanFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
         offsetGraphicsLayer.Graphics.Add(g);
     }
 }
Example #8
0
        private void MOD_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.ScreenUnits;

            if (Setting)
            {
                e.Graphics.DrawText("+", new RectangleF(0.4f, 0.4f, 0.2f, 0.2f), TextAlignment.Center | TextAlignment.VerticalCenter, sFont);
            }
        }
Example #9
0
 public static void FrameRender(object sender, GraphicsEventArgs e)
 {
     MissionPlayer.Tick();
     MainEditor.Tick(e);
     if (Game.IsKeyDown(Keys.F8))
     {
         if(!MainEditor.IsInEditor && !MainEditor.IsInMainMenu)
             MainEditor.EnterEditor();
     }
 }
        void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
        {
            IList<Graphic> results = args.Results;
              GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

              foreach (Graphic graphic in results)
              {
            graphic.Symbol = LayoutRoot.Resources["DefaultBufferSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            graphicsLayer.Graphics.Add(graphic);
              }
        }
Example #11
0
        private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.ScreenUnits;
            if (Exists(target))
            {

                if (Disp.X == -1.0f && Disp.Y == -1.0f) { return; }
                string S = "X";
                e.Graphics.DrawText(S, new RectangleF(Disp.X, Disp.Y, 0.05f, 0.05f), TextAlignment.Center | TextAlignment.VerticalCenter, new GTA.Font(0.04F, FontScaling.ScreenUnits));
            }
        }
 private void GeometryService_LabelPointsCompleted(object sender, GraphicsEventArgs args)
 {
     foreach (Graphic graphic in args.Results)
     {
         graphic.Symbol = LayoutRoot.Resources["DefaultRasterSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
         MapPoint mapPoint = graphic.Geometry as MapPoint;
         graphic.Attributes.Add("X", mapPoint.X);
         graphic.Attributes.Add("Y", mapPoint.Y);
         graphicsLayer.Graphics.Add(graphic);
     }
 }
        void geometryService_ProjectCompleted(object sender, GraphicsEventArgs e)
        {
            Graphic resultGraphic = e.Results[0];
            resultGraphic.Symbol = LayoutRoot.Resources["RoundMarkerSymbol"] as SimpleMarkerSymbol;

            MapPoint resultMapPoint = resultGraphic.Geometry as MapPoint;
            resultGraphic.Attributes.Add("Output_Coordinate", resultMapPoint.X + "," + resultMapPoint.Y);

            MapPoint inputMapPoint = e.UserState as MapPoint;
            resultGraphic.Attributes.Add("Input_Coordinate", inputMapPoint.X + "," + inputMapPoint.Y);

            graphicsLayer.Graphics.Add(resultGraphic);
        }
        void GeometryService_DifferenceCompleted(object sender, GraphicsEventArgs e)
        {
            outputGraphicsLayer = MyMap.Layers["OutputGraphicsLayer"] as GraphicsLayer;
            outputGraphicsLayer.ClearGraphics();
            foreach (Graphic g in e.Results)
            {
                if (g.Geometry is Polygon)
                    g.Symbol = LayoutRoot.Resources["DifferenceFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                outputGraphicsLayer.Graphics.Add(g);
            }

            MyDrawObject.IsEnabled = true;
            ResetButton.IsEnabled = true;
        }
        void GeometryService_AutoCompleteCompleted(object sender, GraphicsEventArgs e)
        {
            GraphicsLayer graphicsLayer = MyMap.Layers["CompletedGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.ClearGraphics();

            foreach (Graphic g in e.Results)
            {
                g.Symbol = LayoutRoot.Resources["RedFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                graphicsLayer.Graphics.Add(g);
            }

            if (e.Results.Count > 0)
                (MyMap.Layers["ConnectDotsGraphicsLayer"] as GraphicsLayer).ClearGraphics();
        }
        private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.ScreenUnits;
            GTA.Font screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits);

            if (TrendNitoro && Player.CanControlCharacter && Player.Character.isAlive)
            {
                if ((Time / 2) % 2 == 1)
                {
                    e.Graphics.DrawText("※市ニトロ注意※", new RectangleF(0.0f, 0.15f, 1.0f, 0.1f), TextAlignment.Center | TextAlignment.Top, screenFont);
                }
               //     e.Graphics.DrawRectangle(new RectangleF(0, 0, 1.0f, 0.05f), Color.FromArgb(30, 0, 0, 255));
            }
        }
        private void geometryService_ProjectCompleted(object sender, GraphicsEventArgs e)
        {
            IList<Graphic> resultlist = e.Results;
            string outstring = "";
            outstring += String.Format("contains {0} points", resultlist.Count);
            outstring += "\n";
            for (int i = 0; i < resultlist.Count; i++)
            {
                MapPoint resultpoint = resultlist[i].Geometry as MapPoint;
                outstring += resultpoint.X + " " + resultpoint.Y + "\n";
            }

            MessageBox.Show(outstring);
        }
        void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
        {
            Graphic bufferGraphic = new Graphic();
            bufferGraphic.Geometry = args.Results[0].Geometry;
            bufferGraphic.Symbol = LayoutRoot.Resources["BufferSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            bufferGraphic.SetZIndex(1);

            _pointAndBufferGraphicsLayer.Graphics.Add(bufferGraphic);

            ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
            query.ReturnGeometry = true;
            query.OutSpatialReference = MyMap.SpatialReference;
            query.Geometry = bufferGraphic.Geometry;
            query.OutFields.Add("OWNERNME1");
            _queryTask.ExecuteAsync(query);
        }
        void GeometryService_IntersectCompleted(object sender, GraphicsEventArgs e)
        {
            intersectGraphicsLayer.Graphics.Clear();

            foreach (Graphic g in e.Results)
            {
                SimpleFillSymbol symbol = new SimpleFillSymbol()
                {
                    Fill = new System.Windows.Media.SolidColorBrush(
                        System.Windows.Media.Color.FromArgb(255, (byte)random.Next(0, 255), (byte)random.Next(0, 255),
                        (byte)random.Next(0, 255))),
                    BorderBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black),
                    BorderThickness = 1
                };
                g.Symbol = symbol;
                intersectGraphicsLayer.Graphics.Add(g);
            }
        }
        private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            if (Player.Character.isInVehicle())
            {
                e.Graphics.Scaling = FontScaling.ScreenUnits; // size on screen will always be the same, regardless of resolution

                for (int i = 0; i < 30; i++)
                {
                    Vector3 V;
                    GTA.Font F;

                    //Engine
                    if (E.IsDamegeActive(i))
                    {
                        V = E.Pos[i];
                        F = new GTA.Font(0.04f, FontScaling.ScreenUnits);
                        F.Color = E.GetColor(i);
                        e.Graphics.DrawText(string.Format("-{0:f1}", E.Damage[i]), new RectangleF(V.X, V.Y, 0.1f, 0.5f), TextAlignment.Left | TextAlignment.Top, F);
                    }

                    //Body
                    if (B.IsDamegeActive(i))
                    {
                        V = B.Pos[i];
                        F = new GTA.Font(0.04f, FontScaling.ScreenUnits);
                        F.Color = B.GetColor(i);
                        e.Graphics.DrawText(string.Format("-{0:f1}", B.Damage[i]), new RectangleF(V.X, V.Y, 0.1f, 0.5f), TextAlignment.Left | TextAlignment.Top, F);
                    }

                    //Petrol
                    if (P.IsDamegeActive(i))
                    {
                        V = P.Pos[i];
                        F = new GTA.Font(0.04f, FontScaling.ScreenUnits);
                        F.Color = P.GetColor(i);
                        e.Graphics.DrawText(string.Format("-{0:f1}", P.Damage[i]), new RectangleF(V.X, V.Y, 0.1f, 0.5f), TextAlignment.Left | TextAlignment.Top, F);
                    }

                }

            }
        }
        private void mPerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.ScreenUnits;
                if (Player.CanControlCharacter)
                {
                    int hrbt;
                    try
                    {
                        hrbt = int.Parse(HRBT);
                    }
                    catch
                    {
                        return;
                    }
                    hrbt = 360-(360*(hrbt-60) / 40)-90;
                    screenFont.Color = HSV2RGB(hrbt, 255, 255);
                    e.Graphics.DrawText(HRBT, rect, TextAlignment.Center | TextAlignment.Bottom, screenFont);

                }
        }
Example #22
0
        private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.ScreenUnits;
            if (!Active || !Exists(rck)) { return; }

            try
            {
                //BackGround
                e.Graphics.DrawRectangle(new RectangleF(0.0f, 0.0f, 1.0f, 1.0f), Color.FromArgb(50, 0, 255, 0));

                //TimerBar
                float Haba = (0.3f*(float)BombTimer)/150.0f;
                e.Graphics.DrawRectangle(new RectangleF(0.3f, 0.8f, 0.3f, 0.025f), Color.FromArgb(200, 0, 0, 0));
                e.Graphics.DrawRectangle(new RectangleF(0.3f, 0.8f, Haba, 0.025f), Color.FromArgb(200, 0, 250, 0));

            }
            catch
            {
                return;
            }
        }
        void GeometryService_DensifyCompleted(object sender, GraphicsEventArgs e)
        {
            GraphicsLayer graphicsLayerVertices = MyMap.Layers["VerticesGraphicsLayer"] as GraphicsLayer;
            foreach (Graphic g in e.Results)
            {
                ESRI.ArcGIS.Client.Geometry.Polygon p = g.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon;

                foreach (ESRI.ArcGIS.Client.Geometry.PointCollection pc in p.Rings)
                {
                    foreach (MapPoint point in pc)
                    {
                        Graphic vertice = new Graphic()
                        {
                            Symbol = LayoutRoot.Resources["NewMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,
                            Geometry = point
                        };
                        graphicsLayerVertices.Graphics.Add(vertice);
                    }
                }
            }
            DensifyButton.IsEnabled = true;
        }
Example #24
0
        private unsafe void MOD_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            if (Player.Character.isDead || !Player.CanControlCharacter) { return; }

            e.Graphics.Scaling = FontScaling.ScreenUnits;
            RectangleF radar = e.Graphics.GetRadarRectangle(FontScaling.ScreenUnits);

            e.Graphics.DrawText(string.Format("{0}", NowPoint), new RectangleF(radar.X, 0.95f, radar.Width, 0.1f), TextAlignment.Center | TextAlignment.Top, screenFont);
            if (NowPoint > Share.POINTs) {
                if (NowPoint - Share.POINTs > 174)
                {
                    NowPoint -= 174;
                }
                if (NowPoint - Share.POINTs > 13)
                {
                    NowPoint -= 13;
                }else{
                NowPoint--;
                }
            }
            if (NowPoint < Share.POINTs)
            {
                if (Share.POINTs - NowPoint > 174)
                {
                    NowPoint += 174;
                }
                if (Share.POINTs - NowPoint > 13)
                {
                    NowPoint += 13;
                }
                else
                {
                    NowPoint++;
                }
            }
        }
Example #25
0
 private void Main_PerFrameDrawing(object sender, GraphicsEventArgs e)
 {
     e.Graphics.DrawText(InfoDraw, 200, 3, Color.Aqua);
 }
Example #26
0
        static void RawFrameRender(object sender, GraphicsEventArgs e)
        {
            int    w           = Game.Resolution.Width;
            int    h           = Game.Resolution.Height;
            string text        = "Warning - DLS Key Lock Active";
            float  size        = 16.0f;
            SizeF  graphicSize = Rage.Graphics.MeasureText(text, "Arial Bold", size);

            if (!Game.IsPaused && Entrypoint.keysLocked)
            {
                if (IsUIOn)
                {
                    e.Graphics.DrawText(text, "Arial Bold", size, new PointF(w - graphicSize.Width - 8, h + graphicSize.Height - sizeY), Color.DarkRed);
                }
                else
                {
                    e.Graphics.DrawText(text, "Arial Bold", size, new PointF(w - graphicSize.Width - 8, h - graphicSize.Height - 8), Color.DarkRed);
                }
            }
            Ped player = UIHelper.player;

            if (IsUIOn && UIHelper.IsUIAbleToDisplay && UIHelper.IsInAnyVehicle)
            {
                Vehicle veh = UIHelper.currentVehicle;
                if (UIHelper.IsUIAbleToDisplay && UIHelper.IsVehicleValid && UIHelper.IsPlayerDriver &&
                    (UIHelper.dlsModel != null || Entrypoint.SCforNDLS) &&
                    UIHelper.activeVeh != null)
                {
                    ActiveVehicle aVeh = UIHelper.activeVeh;
                    Background.Draw(e.Graphics);
                    if (Entrypoint.IndEnabled)
                    {
                        switch (aVeh.IndStatus)
                        {
                        case IndStatus.Off:
                            Hazard_Off.Draw(e.Graphics);
                            Lind_Off.Draw(e.Graphics);
                            Rind_Off.Draw(e.Graphics);
                            break;

                        case IndStatus.Both:
                            Hazard_On.Draw(e.Graphics);
                            Lind_Off.Draw(e.Graphics);
                            Rind_Off.Draw(e.Graphics);
                            break;

                        case IndStatus.Left:
                            Hazard_Off.Draw(e.Graphics);
                            Lind_On.Draw(e.Graphics);
                            Rind_Off.Draw(e.Graphics);
                            break;

                        case IndStatus.Right:
                            Hazard_Off.Draw(e.Graphics);
                            Lind_Off.Draw(e.Graphics);
                            Rind_On.Draw(e.Graphics);
                            break;

                        default:
                            Hazard_Off.Draw(e.Graphics);
                            Lind_Off.Draw(e.Graphics);
                            Rind_Off.Draw(e.Graphics);
                            break;
                        }
                    }
                    else
                    {
                        Hazard_Off.Draw(e.Graphics);
                        Lind_Off.Draw(e.Graphics);
                        Rind_Off.Draw(e.Graphics);
                    }
                    switch (aVeh.SirenStage)
                    {
                    case SirenStage.Off:
                        Wail_Off.Draw(e.Graphics);
                        Yelp_Off.Draw(e.Graphics);
                        Ext1_Off.Draw(e.Graphics);
                        Ext2_Off.Draw(e.Graphics);
                        break;

                    case SirenStage.One:
                        Wail_On.Draw(e.Graphics);
                        Yelp_Off.Draw(e.Graphics);
                        Ext1_Off.Draw(e.Graphics);
                        Ext2_Off.Draw(e.Graphics);
                        break;

                    case SirenStage.Two:
                        Wail_Off.Draw(e.Graphics);
                        Yelp_On.Draw(e.Graphics);
                        Ext1_Off.Draw(e.Graphics);
                        Ext2_Off.Draw(e.Graphics);
                        break;

                    case SirenStage.Warning:
                        Wail_Off.Draw(e.Graphics);
                        Yelp_Off.Draw(e.Graphics);
                        Ext1_On.Draw(e.Graphics);
                        Ext2_Off.Draw(e.Graphics);
                        break;

                    case SirenStage.Warning2:
                        Wail_Off.Draw(e.Graphics);
                        Yelp_Off.Draw(e.Graphics);
                        Ext1_Off.Draw(e.Graphics);
                        Ext2_On.Draw(e.Graphics);
                        break;

                    case SirenStage.Horn:
                        Wail_Off.Draw(e.Graphics);
                        Yelp_Off.Draw(e.Graphics);
                        Ext1_Off.Draw(e.Graphics);
                        Ext2_Off.Draw(e.Graphics);
                        break;

                    default:
                        Wail_Off.Draw(e.Graphics);
                        Yelp_Off.Draw(e.Graphics);
                        Ext1_Off.Draw(e.Graphics);
                        Ext2_Off.Draw(e.Graphics);
                        break;
                    }
                    switch (aVeh.LightStage)
                    {
                    case LightStage.Off:
                        S1_Off.Draw(e.Graphics);
                        S2_Off.Draw(e.Graphics);
                        S3_Off.Draw(e.Graphics);
                        break;

                    case LightStage.One:
                        S1_On.Draw(e.Graphics);
                        S2_Off.Draw(e.Graphics);
                        S3_Off.Draw(e.Graphics);
                        break;

                    case LightStage.Two:
                        S1_Off.Draw(e.Graphics);
                        S2_On.Draw(e.Graphics);
                        S3_Off.Draw(e.Graphics);
                        break;

                    case LightStage.Three:
                        S1_Off.Draw(e.Graphics);
                        S2_Off.Draw(e.Graphics);
                        S3_On.Draw(e.Graphics);
                        break;

                    default:
                        S1_Off.Draw(e.Graphics);
                        S2_Off.Draw(e.Graphics);
                        S3_Off.Draw(e.Graphics);
                        break;
                    }
                    switch (aVeh.TAStage)
                    {
                    case TAStage.Off:
                        Taleft_Off.Draw(e.Graphics);
                        Tadiv_Off.Draw(e.Graphics);
                        Taright_Off.Draw(e.Graphics);
                        Tawarn_Off.Draw(e.Graphics);
                        break;

                    case TAStage.Left:
                        Taleft_On.Draw(e.Graphics);
                        Tadiv_Off.Draw(e.Graphics);
                        Taright_Off.Draw(e.Graphics);
                        Tawarn_Off.Draw(e.Graphics);
                        break;

                    case TAStage.Diverge:
                        Taleft_Off.Draw(e.Graphics);
                        Tadiv_On.Draw(e.Graphics);
                        Taright_Off.Draw(e.Graphics);
                        Tawarn_Off.Draw(e.Graphics);
                        break;

                    case TAStage.Right:
                        Taleft_Off.Draw(e.Graphics);
                        Tadiv_Off.Draw(e.Graphics);
                        Taright_On.Draw(e.Graphics);
                        Tawarn_Off.Draw(e.Graphics);
                        break;

                    case TAStage.Warn:
                        Taleft_Off.Draw(e.Graphics);
                        Tadiv_Off.Draw(e.Graphics);
                        Taright_Off.Draw(e.Graphics);
                        Tawarn_On.Draw(e.Graphics);
                        break;

                    default:
                        Taleft_Off.Draw(e.Graphics);
                        Tadiv_Off.Draw(e.Graphics);
                        Taright_Off.Draw(e.Graphics);
                        Tawarn_Off.Draw(e.Graphics);
                        break;
                    }
                    if (PlayerController.hornButtonDown)
                    {
                        Horn_On.Draw(e.Graphics);
                    }
                    else
                    {
                        Horn_Off.Draw(e.Graphics);
                    }
                    if (aVeh.SBOn)
                    {
                        SB_On.Draw(e.Graphics);
                    }
                    else
                    {
                        SB_Off.Draw(e.Graphics);
                    }
                    if (aVeh.IntLightOn)
                    {
                        Intlt_On.Draw(e.Graphics);
                    }
                    else
                    {
                        Intlt_Off.Draw(e.Graphics);
                    }
                    if (PlayerController.manButtonDown)
                    {
                        Manual_On.Draw(e.Graphics);
                    }
                    else
                    {
                        Manual_Off.Draw(e.Graphics);
                    }
                    if (PlayerController.blktOn)
                    {
                        Blkt_On.Draw(e.Graphics);
                    }
                    else
                    {
                        Blkt_Off.Draw(e.Graphics);
                    }
                    if (UIHelper.dlsModel != null)
                    {
                        DLSModel dlsModel = UIHelper.dlsModel;
                        switch (aVeh.TAType)
                        {
                        case "three":
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.l.ToInt32() - 1] == SirenStatus.On)
                            {
                                _3_l_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _3_l_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.c.ToInt32() - 1] == SirenStatus.On)
                            {
                                _3_c_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _3_c_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.r.ToInt32() - 1] == SirenStatus.On)
                            {
                                _3_r_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _3_r_Off.Draw(e.Graphics);
                            }
                            break;

                        case "four":
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.l.ToInt32() - 1] == SirenStatus.On)
                            {
                                _4_l_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _4_l_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.cl.ToInt32() - 1] == SirenStatus.On)
                            {
                                _4_cl_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _4_cl_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.cr.ToInt32() - 1] == SirenStatus.On)
                            {
                                _4_cr_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _4_cr_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.r.ToInt32() - 1] == SirenStatus.On)
                            {
                                _4_r_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _4_r_Off.Draw(e.Graphics);
                            }
                            break;

                        case "five":
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.l.ToInt32() - 1] == SirenStatus.On)
                            {
                                _5_l_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _5_l_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.cl.ToInt32() - 1] == SirenStatus.On)
                            {
                                _5_cl_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _5_cl_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.c.ToInt32() - 1] == SirenStatus.On)
                            {
                                _5_c_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _5_c_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.cr.ToInt32() - 1] == SirenStatus.On)
                            {
                                _5_cr_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _5_cr_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.r.ToInt32() - 1] == SirenStatus.On)
                            {
                                _5_r_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _5_r_Off.Draw(e.Graphics);
                            }
                            break;

                        case "six":
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.l.ToInt32() - 1] == SirenStatus.On)
                            {
                                _6_l_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _6_l_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.el.ToInt32() - 1] == SirenStatus.On)
                            {
                                _6_el_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _6_el_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.cl.ToInt32() - 1] == SirenStatus.On)
                            {
                                _6_cl_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _6_cl_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.cr.ToInt32() - 1] == SirenStatus.On)
                            {
                                _6_cr_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _6_cr_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.er.ToInt32() - 1] == SirenStatus.On)
                            {
                                _6_er_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _6_er_Off.Draw(e.Graphics);
                            }
                            if (aVeh.TAStage != TAStage.Off && UIHelper.IsSirenOn[dlsModel.TrafficAdvisory.r.ToInt32() - 1] == SirenStatus.On)
                            {
                                _6_r_On.Draw(e.Graphics);
                            }
                            else
                            {
                                _6_r_Off.Draw(e.Graphics);
                            }
                            break;

                        default:
                            _6_l_Off.Draw(e.Graphics);
                            _6_el_Off.Draw(e.Graphics);
                            _6_cl_Off.Draw(e.Graphics);
                            _6_cr_Off.Draw(e.Graphics);
                            _6_er_Off.Draw(e.Graphics);
                            _6_r_Off.Draw(e.Graphics);
                            break;
                        }
                    }
                    else
                    {
                        _6_l_Off.Draw(e.Graphics);
                        _6_el_Off.Draw(e.Graphics);
                        _6_cl_Off.Draw(e.Graphics);
                        _6_cr_Off.Draw(e.Graphics);
                        _6_er_Off.Draw(e.Graphics);
                        _6_r_Off.Draw(e.Graphics);
                    }
                }
            }
        }
Example #27
0
 public static void Process(object sender, GraphicsEventArgs e)
 {
     _menuPool.Process();
 }
 void GeometryService_SimplifyCompleted(object sender, GraphicsEventArgs e)
 {
     geometryService.LabelPointsAsync(e.Results);
 }
        // Raised once result extents have been reprojected
        private void GeometryService_ProjectCompleted(object sender, GraphicsEventArgs e)
        {
            Queue<LocatorResultViewModel> locatorResults = (Queue<LocatorResultViewModel>)e.UserState;

            // Update each locator result with the reprojected extent
            foreach (Graphic g in e.Results)
            {
                LocatorResultViewModel locatorResult = locatorResults.Dequeue();
                locatorResult.Extent = (Envelope)g.Geometry;

                // Add the result to the results set
                _results.Add(locatorResult);
            }

            // Refresh paged collection to update pagination
            PagedResults.Refresh();

            IsSearching = false; // Reset busy state
            OnSearchCompleted(); // Raise completed event
        }
        private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            e.Graphics.Scaling = FontScaling.ScreenUnits;

            if (Player.CanControlCharacter && Player.Character.isAlive)
            {

                //   e.Graphics.DrawText(string.Format("死者:{0, 3} / 破壊台数:{1,3}  ",DC.AmountPed,DC.AmoutCars), new RectangleF(0.0f, 0.0f, 1.0f, 1.0f), TextAlignment.Center | TextAlignment.Top, screenFont);

                int j = 0;

                for (int i = 0; i < DPL.Timers.Length; i++)
                {
                    if (DPL.Timers[DPL.NumberOfQueue(i)] > 0)
                    {

                        if (DPL.KilledByPlayer[DPL.NumberOfQueue(i)])
                        {
                            Font = miniBigFont;
                        }
                        else {
                            Font = miniFont;
                        }
                        Color cl;
                        if (DPL.IsMissionChar[DPL.NumberOfQueue(i)])
                        {
                            cl = Color.Red;
                        }
                        else
                        {
                            cl = Color.White;
                        }

                        e.Graphics.DrawText(DPL.str[DPL.NumberOfQueue(i)], new RectangleF(0.6f, 0.3f + 0.03f * j, 0.4f, 0.04f), TextAlignment.Right | TextAlignment.VerticalCenter, cl ,Font);
                        DPL.Timers[DPL.NumberOfQueue(i)]--;
                        if (DPL.Timers[DPL.NumberOfQueue(i)] == 0) { DPL.Check(); }

                        j++;
                    }
                }

                while (j < DPL.max)
                {

              //          e.Graphics.DrawText(" ", new RectangleF(0.6f, 0.3f + 0.025f * j, 0.4f, 0.04f), TextAlignment.Right | TextAlignment.VerticalCenter, miniFont);
                    j++;
                }
            }
        }
Example #31
0
 void GeometryService_SimplifyCompleted(object sender, GraphicsEventArgs e)
 {
     doIntersect(e.Results[0].Geometry);
 }
Example #32
0
 private void TeleportCameraScript_PerFrameDrawing(object sender, GraphicsEventArgs e)
 {
     drawCross(e.Graphics);
 }
Example #33
0
 public void DrawBanners(GraphicsEventArgs canvas)
 {
     InternalList.ForEach(menu => menu.DrawBanner(canvas));
 }
        private void NumericHealth_PerFrameDrawing(object sender, GraphicsEventArgs e)
        {
            RectangleF radar = e.Graphics.GetRadarRectangle(FontScaling.Pixel);  // this retrieves the rectangle of the radar on screen

            // calculate the center of the radar
            float radarCenterX = radar.X + radar.Width * 0.5f;
            float radarCenterY = radar.Y + radar.Height * 0.5f;

            e.Graphics.Scaling = FontScaling.Pixel;  // Pixel is the default setting, but you could also use any other scaling instead

            // Create a rectangle to display health and armor
            RectangleF healthArmorBox = new RectangleF(radar.X, radar.Y, radar.Width, radar.Height);

            // Get player's health and armor
            int health = Player.Character.Health;
            int armor  = Player.Character.Armor;

            // Draw numeric health and armor if player isn't dead
            if (Player.Character.isAlive && Player.CanControlCharacter)
            {
                Color healthNormalColorToDraw;
                Color armorColorToDraw;

                // Set different colors for different episodes
                if (Game.CurrentEpisode == GameEpisode.TBOGT)
                {
                    healthNormalColorToDraw = healthNormalTbogtColor;
                    armorColorToDraw        = armorTbogtColor;
                }
                else if (Game.CurrentEpisode == GameEpisode.TLAD)
                {
                    healthNormalColorToDraw = healthNormalTbogtColor;   // TLAD uses white health bar
                    armorColorToDraw        = armorColor;
                }
                else
                {
                    healthNormalColorToDraw = healthNormalColor;
                    armorColorToDraw        = armorColor;
                }

                // Draw numeric health text
                e.Graphics.DrawText(health.ToString(), healthArmorBox, TextAlignment.Left, health > 25 ? healthNormalColorToDraw : healthLowColor);
                // Draw numeric armor if there is one
                if (armor > 0)
                {
                    e.Graphics.DrawText(armor.ToString(), healthArmorBox, TextAlignment.Right, armorColorToDraw);
                }

                // Draw numeric vehicle speed and health if player is in vechicle
                if (Player.Character.isInVehicle())
                {
                    Vehicle vehicle   = Player.Character.CurrentVehicle;
                    float   speedKph  = vehicle.Speed * 3600 / 1000; // convert from m/s to km/h
                    int     vehHealth = vehicle.Health / 10;         // convert it from 1000 to 100 scale

                    // Draw the vehicle health on the bottom left
                    e.Graphics.DrawText(vehHealth.ToString(), healthArmorBox, TextAlignment.Bottom | TextAlignment.Left, vehHealthColor);

                    // Draw the converted speed on bottom right of the radar
                    e.Graphics.DrawText(speedKph.ToString("0"), healthArmorBox, TextAlignment.Bottom | TextAlignment.Right, speedColor);
                }
            }
        }
        void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
        {
            IList<Graphic> results = args.Results;
            if (results == null || results.Count < 1)
                return;

            FindNearbyEventArgs eventArgs = args.UserState as FindNearbyEventArgs;
            if (eventArgs == null)
                return;

            GraphicsLayer targetGraphicsLayer = eventArgs.SelectedLayer;
            if(targetGraphicsLayer == null)
                return;

            #region Draw the buffer graphics layer
            GraphicsLayer bufferGraphicsLayer = new GraphicsLayer() { ID = eventArgs.EventId };            

            // Add the circle graphic
            Graphic circleGraphic = results[0];
            circleGraphic.Attributes.Add(Resources.Strings.BufferDistance, string.Format("{0} {1}", eventArgs.Distance, eventArgs.LinearUnit.ToString()));
            SimpleFillSymbol defaultBufferSymbol = new SimpleFillSymbol()
            {
                BorderBrush = new SolidColorBrush(Colors.Blue),
                BorderThickness = 1,
                Fill = new SolidColorBrush(new Color() { A =(byte)102, R = (byte)255, G = (byte)0, B = (byte)0})
            };
            SimpleRenderer simpleRenderer = new SimpleRenderer() { 
                 Symbol = defaultBufferSymbol,
            };
            bufferGraphicsLayer.Renderer = simpleRenderer;
            Collection<FieldInfo> layerFields = Core.LayerExtensions.GetFields(bufferGraphicsLayer);
            if (layerFields != null)
                layerFields.Add(new FieldInfo() { DisplayName = Resources.Strings.BufferDistance, Name = Resources.Strings.BufferDistance, FieldType = FieldType.Text });             
            bufferGraphicsLayer.Graphics.Add(circleGraphic);
            #endregion

            Graphic graphicCircle = results[0];
            if (graphicCircle != null)
            {
                ESRI.ArcGIS.Client.Geometry.Geometry graphicCircleGeometry = graphicCircle.Geometry;
                if (graphicCircleGeometry != null)
                {
                    // Ensure that atleast the first graphic of the graphics layer has a spatial reference set
                    // because ESRI.ArcGIS.Client.Tasks checks it
                    if (targetGraphicsLayer.Graphics.Count > 0)
                    {
                        if (targetGraphicsLayer.Graphics[0].Geometry != null
                            && targetGraphicsLayer.Graphics[0].Geometry.SpatialReference == null && Map != null)
                        {
                            targetGraphicsLayer.Graphics[0].Geometry.SpatialReference = Map.SpatialReference;
                        }
                    }

                    // The extent of the result layer should be the extent of the circle
                    if(Map != null)
                        Map.ZoomTo(expandExtent(graphicCircleGeometry.Extent));

                    relationAsync(GeometryServiceUrl, targetGraphicsLayer.Graphics.ToList(), results, new object[] { eventArgs, bufferGraphicsLayer });
                }
            }
        }
 private void _rebuildGraphicsHandler(object sender, GraphicsEventArgs e)
 {
     _view.ClearGraphics();
     _model.P = _model.GetP(_model.P.Length);
     _buildGraphics(e.Graphics);
 }
Example #37
0
 void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
 {
     results   = args.Results;
     Completed = true;
     //     GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
 }
Example #38
0
 private void Game_RawFrameRender(object sender, GraphicsEventArgs e)
 {
     e.Graphics.DrawTexture(_texture, new Vector2(100f, 100f), new Vector2(640f, 504f), 0f, 0f, 0f, 0f, 0f);
     e.Graphics.DrawText(Text, "Arial", 12f, new PointF(100f, 100f), Color.Black);
 }
 private static void RawFrameRender(object sender, GraphicsEventArgs e)
 {
     e.Graphics.DrawTexture(Binoculars.BinocularsTexture, 0.0f, 0.0f, Game.Resolution.Width, Game.Resolution.Height);
 }
Example #40
0
 private void AC_GraphicInfoUpdated(object sender, GraphicsEventArgs e)
 {
     this._graphics = e.Graphics;
     //  Console.WriteLine("StaticInfo\r\n");
 }
 void GeometryService_SimplifyCompleted(object sender, GraphicsEventArgs e)
 {
     geometryService.DifferenceAsync(inputGraphicsLayer.Graphics.ToList(), e.Results[0].Geometry);
 }
Example #42
0
 private void OnGraphicsDraw(object sender, GraphicsEventArgs e)
 {
     _game.Tick();
 }
Example #43
0
 private void PAc_GraphicsUpdated(object sender, GraphicsEventArgs e)
 {
     pCarStatus.FillGraphic(e.Graphics);
 }
 void GeometryService_SimplifyCompleted(object sender, GraphicsEventArgs e)
 {
     geometryService.LabelPointsAsync(e.Results);
 }
 private void GeometryService_SimplifyCompleted(object sender, GraphicsEventArgs args)
 {
     doQuery(args.Results[0].Geometry);
 }
Example #46
0
 protected void GraphicsUpdated(object sender, GraphicsEventArgs e)
 {
     gr = e.Graphics;
 }
        public void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
        {
            try
            {
                IList <Graphic> results = args.Results;
                //GraphicsLayer graphicsLayer = _mapControl.Layers["BombEvacLayer"] as GraphicsLayer;
                SimpleFillSymbol insideSymbol = new SimpleFillSymbol()
                {
                    Fill            = new SolidColorBrush(Color.FromArgb(100, (byte)255, (byte)0, (byte)0)),
                    BorderBrush     = new SolidColorBrush(Color.FromArgb(100, (byte)255, (byte)0, (byte)0)),
                    BorderThickness = 1
                };
                SimpleFillSymbol outsideSymbol = new SimpleFillSymbol()
                {
                    Fill            = new SolidColorBrush(Color.FromArgb(100, (byte)232, (byte)158, (byte)28)),
                    BorderBrush     = new SolidColorBrush(Color.FromArgb(100, (byte)232, (byte)158, (byte)28)),
                    BorderThickness = 1
                };
                int     count         = 0;
                Graphic extentGraphic = null;
                Graphic graphic1      = new Graphic();
                Graphic graphic2      = new Graphic();
                foreach (Graphic graphic in results)
                {
                    if (count == 1)
                    {
                        graphic.Symbol = outsideSymbol;
                        outdoorPoly    = graphic.Geometry as client.Geometry.Polygon;
                        graphic.Attributes.Add("Evac", "Shelter-in-Place Zone");
                        graphic1 = graphic;
                    }
                    else
                    {
                        graphic.Symbol = insideSymbol;
                        indoorPoly     = graphic.Geometry as client.Geometry.Polygon;
                        graphic.Attributes.Add("Evac", "Mandatory Evacuation Distance");
                        graphic2 = graphic;
                    }
                    count++;
                    extentGraphic = graphic;
                }
                _graphicsLayer.Graphics.Add(graphic1);
                _graphicsLayer.Graphics.Add(graphic2);

                _mapWidget.Map.ZoomTo(extentGraphic.Geometry);
                callQuery = true;

                ////Select features using polygon
                //IEnumerable<ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                //foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                //{
                //    //if (d.IsSelectable)
                //   // {
                //        System.Diagnostics.Debug.WriteLine(d.Name);
                //        ESRI.ArcGIS.OperationsDashboard.Query query = new ESRI.ArcGIS.OperationsDashboard.Query();

                //        query.SpatialFilter = outdoorPoly;
                //        query.ReturnGeometry = true;
                //        query.Fields = new string[] { d.ObjectIdFieldName };

                //        QueryResult result = await d.ExecuteQueryAsync(query);
                //        System.Diagnostics.Debug.WriteLine("Features : " + result.Features.Count);
                //        if (result.Features.Count > 0)
                //        {

                //            // Get the array of IDs from the query results.
                //            var resultOids = from feature in result.Features select System.Convert.ToInt32(feature.Attributes[d.ObjectIdFieldName]);

                //            // Find the map layer in the map widget that contains the data source.
                //            MapWidget mapW = MapWidget.FindMapWidget(d);
                //            if (mapW != null)
                //            {
                //                // Get the feature layer in the map for the data source.
                //                client.FeatureLayer featureL = mapW.FindFeatureLayer(d);

                //                // NOTE: Can check here if the feature layer is selectable, using code shown above.
                //                // For each result feature, find the corresponding graphic in the map by OID and select it.
                //                foreach (client.Graphic feature in featureL.Graphics)
                //                {
                //                    int featureOid;
                //                    int.TryParse(feature.Attributes[d.ObjectIdFieldName].ToString(), out featureOid);
                //                    if (resultOids.Contains(featureOid))
                //                    {
                //                        feature.Select();
                //                    }
                //                }
                //            }
                //        //}
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in geometry service complete: " + ex.Message);
            }
        }
 public static void OnSimplifyCompleted(object sender, GraphicsEventArgs e)
 {
     if (_editGeometry != null && _editedGraphic != null && e.Results != null && e.Results.Count>0 && e.Results[0] != null)
     {
         _editedGraphic.Geometry = e.Results[0].Geometry;
     }
     // cleanup
     _editedLayer = null;
     _editGeometry = null;
 }
Example #49
0
        static void BoundingBoxGraphicHandler(object sender, GraphicsEventArgs e)
        {
            var    ped = Game.LocalPlayer.Character;
            Weapon wp  = ped.Inventory.EquippedWeaponObject;

            var graphics = e.Graphics;

            if (wp)
            {
                wp.Model.GetDimensions(out var weaponBottomLeft, out var weaponTopRight);

                //Compute the size of the three sides of the box
                Vector3 size = (weaponTopRight - weaponBottomLeft) * BoundingBoxScaleFactor;

                //Compute the offset of the weapon center relative to the origin of the model
                Vector3 centerOffset = (weaponTopRight + weaponBottomLeft) / 2.0f;

                //Now we must rotate the center offset computed on the model, to match the entity orientation
                var rotatedCenterOffset = centerOffset.Rotate(wp.Orientation);

                var wireBoxCenter = wp.Position + rotatedCenterOffset;

                //We compute the wirebox, by computing the edges starting from the wireboxCenter

                var coefficients = new List <int> {
                    -1, 1
                };
                var wireboxEdges = new List <Vector3>();

                /*
                 * The wirebox edges can be computed by summing or subtracting half the size of the wirebox
                 * We have 8 possible combinations, (-1,-1,-1), (-1,-1,+1) etc
                 */
                foreach (var coefficientX in coefficients)
                {
                    foreach (var coefficientY in coefficients)
                    {
                        foreach (var coefficientZ in coefficients)
                        {
                            //this is an offset from the wirebox center, not yet rotated to match the entity orientation
                            Vector3 edgeOffsetFromWireBoxCenter = new Vector3(
                                size.X / 2f * coefficientX,
                                size.Y / 2f * coefficientY,
                                size.Z / 2f * coefficientZ
                                );

                            //rotate the offset to match the entity orientation
                            Vector3 rotatedEdgeOffset = edgeOffsetFromWireBoxCenter.Rotate(wp.Orientation);
                            var     edge = wireBoxCenter + rotatedEdgeOffset;
                            wireboxEdges.Add(edge);
                        }
                    }
                }

                /*
                 * Then we compute the BoundingRect by projecting the BoundingBox on the screen
                 * To always be sure of bounding the full weapon, we take the min and max coordinate for each axis
                 */

                //Pay attention: screen position is not accurate if the game is not fullscreen (it ignores the title bar)
                var screenProjectedEdges = wireboxEdges.Select(World.ConvertWorldPositionToScreenPosition).ToList();

                //max/min x and max/min y can be used to compute the BoundingRect size
                var maxX = screenProjectedEdges.Max(edge => edge.X);
                var maxY = screenProjectedEdges.Max(edge => edge.Y);
                var minX = screenProjectedEdges.Min(edge => edge.X);
                var minY = screenProjectedEdges.Min(edge => edge.Y);

                var rectEdges = new List <Vector2>
                {
                    new Vector2(minX, maxY),
                    new Vector2(minX, minY),
                    new Vector2(maxX, minY),
                    new Vector2(maxX, maxY)
                };

                graphics.DrawLine(rectEdges[0], rectEdges[1], Color.Red);
                graphics.DrawLine(rectEdges[1], rectEdges[2], Color.Red);
                graphics.DrawLine(rectEdges[2], rectEdges[3], Color.Red);
                graphics.DrawLine(rectEdges[3], rectEdges[0], Color.Red);
            }
        }
 private void _buildGraphicsHandler(object sender, GraphicsEventArgs e)
 {
     _view.ClearGraphics();
     _buildGraphics(e.Graphics);
 }
Example #51
0
 // Token: 0x0600003F RID: 63 RVA: 0x00006709 File Offset: 0x00004909
 private static void Process(object sender, GraphicsEventArgs e)
 {
     UI._menuPool.ProcessMenus();
 }
Example #52
0
        /// <summary>
        /// Draw your custom banner.
        /// </summary>
        /// <param name="e">Rage.GraphicsEventArgs to draw on.</param>
        public void DrawBanner(GraphicsEventArgs e)
        {
            if(!Visible || _customBanner == null) return;
            var origRes = Game.Resolution;
            var safe = GetSafezoneBounds();
            float aspectRaidou = origRes.Width / (float)origRes.Height;

            Point bannerPos = new Point(_offset.X + safe.X, _offset.Y + safe.Y);
            Size bannerSize = new Size(431 + WidthOffset, 107);

            PointF pos = new PointF(bannerPos.X / (1080 * aspectRaidou), bannerPos.Y / 1080f);
            SizeF siz = new SizeF(bannerSize.Width / (1080 * aspectRaidou), bannerSize.Height / 1080f);

            //Bug: funky positionment on windowed games + max resolution.

            e.Graphics.DrawTexture(_customBanner, pos.X*Game.Resolution.Width, pos.Y*Game.Resolution.Height, siz.Width*Game.Resolution.Width, siz.Height*Game.Resolution.Height);
        }
        void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
        {
            IList <Graphic> results = args.Results;

            if (results == null || results.Count < 1)
            {
                return;
            }

            FindNearbyEventArgs eventArgs = args.UserState as FindNearbyEventArgs;

            if (eventArgs == null)
            {
                return;
            }

            GraphicsLayer targetGraphicsLayer = eventArgs.SelectedLayer;

            if (targetGraphicsLayer == null)
            {
                return;
            }

            #region Draw the buffer graphics layer
            GraphicsLayer bufferGraphicsLayer = new GraphicsLayer()
            {
                ID = eventArgs.EventId
            };

            // Add the circle graphic
            Graphic circleGraphic = results[0];
            circleGraphic.Attributes.Add(Resources.Strings.BufferDistance, string.Format("{0} {1}", eventArgs.Distance, eventArgs.LinearUnit.ToString()));
            SimpleFillSymbol defaultBufferSymbol = new SimpleFillSymbol()
            {
                BorderBrush     = new SolidColorBrush(Colors.Blue),
                BorderThickness = 1,
                Fill            = new SolidColorBrush(new Color()
                {
                    A = (byte)102, R = (byte)255, G = (byte)0, B = (byte)0
                })
            };
            SimpleRenderer simpleRenderer = new SimpleRenderer()
            {
                Symbol = defaultBufferSymbol,
            };
            bufferGraphicsLayer.Renderer = simpleRenderer;
            Collection <FieldInfo> layerFields = Core.LayerExtensions.GetFields(bufferGraphicsLayer);
            if (layerFields != null)
            {
                layerFields.Add(new FieldInfo()
                {
                    DisplayName = Resources.Strings.BufferDistance, Name = Resources.Strings.BufferDistance, FieldType = FieldType.Text
                });
            }
            bufferGraphicsLayer.Graphics.Add(circleGraphic);
            #endregion

            Graphic graphicCircle = results[0];
            if (graphicCircle != null)
            {
                ESRI.ArcGIS.Client.Geometry.Geometry graphicCircleGeometry = graphicCircle.Geometry;
                if (graphicCircleGeometry != null)
                {
                    // Ensure that atleast the first graphic of the graphics layer has a spatial reference set
                    // because ESRI.ArcGIS.Client.Tasks checks it
                    if (targetGraphicsLayer.Graphics.Count > 0)
                    {
                        if (targetGraphicsLayer.Graphics[0].Geometry != null &&
                            targetGraphicsLayer.Graphics[0].Geometry.SpatialReference == null && Map != null)
                        {
                            targetGraphicsLayer.Graphics[0].Geometry.SpatialReference = Map.SpatialReference;
                        }
                    }

                    // The extent of the result layer should be the extent of the circle
                    if (Map != null)
                    {
                        Map.ZoomTo(expandExtent(graphicCircleGeometry.Extent));
                    }

                    relationAsync(GeometryServiceUrl, targetGraphicsLayer.Graphics.ToList(), results, new object[] { eventArgs, bufferGraphicsLayer });
                }
            }
        }