Jump to content

  • Log In with Google      Sign In   
  • Create Account


Landi20

Member Since 14 Feb 2012
Offline Last Active Yesterday, 05:48 PM
*----

Topics I've Started

How load a 3d model with sharpdx

22 July 2014 - 05:24 PM

i can´t load a 3d model with sharpdx 2.6.2

this is my code

  static void Main()
    {
        if (!SharpDevice.IsDirectX11Supported())
        {
            System.Windows.Forms.MessageBox.Show("DirectX11 Not Supported");
            return;
        }

        //render form
        RenderForm form = new RenderForm();
        form.Text = "Tutorial 17: Query";
        //frame rate counter
        SharpFPS fpsCounter = new SharpFPS();


        using (SharpDevice device = new SharpDevice(form))
        {
            //load font
            SharpBatch font = new SharpBatch(device, "textfont.dds");

            //load model from wavefront obj file
            SharpMesh earth = SharpMesh.CreateFromObj(device, "../../../Models/planets/earth.obj");
            SharpMesh moon = SharpMesh.CreateFromObj(device, "../../../Models/planets/moon.obj");

            //init shader
            SharpShader shader = new SharpShader(device, "../../HLSL.txt",
                new SharpShaderDescription() { VertexShaderFunction = "VS", PixelShaderFunction = "PS" },
                new InputElement[] {  
                        new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
                        new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0),
                        new InputElement("TEXCOORD", 0, Format.R32G32_Float, 24, 0)
                    });

            //init constant buffer
            Buffer11 buffer = shader.CreateBuffer<Data>();

            Query pipelineQuery = new Query(device.Device, new QueryDescription() { Flags = QueryFlags.None, Type = QueryType.PipelineStatistics });

            QueryDataPipelineStatistics stats = new QueryDataPipelineStatistics();


            //init frame counter
            fpsCounter.Reset();

            int lastX = 0;
            float currentAngle = 200;
            form.MouseMove += (sender, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    currentAngle += (lastX - e.X);
                }
                lastX = e.X;
            };

            //main loop
            RenderLoop.Run(form, () =>
            {
                //Resizing
                if (device.MustResize)
                {
                    device.Resize();
                    font.Resize();
                }

                //apply states
                device.UpdateAllStates();

                //clear color
                device.Clear(Color.CornflowerBlue);

                //apply shader
                shader.Apply();


                //apply constant buffer to shader
                device.DeviceContext.VertexShader.SetConstantBuffer(0, buffer);
                device.DeviceContext.PixelShader.SetConstantBuffer(0, buffer);

                //set transformation matrix
                float ratio = (float)form.ClientRectangle.Width / (float)form.ClientRectangle.Height;
                Matrix projection = Matrix.PerspectiveFovLH(3.14F / 3.0F, ratio, 1F, 1000.0F);
                Matrix view = Matrix.LookAtLH(new Vector3(0, 0, -250), new Vector3(), Vector3.UnitY);
                Matrix world = Matrix.Translation(0, 0, 200) * Matrix.RotationY(MathUtil.DegreesToRadians(currentAngle));

                //light direction
                Vector3 lightDirection = new Vector3(0.5f, 0, -1);
                lightDirection.Normalize();


                Data sceneInformation = new Data()
                {
                    world = world,
                    worldViewProjection = world * view * projection,
                    lightDirection = new Vector4(lightDirection, 1)
                };

                //write data inside constant buffer
                device.UpdateData<Data>(buffer, sceneInformation);

                //draw mesh
                moon.Begin();
                for (int i = 0; i < moon.SubSets.Count; i++)
                {
                    device.DeviceContext.PixelShader.SetShaderResource(0, moon.SubSets[i].DiffuseMap);
                    moon.Draw(i);
                }

                //begin analizing
                device.DeviceContext.Begin(pipelineQuery);

                world = Matrix.RotationY(Environment.TickCount / 2000.0F);
                sceneInformation = new Data()
                {
                    world = world,
                    worldViewProjection = world * view * projection,
                    lightDirection = new Vector4(lightDirection, 1)
                };

                //write data inside constant buffer
                device.UpdateData<Data>(buffer, sceneInformation);

                //draw mesh
                earth.Begin();
                for (int i = 0; i < earth.SubSets.Count; i++)
                {
                    device.DeviceContext.PixelShader.SetShaderResource(0, earth.SubSets[i].DiffuseMap);
                    earth.Draw(i);
                }
                //end analizing
                device.DeviceContext.End(pipelineQuery);

                //get result
                while (!device.DeviceContext.GetData<QueryDataPipelineStatistics>(pipelineQuery, AsynchronousFlags.None, out stats))
                {
                }

                //begin drawing text
                font.Begin();

                //draw string
                fpsCounter.Update();
                font.DrawString("Earth Stats : FPS: " + fpsCounter.FPS, 0, 0, Color.White);

                //print earth stats
                font.DrawString("Earth Stats : Rotate Moon To Cover Earth ", 0, 30, Color.White);
                font.DrawString(string.Format("Primitive Count: {0}", stats.IAPrimitiveCount), 0, 60, Color.White);
                font.DrawString(string.Format("Vertex Count Count: {0}", stats.IAVerticeCount), 0, 90, Color.White);
                font.DrawString(string.Format("Vertex Shader Execution: {0}", stats.VSInvocationCount), 0, 120, Color.White);
                font.DrawString(string.Format("Pixel Shader Execution: {0}", stats.PSInvocationCount), 0, 150, Color.White);

                //flush text to view
                font.End();
                //present
                device.Present();




            });

            //release resource
            font.Dispose();
            earth.Dispose();
            moon.Dispose();
            buffer.Dispose();
            pipelineQuery.Dispose();
        }
    }

Error    1    The type 'SharpDX.Windows.RenderForm' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    526    9    Central
Error    2    The best overloaded method match for 'SharpHelper.SharpDevice.SharpDevice(SharpDX.Windows.RenderForm, bool)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    526    37    Central
Error    3    Argument 1: cannot convert from 'SharpDX.Windows.RenderForm [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Windows.RenderForm'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    526    53    Central
Error    4    The type 'SharpDX.Direct3D11.InputElement' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    536    13    Central
Error    5    The best overloaded method match for 'SharpHelper.SharpShader.SharpShader(SharpHelper.SharpDevice, string, SharpHelper.SharpShaderDescription, SharpDX.Direct3D11.InputElement[])' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    536    34    Central
Error    6    Argument 4: cannot convert from 'SharpDX.Direct3D11.InputElement[] [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.Direct3D11.dll]' to 'SharpDX.Direct3D11.InputElement[]'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    538    17    Central
Error    7    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    545    51    Central
Error    8    The type 'SharpDX.Direct3D11.Device' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    547    13    Central
Error    9    The best overloaded method match for 'SharpDX.Direct3D11.Query.Query(SharpDX.Direct3D11.Device, SharpDX.Direct3D11.QueryDescription)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    547    35    Central
Error    10    Argument 1: cannot convert from 'SharpDX.Direct3D11.Device' to 'SharpDX.Direct3D11.Device [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.Direct3D11.dll]'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    547    45    Central
Error    11    The best overloaded method match for 'SharpHelper.SharpDevice.Clear(SharpDX.Color4)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    580    17    Central
Error    12    The type 'SharpDX.Color4' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    580    17    Central
Error    13    Argument 1: cannot convert from 'SharpDX.Color' to 'SharpDX.Color4'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    580    30    Central
Error    14    The type 'SharpDX.Direct3D11.DeviceContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    587    17    Central
Error    15    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'VertexShader' and no extension method 'VertexShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    587    38    Central
Error    16    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'PixelShader' and no extension method 'PixelShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    588    38    Central
Error    17    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    601    17    Central
Error    18    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    601    45    Central
Error    19    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    609    35    Central
Error    20    The type 'SharpDX.Direct3D11.ShaderResourceView' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    615    21    Central
Error    21    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'PixelShader' and no extension method 'PixelShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    615    42    Central
Error    22    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'Begin' and no extension method 'Begin' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    620    38    Central
Error    23    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    623    40    Central
Error    24    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    631    35    Central
Error    25    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'PixelShader' and no extension method 'PixelShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    637    42    Central
Error    26    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'End' and no extension method 'End' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    641    38    Central
Error    27    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'GetData' and no extension method 'GetData' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    644    46    Central
Error    28    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    653    17    Central
Error    29    The type 'SharpDX.Color' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    653    17    Central
Error    30    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    653    79    Central
Error    31    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    656    17    Central
Error    32    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    656    85    Central
Error    33    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    657    17    Central
Error    34    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    657    103    Central
Error    35    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    658    17    Central
Error    36    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    658    104    Central
Error    37    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    659    17    Central
Error    38    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    659    113    Central
Error    39    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    660    17    Central
Error    40    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    660    112    Central
 


encryption my password

04 July 2014 - 10:04 AM

i make my game and i want encrypte my password like this $P$DzZ6dPRg/zHF6G3vRHgskT1.FwoX9k/

but my result it is $H$9tUnBmMHAOlbeljxTdJHG/OBfZhstH1

this is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Security;
using System.Net.Sockets;
using System.IO;
namespace TomShane.Neoforce.Central.Code
{
    class Login
    {
       
        public int id_user;
        String username;
        String password;
        public int tipo;
       public int Id
        {

            get { return id_user; }
            set { id_user = value; }
        }
        public String Username
        {
            get { return username; }
            set { username = value; }
        }
        public String Password
        {
            get { return password; }
            set { password = value; }
        }
        public int Tipo
        {
            get { return tipo; }
            set { tipo = value; }
        }
         private string itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
        /// <summary>
        /// Compares the password string given with the hash retrieved from your database.
        /// </summary>
        /// <param name="password">Plaintext password.</param>
        /// <param name="hash">Hash from a SQL database</param>
        /// <returns>True if the password is correct, False otherwise.</returns>
        public bool phpbbCheckHash(string password, string hash)
        {
            if (hash.Length == 34) return (hashCryptPrivate(ASCIIEncoding.ASCII.GetBytes(password), hash, itoa64) == hash);
            return false;
        }
 
        /// <summary>
        /// This function will return the resulting hash from the password string you specify.
        /// </summary>
        /// <param name="password">String to hash.</param>
        /// <returns>Encrypted hash.</returns>
        /// <remarks>
        /// Although this will return the md5 for an older password, I have not added
        /// support for older passwords, so they will not work with this class unless
        /// I or someone else updates it.
        /// </remarks>
        public string phpbb_hash(string password)
        {
            // Generate a random string from a random number with the length of 6.
            // You could use a static string instead, doesn't matter. E.g.
            // byte[] random = ASCIIEncoding.ASCII.GetBytes("abc123");
            byte[] random = ASCIIEncoding.ASCII.GetBytes(new Random().Next(100000, 999999).ToString());
 
            string hash = hashCryptPrivate(ASCIIEncoding.ASCII.GetBytes(password), hashGensaltPrivate(random, itoa64), itoa64);
 
            if (hash.Length == 34) return hash;
 
            return sMD5(password);
        }
 
        /// <summary>
        /// The workhorse that encrypts your hash.
        /// </summary>
        /// <param name="password">String to be encrypted. Use: ASCIIEncoding.ASCII.GetBytes();</param>
        /// <param name="genSalt">Generated salt.</param>
        /// <param name="itoa64">The itoa64 string.</param>
        /// <returns>The encrypted hash ready to be compared.</returns>
        /// <remarks>
        /// password:  Saves conversion inside the function, lazy coding really.
        /// genSalt:   Returns from hashGensaltPrivate(random, itoa64);
        /// return:    Compare with phpbbCheckHash(password, hash)
        /// </remarks>
        private string hashCryptPrivate(byte[] password, string genSalt, string itoa64)
        {
            string output = "*";
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            if (!genSalt.StartsWith("$H$")) return output;
            //   $count_log2 = strpos($itoa64, $setting[3]);
            int count_log2 = itoa64.IndexOf(genSalt[3]);
            if (count_log2 < 7 || count_log2 > 30) return output;
 
            int count = 1 << count_log2;
            byte[] salt = ASCIIEncoding.ASCII.GetBytes(genSalt.Substring(4, 8));
 
            if (salt.Length != 8) return output;
 
            byte[] hash = md5.ComputeHash(Combine(salt, password));
 
            do
            {
                hash = md5.ComputeHash(Combine(hash, password));
            } while (count-- > 1);
 
            output = genSalt.Substring(0, 12);
            output += hashEncode64(hash, 16, itoa64);
 
            return output;
        }
 
        /// <summary>
        /// Private function to concat byte arrays.
        /// </summary>
        /// <param name="b1">Source array.</param>
        /// <param name="b2">Array to add to the source array.</param>
        /// <returns>Combined byte array.</returns>
        private byte[] Combine(byte[] b1, byte[] b2)
        {
            byte[] retVal = new byte[b1.Length + b2.Length];
            Array.Copy(b1, 0, retVal, 0, b1.Length);
            Array.Copy(b2, 0, retVal, b1.Length, b2.Length);
            return retVal;
        }
 
        /// <summary>
        /// Encode the hash.
        /// </summary>
        /// <param name="input">The hash to encode.</param>
        /// <param name="count">[This parameter needs documentation].</param>
        /// <param name="itoa64">The itoa64 string.</param>
        /// <returns>Encoded hash.</returns>
        private string hashEncode64(byte[] input, int count, string itoa64)
        {
            string output = "";
            int i = 0; int value = 0;
 
            do
            {
                value = input[i++];
                output += itoa64[value & 0x3f];
 
                if (i < count) value |= input[i] << 8;
                output += itoa64[(value >> 6) & 0x3f];
                if (i++ >= count)
                    break;
 
                if (i < count) value |= input[i] << 16;
                output += itoa64[(value >> 12) & 0x3f];
                if (i++ >= count)
                    break;
 
                output += itoa64[(value >> 18) & 0x3f];
 
            } while (i < count);
 
            return output;
        }
 
        /// <summary>
        /// Generate salt for hash generation.
        /// </summary>
        /// <param name="input">Any random information.</param>
        /// <param name="itoa64">The itoa64 string.</param>
        /// <returns>Generated salt string</returns>
        private string hashGensaltPrivate(byte[] input, string itoa64)
        {
            int iteration_count_log2 = 6;
 
            string output = "$H$";
            output += itoa64[Math.Min(iteration_count_log2 + 5, 30)];
            output += hashEncode64(input, 6, itoa64);
 
            return output;
        }
 
        /// <summary>
        /// Returns a hexadecimal string representation for the encrypted MD5 parameter.
        /// </summary>
        /// <param name="password">String to be encrypted.</param>
        /// <returns>String</returns>
        private string sMD5(string password) { return sMD5(password, false); }
 
        /// <summary>
        /// Returns a hexadecimal string representation for the encrypted MD5 parameter.
        /// </summary>
        /// <param name="password">String to be encrypted.</param>
        /// <param name="raw">Whether or not to produce a raw string.</param>
        /// <returns>String</returns>
        private string sMD5(string password, bool raw)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            if (raw) return Encoding.ASCII.GetString(md5.ComputeHash(Encoding.ASCII.GetBytes(password)));
            else return BitConverter.ToString(md5.ComputeHash(Encoding.ASCII.GetBytes(password))).Replace("-", "");
        }
    
   
     }

i cant transforme a 2d pickture to 3d

02 July 2014 - 10:18 AM

i have this error  unhandled exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll

Additional information: Error loading "terrain". File contains Microsoft.Xna.Framework.Graphics.Texture2D but trying to load as Microsoft.Xna.Framework.Graphics.Model.

i use to make this code this example http://xbox.create.msdn.com/en-US/education/catalog/sample/collision_3d_heightmap

this is my code

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 = 12.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;

        Model terrain;

        Matrix projectionMatrix;
        Matrix viewMatrix;

        Vector3 spherePosition;
        float sphereFacingDirection;
        Matrix sphereRollingMatrix = Matrix.Identity;

        Model sphere;
        HeightMapInfo heightMapInfo;
        public Gameplays(Game game, GameStateManager manager, GraphicsDeviceManager graphics)
            : base(game, manager)
        {
           
            NeoManager = new Manager(game, graphics, "Default");
            graphics1 = graphics;
            //graphics = new GraphicsDeviceManager(Game);
            NeoManager.SkinDirectory = @"C:\Users\Pedro\Dropbox\GAMES\TomShane.Neoforce.Controls.XNA4\Neoforce\Skins";
            NeoManager.AutoUnfocus = false;
           texto = text;
            System.Console.Write(texto);

           

        }
        protected override void LoadContent()
        {



            terrain = Game.Content.Load<Model>("terrain");//error is where

            // 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");
            base.LoadContent();


            InitConsole(texto);


            // NeoManager.Add(sidebar);









        }
        public override void Update(GameTime gameTime)
        {
            HandleInput();

            UpdateCamera();
           // StateManager.Update(gameTime);
            //  ControlManager.Update(gameTime, PlayerIndex.One);
            base.Update(gameTime);

            NeoManager.Update(gameTime);
            //   stateManager.PopState();
        }
        public override void Draw(GameTime gameTime)
        {
            //  StateManager.BeginDraw(gameTime);
            NeoManager.BeginDraw(gameTime);

            GraphicsDevice.Clear(Color.CornflowerBlue);

            NeoManager.EndDraw();
            DrawModel(terrain, Matrix.Identity);

            DrawModel(sphere, sphereRollingMatrix *
                Matrix.CreateTranslation(spherePosition));
            //   ControlManager.Draw(GameRef.spriteBatch);
            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();
            }
        }


      

       



        /// <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;
            }

            // 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);
        }
        public override void Initialize()
        {
            
            NeoManager.Initialize();
         //   StateManager.Initialize();
            base.Initialize();
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
               MathHelper.ToRadians(45.0f), GraphicsDevice.Viewport.AspectRatio, 1f, 10000);
            //  NeoManager.Initialize();
        }
         private void InitConsole(string texto)
        {
            lbusername = new Label(NeoManager);

            TomShane.Neoforce.Controls.TabControl tbc = new TomShane.Neoforce.Controls.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.Focused = fals;

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

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

            //tbc.TabPages[2].Add(con3);

            con1.Init();
            con1.Sender = texto;
            con2.Init();
            //con3.Init();
            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.Green));
            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));


            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
        }
        ////////////////////////////////////////////////////////////////////////////

       

    
    }
}

problem selection a model

26 June 2014 - 01:19 PM

i can selection a model when i click in a button like this example i click in the button say Maria and the helmet change the color our posicion to yellow and when click in start say you choose Maria and if i select any button it is in groupbox say you must select a characters

this is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

using System.Threading;
using XRpgLibrary;

using TomShane.Neoforce.Controls;

namespace TomShane.Neoforce.Central.Code
{
    public class Characterse : BaseGameState
    {
        //string texto;

       // private LoginClient cliente;
        private Manager NeoManager;
        public Model model;
        public Matrix[] modelTransforms;
        //private string texto;

        private string tex;

        private ImageBox image;
        private SideBarPanel pnlRes = null;
        

    
        private Label ServerSection = null;
       
        private Button create = null;
        private Button start = null;
        private Button ok = null;
        private Button delete = null;
        private Button Quit = null;
       
        private StackPanel group1 = null;
        private Button btnFirst = null;
        private Label nome = null;
        private GroupPanel groupo=null;
        private Button btnFirst1 = null;
        private Label nome1 = null;
        private GroupPanel groupo1 = null;
        private Button btnFirst2 = null;
        private Label nome2 = null;
        private GroupPanel groupo2 = null;
        private Label nome3 = null;
        private GroupPanel groupo3 = null;
        private Button btnFirst3 = null;
        private Label nome4 = null;
        private GroupPanel groupo4 = null;
        private Button btnFirst4 = null;
        private Label nome5 = null;
        private GroupPanel groupo5 = null;
        private Button btnFirst5 = null;
        private Label nome6 = null;
        private GroupPanel groupo6 = null;
        private Button btnFirst6 = null;
        private Label nome7 = null;
        private GroupPanel groupo7 = null;
        private Button btnFirst7 = null;
        string charact0=null;
        string charact1=null;
        string charact2=null;
        string charact3=null;
        string charact4=null;
        string charact5=null;
        string charact6=null;
        string charact7=null;
        //public Texture2D ImageBox { get { return image.Image; } set { image.Image = value; } }

        public Characterse(Game game, GameStateManager manager)
            : base(game, manager)
        {
          
            System.Console.WriteLine("OLA");

        }


        protected override void LoadContent()
        {



            NeoManager = new Manager(Game);
            NeoManager.AutoCreateRenderTarget = true;
            NeoManager.AutoUnfocus = true;
            NeoManager.Initialize();


            base.LoadContent();
            InitRes();
            model = Game.Content.Load<Model>("helmet");
            modelTransforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(modelTransforms);

         

        }
        public override void Initialize()
        {



            base.Initialize();

          
        }
        public override void Update(GameTime gameTime)
        {




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

        }
        public override void Draw(GameTime gameTime)
        {

            NeoManager.BeginDraw(gameTime);

            GraphicsDevice.Clear(Color.CornflowerBlue);
            
            NeoManager.EndDraw();

            Matrix view = Matrix.CreateLookAt(
            new Vector3(200, 300, 900),
            new Vector3(0, 50, 0),
            Vector3.Up);
            Matrix projection = Matrix.CreatePerspectiveFieldOfView(
            MathHelper.ToRadians(45),
            GraphicsDevice.Viewport.AspectRatio,
            0.1f, 10000.0f);
            // Calculate the starting world matrix
            Matrix baseWorld = Matrix.CreateScale(0.4f) *
            Matrix.CreateRotationY(MathHelper.ToRadians(180));
            foreach (ModelMesh mesh in model.Meshes)
            {
                // Calculate each mesh's world matrix
                Matrix localWorld = modelTransforms[mesh.ParentBone.Index]
                * baseWorld;
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    BasicEffect e = (BasicEffect)part.Effect;
                    // Set the world, view, and projection
                    // matrices to the effect
                    e.World = localWorld;
                    e.View = view;
                    e.Projection = projection;
                    e.EnableDefaultLighting();
                }
                mesh.Draw();
            }

            base.Draw(gameTime);
        }


        private void InitRes()
        {
            
          string[] ola = new string[8] {"Maria","torradeira","OLA","aspirador" ,"","","",""};

            for (int i = 0; i <=ola.Length; i++)
            {
                System.Console.WriteLine(ola.Length);
                 charact0 = ola[0];
                 charact1 = ola[1];
                charact2=ola[2];
                charact3 = ola[3];
                charact4=ola[4];
                charact5=ola[5];
                charact6=ola[6];
                charact7=ola[7];
            
                }
                pnlRes = new SideBarPanel(NeoManager);
            pnlRes.Init();
            pnlRes.Passive = true;
           
            pnlRes.Left = 16;
            pnlRes.Top = 16;
            pnlRes.Width = 400;
            pnlRes.Height = 200;
            pnlRes.CanFocus = false;

            ServerSection = new Label(NeoManager);
            ServerSection.Init();

            ServerSection.Width = 120;
            ServerSection.Parent = pnlRes;
            ServerSection.Top = pnlRes.Left + 10;
            ServerSection.Left = 400;
            ServerSection.Text = "Character Selection";
            NeoManager.Add(ServerSection);
          /*  image = new ImageBox(NeoManager);
            image.Init();
            image.Parent = pnlRes;
            image.Top = pnlRes.Left + 100;
            image.Left = 400;
            image.Width = 400;
            image.Height = 100;

           
          /*  image.SizeMode = SizeMode.Normal;
            image.Image = NeoManager.Content.Load<Texture2D>("Content\\Images\\Caption");
            NeoManager.Add(image);
            */
            ok = new Button(NeoManager);
            ok.Init();
            ok.Width = 100;
            ok.Parent = pnlRes;
            ok.Left = pnlRes.Left + 120;
            ok.Top = pnlRes.Top + 740;
            ok.Text = "Select Server";
            NeoManager.Add(ok);
            start = new Button(NeoManager);
            start.Init();
            start.Width = 100;
            start.Parent = pnlRes;
            start.Left = pnlRes.Left + 340;
            start.Top = pnlRes.Top + 740;
            start.Text = "Start";
            start.Click += new Controls.EventHandler(btnStart_Click);
            NeoManager.Add(start);

            create = new Button(NeoManager);
            create.Init();
            create.Width = 100;
            create.Parent = pnlRes;
            create.Left = pnlRes.Left + 450;
            create.Top = pnlRes.Top + 740;
            create.Text = "Create";
            create.Click += new Controls.EventHandler(btncreate_Click);
            NeoManager.Add(create);

            delete = new Button(NeoManager);
            delete.Init();
            delete.Width = 100;
            delete.Parent = pnlRes;
            delete.Left = pnlRes.Left + 560;
            delete.Top = pnlRes.Top + 740;
            delete.Text = "Delete";
            NeoManager.Add(delete);
            Quit = new Button(NeoManager);
            Quit.Init();
            Quit.Width = 100;
            Quit.Parent = pnlRes;
            Quit.Left = pnlRes.Left + 670;
            Quit.Top = pnlRes.Top + 740;
            Quit.Text = "Quit";
            Quit.Click += new Controls.EventHandler(btnExit_Click);
            NeoManager.Add(Quit);


          group1 = new StackPanel(NeoManager,Orientation.Horizontal);
            group1.Init();
            group1.Parent = pnlRes;
         
            group1.Init();
            group1.Parent = pnlRes;
            group1.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            group1.Top = 690;
            group1.Left = pnlRes.Top + 60; ;
            group1.Width = 100;
            //group1.Height = 100;
            NeoManager.Add(group1);
            groupo = new GroupPanel(NeoManager);
            groupo.Init();
            groupo.Parent = group1;

            groupo.Top = 660;
            groupo.Left = pnlRes.Top + 60;
            groupo.Width = 100;
            groupo.Text = "";
            NeoManager.Add(groupo);
          
            
            btnFirst = new Button(NeoManager);
            btnFirst.Init();
            btnFirst.Parent = groupo;
            btnFirst.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            btnFirst.Top = 660;
            btnFirst.Left = pnlRes.Top + 60 ;
            btnFirst.Width = 100;
            btnFirst.Text =charact0;
            NeoManager.Add(btnFirst);
            nome = new Label(NeoManager);
            nome.Init();
            nome.Parent = groupo;
            nome.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            nome.Top = 680;
            nome.Left = pnlRes.Top + 60;
            nome.Width = 100;
            nome.Height = 25;
            nome.Text = "PDS\n"+"24";
            nome.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome);
            
            /////
            
            groupo1 = new GroupPanel(NeoManager);
            groupo1.Init();
            groupo1.Parent = group1;

            groupo1.Top = 660;
            groupo1.Left = pnlRes.Top +groupo.Width+ 70;
            groupo1.Width = 100;
            groupo1.Text = "";
            NeoManager.Add(groupo1);
            btnFirst1 = new Button(NeoManager);
            btnFirst1.Init();
            btnFirst1.Parent = groupo1;
            btnFirst1.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            btnFirst1.Top = 660;
            btnFirst1.Left = pnlRes.Top + groupo.Width + 70;
            btnFirst1.Width = 100;
            btnFirst1.Text = charact1;
            NeoManager.Add(btnFirst1);
            nome1 = new Label(NeoManager);
            nome1.Init();
            nome1.Parent = groupo1;
            nome1.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            nome1.Top = 680;
            nome1.Left = pnlRes.Top + groupo.Width + 70;
            nome1.Width = 100;
            nome1.Height = 25;
            nome1.Text = "d";
            nome1.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome1);
       ///////////////////////////////////////////////////////////////////////////////////////////

            groupo2 = new GroupPanel(NeoManager);
            groupo2.Init();
            groupo2.Parent = group1;

            groupo2.Top = 660;
            groupo2.Left = pnlRes.Top + groupo1.Width + 179;
            groupo2.Width = 100;
            groupo2.Text = "";
            NeoManager.Add(groupo2);
            btnFirst2 = new Button(NeoManager);
            btnFirst2.Init();
            btnFirst2.Parent = groupo2;

            btnFirst2.Top = 660;
            btnFirst2.Left = pnlRes.Top + groupo1.Width + 179;
            btnFirst2.Width = 100;
            btnFirst2.Text = charact2;
            NeoManager.Add(btnFirst2);
            nome2 = new Label(NeoManager);
            nome2.Init();
            nome2.Parent = groupo2;
    
            nome2.Top = 680;
            nome2.Left = pnlRes.Top + groupo1.Width + 179;
            nome2.Width = 100;
            nome2.Height = 25;
            nome2.Text = "dsad";
            nome2.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome2);

            groupo3 = new GroupPanel(NeoManager);
            groupo3.Init();
            groupo3.Parent = group1;

            groupo3.Top = 660;
            groupo3.Left = pnlRes.Top + groupo1.Width + 290;
            groupo3.Width = 100;
            groupo3.Text = "";
            NeoManager.Add(groupo3);
            btnFirst3 = new Button(NeoManager);
            btnFirst3.Init();
            btnFirst3.Parent = groupo3;

            btnFirst3.Top = 660;
            btnFirst3.Left = pnlRes.Top + groupo2.Width + 290;
            btnFirst3.Width = 100;
            btnFirst3.Text = charact3;
            NeoManager.Add(btnFirst3);
            nome3 = new Label(NeoManager);
            nome3.Init();
            nome3.Parent = groupo3;

            nome3.Top = 680;
            nome3.Left = pnlRes.Top + groupo2.Width + 290;
            nome3.Width = 100;
            nome3.Height = 25;
            nome3.Text = "dsad";
            nome3.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome3);

            groupo4 = new GroupPanel(NeoManager);
            groupo4.Init();
            groupo4.Parent = group1;

            groupo4.Top = 660;
            groupo4.Left = pnlRes.Top + groupo3.Width + 399;
            groupo4.Width = 100;
            groupo4.Text ="";
            NeoManager.Add(groupo4);
            btnFirst4 = new Button(NeoManager);
            btnFirst4.Init();
            btnFirst4.Parent = groupo4;

            btnFirst4.Top = 660;
            btnFirst4.Left = pnlRes.Top + groupo3.Width + 399;
            btnFirst4.Width = 100;
            btnFirst4.Text = charact4;
            NeoManager.Add(btnFirst4);
            nome4 = new Label(NeoManager);
            nome4.Init();
            nome4.Parent = groupo4;

            nome4.Top = 680;
            nome4.Left = pnlRes.Top + groupo3.Width + 399;
            nome4.Width = 100;
            nome4.Height = 25;
            nome4.Text = "dsad";
            nome4.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome4);

          groupo5 = new GroupPanel(NeoManager);
            groupo5.Init();
            groupo5.Parent = group1;

            groupo5.Top = 660;
            groupo5.Left = pnlRes.Top + groupo4.Width + 510;
            groupo5.Width = 100;
            groupo5.Text ="";
            NeoManager.Add(groupo5);
            btnFirst5 = new Button(NeoManager);
            btnFirst5.Init();
            btnFirst5.Parent = groupo5;

            btnFirst5.Top = 660;
            btnFirst5.Left = pnlRes.Top + groupo4.Width + 510;
            btnFirst5.Width = 100;
            btnFirst5.Text = charact5;
            NeoManager.Add(btnFirst5);
            nome5 = new Label(NeoManager);
            nome5.Init();
            nome5.Parent = groupo5;

            nome5.Top = 680;
            nome5.Left = pnlRes.Top + groupo4.Width + 510;
            nome5.Width = 100;
            nome5.Height = 25;
            nome5.Text = "dsad";
            nome5.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome5);

            groupo6 = new GroupPanel(NeoManager);
            groupo6.Init();
            groupo6.Parent = group1;

            groupo6.Top = 660;
            groupo6.Left = pnlRes.Top + groupo5.Width + 620;
            groupo6.Width = 100;
            groupo6.Text ="";
            NeoManager.Add(groupo6);
            btnFirst6 = new Button(NeoManager);
            btnFirst6.Init();
            btnFirst6.Parent = groupo6;

            btnFirst6.Top = 660;
            btnFirst6.Left = pnlRes.Top + groupo5.Width + 620;
            btnFirst6.Width = 100;
            btnFirst6.Text = charact6;
            NeoManager.Add(btnFirst6);
            nome6 = new Label(NeoManager);
            nome6.Init();
            nome6.Parent = groupo6;

            nome6.Top = 680;
            nome6.Left = pnlRes.Top + groupo5.Width + 620;
            nome6.Width = 100;
            nome6.Height = 25;
            nome6.Text = "dsad";
            nome6.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome6);
          /* */
            groupo7 = new GroupPanel(NeoManager);
            groupo7.Init();
            groupo7.Parent = group1;

            groupo7.Top = 660;
            groupo7.Left = pnlRes.Top + groupo5.Width + 730;
            groupo7.Width = 100;
            groupo7.Text ="";
            NeoManager.Add(groupo7);
            btnFirst7 = new Button(NeoManager);
            btnFirst7.Init();
            btnFirst7.Parent = groupo7;

            btnFirst7.Top = 660;
            btnFirst7.Left = pnlRes.Top + groupo6.Width + 730;
            btnFirst7.Width = 100;
            btnFirst7.Text = charact7;
            NeoManager.Add(btnFirst7);
            nome7 = new Label(NeoManager);
            nome7.Init();
            nome7.Parent = groupo7;

            nome7.Top = 680;
            nome7.Left = pnlRes.Top + groupo6.Width + 730;
            nome7.Width = 100;
            nome7.Height = 25;
            nome7.Text = "dsad";
            nome7.BackColor = new Color(1, 1, 60);
            NeoManager.Add(nome7);
        /////////////////////////////////////////////////////////////////////////////////////////////    
            if (btnFirst.Text.Equals("")) {
                btnFirst.Hide();
                nome.Hide();
            }  if (btnFirst1.Text.Equals(""))
            {
                btnFirst1.Hide();
                nome1.Hide();

            }
             if (btnFirst2.Text.Equals(""))
            {
                btnFirst2.Hide();
                nome2.Hide();
            }
             if (btnFirst3.Text.Equals(""))
            {
                btnFirst3.Hide();
                nome3.Hide();
            }
             if (btnFirst4.Text.Equals(""))
            {
                btnFirst4.Hide();
                nome4.Hide();
            }
             if (btnFirst5.Text.Equals(""))
            {
                btnFirst5.Hide();
                nome5.Hide();
            }
             if (btnFirst6.Text.Equals(""))
            {
                btnFirst6.Hide();
                nome6.Hide();
            }
             if (btnFirst7.Text.Equals(""))
            {
                btnFirst7.Hide();
                nome7.Hide();
            }
        }

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

        ////////////////////////////////////////////////////////////////////////////    
        void btnExit_Click(object sender, Controls.EventArgs e)
        {

            System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Do You Want Exit", "", System.Windows.Forms.MessageBoxButtons.YesNo);
            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                System.Windows.Forms.Application.Exit();

            }


        }
        void btncreate_Click(object sender, Controls.EventArgs e)
        {

            StateManager.ChangeState(GameRef.createchar);

        }
        void btnStart_Click(object sender, Controls.EventArgs e)
        {

            /*  World ola = new World(Manager, tex);


              ola.Init();
              ola.StayOnTop = true;
              ola.Visible = false;
              ola.Width = 900;
              ola.Height = 800;
              ola.CloseButtonVisible = true;
              ola.Center();
              ola.Movable = false;
              ola.Shadow = false;
              delete.Hide();
              create.Hide();
              start.Hide();
              ServerSection.Hide();
              Quit.Hide();
              ok.Hide();
              group1.Hide();
              btnFirst.Hide();
              ola.Show();
              */

        }
    }


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

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



}


problem change screen xna

13 June 2014 - 03:44 PM

the problem is execute the game and make the login if the StateManager.PushState(GameRef.StartMenuScreen); in the function private void ProcessComplete(Headers header, ErrorCodes Erro)

give a message of server is offline

i put my interecode in github

this is the link to my code https://github.com/Kammikazy/Firstgame


PARTNERS