Пример #1
0
        /// <summary>
        /// Adds a <c>outerShdw</c> node (Outer Shadow) to the node of type <c>effectLst</c> (Effect Container) specified. Not supported in <c>EPPlus</c> library.
        /// </summary>
        /// <param name="effectContainerNode"><c>effectLst</c> node (Effect Container).</param>
        /// <param name="model">Shadow from model.</param>
        /// <remarks>
        /// For more information please see <a href="http://www.schemacentral.com/sc/ooxml/e-a_outerShdw-2.html">http://www.schemacentral.com/sc/ooxml/e-a_outerShdw-2.html</a>
        /// </remarks>
        private static void AddOuterShadowNode(this XmlNode effectContainerNode, ShadowModel model)
        {
            var blurRadAttr = ChartXmlHelper.CreateAttribute("blurRad");

            blurRadAttr.Value = "63500";

            var distAttr = ChartXmlHelper.CreateAttribute("dist");

            distAttr.Value = "71842";

            var dirAttr = ChartXmlHelper.CreateAttribute("dir");

            dirAttr.Value = "2700013";

            var rotWithShapeAttr = ChartXmlHelper.CreateAttribute("rotWithShape");

            rotWithShapeAttr.Value = "0";

            var outerShadowNode = ChartXmlHelper.CreateOrDefaultAndAppendElementToNode(effectContainerNode, "a", "outerShdw");

            outerShadowNode.Attributes.Append(blurRadAttr);
            outerShadowNode.Attributes.Append(distAttr);
            outerShadowNode.Attributes.Append(dirAttr);
            outerShadowNode.Attributes.Append(rotWithShapeAttr);

            outerShadowNode.AddRgbColorModelPercentageVariantNode(model);
        }
Пример #2
0
        /// <summary>
        /// Adds an <c>effectLst</c> node (Effect Container) to the node of type <c>spPr</c> (Shape properties) specified. Not supported in <c>EPPlus</c> library.
        /// </summary>
        /// <param name="node"><c>spPr</c> node (Shape properties).</param>
        /// <param name="model">Shadow from model.</param>
        /// <remarks>
        /// For more information please see <a href="http://www.schemacentral.com/sc/ooxml/e-a_effectLst-1.html">http://www.schemacentral.com/sc/ooxml/e-a_effectLst-1.html</a>
        /// </remarks>
        /// <exception cref="T:System.ArgumentNullException">If <paramref name="node" /> is <c>null</c>.</exception>
        /// <exception cref="T:System.ArgumentNullException">If <paramref name="model" /> is <c>null</c>.</exception>
        public static void AddEffectContainerNode(this XmlNode node, ShadowModel model)
        {
            SentinelHelper.ArgumentNull(node);
            SentinelHelper.ArgumentNull(model);

            var effectContainerNode = ChartXmlHelper.CreateOrDefaultAndAppendElementToNode(node, "a", "effectLst");

            effectContainerNode.AddOuterShadowNode(model);
        }
Пример #3
0
        /// <summary>
        /// Adds a <c>scrgbClr</c> node (Rgb Color Model Percentage Variant) to the node of type <c>outerShdw</c> (Outer Shadow) specified. Not supported in <c>EPPlus</c> library.
        /// </summary>
        /// <param name="outerShadowNode"><c>outerShdw</c> node (Outer Shadow).</param>
        /// <param name="model">Shadow from model.</param>
        /// <remarks>
        /// For more information please see <a href="http://www.schemacentral.com/sc/ooxml/e-a_scrgbClr-1.html">http://www.schemacentral.com/sc/ooxml/e-a_scrgbClr-1.html</a>
        /// </remarks>
        private static void AddRgbColorModelPercentageVariantNode(this XmlNode outerShadowNode, ShadowModel model)
        {
            var redRadAttr = ChartXmlHelper.CreateAttribute("r");

            redRadAttr.Value = "0";

            var greenAttr = ChartXmlHelper.CreateAttribute("g");

            greenAttr.Value = "0";

            var blueAttr = ChartXmlHelper.CreateAttribute("b");

            blueAttr.Value = "0";

            var rgbColorModelPercentageVariantNode = ChartXmlHelper.CreateOrDefaultAndAppendElementToNode(outerShadowNode, "a", "scrgbClr");

            rgbColorModelPercentageVariantNode.Attributes.Append(redRadAttr);
            rgbColorModelPercentageVariantNode.Attributes.Append(greenAttr);
            rgbColorModelPercentageVariantNode.Attributes.Append(blueAttr);

            var valAttr = ChartXmlHelper.CreateAttribute("val");

            valAttr.Value = (model.Transparency * 100000).ToString(CultureInfo.InvariantCulture);

            var alphaNode = ChartXmlHelper.CreateOrDefaultAndAppendElementToNode(rgbColorModelPercentageVariantNode, "a", "alpha");

            alphaNode.Attributes.Append(valAttr);
        }
Пример #4
0
        private void TypeComboBox_Selected(object sender, RoutedEventArgs e)
        {
            if (!IsLoaded)
            {
                return;
            }

            if (TypeComboBox.SelectedIndex < 1)
            {
                MainPresenter.Content = null;
                return;
            }

            if (!IsEditing)
            {
                //Create a new model.
                switch ((DefaultTaskModel.TaskTypeEnum)TypeComboBox.SelectedIndex)
                {
                case DefaultTaskModel.TaskTypeEnum.MouseClicks:
                    CurrentTask = MouseClicksModel.Default();
                    break;

                case DefaultTaskModel.TaskTypeEnum.KeyStrokes:
                    CurrentTask = KeyStrokesModel.Default();
                    break;

                case DefaultTaskModel.TaskTypeEnum.Delay:
                    CurrentTask = DelayModel.Default();
                    break;

                case DefaultTaskModel.TaskTypeEnum.Progress:
                    CurrentTask = ProgressModel.Default();
                    break;

                case DefaultTaskModel.TaskTypeEnum.Border:
                    CurrentTask = BorderModel.Default();
                    break;

                case DefaultTaskModel.TaskTypeEnum.Shadow:
                    CurrentTask = ShadowModel.Default();
                    break;
                }
            }

            switch ((DefaultTaskModel.TaskTypeEnum)TypeComboBox.SelectedIndex)
            {
            case DefaultTaskModel.TaskTypeEnum.MouseClicks:
                MainPresenter.Content = new MouseClicksPanel {
                    DataContext = CurrentTask
                };
                break;

            case DefaultTaskModel.TaskTypeEnum.KeyStrokes:
                MainPresenter.Content = new KeyStrokesPanel {
                    DataContext = CurrentTask
                };
                break;

            case DefaultTaskModel.TaskTypeEnum.Delay:
                MainPresenter.Content = new DelayPanel {
                    DataContext = CurrentTask
                };
                break;

            case DefaultTaskModel.TaskTypeEnum.Progress:
                MainPresenter.Content = new ProgressPanel {
                    DataContext = CurrentTask
                };
                break;

            case DefaultTaskModel.TaskTypeEnum.Border:
                MainPresenter.Content = new BorderPanel {
                    DataContext = CurrentTask
                };
                break;

            case DefaultTaskModel.TaskTypeEnum.Shadow:
                MainPresenter.Content = new ShadowPanel {
                    DataContext = CurrentTask
                };
                break;
            }
        }
Пример #5
0
    void CopyModel()
    {
        GameObject objShadow = new GameObject();

        objShadow.transform.position = pos;
        objShadow.transform.rotation = quat;
        objShadow.transform.SetParent(null);
        ShadowModel shadowModel = new ShadowModel();

        shadowModel.alpha = 1;
        SkinnedMeshRenderer[]         msrChild   = GetComponentsInChildren <SkinnedMeshRenderer>();
        MeshRenderer[]                mrChild    = GetComponentsInChildren <MeshRenderer>();
        Dictionary <Mesh, ShadowInfo> ShadowMesh = new Dictionary <Mesh, ShadowInfo>();//静态的mesh 武器挂载点要设置坐标

        //objShadow.AddComponent<MeshRenderer>();
        for (int i = 0; i < msrChild.Length; i++)
        {
            if (!msrChild[i].enabled)
            {
                continue;
            }
            Mesh ms = new Mesh();
            msrChild[i].BakeMesh(ms);
            ShadowInfo      info = new ShadowInfo();
            List <Material> mat  = new List <Material>();
            for (int j = 0; j < msrChild[i].materials.Length; j++)
            {
                mat.Add(Instantiate(msrChild[i].materials[j]));
            }
            info.mat        = mat.ToArray();
            info.attach     = msrChild[i].transform;
            info.normalMesh = false;
            ShadowMesh.Add(ms, info);
        }

        for (int i = 0; i < mrChild.Length; i++)
        {
            if (!mrChild[i].enabled)
            {
                continue;
            }
            Mesh            ms   = mrChild[i].GetComponent <MeshFilter>().mesh;
            ShadowInfo      info = new ShadowInfo();
            List <Material> mat  = new List <Material>();
            for (int j = 0; j < mrChild[i].materials.Length; j++)
            {
                mat.Add(Instantiate(mrChild[i].materials[j]));
            }
            info.mat        = mat.ToArray();
            info.attach     = mrChild[i].transform;
            info.normalMesh = true;
            ShadowMesh.Add(ms, info);
        }



        foreach (var each in ShadowMesh)
        {
            GameObject subMesh = new GameObject();
            subMesh.name = each.Value.attach.name;
            MeshFilter mf = subMesh.AddComponent <MeshFilter>();
            mf.mesh = each.Key;
            MeshRenderer mr = subMesh.AddComponent <MeshRenderer>();
            mr.materials = each.Value.mat;
            subMesh.transform.SetParent(objShadow.transform);

            if (each.Value.normalMesh)
            {
                subMesh.transform.rotation = each.Value.attach.transform.rotation;
                subMesh.transform.position = each.Value.attach.transform.position;
            }
            else
            {
                subMesh.transform.localPosition = Vector3.zero;
                subMesh.transform.localRotation = Quaternion.identity;
            }

            for (int i = 0; i < mr.materials.Length; i++)
            {
                mr.materials[i].SetFloat("_Alpha", alphaInitialize);
                mr.materials[i].SetColor("_TintColor", colorMul);
            }
            //mr.material.SetFloat("_Alpha", shadowModel.alpha);
        }
        shadowModel.shadowLast = shadowLast;
        copyedModel.Add(objShadow, shadowModel);
    }