コード例 #1
0
        // Add GUI controls to the Options window.
        private void CreateGuiControls()
        {
            var sampleFramework = _services.GetInstance <SampleFramework>();
            var optionsPanel    = sampleFramework.AddOptions("Game Objects");
            var panel           = SampleHelper.AddGroupBox(optionsPanel, "ProceduralTerrainObject");

            SampleHelper.AddSlider(
                panel, "Noise width", null, 0.1f, 10f, _noiseWidth,
                value =>
            {
                _noiseWidth            = value;
                _updateGeometryTexture = true;
            });

            SampleHelper.AddSlider(
                panel, "Noise height", null, 0, 1000, _noiseHeight,
                value =>
            {
                _noiseHeight           = value;
                _updateGeometryTexture = true;
            });

            SampleHelper.AddSlider(
                panel, "Noise mu", null, 1, 1.16f, _noiseMu,
                value =>
            {
                _noiseMu = value;
                _updateGeometryTexture = true;
            });
        }
コード例 #2
0
        public SkeletonMappingSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            // Get dude model and start animation on the dude.
            var modelNode = ContentManager.Load <ModelNode>("Dude/Dude");

            _dudeMeshNode           = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _dudeMeshNode.PoseLocal = new Pose(new Vector3F(-0.5f, 0, 0), Matrix33F.CreateRotationY(ConstantsF.Pi));
            SampleHelper.EnablePerPixelLighting(_dudeMeshNode);
            GraphicsScreen.Scene.Children.Add(_dudeMeshNode);

            var animations       = _dudeMeshNode.Mesh.Animations;
            var loopingAnimation = new AnimationClip <SkeletonPose>(animations.Values.First())
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };

            AnimationService.StartAnimation(loopingAnimation, (IAnimatableProperty)_dudeMeshNode.SkeletonPose);

            // Get marine model - do not start any animations on the marine model.
            modelNode                 = ContentManager.Load <ModelNode>("Marine/PlayerMarine");
            _marineMeshNode           = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _marineMeshNode.PoseLocal = new Pose(new Vector3F(0.5f, 0, 0), Matrix33F.CreateRotationY(ConstantsF.Pi));
            SampleHelper.EnablePerPixelLighting(_marineMeshNode);
            GraphicsScreen.Scene.Children.Add(_marineMeshNode);

            CreateSkeletonMapper();
        }
コード例 #3
0
        /// <summary>
        /// Adds bigger spheres with different diffuse and specular properties.
        /// </summary>
        private void AddTestSpheres()
        {
            const int NumX = 5;
            const int NumZ = 11;

            for (int x = 0; x < NumX; x++)
            {
                var mesh = SampleHelper.CreateMesh(
                    ContentManager,
                    GraphicsService,
                    new SphereShape(0.2f),
                    new Vector3F(1 - (float)x / (NumX - 1)), // Diffuse goes from 1 to 0.
                    new Vector3F((float)x / (NumX - 1)),     // Specular goes from 0 to 1.
                    (float)Math.Pow(10, x));                 // Specular power

                for (int z = 0; z < NumZ; z++)
                {
                    _graphicsScreen.Scene.Children.Add(
                        new MeshNode(mesh)
                    {
                        PoseWorld = _globalRotation * new Pose(new Vector3F(x - 2, 1.5f, 3 - z))
                    });
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// The SaveChanges.
        /// </summary>
        /// <returns>The <see cref="Task"/>.</returns>
        private async Task SaveChanges()
        {
            if (await validation())
            {
                if (IsNewProduct && SampleHelper.IsAdmin())
                {
                    var result = await _productService.AddProducts(Product);

                    if (result)
                    {
                        await Application.Current.MainPage.DisplayAlert("", "Product Added Succesfully", "ok");

                        await Application.Current.MainPage.Navigation.PopAsync();
                    }
                }
                else if (!IsNewProduct)
                {
                    var result = await _productService.Updateproduct(Product);

                    if (result)
                    {
                        await Application.Current.MainPage.DisplayAlert("", "Product Updated Succesfully", "ok");

                        await Application.Current.MainPage.Navigation.PopAsync();
                    }
                }
            }
        }
コード例 #5
0
        public AttachmentSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            var modelNode = ContentManager.Load <ModelNode>("Marine/PlayerMarine");

            _meshNode = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            SampleHelper.EnablePerPixelLighting(_meshNode);
            GraphicsScreen.Scene.Children.Add(_meshNode);

            // Play a looping 'Idle' animation.
            var animations       = _meshNode.Mesh.Animations;
            var idleAnimation    = animations["Idle"];
            var loopingAnimation = new AnimationClip <SkeletonPose>(idleAnimation)
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };
            var animationController = AnimationService.StartAnimation(loopingAnimation, (IAnimatableProperty)_meshNode.SkeletonPose);

            animationController.UpdateAndApply();
            animationController.AutoRecycle();

            // Add weapon model to the scene graph under the node of the marine mesh.
            _weaponModelNode   = ContentManager.Load <ModelNode>("Marine/Weapon/WeaponMachineGun").Clone();
            _meshNode.Children = new SceneNodeCollection();
            _meshNode.Children.Add(_weaponModelNode);
        }
コード例 #6
0
        private void CreateGuiControls()
        {
            var panel = SampleFramework.AddOptions("Facial Animation");

            SampleHelper.AddCheckBox(panel, "Play animation", false, PlayAnimation);

            // Add UI controls for morph targets.
            var morphTargetsPanel = SampleHelper.AddGroupBox(panel, "Morph Targets");

            foreach (var morph in _sintel.MorphWeights)
            {
                string name = morph.Key;
                SampleHelper.AddSlider(morphTargetsPanel, name, null, 0, 1, 0, value => _sintel.MorphWeights[name] = value);
            }

            // Add controls for skeleton.
            var skeletonPanel = SampleHelper.AddGroupBox(panel, "Skeleton");

            SampleHelper.AddSlider(skeletonPanel, "Mouth-open", null, 0, 1, 0, value => InterpolatePose(_sintel, _mouthClosedPose, _mouthOpenPose, value));
            SampleHelper.AddCheckBox(skeletonPanel, "Draw skeleton", false, b => _drawSkeleton = b);

            _sliders = panel.GetDescendants().OfType <Slider>().ToArray();

            SampleFramework.ShowOptionsWindow("Facial Animation");
        }
コード例 #7
0
        public string CreateUseer(string name, string email, string mobile)
        {
            string password     = SampleHelper.GetRandomPassword();
            string hashPassword = string.Empty;


            using (MD5 md5Hash = MD5.Create())
            {
                hashPassword = SampleHelper.GetMd5Hash(md5Hash, password);
            }

            using (SqlConnection con = new SqlConnection(SampleHelper.GetConnectionString()))
            {
                string query = "INSERT INTO [OTCUsers] (UserName,Password,Name,Mobile,CreatedBy) values(@email,@password,@name,@mobile,101)";

                using (SqlCommand cmd = new SqlCommand(query))
                {
                    cmd.Connection = con;
                    con.Open();
                    cmd.Parameters.AddWithValue("@email", email);
                    cmd.Parameters.AddWithValue("@password", hashPassword);
                    cmd.Parameters.AddWithValue("@name", name);
                    cmd.Parameters.AddWithValue("@mobile", mobile);
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }

            SampleHelper.SendO365Mail(email, name, "myTest Account", string.Format("User Name :{0} password : {1}", email, password));

            return(string.Format("User created for {0}.", name));
        }
コード例 #8
0
        public ClosedFormIKSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            var modelNode = ContentManager.Load <ModelNode>("Dude/Dude");

            _meshNode           = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _meshNode.PoseLocal = new Pose(new Vector3F(0, 0, 0));
            SampleHelper.EnablePerPixelLighting(_meshNode);
            GraphicsScreen.Scene.Children.Add(_meshNode);

            // Create the IK solver. The ClosedFormIKSolver uses an analytic solution to compute
            // IK for arbitrary long bone chains. It does not support bone rotation limits.
            _ikSolver = new ClosedFormIKSolver
            {
                SkeletonPose = _meshNode.SkeletonPose,

                // The chain starts at the upper arm.
                RootBoneIndex = 13,

                // The chain ends at the hand bone.
                TipBoneIndex = 15,

                // The offset from the hand center to the hand origin.
                TipOffset = new Vector3F(0.1f, 0, 0),
            };
        }
コード例 #9
0
        void CreateHelper(ref Dictionary <char, SampleHelper> signDictionary, string input)
        {
            int seqnumber = 0;

            String[] singleOperations = input.Split(' ');
            for (int i = 0; i < singleOperations.Length; i++)
            {
                String[] parts = singleOperations[i].Split('_');

                if (parts[0].Equals("d"))
                {
                    //przucisk wcisniety
                    SampleHelper samHelp = new SampleHelper();
                    samHelp.dTime          = Int32.Parse(parts[2]);
                    samHelp.sign           = (char)Int32.Parse(parts[1]);
                    samHelp.sequenceNumber = seqnumber++;
                    signDictionary.Add(samHelp.sign, samHelp);
                }
                else if (parts[0].Equals("u"))
                {
                    //przycisk puszczony
                    //jesli to nie jest ENTER
                    if (parts[1] != "13")
                    {
                        signDictionary[(char)Int32.Parse(parts[1])].uTime = Int32.Parse(parts[2]);
                    }
                }
            }
        }
コード例 #10
0
        private void CreateGuiControls()
        {
            var panel = SampleFramework.AddOptions("Intersections");

            // ----- Light node controls
            SampleHelper.AddSlider(
                panel,
                "Max convexity",
                "F0",
                1,
                10,
                _maxConvexity,
                value => _maxConvexity = (int)value);

            SampleHelper.AddSlider(
                panel,
                "Downsample factor",
                "F2",
                1,
                4,
                _intersectionRenderer.DownsampleFactor,
                value => _intersectionRenderer.DownsampleFactor = value);

            SampleHelper.AddCheckBox(
                panel,
                "Use sissor test",
                _intersectionRenderer.EnableScissorTest,
                isChecked => _intersectionRenderer.EnableScissorTest = isChecked);

            SampleFramework.ShowOptionsWindow("Intersections");
        }
コード例 #11
0
        public BoneJiggleSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            var modelNode = ContentManager.Load <ModelNode>("Dude/Dude");

            _meshNode           = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _meshNode.PoseLocal = new Pose(new Vector3F(0, 0, 0), Matrix33F.CreateRotationY(ConstantsF.Pi));
            SampleHelper.EnablePerPixelLighting(_meshNode);
            GraphicsScreen.Scene.Children.Add(_meshNode);

            var animations    = _meshNode.Mesh.Animations;
            var walkAnimation = new AnimationClip <SkeletonPose>(animations.Values.First())
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };

            _walkAnimationController = AnimationService.StartAnimation(walkAnimation, (IAnimatableProperty)_meshNode.SkeletonPose);
            _walkAnimationController.AutoRecycle();

            // Create a BoneJiggler instance for the head bone (bone index 7).
            _boneJiggler = new BoneJiggler(_meshNode.SkeletonPose, 7, new Vector3F(1.1f, 0, 0))
            {
                Spring  = 100,
                Damping = 3,
            };
        }
コード例 #12
0
        private void CreateGuiControls()
        {
            var panel = SampleFramework.AddOptions("Terrain");

            SampleHelper.AddCheckBox(
                panel,
                "Enable per-pixel holes",
                false,
                isChecked => UpdateTerrainMaterial(isChecked));

            SampleHelper.AddSlider(
                panel,
                "Hole size",
                "F0",
                0,
                8,
                _holeSize,
                value =>
            {
                _holeSize = (int)value;
                UpdateHoleTexture();
            });

            SampleHelper.AddSlider(
                panel,
                "Hole threshold",
                null,
                0,
                1,
                _terrainObject.TerrainNode.HoleThreshold,
                value => _terrainObject.TerrainNode.HoleThreshold = value);

            SampleFramework.ShowOptionsWindow("Terrain");
        }
コード例 #13
0
ファイル: WindObject.cs プロジェクト: terrynoya/DigitalRune
        protected override void OnLoad()
        {
            // ----- Register info for "Wind" effect parameter.
            var graphicsService = _services.GetInstance <IGraphicsService>();

            // Tell the graphics service some information about effect parameters with
            // the name or semantic "Wind". The hint "Global" tells the engine that this
            // parameter is the same for all scene nodes.
            var defaultEffectInterpreter = graphicsService.EffectInterpreters.OfType <DefaultEffectInterpreter>().First();

            defaultEffectInterpreter.ParameterDescriptions.Add(
                "Wind",
                (parameter, i) => new EffectParameterDescription(parameter, "Wind", i, EffectParameterHint.Global));

            // Tell the engine how to create an effect parameter binding for "Wind" which
            // automatically sets the effect parameter value.
            var defaultEffectBinder = graphicsService.EffectBinders.OfType <DefaultEffectBinder>().First();

            defaultEffectBinder.Vector3Bindings.Add(
                "Wind",
                (effect, parameter, data) => new DelegateParameterBinding <Vector3>(effect, parameter,
                                                                                    (binding, context) => (Vector3)Wind)); // The delegate returns the Wind property.


            // ----- Add GUI controls to the Options window.
            var sampleFramework = _services.GetInstance <SampleFramework>();
            var optionsPanel    = sampleFramework.AddOptions("Game Objects");
            var panel           = SampleHelper.AddGroupBox(optionsPanel, "Wind");

            SampleHelper.AddSlider(
                panel,
                "Max speed",
                "F2",
                0,
                30,
                MaxSpeed,
                value => MaxSpeed = value,
                "0 = no wind, 30 = violent storm");

            SampleHelper.AddSlider(
                panel,
                "Speed variation",
                "F2",
                0,
                1,
                SpeedVariation,
                value => SpeedVariation = value,
                "0 wind blows only with max speed; > 0 wind vary the speed.");

            SampleHelper.AddSlider(
                panel,
                "Direction variation",
                "F2",
                0,
                1,
                DirectionVariation,
                value => DirectionVariation = value,
                "0 wind blows only in one direction; > 0 wind can change direction");
        }
コード例 #14
0
        public BindPoseSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            // Load dude model node.
            // This model uses the DigitalRune Model Processor. Several XML files (*.drmdl
            // and *.drmat) in the folder of dude.fbx define the materials and other properties.
            // The DigitalRune Model Processor also imports the animations of the dude model
            // and the *.drmdl can be used to specify how animations should be processed in
            // the content pipeline.
            // The *.drmat files define the used effects and effect parameters. The effects
            // must support mesh skinning.
            var sharedDudeModelNode = ContentManager.Load <ModelNode>("Dude/Dude");

            // Clone the dude model because objects returned by the ContentManager
            // are shared instances, and we do not want manipulate or animate this shared instance.
            var dudeModelNode = sharedDudeModelNode.Clone();

            // The loaded dude model is a scene graph which consists of a ModelNode
            // which has a single MeshNode as its child.
            _dudeMeshNode = (MeshNode)dudeModelNode.Children[0];
            // We could also get the MeshNode by name:
            _dudeMeshNode = (MeshNode)dudeModelNode.GetSceneNode("him");
            // Or using a more general LINQ query:
            _dudeMeshNode = dudeModelNode.GetSubtree().OfType <MeshNode>().First();

            // Set the world space position and orientation of the dude.
            _dudeMeshNode.PoseLocal = new Pose(new Vector3(-1f, 0, 0));

            // The imported Mesh of the Dude has a Skeleton, which defines the bone hierarchy.
            var skeleton = _dudeMeshNode.Mesh.Skeleton;

            // The imported MeshNode has a SkeletonPose, which defines the current animation pose
            // (transformations of the bones). The default skeleton pose is the bind pose
            // where all bone transformations are set to an identity transformation (no scale,
            // no rotation, no translation).
            var skeletonPose = _dudeMeshNode.SkeletonPose;

            // Load the marine model:
            var marineModelNode = ContentManager.Load <ModelNode>("Marine/PlayerMarine").Clone();

            _marineMeshNode           = marineModelNode.GetSubtree().OfType <MeshNode>().First();
            _marineMeshNode.PoseLocal = new Pose(new Vector3(1f, 0, 0));

            // Enable per-pixel lighting.
            SampleHelper.EnablePerPixelLighting(_dudeMeshNode);
            SampleHelper.EnablePerPixelLighting(_marineMeshNode);

            // Add the to the scene graph, so that they are drawn by the graphics screen.
            // We can add the ModelNodes directly to the scene.
            //GraphicsScreen.Scene.Children.Add(dudeModelNode);
            //GraphicsScreen.Scene.Children.Add(marineModelNode);
            // Alternatively, we can detach the MeshNodes from their parent nodes and
            // add them directly to the scene graph. The parent ModelNodes basically empty
            // nodes, which are only used to load and group other nodes.
            _dudeMeshNode.Parent.Children.Remove(_dudeMeshNode);
            GraphicsScreen.Scene.Children.Add(_dudeMeshNode);
            _marineMeshNode.Parent.Children.Remove(_marineMeshNode);
            GraphicsScreen.Scene.Children.Add(_marineMeshNode);
        }
コード例 #15
0
        public void Simple1Runtime()
        {
            string sources  = SampleHelper.GetCodeFromSample("simple1.lol");
            string baseline = SampleHelper.GetBaselineFromSample("simple1.lol");

            RuntimeTestHelper.TestExecuteSourcesNoInput(sources, baseline,
                                                        "Simple1Runtime", ExecuteMethod.ExternalProcess);
        }
コード例 #16
0
        public void VisibleKeywordRuntime()
        {
            string sources  = SampleHelper.GetCodeFromSample("visible.lol");
            string baseline = SampleHelper.GetBaselineFromSample("visible.lol");

            RuntimeTestHelper.TestExecuteSourcesNoInput(sources, baseline,
                                                        "VisibleKeywordRuntime", ExecuteMethod.ExternalProcess);
        }
コード例 #17
0
        public MixingSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            var modelNode = ContentManager.Load <ModelNode>("Marine/PlayerMarine");

            _meshNode = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            SampleHelper.EnablePerPixelLighting(_meshNode);
            GraphicsScreen.Scene.Children.Add(_meshNode);

            var animations = _meshNode.Mesh.Animations;

            _runAnimation = new AnimationClip <SkeletonPose>(animations["Run"])
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };
            _idleAnimation = new AnimationClip <SkeletonPose>(animations["Idle"])
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };

            // Create a 'Shoot' animation that only affects the upper body.
            var shootAnimation = animations["Shoot"];

            // The SkeletonKeyFrameAnimations allows to set a weight for each bone channel.
            // For the 'Shoot' animation, we set the weight to 0 for all bones that are
            // not descendants of the second spine bone (bone index 2). That means, the
            // animation affects only the upper body bones and is disabled on the lower
            // body bones.
            for (int i = 0; i < _meshNode.Mesh.Skeleton.NumberOfBones; i++)
            {
                if (!SkeletonHelper.IsAncestorOrSelf(_meshNode.SkeletonPose, 2, i))
                {
                    shootAnimation.SetWeight(i, 0);
                }
            }

            var loopedShootingAnimation = new AnimationClip <SkeletonPose>(shootAnimation)
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };

            // Start 'Idle' animation.
            _idleAnimationController = AnimationService.StartAnimation(_idleAnimation, (IAnimatableProperty)_meshNode.SkeletonPose);
            _idleAnimationController.AutoRecycle();

            // Start looping the 'Shoot' animation. We use a Compose transition. This will add the
            // 'Shoot' animation to the animation composition chain and keeping all other playing
            // animations.
            // The 'Idle' animation animates the whole skeleton. The 'Shoot' animation replaces
            // the 'Idle' animation on the bones of the upper body.
            AnimationService.StartAnimation(loopedShootingAnimation,
                                            (IAnimatableProperty)_meshNode.SkeletonPose,
                                            AnimationTransitions.Compose()
                                            ).AutoRecycle();
        }
コード例 #18
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
         SampleHelper.DisposeInstance();
     }
     base.Dispose(disposing);
 }
コード例 #19
0
        public CollisionDetectionOnlyRagdollSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            GraphicsScreen.DrawReticle = true;
            SetCamera(new Vector3F(0, 1, 6), 0, 0);

            // Add a game object which allows to shoot balls.
            _ballShooterObject = new BallShooterObject(Services);
            GameObjectService.Objects.Add(_ballShooterObject);

            var modelNode = ContentManager.Load <ModelNode>("Dude/Dude");

            _meshNode           = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _meshNode.PoseLocal = new Pose(new Vector3F(0, 0, 0), Matrix33F.CreateRotationY(ConstantsF.Pi));
            SampleHelper.EnablePerPixelLighting(_meshNode);
            GraphicsScreen.Scene.Children.Add(_meshNode);

            var animations       = _meshNode.Mesh.Animations;
            var loopingAnimation = new AnimationClip <SkeletonPose>(animations.Values.First())
            {
                LoopBehavior = LoopBehavior.Cycle,
                Duration     = TimeSpan.MaxValue,
            };

            AnimationService.StartAnimation(loopingAnimation, (IAnimatableProperty)_meshNode.SkeletonPose);

            // Create a ragdoll for the Dude model.
            _ragdoll = new Ragdoll();
            DudeRagdollCreator.Create(_meshNode.SkeletonPose, _ragdoll, Simulation, 0.571f);

            // Set the world space pose of the whole ragdoll.
            _ragdoll.Pose = _meshNode.PoseWorld;
            // And copy the bone poses of the current skeleton pose.
            _ragdoll.UpdateBodiesFromSkeleton(_meshNode.SkeletonPose);

            foreach (var body in _ragdoll.Bodies)
            {
                if (body != null)
                {
                    // Set all bodies to kinematic - they should not be affected by forces.
                    body.MotionType = MotionType.Kinematic;

                    // Disable collision response.
                    body.CollisionResponseEnabled = false;
                }
            }

            // In this sample, we do not need joints, limits or motors.
            _ragdoll.DisableJoints();
            _ragdoll.DisableLimits();
            _ragdoll.DisableMotors();

            // Add ragdoll rigid bodies to the simulation.
            _ragdoll.AddToSimulation(Simulation);
        }
コード例 #20
0
        public ActionResult Login(FormCollection formData)
        {
            OTCUsersModel userModel = new OTCUsersModel();
            string        username  = Convert.ToString(formData["UserLogin"]);
            string        password  = Convert.ToString(formData["UserPassword"]);
            string        userInfo  = userModel.ValidateUser(username, password);

            if (userInfo.Trim().Length > 0)
            {
                if (userInfo == "X")
                {
                    ViewBag.Message = "Your account got locked. Please contact admin!";
                }
                else if (userInfo == "O")
                {
                    ViewBag.Message = "Invalid User Name or Password.";
                }
                else if (userInfo.Trim().Length > 10) //Asume valid userInfo will have more than 10 lenth
                {
                    var UserDetails = userInfo.Split('|');

                    CustomPrincipalSerializeModel serializeModel = new CustomPrincipalSerializeModel();
                    serializeModel.UserID   = Convert.ToInt32(UserDetails[0]);
                    serializeModel.Name     = UserDetails[1];
                    serializeModel.UserName = UserDetails[2];
                    serializeModel.Role     = UserDetails[3];

                    string userData = JsonConvert.SerializeObject(serializeModel);

                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                        1,
                        UserDetails[0],
                        DateTime.Now,
                        DateTime.Now.AddMinutes(15),
                        false,
                        userData);

                    string     encTicket = FormsAuthentication.Encrypt(authTicket);
                    HttpCookie faCookie  = new HttpCookie(SampleHelper.GetAuthCookieName(), encTicket);
                    Response.Cookies.Add(faCookie);

                    if (serializeModel.Role == "User")
                    {
                        return(RedirectToAction("Index", "Student"));
                    }
                    else if (serializeModel.Role == "Admin")
                    {
                        return(RedirectToAction("Index", "Admin"));
                        //return RedirectToAction("NewUser", "OTC");
                    }
                }
            }
            //return RedirectToAction("Index", "Login");
            return(Login());
        }
コード例 #21
0
        private void InitializeModelAndRagdoll()
        {
            // Load Dude model.
            var contentManager = Services.GetInstance <ContentManager>();
            var dudeModelNode  = contentManager.Load <ModelNode>("Dude/Dude");

            _meshNode           = dudeModelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _meshNode.PoseLocal = new Pose(new Vector3(0, 0, 0));
            SampleHelper.EnablePerPixelLighting(_meshNode);
            GraphicsScreen.Scene.Children.Add(_meshNode);

            // Create a ragdoll for the Dude model.
            _ragdoll = new Ragdoll();
            DudeRagdollCreator.Create(_meshNode.SkeletonPose, _ragdoll, Simulation, 0.571f);

            // Set the world space pose of the whole ragdoll. And copy the bone poses of the
            // current skeleton pose.
            _ragdoll.Pose = _meshNode.PoseWorld;
            _ragdoll.UpdateBodiesFromSkeleton(_meshNode.SkeletonPose);

            // Disable sleeping.
            foreach (var body in _ragdoll.Bodies)
            {
                if (body != null)
                {
                    body.CanSleep = false;
                    //body.CollisionResponseEnabled = false;
                }
            }

            // The pelvis bone (index 1) is updated directly from the Kinect hip center.
            _ragdoll.Bodies[1].MotionType = MotionType.Kinematic;

            // In this sample we use a passive ragdoll where we need joints to hold the
            // limbs together and limits to restrict angular movement.
            _ragdoll.EnableJoints();
            _ragdoll.EnableLimits();

            // Set all motors to constraint motors that only use damping. This adds a damping
            // effect to all ragdoll limbs.
            foreach (RagdollMotor motor in _ragdoll.Motors)
            {
                if (motor != null)
                {
                    motor.Mode = RagdollMotorMode.Constraint;
                    motor.ConstraintDamping = 100;
                    motor.ConstraintSpring  = 0;
                }
            }
            _ragdoll.EnableMotors();

            // Add rigid bodies and the constraints of the ragdoll to the simulation.
            _ragdoll.AddToSimulation(Simulation);
        }
コード例 #22
0
        public SkeletonManipulationSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            var modelNode = ContentManager.Load <ModelNode>("Dude/Dude");

            _meshNode           = modelNode.GetSubtree().OfType <MeshNode>().First().Clone();
            _meshNode.PoseLocal = new Pose(new Vector3F(-0.5f, 0, 0));
            SampleHelper.EnablePerPixelLighting(_meshNode);

            GraphicsScreen.Scene.Children.Add(_meshNode);
        }
コード例 #23
0
        public SamplesConfiguration()
        {
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
#if STORE_SAMPLE
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.GettingStarted_WinRT).AssemblyQualifiedName, Product = "Schedule", Header = "GettingStarted", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = true
                });
#else
                SampleHelper.SetTagsForProduct("Schedule", Tags.None);
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.GettingStarted_WinRT).AssemblyQualifiedName, Product = "Schedule", Header = "GettingStarted", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = true
                });
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.CustomizationDemo_WinRT).AssemblyQualifiedName, Product = "Schedule", Header = "Customization", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = false
                });
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.RecurrenceAppointment_WinRT).AssemblyQualifiedName, Product = "Schedule", Header = "Recurrence Appointments", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = false
                });
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.ResourceDemo_WinRT).AssemblyQualifiedName, Product = "Schedule", Header = "Resource", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = false
                });
#endif
            }
            else
            {
#if STORE_SAMPLE
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.GettingStarted).AssemblyQualifiedName, Product = "Schedule", ProductIcons = "Icons/Schedule.png", Header = "GettingStarted", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = true
                });
#else
                SampleHelper.SetTagsForProduct("Schedule", Tags.None);
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.GettingStarted).AssemblyQualifiedName, Product = "Schedule", Header = "GettingStarted", ProductIcons = "Icons/Schedule.png", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = true
                });
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.CustomizationDemo).AssemblyQualifiedName, Product = "Schedule", Header = "Customization", ProductIcons = "Icons/Schedule.png", Tag = Tags.None, Category = Categories.DataVisualization, HasOptions = false
                });
                SampleHelper.SampleViews.Add(new SampleInfo()
                {
                    SampleView = typeof(ScheduleUWP_Samples.RecurrenceAppointment).AssemblyQualifiedName, Product = "Schedule", Header = "Recurrence Appointments", Tag = Tags.None, ProductIcons = "Icons/Schedule.png", Category = Categories.DataVisualization, HasOptions = false
                });
#endif
            }
        }
コード例 #24
0
        private void CreateGuiControls()
        {
            var panel = SampleFramework.AddOptions("Terrain");

            SampleHelper.AddCheckBox(
                panel,
                "Enable parallax occlusion mapping",
                true,
                isChecked => UpdateTerrainMaterial(isChecked));

            SampleFramework.ShowOptionsWindow("Terrain");
        }
コード例 #25
0
        private void CreateGuiControls()
        {
            var panel = SampleFramework.AddOptions("Shadows");

            SampleHelper.AddCheckBox(
                panel,
                "Enable shadow map caching",
                _enableShadowMapCaching,
                isChecked => _enableShadowMapCaching = isChecked);

            SampleFramework.ShowOptionsWindow("Shadows");
        }
コード例 #26
0
        private void WriteNote(WaveStreamWriter streamWriter, string name, int durationBefore, int duration, int amplitude)
        {
            Tone tone = Tones.Item(name);

            if (durationBefore > 0)
            {
                streamWriter.WriteSilenceChunk(durationBefore);
            }

            streamWriter.WriteChunk(SampleHelper.MakeBassChunk2(duration, tone.Frequency, amplitude, 2));
            //streamWriter.WriteOscillator(new Oscillator(WaveType.Sine, duration, tone.Frequency, amplitude, 2));
        }
コード例 #27
0
ファイル: Default.aspx.cs プロジェクト: nunezger/berkeleyshoe
 protected void YesSampleButton_Click(object sender, EventArgs e)
 {
     if (!this.Context.User.Identity.IsAuthenticated)
     {
         FormsAuthentication.RedirectToLoginPage();
     }
     else
     {
         this.Response.SetCookie(new HttpCookie("UseSampleData", true.ToString()));
         SampleHelper.AddSampleData();
         this.Response.Redirect(this.Request.RawUrl);
     }
 }
コード例 #28
0
        public void Test4()
        {
            var data = new SamplePostParameterViewModel
            {
                Numbers = new List <int>
                {
                    5, 4, 3, 1, 2,
                },
                Number = 10,
            };
            var result = SampleHelper.Exist(data);

            Assert.False(result);
        }
コード例 #29
0
 public static object GetSample(string styleId)
 {
     using (SunginDataContext sc = new SunginDataContext())
     {
         ISampleBaseInfo s = sc.SampleBaseInfos.SingleOrDefault(p => p.StyleId == styleId);
         if (s != null)
         {
             return(SampleHelper.GetEditObj(s));
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #30
0
        public string GenerateMD5Data(FormCollection formData)
        {
            string userName     = string.Empty;
            string password     = String.Empty;
            string hashPassword = string.Empty;

            userName = Convert.ToString(formData["UserName"]);
            password = Convert.ToString(formData["Password"]);

            using (MD5 md5Hash = MD5.Create())
            {
                hashPassword = SampleHelper.GetMd5Hash(md5Hash, userName);
            }
            return(hashPassword);
        }