Example #1
0
        private void btnBlendDst_Click(object sender, EventArgs e)
        {
            EBlendFactor      eBlendFactor = (EBlendFactor)Enum.Parse(typeof(EBlendFactor), btnBlendDst.Text);
            GLBlendFactorForm form         = new GLBlendFactorForm();

            form.setGlBendFactor(eBlendFactor);
            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                btnBlendDst.Text = form.getGlBendFactor().ToString();
                if (btnBlendSrc.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_SRC_ALPHA) &&
                    btnBlendDst.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_ONE_MINUS_SRC_ALPHA))
                {
                    btnBlendNormal.Font = new Font(btnBlendNormal.Font, FontStyle.Bold);
                    btnBlendToAdd.Font  = new Font(btnBlendToAdd.Font, FontStyle.Regular);
                }
                else if (btnBlendSrc.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_SRC_ALPHA) &&
                         btnBlendDst.Text == Enum.GetName(typeof(EBlendFactor), EBlendFactor.GL_ONE))
                {
                    btnBlendToAdd.Font  = new Font(btnBlendToAdd.Font, FontStyle.Bold);
                    btnBlendNormal.Font = new Font(btnBlendNormal.Font, FontStyle.Regular);
                }
                else
                {
                    btnBlendToAdd.Font  = new Font(btnBlendToAdd.Font, FontStyle.Regular);
                    btnBlendNormal.Font = new Font(btnBlendNormal.Font, FontStyle.Regular);
                }
                updateTitle(true);
            }
        }
Example #2
0
        public void onBtnSet_Click(object sender, EventArgs e)
        {
            if (ePropType == EPropType.ePropType_GL_BlendFactor)
            {
                GLBlendFactorForm form = new GLBlendFactorForm();
                form.setGlBendFactor((EBlendFactor)Enum.Parse(typeof(EBlendFactor), tb.Text));
                form.ShowDialog();
                this.tb.Text = Enum.GetName(typeof(EBlendFactor), form.getGlBendFactor());
            }
            else if (ePropType == EPropType.ePropType_GL_SysParticle)
            {
                ParticleTypeForm form = new ParticleTypeForm();
                form.setType((ESysParticleType)Enum.Parse(typeof(ESysParticleType), tb.Text));
                form.ShowDialog();
                this.tb.Text = Enum.GetName(typeof(ESysParticleType), form.getType());
            }
            else if (ePropType == EPropType.ePropType_Condition)
            {
                CondTypeForm form = new CondTypeForm();
                form.setType((ECondType)Enum.Parse(typeof(ECondType), tb.Text));
                form.ShowDialog();
                this.tb.Text = Enum.GetName(typeof(ECondType), form.getType());
            }
            else if (ePropType == EPropType.ePropType_OffsetType)
            {
                OffsetTypeForm form = new OffsetTypeForm();
                form.setType((EOffsetType)Enum.Parse(typeof(EOffsetType), tb.Text));
                form.ShowDialog();
                this.tb.Text = Enum.GetName(typeof(EOffsetType), form.getType());
            }
            else if (ePropType == EPropType.ePropType_ShaderType)
            {
                __curContextMenuValue = "";
                ContextMenu contextMenu = new ContextMenu();
                contextMenu.MenuItems.Add("默认 - ShaderPositionTextureColor");
                contextMenu.MenuItems.Add("模糊 - ShaderBlur");
                contextMenu.MenuItems.Add("灰度图 - ShaderGrey");
                contextMenu.MenuItems.Add("马赛克 - ShaderMosaic");
                contextMenu.MenuItems.Add("调色(亮度,对比度,饱和度) - ShaderCompose");
                contextMenu.MenuItems.Add("Bloom - ShaderBloom");
                contextMenu.Show(this.tb, new Point(0, 0));
                for (int i = 0; i < contextMenu.MenuItems.Count; i++)
                {
                    contextMenu.MenuItems[i].Click += onContextMenuClick;
                }
            }
            else if (ePropType == EPropType.ePropType_ShaderParamType)
            {
                String shaderName = "";
                foreach (Prop prop in propForm.props)
                {
                    if (prop.ePropType == EPropType.ePropType_ShaderType)
                    {
                        shaderName = prop.tb.Text;
                        break;
                    }
                }

                if (shaderName == "")
                {
                    return;
                }

                ContextMenu contextMenu = new ContextMenu();
                contextMenu.MenuItems.Add("(空)");
                switch (shaderName)
                {
                case "ShaderBlur":
                    contextMenu.MenuItems.Add("模糊程度 - ShaderParam_Blur");
                    break;

                case "ShaderGrey":      // 目前没有参数
                    contextMenu.MenuItems.Add("灰度程度 - ShaderParam_Grey");
                    break;

                case "ShaderMosaic":      // 目前没有参数
                    contextMenu.MenuItems.Add("马赛克程度 - ShaderParam_Mosaic");
                    break;

                case "ShaderCompose":      // 目前没有参数
                    contextMenu.MenuItems.Add("调色(亮度)  - ShaderParam_Compose_brightness");
                    contextMenu.MenuItems.Add("调色(对比度) - ShaderParam_Compose_contrast");
                    contextMenu.MenuItems.Add("调色(饱和度) - ShaderParam_Compose_saturation");
                    break;

                case "ShaderBloom":
                    contextMenu.MenuItems.Add("bloom(offset)  - ShaderParam_Bloom_offset");
                    contextMenu.MenuItems.Add("bloom(scale)  - ShaderParam_Bloom_scale");
                    break;
                }

                contextMenu.Show(this.tb, new Point(0, 0));
                for (int i = 0; i < contextMenu.MenuItems.Count; i++)
                {
                    contextMenu.MenuItems[i].Click += onContextMenuClick;
                }
            }
        }