Beispiel #1
0
 private void MoveUpBt_Click(object sender, EventArgs e)
 {
     if (FinalList.SelectedItems.Count > 0)
     {
         int    selectedId    = FinalList.SelectedIndex;
         string insertContent = FinalList.SelectedItem.ToString();
         if (selectedId > 0)
         {
             FinalList.Items.Insert(selectedId - 1, insertContent);
             FinalList.Items.RemoveAt(selectedId + 1);
             FinalList.SetSelected(selectedId - 1, true);
         }
     }
 }
Beispiel #2
0
        //SPACE DOWN
        private void PressSpaceKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
            {
                //TODO:
                var finalcount    = FinalList.Items.Count;
                var selectedindex = FinalList.SelectedIndex;

                if (selectedindex < finalcount)
                {
                    String   selectedMaterial = FinalList.SelectedItem.ToString();
                    string[] s          = selectedMaterial.Split(new char[] { '|' });
                    var      ExecuteNum = s.Length;
                    for (int i = 0; i < ExecuteNum; i++)
                    {
                        if (s[i][0] == '#')
                        {
                            string[] AnimateS = s[i].Split(new char[] { ',' });
                            string[] stemp    = AnimateS[0].Split(new char[] { '#' });
                            AnimateExecute(stemp[1], AnimateS[1]);
                        }
                        else
                        {
                            string[] PropertiseS = s[i].Split(new char[] { ',' });
                            var      Proinstance = nodeGraph.Nodes[PropertiseS[0]];
                            var      ZDProType   = nodeGraph.Nodes[PropertiseS[0]].Properties[PropertiseS[1]].DependencyObjectType.Name;
                            switch (ZDProType)
                            {
                            case "ZDProperty_String":
                                if (PropertiseS[1].Equals("NodeName"))
                                {
                                    MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                                    DialogResult      dr         = MessageBox.Show("不可修改NodeName,若要修改请联系管理员", "退出", messButton);
                                    if (dr == DialogResult.OK)      //如果点击“确定”按钮
                                    {
                                        this.Close();
                                    }
                                    else    //如果点击“取消”按钮
                                    {
                                        this.Close();
                                    }
                                }
                                else
                                {
                                    (Proinstance.Properties[PropertiseS[1]] as ZDProperty_String).Value = PropertiseS[2];
                                }

                                break;

                            case "ZDProperty_Float":
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Float).Value = Convert.ToSingle(PropertiseS[2]);



                                break;

                            case "ZDProperty_Boolean":
                                var tbool = false;
                                if (PropertiseS[2].Equals("true"))
                                {
                                    tbool = true;
                                }
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Boolean).Value = tbool;


                                break;

                            case "ZDProperty_Integer":
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Integer).Value = Convert.ToInt32(PropertiseS[2]);

                                break;

                            case "ZDProperty_Transform":
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Location.X     = Convert.ToSingle(PropertiseS[2]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Location.Y     = Convert.ToSingle(PropertiseS[3]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Location.Z     = Convert.ToSingle(PropertiseS[4]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Rotation.Roll  = Convert.ToSingle(PropertiseS[5]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Rotation.Yaw   = Convert.ToSingle(PropertiseS[6]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Rotation.Pitch = Convert.ToSingle(PropertiseS[7]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Scale.X        = Convert.ToSingle(PropertiseS[8]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Scale.Y        = Convert.ToSingle(PropertiseS[9]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Transform).Value.Scale.Z        = Convert.ToSingle(PropertiseS[10]);

                                break;

                            case "ZDProperty_Color":
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Color).Value.R = Convert.ToSingle(PropertiseS[2]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Color).Value.G = Convert.ToSingle(PropertiseS[3]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Color).Value.B = Convert.ToSingle(PropertiseS[4]);
                                (Proinstance.Properties[PropertiseS[1]] as ZDProperty_Color).Value.A = Convert.ToSingle(PropertiseS[5]);

                                break;

                            default: break;
                            }
                        }
                    }

                    if (selectedindex + 1 == finalcount)
                    {
                    }
                    else
                    {
                        FinalList.SetSelected(selectedindex + 1, true);
                    }
                }
            }
            else
            {
            }
        }