Ejemplo n.º 1
0
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            Tbx.Clear();
            LbxWord.Items.Clear();
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = AppInfoHelper.GetArticleFolder();
            dialog.Multiselect      = false; //该值确定是否可以选择多个文件
            dialog.Title            = "请选择文件夹";
            dialog.Filter           = "所有文件(*.xml)|*.xml";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                articlePath     = dialog.FileName;
                TbxArticle.Text = dialog.SafeFileName.Replace(".xml", "");
            }
            words        = new HashSet <string>();
            dict         = CbxDictionary.Text;
            wordList     = new List <string>();
            transList    = new List <string>();
            phoneticList = new List <string>();
            if (File.Exists(articlePath))
            {
                MPB.Value = 0;
                MPB.Show();
                OpenArticle();
                t = new Thread(BackgroundProcess);
                t.IsBackground = true;
                t.Start();
            }
        }
Ejemplo n.º 2
0
    void SetDissolveValue(int isOn, float diss, bool activeParaicels)
    {
        if (SMR != null && SMR.Length > 0)
        {
            foreach (var s in SMR)
            {
                if (s != null && s.sharedMesh != null)
                {
                    for (int i = 0; i < s.sharedMesh.subMeshCount; i++)
                    {
                        s.GetPropertyBlock(MPB, i);
                        MPB.SetInt(dissolveOn, isOn);
                        MPB.SetFloat(dissolveAmount, diss);
                        s.SetPropertyBlock(MPB, i);
                    }
                }
            }
        }

        if (particels != null && particels.Length > 0)
        {
            foreach (var ps in particels)
            {
                if (ps != null && ps.gameObject.activeSelf != activeParaicels)
                {
                    ps.gameObject.SetActive(activeParaicels);
                }
            }
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 开启角色的边缘光效果
 /// </summary>
 /// <param name="state">true开启,false关闭</param>
 /// <param name="col">边缘光颜色</param>
 /// <param name="width">边缘光宽度,0最宽,角色全亮,10以上很窄</param>
 public void SetEdgeLit(bool state, Color col, float width)
 {
     if (SMR == null || SMR.Length < 1)
     {
         return;
     }
     foreach (var smr in SMR)
     {
         int matCount = smr.sharedMaterials.Length;
         for (int i = 0; i < matCount; i++)
         {
             smr.GetPropertyBlock(MPB, i);
             if (state)
             {
                 MPB.SetInt(edgeLightId, 1);
                 MPB.SetFloat(edgeColorWidthId, width);
                 MPB.SetColor(edgeColorId, col);
             }
             else
             {
                 MPB.SetInt(edgeLightId, 0);
             }
             smr.SetPropertyBlock(MPB, i);
         }
     }
 }
Ejemplo n.º 4
0
 void Awake()
 {
     blocks = renderers.Select(renderer =>
     {
         var block = new MPB(renderer);
         block.SetFloat("_Gain", gain, 1f);
         block.SetFloat("_Magnitude", magnitude, 1f);
         return(block);
     }).ToList();
 }
Ejemplo n.º 5
0
    /// <summary>
    /// 判断边缘光是否已经开启
    /// </summary>
    /// <returns></returns>
    public bool IsEdgeLitOpen()
    {
        if (SMR == null || SMR.Length < 1)
        {
            return(false);
        }
        var smr = SMR[0];

        smr.GetPropertyBlock(MPB, 0);
        return(MPB.GetInt(edgeLightId) > 0);
    }
Ejemplo n.º 6
0
 private void ThreadFunction()
 {
     if (this.MPB.InvokeRequired)
     {
         NewDelegate newdel = new NewDelegate(ThreadFunction);
         this.Invoke(newdel);
         //Console.WriteLine("ThreadFunction");
     }
     else
     {
         ShowListBox();
         MPB.Hide();
         BtnGrasp.Show();
         BtnSelectAll.Show();
         BtnUngrasp.Show();
         //Console.WriteLine("ShowTreeView");
     }
 }
Ejemplo n.º 7
0
        //todo:添加到单词本

        public ArticleStudy()
        {
            InitializeComponent();
            MPB.Hide();
            BtnGrasp.Hide();
            BtnSelectAll.Hide();
            BtnUngrasp.Hide();
            CheckForIllegalCrossThreadCalls = false;
            formWidth   = 800;
            formHeight  = 426;
            formWidthN  = this.Width;
            formHeightN = this.Height;
            graspList   = StatisticsHelper.GetWordLog(StatisticsHelper.GetWordLogPath(DateTime.Now), StatisticsHelper.WordLogType.grasp);
            ungraspList = new List <string>();
            setTag(this);//调用方法
            dictList = DictHelper.GenerateDictList();
            dictDict = DictHelper.ReadDictDict();
            CbxDictionary.DataSource = dictList;
            MoveControl moveControl = new MoveControl(Tbx);
        }
Ejemplo n.º 8
0
    private void SetPosClipValue(int isOn, float zPos, Color color)
    {
        if (SMR == null || SMR.Length < 1)
        {
            return;
        }
        Matrix4x4 localSpace = transform.worldToLocalMatrix;

        foreach (var r in SMR)
        {
            for (int i = 0; i < r.sharedMesh.subMeshCount; i++)
            {
                r.GetPropertyBlock(MPB, i);
                MPB.SetMatrix(localSpaceProp, localSpace);
                MPB.SetInt(_UsePosClipProp, isOn);
                MPB.SetFloat(_PosMaskZProp, zPos);
                MPB.SetColor(_PosMaskEdgeColorProp, color);
                r.SetPropertyBlock(MPB, i);
            }
        }
    }
Ejemplo n.º 9
0
 private void SetProgressBar(int num)
 {
     MPB.SetProgress(num);
 }
Ejemplo n.º 10
0
        public void SetAlpha(float alpha, bool trackValue = true)
        {
            if (!ShaderProperties)
            {
                return;
            }

            if (FadeMode == Modes.SeparateMaterials)
            {
                if (!OpaqueMaterial || !TransparentMaterial)
                {
                    return;
                }

                //set opaque or transparent material
                Material m = Mathf.Approximately(alpha, 1) ? OpaqueMaterial : TransparentMaterial;
                if (CurrentMaterial != m)
                {
                    SetMaterial(m);
                    CurrentMaterial = m;
                }
            }

            for (int i = 0; i < Renderers.Length; i++)
            {
                //for each renderer:
                Renderer r = Renderers[i];

                //just skip null/missing renderers for now - not sure how to keep the list up to date in every situation yet
                if (!r)
                {
                    continue;
                }

                //turn renderer on or off
                if (Mathf.Approximately(alpha, 0f))
                {
                    if (r.enabled)
                    {
                        r.enabled = false;
                    }
                }
                else if (!r.enabled)
                {
                    r.enabled = true;
                }

                //initialize property block with default material values
                ShaderProperties.SetProperties(MPB, r.sharedMaterial, clear: true);

                //add per-renderer colors back in
                PerRendererColor prc = r.GetComponent <PerRendererColor>();
                if (prc && prc.enabled)
                {
                    MPB.SetColor(prc.ColorName, prc.Color);
                }

                //scale alpha based on min/max alpha
                float scaledAlpha = Mathf.Lerp(MinAlpha, MaxAlpha, alpha);

                //set alpha value of all colors
                ShaderProperties.SetAlpha(MPB, scaledAlpha);

                //apply property block
                r.SetPropertyBlock(MPB);
            }

            if (trackValue)
            {
                CurrentValue = alpha;
            }
        }