public StaticPlanetObject(Vector3 position, float size, float rotSpeed = 0.003f)
            : base(position, size)
        {
            var rand = new Random();
            _model = ModelLoader.LoadModel<LightShaderParameters>("sphere.bin", "Planets/planet" + rand.Next(1,4));
            _model.InitStandardLights();

            _rotationDelta = new Vector3(rand.NextDouble(-rotSpeed, rotSpeed), rand.NextDouble(-rotSpeed, rotSpeed), rand.NextDouble(-rotSpeed, rotSpeed));
        }
        public StaticHiResObject(Vector3 position, String texture, float size, float rotSpeed, Vector3 rotationAxis)
            : base(position, size)
        {
            var rand = new Random();
            _model = ModelLoader.LoadModel<LightShaderParameters>("planet.bin", texture);
            _model.InitStandardLights();

            _rotationDelta = Matrix.CreateFromAxisAngle(rotationAxis, rotSpeed);
        }
        public OrbitingPlanetObject(Orbit orbit, float size)
            : base(orbit, size)
        {
            var rand = new Random();
            _model = ModelLoader.LoadModel<LightShaderParameters>("sphere.bin", "Planets/planet" + rand.Next(1,4));
            _model.InitStandardLights();

            _rotationDelta = new Vector3((float) (rand.NextDouble() * 0.06 - 0.03), (float) (rand.NextDouble() * 0.06 - 0.03), (float) (rand.NextDouble() * 0.06 - 0.03));
            _rotationDelta /= 10;
        }
        public void Given_any_INPC_implementation_converted_to_NC_When_I_change_converted_property_Then_converted_value_should_change()
        {
            // Arrange
            var model = new CustomModel();
            var count = model.GetNotifyChangeOfProperty(x => x.Count);

            // Act
            model.Count = 1;

            // Assert
            count.Value.Should().Be(1);
        }
        public void Given_any_INPC_implementation_converted_to_NC_When_I_change_not_converted_property_Then_NC_should_not_raise_PC()
        {
            // Arrange
            var model = new CustomModel();
            var count = model.GetNotifyChangeOfProperty(x => x.Count);
            var raised = false;
            count.PropertyChanged += (sender, args) => raised = true;

            // Act
            model.Message = "hey";

            // Assert
            raised.Should().BeFalse();
        }
        public StarObject(Vector3 position, float size, float rotSpeed = 0.006f, float density = 0.6f, float decay = 0.92f, float weight = 0.2f, int steps = 50)
            : base(position, size)
        {
            _density = density;
            _decay = decay;
            _weight = weight;
            _steps = steps;

            model = ModelLoader.LoadModel<TextureShaderParameters>("sphere.bin", "StarTexture");

            var rand = new Random();
            _rotationDelta = new Vector3(rand.NextDouble(-rotSpeed, rotSpeed), rand.NextDouble(-rotSpeed, rotSpeed), rand.NextDouble(-rotSpeed, rotSpeed));

            _postProcessTarget = new RenderTarget2D(YND.GraphicsDevice, YND.GraphicsDevice.Viewport.Width, YND.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8,
                                                    1, RenderTargetUsage.PreserveContents);
            _postProcess = YND.ContentManager.Load<Effect>("Shaders/PostProcess");
        }
 public IViewComponentResult Invoke(CustomModel model)
 {
     this.data.Models.Add(model);
     return this.View();
 }
 public IActionResult Create(CustomModel model)
 {
     this.data.Models.Add(model);
     return this.Ok();
 }
 public StaticObject(String modelName, String textureName)
 {
     _model = ModelLoader.LoadModel<TextureShaderParameters>(modelName, textureName);
 }
Exemple #10
0
        public ActionResult Create(CustomModel.Contact.ContactCustome cc)
        {
            ContactInformation ContactInfo = cc.ContactInformation;
            ContactDetails PostalAddress = cc.PostalAddress;
            ContactDetails PhysicalAddress = cc.PhysicalAddress;
            Person PrimaryPerson = cc.PrimaryPerson;
            List<Person> Peoples = cc.Person;
            FinancialDetails FinancialDetail = cc.FinancialDetails;
            Notes Note = cc.Notes;
            TelePhone Telephone = cc.TelePhone;

            try
            {
                var tt = HttpContext.User.Identity.Name;
                var user = uService.GetSingleUserByEmail(tt);
                var logObj = _companyViewLog.GetLastViewCompanyByUserId(user.Id);
                int companyId = 0;
                if (logObj != null)
                {
                    companyId = (int)logObj.CompanyId;
                }
                var activatedCompany = cService.GetSingleCompany(companyId);

                ContactInfo.CompanyId = companyId;
                ContactInfo.CreateBy = user.Id;
                ContactInfo.UpdateBy = user.Id;
                ContactInfo.CreateDate = DateTime.Now;
                ContactInfo.UpdateDate = DateTime.Now;
                ContactInfo.ContactType = EnumContactType.All;

                //if (!(contactDetailsService.CreateContactDetails(PostalAddress) && contactDetailsService.CreateContactDetails(PhysicalAddress)))
                //    TempData.Add("errMsg", "Postal Address and Physical Address not set properly.");
                //ContactInfo.PostalAddId = PostalAddress.Id;
                //ContactInfo.PhysicalAddId = PhysicalAddress.Id;

                if (contactInfoService.CreateContInfo(ContactInfo))
                {

                    PostalAddress.ContactInfoId = ContactInfo.Id;
                    PhysicalAddress.ContactInfoId = ContactInfo.Id;
                    if (!(contactDetailsService.CreateContactDetails(PostalAddress) && contactDetailsService.CreateContactDetails(PhysicalAddress)))
                        TempData.Add("errMsg", "Postal Address and Physical Address not set properly.");
                    PrimaryPerson.ContactInfoId = ContactInfo.Id;
                    personService.CreatePersons(PrimaryPerson);

                    foreach (var people in Peoples)
                    {
                        if (people.Email != null)
                        {
                            people.ContactInfoId = ContactInfo.Id;
                            personService.CreatePersons(people);
                        }

                    }

                    FinancialDetail.ContactInfoId = ContactInfo.Id;
                    financialDetailsService.CreateFinancialDetails(FinancialDetail);
                    Note.UserId = user.Id;
                    Note.Date = DateTime.Now;
                    Note.ContactInfoId = ContactInfo.Id;
                    noteService.CreateNote(Note);
                    Telephone.ContactInfoId = ContactInfo.Id;
                    telephoneService.CreateTelePhone(Telephone);

                    return RedirectToAction("FilterContact");
                }
                else
                {
                    TempData.Add("errMsg", "Please FillUp Every Field");
                    return RedirectToAction("Create");
                }
            }
            catch (Exception ex)
            {
                return Content("Somthing Wrong");
            }
        }
        private static void CopyAssetsToFileFolder(Window callingWindow)
        {
            string targetDirectory = FileManager.GetDirectory(mLastFileName);

            CopyTexturesMultiButtonMessageBox mbmb = ((CopyTexturesMultiButtonMessageBox)callingWindow);
            List <string> filesToMakeDotDot        = mbmb.FilesMarkedDotDotRelative;

            #region Copy Texture2Ds and replace references

            foreach (Texture2D texture in mTexturesNotRelative)
            {
                if (filesToMakeDotDot == null || !filesToMakeDotDot.Contains(texture.Name))
                {
                    if (!System.IO.File.Exists(targetDirectory + FileManager.RemovePath(texture.SourceFile())))
                    {
                        System.IO.File.Copy(texture.SourceFile(), targetDirectory + FileManager.RemovePath(texture.SourceFile()));
                    }

                    mReplaceTextureDelegate(texture,
                                            FlatRedBallServices.Load <Texture2D>(targetDirectory + FileManager.RemovePath(texture.SourceFile()),
                                                                                 mContentManager));
                }
            }
            #endregion

            #region Copy AnimationChainLists and replace references

            foreach (AnimationChainList animationChainList in mAnimationChainListsNotRelative)
            {
                if (filesToMakeDotDot == null || !filesToMakeDotDot.Contains(animationChainList.Name))
                {
                    if (!System.IO.File.Exists(targetDirectory + FileManager.RemovePath(animationChainList.Name)))
                    {
                        System.IO.File.Copy(animationChainList.Name, targetDirectory + FileManager.RemovePath(animationChainList.Name));
                    }

                    animationChainList.Name = targetDirectory + FileManager.RemovePath(animationChainList.Name);
                }
            }

            #endregion

            #region Copy Fnt Files and replace references

            foreach (string oldFnt in mFntFilesNotRelative)
            {
                if (filesToMakeDotDot == null || !filesToMakeDotDot.Contains(oldFnt))
                {
                    if (!System.IO.File.Exists(targetDirectory + FileManager.RemovePath(oldFnt)))
                    {
                        System.IO.File.Copy(
                            oldFnt,
                            targetDirectory + FileManager.RemovePath(oldFnt));

                        foreach (Text text in SceneSaving.Texts)
                        {
                            if (text.Font.FontFile == oldFnt)
                            {
                                // A little inefficient because it hits the file for the same information.
                                // Revisit this if it's a performance problem.
                                text.Font.SetFontPatternFromFile(targetDirectory + FileManager.RemovePath(oldFnt));
                            }
                        }
                    }
                }
            }


            #endregion

            #region Copy model files and replace references

            foreach (string modelFile in mModelsNotRelative)
            {
                if (filesToMakeDotDot == null || !filesToMakeDotDot.Contains(modelFile))
                {
                    if (!System.IO.File.Exists(targetDirectory + FileManager.RemovePath(modelFile)))
                    {
                        System.IO.File.Copy(modelFile, targetDirectory + FileManager.RemovePath(modelFile));

#if FRB_XNA
                        if (FileManager.GetExtension(modelFile) == "wme")
                        {
                            string modelDirectory;

                            if (FileManager.IsRelative(modelFile))
                            {
                                modelDirectory = FileManager.GetDirectory(FileManager.MakeAbsolute(modelFile));
                            }
                            else
                            {
                                modelDirectory = FileManager.GetDirectory(modelFile);
                            }

                            CustomModel customModel = FlatRedBallServices.Load <CustomModel>(modelFile, mContentManager);

                            // copy files that this model references
                            foreach (string referencedFile in customModel.ReferencedFiles)
                            {
                                string fullFile = modelDirectory + referencedFile;

                                if (!System.IO.File.Exists(targetDirectory + referencedFile))
                                {
                                    System.IO.File.Copy(fullFile, targetDirectory + referencedFile);
                                }
                            }
                        }
#endif
                    }

                    // Vic says on 10/7/2010
                    // Right now we do a full file replacement.  We *could* just change the file names instead of loading from file,
                    // but I'm not sure if we'll need to do an actual replacement at some point in the future...this seems more bugproof
                    ModelManager.ReplaceSourceModel(modelFile, targetDirectory + FileManager.RemovePath(modelFile), mContentManager);
                }
            }

            #endregion

            #region Copy Extra Files

            for (int i = 0; i < mExtraFilesToCopy.Count; i++)
            {
                try
                {
#if !FRB_MDX
                    string oldFileName = mExtraFilesToCopy[i];
                    string newFileName = targetDirectory + FileManager.RemovePath(mExtraFilesToCopy[i]);

                    System.IO.File.Copy(
                        oldFileName,
                        newFileName, true);

                    ModelManager.ReplaceFileReference(oldFileName, newFileName);
#endif
                }
                catch (System.IO.IOException e)
                {
                    System.Windows.Forms.MessageBox.Show("Could not copy to " + targetDirectory + FileManager.RemovePath(mExtraFilesToCopy[i]));
                }
                // Don't do anything else with these files
            }


            #endregion

            mSaveDelegate(mLastFileName, mbmb.AreAssetsRelative);
        }
Exemple #12
0
        public async Task <IActionResult> Index(string user)
        {
            var     books       = _bookService.GetList();
            var     userId      = 0;
            AppUser currentUser = new AppUser();

            Models.Member member      = new Models.Member();
            CustomModel   model       = new CustomModel();
            AppUser       profileUser = new AppUser();

            TempData["Active"] = "profile";
            TempData["sa"]     = TempData["deneme"];
            var userprofile = TempData["currentUser"];
            var appUser     = await _userManager.FindByNameAsync(User.Identity.Name);

            if (userprofile == null)
            {
                profileUser = null;

                member.Id          = appUser.Id;
                member.FirstName   = appUser.FirstName;
                member.LastName    = appUser.LastName;
                member.Email       = appUser.Email;
                member.UserName    = appUser.UserName;
                member.Description = appUser.Description;
                member.Picture     = appUser.ProfileImageFile;
                model.Member       = member;
                userId             = appUser.Id;
            }
            else
            {
                profileUser = await _userManager.FindByNameAsync(userprofile.ToString());

                member.Id          = profileUser.Id;
                member.FirstName   = profileUser.FirstName;
                member.LastName    = profileUser.LastName;
                member.Email       = profileUser.Email;
                member.UserName    = profileUser.UserName;
                member.Description = profileUser.Description;
                member.Picture     = profileUser.ProfileImageFile;
                model.Member       = member;
                userId             = profileUser.Id;
            }

            if (user == null)
            {
                currentUser        = null;
                member.Id          = appUser.Id;
                member.FirstName   = appUser.FirstName;
                member.LastName    = appUser.LastName;
                member.Email       = appUser.Email;
                member.UserName    = appUser.UserName;
                member.Description = appUser.Description;
                member.Picture     = appUser.ProfileImageFile;
                model.Member       = member;
                userId             = appUser.Id;
            }

            else
            {
                currentUser = await _userManager.FindByNameAsync(user);

                member.Id          = currentUser.Id;
                member.FirstName   = currentUser.FirstName;
                member.LastName    = currentUser.LastName;
                member.Email       = currentUser.Email;
                member.UserName    = currentUser.UserName;
                member.Description = currentUser.Description;
                member.Picture     = currentUser.ProfileImageFile;
                model.Member       = member;
                userId             = currentUser.Id;
            }



            if (currentUser != null)
            {
                if (appUser.UserName != currentUser.UserName)
                {
                    model.IsProfile = false;
                }
                else
                {
                    model.IsProfile = true;
                }
            }

            if (profileUser != null)
            {
                if (appUser.UserName == profileUser.UserName)
                {
                    model.IsProfile = true;
                }
                else
                {
                    model.IsProfile = false;
                }
            }



            List <Review> reviews = new List <Review>();
            List <Entities.Concrete.Quotation> quotations = new List <Entities.Concrete.Quotation>();

            var userbooks = _bookAppUserService.GetByAppUserId(userId);

            foreach (var book in userbooks)
            {
                if (book.Reviews.Count > 0)
                {
                    reviews.AddRange(book.Reviews);
                }

                if (book.Quotations.Count > 0)
                {
                    quotations.AddRange(book.Quotations);
                }
            }

            quotations.ShuffleMethod();
            reviews.ShuffleMethod();
            ViewBag.Comment    = reviews;
            ViewBag.Quotations = quotations;



            return(View(model));
        }
        public static IObject[] CreateOBJ(IWorld world, GraphicFactory factory, GraphicInfo ginfo, ObjectInformation[] mi)
        {
            IModelo model = new CustomModel(factory, mi);

            MaterialDescription material;

            if (mi[0].staticfriction == -1 || mi[0].dinamicfriction == -1 || mi[0].ellasticity == -1)
            {
                material = MaterialDescription.DefaultBepuMaterial();
            }
            else
            {
                material = new MaterialDescription(mi[0].staticfriction, mi[0].dinamicfriction, mi[0].ellasticity);
            }

            IPhysicObject po;

            bool massflag = false;

            if (mi[0].mass == 0)
            {
                massflag   = true;
                mi[0].mass = 0.5f;
            }

            BatchInformation binf = model.GetBatchInformation(0)[0];

            BoundingBox bb;

            switch (mi[0].collisionType)
            {
            case "Ghost":


                po = new GhostObject(mi[0].position, Matrix.CreateFromQuaternion(mi[0].rotation), mi[0].scale);

                break;

            case "Cylinder":

                binf.ModelLocalTransformation = Matrix.Identity;
                bb = ModelBuilderHelper.CreateBoundingBoxFromModel(binf);
                Vector3 len = bb.Max - bb.Min;

                po = new CylinderObject(mi[0].position, len.Y, len.X / 2, Vector3.Up, mi[0].mass, Matrix.CreateFromQuaternion(mi[0].rotation), material);

                break;


            case "Sphere":
                binf.ModelLocalTransformation = Matrix.Identity;
                po          = new SphereObject(mi[0].position, model.GetModelRadius(), mi[0].mass, mi[0].scale.X, material);
                po.Rotation = Matrix.CreateFromQuaternion(mi[0].rotation);

                break;


            case "Box":

                bb = ModelBuilderHelper.CreateBoundingBoxFromModel(binf);

                len = bb.Max - bb.Min;

                po = new BoxObject(mi[0].position, len.X, len.Y, len.Z, mi[0].mass, mi[0].scale, Matrix.CreateFromQuaternion(mi[0].rotation), material);

                break;

            case "Water":
                po = new GhostObject(mi[0].position, Matrix.CreateFromQuaternion(mi[0].rotation), mi[0].scale);
                break;

            case "TriangleMesh":
            default:
                po = new TriangleMeshObject(model, Vector3.Zero, Matrix.Identity, new Vector3(1), material);
                break;
            }

            po.isMotionLess = massflag;

            IShader shader = null;

#if !REACH && !WINDOWS_PHONE
            if (mi[0].HasTexture(TextureType.ENVIRONMENT))
            {
                shader = new DeferredEMReflectiveShader();
                (shader as DeferredEMReflectiveShader).TextureCube = mi[0].textureInformation.getCubeTexture(TextureType.ENVIRONMENT);
            }
            else if (mi[0].collisionType != null && mi[0].collisionType.Contains("Water"))
            {
                Vector3 position = (Vector3)(mi[0].extra["position"]);
                var     width    = (mi[0].extra["width"]);
                var     height   = (mi[0].extra["length"]);
                shader = new DeferredWaterCompleteShader((int)width, (int)height, new Plane(position.X, position.Y, position.Z, 1), 10.0f);
            }

            else
            {
                shader = new DeferredCustomShader(mi[0].HasTexture(TextureType.GLOW), mi[0].HasTexture(TextureType.BUMP), mi[0].HasTexture(TextureType.SPECULAR), mi[0].HasTexture(TextureType.PARALAX));
            }

            DeferredMaterial dm = new DeferredMaterial(shader);
#else
            shader = new ForwardXNABasicShader();
            ForwardMaterial dm = new ForwardMaterial(shader);
#endif
            IObject ob = new IObject(dm, model, po);

            ob.Name = mi[0].modelName;

            return(new IObject[] { ob });
        }
 public ActionResult Save(CustomModel model)
 {
     return(Json(bll.Save(model), JsonRequestBehavior.AllowGet));
 }
Exemple #15
0
 public void AddToDictionary(Doru_Type type, CustomModel cm)
 {
     customModelDictionary[type] = cm;
     //Debug.Log("Added to Dictionary [Key]: " + type + " [Value]: " + customModelDictionary[type].name);
 }
Exemple #16
0
        public ActionResult CustomBinder(CustomModel customModel)
        {
            HttpContext.Items.Add(IntegrationTestTab.Expected, customModel.ToString());

            return(View(model: customModel));
        }