예제 #1
0
        //construct the displayer.
        //Because this class needs to load content, a ContentRegister is a required
        //constructor parameter. This makes sure it will always load content
        public ImageDisplayer(ContentRegister contentRegister)
        {
            if (contentRegister == null)
            {
                throw new ArgumentNullException();
            }

            //create the element that will display the texture
            Vector2 sizeInPixels = new Vector2(768, 384);

            //create an instance of the shader
            //The texture will be assigned to the shader in LoadContent
            this.shader = new Shader.Tutorial09Technique();

            //create the element which will display the shader
            this.element = new ShaderElement(shader, sizeInPixels);

            //place the element in the centre of the screen
            this.element.HorizontalAlignment = HorizontalAlignment.Centre;
            this.element.VerticalAlignment   = VerticalAlignment.Centre;

            //add this object to the content register
            //items added to a content register do not need to be removed, as they
            //are tracked by a weak reference.
            //LoadContent() will be called whenever the device is created/reset.
            contentRegister.Add(this);

            //At this point, since the device has been created, LoadContent() will have
            //been called already. If the device hadn't been created yet, then
            //LoadContent() would be called at a later time.

            //LoadContent() will always be called before the first time Draw() is called.
        }
예제 #2
0
        public static void LoadDefaultSkin()
        {
            // *** Box ***
            Box_TopLeft     = ContentRegister.BitmapToTexture(Resources.Box_TopLeft, "Resource_Box_TopLeft");
            Box_Top         = ContentRegister.BitmapToTexture(Resources.Box_Top, "Resource_Box_Top");
            Box_TopRight    = ContentRegister.BitmapToTexture(Resources.Box_TopRight, "Resource_Box_TopRight");
            Box_Left        = ContentRegister.BitmapToTexture(Resources.Box_Left, "Resource_Box_Left");
            Box_Mid         = ContentRegister.BitmapToTexture(Resources.Box_Mid, "Resource_Box_Mid");
            Box_Right       = ContentRegister.BitmapToTexture(Resources.Box_Right, "Resource_Box_Right");
            Box_BottomLeft  = ContentRegister.BitmapToTexture(Resources.Box_BottomLeft, "Resource_Box_BottomLeft");
            Box_Bottom      = ContentRegister.BitmapToTexture(Resources.Box_Bottom, "Resource_Box_Bottom");
            Box_BottomRight = ContentRegister.BitmapToTexture(Resources.Box_BottomRight, "Resource_Box_BottomRight");

            // *** Button ***
            Button_TopLeft          = ContentRegister.BitmapToTexture(Resources.Button_TopLeft, "Resource_Button_TopLeft");
            Button_Top              = ContentRegister.BitmapToTexture(Resources.Button_Top, "Resource_Button_Top");
            Button_TopRight         = ContentRegister.BitmapToTexture(Resources.Button_TopRight, "Resource_Button_TopRight");
            Button_Left             = ContentRegister.BitmapToTexture(Resources.Button_Left, "Resource_Button_Left");
            Button_Mid              = Mrag.SpriteBatch.Pixel; //ContentRegister.BitmapToTexture(Resource.Button_Mid, "Resource_Button_Mid");
            Button_Right            = ContentRegister.BitmapToTexture(Resources.Button_Right, "Resource_Button_Right");
            Button_BottomLeft       = ContentRegister.BitmapToTexture(Resources.Button_BottomLeft, "Resource_Button_BottomLeft");
            Button_Bottom           = ContentRegister.BitmapToTexture(Resources.Button_Bottom, "Resource_Button_Bottom");
            Button_BottomRight      = ContentRegister.BitmapToTexture(Resources.Button_BottomRight, "Resource_Button_BottomRight");
            Button_ColorMiddleBlend = new Color(26, 29, 34);
        }
		private bool worldMatrixDirty = true; // set to true if worldMatrix is no longer valid, see 'UpdateWorldMatrix()'

		//create the actor
		public Actor(ContentRegister content, UpdateManager updateManager, MaterialLightCollection lights, float groundRadius)
		{
			this.groundRadius = groundRadius;

			model = new ModelInstance();
			model.LightCollection = lights;

			//force the model to render using spherical harmonic lighting
			//this will significantly improve performance on some hardware when GPU limited
			model.ShaderProvider = new Xen.Ex.Graphics.Provider.LightingDisplayShaderProvider(LightingDisplayModel.ForceSphericalHarmonic, model.ShaderProvider);

			//random starting position
			position = GetRandomPosition();

			//initially target the current position
			//the 'move to next target' timer will wind down and then the actor will move
			target = position;

			//randomize a bit
			lookAngle = (float)random.NextDouble() * MathHelper.TwoPi;
			moveSpeed = (float)random.NextDouble() * 0.9f + 0.1f;

			content.Add(this);
			updateManager.Add(this);


			InitaliseAnimations(updateManager);
		}
예제 #4
0
        //load the avatar
        public Avatar(ContentRegister content, UpdateManager update)
        {
            //create a random avatar description...
            Microsoft.Xna.Framework.GamerServices.AvatarDescription description;
            description = Microsoft.Xna.Framework.GamerServices.AvatarDescription.CreateRandom();

            //Create the avatar instance
            avatar = new AvatarInstance(description, true);


            //Create the animation controller.
            animationController = avatar.GetAnimationController();

            //NOTE: Animations cannot be played until the avatar animation data has been loaded...
            content.Add(this);             // this will call LoadContent
            update.Add(this);

            //At this point in this tutorial, the animation is now loaded.

            //get the index of the walk animation
            int animationIndex = animationController.AnimationIndex("Walk");

            //begin playing the animation, looping
            walkAnimation = animationController.PlayLoopingAnimation(animationIndex);
        }
예제 #5
0
        public Skydome(ContentRegister content, Vector3 position, float scale)
        {
            model = new ModelInstance();

            Matrix.CreateTranslation(ref position, out worldMatrix);
            Matrix.CreateScale(scale, out scaleMatrix);

            content.Add(this);
        }
예제 #6
0
파일: BMFont.cs 프로젝트: codecat/mrag2
        /// <summary>
        /// Load a BMFont from a stream, and a single page. This page will be used as the first page. More pages can be added manually.
        /// </summary>
        /// <param name="streamXml">The stream for the XML.</param>
        /// <param name="texturePage">The singular (or just the first) texture page.</param>
        public BMFont(Stream streamXml, System.Drawing.Bitmap texturePage)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(BMFontModels.FontFile));
            TextReader    textReader   = new StreamReader(streamXml);

            m_font = (BMFontModels.FontFile)deserializer.Deserialize(textReader);
            textReader.Close();

            AddPage(ContentRegister.BitmapToTexture(texturePage, "_BMFont_ctor2_" + m_font.Pages[0].File));
        }
예제 #7
0
        //call this when you are done with the level, and want to clean it's content up.
        //just make sure the content isn't in use anymore when you call this!
        public void Dispose()
        {
            //dispose the content register. (Otherwise the content will stay in memory)

            if (this.content != null)
            {
                this.content.Dispose();
            }

            this.content = null;
        }
        public TestScene(ContentRegister content, Camera3D camera, int level)
            : base(content, camera)
        {
            CollisionGroupPair pair2 = new CollisionGroupPair(bulletEnemyCollisionGroup, CollisionRules.DefaultKinematicCollisionGroup);
            CollisionRules.CollisionGroupRules.Add(pair2, CollisionRule.NoBroadPhase);

            CollisionGroupPair pair3 = new CollisionGroupPair(bulletEnemyCollisionGroup, CollisionRules.DefaultDynamicCollisionGroup);
            CollisionRules.CollisionGroupRules.Add(pair3, CollisionRule.NoBroadPhase);

            _level = level;
        }
예제 #9
0
		public Scene(ContentRegister content, Camera3D camera)
		{
			this.camera = camera;

			//create the draw target.
			drawToScreen = new DrawTargetScreen(camera);
			drawToScreen.ClearBuffer.ClearColour = Color.Black;

			InitializePhysics();

			content.Add(this);
		}
예제 #10
0
        public Actor(ContentRegister content, Vector3 position)
        {
            Matrix.CreateTranslation(ref position, out this.worldMatrix);

            //A ModelInstance can be created without any content...
            //However it cannot be used until the content is set

            model = new ModelInstance();

            //add to the content register
            content.Add(this);
        }
예제 #11
0
        public Actor(ContentRegister content, Vector3 position, float animationSpeed, int animationIndex)
        {
            Matrix.CreateRotationZ(1 - (float)animationIndex, out this.worldMatrix);
            this.worldMatrix.Translation = position;

            model = new ModelInstance();
            this.animationController = model.GetAnimationController();

            content.Add(this);

            this.animation = this.animationController.PlayLoopingAnimation(animationIndex);
            this.animation.PlaybackSpeed = animationSpeed;
        }
예제 #12
0
        public RenderConfigEditor(ContentRegister content)
        {
            //setup the text elements
            this.stateText         = new List <TextElement>();
            this.visibleElementGap = new List <bool>();

#if XBOX360
            this.helpText = new TextElement("Use 'A' and the DPad to interact with the menu");
#else
            this.helpText = new TextElement("Use the Arrow Keys and 'Enter' to interact with the menu");
#endif
            this.helpText.HorizontalAlignment = HorizontalAlignment.Left;
            this.helpText.VerticalAlignment   = VerticalAlignment.Bottom;
            this.helpText.Colour = Color.Black;

            this.backgroundContainer = new SolidColourElement(new Color(0, 0, 0, 200), new Vector2(0, 0));
            this.backgroundContainer.AlphaBlendState = Xen.Graphics.State.AlphaBlendState.Alpha;

            foreach (string name in ConfigProperties.Keys)
            {
                //create the text
                TextElement text = new TextElement();

                //if it's a ediable value, then put a '[X]' infront
                if (ConfigProperties[name].CanRead)
                {
                    text.Text.SetText("[ ] " + name);
                }
                else
                {
                    text.Text.SetText(name);
                }

                text.VerticalAlignment = VerticalAlignment.Bottom;
                this.stateText.Add(text);

                bool gap = false;
                if (ConfigProperties[name].GetCustomAttributes(typeof(RenderConfiguration.GapAttribute), false).Length > 0)
                {
                    gap = true;
                }

                this.visibleElementGap.Add(gap);
            }

            //select top instance
            this.editSelection = this.stateText.Count - 1;

            //sizes of the elements are setup in LoadContent()
            content.Add(this);
        }
예제 #13
0
        /// <summary>
        /// create a new actor
        /// </summary>
        /// <param name="content"></param>
        /// <param name="modelfile">model file to be loaded</param>
        /// <param name="position">position</param>
        /// <param name="scale_factor">scale</param>
        public Actor(ContentRegister content,String modelfile, Vector3 position, float scale_factor)
        {
            this.scale = scale_factor;
            this.position = position;

            Matrix.CreateTranslation(ref position, out this.worldMatrix);
            Matrix.CreateScale(scale_factor,out this.scaleMatrix);

            this.filename = modelfile;

            this.model = new ModelInstance();

            content.Add(this);
        }
예제 #14
0
        public ActionResult Forgot(string mail)
        {
            ViewBag.Mes = "";
            // Member member = SessionUtility.GetSessionMember(Session);
            var member = _membersBusiness.GetDynamicQuery().Where(x => x.MemberProfile.Emaill == mail).ToList();

            if (member.Any())
            {
                ViewBag.Mes = "Chúng tôi đã gửi link thay đổi mật khẩu của bạn, vui lòng kiểm tra mail để hoàn tất tiến trình";
                var entity = member.First();
                var verify = HomeFunction.RandomString(15);
                entity.Verify = verify;
                _membersBusiness.Edit(entity);

                #region SendMail

                var ho = Request.ServerVariables["HTTP_HOST"];
                //string sub = "Active tài khoản thành viên";
                var url  = "http://" + ho + "/Login/VerifyForget?vr=" + verify;
                var link = "<a href=\"" + url + "\" style=\"color: #0388cd\" target=\"_blank\"><span class=\"il\">BUYGROUP365</span> – Buygroup365.vn</a>";
                var html =
                    "<tr><td style=\"padding: 14px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Xác nhận thay đổi mật khẩu của quý khách trên <span class=\"il\">BUYGROUP365</span>!</b></td> </tr>" +
                    "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Vui lòng nhấn vào đường dẫn dưới đây để xác nhận:</b></td></tr>" +
                    "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>" + link + "</td></tr>" +
                    "<tr><td style=\"padding: 7px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\">Mọi thắc mắc và góp ý, xin Quý khách vui lòng liên hệ với chúng tôi qua:</td></tr>";

                //   var link = "<a href=\"" + url + "\">BUYGROUP365 – Xác nhận đăng ký thành công</a>";
                //  string body = ControllerExtensions.RenderRazorViewToString(MailTempController, "DetailCart", link);
                var contentRegister = new ContentRegister {
                    LinkActive = html, UserName = "", Pass = ""
                };
                string body = ControllerExtensions.RenderRazorViewToString(this, "MesengerRegister", contentRegister);
                Function.ObjMailSend objmail = new Function.ObjMailSend();
                var mailsend = new SystemSettingBusiness().GetDynamicQuery().First(x => x.Key == "mail_noreply");
                var acount   = mailsend.Value.Split('|');
                objmail.FromMail     = acount[0];
                objmail.PassFromMail = acount[1];
                objmail.ToMail       = entity.MemberProfile.Emaill;

                Function.email_send(objmail, "[Buygroup365]Xác nhận quên mật khẩu (" + DateTime.Now + ")", body);

                #endregion SendMail
            }
            else
            {
                ViewBag.Mes = "";
            }
            return(View(member));
        }
		public Actor(ContentRegister content)
		{
			//A ModelInstance can be created without any content...
			//However it cannot be used until the content is set

			model = new ModelInstance();

			content.Add(this);

			//play an animation
			model.GetAnimationController().PlayLoopingAnimation(3);

			//This method creates a Cube for each bone in the mesh
			BuildBoundingBoxGeometry();
		}
예제 #16
0
        public Actor(ContentRegister content)
        {
            //A ModelInstance can be created without any content...
            //However it cannot be used until the content is set

            model = new ModelInstance();

            content.Add(this);

            //play an animation
            model.GetAnimationController().PlayLoopingAnimation(3);

            //This method creates a Cube for each bone in the mesh
            BuildBoundingBoxGeometry();
        }
예제 #17
0
파일: BMFont.cs 프로젝트: codecat/mrag2
        /// <summary>
        /// Load a BMFont from a path to an XML-encoded .fnt file.
        /// </summary>
        /// <param name="filename">Path to the XML file.</param>
        public BMFont(string filename)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(BMFontModels.FontFile));
            TextReader    textReader   = new StreamReader(filename);

            m_font = (BMFontModels.FontFile)deserializer.Deserialize(textReader);
            textReader.Close();

            foreach (var page in m_font.Pages)
            {
                Texture2D texture = ContentRegister.Texture(System.IO.Path.GetDirectoryName(filename) + "/" + page.File);
                Debug.Assert(texture != null);
                AddPage(texture);
            }
        }
예제 #18
0
        void IContentOwner.LoadContent(ContentRegister content, DrawState state, ContentManager manager)
        {
            //this is just making work...
            //and it's *really* slow on the xbox :D
#if XBOX360
            for (int i = 0; i < 1000; i++)
#else
            for (int i = 0; i < 10000; i++)
#endif
            {
                if (Math.Sqrt(DateTime.Now.Ticks) > Math.Tan(DateTime.Today.Ticks))
                {
                    FakeData++;
                }
            }
        }
예제 #19
0
        //Load content
        public void LoadContent(ContentRegister register, DrawState state, ContentManager manager)
        {
            //This is the only place the API is designed to give access to the XNA
            //content manager.
            //This is to encorage keeping all content loading in the one place.

            //load and assign the texture:
            //Note the texture is assigned to the shader, not the visual element
            this.shader.DisplayTexture = manager.Load <Texture2D>(@"skyline");

            //use:

            /*
             * this.shader.DisplayTextureSampler
             */
            //to change how the texture is sampled
        }
		public GroundDisk(ContentRegister content, MaterialLightCollection lights, float radius)
		{
			this.radius = radius;

			int vertexCount = 256;
			var indices = new List<int>();

			//create the vertices. Note the DiskVertex() constructor takes an angle/size
			var verts = new DiskVertex[vertexCount];

			for (int i = 0; i < vertexCount; i++)
			{
				verts[i] = new DiskVertex((i / (float)(vertexCount - 1)) * MathHelper.TwoPi, radius, 0.05f);
				
				if (i != 0)	//add the tirangle indices
				{
					indices.Add(0);
					indices.Add(i - 1);
					indices.Add(i);
				}
			}

			//create the vertex buffer
			this.vertices = new Vertices<DiskVertex>(verts);
			this.indices = new Indices<int>(indices);


			//create the custom material for this geometry
			//the light collection has been passed into the constructor, although it
			//could easily be changed later (by changing material.Lights)
			this.Material = new MaterialShader(lights);
			
			//give the disk really bright specular for effect
			Material.SpecularColour = new Vector3(1,1,1);
			Material.DiffuseColour = new Vector3(0.6f, 0.6f, 0.6f);
			Material.SpecularPower = 64;

			//setup the texture samples to use high quality anisotropic filtering
			//the textures are assigned in LoadContent
			Material.Textures = new MaterialTextures();
			Material.Textures.TextureMapSampler = TextureSamplerState.AnisotropicHighFiltering;
			Material.Textures.NormalMapSampler = TextureSamplerState.AnisotropicLowFiltering;

			//load the textures for this material
			content.Add(this);
		}
예제 #21
0
        public RenderConfigEditor(ContentRegister content)
        {
            //setup the text elements
            this.stateText = new List<TextElement>();
            this.visibleElementGap = new List<bool>();

            #if XBOX360
            this.helpText = new TextElement("Use 'A' and the DPad to interact with the menu");
            #else
            this.helpText = new TextElement("Use the Arrow Keys and 'Enter' to interact with the menu");
            #endif
            this.helpText.HorizontalAlignment = HorizontalAlignment.Left;
            this.helpText.VerticalAlignment = VerticalAlignment.Bottom;
            this.helpText.Colour = Color.Black;

            this.backgroundContainer = new SolidColourElement(new Color(0, 0, 0, 200), new Vector2(0, 0));
            this.backgroundContainer.AlphaBlendState = AlphaBlendState.Alpha;

            foreach (string name in ConfigProperties.Keys)
            {
                //create the text
                TextElement text = new TextElement();

                //if it's a ediable value, then put a '[X]' infront
                if (ConfigProperties[name].CanRead)
                    text.Text.SetText("[ ] " + name);
                else
                    text.Text.SetText(name);

                text.VerticalAlignment = VerticalAlignment.Bottom;
                this.stateText.Add(text);

                bool gap = false;
                if (ConfigProperties[name].GetCustomAttributes(typeof(RenderConfiguration.GapAttribute), false).Length > 0)
                    gap = true;

                this.visibleElementGap.Add(gap);
            }

            //select top instance
            this.editSelection = this.stateText.Count - 1;

            //sizes of the elements are setup in LoadContent()
            content.Add(this);
        }
예제 #22
0
        public SimpleTerrain(ContentRegister content, Vector3 position, string modelDataName)
        {
            this.modelDataName = modelDataName;

            //Matrix.CreateTranslation(ref position, out this.worldMatrix);
            this.worldMatrix = Matrix.CreateTranslation(position);// *Matrix.CreateScale(2.0f); // needed for physics

            //A ModelInstance can be created without any content...
            //However it cannot be used until the content is set
            this.model = new ModelInstance();

            this.terrainShader = new Shaders.SimpleTerrain();

            PickingDrawer = new LightSourceDrawer(Vector3.Zero, new Xen.Ex.Geometry.Sphere(new Vector3(3), 8, true, false, false), Color.Red);

            //add to the content register and load textures/etc
            content.Add(this);
        }
예제 #23
0
        void IContentOwner.LoadContent(ContentRegister content, DrawState state, ContentManager manager)
        {
            //setup the font
            SpriteFont font = manager.Load <SpriteFont>(@"CourierNew");

            if (this.helpText != null)
            {
                this.helpText.Font = manager.Load <SpriteFont>(@"Arial");
            }

            for (int i = 0; i < stateText.Count; i++)
            {
                stateText[i].Font = font;
            }

            Application application = state.Application;

            SetupTextSize(application);
        }
예제 #24
0
        //load the avatar animation...
        public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
        {
            //load the model data into the model instance

            /********************************************************************************************/
            /********************************************************************************************/
            avatar.AddNamedAnimation(manager.Load <AvatarAnimationData>(@"AvatarAnimations\walk"), "Walk");
            /********************************************************************************************/
            /********************************************************************************************/
            /*																							*/
            /*	Getting an exeption here? Here is how to fix it:										*/
            /*																							*/
            /********************************************************************************************/
            /********************************************************************************************/

            /*/
             *
             * This sample demonstrates two forms of avatar animation, 'preset' animations that are
             * standard animations available to all XNA applications, and custom animations imported
             * from an FBX file.
             *
             * The fbx used in this tutorial is walk.fbx, from the XNA custom avatar animation sample.
             * This sample is for premium members only (so can't be redistributed) and is also a quite
             * large download. (Walk.fbx is 10MB!)
             *
             * The sample can be downloaded here:
             * http://creators.xna.com/en-US/sample/customavataranimation
             * http://creators.xna.com/downloads/?id=387
             *
             * Once downloaded and extracted, add Walk.fbx in the 'AvatarAnimations' directory in
             * the Content project.
             * Once added, set the content processor to 'Avatar Animation - Xen'.
             *
             * Note:
             *
             * The XNA sample assumes there is a single animation per FBX file.
             * Use the 'AddNamedAnimation' method to load these types of animation files. For FBX
             * files with multiple animations (that are already named) use the 'AddAnimationSource'
             * method.
             *
             * /*/
        }
		//load the avatar
		public Avatar(ContentRegister content, UpdateManager update, out bool contentLoaded)
		{
			//create a random avatar description...
			Microsoft.Xna.Framework.GamerServices.AvatarDescription description;
			description = Microsoft.Xna.Framework.GamerServices.AvatarDescription.CreateRandom();

			//Create the avatar instance
			avatar = new AvatarInstance(description, true);


			//Create the animation controller.
			animationController = avatar.GetAnimationController();

			//NOTE: Animations cannot be played until the avatar animation data has been loaded...
			update.Add(this);

			//to play animations from a file, the user must download additional content.
			//however, we don't want to crash if they haven't... so only crash if the debugger is present
			//this will allow the user to download the content.
			contentLoaded = false;

			try
			{
				content.Add(this);
				contentLoaded = true;
			}
			catch
			{
				content.Remove(this);	//failed! but don't crash
			}

			if (contentLoaded)
			{
				//At this point in this tutorial, the animation is now loaded.

				//get the index of the walk animation
				int animationIndex = animationController.AnimationIndex("Walk");

				//begin playing the animation, looping
				walkAnimation = animationController.PlayLoopingAnimation(animationIndex);
			}
		}
		public Actor(ContentRegister content, Vector3 position)
		{
			//set the world matrix
			Matrix.CreateTranslation(ref position, out this.worldMatrix);

			//A ModelInstance can be created without any content...
			//However it cannot be used until the content is set

			this.model = new ModelInstance();

			//Note:
			// When a model is drawn, by default it will bind and use a MaterialShader.
			// This shader uses the material properties stored in the original mesh.
			// If you don't want to use the MaterialShader, simply set the property
			// model.ShaderProvider to null.
			

			//add to the content register
			content.Add(this);
		}
예제 #27
0
        public GroundDisk(ContentRegister content, float radius, MaterialLightCollection lights)
        {
            //build the disk
            VertexPositionNormalTexture[] vertexData = new VertexPositionNormalTexture[256];

            for (int i = 0; i < vertexData.Length; i++)
            {
                //a bunch of vertices, in a circle!
                float   angle    = (float)i / (float)vertexData.Length * MathHelper.TwoPi;
                Vector3 position = new Vector3((float)Math.Sin(angle), (float)Math.Cos(angle), 0);

                vertexData[i] = new VertexPositionNormalTexture(position * radius, new Vector3(0, 0, 1), new Vector2(position.X, position.Y));
            }
            this.vertices = new Vertices <VertexPositionNormalTexture>(vertexData);

            //create the material, and add to content
            this.material        = new MaterialShader();
            this.material.Lights = lights;
            content.Add(this);
        }
		//NEW CODE
		public Actor(ContentRegister content, MaterialLightCollection lights)
		{
			//A ModelInstance can be created without any content...
			//However it cannot be used until the content is set

			model = new ModelInstance();
			model.LightCollection = lights;	//this class is reused by later tutorials, which require lights

			//get and create the animation controller for this model.
			animationController = model.GetAnimationController();

			//NOTE: Animations cannot be played until the model data has been loaded...

			content.Add(this);

			//At this point in this tutorial, the model is now loaded.

			//get the index of the walk animation
			//this model has 4 animations, Wave, Jog, Walk and Loiter
			//The animations are stored in model.ModelData.Animations
			int animationIndex = animationController.AnimationIndex("Walk");

			//begin playing the animation, looping
			animation = animationController.PlayLoopingAnimation(animationIndex);

			//as many animations as you want can be played at any one time
			//to blend between animations, adjust their weighting with:
			//animation.Weighting = ...;
			//Combined weightings usually should add up to 1.0
			//A weighting of 0 means the animation has no effect, 1 has normal effect.
			//Values outside the 0-1 range usually produces undesirable results.

			//Note:
			//Animations in xen are lossy compressed.
			//For the model used here, the animation data is reduced from nearly 2mb
			//down to around 200kb. (The model geometry is less than 300kb)
			//The amount of compression change can be configured in the content's properties
			//The 'Animation Compression Tolerance' value is a percentage
			//The default is .5%. This means the animation will always be within .5%
			//of the source. Setting this value to 0 will save a lossless animation.
		}
예제 #29
0
        //NEW CODE
        public Actor(ContentRegister content)
        {
            //A ModelInstance can be created without any content...
            //However it cannot be used until the content is set

            model = new ModelInstance();

            //create the animation controller.
            animationController = model.GetAnimationController();

            //NOTE: Animations cannot be played until the model data has been loaded...

            content.Add(this);

            //At this point in this tutorial, the model is now loaded.

            //get the index of the walk animation
            //this model has 4 animations, Wave, Jog, Walk and Loiter
            //The animations are stored in model.ModelData.Animations
            int animationIndex = animationController.AnimationIndex("Walk");

            //begin playing the animation, looping
            animation = animationController.PlayLoopingAnimation(animationIndex);

            //as many animations as you want can be played at any one time
            //to blend between animations, adjust their weighting with:
            //animation.Weighting = ...;
            //Combined weightings usually should add up to 1.
            //A weighting of 0 means the animation has no effect, 1 has normal effect.
            //Values outside the 0-1 range usually produces undesirable results.

            //Note:
            //Animations in xen are lossy compressed.
            //For the model used here, the animation data is reduced from nearly 2mb
            //down to around 200kb. (The model geometry is less than 300kb)
            //The amount of compression change can be configured in the content's properties
            //The 'Animation Compression Tolerance' value is a percentage
            //The default is .5%. This means the animation will always be within .5%
            //of the source. Setting this value to 0 will save a lossless animation.
        }
예제 #30
0
        public GroundDisk(ContentRegister content, MaterialLightCollection lights, float radius)
        {
            this.radius = radius;

            int vertexCount = 256;

            //create the vertices. Note the DiskVertex() constructor takes an angle/size
            DiskVertex[] verts = new DiskVertex[vertexCount];
            for (int i = 0; i < vertexCount; i++)
            {
                verts[i] = new DiskVertex((i / (float)(vertexCount - 1)) * MathHelper.TwoPi, radius, 0.05f);
            }

            //create the vertex buffer
            this.vertices = new Vertices <DiskVertex>(verts);


            //create the custom material for this geometry
            //the light collection has been passed into the constructor, although it
            //could easily be changed later (by changing material.Lights)
            this.material = new MaterialShader(lights);

            //By default, per-pixel lighting in the material shader does not do
            //specular reflection. This is because specular nearly triples the
            //complexity of the lighting calculation - which makes rendering slower
            //and reduces the maximum number of per-pixel lights supported from 4 to 2.
            material.UsePerPixelSpecular = true;

            //give the disk really bright specular for effect
            material.SpecularColour = new Vector3(1, 1, 1);
            material.DiffuseColour  = new Vector3(0.6f, 0.6f, 0.6f);
            material.SpecularPower  = 64;

            //setup the texture samples to use high quality anisotropic filtering
            material.TextureMapSampler = TextureSamplerState.AnisotropicHighFiltering;
            material.NormalMapSampler  = TextureSamplerState.AnisotropicLowFiltering;

            //load the textures for this material
            content.Add(this);
        }
예제 #31
0
        //this method is called by a Background Thread.
        void Xen.Threading.IAction.PerformAction(object data)
        {
            //here is where the loading is initalised.
            //this is on another thread

            //create the ContentRegister
            //This should usually be done on the thread
            //where the register will be used

            this.content = new ContentRegister(this.application);


            float invItemCount100 = 0, index = 0;

            if (this.contentToLoad.Count > 0)
            {
                invItemCount100 = 100F / this.contentToLoad.Count;
            }

            //now, loop the content list, and load each item
            for (int i = 0; i < this.contentToLoad.Count; i++)
            {
                this.content.Add(this.contentToLoad[i]);

                //update the progress
                index += 1;
                lock (this)
                {
                    this.loadPercentage = index * invItemCount100;
                }
            }

            //done!
            lock (this)
            {
                this.loadComplete = true;
            }
        }
예제 #32
0
        public Actor(ContentRegister content, UpdateManager updateManager)
        {
            //load the model
            model = new ModelInstance();
            content.Add(this);

            //create the animation controller
            animationController = model.GetAsyncAnimationController(updateManager);

            //NEW CODE
            //create the animation modifier

            int rotateBoneIndex = model.ModelData.Skeleton.GetBoneIndexByName("Bip01_Spine2");

            this.animationModifer = new AnimationModifier(rotateBoneIndex, model.ModelData);

            //set the modifier on the animation controller
            this.animationController.AnimationBoneModifier = this.animationModifer;

            //play the run animation
            int animationIndex = animationController.AnimationIndex("Jog");

            this.animation = animationController.PlayLoopingAnimation(animationIndex);
        }
예제 #33
0
        private bool worldMatrixDirty = true;         // set to true if worldMatrix is no longer valid, see 'UpdateWorldMatrix()'

        //create the actor
        public Actor(ContentRegister content, UpdateManager updateManager, MaterialLightCollection lights, float groundRadius)
        {
            this.groundRadius = groundRadius;

            model = new ModelInstance();
            model.LightCollection = lights;

            //random starting position
            position = GetRandomPosition();

            //initially target the current position
            //the 'move to next target' timer will wind down and then the actor will move
            target = position;

            //randomize a bit
            lookAngle = (float)random.NextDouble() * MathHelper.TwoPi;
            moveSpeed = (float)random.NextDouble() * 0.9f + 0.1f;

            content.Add(this);
            updateManager.Add(this);


            InitaliseAnimations(updateManager);
        }
		public Actor(ContentRegister content, UpdateManager updateManager)
		{
			//load the model
			model = new ModelInstance();
			content.Add(this);

			//create the animation controller
			animationController = model.GetAsyncAnimationController(updateManager);

			//NEW CODE
			//create the animation modifier

			int rotateBoneIndex = model.ModelData.Skeleton.GetBoneIndexByName("Bip01_Spine2");
			this.animationModifer = new AnimationModifier(rotateBoneIndex, model.ModelData);

			//set the modifier on the animation controller
			this.animationController.AnimationBoneModifier = this.animationModifer;

			//play the run animation
			int animationIndex = animationController.AnimationIndex("Jog");
			this.animation = animationController.PlayLoopingAnimation(animationIndex);
		}
예제 #35
0
 public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
 {
     //load the model
     model.ModelData = manager.Load <ModelData>(@"tiny_4anim");
 }
예제 #36
0
 public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
 {
     material.TextureMap = manager.Load <Texture2D>(@"box");
 }
예제 #37
0
 void IContentOwner.UnloadContent(ContentRegister content, DrawState state)
 {
     decl = null;
 }
		internal void Run(GameComponentHost host)
		{
			if (host == null)
				throw new ArgumentNullException();
			if (xnaLogic != null)
				throw new InvalidOperationException("Application is already initalised");

			xnaLogic = new XNALogic(this, host, out this.gamerServicesComponent);
			xnaLogic.Services.AddService(typeof(ApplicationProviderService), new ApplicationProviderService(this));
			xnaLogic.Exiting += new EventHandler(ShutdownThreadPool);
			xnaLogic.Content.RootDirectory += "Content";

			content = new ContentRegister(this, xnaLogic.Content);
			content.Add(this);

			xnaLogic.Run();
		}
		/// <summary>
		/// Start the main application loop. This method should be called from the entry point of the application
		/// </summary>
		public void Run()
		{
			if (xnaLogic != null)
				throw new InvalidOperationException("Application is already initalised");

			xnaLogic = new XNALogic(this, null, out gamerServicesComponent);

			this.XnaComponents.ComponentAdded += delegate(object sender, GameComponentCollectionEventArgs e) { if (e.GameComponent is DrawableGameComponent) drawableComponents++; };
			this.XnaComponents.ComponentRemoved += delegate(object sender,GameComponentCollectionEventArgs e) { if (e.GameComponent is DrawableGameComponent) drawableComponents--; };

			xnaLogic.Services.AddService(typeof(ApplicationProviderService), new ApplicationProviderService(this));
			xnaLogic.Exiting += new EventHandler(ShutdownThreadPool);
			xnaLogic.Content.RootDirectory += "Content";

			content = new ContentRegister(this, xnaLogic.Content);
			content.Add(this);

			xnaLogic.Run();
		}
예제 #40
0
        public ActionResult Register(Register obj)
        {
            //verryfy dư liêu trước khi insert.....wating
            //
            //    Member member=new Member();
            // MemberProfile memberProfile=new MemberProfile();
            if (_membersBusiness.CheckDuplicate(obj.Username))
            {
                ViewBag.Mes = "Tên này đã tồn tại trong hệ thống";
                return(View(obj));
            }
            else if (_membersBusiness.CheckDuplicate(obj.Email))
            {
                ViewBag.Mes = "Mail này đã tồn tại trong hệ thống";
                return(View(obj));
            }
            else
            {
                Random rd     = new Random();
                var    member = new Member
                {
                    UserName                = obj.Username,
                    Password                = Common.util.Common.GetMd5Sum(obj.Pass),
                    PasswordTransaction     = Common.util.Common.GetMd5Sum(obj.Pass),
                    PasswordEncrypted       = 1,
                    PasswordModifyDate      = DateTime.Now,
                    PasswordEncryptedMethod = "MD5",
                    LoginDate               = DateTime.Now,
                    LastFailedLoginDate     = DateTime.Now,
                    Loutout     = false,
                    LockoutDate = DateTime.Now,

                    Verify     = Common.util.Common.GetMd5Sum(rd.Next(1111, 9999).ToString()),
                    Status     = 0,
                    CreateDate = DateTime.Now,
                    ModifyDate = DateTime.Now,
                    ActiveDate = DateTime.Now
                };

                var memberProfile = new MemberProfile
                {
                    FirstName  = obj.FirstName,
                    LastName   = obj.LastName,
                    LocationId = -1,
                    Address    = " ",
                    Emaill     = obj.Email,
                    Dob        = DateTime.Now,
                    Sex        = -1,
                    Pid        = " ",
                    ZipCode    = " ",
                    Phone      = ""
                };
                member.MemberProfile = memberProfile;

                //  #region insert bảng shop

                //  Shop objshop = new Shop();
                //  objshop.ShopName = member.UserName;
                //  objshop.LocationId = -1;//chưa xác định
                //  objshop.Phone = "012345446";//chưa xác định
                //  objshop.BeginDate = DateTime.Now;
                //  objshop.EndDate = DateTime.Now;
                //  objshop.ActiveDate = DateTime.Now;
                //  objshop.CreateDate = DateTime.Now;
                //  objshop.ModifyDate = DateTime.Now;
                //  ShopSupport shopSupport = new ShopSupport();
                //  shopSupport.Email = member.MemberProfile.Emaill;
                //  shopSupport.Facebook = " ";//t
                //  shopSupport.Mobile = " ";
                //  shopSupport.Skype = " ";
                //  shopSupport.Yahoo = " ";
                //  shopSupport.SupportName = member.UserName;
                //  shopSupport.Phone = " ";
                ////  objshop.ShopSupport = shopSupport;
                //  ShopPolicy shopPolicy = new ShopPolicy();
                //  shopPolicy.PaymentPolicy = " ";
                //  shopPolicy.SalesPolicy = " ";
                //  shopPolicy.About = " ";
                //  shopPolicy.PrivacyPolicy = " ";
                //  objshop.ShopPolicy = shopPolicy;
                //  //      shopsBusiness.AddNew(objshop);

                //  // objshop.ShopPolicy=
                //  #endregion

                //member.Shop = objshop;

                _membersBusiness.AddNew(member);
                //shopSupport.Id = member.Id;
                //    _shopSupportsBusiness.AddNew(shopSupport);
                ViewBag.Mes = "Đăng ký thành công! vui lòng check mail để active.";

                #region SendMail

                var ho = Request.ServerVariables["HTTP_HOST"];
                //string sub = "Active tài khoản thành viên";
                var url  = "http://" + ho + "/Login/VerifyMember?vr=" + member.Verify;
                var link = "<a href=\"" + url + "\" style=\"color: #0388cd\" target=\"_blank\"><span class=\"il\">BUYGROUP365</span> – Xác nhận đăng ký thành công</a>";
                var html =
                    "<tr><td style=\"padding: 14px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Chúc mừng Quý khách đã đăng ký thành công tài khoản trên <span class=\"il\">BUYGROUP365</span>!</b></td> </tr>" +
                    "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Vui lòng nhấn vào đường dẫn dưới đây để kích hoạt tài khoản:</b></td></tr>" +
                    "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>" + link + "</td></tr>" +
                    "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Tên đăng nhập và mật khẩu của bạn là:  " + obj.Email + " hoặc" + obj.Username + " / " + obj.Pass + "</b></td></tr>" +
                    "<tr><td style=\"padding: 7px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\">Mọi thắc mắc và góp ý, xin Quý khách vui lòng liên hệ với chúng tôi qua:</td></tr>";

                //   var link = "<a href=\"" + url + "\">BUYGROUP365 – Xác nhận đăng ký thành công</a>";
                //  string body = ControllerExtensions.RenderRazorViewToString(MailTempController, "DetailCart", link);
                var contentRegister = new ContentRegister {
                    LinkActive = html, UserName = obj.Username, Pass = obj.Pass
                };
                string body = ControllerExtensions.RenderRazorViewToString(this, "MesengerRegister", contentRegister);
                Function.ObjMailSend objmail = new Function.ObjMailSend();
                var mailsend = new SystemSettingBusiness().GetDynamicQuery().First(x => x.Key == "mail_noreply");
                var acount   = mailsend.Value.Split('|');
                objmail.FromMail     = acount[0];
                objmail.PassFromMail = acount[1];
                objmail.ToMail       = obj.Email;
                Function.email_send(objmail, "[Buygroup365]Xác nhận đăng ký tài khoản (" + DateTime.Now + ")", body);

                #endregion SendMail

                ViewBag.Mes = "1";
                return(View(obj));
            }
        }
예제 #41
0
 void IContentOwner.LoadContent(ContentRegister content, DrawState state, Microsoft.Xna.Framework.Content.ContentManager manager)
 {
     Warm(state);
 }
		//this method is called by a Background Thread.
		void Xen.Threading.IAction.PerformAction(object data)
		{
			//here is where the loading is initalised.
			//this is on another thread

			//create the ContentRegister
			//This should usually be done on the thread
			//where the register will be used

			this.content = new ContentRegister(this.application);


			float invItemCount100 = 0, index = 0;

			if (this.contentToLoad.Count > 0)
				invItemCount100 = 100F / this.contentToLoad.Count;

			//now, loop the content list, and load each item
			for (int i = 0; i < this.contentToLoad.Count; i++)
			{
				this.content.Add(this.contentToLoad[i]);

				//update the progress
				index += 1;
				lock (this)
				{
					this.loadPercentage = index * invItemCount100;
				}
			}

			//done!
			lock (this)
			{
				this.loadComplete = true;
			}
		}
예제 #43
0
 public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
 {
     //load the box texture, and it's normal map.
     material.TextureMap = manager.Load <Texture2D>(@"box");
     material.NormalMap  = manager.Load <Texture2D>(@"box_normal");
 }
		public GroundDisk(ContentRegister content, float radius, MaterialLightCollection lights)
		{
			//build the disk
			var vertexData = new VertexPositionNormalTexture[256];
			var indices = new List<int>();

			for (int i = 1; i < vertexData.Length; i++)
			{
				//a bunch of vertices, in a circle!
				float angle = (float)(i-1) / (float)(vertexData.Length-2) * MathHelper.TwoPi;
				Vector3 position = new Vector3((float)Math.Sin(angle), (float)Math.Cos(angle), 0);

				vertexData[i] = new VertexPositionNormalTexture(position * radius, new Vector3(0, 0, 1), new Vector2(position.X, position.Y));
				if (i > 1)
				{
					indices.Add(0);
					indices.Add(i - 1);
					indices.Add(i);
				}
			}
			vertexData[0] = new VertexPositionNormalTexture(new Vector3(), new Vector3(0, 0, 1), new Vector2());

			this.vertices = new Vertices<VertexPositionNormalTexture>(vertexData);
			this.indices = new Indices<int>(indices);

			//create the material, and add to content
			this.material = new MaterialShader();
			this.material.LightCollection = lights;
			this.material.Textures = new MaterialTextures();

			content.Add(this);
		}
예제 #45
0
 public void UnloadContent(ContentRegister content, DrawState state)
 {
 }
예제 #46
0
 public void LoadContent(ContentRegister content, DrawState state, ContentManager manager)
 {
     //load the model data into the model instance
     model.ModelData = manager.Load <Xen.Ex.Graphics.Content.ModelData>(@"tiny_4anim");
 }
		public Actor(ContentRegister content, Vector3 position, float animationSpeed, int animationIndex)
		{
			Matrix.CreateRotationZ(1-(float)animationIndex, out this.worldMatrix);
			this.worldMatrix.Translation = position;

			model = new ModelInstance();
			this.animationController = model.GetAnimationController();

			content.Add(this);

			this.animation = this.animationController.PlayLoopingAnimation(animationIndex);
			this.animation.PlaybackSpeed = animationSpeed;
		}
예제 #48
0
        public ActionResult VerifyForget(string vr)
        {
            ViewBag.Mes = "";
            var member = _membersBusiness.GetDynamicQuery().Where(x => x.Verify == vr);

            if (member.Any())
            {
                var entity = member.First();
                if (entity.Status == 1)
                {
                    var verify = HomeFunction.RandomString(20);
                    ViewBag.Mes = "1";
                    var pass   = BuyGroup365.Models.Home.HomeFunction.RandomString(8);
                    var mdpass = Common.util.Common.GetMd5Sum(pass);
                    entity.Password           = mdpass;
                    entity.Verify             = verify;
                    entity.PasswordModifyDate = DateTime.Now;
                    _membersBusiness.Edit(entity);

                    #region SendMail

                    var ho = Request.ServerVariables["HTTP_HOST"];
                    //string sub = "Active tài khoản thành viên";
                    var url  = "http://" + ho + "/";
                    var link = "<a href=\"" + url +
                               "\" style=\"color: #0388cd\" target=\"_blank\"><span class=\"il\">BUYGROUP365</span> – Buygroup365.vn</a>";
                    var html =
                        "<tr><td style=\"padding: 14px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Quý khách đã thay đổi mật khẩu thành công <span class=\"il\">BUYGROUP365</span>!</b></td> </tr>" +
                        "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Vui lòng nhấn vào đường dẫn dưới đây để tiếp tục mua hàng:</b></td></tr>" +
                        "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>" +
                        link + "</td></tr>" +
                        "<tr> <td style=\"padding: 4px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\"><b>Tên đăng nhập và mật khẩu của bạn là:  " +
                        entity.MemberProfile.Emaill + " hoặc" + entity.UserName + " ; " + pass + "</b></td></tr>" +
                        "<tr><td style=\"padding: 7px 10px 0 24px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: #666666\">Mọi thắc mắc và góp ý, xin Quý khách vui lòng liên hệ với chúng tôi qua:</td></tr>";

                    //   var link = "<a href=\"" + url + "\">BUYGROUP365 – Xác nhận đăng ký thành công</a>";
                    //  string body = ControllerExtensions.RenderRazorViewToString(MailTempController, "DetailCart", link);
                    var contentRegister = new ContentRegister {
                        LinkActive = html, UserName = "", Pass = ""
                    };
                    string body = ControllerExtensions.RenderRazorViewToString(this, "MesengerRegister", contentRegister);
                    Function.ObjMailSend objmail = new Function.ObjMailSend();
                    var mailsend = new SystemSettingBusiness().GetDynamicQuery().First(x => x.Key == "mail_noreply");
                    var acount   = mailsend.Value.Split('|');
                    objmail.FromMail     = acount[0];
                    objmail.PassFromMail = acount[1];
                    objmail.ToMail       = entity.MemberProfile.Emaill;
                    Function.email_send(objmail, "[Buygroup365]Quên mật khẩu (" + DateTime.Now + ")", body);

                    #endregion SendMail
                }
                else
                {
                    //ViewBag.Mes = "<h4>Chào bạn " + entity.MemberProfile.FirstName + ".Tài khoản của bạn đang bị khóa, hoặc chưa được kick hoạt !</h4>";
                    ViewBag.Mes = 0; // tài khoản bị khóa hoặc chưa được kick hoạt
                }
            }
            else
            {
                ViewBag.Mes = "2";//mã chỉ dc sư dụng 1 lần
            }
            return(View(member));
        }
		//call this when you are done with the level, and want to clean it's content up.
		//just make sure the content isn't in use anymore when you call this!
		public void Dispose()
		{
			//dispose the content register. (Otherwise the content will stay in memory)

			if (this.content != null)
				this.content.Dispose();

			this.content = null;
		}