Beispiel #1
0
 /// <summary>
 /// Inicializa uma nova instância da classe <see cref="Spartacus.Forms.Form"/>.
 /// </summary>
 /// <param name="p_parent">Janela pai.</param>
 public Form(Spartacus.Forms.Window p_parent)
     : base()
 {
     this.v_type          = Spartacus.Forms.FormType.CHILD;
     this.v_parent        = p_parent;
     this.VisibleChanged += new System.EventHandler(OnVisibleChanged);
 }
Beispiel #2
0
        private void OnMainUpdateClick(object sender, System.EventArgs e)
        {
            System.Data.DataRow v_row = this.v_maingrid.CurrentRow();

            this.v_reportwindow = new Spartacus.Forms.Window(
                System.Configuration.ConfigurationManager.AppSettings["reportupdate.title"].ToString(),
                600,
                150,
                this.v_mainwindow
                );

            this.v_reportname = new Spartacus.Forms.Textbox(this.v_reportwindow, System.Configuration.ConfigurationManager.AppSettings["reportupdate.name"].ToString());
            this.v_reportname.SetValue(v_row["name"].ToString());
            this.v_reportwindow.Add(this.v_reportname);

            this.v_reportxmlfile = new Spartacus.Forms.Filepicker(
                this.v_reportwindow,
                Spartacus.Forms.Filepicker.Type.OPEN,
                System.Configuration.ConfigurationManager.AppSettings["reportupdate.xmlfile"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["reportupdate.filter"].ToString()
                );
            this.v_reportxmlfile.SetValue(v_row["xmlfile"].ToString());
            this.v_reportwindow.Add(this.v_reportxmlfile);

            this.v_reportbuttons = new Spartacus.Forms.Buttons(this.v_reportwindow);
            this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportupdate.save"].ToString(), this.OnReportUpdateSaveClick);
            this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportupdate.cancel"].ToString(), this.OnReportUpdateCancelClick);
            this.v_reportwindow.Add(this.v_reportbuttons);

            this.v_reportwindow.Show();
        }
Beispiel #3
0
        public void Initialize()
        {
            v_window = new Spartacus.Forms.Window("Spartacus Pong", 800, 600);

            v_racket_left = new Spartacus.Game.Object("RL", 20, (v_window.v_height - 100) / 2, 20, 100);
            v_racket_left.AddImage("racket.png");

            v_racket_right = new Spartacus.Game.Object("RR", v_window.v_width - 40, (v_window.v_height - 100) / 2, 20, 100);
            v_racket_right.AddImage("racket.png");

            v_ball = new Spartacus.Game.Object("B", v_window.v_width / 2, v_window.v_height / 2, 15, 15);
            v_ball.AddImage("ball.png");
            v_ball_x = 10;
            v_ball_y = 10;

            v_bound_up    = new Spartacus.Game.Object("BU", 0, 0, v_window.v_width, 10);
            v_bound_down  = new Spartacus.Game.Object("BD", 0, v_window.v_height - 10, v_window.v_width, 10);
            v_bound_left  = new Spartacus.Game.Object("BL", 0, 0, 10, v_window.v_height);
            v_bound_right = new Spartacus.Game.Object("BR", v_window.v_width - 10, 0, 10, v_window.v_height);

            v_score_left = new Spartacus.Game.Text(80, 10, "Courier New", 14, 255, 255, 255, 255);
            v_score_left.SetMessage("0");

            v_score_right = new Spartacus.Game.Text(v_window.v_width - 100, 10, "Courier New", 14, 255, 255, 255, 255);
            v_score_right.SetMessage("0");

            v_text_paused = new Spartacus.Game.Text((v_window.v_width - 50) / 2, 10, "Courier New", 14, 255, 255, 255, 255);
            v_text_paused.SetMessage("");
            v_paused = false;

            v_layer = new Spartacus.Game.Layer();
            v_layer.AddObject(v_racket_left);
            v_layer.AddObject(v_racket_right);
            v_layer.AddObject(v_ball);
            v_layer.AddObject(v_bound_up);
            v_layer.AddObject(v_bound_down);
            v_layer.AddObject(v_bound_left);
            v_layer.AddObject(v_bound_right);
            v_layer.AddText(v_score_left);
            v_layer.AddText(v_score_right);
            v_layer.AddText(v_text_paused);
            v_layer.Collision += this.OnCollision;

            v_keyboard           = new Spartacus.Game.Keyboard(v_window);
            v_keyboard.KeyDown  += this.OnKeyDown;
            v_keyboard.KeyPress += this.OnKeyPress;
            v_keyboard.Start(60);

            v_level = new Spartacus.Game.Level(v_window);
            v_level.AddLayer(v_layer);
            v_level.Time += this.OnTime;
            v_level.Start(30);

            v_window.Run();
        }
        /// <summary>
        /// Inicializa uma nova instância da classe <see cref="Spartacus.Forms.Window"/>.
        /// </summary>
        /// <param name="p_text">Título da Janela.</param>
        /// <param name="p_width">Largura da Janela.</param>
        /// <param name="p_height">Altura da Janela.</param>
        /// <param name="p_parent">Janela pai.</param>
        public Window(string p_text, int p_width, int p_height, Spartacus.Forms.Window p_parent)
            : base()
        {
            this.v_control = new Spartacus.Forms.Form(p_parent);
            ((Spartacus.Forms.Form) this.v_control).Resize += new System.EventHandler(this.OnResize);

            this.v_control.Text = p_text;

            this.SetWidth(p_width);
            this.SetHeight(p_height);
        }
Beispiel #5
0
        public void Initialize()
        {
            try
            {
                if (new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["database"].ToString()).Exists)
                {
                    this.v_database = new Spartacus.Database.Sqlite(System.Configuration.ConfigurationManager.AppSettings["database"].ToString());
                }
                else
                {
                    this.v_database = new Spartacus.Database.Sqlite();
                    this.v_database.CreateDatabase(System.Configuration.ConfigurationManager.AppSettings["database"].ToString());
                    this.v_database.Execute("create table reports (code integer primary key autoincrement, name text, xmlfile text not null);");
                }

                this.v_mainwindow = new Spartacus.Forms.Window(
                    System.Configuration.ConfigurationManager.AppSettings["main.title"].ToString(),
                    600,
                    400
                    );

                this.v_maingrid = new Spartacus.Forms.Grid(this.v_mainwindow, 300);
                this.v_maingrid.Populate(this.v_database, "select * from reports");
                this.v_mainwindow.Add(this.v_maingrid);

                this.v_editable = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["editable"].ToString());

                this.v_mainbuttons = new Spartacus.Forms.Buttons(this.v_mainwindow);
                this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.execute"].ToString(), this.OnMainExecuteClick);
                this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.insert"].ToString(), this.OnMainInsertClick, this.v_editable);
                this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.update"].ToString(), this.OnMainUpdateClick, this.v_editable);
                this.v_mainbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["main.delete"].ToString(), this.OnMainDeleteClick, this.v_editable);
                this.v_mainwindow.Add(this.v_mainbuttons);

                this.v_mainwindow.Run();
            }
            catch (Spartacus.Database.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Database.Exception", Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
            catch (Spartacus.Forms.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Forms.Exception", Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
            catch (System.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.Message, exc.GetType().ToString(), Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
        }
Beispiel #6
0
        public Keyboard(Spartacus.Forms.Window p_window)
        {
            this.v_keysdown      = new System.Collections.Generic.List <Spartacus.Game.Keys>();
            this.v_keysdown_lock = new object();

            this.v_timer       = new System.Windows.Forms.Timer();
            this.v_timer.Tick += new System.EventHandler(this.OnTimer);

            ((System.Windows.Forms.Form)p_window.v_control).KeyPreview      = true;
            ((System.Windows.Forms.Form)p_window.v_control).PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.OnPreviewKeyDown);
            ((System.Windows.Forms.Form)p_window.v_control).KeyDown        += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
            ((System.Windows.Forms.Form)p_window.v_control).KeyUp          += new System.Windows.Forms.KeyEventHandler(this.OnKeyUp);
            ((System.Windows.Forms.Form)p_window.v_control).KeyPress       += new System.Windows.Forms.KeyPressEventHandler(this.OnKeyPressed);
        }
        public Level(Spartacus.Forms.Window p_window)
        {
            this.v_layers = new System.Collections.Generic.List <Spartacus.Game.Layer>();

            this.v_screen = (System.Windows.Forms.Form)p_window.v_control;

            this.v_context = System.Drawing.BufferedGraphicsManager.Current;
            this.v_context.MaximumBuffer = new System.Drawing.Size(this.v_screen.Width + 1, this.v_screen.Height + 1);

            this.v_bufferedgraphics = v_context.Allocate(this.v_screen.CreateGraphics(), new System.Drawing.Rectangle(0, 0, this.v_screen.Width, this.v_screen.Height));

            this.v_timer       = new System.Windows.Forms.Timer();
            this.v_timer.Tick += new System.EventHandler(this.OnTimer);

            ((System.Windows.Forms.Form)p_window.v_control).MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnMouseClick);
        }
Beispiel #8
0
        private void OnMainInsertClick(object sender, System.EventArgs e)
        {
            try
            {
                this.v_reportwindow = new Spartacus.Forms.Window(
                    System.Configuration.ConfigurationManager.AppSettings["reportinsert.title"].ToString(),
                    600,
                    150,
                    this.v_mainwindow
                    );

                this.v_reportname = new Spartacus.Forms.Textbox(this.v_reportwindow, System.Configuration.ConfigurationManager.AppSettings["reportinsert.name"].ToString());
                this.v_reportwindow.Add(this.v_reportname);

                this.v_reportxmlfile = new Spartacus.Forms.Filepicker(
                    this.v_reportwindow,
                    Spartacus.Forms.Filepicker.Type.OPEN,
                    System.Configuration.ConfigurationManager.AppSettings["reportinsert.xmlfile"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["reportinsert.filter"].ToString()
                    );
                this.v_reportwindow.Add(this.v_reportxmlfile);

                this.v_reportbuttons = new Spartacus.Forms.Buttons(this.v_reportwindow);
                this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportinsert.save"].ToString(), this.OnReportInsertSaveClick);
                this.v_reportbuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["reportinsert.cancel"].ToString(), this.OnReportInsertCancelClick);
                this.v_reportwindow.Add(this.v_reportbuttons);

                this.v_reportwindow.Show();
            }
            catch (Spartacus.Forms.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Forms.Exception", Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
            catch (System.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.Message, exc.GetType().ToString(), Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Inicializa uma nova instância da classe <see cref="Spartacus.Forms.Form"/>.
 /// </summary>
 public Form()
     : base()
 {
     this.v_type   = Spartacus.Forms.FormType.PARENT;
     this.v_parent = null;
 }
Beispiel #10
0
        private void OnMainExecuteClick(object sender, System.EventArgs e)
        {
            System.Data.DataRow v_row = this.v_maingrid.CurrentRow();

            try
            {
                this.v_currentcode = int.Parse(v_row["code"].ToString());
                this.v_currentfile = v_row["xmlfile"].ToString();
                this.v_report      = new Spartacus.Reporting.Report(this.v_currentcode, this.v_currentfile);

                this.v_paramwindow = new Spartacus.Forms.Window(
                    System.Configuration.ConfigurationManager.AppSettings["param.title"].ToString(),
                    500,
                    500,
                    this.v_mainwindow
                    );

                for (int k = 0; k < this.v_report.v_cmd.v_parameters.Count; k++)
                {
                    if (this.v_report.v_cmd.v_parameters[k].v_type == Spartacus.Database.Type.DATE)
                    {
                        Spartacus.Forms.Datetimepicker v_param = new Spartacus.Forms.Datetimepicker(
                            this.v_paramwindow,
                            this.v_report.v_cmd.v_parameters[k].v_description,
                            "dd/MM/yyyy"
                            );
                        this.v_paramwindow.Add(v_param);
                    }
                    else
                    {
                        if (this.v_report.v_cmd.v_parameters[k].v_lookup != null &&
                            this.v_report.v_cmd.v_parameters[k].v_lookup != "")
                        {
                            Spartacus.Forms.Lookup v_param = new Spartacus.Forms.Lookup(
                                this.v_paramwindow,
                                this.v_report.v_cmd.v_parameters[k].v_description
                                );
                            v_param.Populate(this.v_report.v_database, this.v_report.v_cmd.v_parameters[k].v_lookup, "80;150");
                            this.v_paramwindow.Add(v_param);
                        }
                        else
                        {
                            Spartacus.Forms.Textbox v_param = new Spartacus.Forms.Textbox(
                                this.v_paramwindow,
                                this.v_report.v_cmd.v_parameters[k].v_description
                                );
                            this.v_paramwindow.Add(v_param);
                        }
                    }
                }

                this.v_reportpdffile = new Spartacus.Forms.Filepicker(
                    this.v_paramwindow,
                    Spartacus.Forms.Filepicker.Type.SAVE,
                    System.Configuration.ConfigurationManager.AppSettings["param.pdffile"].ToString(),
                    System.Configuration.ConfigurationManager.AppSettings["param.filter"].ToString()
                    );
                this.v_paramwindow.Add(this.v_reportpdffile);

                this.v_parambuttons = new Spartacus.Forms.Buttons(this.v_paramwindow);
                this.v_parambuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["param.execute"].ToString(), this.OnParamExecuteClick);
                this.v_parambuttons.AddButton(System.Configuration.ConfigurationManager.AppSettings["param.cancel"].ToString(), this.OnParamCancelClick);
                this.v_paramwindow.Add(this.v_parambuttons);

                this.v_progressbar = new Spartacus.Forms.Progressbar(this.v_paramwindow);
                this.v_progressbar.SetValue("Aguardando início", 0);
                this.v_paramwindow.Add(this.v_progressbar);

                this.v_paramwindow.Show();
            }
            catch (Spartacus.Database.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Database.Exception", Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
            catch (Spartacus.Reporting.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Reporting.Exception", Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
            catch (Spartacus.Forms.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.v_message, "Spartacus.Forms.Exception", Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
            catch (System.Exception exc)
            {
                Spartacus.Forms.Messagebox.Show(exc.Message, exc.GetType().ToString(), Spartacus.Forms.Messagebox.Icon.ERROR);
                System.Environment.Exit(-1);
            }
        }
Beispiel #11
0
        public void Initialize()
        {
            this.v_window = new Spartacus.Forms.Window("Spartacus OverLord", this.v_window_width, this.v_window_height);

            this.v_database = new Spartacus.Database.Sqlite("overlord.db");

            MapGenerator v_generator = new MapGenerator();

            this.v_tileset = v_generator.Generate(
                this.v_database,
                this.v_map_size,
                this.v_tile_size,
                this.v_tree_chance,
                "and name like 'jungle%'",
                "and name not like 'autumn%'"
                );

            this.v_player      = "green";
            this.v_playercolor = System.Drawing.Color.Green;

            this.v_soldiers    = new Soldier[4];
            this.v_soldiers[0] = new Soldier(
                this.v_database,
                TeamColor.GREEN,
                "green_1",
                2, 3
                );
            this.v_soldiers[1] = new Soldier(
                this.v_database,
                TeamColor.GREEN,
                "green_2",
                2, 4
                );
            this.v_soldiers[2] = new Soldier(
                this.v_database,
                TeamColor.RED,
                "red_1",
                6, 1
                );
            this.v_soldiers[3] = new Soldier(
                this.v_database,
                TeamColor.BLUE,
                "blue_1",
                1, 6
                );

            this.v_selected = -1;
            this.v_action   = "";
            this.v_turn     = TeamColor.GREEN;

            this.v_range = new Range(this.v_tileset, this.v_map_size, this.v_mapview_width, this.v_mapview_height);

            this.v_soldiersview             = new Spartacus.Game.Layer();
            this.v_soldiersview.MouseClick += this.OnSoldierMouseClick;
            this.v_soldiersview.Collision  += this.OnCollision;

            this.v_mapview             = new Spartacus.Game.Layer();
            this.v_mapview.MouseClick += this.OnMapMouseClick;
            this.v_mapview.Collision  += this.OnCollision;
            this.BuildMapView();

            this.v_guiview             = new Spartacus.Game.Layer();
            this.v_guiview.MouseClick += this.OnGuiMouseClick;
            this.v_guiview.Collision  += this.OnCollision;
            this.BuidGuiView();

            this.v_keyboard          = new Spartacus.Game.Keyboard(this.v_window);
            this.v_keyboard.KeyDown += this.OnKeyDown;
            this.v_keyboard.Start(15);

            this.v_level = new Spartacus.Game.Level(this.v_window);
            this.v_level.AddLayer(this.v_mapview);
            this.v_level.AddLayer(this.v_soldiersview);
            this.v_level.AddLayer(this.v_guiview);
            v_level.Time += this.OnTime;
            this.v_level.Start(15);

            this.v_window.Run();
        }