Ejemplo n.º 1
0
 public FrmAddValue(LevelObj s)
 {
     InitializeComponent();
     result = null;
     propertyGrid1.SelectedObject = result;
     resName = null;
     Source  = s;
 }
Ejemplo n.º 2
0
 void LoadObjList(string[] array)
 {
     comboBox1.Items.Clear();
     if (LayerName == "StartInfo")
     {
         comboBox1.Text    = "Mario";
         comboBox1.Enabled = false;
         checkBox1.Enabled = false;
     }
     else if (LayerName == "AreaObjInfo")
     {
         foreach (string s in array)
         {
             if (!s.EndsWith("*") && s.ToLower().EndsWith("area") && !s.ToLower().Contains("camera"))
             {
                 comboBox1.Items.Add(s);
             }
         }
     }
     else if (LayerName == "CameraAreaInfo")
     {
         foreach (string s in array)
         {
             if (!s.EndsWith("*") && s.ToLower().EndsWith("area") && s.ToLower().Contains("camera"))
             {
                 comboBox1.Items.Add(s);
             }
         }
     }
     else if (LayerName == "ObjInfo")
     {
         comboBox1.Items.Add("@CameraPositionHelper");
         foreach (string s in array)
         {
             if (!s.EndsWith("*") && !s.ToLower().EndsWith("area"))
             {
                 comboBox1.Items.Add(s);
             }
         }
     }
     else if (LayerName == "StartEventObjInfo")
     {
         foreach (string s in array)
         {
             if (!s.EndsWith("*") && s.ToLower().StartsWith("startevent"))
             {
                 comboBox1.Items.Add(s);
             }
         }
     }
     else
     {
         comboBox1.Items.AddRange(array);
     }
     Value = null;
 }
Ejemplo n.º 3
0
        public FrmObjEditor(Dictionary <string, object> Lev)
        {
            InitializeComponent();
            Value      = new LevelObj();
            Value.Prop = Lev;
            this.Text  = "Edit object: " + Value.ToString();
            Form1 owner = (Form1)Application.OpenForms["Form1"];

            ObjectDatabase = owner.ObjectDatabase;
        }
Ejemplo n.º 4
0
        public LevelObj Clone()
        {
            LevelObj o = new LevelObj();

            foreach (string k in Prop.Keys.ToArray())
            {
                if (Prop[k] is ICloneable)
                {
                    o.Prop.Add(k, ((ICloneable)Prop[k]).Clone());
                }
                else
                {
                    throw new Exception("Type non cloneable");
                }
            }
            return(o);
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            LevelObj obj = new LevelObj();

            if (LayerName != "StartInfo" && LayerName != "AreaObjInfo")
            {
                if (LayerName != "CameraAreaInfo")
                {
                    obj.Prop.Add("ViewId", new Node("-1", "D1"));
                }
                obj.Prop.Add("CameraId", new Node("-1", "D1"));
            }
            if (LayerName != "StartInfo")
            {
                obj.Prop.Add("l_id", new Node("0", "D1"));
                obj.Prop.Add("Arg", new int[1] {
                    -1
                });
                obj.Prop.Add("SwitchA", new Node("-1", "D1"));
                obj.Prop.Add("SwitchAppear", new Node("-1", "D1"));
                obj.Prop.Add("SwitchB", new Node("-1", "D1"));
                obj.Prop.Add("SwitchKill", new Node("-1", "D1"));
                obj.Prop.Add("SwitchDeadOn", new Node("-1", "D1"));
            }
            else
            {
                obj.Prop.Add("MarioNo", new Node("0", "D1"));
            }
            obj.Prop.Add("LayerName", new Node("共通", "A0"));
            obj.Prop.Add("name", new Node(comboBox1.Text, "A0"));
            obj.Prop.Add("dir_x", new Node("0", "D2"));
            obj.Prop.Add("dir_y", new Node("0", "D2"));
            obj.Prop.Add("dir_z", new Node("0", "D2"));
            obj.Prop.Add("pos_x", new Node(objPos.X.ToString(), "D2"));
            obj.Prop.Add("pos_y", new Node((objPos.Z).ToString(), "D2"));
            obj.Prop.Add("pos_z", new Node((-objPos.Y).ToString(), "D2"));
            obj.Prop.Add("scale_x", new Node("1", "D2"));
            obj.Prop.Add("scale_y", new Node("1", "D2"));
            obj.Prop.Add("scale_z", new Node("1", "D2"));
            Value = obj;
            this.Close();
        }
Ejemplo n.º 6
0
 void PasteValue(ClipBoardItem itm)
 {
     if (Value == null)
     {
         Value = new LevelObj();
     }
     if (itm.Type == ClipBoardItem.ClipboardType.Position)
     {
         if (Value.Prop.ContainsKey("pos_x"))
         {
             ((Node)Value.Prop["pos_x"]).StringValue = itm.X.ToString();
         }
         if (Value.Prop.ContainsKey("pos_y"))
         {
             ((Node)Value.Prop["pos_y"]).StringValue = itm.Y.ToString();
         }
         if (Value.Prop.ContainsKey("pos_z"))
         {
             ((Node)Value.Prop["pos_z"]).StringValue = itm.Z.ToString();
         }
     }
     else if (itm.Type == ClipBoardItem.ClipboardType.Rotation)
     {
         if (Value.Prop.ContainsKey("dir_x"))
         {
             ((Node)Value.Prop["dir_x"]).StringValue = itm.X.ToString();
         }
         if (Value.Prop.ContainsKey("dir_y"))
         {
             ((Node)Value.Prop["dir_y"]).StringValue = itm.Y.ToString();
         }
         if (Value.Prop.ContainsKey("dir_z"))
         {
             ((Node)Value.Prop["dir_z"]).StringValue = itm.Z.ToString();
         }
     }
     else if (itm.Type == ClipBoardItem.ClipboardType.Scale)
     {
         if (Value.Prop.ContainsKey("scale_x"))
         {
             ((Node)Value.Prop["scale_x"]).StringValue = itm.X.ToString();
         }
         if (Value.Prop.ContainsKey("scale_y"))
         {
             ((Node)Value.Prop["scale_y"]).StringValue = itm.Y.ToString();
         }
         if (Value.Prop.ContainsKey("scale_z"))
         {
             ((Node)Value.Prop["scale_z"]).StringValue = itm.Z.ToString();
         }
     }
     else if (itm.Type == ClipBoardItem.ClipboardType.IntArray)
     {
         if (Value.Prop.ContainsKey("Arg"))
         {
             Value.Prop["Arg"] = itm.Args;
         }
         else
         {
             Value.Prop.Add("Arg", itm.Args);
         }
     }
     else if (itm.Type == ClipBoardItem.ClipboardType.Rail)
     {
         if (Value.Prop.ContainsKey("Rail"))
         {
             Value.Prop["Rail"] = itm.Rail.Clone();
         }
         else
         {
             Value.Prop.Add("Rail", itm.Rail.Clone());
         }
     }
     else if (itm.Type == ClipBoardItem.ClipboardType.FullObject)
     {
         string name = itm.Objs[0].ToString();
         if (name == "ObjectChildArea" || name == "SwitchKeepOnArea" || name == "SwitchOnArea")
         {
             if (!Value.Prop.ContainsKey("ChildrenArea"))
             {
                 Value.Prop.Add("ChildrenArea", new C0List());
             }
             ((C0List)Value.Prop["ChildrenArea"]).List.Add(itm.Objs[0].Clone());
         }
         else
         {
             if (!Value.Prop.ContainsKey("GenerateChildren"))
             {
                 Value.Prop.Add("GenerateChildren", new C0List());
             }
             ((C0List)Value.Prop["GenerateChildren"]).List.Add(itm.Objs[0].Clone());
         }
     }
     else if (itm.Type == ClipBoardItem.ClipboardType.ObjectArray)
     {
         foreach (LevelObj o in itm.Objs)
         {
             string name = o.ToString();
             if (name == "ObjectChildArea" || name == "SwitchKeepOnArea" || name == "SwitchOnArea")
             {
                 if (!Value.Prop.ContainsKey("ChildrenArea"))
                 {
                     Value.Prop.Add("ChildrenArea", new C0List());
                 }
                 ((C0List)Value.Prop["ChildrenArea"]).List.Add(o.Clone());
             }
             else
             {
                 if (!Value.Prop.ContainsKey("GenerateChildren"))
                 {
                     Value.Prop.Add("GenerateChildren", new C0List());
                 }
                 ((C0List)Value.Prop["GenerateChildren"]).List.Add(o.Clone());
             }
         }
     }
     propertyGrid1.Refresh();
 }