public void OnDelClick() { s_CurrentDelDecal = VCEAssetMgr.GetDecal(m_GUID); if (s_CurrentDelDecal != null) { VCEMsgBox.Show(VCEMsgBoxType.DECAL_DEL_QUERY); } }
// Update is called once per frame void LateUpdate() { VCDecalAsset decal_asset = VCEAssetMgr.GetDecal(m_Guid); if (decal_asset == null) { if (m_Iso != null && m_Iso.m_DecalAssets != null && m_AssetIndex >= 0 && m_AssetIndex < VCIsoData.DECAL_ARR_CNT) { decal_asset = m_Iso.m_DecalAssets[m_AssetIndex]; } } if (decal_asset == null) { m_Projector.gameObject.SetActive(false); return; } if (VCEditor.DocumentOpen() && m_Tool != null && m_Tool.m_SelBound != null) { m_Tool.m_SelBound.transform.localScale = new Vector3(m_Size, m_Size, m_Depth * 2 - 0.002f); m_Tool.m_SelBound.transform.localPosition = new Vector3(0, 0, 0); } Material usedMaterial = null; if (m_ShaderIndex >= 0 && m_ShaderIndex < m_DecalMats.Length) { usedMaterial = m_DecalMats[m_ShaderIndex]; } m_Projector.gameObject.SetActive(usedMaterial != null); if (usedMaterial != null) { m_Projector.material = usedMaterial; m_Projector.nearClipPlane = 0.001f - m_Depth; m_Projector.farClipPlane = m_Depth - 0.001f; m_Projector.orthographicSize = m_Size * 0.5f; usedMaterial.SetTexture("_Texture", decal_asset.m_Tex); usedMaterial.SetColor("_TintColor", m_Color); usedMaterial.SetFloat("_Size", m_Size * 0.5f); usedMaterial.SetFloat("_Depth", m_Depth); usedMaterial.SetVector("_Center", new Vector4(transform.position.x, transform.position.y, transform.position.z, 1)); usedMaterial.SetVector("_Forward", new Vector4(transform.forward.x, transform.forward.y, transform.forward.z, 0)); if (m_Mirrored) { usedMaterial.SetVector("_Right", -new Vector4(transform.right.x, transform.right.y, transform.right.z, 0)); } else { usedMaterial.SetVector("_Right", new Vector4(transform.right.x, transform.right.y, transform.right.z, 0)); } usedMaterial.SetVector("_Up", new Vector4(transform.up.x, transform.up.y, transform.up.z, 0)); } }
public override void Redo() { VCDecalAsset old_dcl = VCEditor.s_Scene.m_IsoData.m_DecalAssets[m_Index]; VCDecalAsset new_dcl = VCEAssetMgr.GetDecal(m_NewDecal); ulong old_guid = (old_dcl == null) ? (0) : (old_dcl.m_Guid); ulong new_guid = (new_dcl == null) ? (0) : (new_dcl.m_Guid); if (old_guid != new_guid) { VCEditor.s_Scene.m_IsoData.m_DecalAssets[m_Index] = new_dcl; } }
public void OnAddClick() { if (VCEAssetMgr.AddDecalFromTemp(m_GUID)) { VCDecalAsset decal = VCEAssetMgr.GetDecal(m_GUID); VCEditor.SelectedDecalGUID = m_GUID; m_ParentList.RefreshDecalList(); VCEStatusBar.ShowText("Add decal".ToLocalizationString() + " [" + decal.GUIDString + "] " + "from the current ISO".ToLocalizationString() + " !", 6f, true); } else { VCEMsgBox.Show(VCEMsgBoxType.DECAL_NOT_SAVED); } s_CurrentDelDecal = null; }
// Use this for initialization void Start() { m_DecalUITexMat = Material.Instantiate(m_DecalUITex.material) as Material; m_DecalUITex.material = m_DecalUITexMat; m_SelectedSign.SetActive(false); VCDecalAsset dcl = VCEAssetMgr.GetDecal(m_GUID); if (dcl != null) { m_DecalUITexMat.SetTexture("_MainTex", dcl.m_Tex); } else { m_DecalUITexMat.SetTexture("_MainTex", null); } }
// Update is called once per frame void Update() { if (VCEditor.DocumentOpen()) { VCDecalAsset decal = VCEAssetMgr.GetDecal(m_GUID); m_SelectedSign.SetActive(VCEditor.SelectedDecalGUID == m_GUID && m_GUID != 0); int index = VCEditor.s_Scene.m_IsoData.QueryExistDecalIndex(decal); if (index >= 0 && VCEditor.s_Scene.m_IsoData.m_DecalAssets[index] == decal) { m_IndexLabel.text = (index + 1).ToString() + " of " + VCIsoData.DECAL_ARR_CNT.ToString(); m_IndexLabel.color = Color.white; } else if (VCEditor.SelectedDecal == decal) { if (VCEditor.SelectedDecalIndex < 0) { m_IndexLabel.text = "FULL"; m_IndexLabel.color = Color.red; } else { m_IndexLabel.text = (VCEditor.SelectedDecalIndex + 1).ToString() + " of " + VCIsoData.DECAL_ARR_CNT.ToString(); m_IndexLabel.color = Color.white; } } else { m_IndexLabel.text = ""; m_IndexLabel.color = Color.white; } bool tempdcl = VCEAssetMgr.s_TempDecals.ContainsKey(m_GUID); bool existdcl = VCEAssetMgr.s_Decals.ContainsKey(m_GUID); m_AddBtn.SetActive(tempdcl && !existdcl); m_DelBtn.SetActive(!tempdcl && existdcl && index < 0 && VCEditor.SelectedDecal == decal); } }
// Update is called once per frame void Update() { if (!WindowVisible()) { return; } if (VCEditor.SelectedDecal != null) { HideWindow(); } if (m_PathInput.text.Length > 0) { string s = m_PathInput.text.Replace("\\", "/"); if (m_PathInput.text != s) { m_PathInput.text = s; } } if (m_LastPath.Length < 4) { if (m_TmpDecal != null) { m_TmpDecal.Destroy(); m_TmpDecal = null; } } if (m_LastPath != m_PathInput.text) { m_LastPath = m_PathInput.text; if (m_TmpDecal != null) { m_TmpDecal.Destroy(); m_TmpDecal = null; } Texture2D tmptex = VCUtils.LoadTextureFromFile(m_PathInput.text); if (tmptex != null) { m_TmpDecal = new VCDecalAsset(); m_TmpDecal.Import(tmptex.EncodeToPNG()); Texture2D.Destroy(tmptex); } } if (m_TmpDecal != null && m_TmpDecal.m_Tex != null) { m_UIDLabel.text = m_TmpDecal.GUIDString; m_DecalUIMat.mainTexture = m_TmpDecal.m_Tex; m_DecalUITex.gameObject.SetActive(true); if (VCEAssetMgr.GetDecal(m_TmpDecal.m_Guid) != null) { m_ErrorLabel.text = "The same decal image already exist".ToLocalizationString() + " !"; } else if (m_TmpDecal.m_Tex.width > 512 || m_TmpDecal.m_Tex.height > 512) { m_ErrorLabel.text = "Decal size must smaller than 512px".ToLocalizationString() + " !"; } else { m_ErrorLabel.text = ""; } } else { m_UIDLabel.text = "0000000000000000"; m_DecalUITex.gameObject.SetActive(false); m_DecalUIMat.mainTexture = null; m_ErrorLabel.text = "Please specify a decal image".ToLocalizationString() + " (*.png)"; } m_CreateBtnGO.SetActive(m_ErrorLabel.text.Trim().Length < 1); }