Ejemplo n.º 1
0
 public RegExPresenter(AbstractWindow _window)
 {
     match             = null;
     form              = _window;
     form.MobilePhone += CheckMobileNumber;
     form.AltPhone    += CheckAltNumber;
 }
Ejemplo n.º 2
0
        protected override void StateStarted()
        {
            AbstractWindow pwin = Game.RenderSystem.Window;

            pwin.RemoveAllRegions();
            pwin.Clear();

            Window mainwin = new Window(pwin);

            mainwin.Size  = pwin.Size;
            mainwin.Title = "Sharplike.Tests.UI";
            mainwin.Style = BorderStyle.Double;

            ListBox ols = new ListBox(mainwin);

            ols.Location = new System.Drawing.Point(1, 1);
            ols.Size     = new System.Drawing.Size(11, 5);
            ListBoxItem def = ols.AddItem("New Game");

            ols.AddItem("Load Game");
            ols.AddItem("Quit");

            ols.SelectedItem = def;

            ols.Focus();

            Game.InputSystem.Command.CommandSet = "MainMenu";
        }
Ejemplo n.º 3
0
        public MainMenuState() : base()
        {
            Window = Game.RenderSystem.Window;

            dialogBox                 = new Window(Window);
            dialogBox.Size            = Window.Size;
            dialogBox.Title           = "New Character";
            dialogBox.Style           = BorderStyle.Double;
            dialogBox.ForegroundColor = Color.DarkGray;

            Label welcome = new Label(dialogBox);

            welcome.Text     = "Welcome to Sharphack, where is ale is sharp, and the swords are strong.";
            welcome.Location = new Point(2, 2);
            welcome.Size     = new Size(dialogBox.Size.Width - 4, 5);

            Label lblNewGame = new Label("[N]ew Game", dialogBox);

            lblNewGame.Location = new Point(2, 8);
            lblNewGame.Color    = Color.Yellow;

            Label lblQuit = new Label("[Q]uit Game", dialogBox);

            lblQuit.Location = new Point(2, 9);
            lblQuit.Color    = Color.Yellow;
        }
Ejemplo n.º 4
0
 public static void Remove(AbstractWindow window)
 {
     if (_instance._windows.Count == 0)
     {
         return;
     }
     _instance._windows.Remove(window);
 }
Ejemplo n.º 5
0
        // Считывание данных о типе знакомства с формы добавления или изменения.
        private string RelationsTypeToString(ref AbstractWindow form)
        {
            string relationsType = "";

            foreach (var item in form.RelationsTypeCheckedListBox.CheckedItems)
            {
                relationsType += " " + item.ToString() + ";";
            }
            return(relationsType);
        }
Ejemplo n.º 6
0
        //  Добавления в коллекцию  нового контакта или изменения.
        protected Person NewPerson(AbstractWindow form)
        {
            PersonalData newPerson     = NewPersonalData(ref form);
            Phone        newPhone      = NewPhone(ref form);
            Study        newStudyPlace = NewStudyPlace(ref form);
            Work         newWorkPlace  = NewWorkPlace(ref form);
            Other        newOtherData  = NewOtherData(ref form);

            return(Person.CreatePerson(newPerson, newPhone, newStudyPlace, newWorkPlace, newOtherData));
        }
Ejemplo n.º 7
0
            protected void MoveWindowAside(AbstractWindow window)
            {
                int x = GetX() + GetInitialWidth() + 5;

                if (x + window.GetInitialWidth() > Screen.width)
                {
                    x = GetX() - window.GetInitialWidth() - 5;
                }
                window.SetPosition(x, GetY());
            }
Ejemplo n.º 8
0
        public MainMenuState()
            : base()
        {
            Window = Game.RenderSystem.Window;

            dialogBox                 = new Window(new Size(40, 40), new Point(30, 5));
            dialogBox.Style           = BorderStyle.Double;
            dialogBox.ForegroundColor = Color.DarkGray;

            Window.AddRegion(dialogBox);
        }
Ejemplo n.º 9
0
        public static void AddToList(AbstractWindow window)
        {
            var type = window.GetType();

            if (type == typeof(ConsoleLog) || type == typeof(NavigationWindow))
            {
                return;
            }
            _instance._windows.Add(window);
            window.transform.SetParent(_instance.transform, false);
            window.transform.ToRect().anchoredPosition = -25 * _instance._windows.Count * Vector2.one;
        }
Ejemplo n.º 10
0
 // Считывание персональных данных с формы добавления или изменения.
 private PersonalData NewPersonalData(ref AbstractWindow form)
 {
     DateArgumentScan(form);
     return(PersonalData.InputPersonalData(
                ArgumentScan(form.SurnameTextBox.Text),
                ArgumentScan(form.NameTextBox.Text),
                ArgumentScan(form.SecondNameTextBox.Text),
                ArgumentScan(form.AdressTextBox.Text),
                form.BirthDayNumberComboBox.SelectedItem.ToString(),
                form.BirthDayMonthComboBox.SelectedIndex,
                form.BirsthDayYearComboBox.SelectedItem.ToString()
                ));
 }
Ejemplo n.º 11
0
 // Заполнение полей ввода даты по умолчанию.
 protected void DateArgumentScan(AbstractWindow form)
 {
     if (form.BirthDayNumberComboBox.SelectedItem == null)
     {
         form.BirthDayNumberComboBox.SelectedItem = "1";
     }
     if (form.BirthDayMonthComboBox.SelectedIndex == -1)
     {
         form.BirthDayMonthComboBox.SelectedIndex = 0;
     }
     if (form.BirsthDayYearComboBox.SelectedItem == null)
     {
         form.BirsthDayYearComboBox.SelectedItem = "2000";
     }
 }
Ejemplo n.º 12
0
        protected override void StateStarted()
        {
            AbstractWindow pwin = Game.RenderSystem.Window;

            pwin.RemoveAllRegions();
            pwin.Clear();

            Window mainwin = new Window(pwin);

            mainwin.Size  = pwin.Size;
            mainwin.Title = "(Press Escape)";
            mainwin.Style = BorderStyle.Double;


            Game.InputSystem.Command.CommandSet = "MainMenu";
        }
Ejemplo n.º 13
0
        static void game_GameProcessing(object sender, EventArgs e)
        {
            AbstractWindow gwin = Game.RenderSystem.Window;

            gwin.Clear();
            for (Int32 i = 0; i < 256; i++)
            {
                Int32 x = i % 16;
                Int32 y = i / 16;

                Int32 r = Program.RNG.Next(0, 255);
                Int32 g = Program.RNG.Next(0, 255);
                Int32 b = Program.RNG.Next(0, 255);

                //gwin[x, y].AddGlyph(i, Color.White, Color.FromArgb(r, g, b));
            }
        }
Ejemplo n.º 14
0
 public void RemoveWindow(AbstractWindow window)
 {
     windows.Remove(window);
 }
Ejemplo n.º 15
0
 public void AddWindow(AbstractWindow window)
 {
     windows.Add(window);
 }
Ejemplo n.º 16
0
 public Pair<int, int> GetWindowPosition(AbstractWindow window)
 {
    return GetWindowPosition(window.GetWindowId());
 }
Ejemplo n.º 17
0
 public Pair <int, int> GetWindowPosition(AbstractWindow window)
 {
     return(currentGaugeSet.GetWindowPosition(window.GetWindowId()));
 }
Ejemplo n.º 18
0
 public void SetWindowPosition(AbstractWindow window)
 {
    SetWindowPosition(window.GetWindowId(), window.GetX(), window.GetY());
 }
Ejemplo n.º 19
0
 //  Считывание дополнительных данных.
 private Other NewOtherData(ref AbstractWindow form)
 {
     return(Other.InputOtherData(ArgumentScan(RelationsTypeToString(ref form)), ArgumentScan(form.BusinessQualitiesTextBox.Text)));
 }
Ejemplo n.º 20
0
 public Client(WidgetFactory widgetFactory)
 {
     _abstractWindow = widgetFactory.CreateForm();
     _abstractButton = widgetFactory.CreateButton();
 }
Ejemplo n.º 21
0
        void Main_Load(object sender, EventArgs e)
        {
            Game.Initialize();
            Game.SetRenderSystem("OpenTK");

            String glyphPath = Game.PathTo("curses_640x300.png");

            using (Stream imgstream = File.OpenRead(glyphPath))
            {
                GlyphPalette pal = new GlyphPalette(imgstream, 16, 16);

                window = Game.RenderSystem.CreateWindow(SharplikeView.Size, pal, SharplikeView);
            }

            SharplikeView.Controls[0].MouseDown += new MouseEventHandler(SharplikeView_MouseDown);
            SharplikeView.Controls[0].MouseUp   += new MouseEventHandler(SharplikeView_MouseUp);
            SharplikeView.Controls[0].MouseMove += new MouseEventHandler(SharplikeView_MouseMove);

            EntityList.ItemDrag += new ItemDragEventHandler(EntityList_ItemDrag);
            SharplikeView.Controls[0].AllowDrop  = true;
            SharplikeView.Controls[0].DragDrop  += new DragEventHandler(Main_DragDrop);
            SharplikeView.Controls[0].DragOver  += new DragEventHandler(Main_DragOver);
            SharplikeView.Controls[0].DragEnter += new DragEventHandler(Main_DragEnter);
            SharplikeView.Controls[0].DragLeave += new EventHandler(Main_DragLeave);

            //Game.SetInputSystem("OpenTK");

            window.Clear();

            ReplaceMap(new MapStack(window.Size, 20, 15, "EditorMap", null));
            Map.ViewFrom(new Vector3(0, 0, 0), true);

            Bitmap    glyphs    = Game.RenderSystem.Window.GlyphPalette.SourceBitmap;
            ImageList il        = new ImageList();
            Size      glyphSize = Game.RenderSystem.Window.GlyphPalette.GlyphDimensions;

            for (int y = 0; y < Game.RenderSystem.Window.GlyphPalette.RowCount; ++y)
            {
                for (int x = 0; x < Game.RenderSystem.Window.GlyphPalette.ColumnCount; ++x)
                {
                    Rectangle area = new Rectangle(x * glyphSize.Width, y * glyphSize.Height,
                                                   glyphSize.Width, glyphSize.Height);
                    Bitmap b = new Bitmap(glyphSize.Width, glyphSize.Height, glyphs.PixelFormat);
                    using (Graphics bg = Graphics.FromImage(b))
                    {
                        bg.Clear(Color.Black);
                        bg.DrawImageUnscaled(glyphs.Clone(area, glyphs.PixelFormat), new Point(0, 0));
                    }
                    il.Images.Add(b);
                }
            }
            EntityList.LargeImageList = il;
            EntityList.SmallImageList = il;

            SquareList.LargeImageList = il;
            SquareList.SmallImageList = il;

            foreach (EditorExtensionNode node in AddinManager.GetExtensionNodes("/Sharplike/Entities"))
            {
                ListViewItem i = new ListViewItem();
                i.Text        = node.Id;
                i.ToolTipText = node.TooltipText;
                i.Tag         = node;
                i.ImageIndex  = node.GlyphID;

                EntityList.Items.Add(i);
            }

            foreach (EditorExtensionNode node in AddinManager.GetExtensionNodes("/Sharplike/Squares"))
            {
                ListViewItem i = new ListViewItem();
                i.Text        = node.Id;
                i.ToolTipText = node.TooltipText;
                i.Tag         = node;
                i.ImageIndex  = node.GlyphID;

                SquareList.Items.Add(i);
            }

            foreach (ToolGroupExtensionNode node in AddinManager.GetExtensionNodes("/Sharplike/Editlike/Tools"))
            {
                foreach (ExtensionNode mapnode in node.ChildNodes)
                {
                    if (mapnode.GetType() == typeof(MapToolExtensionNode))
                    {
                        ToolStripButton btn = new ToolStripButton();
                        BuildButton(mapnode as MapToolExtensionNode, btn);
                        EditorTools.Items.Add(btn);
                    }
                    else
                    {
                        ToolStripDropDownButton ddbtn = new ToolStripDropDownButton();
                        ddbtn.DropDown.Width = 200;
                        foreach (MapToolExtensionNode mnode in mapnode.ChildNodes)
                        {
                            ToolStripButton btn = new ToolStripButton();
                            BuildButton(mnode, btn);
                            if (btn.DisplayStyle == ToolStripItemDisplayStyle.Image)
                            {
                                btn.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                            }

                            Image i = mnode.Icon;
                            btn.Click += delegate(object send, EventArgs ea)
                            {
                                ddbtn.Image = i;
                                ddbtn.Tag   = btn;
                            };

                            ddbtn.DropDownItems.Add(btn);

                            if (ddbtn.Tag == null)
                            {
                                ddbtn.Tag   = btn;
                                ddbtn.Image = mnode.Icon;
                            }
                        }

                        ddbtn.Click += delegate(object send, EventArgs ea)
                        {
                            btn_Click(ddbtn.Tag, ea);
                        };

                        EditorTools.Items.Add(ddbtn);
                    }
                }
                EditorTools.Items.Add(new ToolStripSeparator());
            }

            viewTool = new ViewportTool();
            viewTool.SetActive(this, "");

            Game.Run();
        }
Ejemplo n.º 22
0
 // Считывание данных  о трудоустройстве с формы добавления или изменения.
 private Work NewWorkPlace(ref AbstractWindow form)
 {
     return(Work.InputWorkData(ArgumentScan(form.WorkPlaceNametextBox.Text), ArgumentScan(form.WorkPlaceFunctionTextBox.Text)));
 }
Ejemplo n.º 23
0
 // Считывание данных  о образовании с формы добавления или изменения.
 private Study NewStudyPlace(ref AbstractWindow form)
 {
     return(Study.InputStudyData(ArgumentScan(form.CollegeNameTextBox.Text), ArgumentScan(form.CollageFinishYearComboBox.Text)));
 }
Ejemplo n.º 24
0
 protected void MoveWindowAside(AbstractWindow window)
 {
    int x = GetX() + GetInitialWidth() + 5;
    if (x + window.GetInitialWidth() > Screen.width) x = GetX() - window.GetInitialWidth() - 5;
    window.SetPosition(x, GetY());
 }
Ejemplo n.º 25
0
 public Pair <int, int> GetWindowPosition(AbstractWindow window)
 {
     return(GetWindowPosition(window.GetWindowId()));
 }
Ejemplo n.º 26
0
 public void SetWindowPosition(AbstractWindow window)
 {
     SetWindowPosition(window.GetWindowId(), window.GetX(), window.GetY());
 }
Ejemplo n.º 27
0
 // Считывание телефонных данных с формы добавления или измененения.
 private Phone NewPhone(ref AbstractWindow form)
 {
     return(Phone.InputPhoneData(ArgumentScan(form.MobilePhoneTextBox.Text), ArgumentScan(form.AltPhoneTextBox.Text)));
 }