Ejemplo n.º 1
0
        public static MvcHtmlString MenuTcCenter()
        {
            var IdTrainingCenter = TCHelper.GetCurrentTCName();

            TrainingCentersCRM.Models.TrainingCentersDBEntities db1 = new Models.TrainingCentersDBEntities();
            return(new MvcHtmlString(TrainingCentersMenu(0, db1, IdTrainingCenter)));
        }
Ejemplo n.º 2
0
        // GET: Articles
        public ActionResult Index(int?id, bool?partial, int?page, int?top)
        {
            IQueryable <Article> result = db.Articles.OrderByDescending(a => a.PublishDate);

            if (TCHelper.GetCurrentTCName() != "" && TCHelper.GetCurrentTCName() != "empty")
            {
                ViewBag.TrainingCenter = TCHelper.GetCurrentTc(db);
                result = result.Where(a => a.TrainingCenter.Id == this.trainingCenter.Id);
            }
            if (id != null)
            {
                ViewBag.Type = id;
                result       = result.Where(a => a.Type == (Article.ArticleType)id);
            }

            //int pageSize = page == null ? Int32.MaxValue : (Int32)HttpContext.Application["PageSize"];
            int pageSize   = top != null ? (int)top : (Int32)HttpContext.Application["PageSize"];
            int pageNumber = (page ?? 1);
            var pagedRes   = result.ToPagedList(pageNumber, pageSize);

            if (partial != null && partial == true)
            {
                return(PartialView(pagedRes));
            }
            return(View(pagedRes));
        }
Ejemplo n.º 3
0
 public ActionResult Index()
 {
     //db.TrainingCenters.Add(new TrainingCenter { Url = "empty" });
     //db.SaveChanges();
     ViewBag.TrainingCenter = TCHelper.GetCurrentTc();
     return(View());
 }
Ejemplo n.º 4
0
    public void UpdateCompositeGradient()
    {
        if (m_gradientTexture == null)
        {
            return;
        }

        TCHelper.TextureFromGradient(compositeGradient, m_gradientTexture, tint, 0.0f);
    }
Ejemplo n.º 5
0
        public static MvcHtmlString Menu()
        {
            var IdTrainingCenter = TCHelper.GetCurrentTCName();

            // TrainingCentersCRM.Models.ApplicationDbContext db = new Models.ApplicationDbContext();
            TrainingCentersCRM.Models.TrainingCentersDBEntities db1 = new Models.TrainingCentersDBEntities();

            //Rec_menu(0, db1);
            return(new MvcHtmlString(Rec_menu(0, db1, IdTrainingCenter)));
        }
Ejemplo n.º 6
0
        internal void Dispatch()
        {
            if (useBoidsFlocking)
            {
                if (m_boidsFlock == null)
                {
                    CreateBoids();
                }

                m_boidsFlock.UpdateBoids(SystemComp.transform);
            }

            if (MaxForces == 0)
            {
                return;
            }

            if (m_forcesCount[0] > 0)
            {
                m_forcesBuffer[0].SetData(m_forcesStruct[0]);
                ComputeShader.SetBuffer(UpdateForcesKernel, SID._Forces, m_forcesBuffer[0]);
                Manager.BindPariclesToKernel(ComputeShader, UpdateForcesKernel);
                ComputeShader.Dispatch(UpdateForcesKernel, Manager.DispatchCount, m_forcesCount[0], 1);
            }

            if (m_forcesCount[1] > 0)
            {
                m_forcesBuffer[1].SetData(m_forcesStruct[1]);
                ComputeShader.SetBuffer(UpdateTurbulenceForcesKernel, SID._TurbulenceForces, m_forcesBuffer[1]);

                for (int k = 0; k < m_forcesCount[1]; ++k)
                {
                    TCForce force = m_forcesReference[1][k];

                    if (force.CurrentForceVolume == null)
                    {
                        continue;
                    }

                    ComputeShader.SetTexture(UpdateTurbulenceForcesKernel, SID._TurbulenceTexture, force.CurrentForceVolume);

                    Matrix4x4 rotation = Matrix4x4.TRS(Vector3.zero, force.transform.rotation, Vector3.one);
                    TCHelper.SetMatrix(ComputeShader, SID._TurbulenceRotation, rotation);
                    TCHelper.SetMatrix(ComputeShader, SID._TurbulenceRotationInv, rotation.inverse);

                    //TODO: Just bind one force?
                    ComputeShader.SetInt("turbulenceKernelOffset", k);

                    Manager.BindPariclesToKernel(ComputeShader, UpdateTurbulenceForcesKernel);
                    ComputeShader.Dispatch(UpdateTurbulenceForcesKernel, Manager.DispatchCount, 1, 1);
                }
            }
        }
Ejemplo n.º 7
0
        void UpdateMatrix(ParticleEmitterShape emitShape, Transform trans)
        {
            var localScale = trans.localScale;

            Profiler.BeginSample("Set matrices");
            Matrix4x4 id = Matrix4x4.identity;

            switch (Manager.SimulationSpace)
            {
            case Space.World:
                var rot = trans.rotation;
                if (m_lastRot != rot || m_lastScale != localScale)
                {
                    m_emitMatrix         = Matrix4x4.TRS(Vector3.zero, rot, localScale);
                    m_emitRotationMatrix = Matrix4x4.TRS(Vector3.zero, rot, Vector3.one);
                    m_lastRot            = rot;
                    m_lastScale          = localScale;
                }

                TCHelper.SetMatrix(ComputeShader, SID._EmitterMatrix, m_emitMatrix);
                TCHelper.SetMatrix(ComputeShader, SID._EmitterRotationMatrix, m_emitRotationMatrix);

                break;

            case Space.Local:
                TCHelper.SetMatrix(ComputeShader, SID._EmitterMatrix, Matrix4x4.TRS(Vector3.zero, Quaternion.identity, localScale));
                TCHelper.SetMatrix(ComputeShader, SID._EmitterRotationMatrix, id);
                break;

            case Space.LocalWithScale:
                TCHelper.SetMatrix(ComputeShader, SID._EmitterMatrix, id);
                TCHelper.SetMatrix(ComputeShader, SID._EmitterRotationMatrix, id);
                break;

            case Space.Parent:
                if (trans.parent != null)
                {
                    var rot2 = trans.localRotation;
                    TCHelper.SetMatrix(ComputeShader, SID._EmitterMatrix, Matrix4x4.TRS(Vector3.zero, rot2, localScale));
                    TCHelper.SetMatrix(ComputeShader, SID._EmitterRotationMatrix, Matrix4x4.TRS(Vector3.zero, rot2, Vector3.one));
                }
                break;
            }

            if (emitShape.startDirectionType == StartDirection.Vector)
            {
                TCHelper.SetMatrix(ComputeShader, SID._EmitterStartRotationMatrix,
                                   Matrix4x4.TRS(Vector3.zero, Quaternion.FromToRotation(Vector3.forward, emitShape.startDirectionVector), Vector3.one));
            }

            Profiler.EndSample();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Update the colour over lifetime texture. Should be called whenever changing the colour over lifetime gradient
 /// </summary>
 public void UpdateColourOverLifetime()
 {
     TCHelper.TextureFromGradient(ColourOverLifetime, colourOverLifetimeTexture, TintColor);
 }
 protected override void OnActionExecuting(ActionExecutingContext ctx)
 {
     trainingCenter = TCHelper.getTc(RouteData.Values["tc"].ToString(), db);
 }