private void btn_scale_negative_Click(object sender, EventArgs e) { GameObject_Scene_EDITOR gameObject = editor_handle.GetActiveGameObject(); if (gameObject != null) { if (gameObject.obj.scaling_rate > 0) { gameObject.obj.scaling_rate -= 1f; gameObject.obj.UpdateScale(1f, true); for (int cnt = 0; cnt < editor_handle.gameObjectScene_list.Count; cnt++) { Editor.GameObject_Scene gameObj = editor_handle.gameObjectScene_list[cnt]; if (editor_handle.gameObjectScene_list[cnt].instance_name == gameObject._obj.instance_name) { gameObj.scaling_rate -= 1f; editor_handle.gameObjectScene_list[cnt] = gameObj; editor_handle.UpdateWorldChilds(editor_handle.gameObjectScene_list[cnt]); break; } } } } }
private void ChildEditor_Load(object sender, EventArgs e) { GameObject_Scene_EDITOR gameObj = null; if ((gameObj = editor_handle.GetActiveGameObject()) == null) { MessageBox.Show("No selected object found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close( ); } cb_objects.Items.Clear(); foreach (Editor.GameObject_Scene gameObject in editor_handle.gameObjectScene_list) { if (gameObject.instance_name != gameObj._obj.instance_name) { cb_objects.Items.Add(gameObject.instance_name); } } lb_childs.Items.Clear(); foreach (Editor.GameObject_Scene gameObject in gameObj.obj.child_list) { if (gameObject.instance_name != gameObj._obj.instance_name) { lb_childs.Items.Add(gameObject.instance_name); } } }
private void btn_delete_Click(object sender, EventArgs e) { GameObject_Scene_EDITOR gameObj = null; if ((gameObj = editor_handle.GetActiveGameObject()) == null) { MessageBox.Show("No selected object found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close( ); } if (lb_childs.SelectedIndex < 0) { return; } for (int cnt = 0; cnt < gameObj.obj.child_list.Count; cnt++) { if (gameObj.obj.child_list[cnt].instance_name == (string)lb_childs.Items[lb_childs.SelectedIndex]) { gameObj.obj.child_list.RemoveAt(cnt); ChildEditor_Load(null, null); // Reload our lists. return; } } }
private void btn_rotate_anticlockwise_Click(object sender, EventArgs e) { GameObject_Scene_EDITOR gameObject = editor_handle.GetActiveGameObject( ); if (gameObject != null) { gameObject.obj.Rotate(1f); gameObject.obj.UpdateRotation(1f, gameObject.obj.position_scene_x + gameObject.obj.mainObject.object_img.Width / 2, gameObject.obj.position_scene_y + gameObject.obj.mainObject.object_img.Height / 2, true); for (int cnt = 0; cnt < editor_handle.gameObjectScene_list.Count; cnt++) { Editor.GameObject_Scene gameObj = editor_handle.gameObjectScene_list[cnt]; if (editor_handle.gameObjectScene_list[cnt].instance_name == gameObject._obj.instance_name) { gameObj.Rotate(1f); editor_handle.gameObjectScene_list[cnt] = gameObj; editor_handle.UpdateWorldChilds(editor_handle.gameObjectScene_list[cnt]); break; } } } }
private void btn_add_child_Click(object sender, EventArgs e) { GameObject_Scene_EDITOR gameObject = null; if ((gameObject = editor_handle.GetActiveGameObject()) == null) { MessageBox.Show("No selected object found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } if (cb_objects.SelectedIndex != -1) { bool isSuccess = false; foreach (Editor.GameObject_Scene gameObj in editor_handle.gameObjectScene_list) { if (gameObj.instance_name == gameObject._obj.instance_name) { isSuccess = true; break; } } if (!isSuccess) { MessageBox.Show("The GameObject is deleted from the scene."); ChildEditor_Load(null, null); // Reload our list. } else { isSuccess = false; for (int cnt = 0; cnt < editor_handle.gameObjectScene_list.Count; cnt++) { Editor.GameObject_Scene obj = editor_handle.gameObjectScene_list[cnt]; if (addChild(ref gameObject.obj, ref obj, (string)cb_objects.Items[cb_objects.SelectedIndex])) { editor_handle.gameObjectScene_list[cnt] = obj; ChildEditor_Load(null, null); isSuccess = true; break; } } if (!isSuccess) { if (!addChild(ref gameObject.obj, ref gameObject.obj, (string)cb_objects.Items[cb_objects.SelectedIndex])) { for (int cnt = 0; cnt < editor_handle.gameObjectScene_list.Count; cnt++) { if (editor_handle.gameObjectScene_list[cnt].instance_name == (string)cb_objects.Items[cb_objects.SelectedIndex]) { gameObject.obj.child_list.Add(editor_handle.gameObjectScene_list[cnt]); ChildEditor_Load(null, null); return; } } } } } } }