NeoforceControls / XNA

XNA Version of NeoForce Controls
21 stars 9 forks source link

neoforce problem #18

Closed PedroAlvesq closed 10 years ago

PedroAlvesq commented 10 years ago

the graphics is very poor when i draw the manager how solve the problem

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.GamerServices;
using TomShane.Neoforce.Controls;
using XRpgLibrary;
using System.Threading;
using System.Security.Cryptography;
using System.Security;
using Microsoft.Xna.Framework.Input;

namespace TomShane.Neoforce.Central.Code
{
    public class Gameplays : BaseGameState
    {
        const float SphereVelocity = 2;
       // GraphicsDeviceManager graphics1;
        // how quickly the sphere can turn from side to side
        const float SphereTurnSpeed = .025f;

        // the radius of the sphere. We'll use this to keep the sphere above the ground,
        // and when computing how far the sphere has rolled.
        const float SphereRadius = 13.0f;

        // This vector controls how much the camera's position is offset from the
        // sphere. This value can be changed to move the camera further away from or
        // closer to the sphere.
        readonly Vector3 CameraPositionOffset = new Vector3(0, 40, 150);

        // This value controls the point the camera will aim at. This value is an offset
        // from the sphere's position.
        readonly Vector3 CameraTargetOffset = new Vector3(0, 30, 0);
        string text = "admin";
         string texto;
        private Label lbusername = null;
        private Manager NeoManager;
      private  Window inventory;
      private Window Charactersstatus;

        Model terrain;

        Matrix projectionMatrix;
        Matrix viewMatrix;
        TabControl tbc;
        Vector3 spherePosition;
        float sphereFacingDirection;
        Matrix sphereRollingMatrix = Matrix.Identity;

        Model sphere;
        HeightMapInfo heightMapInfo;

        GraphicsDeviceManager graphics1;
        public Gameplays(Game game, GameStateManager manager, GraphicsDeviceManager graphics)
            : base(game, manager)
        {

            NeoManager = new Manager(game, graphics, "Default");
          graphics1 = graphics;
            NeoManager.SkinDirectory = @"C:\Users\Pedro\Dropbox\GAMES\TomShane.Neoforce.Controls.XNA4\Neoforce\Skins";
            NeoManager.AutoUnfocus = false;
           texto = text;
            System.Console.Write(texto);

        }
        public override void Initialize()
        {

            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
             MathHelper.ToRadians(45.0f), Game.GraphicsDevice.Viewport.AspectRatio, 1f, 10000);

            NeoManager.Initialize();

            base.Initialize();

        }
        protected override void LoadContent()
        {

         terrain = Game.Content.Load<Model>("terrain");

            // The terrain processor attached a HeightMapInfo to the terrain model's
            // Tag. We'll save that to a member variable now, and use it to
            // calculate the terrain's heights later.
            heightMapInfo = terrain.Tag as HeightMapInfo;
            if (heightMapInfo == null)
            {
                string message = "The terrain model did not have a HeightMapInfo " +
                    "object attached. Are you sure you are using the " +
                    "TerrainProcessor?";
                throw new InvalidOperationException(message);
            }

            sphere = Game.Content.Load<Model>("sphere");
            InitConsole(texto);
           Inventory();
           charactersstatus();
            base.LoadContent();
        }
        private void Inventory() {
            inventory = new Window(NeoManager);
            inventory.Init();
            inventory.Text = "Inventory";
            inventory.Width = 450;
            inventory.Height = 250;
            inventory.Center();
            inventory.Visible = true;
            inventory.CloseButtonVisible = true;
            inventory.Resizable = false;
            inventory.Movable = true;
            inventory.Close();
            NeoManager.Add(inventory);

        }
        private void charactersstatus()
        {
            Charactersstatus = new Window(NeoManager);
            Charactersstatus.Init();
            Charactersstatus.Text = "Characters Status";
            Charactersstatus.Width = 450;
            Charactersstatus.Height = 250;
            Charactersstatus.Center();
            Charactersstatus.Visible = true;
            Charactersstatus.CloseButtonVisible = true;
            Charactersstatus.Resizable = false;
            Charactersstatus.Movable = true;
            Charactersstatus.Close();
            NeoManager.Add(Charactersstatus);

        }

        public override void Update(GameTime gameTime)
        {

          HandleInput();

           UpdateCamera();

            base.Update(gameTime);

            NeoManager.Update(gameTime);

        }
        public override void Draw(GameTime gameTime)
        {

          //  NeoManager.BeginDraw(gameTime); if i comment this the graphic is execelents

            GraphicsDevice device = graphics1.GraphicsDevice;

            device.Clear(Color.CornflowerBlue);

            DrawModel(terrain, Matrix.Identity);

           DrawModel(sphere, sphereRollingMatrix *
                Matrix.CreateTranslation(spherePosition));

            //NeoManager.EndDraw();

            base.Draw(gameTime);

        }
        void DrawModel(Model model, Matrix worldMatrix)
        {
            Matrix[] boneTransforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(boneTransforms);

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = boneTransforms[mesh.ParentBone.Index] * worldMatrix;
                    effect.View = viewMatrix;
                    effect.Projection = projectionMatrix;

                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;

                    // Set the fog to match the black background color
                    effect.FogEnabled = true;
                    effect.FogColor = Vector3.Zero;
                    effect.FogStart = 1000;
                    effect.FogEnd = 3200;
                }

                mesh.Draw();
            }
       }

        private void InitConsole(string texto)
        {
            lbusername = new Label(NeoManager);
            tbc = new TabControl(NeoManager);

            TomShane.Neoforce.Controls.Console con1 = new TomShane.Neoforce.Controls.Console(NeoManager);
            TomShane.Neoforce.Controls.Console con2 = new TomShane.Neoforce.Controls.Console(NeoManager);
            //TomShane.Neoforce.Controls.Console con3 = new TomShane.Neoforce.Controls.Console(Manager);
            //Console con3 = new Console(Manager);

            // Setup of TabControl, which will be holding both consoles
            tbc.Init();

            tbc.AddPage("Global");
            tbc.AddPage("Guild");
            tbc.AddPage("PARTY");
            tbc.AddPage("TRADE");
            tbc.Alpha = 220;
            tbc.Left = 0;
            tbc.Height = 220;
            tbc.Width = 400;
            tbc.Top = NeoManager.TargetHeight - tbc.Height - 32;

            tbc.Movable = false;
            tbc.Resizable = false;
            tbc.MinimumHeight = 96;
            tbc.MinimumWidth = 160;

            tbc.TabPages[0].Add(con1);
            tbc.TabPages[1].Add(con2);

            con1.Init();
            con1.Sender = texto;
            con2.Init();
            con2.Sender = texto;

            con2.Width = con1.Width = tbc.TabPages[0].ClientWidth;
            con2.Height = con1.Height = tbc.TabPages[0].ClientHeight;
            con2.Anchor = con1.Anchor = Anchors.All;
            con1.Channels.Add(new ConsoleChannel(0, "General", Color.Orange));
            con1.Channels.Add(new ConsoleChannel(1, "Private", Color.White));
            con1.Channels.Add(new ConsoleChannel(2, "System", Color.Yellow));
            con1.Channels.Add(new ConsoleChannel(3, "Guild", Color.GreenYellow));
            con1.Channels.Add(new ConsoleChannel(4, "Trade", Color.Red));
            // We want to share channels and message buffer in both consoles
            con2.Channels = con1.Channels;
            con2.MessageBuffer = con1.MessageBuffer;

            // In the second console we display only "Private" messages
            con2.ChannelFilter.Add(3);

            // Select default channels for each tab
            con1.SelectedChannel = 0;
            con2.SelectedChannel = 3;

            //con3.SelectedChannel = 3;

            // Do we want to add timestamp or channel name at the start of every message?
            con1.MessageFormat = ConsoleMessageFormats.All;

            con2.MessageFormat = ConsoleMessageFormats.All;
            // Handler for altering incoming message
            //  con1.MessageSent += new ConsoleMessageEventHandler(con1_MessageSent);

            // We send initial welcome message to System channel
            con1.MessageBuffer.Add(new ConsoleMessage("System", "WELCOME TO THE SERVER! " + texto, 2));
            //  con2.MessageBuffer.Add(new ConsoleMessage("System", "WELCOME TO THE SERVER! " + texto, 2));

            NeoManager.Add(tbc);

        }
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        void con1_MessageSent(object sender, ConsoleMessageEventArgs e)
        {
            if (e.Message.Channel == 0)
            {
                //e.Message.Text = "(!) " + e.Message.Text;
            }//if(e.Message.Sender
        }

        /// <summary>
        /// Handles input for quitting the game.
        /// </summary>
        private void HandleInput()
        {
            KeyboardState currentKeyboardState = Keyboard.GetState();
            GamePadState currentGamePadState = GamePad.GetState(PlayerIndex.One);

            // Check for exit.

            // Now move the sphere. First, we want to check to see if the sphere should
            // turn. turnAmount will be an accumulation of all the different possible
            // inputs.
            float turnAmount = -currentGamePadState.ThumbSticks.Left.X;
            if (currentKeyboardState.IsKeyDown(Keys.A) ||
                currentKeyboardState.IsKeyDown(Keys.Left) ||
                currentGamePadState.DPad.Left == ButtonState.Pressed)
            {
                turnAmount += 1;
            }
            if (currentKeyboardState.IsKeyDown(Keys.D) ||
                currentKeyboardState.IsKeyDown(Keys.Right) ||
                currentGamePadState.DPad.Right == ButtonState.Pressed)
            {
                turnAmount -= 1;
            }

            // clamp the turn amount between -1 and 1, and then use the finished
            // value to turn the sphere.
            turnAmount = MathHelper.Clamp(turnAmount, -1, 1);
            sphereFacingDirection += turnAmount * SphereTurnSpeed;

            // Next, we want to move the sphere forward or back. to do this, 
            // we'll create a Vector3 and modify use the user's input to modify the Z
            // component, which corresponds to the forward direction.
            Vector3 movement = Vector3.Zero;
            movement.Z = -currentGamePadState.ThumbSticks.Left.Y;

            if (currentKeyboardState.IsKeyDown(Keys.W) ||
                currentKeyboardState.IsKeyDown(Keys.Up) ||
                currentGamePadState.DPad.Up == ButtonState.Pressed)
            {
                movement.Z = -1;
            }

            if (currentKeyboardState.IsKeyDown(Keys.S) ||
                currentKeyboardState.IsKeyDown(Keys.Down) ||
                currentGamePadState.DPad.Down == ButtonState.Pressed)
            {
                movement.Z = 1;
            }
            if (currentKeyboardState.IsKeyDown(Keys.I))
            {
                inventory.Show();

            }
            if (currentKeyboardState.IsKeyDown(Keys.B))
            {
                Charactersstatus.Show();

            }
           /* if (currentKeyboardState.IsKeyDown(Keys.Escape))
            {
                if(tbc.Focused==true){
                tbc.Visible = false;
                }
                //else
                //{
                 //   tbc.Show();
                //}

              //  InitConsole(text).Show();
                //windows();

            }
           */
            // next, we'll create a rotation matrix from the sphereFacingDirection, and
            // use it to transform the vector. If we didn't do this, pressing "up" would
            // always move the ball along +Z. By transforming it, we can move in the
            // direction the sphere is "facing."
            Matrix sphereFacingMatrix = Matrix.CreateRotationY(sphereFacingDirection);
            Vector3 velocity = Vector3.Transform(movement, sphereFacingMatrix);
            velocity *= SphereVelocity;

            // Now we know how much the user wants to move. We'll construct a temporary
            // vector, newSpherePosition, which will represent where the user wants to
            // go. If that value is on the heightmap, we'll allow the move.
            Vector3 newSpherePosition = spherePosition + velocity;
            if (heightMapInfo.IsOnHeightmap(newSpherePosition))
            {
                // finally, we need to see how high the terrain is at the sphere's new
                // position. GetHeight will give us that information, which is offset by
                // the size of the sphere. If we didn't offset by the size of the
                // sphere, it would be drawn halfway through the world, which looks 
                // a little odd.
                newSpherePosition.Y = heightMapInfo.GetHeight(newSpherePosition) +
                    SphereRadius;
            }
            else
            {
                newSpherePosition = spherePosition;
            }

            // now we need to roll the ball "forward." to do this, we first calculate
            // how far it has moved.
            float distanceMoved = Vector3.Distance(spherePosition, newSpherePosition);

            // The length of an arc on a circle or sphere is defined as L = theta * r,
            // where theta is the angle that defines the arc, and r is the radius of
            // the circle.
            // we know L, that's the distance the sphere has moved. we know r, that's
            // our constant "sphereRadius". We want to know theta - that will tell us
            // how much to rotate the sphere. we rearrange the equation to get...
            float theta = distanceMoved / SphereRadius;

            // now that we know how much to rotate the sphere, we have to figure out 
            // whether it will roll forward or backward. We'll base this on the user's
            // input.
            int rollDirection = movement.Z > 0 ? 1 : -1;

            // finally, we'll roll it by rotating around the sphere's "right" vector.
            sphereRollingMatrix *= Matrix.CreateFromAxisAngle(sphereFacingMatrix.Right,
                theta * rollDirection);

            // once we've finished all computations, we can set spherePosition to the
            // new position that we calculated.
            spherePosition = newSpherePosition;
        }

        private void UpdateCamera()
        {
            // The camera's position depends on the sphere's facing direction: when the
            // sphere turns, the camera needs to stay behind it. So, we'll calculate a
            // rotation matrix using the sphere's facing direction, and use it to
            // transform the two offset values that control the camera.
            Matrix cameraFacingMatrix = Matrix.CreateRotationY(sphereFacingDirection);
            Vector3 positionOffset = Vector3.Transform(CameraPositionOffset,
                cameraFacingMatrix);
            Vector3 targetOffset = Vector3.Transform(CameraTargetOffset,
                cameraFacingMatrix);

            // once we've transformed the camera's position offset vector, it's easy to
            // figure out where we think the camera should be.
            Vector3 cameraPosition = spherePosition + positionOffset;

            // We don't want the camera to go beneath the heightmap, so if the camera is
            // over the terrain, we'll move it up.
            if (heightMapInfo.IsOnHeightmap(cameraPosition))
            {
                // we don't want the camera to go beneath the terrain's height +
                // a small offset.
                float minimumHeight =
                    heightMapInfo.GetHeight(cameraPosition) + CameraPositionOffset.Y;

                if (cameraPosition.Y < minimumHeight)
                {
                    cameraPosition.Y = minimumHeight;
                }
            }

            // next, we need to calculate the point that the camera is aiming it. That's
            // simple enough - the camera is aiming at the sphere, and has to take the 
            // targetOffset into account.
            Vector3 cameraTarget = spherePosition + targetOffset;

            // with those values, we'll calculate the viewMatrix.
            viewMatrix = Matrix.CreateLookAt(cameraPosition,
                                              cameraTarget,
                                              Vector3.Up);
        }

        ////////////////////////////////////////////////////////////////////////////

    }
}

gameplay

Grimston commented 10 years ago

Currently don't have access to the library to test, but it sounds/looks like a Render State issue.

Neoforce changes some Render State details, you should first render Neoforce using the Being Draw function, Then reset GraphicsDevice Properties, such as BlendState, RasterizerState, DepthStencilState, SamplerState. Draw your 3D world, then call EndDraw on Neoforce

PedroAlvesq commented 10 years ago

thanks men works but i change my game the xna to sharpdx and i have the same problem this is my code

using System;
using SharpDX;
using SharpDX.Toolkit;
using System.Collections.Generic;
using SharpDX.Toolkit.Input;
using TomShane.Neoforce.Controls;
using SharpDX.Direct3D;
using SharpDX.Direct3D11;
using SharpDX.Toolkit.Content;

namespace TomShane.Neoforce.Central
{
    using SharpDX.Toolkit.Graphics;

    /// <summary>
    /// Simple MiniCube application using SharpDX.Toolkit.
    /// The purpose of this application is to show a rotating cube using <see cref="BasicEffect"/>.
    /// </summary>
    public class Gamer : Game
    {
        private Manager NeoManager;
       private GraphicsDeviceManager graphicsDeviceManager;

        private readonly World _Login;

        public Gamer()
        {
            // Creates a graphics manager. This is mandatory.

            graphicsDeviceManager = new GraphicsDeviceManager(this);
            graphicsDeviceManager.PreferredBackBufferWidth = 1280;
            graphicsDeviceManager.PreferredBackBufferHeight = 800;
            NeoManager = new Manager(this, graphicsDeviceManager, "Default");
            IsMouseVisible = true;
            _Login = new World(this, NeoManager,"ola", graphicsDeviceManager);
            Content.RootDirectory = "Content";

        }

        protected override void LoadContent()
        {

            base.LoadContent();
        }

        protected override void Initialize()
        {

            base.Initialize();
            NeoManager.Initialize();

            Window.Title = "Firstgame";
        }

        protected override void Update(GameTime gameTime)
        { 
            base.Update(gameTime);
            NeoManager.Update(gameTime);

        }

        protected override void Draw(GameTime gameTime)
        {

            NeoManager.BeginDraw(gameTime);// the problem is where
            GraphicsDevice.Clear(SharpDX.Color.CornflowerBlue);
          NeoManager.EndDraw(); //the problem its where
            base.Draw(gameTime);

        }
    }
}
using System;
using SharpDX;
using SharpDX.Toolkit;
using System.Collections.Generic;
using SharpDX.Toolkit.Input;
using TomShane.Neoforce.Controls;
using SharpDX.Direct3D;
using SharpDX.Direct3D11;
using SharpDX.Toolkit.Content;
using SharpDX.Toolkit.Graphics;

namespace TomShane.Neoforce.Central
{
    internal sealed class World : GameSystem
    {
        private Manager NeoManager;
    //    private Window window;
        string texto;
        private SpriteBatch spriteBatch;
        private SpriteFont arial16BMFont;
        private readonly Login _Login;
        //    private readonly Server _Server;

        // By preloading any assets used by UI rendering, we avoid framerate glitches
        // when they suddenly need to be loaded in the middle of a menu transition.
        private PointerManager pointer;

        private Model model;

        private List<Model> models;
        private Game _game;
        private BoundingSphere modelBounds;
        private Matrix world;
        private Matrix view;
        private Matrix projection;
        TomShane.Neoforce.Controls.TabControl tbc;
       private GraphicsDeviceManager graphicsDeviceManager;

        public World(Game game,Manager ola,string text,GraphicsDeviceManager gra)
            : base(game)
        {
            _game = game;
           graphicsDeviceManager = gra;
            texto = text;
            System.Console.Write(texto);
         graphicsDeviceManager.PreferredGraphicsProfile = new FeatureLevel[] { FeatureLevel.Level_9_1, };
            pointer = new PointerManager(_game);
            NeoManager = ola;

            // this game system has something to draw - enable drawing by default
            // this can be disabled to make objects drawn by this system disappear
            Visible = true;

            // this game system has logic that needs to be updated - enable update by default
            // this can be disabled to simulate a "pause" in logic update
            Enabled = true;

            // add the system itself to the systems list, so that it will get initialized and processed properly
            // this can be done after game initialization - the Game class supports adding and removing of game systems dynamically
            game.GameSystems.Add(this);
        }

        /// <summary>
        /// Initialize here anything that depends on other services
        /// </summary>
        public override void Initialize()
        {

          //  NeoManager.Initialize();

            base.Initialize();

            // get the camera service from service registry

        }

        /// <summary>
        /// Load all graphics content here.
        /// </summary>
        protected override void LoadContent()
        { 
            InitConsole(texto);
        arial16BMFont = Content.Load<SpriteFont>("Arial16");

        // Load the model (by default the model is loaded with a BasicEffect. Use ModelContentReaderOptions to change the behavior at loading time.
        models = new List<Model>();
        foreach (var modelName in new[] { "Dude", "Duck", "Car", "Happy", "Knot", "Skull", "Sphere", "Teapot", "helmet" })
        {
            model = Content.Load<Model>(modelName);

            // Enable default lighting  on model.
            BasicEffect.EnableDefaultLighting(model, true);

            models.Add(model);
        }
        model = models[0];

        // Instantiate a SpriteBatch
        spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice));
            base.LoadContent();

            // InitRes();
            // initialize the basic effect (shader) to draw the geometry, the BasicEffect class is similar to one from XNA

        }

        /// <summary>
        /// Draw the scene content.
        /// </summary>
        /// <param name="gameTime">Structure containing information about elapsed game time.</param>

        /// <summary>
        /// Update the scene logic.
        /// </summary>
        /// <param name="gameTime">Structure containing information about elapsed game time.</param>
        public override void Update(GameTime gameTime)
        {
            var pointerState = pointer.GetState();
            if (pointerState.Points.Count > 0 && pointerState.Points[0].EventType == PointerEventType.Released)
            {
                // Go to next model when pressing key space
                model = models[(models.IndexOf(model) + 1) % models.Count];
            }

            // Calculate the bounds of this model
            modelBounds = model.CalculateBounds();

            // Calculates the world and the view based on the model size
            const float MaxModelSize = 10.0f;
            var scaling = MaxModelSize / modelBounds.Radius;
            view = Matrix.LookAtRH(new Vector3(0, 0, MaxModelSize * 2.5f), new Vector3(0, 0, 0), Vector3.UnitY);
            projection = Matrix.PerspectiveFovRH(0.9f, (float)GraphicsDevice.BackBuffer.Width / GraphicsDevice.BackBuffer.Height, 0.1f, MaxModelSize * 10.0f);
            world = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(scaling) * Matrix.RotationY((float)gameTime.TotalGameTime.TotalSeconds);

            base.Update(gameTime);
        //  NeoManager.Update(gameTime);

            // get the total elapsed seconds since the start of the game

        }
        public override void Draw(GameTime gameTime)
        {
          //  NeoManager.BeginDraw(gameTime);

           // graphicsDeviceManager.GraphicsDevice.BlendStates = BlendStateCollection.StateAllocatorDelegate.RemoveAll();
              model.Draw(GraphicsDevice, world, view, projection);
            // Render the text

              spriteBatch.Begin();
            //correntscreen.Draw(gameTime);
              spriteBatch.DrawString(arial16BMFont, "Press the pointer to switch models...\r\nCurrent Model: " + model.Name, new Vector2(16, 16), Color.White);

            spriteBatch.End();
         //   NeoManager.EndDraw();

            base.Draw(gameTime);

            // set the parameters for cube drawing and draw it using the basic effect

        }
        private void InitConsole(string texto)
        {
            tbc = new TomShane.Neoforce.Controls.TabControl(NeoManager);
         //   tbc.BackColor = new Color(10, 12, 3);
            TomShane.Neoforce.Controls.Console con1 = new TomShane.Neoforce.Controls.Console(NeoManager);
            TomShane.Neoforce.Controls.Console con2 = new TomShane.Neoforce.Controls.Console(NeoManager);

            tbc.Visible = true;
          //  con2.BackColor
            // Setup of TabControl, which will be holding both consoles
            tbc.Init();
            tbc.AddPage("Global");
            tbc.AddPage("Guild");
            tbc.AddPage("PARTY");
            tbc.AddPage("TRADE");

            tbc.Alpha = 220;
            tbc.Left = 0;
            tbc.Height = 220;
            tbc.Width = 450;
            tbc.Top =NeoManager.TargetHeight - tbc.Height - 32;

            tbc.Movable = true;
            tbc.Resizable = true;
            tbc.MinimumHeight = 96;
            tbc.MinimumWidth = 160;

            tbc.TabPages[0].Add(con1);
            tbc.TabPages[1].Add(con2);

            con1.Init();
            con1.Sender = texto;
            tbc.BringToFront();
            con2.Init();
            con2.Sender = texto;

            con2.Width = con1.Width = tbc.TabPages[0].ClientWidth;
            con2.Height = con1.Height = tbc.TabPages[0].ClientHeight;
            con2.Anchor = con1.Anchor = Anchors.All;

            con1.Channels.Add(new ConsoleChannel(0, "General", SharpDX.Color.Orange));
            con1.Channels.Add(new ConsoleChannel(1, "Private", SharpDX.Color.White));
            con1.Channels.Add(new ConsoleChannel(2, "System", SharpDX.Color.Yellow));
            con1.Channels.Add(new ConsoleChannel(3, "Guild", SharpDX.Color.Green));
            con1.Channels.Add(new ConsoleChannel(4, "Trade", SharpDX.Color.Red));

            // We want to share channels and message buffer in both consoles
            con2.Channels = con1.Channels;
            con2.MessageBuffer = con1.MessageBuffer;

            // In the second console we display only "Private" messages
            con2.ChannelFilter.Add(3);

            // Select default channels for each tab
            con1.SelectedChannel = 0;
            con2.SelectedChannel = 3;

            // Do we want to add timestamp or channel name at the start of every message?
            con1.MessageFormat = ConsoleMessageFormats.All;
            con2.MessageFormat = ConsoleMessageFormats.All;

            // Handler for altering incoming message
            con1.MessageSent += new ConsoleMessageEventHandler(con1_MessageSent);

            // We send initial welcome message to System channel
            con1.MessageBuffer.Add(new ConsoleMessage("System", "WELCOME TO THE SERVER! " + texto, 2));

            NeoManager.Add(tbc);
        }
        ////////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        void con1_MessageSent(object sender, ConsoleMessageEventArgs e)
        {
            if (e.Message.Channel == 0)
            {
                //e.Message.Text = "(!) " + e.Message.Text;
            }
        }
    }
}

i have the same result i have when i used the xna r

PedroAlvesq commented 10 years ago

problem as been solve it thanks for the help