Exemple #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            renderView.ShowWorkingGrid(false);
            renderView.ExecuteCommand("ShadeWithEdgeMode");
            renderView.ShowCoordinateAxis(false);

            ColorValue clr = new ColorValue(33f / 255f, 40f / 255f, 48f / 255f, 1);
            renderView.SetBackgroundColor(clr, clr, clr);

            Renderer renderer = renderView.Renderer;

            // Customize the Axis
            ScreenWidget coodinateNode = new ScreenWidget();
            AxesWidget axesNode = new AxesWidget();
            axesNode.SetArrowText((int)EnumAxesDirection.Axes_Z, "");
            coodinateNode.SetNode(axesNode);
            coodinateNode.SetWidgetPosition(2);     
            renderer.SetCoordinateWidget(coodinateNode);

            // Set the fixed Top View
            renderer.SetStandardView(EnumStandardView.SV_Top);
            renderer.SetViewType(EnumStandardView.SV_Top);

            this.renderView.RequestDraw();

        }
        protected override void OnAttach()
        {
            base.OnAttach();

            EControl window = ControlDeclarationManager.Instance.CreateControl( "Gui\\AntMenuWindow.gui" );
            Controls.Add( window );

            //( (EButton)window.Controls[ "Maps" ] ).Click += mapsButton_Click;
            ( (EButton)window.Controls[ "LoadSave" ] ).Click += loadSaveButton_Click;
            ( (EButton)window.Controls[ "Options" ] ).Click += optionsButton_Click;
            ( (EButton)window.Controls[ "PostEffects" ] ).Click += postEffectsButton_Click;
            ( (EButton)window.Controls[ "Debug" ] ).Click += debugButton_Click;
            ( (EButton)window.Controls[ "About" ] ).Click += aboutButton_Click;
            ( (EButton)window.Controls[ "ExitToMainMenu" ] ).Click += exitToMainMenuButton_Click;
            ( (EButton)window.Controls[ "Exit" ] ).Click += exitButton_Click;
            ( (EButton)window.Controls[ "Resume" ] ).Click += resumeButton_Click;

            if( GameWindow.Instance == null )
                window.Controls[ "ExitToMainMenu" ].Enable = false;

            if( GameNetworkServer.Instance != null || GameNetworkClient.Instance != null )
            {
                //window.Controls[ "Maps" ].Enable = false;
                window.Controls[ "LoadSave" ].Enable = false;
            }

            MouseCover = true;

            BackColor = new ColorValue( 0, 0, 0, .5f );
        }
        public void configurarLuces(MeshLightData mld)
        {
            Effect effect =  mld.mesh.Effect;
            ColorValue[] lightColors = new ColorValue[3];
            Vector4[] pointLightPositions = new Vector4[3];
            float[] pointLightIntensity = new float[3];
            float[] pointLightAttenuation = new float[3];
            float[] spotLightAngleCos = new float[3];
            float[] spotLightExponent = new float[3];
            Vector4[] spotLightDir = new Vector4[3];

            for (int i = 0; i < 3; i++)
            {
                lightColors[i] = ColorValue.FromColor(mld.lights[i].color);
                pointLightPositions[i] =  TgcParserUtils.vector3ToVector4(mld.lights[i].pos);
                spotLightDir[i] = TgcParserUtils.vector3ToVector4(mld.lights[i].direccion);
                pointLightIntensity[i] = mld.lights[i].intencidad;
                pointLightAttenuation[i] = mld.lights[i].atenuacion;
                spotLightExponent[i] = mld.lights[i].exp;
                spotLightAngleCos[i] = FastMath.ToRad(mld.lights[i].angleCos);
            }
            effect.SetValue("spotLightAngleCos", spotLightAngleCos);
            effect.SetValue("spotLightExponent", spotLightExponent);
            effect.SetValue("lightIntensity", pointLightIntensity);
            effect.SetValue("lightAttenuation", pointLightAttenuation);
            effect.SetValue("lightColor", lightColors);
            effect.SetValue("spotLightDir", spotLightDir);
            effect.SetValue("lightPosition", pointLightPositions);
        }
        ///////////////////////////////////////////

        protected override void OnAttach()
        {
            base.OnAttach();

            //create window
            window = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\RegisterWindow.gui");
            Controls.Add(window);

            MouseCover = true;
            BackColor = new ColorValue(0, 0, 0, .5f);

            RealName = (EditBox)window.Controls["RealName"];
            UserName = (EditBox)window.Controls["UserName"];
            
            //Age = (EditBox)window.Controls["Age"];
            //OfAge = (CheckBox)window.Controls["OfAge"];

            Pass1 = (PasswordBox)window.Controls["Pass1"];
            Pass2 = (PasswordBox)window.Controls["Pass2"];
            Email = (EditBox)window.Controls["Email"];

            ((Button)window.Controls["Exit"]).Click += Exit_Click;
            ((Button)window.Controls["Register"]).Click += Register_Click;
            ((Button)window.Controls["Cancel"]).Click += Cancel_Click;
        }
Exemple #5
0
 public Popup2(RenderSystem rs, Texture tex, int x, int y, float duration, ColorValue modColor)
 {
     this.x = x;
     this.y = y;
     this.texture = tex;
     this.duration = duration;
     this.modColor = modColor;
 }
Exemple #6
0
        public ColorValue[] States; // Modulate colors for all possible control states

        #endregion Fields

        #region Methods

        /// <summary>Blend the colors together</summary>
        public void Blend(ControlState state, float elapsedTime, float rate)
        {
            if ((States == null) || (States.Length == 0) )
                return; // Nothing to do

            ColorValue destColor = States[(int)state];
            Current = ColorOperator.Lerp(Current, destColor, 1.0f - (float)Math.Pow(rate, 30 * elapsedTime) );
        }
 /// <summary>Creates a new StringBlock</summary>
 /// <param name="text">Text to render</param>
 /// <param name="textBox">Text box to constrain text</param>
 /// <param name="alignment">Font alignment</param>
 /// <param name="size">Font size in pixels(max height of line)</param>
 /// <param name="color">Color</param>
 /// <param name="kerning">true to use kerning, false otherwise.</param>
 public StringBlock(string text, RectangleF textRect, Align alignment,
     float size, ColorValue color, bool kerning)
 {
     Text = text;
     TextRect = textRect;
     ViewportRect = textRect;
     Alignment = alignment;
     Size = size;
     Color = color;
     Kerning = kerning;
 }
Exemple #8
0
        /// <summary>
        /// Gets the interpolated colour between two pixels from an image.
        /// Interpolate a texture pixel by hand. (fx, fy) are in texture coordinates,
        /// ranging [0-1] across the entire texture.
        /// Smooth blending is only done on the x coordinate.
        /// Wrapping is only supported on X as well.</summary>
        public static ColorValue GetInterpolatedColour(float fx, float fy, Bitmap img, bool wrapX)
        {
            if (img == null)
                return CaelumUtils.ColorWhite;

            // Get the image width
            int imgWidth = img.Width;
            int imgHeight = img.Height;

            // Calculate pixel y coord.
            int py = Convert.ToInt32( MathFunctions.Floor(Math.Abs(fy)*(imgHeight - 1) ));
            // Snap to py image bounds.
            py = Math.Max(0, Math.Min(py, imgHeight - 1));

            // Get the two closest pixels on x.
            // px1 and px2 are the closest integer pixels to px.
            float px = fx * (img.Width - 1);
            int px1 = Convert.ToInt32( MathFunctions.Floor(px));
            int px2 = Convert.ToInt32( Math.Ceiling(px));

            if (wrapX)
            {
                // Wrap x coords. The funny addition ensures that it does
                // "the right thing" for negative values.
                px1 = (px1 % imgWidth + imgWidth) % imgWidth;
                px2 = (px2 % imgWidth + imgWidth) % imgWidth;
            }
            else
            {
                px1 = Math.Max(0, Math.Min(px1, imgWidth - 1));
                px2 = Math.Max(0, Math.Min(px2, imgWidth - 1));
            }

            float R, G, B;

            // Gets (px1, py) pixel
            Color col = img.GetPixel(px1, py);
            R = col.R; G = col.G; B = col.B;
            ColorValue c1 = new ColorValue(R / 255, G / 255, B / 255);

            // Gets (px2, py) pixel
            col = img.GetPixel(px2, py);
            R = col.R; G = col.G; B = col.B;
            ColorValue c2 = new ColorValue(R / 255, G / 255, B / 255);

            // Blend the two pixels together.
            // diff is the weight between pixel 1 and pixel 2.
            float diff = px - px1;
            ColorValue cf = c1 * (1 - diff) + c2 * diff;

            return cf;
        }
Exemple #9
0
        public ColorValue Current; // Current color

        /// <summary>Initialize the color blending</summary>
        public void Initialize(ColorValue defaultColor, ColorValue disabledColor, ColorValue hiddenColor)
        {
            // Create the array
            States = new ColorValue[(int)ControlState.LastState];
            for(int i = 0; i < States.Length; i++)
            {
                States[i] = defaultColor;
            }

            // Store the data
            States[(int)ControlState.Disabled] = disabledColor;
            States[(int)ControlState.Hidden] = hiddenColor;
            Current = hiddenColor;
        }
Exemple #10
0
        protected Control()
        {

            //txtHint = TextRenderingHint.ClearTypeGridFit;
            modColor = ColorValue.White;

            controls = new List<Control>();

            //InputEngine = gameUI.InputEngine;

            //InputEngine.KeyStateChanged += this._OnKeyStateChanged;
            //InputEngine.MouseDown += this._OnMouseDown;
            //InputEngine.MouseMove += this._OnMouseMove;
            //InputEngine.MouseUp += this._OnMouseUp;
            //InputEngine.MouseWheel += this._OnMouseWheel;
        }
Exemple #11
0
        public void R_FR()
        {
            TimeSpan ts = DateTime.Now - t_start;
            double t = ts.TotalSeconds;

            dev2.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Blue, 1.0f, 0);
            dev2.BeginScene();

            System.Drawing.Color col = System.Drawing.Color.White;
            Direct3D.Material mtrl = new Direct3D.Material();
            mtrl.Diffuse = col;
            mtrl.Ambient = col;
            dev2.Material = mtrl;

            Vector4 lightdir = new Vector4((float)Math.Cos(Environment.TickCount / 550.0f), 1.0f, (float)Math.Sin(Environment.TickCount / 250.0f), 0);

            dev2.Transform.World = Matrix.RotationAxis(new Vector3((float)Math.Cos(t), 1, (float)Math.Sin(Environment.TickCount / 250.0f)), Environment.TickCount / 3000.0f);

            dev2.Transform.View = Matrix.LookAtLH(new Vector3(0.0f, 4.0f, -5.0f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f));

            dev2.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, 1.0f, 1.0f, 100.0f);

            ColorValue WhiteColor = new ColorValue(1.0f, 1.0f, 1.0f, 1.0f);
            ColorValue YellowColor = new ColorValue(1.0f, 1.0f, 0.0f, 1.0f);

            eff.SetValue("projectionMatrix", dev2.Transform.Projection);
            eff.SetValue("viewMatrix", dev2.Transform.View);
            eff.SetValue("worldMatrix", dev2.Transform.World);
            eff.SetValue("appTime", (float)t);

            //		eff.SetValue("g_MaterialDiffuseColor", WhiteColor);
            //		eff.SetValue("g_nNumLights", 1);

            dev2.SetStreamSource(0, vb, 0);
            dev2.VertexFormat = CustomVertex.PositionNormal.Format;

            eff.Begin(0);
            for (int p = 0; p < 4; p++)
            {
                eff.BeginPass(p);
                dev2.DrawPrimitives(PrimitiveType.TriangleList, 0, usteps * vsteps * 2 );
                eff.EndPass();
            }
            eff.End();
            dev2.EndScene();
            dev2.Present();
        }
		public static void AddCircle(this GuiRenderer renderer, Vec2 center, ColorValue color, Vec2 radius, float startAngle = 0f, float endAngle = (float)Math.PI * 2f, float divisions = 16)
		{
			List<GuiRenderer.TriangleVertex> tris = new List<GuiRenderer.TriangleVertex>((int)(divisions * 3));
			float inc = (float)Math.PI / divisions;
			float cond = endAngle * (float)(1f - 1f / divisions);
			float curAngle;
			for (curAngle = startAngle; curAngle < cond; curAngle += inc)
			{
				tris.Add(new GuiRenderer.TriangleVertex(center, color));
				tris.Add(CircleVertex(curAngle, center, radius, color));
				tris.Add(CircleVertex(curAngle + inc, center, radius, color));
			}
			tris.Add(new GuiRenderer.TriangleVertex(center, color));
			tris.Add(CircleVertex(curAngle, center, radius, color));
			tris.Add(CircleVertex(endAngle, center, radius, color));
			renderer.AddTriangles(tris);
		}
        protected override void OnAttach()
        {
            base.OnAttach();

            Control window = ControlDeclarationManager.Instance.CreateControl("Gui\\AboutWindow.gui");
            Controls.Add(window);

            window.Controls["Version"].Text = EngineVersionInformation.Version;

            ((Button)window.Controls["Quit"]).Click += delegate(Button sender)
            {
                SetShouldDetach();
            };

            BackColor = new ColorValue(0, 0, 0, .5f);
            MouseCover = true;
        }
        ///////////////////////////////////////////
        protected override void OnAttach()
        {
            base.OnAttach();

            //disable check for disconnection
            GameEngineApp.Instance.Client_AllowCheckForDisconnection = false;

            //register config fields
            EngineApp.Instance.Config.RegisterClassParameters( GetType() );

            //create window
            window = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\MultiplayerLoginWindow.gui" );
            Controls.Add( window );

            MouseCover = true;
            BackColor = new ColorValue( 0, 0, 0, .5f );

            //initialize controls

            buttonCreateServer = (EButton)window.Controls[ "CreateServer" ];
            buttonCreateServer.Click += CreateServer_Click;

            buttonConnect = (EButton)window.Controls[ "Connect" ];
            buttonConnect.Click += Connect_Click;

            ( (EButton)window.Controls[ "Exit" ] ).Click += Exit_Click;

            //generate user name
            if( string.IsNullOrEmpty( userName ) )
            {
                EngineRandom random = new EngineRandom();
                userName = "******" + random.Next( 1000 ).ToString( "D03" );
            }

            editBoxUserName = (EEditBox)window.Controls[ "UserName" ];
            editBoxUserName.Text = userName;
            editBoxUserName.TextChange += editBoxUserName_TextChange;

            editBoxConnectTo = (EEditBox)window.Controls[ "ConnectTo" ];
            editBoxConnectTo.Text = connectToAddress;
            editBoxConnectTo.TextChange += editBoxConnectTo_TextChange;

            SetInfo( "", false );
        }
Exemple #15
0
        public override void OnSetFaceColor(ColorValue clr)
        {
            if (clr.ToRGBA() == faceStyle.GetColor().ToRGBA())
                return;

            FaceStyle fs = null;
            if (!faceStyleDict.TryGetValue(clr.ToRGBA(), out fs))
            {
                fs = new FaceStyle();
                fs.SetColor(clr);
                faceStyleDict.Add(clr.ToRGBA(), fs);
            }

            faceStyle = fs;

            fileSys.WriteLine(String.Format("{0} {1} {2}", clr.R, clr.G, clr.B));
            fileSys.Flush();
        }
Exemple #16
0
        ///////////////////////////////////////////
        protected override void OnAttach()
        {
            base.OnAttach();

            //create window
            window = ControlDeclarationManager.Instance.CreateControl( "Gui\\GUISamples3Window.gui" );
            Controls.Add( window );

            addressEditBox = (EditBox)window.Controls[ "Address" ];
            addressEditBox.PreKeyDown += addressEditBox_PreKeyDown;

            webBrowserControl = (Engine.UISystem.WebBrowserControl)window.Controls[ "WebBrowser" ];

            ( (Button)window.Controls[ "Close" ] ).Click += Close_Click;
            ( (Button)window.Controls[ "Go" ] ).Click += go_Click;

            BackColor = new ColorValue( 0, 0, 0, .5f );
            MouseCover = true;
        }
        protected override void OnAttach()
        {
            base.OnAttach();

            TopMost = true;

            EControl window = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\MessageBoxWindow.gui" );
            Controls.Add( window );

            window.Controls[ "MessageText" ].Text = messageText;

            window.Text = caption;

            ( (EButton)window.Controls[ "OK" ] ).Click += OKButton_Click;

            BackColor = new ColorValue( 0, 0, 0, .5f );

            EngineApp.Instance.RenderScene();
        }
        ///////////////////////////////////////////

        protected override void OnAttach()
        {
            base.OnAttach();

            //create window
            window = ControlDeclarationManager.Instance.CreateControl("Gui\\MultiViewConfigurationWindow.gui");
            Controls.Add(window);

            //update views list box
            listBoxViews = (ListBox)window.Controls["ViewList"];
            listBoxViews.Items.Clear();
            foreach (ViewConfigurations configuration in Enum.GetValues(typeof(ViewConfigurations)))
                listBoxViews.Items.Add(configuration.ToString());
            listBoxViews.SelectedIndex = (int)lastViewsConfiguration;
            listBoxViews.SelectedIndexChange += listBoxViews_SelectedIndexChange;

            //showMainScene checkbox
            checkBoxShowMainScene = (CheckBox)window.Controls["ShowMainScene"];
            if (MultiViewRenderingManager.Instance != null)
                checkBoxShowMainScene.Checked = MultiViewRenderingManager.Instance.MainCameraDraw3DScene;
            checkBoxShowMainScene.CheckedChange += checkBoxShowMainScene_CheckedChange;
            checkBoxShowMainScene.Enable = listBoxViews.SelectedIndex != 0;

            //view opacity
            scrollBarViewsOpacity = (ScrollBar)window.Controls["ViewsOpacity"];
            if (MultiViewRenderingManager.Instance != null && MultiViewRenderingManager.Instance.Views.Count > 0)
                scrollBarViewsOpacity.Value = MultiViewRenderingManager.Instance.Views[0].Opacity;
            scrollBarViewsOpacity.ValueChange += scrollBarViewsOpacity_ValueChange;
            scrollBarViewsOpacity.Enable = listBoxViews.SelectedIndex != 0;

            checkBoxDrawDebugInfo = (CheckBox)window.Controls["DrawDebugInfo"];
            if (MultiViewRenderingManager.Instance != null)
                checkBoxDrawDebugInfo.Checked = MultiViewRenderingManager.Instance.DrawDebugInfo;
            checkBoxDrawDebugInfo.CheckedChange += checkBoxDrawDebugInfo_CheckedChange;
            checkBoxDrawDebugInfo.Enable = listBoxViews.SelectedIndex != 0;

            ((Button)window.Controls["Close"]).Click += Close_Click;

            BackColor = new ColorValue(0, 0, 0, .5f);
            MouseCover = true;
        }
Exemple #19
0
        ///////////////////////////////////////////
        protected override void OnAttach()
        {
            base.OnAttach();

            //create window
            window = ControlDeclarationManager.Instance.CreateControl( "Gui\\GUISamples2Window.gui" );
            Controls.Add( window );

            sceneBox = (SceneBox)window.Controls[ "SceneBox" ];

            ( (Button)window.Controls[ "Close" ] ).Click += Close_Click;
            ( (Button)window.Controls[ "SceneBoxChangeModel" ] ).Click += SceneBoxChangeModel_Click;
            ( (Button)window.Controls[ "SceneBoxCreateParticle" ] ).Click += SceneBoxCreateParticle_Click;
            ( (Button)window.Controls[ "SceneBoxFullScreenEffect" ] ).Click += SceneBoxFullScreenEffect_Click;
            //( (Button)window.Controls[ "RenderToTextureTest" ] ).Click += RenderToTextureTest_Click;

            BackColor = new ColorValue( 0, 0, 0, .5f );
            MouseCover = true;

            renderToTexture.Create( window.Controls[ "RenderToTextureOutput" ] );
        }
        private void Fire()
        {
            if (!Visible)
                return;

            if (fireworkBulletType == null)
                return;

            Bullet bullet = (Bullet)Entities.Instance.Create(fireworkBulletType, Map.Instance);

            bullet.Position = GetInterpolatedPosition() + new Vec3(0, 0, .1f);

            EngineRandom random = World.Instance.Random;
            bullet.Rotation = Rotation *
                new Angles(random.NextFloatCenter() * 25, 90 + random.NextFloatCenter() * 25, 0).ToQuat();

            bullet.PostCreate();

            foreach (MapObjectAttachedObject attachedObject in bullet.AttachedObjects)
            {
                MapObjectAttachedRibbonTrail attachedRibbonTrail = attachedObject as MapObjectAttachedRibbonTrail;
                if (attachedRibbonTrail == null)
                    continue;

                ColorValue color;
                switch (random.Next(4))
                {
                    case 0: color = new ColorValue(1, 0, 0); break;
                    case 1: color = new ColorValue(0, 1, 0); break;
                    case 2: color = new ColorValue(0, 0, 1); break;
                    case 3: color = new ColorValue(1, 1, 0); break;
                    default: color = new ColorValue(0, 0, 0); break;
                }

                if (attachedRibbonTrail.RibbonTrail != null)
                    attachedRibbonTrail.RibbonTrail.Chains[0].InitialColor = color;
            }
        }
		protected override void OnAttach()
		{
			base.OnAttach();

			Control window = ControlDeclarationManager.Instance.CreateControl( "Gui\\AboutWindow.gui" );
			Controls.Add( window );

			window.Controls[ "Version" ].Text = EngineVersionInformation.Version;

			( (Button)window.Controls[ "Quit" ] ).Click += delegate( Button sender )
			{
				SetShouldDetach();
			};

			SDKInfo.SDKs sdk = SDKInfo.GetSDK();
			float alpha = .08f;

			if( sdk > SDKInfo.SDKs.Free )
			{
				window.Controls[ "FreeSDK" ].ColorMultiplier = new ColorValue( 1, 1, 1, alpha );
				window.Controls[ "FreeSDKBackground" ].ColorMultiplier = new ColorValue( 1, 1, 1, alpha );
			}
			if( sdk > SDKInfo.SDKs.Professional )
			{
				window.Controls[ "ProfessionalSDK" ].ColorMultiplier = new ColorValue( 1, 1, 1, alpha );
				window.Controls[ "ProfessionalSDKBackground" ].ColorMultiplier = new ColorValue( 1, 1, 1, alpha );
			}
			if( sdk > SDKInfo.SDKs.Unlimited )
			{
				window.Controls[ "UnlimitedSDK" ].ColorMultiplier = new ColorValue( 1, 1, 1, alpha );
				window.Controls[ "UnlimitedSDKBackground" ].ColorMultiplier = new ColorValue( 1, 1, 1, alpha );
			}

			BackColor = new ColorValue( 0, 0, 0, .5f );
			MouseCover = true;
		}
Exemple #22
0
        public void FillEllipse(double x1, double y1, double w, double h, ColorValue FillColor, ColorValue BorderColor)
        {
            using (var paint = new SKPaint())
            {
                paint.IsAntialias = true;

                var rect = new SKRect((float)x1, (float)y1, (float)(x1 + w), (float)(y1 + h));
                paint.Color    = GetColorFromColorValue(FillColor);
                paint.IsStroke = false;

                canvas.DrawOval(rect, paint);

                paint.Color       = GetColorFromColorValue(BorderColor);
                paint.IsStroke    = true;
                paint.StrokeWidth = 0.5f;
                canvas.DrawOval(rect, paint);
            }
        }
        public override void Render()
        {
            PreRender();

            //Habilitar luz
            var    lightEnable = lightEnableModifier.Value;
            Effect currentShader;
            string currentTechnique;

            if (lightEnable)
            {
                //Shader personalizado de iluminacion
                currentShader    = effect;
                currentTechnique = "ThreeLightsTechnique";
            }
            else
            {
                //Sin luz: Restaurar shader default
                currentShader    = TGCShaders.Instance.TgcMeshShader;
                currentTechnique = TGCShaders.Instance.GetTGCMeshTechnique(TgcMesh.MeshRenderType.DIFFUSE_MAP);
            }

            //Aplicar a cada mesh el shader actual
            foreach (var meshData in meshesWithLight)
            {
                meshData.mesh.Effect    = currentShader;
                meshData.mesh.Technique = currentTechnique;
            }

            var eyePosition = Camera.Position;

            //Renderizar meshes con BumpMapping
            foreach (var meshData in meshesWithLight)
            {
                var mesh = meshData.mesh;

                if (true) //FIXME da error cuando se desabilitan las luces.) (lightEnable)
                {
                    mesh.Effect.SetValue("eyePosition", TGCVector3.TGCVector3ToFloat4Array(eyePosition));
                    mesh.Effect.SetValue("bumpiness", bumpinessModifier.Value);
                    mesh.Effect.SetValue("reflection", reflectionModifier.Value);

                    //Cargar variables de shader del Material
                    mesh.Effect.SetValue("materialEmissiveColor", ColorValue.FromColor(mEmissiveModifier.Value));
                    mesh.Effect.SetValue("materialAmbientColor", ColorValue.FromColor(mAmbientModifier.Value));
                    mesh.Effect.SetValue("materialDiffuseColor", ColorValue.FromColor(mDiffuseModifier.Value));
                    mesh.Effect.SetValue("materialSpecularColor", ColorValue.FromColor(mSpecularModifier.Value));
                    mesh.Effect.SetValue("materialSpecularExp", specularExModifier.Value);

                    //CubeMap
                    mesh.Effect.SetValue("texCubeMap", cubeMap);

                    //Cargar variables de shader de las 3 luces
                    //Intensidad y atenuacion deberian ser atributos propios de cada luz
                    var lightIntensity   = lightIntensityModifier.Value;
                    var lightAttenuation = lightAttenuationModifier.Value;
                    mesh.Effect.SetValue("lightIntensity", new[] { lightIntensity, lightIntensity, lightIntensity });
                    mesh.Effect.SetValue("lightAttenuation", new[] { lightAttenuation, lightAttenuation, lightAttenuation });

                    mesh.Effect.SetValue("lightColor",
                                         new[]
                    {
                        ColorValue.FromColor(meshData.lights[0].color),
                        ColorValue.FromColor(meshData.lights[1].color),
                        ColorValue.FromColor(meshData.lights[2].color)
                    });
                    mesh.Effect.SetValue("lightPosition", TGCVector4.TGCVector4ArrayToVector4Array(
                                             new[]
                    {
                        TGCVector3.TGCVector3ToTGCVector4(meshData.lights[0].pos),
                        TGCVector3.TGCVector3ToTGCVector4(meshData.lights[1].pos),
                        TGCVector3.TGCVector3ToTGCVector4(meshData.lights[2].pos)
                    }));
                }

                //Renderizar modelo
                mesh.Render();
            }

            //Renderizar meshes comunes
            foreach (var mesh in commonMeshes)
            {
                mesh.Render();
            }

            PostRender();
        }
 public BoxGroupAttribute(string name, bool drawName, bool drawLine, bool nameAsCallback, ColorValue backgroundColor,
                          ColorValue contentColor = ColorValue.Default) : base(name, drawName, drawLine, nameAsCallback, backgroundColor,
                                                                               contentColor)
 {
     BackgroundColor = backgroundColor;
 }
 public BoxAttribute(string name, ColorValue backgroundColor, ColorValue contentColor = ColorValue.Default) :
     base(name, backgroundColor, contentColor)
 {
 }
Exemple #26
0
 public FoldAttribute(string name, bool drawName, bool nameAsCallback, ColorValue backgroundColor,
                      ColorValue contentColor = ColorValue.Default) : base(name, drawName, nameAsCallback, backgroundColor, contentColor)
 {
 }
Exemple #27
0
        public void DrawLine(double x1, double y1, double x2, double y2, double strokeThickness, ColorValue color)
        {
            //Pen p = new Pen(GetPresetBrush(color), (float)strokeThickness);
            //canvas.DrawLine(p, (float)x1, (float)y1, (float)x2, (float)y2);

            using (var paint = new SKPaint())
            {
                paint.IsAntialias = true;
                paint.Color       = GetColorFromColorValue(color);

                paint.StrokeWidth = (float)strokeThickness;

                paint.StrokeCap = SKStrokeCap.Round;
                var t = paint.StrokeCap;

                canvas.DrawLine((float)x1, (float)y1, (float)x2, (float)y2, paint);
            }
        }
Exemple #28
0
    // Use this for initialization
    void Start()
    {
        alive = true;

        hp = 50;

        currentColor = ColorValue.RED;
        colorTimer = 0.0f;

        eventMan = GameObject.Find ("Global Script Executor").GetComponent<CustomEventManager>();
        eventMan.EventListeners += RecieveEvent;

        //target = GameObject.Find("Doctor").GetComponent<Transform>();

        mMaterial = renderer.material;
        mAnimator = new CustomAnimator(ref mMaterial, 4, 1);

        mAnimator.CreateAnimation("Red", 0, 0, 10000000);
        mAnimator.CreateAnimation("Blue", 1, 1, 10000000);
        mAnimator.CreateAnimation("Green", 2, 2, 10000000);
        mAnimator.CreateAnimation("Death", 3, 3, 10000000);
    }
 protected BaseSimpleScrollGroupAttribute(string groupName, float height, bool drawName, bool nameAsCallback, string backgroundColorName,
                                          string contentColorName, bool drawLine, ColorValue lineColor)
     : base(groupName, drawName, nameAsCallback, backgroundColorName, contentColorName, drawLine, lineColor) => Height = height;
Exemple #30
0
 public Drawable(char symbol, Color16 color)
 {
     Symbol = symbol;
     Color  = new ColorValue(color);
 }
        void AddTextWithShadow(GuiRenderer renderer, string text, Vec2 position,
                               HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, ColorValue color)
        {
            Vec2 shadowOffset = 2.0f / RendererWorld.Instance.DefaultViewport.DimensionsInPixels.Size.ToVec2();

            renderer.AddText(text, position + shadowOffset, horizontalAlign, verticalAlign,
                             new ColorValue(0, 0, 0, color.Alpha / 2));
            renderer.AddText(text, position, horizontalAlign, verticalAlign, color);
        }
Exemple #32
0
        public override void Handle(IIntentState <ColorValue> obj)
        {
            byte byteLevel = ColorValue.GetGrayscaleLevel(obj.GetValue().Color);

            EvaluatorValue = new _64BitCommand(byteLevel);
        }
Exemple #33
0
 public void Handle(ColorCommand obj)
 {
     EvaluatorValue = new _64BitCommand(ColorValue.GetGrayscaleLevel(obj.CommandValue));
 }
Exemple #34
0
 private SKColor GetColorFromColorValue(ColorValue v)
 {
     return(new SKColor(v.R, v.G, v.B, v.A));
 }
Exemple #35
0
 public void DrawString(double x, double y, string text, ColorValue color)
 {
     DrawString(x, y, text, 9, color);
 }
Exemple #36
0
        //Draw minimap
        void Minimap_RenderUI( EControl sender, GuiRenderer renderer )
        {
            Rect screenMapRect = sender.GetScreenRectangle();

            Bounds initialBounds = Map.Instance.InitialCollisionBounds;
            Rect mapRect = new Rect( initialBounds.Minimum.ToVec2(), initialBounds.Maximum.ToVec2() );

            Vec2 mapSizeInv = new Vec2( 1, 1 ) / mapRect.Size;

            //draw units
            Vec2 screenPixel = new Vec2( 1, 1 ) / new Vec2( EngineApp.Instance.VideoMode.Size.ToVec2() );

            foreach( Entity entity in Map.Instance.Children )
            {
                RTSUnit unit = entity as RTSUnit;
                if( unit == null )
                    continue;

                Rect rect = new Rect( unit.MapBounds.Minimum.ToVec2(), unit.MapBounds.Maximum.ToVec2() );

                rect -= mapRect.Minimum;
                rect.Minimum *= mapSizeInv;
                rect.Maximum *= mapSizeInv;
                rect.Minimum = new Vec2( rect.Minimum.X, 1.0f - rect.Minimum.Y );
                rect.Maximum = new Vec2( rect.Maximum.X, 1.0f - rect.Maximum.Y );
                rect.Minimum *= screenMapRect.Size;
                rect.Maximum *= screenMapRect.Size;
                rect += screenMapRect.Minimum;

                //increase 1 pixel
                rect.Maximum += new Vec2( screenPixel.X, -screenPixel.Y );

                ColorValue color;

                if( playerFaction == null || unit.Intellect == null || unit.Intellect.Faction == null )
                    color = new ColorValue( 1, 1, 0 );
                else if( playerFaction == unit.Intellect.Faction )
                    color = new ColorValue( 0, 1, 0 );
                else
                    color = new ColorValue( 1, 0, 0 );

                renderer.AddQuad( rect, color );
            }

            //Draw camera borders
            {
                Camera camera = RendererWorld.Instance.DefaultCamera;

                if( camera.Position.Z > 0 )
                {

                    Plane groundPlane = new Plane( 0, 0, 1, 0 );

                    Vec2[] points = new Vec2[ 4 ];

                    for( int n = 0; n < 4; n++ )
                    {
                        Vec2 p = Vec2.Zero;

                        switch( n )
                        {
                        case 0: p = new Vec2( 0, 0 ); break;
                        case 1: p = new Vec2( 1, 0 ); break;
                        case 2: p = new Vec2( 1, 1 ); break;
                        case 3: p = new Vec2( 0, 1 ); break;
                        }

                        Ray ray = camera.GetCameraToViewportRay( p );

                        float scale;
                        groundPlane.RayIntersection( ray, out scale );

                        Vec3 pos = ray.GetPointOnRay( scale );
                        if( ray.Direction.Z > 0 )
                            pos = ray.Origin + ray.Direction.GetNormalize() * 10000;

                        Vec2 point = pos.ToVec2();

                        point -= mapRect.Minimum;
                        point *= mapSizeInv;
                        point = new Vec2( point.X, 1.0f - point.Y );
                        point *= screenMapRect.Size;
                        point += screenMapRect.Minimum;

                        points[ n ] = point;
                    }

                    for( int n = 0; n < 4; n++ )
                        renderer.AddLine( points[ n ], points[ ( n + 1 ) % 4 ], new ColorValue( 1, 1, 1 ),
                            screenMapRect );
                }
            }
        }
 public Color(ColorValue colorValue)
 {
     Value = colorValue;
 }
Exemple #38
0
        /////////////////////////////////////////////////////////////////////////
        ////////////////////////////////INIT/////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////


        public void init(string MediaDir, string shaderDir, TgcCamera camara)
        {
            var d3dDevice = D3DDevice.Instance.Device;

            resolucionX = d3dDevice.PresentationParameters.BackBufferWidth;
            resolucionY = d3dDevice.PresentationParameters.BackBufferHeight;

            D3DDevice.Instance.ParticlesEnabled = true;
            D3DDevice.Instance.EnableParticles();

            var loader = new TgcSceneLoader();

            scene = loader.loadSceneFromFile(MediaDir + "NivelFisica1\\EscenaSceneEditorFisica1-TgcScene.xml");

            SetearAguas();

            pathDeLaCancion = MediaDir + "Musica\\FeverTime.mp3";


            meshesDeLaEscena = new List <TgcMesh>();

            HUD       = new Sprite(D3DDevice.Instance.Device);
            vida      = TgcTexture.createTexture(MediaDir + "Textures\\vida.png");
            fisicaLib = TgcTexture.createTexture(MediaDir + "NivelFisica1\\Textures\\TexturaTapaLibro.jpg");

            var skeletalLoader = new TgcSkeletalLoader();

            personajePrincipal =
                skeletalLoader.loadMeshAndAnimationsFromFile(
                    MediaDir + "Robot\\Robot-TgcSkeletalMesh.xml",
                    MediaDir + "Robot\\",
                    new[]
            {
                MediaDir + "Robot\\Caminando-TgcSkeletalAnim.xml",
                MediaDir + "Robot\\Parado-TgcSkeletalAnim.xml",
                MediaDir + "Robot\\Empujar-TgcSkeletalAnim.xml",
            });
            //Configurar animacion inicial
            personajePrincipal.playAnimation("Parado", true);

            personajePrincipal.Position = puntoCheckpointActual;
            personajePrincipal.RotateY(Geometry.DegreeToRadian(180));


            camaraInterna = new TgcThirdPersonCamera(personajePrincipal.Position, 250, 500);
            // camara = camaraInterna;
            camaraInterna.rotateY(Geometry.DegreeToRadian(180));

            librosAdquiridos = new Boton(cantidadLibrosAdquiridos.ToString(), resolucionX - (resolucionX / 9), resolucionY - (resolucionY / 7), null);

            plataforma1 = scene.Meshes[164];
            plataforma2 = scene.Meshes[165];

            plataformasMovibles.Add(plataforma1);
            plataformasMovibles.Add(plataforma2);

            bolaDeCanion1 = scene.Meshes[172];
            bolaDeCanion2 = scene.Meshes[173];
            bolaDeCanion3 = scene.Meshes[174];

            posicionInicialBolaDeCanion1 = scene.Meshes[172].Position;
            posicionInicialBolaDeCanion2 = scene.Meshes[173].Position;
            posicionInicialBolaDeCanion3 = scene.Meshes[174].Position;

            bolasDeCanion.Add(bolaDeCanion1);
            bolasDeCanion.Add(bolaDeCanion2);
            bolasDeCanion.Add(bolaDeCanion3);

            pathTexturaEmisorDeParticulas = MediaDir + "Textures\\fuego.png";
            cantidadDeParticulas          = 10;

            emisorDeParticulas1 = new ParticleEmitter(pathTexturaEmisorDeParticulas, cantidadDeParticulas);
            emisorDeParticulas1.MinSizeParticle    = 30f;
            emisorDeParticulas1.MaxSizeParticle    = 30f;
            emisorDeParticulas1.ParticleTimeToLive = 1f;
            emisorDeParticulas1.CreationFrecuency  = 1f; //0.25
            emisorDeParticulas1.Dispersion         = 500;
            emisorDeParticulas1.Speed          = new TGCVector3(-25, 40, 50);
            posicionInicialEmisorDeParticulas1 = new TGCVector3(1935, 200, 4345);
            emisorDeParticulas1.Position       = posicionInicialEmisorDeParticulas1;

            emisorDeParticulas2 = new ParticleEmitter(pathTexturaEmisorDeParticulas, cantidadDeParticulas);
            emisorDeParticulas2 = new ParticleEmitter(pathTexturaEmisorDeParticulas, cantidadDeParticulas);
            emisorDeParticulas2.MinSizeParticle    = 30f;
            emisorDeParticulas2.MaxSizeParticle    = 30f;
            emisorDeParticulas2.ParticleTimeToLive = 1f;
            emisorDeParticulas2.CreationFrecuency  = 1f;
            emisorDeParticulas2.Dispersion         = 500;
            emisorDeParticulas2.Speed          = new TGCVector3(-25, 40, 50);
            posicionInicialEmisorDeParticulas2 = new TGCVector3(2205, 200, 4345);
            emisorDeParticulas2.Position       = posicionInicialEmisorDeParticulas2;

            emisorDeParticulas3 = new ParticleEmitter(pathTexturaEmisorDeParticulas, cantidadDeParticulas);
            emisorDeParticulas3 = new ParticleEmitter(pathTexturaEmisorDeParticulas, cantidadDeParticulas);
            emisorDeParticulas3.MinSizeParticle    = 30f;
            emisorDeParticulas3.MaxSizeParticle    = 30f;
            emisorDeParticulas3.ParticleTimeToLive = 1f;
            emisorDeParticulas3.CreationFrecuency  = 1f;
            emisorDeParticulas3.Dispersion         = 500;
            emisorDeParticulas3.Speed          = new TGCVector3(-25, 40, 50);
            posicionInicialEmisorDeParticulas3 = new TGCVector3(2495, 200, 4345);
            emisorDeParticulas3.Position       = posicionInicialEmisorDeParticulas3;

            reproductorMp3.FileName = pathDeLaCancion;
            reproductorMp3.play(true);

            AdministradorDeEscenarios.getSingleton().SetCamara(camaraInterna);

            cantVidas = 3;
            effect    = TgcShaders.loadEffect(shaderDir + "MultiDiffuseLights.fx");
            for (var i = 224; i < 250; ++i)
            {
                lights.Add(scene.Meshes[i]);
            }

            scene.Meshes[4].D3dMesh.ComputeNormals();
            scene.Meshes[48].D3dMesh.ComputeNormals();
            var lightColors           = new ColorValue[lights.Count];
            var pointLightPositions   = new Vector4[lights.Count];
            var pointLightIntensity   = new float[lights.Count];
            var pointLightAttenuation = new float[lights.Count];

            for (var i = 0; i < lights.Count; i++)
            {
                var lightMesh = lights[i];

                lightColors[i]           = ColorValue.FromColor(Color.White);
                pointLightPositions[i]   = TGCVector3.Vector3ToVector4(lightMesh.BoundingBox.Position);
                pointLightIntensity[i]   = 20;
                pointLightAttenuation[i] = 0.07f;
            }
            tecnicaNormal = scene.Meshes[0].Technique;
            sinEfectos    = scene.Meshes[0].Effect;
            foreach (var mesh in scene.Meshes)
            {
                //if (mesh.Name.Contains("Box") || mesh.Name.Contains("Madera") || mesh.Name.Contains("East") || mesh.Name.Contains("South") || mesh.Name.Contains("North") || mesh.Name.Contains("West"))
                if (!mesh.Name.Contains("Floor"))
                {
                    continue;
                }
                mesh.Effect = effect;

                mesh.Effect.SetValue("lightColor", lightColors);
                mesh.Effect.SetValue("lightPosition", pointLightPositions);
                mesh.Effect.SetValue("lightIntensity", pointLightIntensity);
                mesh.Effect.SetValue("lightAttenuation", pointLightAttenuation);
                mesh.Effect.SetValue("materialEmissiveColor", ColorValue.FromColor(Color.Black));
                mesh.Effect.SetValue("materialDiffuseColor", ColorValue.FromColor(Color.White));
                mesh.Technique = "MultiDiffuseLightsTechnique";
                if (mesh.Name.Contains("Box") || mesh.Name.Contains("Madera"))
                {
                    mesh.Effect.SetValue("lightAttenuation", pointLightAttenuation);
                    mesh.D3dMesh.ComputeNormals();
                }
            }

            AplicarShaders(shaderDir);
        }
Exemple #39
0
 public FoldGroupAttribute(ColorValue backgroundColor, ColorValue contentColor = ColorValue.Default) :
     base("", false, false, backgroundColor, contentColor)
 {
 }
Exemple #40
0
        public override void render(float elapsedTime)
        {
            Device device = GuiController.Instance.D3dDevice;

            //Habilitar luz
            bool   lightEnable = (bool)GuiController.Instance.Modifiers["lightEnable"];
            Effect currentShader;
            String currentTechnique;

            if (lightEnable)
            {
                //Shader personalizado de iluminacion
                currentShader    = this.effect;
                currentTechnique = "MultiDiffuseLightsTechnique";
            }
            else
            {
                //Sin luz: Restaurar shader default
                currentShader    = GuiController.Instance.Shaders.TgcMeshShader;
                currentTechnique = GuiController.Instance.Shaders.getTgcMeshTechnique(TgcMesh.MeshRenderType.DIFFUSE_MAP);
            }

            //Aplicar a cada mesh el shader actual
            foreach (TgcMesh mesh in scene.Meshes)
            {
                mesh.Effect    = currentShader;
                mesh.Technique = currentTechnique;
            }



            //Configurar los valores de cada luz
            Vector3 move = new Vector3(0, 0, ((bool)GuiController.Instance.Modifiers["lightMove"]) ? interp.update() : 0);

            ColorValue[] lightColors           = new ColorValue[lightMeshes.Length];
            Vector4[]    pointLightPositions   = new Vector4[lightMeshes.Length];
            float[]      pointLightIntensity   = new float[lightMeshes.Length];
            float[]      pointLightAttenuation = new float[lightMeshes.Length];
            for (int i = 0; i < lightMeshes.Length; i++)
            {
                TgcBox lightMesh = lightMeshes[i];
                lightMesh.Position = origLightPos[i] + Vector3.Scale(move, i + 1);

                lightColors[i]           = ColorValue.FromColor(lightMesh.Color);
                pointLightPositions[i]   = TgcParserUtils.vector3ToVector4(lightMesh.Position);
                pointLightIntensity[i]   = (float)GuiController.Instance.Modifiers["lightIntensity"];
                pointLightAttenuation[i] = (float)GuiController.Instance.Modifiers["lightAttenuation"];
            }


            //Renderizar meshes
            foreach (TgcMesh mesh in scene.Meshes)
            {
                if (lightEnable)
                {
                    //Cargar variables de shader
                    mesh.Effect.SetValue("lightColor", lightColors);
                    mesh.Effect.SetValue("lightPosition", pointLightPositions);
                    mesh.Effect.SetValue("lightIntensity", pointLightIntensity);
                    mesh.Effect.SetValue("lightAttenuation", pointLightAttenuation);
                    mesh.Effect.SetValue("materialEmissiveColor", ColorValue.FromColor((Color)GuiController.Instance.Modifiers["mEmissive"]));
                    mesh.Effect.SetValue("materialDiffuseColor", ColorValue.FromColor((Color)GuiController.Instance.Modifiers["mDiffuse"]));
                }

                //Renderizar modelo
                mesh.render();
            }


            //Renderizar meshes de luz
            for (int i = 0; i < lightMeshes.Length; i++)
            {
                TgcBox lightMesh = lightMeshes[i];
                lightMesh.render();
            }
        }
 public BoxAttribute(ColorValue backgroundColor, ColorValue contentColor = ColorValue.Default) :
     base(backgroundColor, contentColor)
 {
 }
        protected override void OnAttach()
        {
            base.OnAttach();

            window = ControlDeclarationManager.Instance.CreateControl("Gui\\WorldLoadSaveWindow.gui");
            Controls.Add(window);

            BackColor  = new ColorValue(0, 0, 0, .5f);
            MouseCover = true;

            //worlds listBox
            {
                listBox = (ListBox)window.Controls["List"];

                for (int slotIndex = 1; slotIndex <= slotCount; slotIndex++)
                {
                    string fileName = GetWorldFileName(slotIndex);

                    string item;
                    if (VirtualFile.Exists(fileName))
                    {
                        item = fileName;
                    }
                    else
                    {
                        item = emptySlotText;
                    }

                    listBox.Items.Add(item);
                }

                listBox.SelectedIndexChange += listBox_SelectedIndexChanged;
                if (listBox.Items.Count != 0 && listBox.SelectedIndex == -1)
                {
                    listBox.SelectedIndex = 0;
                }
                if (listBox.Items.Count != 0)
                {
                    listBox_SelectedIndexChanged(null);
                }
            }

            //Load button event handler
            loadButton        = (Button)window.Controls["Load"];
            loadButton.Click += delegate(Button sender)
            {
                string item = (string)listBox.SelectedItem;
                if (item != null && item != emptySlotText)
                {
                    Load(item);
                }
            };

            //Save button event handler
            saveButton        = (Button)window.Controls["Save"];
            saveButton.Click += delegate(Button sender)
            {
                string item = (string)listBox.SelectedItem;
                if (item != null)
                {
                    if (item == emptySlotText)
                    {
                        item = GetWorldFileName(listBox.SelectedIndex + 1);
                    }
                    Save(item);
                }
            };

            //Close button event handler
            ((Button)window.Controls["Close"]).Click += delegate(Button sender)
            {
                SetShouldDetach();
            };

            UpdateButtonsEnabledFlag();
        }
 public BoxGroupAttribute(string name, ColorValue backgroundColor, ColorValue contentColor = ColorValue.Default) :
     base(name, true, true, false, backgroundColor, contentColor)
 {
     BackgroundColor = backgroundColor;
 }
Exemple #44
0
 /// <summary>Set the font</summary>
 public void SetFont(uint font, ColorValue defaultFontColor, DrawTextFormat format)
 {
     // Store data
     FontIndex = font;
     textFormat = format;
     FontColor.Initialize(defaultFontColor);
 }
Exemple #45
0
 public static MightyInfo <Color?> GetColorInfo(this BaseMightyMember mightyMember, object target, string colorName,
                                                ColorValue colorValue) => GetColorInfo(mightyMember, target, colorName, GetColor(colorValue, null));
        public override void OnGetRenderSceneData(ViewportRenderingContext context, GetRenderSceneDataMode mode)
        {
            base.OnGetRenderSceneData(context, mode);

            if (mode == GetRenderSceneDataMode.InsideFrustum)
            {
                var context2 = context.objectInSpaceRenderingContext;

                //!!!!опцию DisplayPathfindingGeometries

                bool show = (ParentScene.GetDisplayDevelopmentDataInThisApplication() /*!!!! && ParentScene.DisplayLights */) ||
                            context2.selectedObjects.Contains(this) || context2.canSelectObjects.Contains(this) || context2.objectToCreate == this;
                if (show)
                {
                    ColorValue color;
                    if (context2.selectedObjects.Contains(this))
                    {
                        color = ProjectSettings.Get.SelectedColor;
                    }
                    else if (context2.canSelectObjects.Contains(this))
                    {
                        color = ProjectSettings.Get.CanSelectColor;
                    }
                    else
                    {
                        //!!!!
                        color = new ColorValue(0, 0, 1);
                        //color = ProjectSettings.Get.SceneShowLightColor;
                    }

                    var viewport = context.Owner;
                    viewport.Simple3DRenderer.SetColor(color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier);
                    DebugDraw(viewport);
                }
                //if( !show )
                //	context.disableShowingLabelForThisObject = true;



                //var displayColor = DisplayColor.Value;
                //if( displayColor.Alpha != 0 )
                //{
                //	context.viewport.Simple3DRenderer.SetColor( displayColor, displayColor * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier );
                //	RenderShape( context );
                //}

                //if( DisplayObjects )
                //{
                //	var color = DisplayObjectsColor.Value;
                //	if( color.Alpha != 0 )
                //	{
                //		context.viewport.Simple3DRenderer.SetColor( color, color * ProjectSettings.Get.HiddenByOtherObjectsColorMultiplier );
                //		//foreach( var refObject in Objects )
                //		//{
                //		//	var obj = refObject.Value;
                //		//	if( obj != null && obj.EnabledInHierarchy )
                //		//		context.viewport.Simple3DRenderer.AddBounds( obj.SpaceBounds.CalculatedBoundingBox );
                //		//}

                //		foreach( var item in CalculateObjects() )
                //			RenderItem( context.viewport.Simple3DRenderer, item );
                //	}
                //}
            }
        }
Exemple #47
0
 public override void SetValue(string name, System.Drawing.Color val)
 {
     this._effect.SetValue(name, ColorValue.FromColor(val));
 }
Exemple #48
0
        public void FillRectangle(double x, double y, double w, double h, ColorValue fillColor, ColorValue borderColor)
        {
            var rect = new SKRect((float)x, (float)y, (float)(x + w), (float)(y + h));

            using (var paint = new SKPaint())
            {
                paint.Color = GetColorFromColorValue(borderColor);
                canvas.DrawRect(rect, paint);
            }
        }
Exemple #49
0
 /// <summary>Set the texture</summary>
 public void SetTexture(uint tex, System.Drawing.Rectangle texRect, ColorValue defaultTextureColor)
 {
     // Store data
     TextureIndex = tex;
     textureRect = texRect;
     TextureColor.Initialize(defaultTextureColor);
 }
Exemple #50
0
 public static Color GetColor(this BaseMightyMember mightyMember, object target, string colorName, ColorValue colorValue,
                              Color defaultColor) => GetColor(mightyMember, target, colorName, GetColor(colorValue, defaultColor));
Exemple #51
0
    // Update is called once per frame
    void Update()
    {
        if(mAnimator == null) return;

        if(alive)
        {
            colorTimer += Time.deltaTime;

            if(hp > 35 && colorTimer > 6.0f)
            {
                colorTimer -= 6.0f;

                int color = Random.Range(0, 3);
                currentColor = (ColorValue)color;

            }else if(hp > 20 && colorTimer > 4.0f)
            {
                colorTimer -= 4.0f;

                int color = Random.Range(0, 3);
                currentColor = (ColorValue)color;

            }else if(colorTimer > 2.0f)
            {
                colorTimer -= 2.0f;

                int color = Random.Range(0, 3);
                currentColor = (ColorValue)color;

            }

            if(currentColor == ColorValue.RED)
                mAnimator.PlayAnimation("Red", false);
            else if(currentColor == ColorValue.GREEN)
                mAnimator.PlayAnimation("Green", false);
            else if(currentColor == ColorValue.BLUE)
                mAnimator.PlayAnimation("Blue", false);

            Vector3 v3 = target.position - transform.position;
            float angle = Mathf.Atan2(v3.y, v3.x) * Mathf.Rad2Deg;
            Quaternion qTo = Quaternion.AngleAxis (angle, Vector3.forward);
            transform.rotation = Quaternion.RotateTowards (transform.rotation, qTo, 60 * Time.deltaTime);
            transform.Translate (Vector3.right * 80 * Time.deltaTime);
            Vector3 temp = transform.position;
            temp.z = 7.0f;
            transform.position = temp;

        }else
        {
            rigidbody.velocity = new Vector3(0,0,0);

            deathTimer += Time.deltaTime;
            if (deathTimer > 3){
                Destroy(gameObject);
            }
        }
    }
Exemple #52
0
        ///////////////////////////////////////////

        protected override void OnAttach()
        {
            base.OnAttach();

            //register config fields
            EngineApp.Instance.Config.RegisterClassParameters(GetType());

            //create window
            window = ControlDeclarationManager.Instance.CreateControl(Dialogs.MultiplayerLobby);
            Controls.Add(window);

            MouseCover = true;
            BackColor  = new ColorValue(0, 0, 0, .5f);

            ((Button)window.Controls["Exit"]).Click += Exit_Click;

            buttonStart = (Button)window.Controls["Start"];
            if (GameNetworkServer.Instance != null)
            {
                buttonStart.Click += Start_Click;
            }
            if (GameNetworkClient.Instance != null)
            {
                buttonStart.Enable = false;
            }

            listBoxUsers = (ListBox)window.Controls["Users"];

            editBoxChatMessage             = (EditBox)window.Controls["ChatMessage"];
            editBoxChatMessage.PreKeyDown += editBoxChatMessage_PreKeyDown;

            //comboBoxMaps
            {
                comboBoxMaps = (ComboBox)window.Controls["Maps"];

                if (GameNetworkServer.Instance != null)
                {
                    //dynamic map example
                    comboBoxMaps.Items.Add(new MapItem(dynamicMapExampleText, false));
                    if (lastMapName == dynamicMapExampleText)
                    {
                        comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1;
                    }

                    string[] mapList = VirtualDirectory.GetFiles("", "*.map",
                                                                 SearchOption.AllDirectories);

                    foreach (string mapName in mapList)
                    {
                        //check for network support
                        if (VirtualFile.Exists(string.Format("{0}\\NoNetworkSupport.txt",
                                                             Path.GetDirectoryName(mapName))))
                        {
                            continue;
                        }

                        bool recommended =
                            mapName.Contains("JigsawPuzzleGame") ||
                            mapName.Contains("TankDemo") ||
                            mapName.Contains("DeathmatchDemo");

                        comboBoxMaps.Items.Add(new MapItem(mapName, recommended));
                        if (mapName == lastMapName)
                        {
                            comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1;
                        }
                    }

                    comboBoxMaps.SelectedIndexChange += comboBoxMaps_SelectedIndexChange;

                    if (comboBoxMaps.Items.Count != 0 && comboBoxMaps.SelectedIndex == -1)
                    {
                        comboBoxMaps.SelectedIndex = 0;
                    }
                }
                else
                {
                    comboBoxMaps.Enable = false;
                }
            }

            //checkBoxAllowToConnectDuringGame
            {
                checkBoxAllowToConnectDuringGame = (CheckBox)window.Controls[
                    "AllowToConnectDuringGame"];

                if (GameNetworkServer.Instance != null)
                {
                    checkBoxAllowToConnectDuringGame.CheckedChange +=
                        checkBoxAllowToConnectDuringGame_CheckedChange;
                }
                else
                {
                    checkBoxAllowToConnectDuringGame.Enable = false;
                }
            }

            //server specific
            GameNetworkServer server = GameNetworkServer.Instance;

            if (server != null)
            {
                //for receive map name
                server.UserManagementService.AddUserEvent += Server_UserManagementService_AddUserEvent;

                //for chat support
                server.ChatService.ReceiveText += Server_ChatService_ReceiveText;
            }

            //client specific
            GameNetworkClient client = GameNetworkClient.Instance;

            if (client != null)
            {
                //for receive map name
                client.CustomMessagesService.ReceiveMessage +=
                    Client_CustomMessagesService_ReceiveMessage;

                //for chat support
                client.ChatService.ReceiveText += Client_ChatService_ReceiveText;

                AddMessage(string.Format("Connected to server: \"{0}\"", client.RemoteServerName));
                foreach (string serviceName in client.ServerConnectedNode.RemoteServices)
                {
                    AddMessage(string.Format("Server service: \"{0}\"", serviceName));
                }
            }

            UpdateControls();
        }
Exemple #53
0
        protected override void OnRenderUI( GuiRenderer renderer )
        {
            base.OnRenderUI( renderer );

            UpdateHUD();

            //render user names for moving pieces by users
            foreach( Entity entity in Map.Instance.Children )
            {
                JigsawPuzzlePiece piece = entity as JigsawPuzzlePiece;
                if( piece != null )
                {
                    string userName = null;

                    if( EntitySystemWorld.Instance.IsServer() )
                    {
                        if( piece.Server_MovingByUser != null )
                            userName = piece.Server_MovingByUser.Name;
                    }
                    if( EntitySystemWorld.Instance.IsClientOnly() )
                    {
                        if( piece.Client_MovingByUser != null )
                            userName = piece.Client_MovingByUser.Name;
                    }

                    if( !string.IsNullOrEmpty( userName ) )
                    {
                        Vec2 screenPosition;
                        if( RendererWorld.Instance.DefaultCamera.ProjectToScreenCoordinates(
                            piece.Position, out screenPosition ) )
                        {
                            renderer.AddText( userName,
                                screenPosition, HorizontalAlign.Left, VerticalAlign.Top,
                                new ColorValue( 0, 1, 0, .75f ) );
                        }
                    }
                }
            }

            //show list of users
            if( GameNetworkServer.Instance != null || GameNetworkClient.Instance != null )
            {
                List<string> lines = new List<string>();

                lines.Add( "Players:" );

                if( GameNetworkServer.Instance != null )
                {
                    UserManagementServerNetworkService userService =
                        GameNetworkServer.Instance.UserManagementService;

                    foreach( UserManagementServerNetworkService.UserInfo user in userService.Users )
                    {
                        string line = "  " + user.Name;
                        if( user == userService.ServerUser )
                            line += " (you)";
                        lines.Add( line );
                    }
                }

                if( GameNetworkClient.Instance != null )
                {
                    UserManagementClientNetworkService userService =
                        GameNetworkClient.Instance.UserManagementService;

                    foreach( UserManagementClientNetworkService.UserInfo user in userService.Users )
                    {
                        string line = "  " + user.Name;
                        if( user == userService.ThisUser )
                            line += " (you)";
                        lines.Add( line );
                    }
                }

                renderer.AddTextLines( lines, new Vec2( .01f, .15f ), HorizontalAlign.Left, VerticalAlign.Top,
                    0, new ColorValue( 1, 1, 0 ) );
            }

            //screenMessages
            {
                Vec2 pos = new Vec2( .01f, .9f );
                for( int n = screenMessages.Count - 1; n >= 0; n-- )
                {
                    ScreenMessage message = screenMessages[ n ];

                    ColorValue color = new ColorValue( 1, 1, 1, message.timeRemaining );
                    if( color.Alpha > 1 )
                        color.Alpha = 1;

                    renderer.AddText( message.text, pos, HorizontalAlign.Left, VerticalAlign.Top,
                        color );
                    pos.Y -= renderer.DefaultFont.Height;
                }
            }

            //Game is paused on server
            if( EntitySystemWorld.Instance.IsClientOnly() && !EntitySystemWorld.Instance.Simulation )
            {
                renderer.AddText( "Game is paused on server", new Vec2( .5f, .5f ),
                    HorizontalAlign.Center, VerticalAlign.Center, new ColorValue( 1, 0, 0 ) );
            }
        }
Exemple #54
0
        public void Load(BinaryReaderBE reader)
        {
            long origin = reader.BaseStream.Position;

            Version                         = reader.ReadInt16();
            Type                            = (CollectionType)reader.ReadInt16();
            Flags                           = reader.ReadUInt16();
            colorCount                      = reader.ReadInt16();
            colorTableCount                 = reader.ReadInt16();
            colorTableOffset                = reader.ReadInt32();
            highLevelShapeCount             = reader.ReadInt16();
            highLevelShapeOffsetTableOffset = reader.ReadInt32();
            lowLevelShapeCount              = reader.ReadInt16();
            lowLevelShapeOffsetTableOffset  = reader.ReadInt32();
            bitmapCount                     = reader.ReadInt16();
            bitmapOffsetTableOffset         = reader.ReadInt32();
            pixelsToWorld                   = reader.ReadInt16();
            size                            = reader.ReadInt32();
            reader.BaseStream.Seek(253 * 2, SeekOrigin.Current);

            colorTables.Clear();
            reader.BaseStream.Seek(origin + colorTableOffset, SeekOrigin.Begin);
            for (int i = 0; i < colorTableCount; ++i)
            {
                ColorValue[] table = new ColorValue[colorCount];
                for (int j = 0; j < colorCount; ++j)
                {
                    table[j].Load(reader);
                }
                colorTables.Add(table);
            }

            reader.BaseStream.Seek(origin + bitmapOffsetTableOffset, SeekOrigin.Begin);
            bitmaps.Clear();
            for (int i = 0; i < bitmapCount; ++i)
            {
                int  offset   = reader.ReadInt32();
                long position = reader.BaseStream.Position;
                reader.BaseStream.Seek(origin + offset, SeekOrigin.Begin);
                Bitmap bitmap = new Bitmap();
                bitmap.Load(reader);
                bitmaps.Add(bitmap);
                reader.BaseStream.Seek(position, SeekOrigin.Begin);
            }

            reader.BaseStream.Seek(origin + lowLevelShapeOffsetTableOffset, SeekOrigin.Begin);
            frames.Clear();
            for (int i = 0; i < lowLevelShapeCount; ++i)
            {
                int  offset   = reader.ReadInt32();
                long position = reader.BaseStream.Position;
                reader.BaseStream.Seek(origin + offset, SeekOrigin.Begin);
                ShapeFrame frame = new ShapeFrame();
                frame.Load(reader);
                frames.Add(frame);
                reader.BaseStream.Seek(position, SeekOrigin.Begin);
            }

            reader.BaseStream.Seek(origin + highLevelShapeOffsetTableOffset, SeekOrigin.Begin);
            sequences.Clear();
            for (int i = 0; i < highLevelShapeCount; ++i)
            {
                int  offset   = reader.ReadInt32();
                long position = reader.BaseStream.Position;
                reader.BaseStream.Seek(origin + offset, SeekOrigin.Begin);
                ShapeSequence sequence = new ShapeSequence();
                sequence.Load(reader);
                sequences.Add(sequence);
                reader.BaseStream.Seek(position, SeekOrigin.Begin);
            }
        }
Exemple #55
0
        void UpdateHUD()
        {
            Camera camera = RendererWorld.Instance.DefaultCamera;

            hudControl.Visible = Map.Instance.DrawGui;

            //Selected units bounds
            if( taskTargetBuildMeshObject == null )
            {
                Vec3 mouseMapPos = Vec3.Zero;
                Unit mouseOnObject = null;

                bool pickingSuccess = false;

                if( !EngineApp.Instance.MouseRelativeMode )
                {
                    Ray ray = camera.GetCameraToViewportRay( EngineApp.Instance.MousePosition );
                    if( !float.IsNaN( ray.Direction.X ) )
                    {
                        RayCastResult result = PhysicsWorld.Instance.RayCast( ray,
                            (int)ContactGroup.CastOnlyContact );
                        if( result.Shape != null )
                        {
                            pickingSuccess = true;
                            mouseOnObject = MapSystemWorld.GetMapObjectByBody( result.Shape.Body ) as Unit;
                            mouseMapPos = result.Position;
                        }
                    }

                    if( selectMode && selectDraggedMouse )
                    {
                        Rect rect = new Rect( selectStartPos );
                        rect.Add( EngineApp.Instance.MousePosition );

                        Map.Instance.GetObjectsByScreenRectangle( rect, GameFilterGroups.UnitFilterGroup,
                            delegate( MapObject obj )
                            {
                                Unit unit = (Unit)obj;

                                camera.DebugGeometry.Color = new ColorValue( 1, 1, 0 );
                                Bounds bounds = obj.MapBounds;
                                bounds.Expand( .1f );
                                camera.DebugGeometry.AddBounds( bounds );
                            } );
                    }
                    else
                    {
                        if( pickingSuccess && IsMouseInActiveArea() )
                        {
                            if( mouseOnObject != null )
                            {
                                camera.DebugGeometry.Color = new ColorValue( 1, 1, 0 );

                                Bounds bounds = mouseOnObject.MapBounds;
                                bounds.Expand( .1f );
                                camera.DebugGeometry.AddBounds( bounds );
                            }
                            else
                            {
                                camera.DebugGeometry.Color = new ColorValue( 1, 0, 0 );
                                camera.DebugGeometry.AddSphere( new Sphere( mouseMapPos, .4f ), 16 );
                            }
                        }
                    }
                }

                //objects selected
                foreach( Unit unit in selectedUnits )
                {
                    ColorValue color;

                    if( playerFaction == null || unit.Intellect == null || unit.Intellect.Faction == null )
                        color = new ColorValue( 1, 1, 0 );
                    else if( playerFaction == unit.Intellect.Faction )
                        color = new ColorValue( 0, 1, 0 );
                    else
                        color = new ColorValue( 1, 0, 0 );

                    camera.DebugGeometry.Color = color;
                    camera.DebugGeometry.AddBounds( unit.MapBounds );
                }
            }

            //taskTargetBuild
            if( taskTargetBuildMeshObject != null )
            {
                taskTargetBuildSceneNode.Visible = false;

                Ray ray = new Ray( Vec3.Zero, Vec3.Zero );

                //pick on active area
                if( IsMouseInActiveArea() )
                    ray = camera.GetCameraToViewportRay( EngineApp.Instance.MousePosition );

                //pick on minimap
                if( minimapControl.GetScreenRectangle().IsContainsPoint( MousePosition ) )
                {
                    Vec2 p = GetMapPositionByMouseOnMinimap();
                    ray = new Ray( new Vec3( p.X, p.Y, 1000 ), new Vec3( .001f, .001f, -2000 ) );
                }

                if( ray.Direction != Vec3.Zero )
                {
                    RayCastResult result = PhysicsWorld.Instance.RayCast( ray,
                        (int)ContactGroup.CastOnlyCollision );
                    if( result.Shape != null )
                    {
                        Vec3 mouseMapPos = result.Position;

                        //snap
                        mouseMapPos += new Vec3( .5f, .5f, 0 );
                        mouseMapPos = new Vec3( (int)mouseMapPos.X, (int)mouseMapPos.Y, (int)mouseMapPos.Z );

                        //RTSMine specific
                        bool mineFound = false;
                        if( taskTargetBuildingType is RTSMineType )
                        {
                            Bounds bounds = new Bounds( mouseMapPos - new Vec3( 2, 2, 2 ),
                                mouseMapPos + new Vec3( 2, 2, 2 ) );
                            Map.Instance.GetObjects( bounds, delegate( MapObject obj )
                            {
                                if( obj.Type.Name == "RTSGeyser" )
                                {
                                    mineFound = true;
                                    mouseMapPos = obj.Position;
                                }
                            } );
                        }

                        taskTargetBuildSceneNode.Position = mouseMapPos;
                        taskTargetBuildSceneNode.Visible = true;

                        //check free for build
                        bool free = IsFreeForBuildTaskTargetBuild( mouseMapPos );

                        //RTSMine specific
                        if( taskTargetBuildingType is RTSMineType )
                            if( !mineFound )
                                free = false;

                        foreach( MeshObject.SubObject subMesh in taskTargetBuildMeshObject.SubObjects )
                            subMesh.MaterialName = free ? "Green" : "Red";
                    }
                }
            }

            //Selected units HUD
            {
                string text = "";

                if( selectedUnits.Count > 1 )
                {
                    foreach( Unit unit in selectedUnits )
                        text += unit.ToString() + "\n";
                }

                if( selectedUnits.Count == 1 )
                {
                    Unit unit = selectedUnits[ 0 ];

                    text += unit.ToString() + "\n";
                    text += "\n";
                    text += string.Format( "Life: {0}/{1}\n", unit.Life, unit.Type.LifeMax );

                    text += "Intellect:\n";
                    if( unit.Intellect != null )
                    {
                        text += string.Format( "- {0}\n", unit.Intellect.ToString() );
                        FactionType faction = unit.Intellect.Faction;
                        text += string.Format( "- Faction: {0}\n", faction != null ? faction.ToString() : "null" );

                        RTSUnitAI rtsUnitAI = unit.Intellect as RTSUnitAI;
                        if( rtsUnitAI != null )
                        {
                            text += string.Format( "- CurrentTask: {0}\n", rtsUnitAI.CurrentTask.ToString() );
                        }
                    }
                    else
                        text += string.Format( "- null\n" );

                }

                hudControl.Controls[ "SelectedUnitsInfo" ].Text = text;

                UpdateControlPanel();
            }

            //RTSFactionManager
            {
                string text = "";

                if( RTSFactionManager.Instance != null )
                {
                    foreach( RTSFactionManager.FactionItem item in RTSFactionManager.Instance.Factions )
                    {
                        string s = "  " + item.ToString();
                        s += ", Money " + ( (int)item.Money ).ToString();
                        if( item.FactionType == playerFaction )
                            s += " (Player)";
                        text += s + "\n";
                    }
                }
                else
                    text += "RTSFactionManager not exists\n";

                hudControl.Controls[ "DebugText" ].Text = text;
            }

            UpdateHUDControlIcon();
        }
Exemple #56
0
        public Texture2D GetShape(byte ColorTableIndex, byte BitmapIndex)
        {
            Bitmap bitmap = bitmaps[BitmapIndex];

            ColorValue[] colorTable = colorTables[ColorTableIndex];
            Color[]      colors     = new Color[colorTable.Length];
            bool         hasAlpha   = false;

            for (int i = 0; i < colorTable.Length; i++)
            {
                ColorValue color = colorTable[i];
                colors[i].r = (float)color.Red / 65535f;
                colors[i].g = (float)color.Green / 65535f;
                colors[i].b = (float)color.Blue / 65535f;
                if (colors[i].r != 0.0f || colors[i].g != 0.0f || colors[i].b != 1.0f)
                {
                    colors[i].a = 1;
                }
                else
                {
                    colors[i].a = 0;
                }
            }
            Texture2D result;

            for (int i = 0; i < bitmap.Data.Length; i++)
            {
                if (bitmap.Data[i] == 0)
                {
                    hasAlpha = true;
                }
            }
            if (hasAlpha)
            {
                result = new Texture2D(bitmap.Width, bitmap.Height, TextureFormat.ARGB32, true);
            }
            else
            {
                result = new Texture2D(bitmap.Width, bitmap.Height, TextureFormat.RGB24, true);
            }
            if (!bitmap.ColumnOrder)
            {
                for (int y = 0; y < bitmap.Height; y++)
                {
                    for (int x = 0; x < bitmap.Width; x++)
                    {
                        result.SetPixel(x, bitmap.Height - y - 1, colors[bitmap.Data[x + y * bitmap.Width]]);
                    }
                }
            }
            else
            {
                for (int x = 0; x < bitmap.Width; x++)
                {
                    for (int y = 0; y < bitmap.Height; y++)
                    {
                        result.SetPixel(x, bitmap.Height - y - 1, colors[bitmap.Data[x * bitmap.Height + y]]);
                    }
                }
            }
            return(result);
        }
Exemple #57
0
 void UpdateColorMultiplier()
 {
     if( background )
         ColorMultiplier = new ColorValue( 1, 1, 1, .5f );
     else
         ColorMultiplier = new ColorValue( 1, 1, 1 );
 }
Exemple #58
0
 private static string FormatColor(ColorValue color, bool background)
 {
     return(String.Format("\x1b[{0};2;{1};{2};{3}m", background ? 48 : 38, color.R, color.G, color.B));
 }
Exemple #59
0
		void AddTextWithShadow( GuiRenderer renderer, Engine.Renderer.Font font, string text, Vec2 position,
			HorizontalAlign horizontalAlign, VerticalAlign verticalAlign, ColorValue color )
		{
			Vec2 shadowOffset = 2.0f / renderer.ViewportForScreenGuiRenderer.DimensionsInPixels.Size.ToVec2();

			renderer.AddText( font, text, position + shadowOffset, horizontalAlign, verticalAlign,
				new ColorValue( 0, 0, 0, color.Alpha / 2 ) );
			renderer.AddText( font, text, position, horizontalAlign, verticalAlign, color );
		}
Exemple #60
0
 private static void WriteBinaryPacketAsHtml(XmlWriter writer, DataFrame frame, ColorValue c)
 {
     writer.WriteStartElement("pre");
     writer.WriteAttributeString("style", String.Format("background-color:#{0:X02}{1:X02}{2:X02}", c.R, c.G, c.B));
     writer.WriteString(BuildHexDump(16, frame.ToArray()));
     writer.WriteEndElement();
 }