Ejemplo n.º 1
0
        // Functions
        //----------------------------------------------------
        public MaterialUnit MakeBatchedMaterial(Texture2D texture, int textureID, Shader shader)
        {
            MaterialUnit result = _matUnits.Find(delegate(MaterialUnit a)
            {
                return(a.IsEqualMaterial(texture, textureID, shader));
            });

            if (result != null)
            {
                //수정 : 이 함수는 Bake에서 호출되므로 Material은 만들지 않는다.
                //Material resultMat = result._material;
                //if(resultMat == null)
                //{
                //	result.MakeMaterial();
                //	resultMat = result._material;
                //}
                return(result);
            }

            //새로 만들자
            int newID = _matUnits.Count + 1;

            result = new MaterialUnit(newID, texture, textureID, shader);
            _matUnits.Add(result);

            return(result);
        }
Ejemplo n.º 2
0
        public void SetMeshCustomImageAll(int textureID, Texture2D newTexture, string propertyName)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestCustomImage(newTexture, propertyName);
                //curUnit.RefreshLinkedMeshes();
            }

            if (_clippedMatUnits != null && _clippedMatUnits.Count > 0)
            {
                ClippedMatMeshSet curCMMSet = null;
                for (int i = 0; i < _clippedMatUnits.Count; i++)
                {
                    curCMMSet = _clippedMatUnits[i];
                    if (!curCMMSet.IsValid())
                    {
                        continue;
                    }
                    if (curCMMSet._matInfo._textureID != textureID)
                    {
                        continue;
                    }

                    curCMMSet._clippedMesh.SetClippedMaterialPropertyByBatch_CustomTexture(newTexture, propertyName);
                }
            }
        }
Ejemplo n.º 3
0
        public void Clear(bool isDestroyMaterial)
        {
            if (isDestroyMaterial)
            {
                MaterialUnit curUnit = null;
                for (int i = 0; i < _matUnits.Count; i++)
                {
                    curUnit = _matUnits[i];
                    try
                    {
                        if (curUnit._material != null)
                        {
                            UnityEngine.Object.DestroyImmediate(curUnit._material);
                        }

                        if (curUnit._material_Original != null)
                        {
                            UnityEngine.Object.DestroyImmediate(curUnit._material_Original);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            _matUnits.Clear();
        }
Ejemplo n.º 4
0
        public void SetMeshAlphaAll(int textureID, float alpha)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestAlpha(alpha);
                //curUnit.RefreshLinkedMeshes();
            }

            if (_clippedMatUnits != null && _clippedMatUnits.Count > 0)
            {
                ClippedMatMeshSet curCMMSet = null;
                for (int i = 0; i < _clippedMatUnits.Count; i++)
                {
                    curCMMSet = _clippedMatUnits[i];
                    if (!curCMMSet.IsValid())
                    {
                        continue;
                    }
                    if (curCMMSet._matInfo._textureID != textureID)
                    {
                        continue;
                    }

                    curCMMSet._clippedMesh.SetClippedMaterialPropertyByBatch_Alpha(alpha);
                }
            }
        }
Ejemplo n.º 5
0
        public IHttpActionResult PutMaterialUnit(int id, MaterialUnit materialUnit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != materialUnit.MaterialUnitId)
            {
                return(BadRequest());
            }

            db.Entry(materialUnit).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MaterialUnitExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 6
0
        public ActionResult Create([Bind(Include = "Code,MaterialId,Name,latestPrice,MinReOrder,Description,qty,AvgPrice,barcode,UnitId,UnitId2,convert,WareHouseId,Dimension")] Material material)
        {
            if (ModelState.IsValid)
            {
                if (material.AvgPrice == null)
                {
                    material.AvgPrice = 0;
                }

                if (material.latestPrice == null)
                {
                    material.latestPrice = 0;
                }


                if (material.qty == null)
                {
                    material.qty        = 0;
                    material.OpeningQty = 0;
                }
                else
                {
                    material.OpeningQty = material.qty ?? 0;
                }
                material.CreatedDate = DateTime.Now;
                material.Resevedqty  = 0;
                if (material.MinReOrder == null)
                {
                    material.MinReOrder = 0;
                }
                db.Materials.Add(material);
                db.SaveChanges();

                MaterialUnit mu = new MaterialUnit();
                mu.MaterialId = material.MaterialId;
                mu.UnitId     = material.UnitId;
                mu.convert    = 1;
                db.MaterialUnits.Add(mu);

                if (material.UnitId2 != null)
                {
                    MaterialUnit mu2 = new MaterialUnit();
                    mu2.MaterialId = material.MaterialId;
                    mu2.UnitId     = material.UnitId2 ?? 0;
                    mu2.convert    = material.convert ?? 0;
                    db.MaterialUnits.Add(mu2);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UnitId  = new SelectList(db.Units, "UnitId", "Name", material.UnitId);
            ViewBag.UnitId2 = new SelectList(db.Units, "UnitId", "Name", material.UnitId2);

            ViewBag.WareHouseId = new SelectList(db.Warehouses, "WarehouseId", "Name", material.WareHouseId);
            return(View(material));
        }
        // Functions
        //-----------------------------------------------------------------------------
        //Material Info를 사용하지 않는 이전 방식
        public Material GetSharedMaterial_Prev(Texture texture, Shader shader, apPortrait portrait)
        {
#if UNITY_EDITOR
            if (UnityEditor.BuildPipeline.isBuildingPlayer)
            {
                return(null);
            }
#endif
            MaterialUnit matUnit = null;

            //Debug.LogWarning("Shared Material - Get Shared Material [ " + texture.name + " / " + shader.name + " / " + portrait.name + " ]");
            if (_matUnits_Prev.ContainsKey(texture))
            {
                if (_matUnits_Prev[texture].ContainsKey(shader))
                {
                    matUnit = _matUnits_Prev[texture][shader];
                }
                else
                {
                    //새로운 Material Set 생성
                    matUnit = new MaterialUnit(texture, shader);

                    //Shader 키와 함께 등록
                    _matUnits_Prev[texture].Add(shader, matUnit);

                    //Debug.Log(">> (!) 새로운 Material 리턴");
                }
            }
            else
            {
                //새로운 Material Set 생성
                matUnit = new MaterialUnit(texture, shader);

                //Texture 키와 리스트 생성
                _matUnits_Prev.Add(texture, new Dictionary <Shader, MaterialUnit>());

                //Shader 키와 함께 등록
                _matUnits_Prev[texture].Add(shader, matUnit);

                //Debug.Log(">> (!) 새로운 Material 리턴");
            }

            //Portrait 등록
            matUnit.LinkPortrait(portrait);
            List <MaterialUnit> matUnitList = null;
            if (!_portrait2MatUnits_Prev.ContainsKey(portrait))
            {
                _portrait2MatUnits_Prev.Add(portrait, new List <MaterialUnit>());
            }
            matUnitList = _portrait2MatUnits_Prev[portrait];
            if (!matUnitList.Contains(matUnit))
            {
                matUnitList.Add(matUnit);
            }

            //Shader Material 반환
            return(matUnit._material);
        }
Ejemplo n.º 8
0
    private void CreateMaterialsList()
    {
        using (StringWriter sw = new StringWriter())
        {
            using (HtmlTextWriter writer = new HtmlTextWriter(sw))
            {
                MaterialCollection materials = Material.Utils.GetMaterialsByPartID(partID);

                writer.AddAttribute("class", "listview");
                writer.AddAttribute("cellspacing", "0");
                writer.AddAttribute("cellpadding", "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.AddAttribute("class", "title");
                writer.RenderBeginTag(HtmlTextWriterTag.Th);
                writer.Write(Resources.MaterialTexts.ListHeaderTitle);
                writer.RenderEndTag(); // Th

                writer.AddAttribute("class", "unit");
                writer.RenderBeginTag(HtmlTextWriterTag.Th);
                writer.Write(Resources.MaterialTexts.ListHeaderUnit);
                writer.RenderEndTag(); // Th

                writer.AddAttribute("class", "delete");
                writer.RenderBeginTag(HtmlTextWriterTag.Th);
                writer.Write(Resources.Global.ListHeaderButtons);
                writer.RenderEndTag(); // Th

                writer.RenderEndTag(); // Tr
                foreach (var material in materials)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.AddAttribute("class", "title");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(material.Title);
                    writer.RenderEndTag(); // Td
                    writer.AddAttribute("class", "unit");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    MaterialUnit unit = new MaterialUnit(material.UnitID);
                    writer.Write(unit.Title);
                    writer.RenderEndTag(); // Td
                    writer.AddAttribute("class", "delete");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.AddAttribute("class", "fa fa fa-times remove");
                    writer.AddAttribute("onclick", "return removeMaterial(" + material.ID + ", '" + material.Title + "');");
                    writer.RenderBeginTag(HtmlTextWriterTag.I);
                    writer.RenderEndTag(); // I
                    writer.RenderEndTag(); // Td
                    writer.RenderEndTag(); //Tr
                }

                writer.RenderEndTag(); // Table

                litMaterialList.Text = sw.ToString();
            }
        }
    }
Ejemplo n.º 9
0
        public void ResetProperties(int textureID)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                curUnit.ResetRequestProperties();
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 10
0
        public IHttpActionResult GetMaterialUnit(int id)
        {
            MaterialUnit materialUnit = db.MaterialUnits.Find(id);

            if (materialUnit == null)
            {
                return(NotFound());
            }

            return(Ok(materialUnit));
        }
Ejemplo n.º 11
0
        public IHttpActionResult PostMaterialUnit(MaterialUnit materialUnit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MaterialUnits.Add(materialUnit);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = materialUnit.MaterialUnitId }, materialUnit));
        }
Ejemplo n.º 12
0
        //public void DebugAllMaterials()
        //{
        //	MaterialUnit curUnit = null;
        //	Debug.LogError("Batched Materials");
        //	for (int i = 0; i < _matUnits.Count; i++)
        //	{
        //		string strMaterialName = "<None Material>";
        //		string strTextureName = "<None Texture>";
        //		int nLinked = 0;

        //		curUnit = _matUnits[i];
        //		if(curUnit._material != null)
        //		{
        //			strMaterialName = curUnit._material.name;
        //			if(curUnit._material.mainTexture != null)
        //			{
        //				strTextureName = curUnit._material.mainTexture.name;
        //			}
        //		}
        //		nLinked = curUnit._linkedMeshes.Count;
        //		Debug.Log("[" + i + "] : " + strMaterialName + " / " + strTextureName + "  (" + nLinked + ")");
        //	}
        //}

        // 추가 12.13 : 일괄 수정 요청
        //---------------------------------------------------------------

        /// <summary>
        /// Batched Material 의 속성을 초기화한다. 이 함수 호출 후에는 Shared Material로 유도한다.
        /// </summary>
        public void ResetAllProperties()
        {
            MaterialUnit curUnit = null;

            //apOptMesh curMesh = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                curUnit.ResetRequestProperties();
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 13
0
 public string Upd(MaterialUnit Table_entity)
 {
     try
     {
         _app.Upd(Table_entity);
     }
     catch (Exception ex)
     {
         Result.Status  = false;
         Result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }
Ejemplo n.º 14
0
        protected void ButtonNew_Click(object sender, EventArgs e)
        {
            MaterialUnit      NewMat = new MaterialUnit();
            ModelTMSContainer Temp   = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);

            Temp.AddToMaterialUnitSet(NewMat);
            NewMat.Description = "Materiaaleenheid";

            Temp.SaveChanges(SaveOptions.DetectChangesBeforeSave);

            WebUserControlStockUnitsBase1.KeyID   = NewMat.Id;
            WebUserControlStockUnitsBase1.Visible = true;
        }
Ejemplo n.º 15
0
        public IHttpActionResult DeleteMaterialUnit(int id)
        {
            MaterialUnit materialUnit = db.MaterialUnits.Find(id);

            if (materialUnit == null)
            {
                return(NotFound());
            }

            db.MaterialUnits.Remove(materialUnit);
            db.SaveChanges();

            return(Ok(materialUnit));
        }
Ejemplo n.º 16
0
 public MaterialEntity(
     string materialManagementCode,
     string materialCode,
     string materialName,
     float materialQuantity,
     string materialUnit,
     DateTime materialExpirationDate)
 {
     MaterialManagementCode = new MaterialManagementCode(materialManagementCode);
     MaterialCode           = new MaterialCode(materialCode);
     MaterialName           = new MaterialName(materialName);
     MaterialQuantity       = new MaterialQuantity(materialQuantity);
     MaterialUnit           = new MaterialUnit(materialUnit);
     MaterialExpirationDate = new MaterialExpirationDate(materialExpirationDate);//SL
 }
Ejemplo n.º 17
0
        public void SetMeshCustomVector4All(int textureID, Vector4 vecValue, string propertyName)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestCustomVector4(vecValue, propertyName);
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 18
0
        public void SetMeshImageAll(int textureID, Texture2D newTexture)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestImage(newTexture);
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 19
0
        public void SetMeshCustomAlphaAll(int textureID, float alpha, string propertyName)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestCustomAlpha(alpha, propertyName);
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 20
0
        public void SetMeshColorAll(int textureID, Color color)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestColor(color);
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 21
0
        public void SetMeshAlphaAll(int textureID, float alpha)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestAlpha(alpha);
                //curUnit.RefreshLinkedMeshes();
            }
        }
Ejemplo n.º 22
0
        public Material GetMaterial(int materialID)
        {
            MaterialUnit result = _matUnits.Find(delegate(MaterialUnit a)
            {
                return(a._uniqueID == materialID);
            });

            if (result != null)
            {
                if (result._material == null)
                {
                    result.MakeMaterial();
                }
                return(result._material);
            }
            return(null);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Batched Material을 만들거나, 동일한 Material를 리턴하는 함수.
        /// v1.1.7 또는 그 이후 버전을 위한 함수이며 Material Info를 이용한다.
        /// </summary>
        /// <param name="srcMatInfo"></param>
        /// <returns></returns>
        public MaterialUnit MakeBatchedMaterial_MatInfo(apOptMaterialInfo srcMatInfo)
        {
            MaterialUnit result = _matUnits.Find(delegate(MaterialUnit a)
            {
                return(a.IsEqualMaterial_MatInfo(srcMatInfo));
            });

            if (result != null)
            {
                return(result);
            }

            //새로 만들자
            int newID = _matUnits.Count + 1;

            result = new MaterialUnit(newID, srcMatInfo);
            _matUnits.Add(result);

            return(result);
        }
Ejemplo n.º 24
0
        public string GetTemplate()
        {
            var result = new TableData();
            List <MaterialUnit> listMaterialUnit = new List <MaterialUnit>();
            MaterialUnit        entity           = _app.FindSingle(u => u.Id > 0);

            if (entity != null)
            {
                listMaterialUnit.Add(entity);
            }
            else
            {
                listMaterialUnit.Add(new MaterialUnit());
            }

            result.data  = listMaterialUnit;
            result.count = listMaterialUnit.Count;

            return(JsonHelper.Instance.Serialize(result));
        }
Ejemplo n.º 25
0
        public MaterialUnit GetMaterialUnit(int materialID, apOptMesh optMesh)
        {
            MaterialUnit result = _matUnits.Find(delegate(MaterialUnit a)
            {
                return(a._uniqueID == materialID);
            });

            if (result != null)
            {
                if (result._material == null)
                {
                    result.MakeMaterial();
                }

                result.LinkMesh(optMesh);

                return(result);
            }
            return(null);
        }
Ejemplo n.º 26
0
        // Functions
        //----------------------------------------------------
        /// <summary>
        /// Batched Material을 만들거나, 동일한 Material를 리턴하는 함수.
        /// v1.1.6 또는 그 이전 버전의 함수이다.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="textureID"></param>
        /// <param name="shader"></param>
        /// <returns></returns>
        public MaterialUnit MakeBatchedMaterial_Prev(Texture2D texture, int textureID, Shader shader)
        {
            MaterialUnit result = _matUnits.Find(delegate(MaterialUnit a)
            {
                return(a.IsEqualMaterial_Prev(texture, textureID, shader));
            });

            if (result != null)
            {
                return(result);
            }

            //새로 만들자
            int newID = _matUnits.Count + 1;

            result = new MaterialUnit(newID, texture, textureID, shader);
            _matUnits.Add(result);

            return(result);
        }
Ejemplo n.º 27
0
    private void FillValues(Material material)
    {
        txtMaterialTitle.Text  = material.Title;
        txtMaterialPrice.Text  = material.Price.Price.ToString("N2");
        txtMinStockAmount.Text = material.MinStockOrder.ToString("N2");
        txtMaterialNumber.Text = material.Number;

        litPartnumberDetails.Text = material.Number;

        MaterialUnit unit = new MaterialUnit(material.UnitID);

        litUnitDetails.Text = unit.Title;

        litPriceUnitDetails.Text = material.Price.Price.ToString("N2");

        string typeTxt = "";

        switch (material.TypeID)
        {
        case 1:
            typeTxt = "Pakke";
            break;

        case 2:
            typeTxt = "Lager";
            break;

        case 3:
            typeTxt = "Mellemlager";
            break;

        default:
            break;
        }

        litTypeDetails.Text = typeTxt;

        litMinimumOrderDetails.Text = material.MinStockOrder.ToString("N2");
        litCompanyDetails.Text      = new Company(material.CompanyID).Name;
    }
Ejemplo n.º 28
0
        public void Clear(bool isDestroyMaterial)
        {
            //Debug.LogWarning("Batched Material 초기화");
            if (isDestroyMaterial)
            {
                MaterialUnit curUnit = null;
                for (int i = 0; i < _matUnits.Count; i++)
                {
                    curUnit = _matUnits[i];
                    try
                    {
                        if (curUnit._material != null)
                        {
                            UnityEngine.Object.DestroyImmediate(curUnit._material);
                        }

                        if (curUnit._material_Original != null)
                        {
                            UnityEngine.Object.DestroyImmediate(curUnit._material_Original);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            _matUnits.Clear();

            if (_clippedMatUnits == null)
            {
                _clippedMatUnits = new List <ClippedMatMeshSet>();
            }
            if (_clippedMesh2MatUnits == null)
            {
                _clippedMesh2MatUnits = new Dictionary <apOptMesh, ClippedMatMeshSet>();
            }
            _clippedMatUnits.Clear();
            _clippedMesh2MatUnits.Clear();
        }
Ejemplo n.º 29
0
        public void SetMeshImageAll(int textureID, Texture2D newTexture)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];

                //Debug.Log("[" + i + "] : " + curUnit._textureID);

                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.RequestImage(newTexture);
                //curUnit.RefreshLinkedMeshes();
            }

            if (_clippedMatUnits != null && _clippedMatUnits.Count > 0)
            {
                ClippedMatMeshSet curCMMSet = null;
                for (int i = 0; i < _clippedMatUnits.Count; i++)
                {
                    curCMMSet = _clippedMatUnits[i];
                    if (!curCMMSet.IsValid())
                    {
                        continue;
                    }
                    if (curCMMSet._matInfo._textureID != textureID)
                    {
                        continue;
                    }

                    curCMMSet._clippedMesh.SetClippedMaterialPropertyByBatch_Texture(newTexture);
                }
            }
        }
Ejemplo n.º 30
0
        public void ResetProperties(int textureID)
        {
            MaterialUnit curUnit = null;

            for (int i = 0; i < _matUnits.Count; i++)
            {
                curUnit = _matUnits[i];

                //추가 19.10.28 : 이 코드가 빠지면 버그다.
                if (curUnit._textureID != textureID)
                {
                    continue;
                }

                curUnit.ResetRequestProperties();
                //curUnit.RefreshLinkedMeshes();
            }

            if (_clippedMatUnits != null && _clippedMatUnits.Count > 0)
            {
                ClippedMatMeshSet curCMMSet = null;
                for (int i = 0; i < _clippedMatUnits.Count; i++)
                {
                    curCMMSet = _clippedMatUnits[i];
                    if (!curCMMSet.IsValid())
                    {
                        continue;
                    }
                    if (curCMMSet._matInfo._textureID != textureID)
                    {
                        continue;
                    }

                    curCMMSet.ResetRequestProperties();
                }
            }
        }