Пример #1
0
        private void darkTreeView1_SelectedNodesChanged(object sender, EventArgs e)
        {
            if (dtv.SelectedNodes.Count > 0)
            {
                Debug.WriteLine(dtv.SelectedNodes[0].Text);
            }


            if (dtv.SelectedNodes.Count > 0 && execute)
            {
                if ((string)dtv.SelectedNodes[0].Tag != "folder")
                {
                    if (Form1.activeRoom != null)
                    {
                        Sgml.game_save(Path.Combine(Environment.CurrentDirectory, @"Data/" + Form1.activeRoom.Text));
                    }

                    Form1.activeRoom = dtv.SelectedNodes[0];
                    form1.setStatusBottom("Editing " + Form1.activeRoom.Text);


                    if (File.Exists(Path.Combine(Environment.CurrentDirectory, @"Data/" + Form1.activeRoom.Text)))
                    {
                        drawTest1.LoadGame(Path.Combine(Environment.CurrentDirectory,
                                                        @"Data/" + Form1.activeRoom.Text));
                    }
                    else
                    {
                        drawTest1.ClearAll();
                    }
                }
            }

            if (!execute)
            {
                //  execute = true;
            }
        }
Пример #2
0
        private void darkTreeView1_SelectedNodesChanged(object sender, EventArgs e)
        {
            if (dtv.SelectedNodes.Count > 0)
            {
                Debug.WriteLine(dtv.SelectedNodes[0].Text);
            }


            if (dtv.SelectedNodes.Count > 0 && execute)
            {
                if ((string)dtv.SelectedNodes[0].Tag != "folder")
                {
                    string mapContent = Path.Combine(form1.currentProject.RootPath, @"Data\" + dtv.SelectedNodes[0].Text);

                    if (Form1.activeRoom != null)
                    {
                        Sgml.game_save(mapContent, true);
                    }

                    Form1.activeRoom = dtv.SelectedNodes[0];
                    form1.setStatusBottom("Editing " + Form1.activeRoom.Text);


                    if (File.Exists(mapContent))
                    {
                        Root dataDump = Sgml.game_load(mapContent, false);
                        drawTest1.LastRoomState = dataDump;
                    }
                    else
                    {
                        Sgml.currentRoom = (GameRoom)Activator.CreateInstance(Type.GetType("SimplexResources.Rooms." + Form1.activeRoom.Text));

                        Sgml.game_save(mapContent);
                        drawTest1.ClearAll();
                    }
                }
            }
        }