//--------------------------------------------------- //-------------------Constructeurs------------------- //--------------------------------------------------- public TabBarPropertyConverter(CoronaWidget widget, Form1 MainForm) : base(widget,MainForm) { this.tabBar = (WidgetTabBar)widget; }
//--------------------------------------------------- //-------------------Constructeurs------------------- //--------------------------------------------------- public WidgetPropertyConverter(CoronaWidget widget, Form1 MainForm) { this.widget = widget; this.MainForm = MainForm; }
private void treeViewElements_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (hasChecked == false) { try { bool isCustomBuild = this.MainForm.IsCustomBuild; float XRatio = 1; float YRatio = 1; if (isCustomBuild == true) { XRatio = (float)this.MainForm.currentTargetResolution.Resolution.Width / (float)this.MainForm.CurrentProject.width; YRatio = (float)this.MainForm.currentTargetResolution.Resolution.Height / (float)this.MainForm.CurrentProject.height; } //Recuperer la node Project root ProjectRootNodeSelected = getRootNode(e.Node); ProjectSelected = (CoronaGameProject)ProjectRootNodeSelected.Tag; //Si il y a deja un panel Physic d'ouvert : Le fermer if (this.MainForm.CurrentObjectPhysicEditorPanel != null) if (this.MainForm.getMapEditorPage().Controls.Contains(this.MainForm.CurrentObjectPhysicEditorPanel)) { this.MainForm.getMapEditorPage().Controls.Remove(this.MainForm.CurrentObjectPhysicEditorPanel); } //SI la node selectionnée est un game element if (e.Node == this.ProjectRootNodeSelected) { ProjectPropertyConverter converter = new ProjectPropertyConverter(this.ProjectSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } if (e.Node.Name.Equals("GAME_ELEMENT")) { //Faire le traitement de selection GameElement nodeSelected = (GameElement)e.Node; if (nodeSelected.NodeType.Equals("STAGE")) { this.SceneSelected = ((Scene)nodeSelected.InstanceObjet); this.MainForm.sceneEditorView1.objectsSelected.Clear(); this.MainForm.sceneEditorView1.setModeSceneEditor(this.SceneSelected); //Deselect others if (this.LayerSelected != null) { this.LayerSelected.deselectAllObjects(); this.LayerSelected.deselectAllControls(); } this.LayerSelected = null; this.CoronaObjectSelected = null; //Afficher les proprietes du layer dans le property grid ScenePropertyConverter sceneConverter = new ScenePropertyConverter(this.SceneSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = sceneConverter; //Mettre a jour le fichier lua this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio); } else if (nodeSelected.NodeType.Equals("LAYER")) { //Deselect others if (this.LayerSelected != null) { this.LayerSelected.deselectAllObjects(); this.LayerSelected.deselectAllControls(); } this.LayerSelected = ((CoronaLayer)nodeSelected.InstanceObjet); this.LayerSelected.deselectAllObjects(); this.LayerSelected.deselectAllControls(); this.MainForm.sceneEditorView1.objectsSelected.Clear(); this.SceneSelected = this.LayerSelected.SceneParent; this.CoronaObjectSelected = null; this.MainForm.sceneEditorView1.setModeLayerEditor(this.LayerSelected); //Afficher les proprietes du layer dans le property grid LayerPropertyConverter layerConverter = new LayerPropertyConverter(this.LayerSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = layerConverter; //Mettre a jour le fichier lua //this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio); } else if (nodeSelected.NodeType.Equals("OBJECT") || nodeSelected.NodeType.Equals("ENTITY")) { CoronaObject obj = ((CoronaObject)nodeSelected.InstanceObjet); //Selectionner le layer parent this.LayerSelected = obj.LayerParent; if (nodeSelected.NodeType.Equals("ENTITY")) { this.MainForm.SetModeEntity(); //this.LayerSelected.deselectAllObjects(); } else this.MainForm.SetModeObject(); //Fermer le layer et la scene this.SceneSelected = this.LayerSelected.SceneParent; this.CoronaObjectSelected = obj; //Mettre a jour le fichier lua //this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio); /*if (this.MainForm.isFormLocked == false) this.MainForm.sceneEditorView1.surfacePictBx.Refresh();*/ } else if (nodeSelected.NodeType.Equals("TILESMAP")) { this.MainForm.SetModeObject(); TilesMap map = ((TilesMap)nodeSelected.InstanceObjet); //Selectionner le layer parent this.CoronaObjectSelected = null; this.LayerSelected = (CoronaLayer)((GameElement)nodeSelected.Parent).InstanceObjet; this.SceneSelected = this.LayerSelected.SceneParent; //Deselect all objects this.LayerSelected.deselectAllObjects(); //Afficher les proprietes de l'objet dans le property grid TilesMapPropertyConverter mapConverter = new TilesMapPropertyConverter(map, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = mapConverter; if (this.MainForm.isFormLocked == false) GorgonLibrary.Gorgon.Go(); } else if (nodeSelected.NodeType.Equals("CONTROL")) { this.MainForm.SetModeControl(); CoronaControl control = ((CoronaControl)nodeSelected.InstanceObjet); this.ControlSelected = control; if (control.type == CoronaControl.ControlType.joystick) { JoystickControl joy = (JoystickControl)control; JoystickPropertyConverter joyConverter = new JoystickPropertyConverter(joy, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = joyConverter; } } else if (nodeSelected.NodeType.Equals("WIDGET")) { CoronaWidget widget = ((CoronaWidget)nodeSelected.InstanceObjet); this.WidgetSelected = widget; widget.Type = CoronaWidget.WidgetType.tabBar; if (widget.Type == CoronaWidget.WidgetType.tabBar) { TabBarPropertyConverter converter = new TabBarPropertyConverter(widget, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (widget.Type == CoronaWidget.WidgetType.pickerWheel) { WidgetPickerWheel pickerW = (WidgetPickerWheel)widget; this.MainForm.propertyGrid1.SelectedObject = pickerW; } } else if (nodeSelected.NodeType.Equals("JOINT")) { CoronaJointure joint = nodeSelected.InstanceObjet as CoronaJointure; this.MainForm.setModeJoint(); //Selectionner le layer parent this.CoronaObjectSelected = null; this.JointureSelected = joint; this.LayerSelected = joint.layerParent; this.LayerSelected.JointureSelected = joint; this.SelectedNodes.Add(nodeSelected); this.MainForm.sceneEditorView1.setModeLayerEditor(joint.layerParent); //Ouvrir le property converter correspondant au joint if (this.JointureSelected.type.Equals("DISTANCE")) { DistancePropertyConverter converter = new DistancePropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("FRICTION")) { FrictionPropertyConverter converter = new FrictionPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("PISTON")) { PistonPropertyConverter converter = new PistonPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("PIVOT")) { PivotPropertyConverter converter = new PivotPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("WELD")) { WeldPropertyConverter converter = new WeldPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("WHEEL")) { WheelPropertyConverter converter = new WheelPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("PULLEY")) { PulleyPropertyConverter converter = new PulleyPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } else if (this.JointureSelected.type.Equals("TOUCH")) { TouchPropertyConverter converter = new TouchPropertyConverter(this.JointureSelected, this.MainForm); this.MainForm.propertyGrid1.SelectedObject = converter; } //Mettre a jour le fichier lua this.MainForm.cgEeditor1.RefreshSceneLuaCode(this.SceneSelected, isCustomBuild, XRatio, YRatio); } else if (nodeSelected.NodeType.Equals("AUDIO")) { this.AudioObjectSelected = (AudioObject)nodeSelected.InstanceObjet; } else if (nodeSelected.NodeType.Equals("SNIPPET")) { this.SnippetSelected = (Snippet)nodeSelected.InstanceObjet; this.MainForm.cgEeditor1.RefreshSnippetLuaCode(this.ProjectSelected); } else if (nodeSelected.NodeType.Equals("FONT")) { this.FontSelected = (FontItem)nodeSelected.InstanceObjet; } //------------Verifier si le clic est un clic droit if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (nodeSelected.NodeType.Equals("STAGE")) { this.treeViewElements.ContextMenuStrip = this.menuScene; this.treeViewElements.ContextMenuStrip.Show(); this.LayerSelected = null; } else if (nodeSelected.NodeType.Equals("LAYER")) { this.treeViewElements.ContextMenuStrip = this.menuLayer; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("OBJECT") || nodeSelected.NodeType.Equals("ENTITY")) { CoronaObject obj = ((CoronaObject)nodeSelected.InstanceObjet); activerBoutonsNecessairesMenuObject(obj); this.treeViewElements.ContextMenuStrip = this.menuObject; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("CONTROL")) { this.treeViewElements.ContextMenuStrip = this.menuControl; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("WIDGET")) { CoronaWidget widget = (CoronaWidget)nodeSelected.InstanceObjet; if (widget.Type == CoronaWidget.WidgetType.tabBar) { this.treeViewElements.ContextMenuStrip = this.menuWidgetTabBar; this.treeViewElements.ContextMenuStrip.Show(); } else if (widget.Type == CoronaWidget.WidgetType.pickerWheel) { this.treeViewElements.ContextMenuStrip = this.menuWidgetPickerWheel; this.treeViewElements.ContextMenuStrip.Show(); } } else if (nodeSelected.NodeType.Equals("SPRITESHEET") || nodeSelected.NodeType.Equals("SPRITESET")) { this.treeViewElements.ContextMenuStrip = this.menuSpriteSetSheet; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("JOINT")) { this.treeViewElements.ContextMenuStrip = this.menuJointures; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("AUDIO")) { this.treeViewElements.ContextMenuStrip = this.menuAudio; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("TILESMAP")) { this.treeViewElements.ContextMenuStrip = this.menuTilesmap; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("SNIPPET")) { this.treeViewElements.ContextMenuStrip = this.menuSnippets; this.treeViewElements.ContextMenuStrip.Show(); } else if (nodeSelected.NodeType.Equals("FONT")) { this.treeViewElements.ContextMenuStrip = this.fontMenu; this.treeViewElements.ContextMenuStrip.Show(); } else this.treeViewElements.ContextMenuStrip = null; } else this.treeViewElements.ContextMenuStrip = null; } else if (e.Node.Name.Equals("PROJECT")) { //Verifier si le clic est un clic droit if (e.Button == System.Windows.Forms.MouseButtons.Right) { this.treeViewElements.ContextMenuStrip = this.menuProject; this.treeViewElements.ContextMenuStrip.Show(); } } else this.treeViewElements.ContextMenuStrip = null; } catch (Exception ex) { Application.Exit(); } } }
//---------------------------------------------------------- //----------------Corona Widget----------------------- //---------------------------------------------------------- public void newCoronaWidget(CoronaWidget widget) { if (this.LayerSelected != null) { GameElement node = new GameElement("WIDGET", widget.Name, widget); node.Checked = false; GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, LayerSelected); if (layerNode != null) { layerNode.Nodes.Add(node); } } }
public void removeCoronaWidget(CoronaWidget widget) { if (this.LayerSelected != null) { GameElement layerNode = getNodeFromObjectInstance(this.ProjectRootNodeSelected.Nodes, LayerSelected); if (layerNode != null) { GameElement gElementWidget= this.getNodeFromObjectInstance(layerNode.Nodes, widget); if (gElementWidget != null) { if (this.SelectedNodes.Contains(gElementWidget)) this.SelectedNodes.Remove(gElementWidget); LayerSelected.Widgets.Remove(widget); layerNode.Nodes.Remove(gElementWidget); } widget = null; } } this.MainForm.propertyGrid1.SelectedObject = null; if (this.MainForm.isFormLocked == false) GorgonLibrary.Gorgon.Go(); }