Esempio n. 1
0
        public void Add(IWidgetBackend widget, NotebookTab tab)
        {
            NSTabViewItem item = new NSTabViewItem();

            item.Label = tab.Label;
            item.View  = GetWidgetWithPlacement(widget);
            Widget.Add(item);
        }
        public static Widget WorkflowTest()
        {
            Widget       result       = new Widget();
            MyWidgetCode myWidgetCode = new MyWidgetCode();

            result.Add(myWidgetCode.Base);
            return(result);
        }
Esempio n. 3
0
    void ShowHelp()
    {
        Widget helpWindow = new Widget(new VerticalLayout());

        helpWindow.Layout.LeftPadding   = 20;
        helpWindow.Layout.RightPadding  = 20;
        helpWindow.Layout.TopPadding    = 20;
        helpWindow.Layout.BottomPadding = 20;
        foreach (var line in HELPTEXT)
        {
            Label linelabel = new Label(line);
            helpWindow.Add(linelabel);
        }
        PushButton closeHelpBtn = new PushButton("Sulje");

        closeHelpBtn.Clicked += () => Remove(helpWindow);
        helpWindow.Add(closeHelpBtn);
        Add(helpWindow, -1);
    }
Esempio n. 4
0
 public ActionResult AddWidget(Widget widget)
 {
     widget.WidgetID     = Guid.NewGuid();
     widget.LanguageCode = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
     widget.Title        = widget.Title ?? "";
     widget.Body         = widget.Body ?? "";
     //save em
     widget.Add(User.Identity.Name);
     return(Json(widget));
 }
Esempio n. 5
0
 void playmode()
 {
     ClearAll();
     Widget alusta = new Widget(new HorizontalLayout());
     Add(alusta);
     for (int i = 0; i < tasot.Count; i++)
     {
         Widget paikka = new Widget(tasot[i]);
         alusta.BorderColor = Color.White;
         alusta.Add(paikka);
     }
 }
Esempio n. 6
0
    /// <summary>
    /// Luo tavaralle widgetin ruudulle (kuvallinen).
    /// </summary>
    /// <param name="asettelu">Widgetin asettelu</param>
    /// <param name="kuva">Tavaran logo</param>
    /// <param name="laskuri">Tavaran laskurin viite</param>
    /// <returns>Muodostettu widgetti.</returns>
    private static Widget LuoTavaranWidget(HorizontalLayout asettelu, Image kuva, IntMeter laskuri)
    {
        Widget w = new Widget(asettelu);

        w.Color = Color.Black;

        Widget imageLogo = new Widget(32, 32);

        imageLogo.Image = kuva;
        w.Add(imageLogo);

        Label teksti = new Label();

        teksti.BindTo(laskuri);

        teksti.TextColor = Color.White;

        w.Add(teksti);

        return(w);
    }
Esempio n. 7
0
    /// <summary>
    /// Luo teksillisen widgetin ruudulle
    /// </summary>
    /// <param name="asettelu">Widgetin asettelu</param>
    /// <param name="laskurinTeksti">Widgetin laskurin otsikkoteksti</param>
    /// <param name="laskuri">Tavaran laskurin viite</param>
    /// <returns></returns>
    private static Widget LuoTavaranWidget(HorizontalLayout asettelu, string laskurinTeksti, IntMeter laskuri)
    {
        Widget w = new Widget(asettelu);

        w.Color = Color.Black;

        Label otsikko = new Label(laskurinTeksti);

        otsikko.TextColor = Color.White;
        w.Add(otsikko);

        Label teksti = new Label();

        teksti.BindTo(laskuri);

        teksti.TextColor = Color.White;

        w.Add(teksti);

        return(w);
    }
Esempio n. 8
0
        public static Widget BrokenFixedSize()
        {
            var result = new Widget();
            var inner  = new Widget();

            inner.Position = new Point2(50, 50);
            inner.Add(new Widget {
                IsFixedWidth = true
            });
            inner.Add(new Widget());

            inner.Behaviors.Add(new GridFormat(2, 1));

            Debug.WriteLine("Setting width");
            inner.Width = 100;

            //throw new Exception();

            result.Add(inner);
            return(result);
        }
        public static Widget CodeGenTest()
        {
            Widget result = new Widget();
            Widget button = CommonWidgets.Button("Do test", new MonoGame.Extended.RectangleF(30, 30, 0, 0));

            button.OnClick += (s, a) =>
            {
                //ProjectCodeInterface.AddEventVoid(@"C:\Users\jamie\Desktop\test\MyWidgetCode.cs", nameof(Widget.OnClick), "MyWidgetName");
            };
            result.Add(button);
            return(result);
        }
Esempio n. 10
0
        public static Widget CenterTest()
        {
            var layout = new Widget();

            layout.Behaviors.Add(new CenterContent());

            var inner = new Widget {
                Size = new Point2(300, 200)
            };
            var second_inner = new Widget {
                Position = new Point2(350, 40)
            };
            var third_inner = new Widget {
                Position = new Point2(600, 40)
            };

            layout.Add(inner);
            layout.Add(second_inner);
            layout.Add(third_inner);

            return(layout);
        }
Esempio n. 11
0
        private async Task <bool> AddPageAsync(Page page, bool animated)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            Page oldPage = null;

            if (_currentStack.Count >= 1)
            {
                oldPage = _currentStack.Peek().Page;
            }

            (oldPage as IPageController)?.SendDisappearing();

            _currentStack.Push(new NavigationChildPage(page));

            if (Platform.GetRenderer(page) == null)
            {
                Platform.SetRenderer(page, Platform.CreateRenderer(page));
            }

            var pageRenderer = Platform.GetRenderer(page);

            Widget.Add(pageRenderer.Container);

            pageRenderer.Container.SetSizeRequest(
                Allocation.Width,
                Allocation.Height);

            pageRenderer.Container.ShowAll();

            if (animated)
            {
                var from = pageRenderer.Container.Parent.Allocation.Width;
                pageRenderer.Container.MoveTo(from, 0);

                await AnimatePageAsync(pageRenderer.Container, from, 0);
            }

            (page as IPageController)?.SendAppearing();

            if (oldPage != null && Platform.GetRenderer(oldPage) != null)
            {
                var oldPageRenderer = Platform.GetRenderer(oldPage);
                oldPageRenderer.Container.Visible = false;
            }

            return(true);
        }
Esempio n. 12
0
    /// <summary>
    /// Aliohjelma joka luo pistelaskurin
    /// </summary>
    /// <param name="x">pistelaskurin x-koordinaatti</param>
    /// <param name="y">pistelaskurin y-koordinaatti</param>
    /// <param name="lahtoarvo">mikä on pelin alkaessa laskurin arvo</param>
    /// <param name="otsikko">laskurin selite sille, mitä lasketaan</param>
    /// <returns>laskurin</returns>
    IntMeter LuoPisteLaskuri(double x, double y, int lahtoarvo, string otsikko)
    {
        IntMeter laskuri = new IntMeter(lahtoarvo);
        Label    naytto  = new Label();

        naytto.BindTo(laskuri);
        naytto.X           = x;
        naytto.Y           = y;
        naytto.TextColor   = Color.Black;
        naytto.BorderColor = Color.DarkGray;
        naytto.Color       = Color.DarkGray;
        Add(naytto);
        Label pisteTeksti = new Label(otsikko);

        pisteTeksti.X         = x - 100;
        pisteTeksti.Y         = y;
        pisteTeksti.TextColor = Color.Black;

        Add(pisteTeksti);
        laskuriLaatta.Add(naytto);
        laskuriLaatta.Add(pisteTeksti);
        return(laskuri);
    }
Esempio n. 13
0
        public void SetContent(IWidgetBackend widget)
        {
            var w = (WidgetBackend)widget;

            if (Widget.Children.Length > 0)
            {
                Widget.Remove(Widget.Children[0]);
            }

            if (w != null)
            {
                Widget.Add(w.Widget);
            }
        }
Esempio n. 14
0
        public static void InsertFiller(
            Widget widget,
            int width,
            int height,
            Widget filler
            )
        {
            var area = width * height;

            while (widget.Children.Count < area)
            {
                widget.Add((Widget)filler.Clone());
            }
        }
Esempio n. 15
0
    void luoKenttaNaytto(int kentanNro)
    {
        kenttaLaskuri = new IntMeter(kentanNro);

        Widget kenttaRuutu = new Widget(100, 50);

        kenttaRuutu.Color       = Color.Transparent;
        kenttaRuutu.BorderColor = Color.White;
        kenttaRuutu.Layout      = new VerticalLayout();
        kenttaRuutu.X           = Screen.LeftSafe + 75;
        kenttaRuutu.Y           = Screen.TopSafe - 40;
        Add(kenttaRuutu);

        Label kenttaTeksti = new Label("Taso");

        kenttaTeksti.TextColor = Color.White;
        kenttaRuutu.Add(kenttaTeksti);

        Label kenttaNaytto = new Label();

        kenttaNaytto.BindTo(kenttaLaskuri);
        kenttaNaytto.TextColor = Color.White;
        kenttaRuutu.Add(kenttaNaytto);
    }
Esempio n. 16
0
        public static Widget BrokenStuff()
        {
            var result = new Widget();
            var inner  = new Widget();

            inner.Position = new Point2(50, 50);
            inner.Add(CommonWidgets.Label("Testgfd"));
            inner.Add(CommonWidgets.Label("Testfdasfdsa"));
            inner.Add(CommonWidgets.Label("Test"));
            inner.Add(CommonWidgets.Label("Test"));
            //inner.Add(CommonWidgets.Label("Test"));
            inner.Behaviors.Add(new GridFormat(1, inner.Count));
            result.Add(inner);
            return(result);
        }
Esempio n. 17
0
    public static bool CreateWindow(WindowData windowData)
    {
        if (!CanCreateWindow(windowData))
        {
            return(false);
        }

        Mem.Add(windowData.Mem);
        var window = Activator.CreateInstance(windowData.WindowClass) as Window;

        window.SetSkin(windowData.Skin);
        window.OnRemovedEvent += () => Mem.Remove(windowData.Mem);
        desktop.Add(window);
        window.SetPosition(window.GetRandomPosition());
        return(true);
    }
Esempio n. 18
0
        public Cannonselector(List <CannonTemplate> cannons)
        {
            var context = new ListenContext();

            context.Enable();
            Layout               = new HorizontalLayout();
            Layout.LeftPadding   = 5;
            Layout.RightPadding  = 5;
            Layout.BottomPadding = 5;
            Layout.TopPadding    = 5;

            Color       = new Color(193, 66, 66, 120);
            BorderColor = Color.Red;
            IsModal     = false;

            // Need to update Jypeli so that this works and disables window dragging.
            // IsCapturingMouse = false;

            foreach (var cannon in cannons)
            {
                Widget main = new Widget(40, 40);
                main.Color       = defaultColor;
                main.BorderColor = Color.Black;
                main.Tag         = cannon.Name;
                Widget image = new Widget(30, 30);
                image.Image = GameManager.Images[cannon.Image];
                main.Add(image);
                Add(main);

                wcannons.Add(main);

                Game.Instance.Mouse.ListenOn(main, MouseButton.Left, ButtonState.Pressed, () => Select(main), null).InContext(context);
            }

            selected = wcannons.First();
            Select(wcannons.First());

            Game.Instance.Mouse.ListenOn(this, HoverState.Enter, MouseButton.None, ButtonState.Irrelevant, () =>
            {
                GameManager.ListenContext.Disable();
            }, null).InContext(context);
            Game.Instance.Mouse.ListenOn(this, HoverState.Exit, MouseButton.None, ButtonState.Irrelevant, () =>
            {
                GameManager.ListenContext.Enable();
            }, null).InContext(context);
        }
Esempio n. 19
0
        public static Widget FileBar(
            AutoDictionary <string, AutoDictionary <string, DropDownEntry> > entries
            )
        {
            var file_bar = new Widget {
                Height = 40f
            };

            file_bar.VisualSettings.ChangeColorOnMouseOver = false;
            file_bar.VisualSettings.VisualRole             = VisualRoleType.header_widget;
            file_bar.FitToContentArea = true;

            //file_bar.Behaviors.Add(new ShadingBehavior() { UseWidgetOutlineColor = true });
            file_bar.Behaviors.Add(new SpacedListFormat()
            {
                ListSpacing = 0f
            });

            foreach (var entry in entries)
            {
                var w_entry = Button(entry.Key, new RectangleF(0, 0, 50, 40));
                w_entry.Behaviors.Get <DrawText>().SideSpacing = 25f;
                w_entry.VisualSettings.DrawOutline             = false;
                w_entry.VisualSettings.DrawBackground          = false;

                var dropdown = DropDown(entry.Value);

                w_entry.Behaviors.Add(
                    new TriggerWidgetAction(
                        nameof(Widget.OnClick),
                        new AddMainWidget(
                            dropdown,
                            new SideOfParent {
                    ParentSide = Direction2D.down,
                    ParentUp   = 1
                }
                            )
                        )
                    );

                file_bar.Add(w_entry);
            }

            return(file_bar);
        }
Esempio n. 20
0
    public void LuoSammakonSydamet(double x, double y, double leveys, double korkeus, int sydanMaara)
    {
        HorizontalLayout asettelu = new HorizontalLayout();

        asettelu.Spacing = 10;

        sydamet       = new Widget(asettelu);
        sydamet.Color = Color.Transparent;
        sydamet.X     = Screen.Center.X + 450;
        sydamet.Y     = Screen.Top - 60;
        Add(sydamet);

        for (int i = 0; i < sydanMaara; i++)
        {
            Widget sydan = new Widget(20, 20, Shape.Heart);
            sydan.Color = Color.Red;
            sydamet.Add(sydan);
        }
    }
Esempio n. 21
0
    private void LopetusIkkuna(Window sender)
    {
        Widget lopetusIkkuna = new Widget(600, 250, Shape.Rectangle)
        {
            X     = 0,
            Y     = 0,
            Color = Color.White
        };

        matti1.Destroy();
        Add(lopetusIkkuna);
        Label pisteTeksti = new Label("Onneksi olkoon! Sait talvipesän valmiiksi ja voitit pelin!\nVoit lopettaa pelin painamalla ESC tai \nvaihtoehtoisesti aloittaa uuden pelin painamalla U")
        {
            TextColor = Color.Black
        };

        lopetusIkkuna.Add(pisteTeksti);
        koskettaakoSiementa = true;
        Timer.SingleShot(3, () => { Aloitus(); });
    }
Esempio n. 22
0
    public void ViewSetSelect(List <ProblemInstance> instances, SetSelectedHandler handler, int perRow = 4)
    {
        var selh = Game.Screen.Height / VRPGame.SCREEN_MARGIN_WIDHT_RATIO;

        // int perRow = Math.Max(1,instances.Count/MAX_ROWS);
        List <string> sets = instances.Select(pi => pi.ProblemSet).Distinct().ToList();

        if (sets.Count == 1)
        {
            // Only one set, autoselect it
            string onlySetName = sets[0];
            handler(onlySetName);
        }
        else
        {
            double btnSize = (Game.Screen.Width - SPACING_BETWEEN_BTNS * (perRow + 3)) / perRow;

            var vl = new VerticalLayout();
            vl.Spacing = SPACING_BETWEEN_BTNS;
            Widget vgrid = new Widget(vl);
            for (int i = 0; i < MAX_ROWS && i * perRow < sets.Count; i++)
            {
                var hl = new HorizontalLayout();
                hl.Spacing = SPACING_BETWEEN_BTNS;
                Widget hgrid = new Widget(hl);

                for (int j = i * perRow; j < (i + 1) * perRow && j < sets.Count; j++)
                {
                    string     setName          = sets[j];
                    PushButton selectThisSetBtn = new PushButton(btnSize, btnSize, setName);
                    selectThisSetBtn.Image    = nolevelBtnImage;
                    selectThisSetBtn.Clicked += () => handler(setName);
                    selectThisSetBtn.Clicked += () => game.Remove(vgrid);
                    hgrid.Add(selectThisSetBtn);
                }
                vgrid.Add(hgrid);
            }
            game.Add(vgrid);
        }
    }
Esempio n. 23
0
    /// <summary>
    /// Printtaa tekstin keskelle ruutua, ja asettaa parametrifunktion avulla mitä tapahtuu tekstin jälkeen.
    /// Tekstin saa pois painamalla space-näppäintä.
    /// </summary>
    /// <param name="teksti">Teksti, joka ruudulle halutaan.</param>
    /// <param name="funktio">Funktio, joka määrittelee mitä tapahtuu kun painetaan spacea.</param>
    public void PrinttaaTekstiJaOdotaInput(string teksti, Delegate1 funktio)
    {
        _tapahtumaTekstinJalkeen = funktio;

        HorizontalLayout asettelu = new HorizontalLayout();

        asettelu.Spacing      = 8;
        asettelu.LeftPadding  = 8;
        asettelu.RightPadding = 8;

        Widget tausta = new Widget(asettelu);

        tausta.Color = Color.Black;
        Add(tausta);

        tausta.Position = Game.Screen.Center;

        Label tekstikentta = new Label(teksti + "\nPress space to continue.");

        tekstikentta.TextColor = Color.White;
        tausta.Add(tekstikentta);
    }
Esempio n. 24
0
        private static void AddOrUpdateWorkItem(Widget widget, WorkItem workItem)
        {
            var workItemWidget = (WorkItemWidget)widget.Items.FirstOrDefault(i => i is WorkItemWidget w && w.WorkItemId == workItem.Id);

            if (workItemWidget == null)
            {
                workItemWidget = new WorkItemWidget();

                widget.Add(workItemWidget);
            }

            workItemWidget.Name       = workItem.Fields["System.Title"];
            workItemWidget.WorkItemId = workItem.Fields["System.Id"];
            workItemWidget.URL        = workItem.Links["html"]["href"];

            workItemWidget.Message = new StringBuilder()
                                     .AppendLine($"Title: {workItem.Fields["System.Title"]}")
                                     .AppendLine($"Type: {workItem.Fields["System.WorkItemType"]}")
                                     .Append($"Project: {workItem.Fields["System.TeamProject"]}")
                                     .ToString();

            workItemWidget.State = State.Ok;
        }
Esempio n. 25
0
    public void ViewProblemSelect(List <ProblemInstance> instances, ProblemSelectedHandler handler, int perRow = 6)
    {
        var selh = Game.Screen.Height / VRPGame.SCREEN_MARGIN_WIDHT_RATIO;

        // int perRow = Math.Max(1,instances.Count/MAX_ROWS);

        double btnSize = (Game.Screen.Width - SPACING_BETWEEN_BTNS * (perRow + 3)) / perRow;

        var vl = new VerticalLayout();

        vl.Spacing = SPACING_BETWEEN_BTNS;
        Widget vgrid = new Widget(vl);

        for (int i = 0; i < MAX_ROWS && i * perRow < instances.Count; i++)
        {
            var hl = new HorizontalLayout();
            hl.Spacing = SPACING_BETWEEN_BTNS;
            Widget hgrid = new Widget(hl);

            for (int j = i * perRow; j < (i + 1) * perRow && j < instances.Count; j++)
            {
                var        probI = instances[j];
                PushButton selectThisProblemBtn = VRPProblemSelector.CreateInstanceButton(btnSize, probI.ProblemName, probI.Stars, probI.Locked);

                if (!probI.Locked)
                {
                    selectThisProblemBtn.Clicked += () => handler(probI);
                    selectThisProblemBtn.Clicked += () => game.Remove(vgrid);
                }

                hgrid.Add(selectThisProblemBtn);
            }
            vgrid.Add(hgrid);
        }
        game.Add(vgrid, -1);
    }
Esempio n. 26
0
    //private IntValue barValue;

    public override void Init()
    {
        base.Init();

        Core.BackgroundColor = Computer.DesktopColor;

        rootWidget = new RootWidget().SetSize(Core.ScreenSize);
        desktop    = rootWidget.Add <Widget>()
                     .SetPosition(0f, 12f)
                     .SetSize(Core.ScreenSize.X, Core.ScreenSize.Y - 12);

        Computer.Init(desktop, diskMax: 1024, memMax: 512, coinMax: 512);

        statusBar = rootWidget.Add <Panel>()
                    .SetSkin(Computer.StatusBarSkin)
                    .SetSize(Core.ScreenSize.X, 16);

        (debugLabel = statusBar.Add <TextLabel>())
        .SetHorizontalAlign(Horizontal.Right)
        .SetVerticalAlign(Vertical.Center)
        .SetPosition(Core.ScreenSize.X / 2, 2f)
        .SetSize(Core.ScreenSize.X / 2 - 4, 12)
        ;

        statusBar.Add <Bar>()
        .SetValue(Computer.Disk)
        .SetPosition(4f, 2f)
        .SetSize(56, 12)
        .Add <TextLabel>()
        .SetText("DISK")
        .Center()
        ;

        statusBar.Add <Bar>()
        .SetValue(Computer.Mem)
        .SetInverse(true)
        .SetPosition(66f, 2f)
        .SetSize(60, 12)
        .Add <ValueLabel>()
        .SetFormat("MEM {2}Kb")
        .SetValue(Computer.Mem)
        .Center()
        ;

        statusBar.Add <ValueLabel>()
        .SetFormat("COIN {0}/{1}")
        .SetValue(Computer.Coin)
        .SetVerticalAlign(Vertical.Center)
        .SetPosition(140, 2f)
        .SetSize(56, 12)
        ;

        //Computer.CreateWindow(WindowData.Mine);

        //var layout = desktop.Add<Layout>();
        //layout.SetSkin(WindowData.ShopSkin).SetPosition(40, 80);
        //layout.Background = WindowData.ShopSkin.WindowFramePatch;

        //var topLayout = layout.Add<Layout>();
        ////vLayout.Background = WindowData.PlayerSkin.WindowFramePatch;
        //topLayout.Add<Image>().SetSprite(new Sprite(Asset.DefaultTexture, new Rectangle(4, 64, 28, 28)));
        //topLayout.Add<TextLabel>().SetText("Hello! Welcome to the\nminer's paradise!").Pack();
        //topLayout.PackHorizontally();


        //var hLayout = layout.Add<Layout>();
        ////hLayout.Background = WindowData.PlayerSkin.WindowFramePatch;
        //hLayout.Add<Button>().SetSize(32, 32);
        //hLayout.Add<Button>().SetSize(32, 32);
        //hLayout.Add<Button>().SetSize(32, 32);
        //hLayout.PackHorizontally();

        //layout.PackVertically();

        //layout.Add<Panel>().SetSkin(WindowData.PlayerSkin);

        //barValue = new IntValue(0, 1000);

        //var bar = new Bar(barValue);
        //bar.Size = new Point(64, 12);
        //bar.Position = new Vector2(120f, 80f);
        //bar.BackgroundPatch = new NinePatch(Asset.SkinTexture, new Point(26, 22), 2);
        //bar.FramePatch = new NinePatch(Asset.SkinTexture, new Point(32, 22), 2);
        //bar.Add<ValueLabel>().SetValue(barValue).Center().SetSkin(Computer.PlayerSkin);
        //desktop.Add(bar);
        //var w = desktop.Add<Window>().SetTitle("Enemy!");
        //w.Draggable = false;
        //w.AlwaysOnTop = true;
        //w.SetSkin(Computer.Instance.EnemySkin).SetPosition(510f, 190f);
        //w.Add<Label>().SetText("Helloo").SetSize(80, 8);
        //var removeButton = w.Add<Button>();
        //removeButton.SetSize(80, 12);
        //removeButton.Add<Label>().SetText("Remove").Center();
        //removeButton.OnPressed += () => w.Remove();
        //w.Pack();

        //desktop.Add<Button>()
        //	.AddOnPressed(() => Debug.Log("test button pressed"))
        //	.SetSkin(Computer.Instance.PlayerSkin)
        //	.SetSize(64, 64).SetPosition(80f, 50f)
        //		.Add<Label>()
        //		.SetText("Hello!")
        //		.SetHorizontalAlign(Horizontal.Center)
        //		.SetVerticalAlign(Vertical.Center)
        //;
    }
Esempio n. 27
0
File: bbd.cs Progetto: EA99/sejypeli
    void kokoesinevalikko()
    {
        kehys = new Widget(yu);
        kehys.Color = Color.Cyan;
        kehys.X = Screen.Center.X;
        kehys.Y = Screen.Center.Y-50;
        Widget valikkokehys = new Widget(500, 400);
        valikkokehys.Color = Color.Cyan;

        Add(kehys);
        kehys.Add(valikkokehys);

        qq.Spacing = 5;
        varusteet = new Widget(qq);
        varusteet.X = Screen.Center.X-90;
        varusteet.Y = Screen.Center.Y;
        varusteet.Color = Color.Cyan;
        Add(varusteet);
        Widget kypärä = new Widget(40,40);
        Widget paita = new Widget(40, 40);
        Widget housut = new Widget(40, 40);
        Widget kengät = new Widget(40, 40);
        kypärä.Color = Color.LightGray;
        kypärä.BorderColor = Color.Charcoal;
        paita.Color = Color.LightGray;
        paita.BorderColor = Color.Charcoal;
        housut.Color = Color.LightGray;
        housut.BorderColor = Color.Charcoal;
        kengät.Color = Color.LightGray;
        kengät.BorderColor = Color.Charcoal;
        varusteet.Add(kypärä);
        varusteet.Add(paita);
        varusteet.Add(housut);
        varusteet.Add(kengät);

        n = new Widget(yu);
        n.X = Screen.Center.X-170;
        n.Y = Screen.Center.Y;
        n.Color = Color.Cyan;
        Add(n);
        yläosa = new Widget(yu);
        yläosa.X = Screen.Center.X;
        yläosa.Y = Screen.Center.Y-140;
        yläosa.Color = Color.LightGray;
        Add(yläosa);
        Widget hahmokuva = new Widget(100, 200);
        hahmokuva.Color = Color.Red;
        hahmokuva.Image = pelaajanKuva;
        n.Add(hahmokuva);
        for (int i = 0; i < 10; i++)
        {
            Widget slot = new Widget(40, 40);
            slot.Color = Color.LightGray;
            slot.BorderColor = Color.Charcoal;
            yläosa.Add(slot);

        }
        rivi2 = new Widget(yu);
        rivi2.X = Screen.Center.X;
        rivi2.Y = Screen.Center.Y - 130;
        rivi2.Color = Color.Cyan;
        Add(rivi2);
        for (int i = 0; i < 10; i++)
        {
            Widget slot = new Widget(40, 40);
            slot.Color = Color.LightGray;
            slot.BorderColor = Color.Charcoal;
            rivi2.Add(slot);

        }
        rivi3 = new Widget(yu);
        rivi3.X = Screen.Center.X;
        rivi3.Y = Screen.Center.Y - 180;
        rivi3.Color = Color.Cyan;
        Add(rivi3);
        for (int i = 0; i < 10; i++)
        {
            Widget slot = new Widget(40, 40);
            slot.Color = Color.LightGray;
            slot.BorderColor = Color.Charcoal;
            rivi3.Add(slot);

        }
        rivi4 = new Widget(yu);
        rivi4.X = Screen.Center.X;
        rivi4.Y = Screen.Center.Y - 180;
        rivi4.Color = Color.Cyan;
        Add(rivi4);
        for (int i = 0; i < 10; i++)
        {
            Widget slot = new Widget(40, 40);
            slot.Color = Color.LightGray;
            slot.BorderColor = Color.Charcoal;
            rivi4.Add(slot);

        }
        vinpain = new Widget(yu);
        vinpain.X = Screen.Center.X + 210;
        vinpain.Y = Screen.Center.Y + 120;
        Add(vinpain);
        rasti = new Widget(40, 40);
        rasti.X = Screen.Center.X + 210;
        rasti.Y = Screen.Center.Y + 120;
        rasti.Color = Color.Red;
        vinpain.Add(rasti);
        Mouse.ListenOn(rasti, MouseButton.Left,ButtonState.Pressed, kysykokoesinevalikkoa,"");
    }
Esempio n. 28
0
    void LuoElamaLaskuri()
    {
        HorizontalLayout asettelu = new HorizontalLayout();
        asettelu.Spacing = 10;

        Widget sydamet = new Widget(asettelu);
        sydamet.Color = Color.Transparent;
        sydamet.X = Screen.Center.X;
        sydamet.Y = Screen.Top - 30;
        Add(sydamet);

        for (int i = 0; i < 10; i++)
        {
            Widget sydan = new Widget(30, 30, Shape.Heart);
            sydan.Color = Color.Red;
            sydamet.Add(sydan);
        }
    }
Esempio n. 29
0
        public static Widget LoginWindow(
            Action <LoginSignal> confirm_handle,
            Action <CreateAccountSignal> handle_account_creation = null
            )
        {
            const int login_create_spacing = 8 / 2;

            var window = new Widget {
                Size = new Point2(400, 300), Name = "Login Window"
            };

            window.VisualSettings.VisualRole = GeneralVisualSettings.VisualRoleType.pop_up;

            window.Behaviors.Add(new CenterContent());
            window.Behaviors.Add(new PinWidget {
                Pin = InnerWidgetLocation.Centered
            });
            window.Behaviors.Add(new PopInOut(RectanglePart.Uniform(0.975f), RectanglePart.Uniform(0.5f))
            {
                OpeningMotion = InterpolationSettings.Fast, ClosingMotion = InterpolationSettings.Fast
            });

            var username_entry = CommonWidgets.SingleLineTextEntry("", DrawText.XTextPositioningPolicy.left, DrawText.YTextPositioningPolicy.center, 8f);
            var password_entry = CommonWidgets.SingleLineTextEntry("", DrawText.XTextPositioningPolicy.left, DrawText.YTextPositioningPolicy.center, 8f);

            username_entry.Area = new RectangleF(100, 0, 150, 40);
            password_entry.Area = new RectangleF(100, 60, 150, 40);

            var username_label = CommonWidgets.Label("Username:"******"Password:"******"Login");

            login_button.Area = handle_account_creation != null
                ? new RectangleF(125 + login_create_spacing, 120, 125 - login_create_spacing, 40)
                : new RectangleF(100, 120, 150, 40);

            window.Add(username_label);
            window.Add(password_label);
            window.Add(username_entry);
            window.Add(password_entry);
            window.Add(login_button);

            void handleResponse(WidgetResponse response)
            {
                if (response.Reply != WidgetResponse.ResponseType.reject)
                {
                    return;
                }

                window.ParentDWindow.ShowPopUpMessage("Could not log in.\n\nError: " + response.Message);
            }

            login_button.OnClick += (s, a) =>
                                    confirm_handle.Invoke(new LoginSignal(
                                                              username_entry.Behaviors.Common.DrawText.Text,
                                                              password_entry.Behaviors.Common.DrawText.Text,
                                                              handleResponse
                                                              ));

            if (handle_account_creation == null)
            {
                return(window);
            }

            var create_account_button = CommonWidgets.Button("Create Account");

            create_account_button.Area = new RectangleF(0, 120, 125 - login_create_spacing, 40);

            void handleCreationResponse(WidgetResponse r)
            {
                if (r.Reply != WidgetResponse.ResponseType.reject)
                {
                    return;
                }

                window.ParentDWindow.ShowPopUpMessage("Error creating account: " + r.Message);
            }

            create_account_button.OnClick += (s, a) =>
                                             handle_account_creation.Invoke(
                new CreateAccountSignal(
                    username_entry.Behaviors.Common.DrawText.Text,
                    password_entry.Behaviors.Common.DrawText.Text,
                    "",
                    handleCreationResponse
                    )
                );

            window.Add(create_account_button);

            return(window);
        }
Esempio n. 30
0
File: bbd.cs Progetto: EA99/sejypeli
    void LataaMaailma()
    {
        int num2=montamaailmaa();

        lll = new VerticalLayout();
        Widget tarjotin = new Widget(lll);
        Add(tarjotin,3);
        for (int i = 0; i < num2; i++)
        {
            Label tonttu1 = new Label(nykymaailma(i));
            tonttu1.Color = Color.LightGray;
            tarjotin.Add(tonttu1);
            Mouse.ListenOn(tonttu1, MouseButton.Left, ButtonState.Pressed, delegate { pelaa(i); }, "");

        }
        //for(int i=0; i> System.IO.

        //lataakenttä funktiolle annetaan parametreiksi bitmapimage josta se lataa kentän
        //LisaaNappaimet();
        //Inventory inventory = new Inventory();
        //Add(inventory);
        /*
        foreach (PhysicsObject esine in esineet())
        {
            inventory.AddItem(esine, kivihakku);
            inventory.SelectItem(esine);
        }
        inventory.Y = Screen.Top - 20;

        int luku = RandomGen.NextInt(1, 200);
        luopuu(luku);
        //luopuu(new Vector kentanPiste = Level.GetRandomPosition());

        Camera.Zoom(1.5);
        //Camera.ZoomToLevel();
        Camera.Follow(pelaaja1);
         */
    }
Esempio n. 31
0
File: bbd.cs Progetto: EA99/sejypeli
    void luojano()
    {
        HorizontalLayout asettelu = new HorizontalLayout();
        asettelu.Spacing = 10;

        Widget vedet = new Widget(asettelu);
        vedet.Color = Color.Transparent;
        vedet.X = Screen.Center.X;
        vedet.Y = Screen.Bottom + 120;
        Add(vedet);

        for (int i = 0; i < 10; i++)
        {
            Widget vesi = new Widget(30, 30, Shape.Circle);
            vesi.Color = Color.Red;
            vedet.Add(vesi);
            janokulu.Add(vesi);
            vesi.Image = janokuplakuva;
        }

        janot = new IntMeter(10,0,10);
        janot.LowerLimit += janooo;
        Timer janostin = new Timer();
        janostin.Interval = 39.0;
        janostin.Timeout += miinusjano;
        janostin.Start();
    }
Esempio n. 32
0
File: bbd.cs Progetto: EA99/sejypeli
    void luoesinevalikko()
    {
        selausnumero = 0;
        HorizontalLayout s = new HorizontalLayout();
        s.Spacing = 5;
        Widget v = new Widget(s);
        v.Color = Color.Cyan;
        v.X = Screen.Center.X;
        v.Y = Screen.Bottom + 60;
        Add(v);
        for (int i = 0; i < 9; i++)
        {
            Widget slot = new Widget(40, 40);
            slot.Color = Color.LightGray;
            slot.BorderColor = Color.Charcoal;
            v.Add(slot);
            if (selausnumero < esineet2.Count)
            {
                GameObject väliolio = esineet2[selausnumero];
                slot.Add(väliolio);
                esineslotit.Add(slot);
                väliolio.Color = Color.Blue;
                slot.Image = väliolio.Image;
                käsitaso.Add(slot);
                if (käsiselecteditem == selausnumero)
                {
                    valitseuusikäsiesine(selausnumero);

                }
                selausnumero = selausnumero + 1;
                Keyboard.Listen(Key.D1, ButtonState.Pressed, delegate { valitseuusikäsiesine(1); }, "");
                Keyboard.Listen(Key.D2, ButtonState.Pressed, delegate { valitseuusikäsiesine(2); }, "");
                Keyboard.Listen(Key.D3, ButtonState.Pressed, delegate { valitseuusikäsiesine(3); }, "");
                Keyboard.Listen(Key.D4, ButtonState.Pressed, delegate { valitseuusikäsiesine(4); }, "");
                Keyboard.Listen(Key.D5, ButtonState.Pressed, delegate { valitseuusikäsiesine(5); }, "");
                Keyboard.Listen(Key.D6, ButtonState.Pressed, delegate { valitseuusikäsiesine(6); }, "");
                Keyboard.Listen(Key.D7, ButtonState.Pressed, delegate { valitseuusikäsiesine(7); }, "");
                Keyboard.Listen(Key.D8, ButtonState.Pressed, delegate { valitseuusikäsiesine(8); }, "");
                Keyboard.Listen(Key.D9, ButtonState.Pressed, delegate { valitseuusikäsiesine(9); }, "");
            }
        }
        Keyboard.Listen(Key.E, ButtonState.Pressed,kysykokoesinevalikkoa, "");
    }
Esempio n. 33
0
        public PisteIkkuna(List <ScoreItem> pistelista) : base(Game.Screen.Width, Game.Screen.Height)
        {
            Pistelista = pistelista;

            AddedToGame += delegate()
            {
                Game.Keyboard.Listen(Key.Escape, ButtonState.Released, this.Close, "Sulje ikkuna").InContext(this);
            };

            Otsikko = LuoTeksti("Pahimmat armottomat");
            Sisältö.Add(Otsikko);

            Otsikko.TextColor           = new Color(248, 143, 28);
            Otsikko.SizeMode            = TextSizeMode.AutoSize;
            Otsikko.HorizontalAlignment = HorizontalAlignment.Center;
            Otsikko.VerticalAlignment   = VerticalAlignment.Top;


            Tulokset = new Widget(new VerticalLayout()
            {
                Spacing = 5, LeftPadding = 25, RightPadding = 25
            })
            {
                Color = Color.Transparent
            };
            Sisältö.Add(Tulokset);

            for (int i = 0; i < pistelista.Count; i++)
            {
                var tulos = ScoresPHP.ValidoiScoreItem(pistelista[i]);
                var siw   = LuoWidgetti();

                var t = LuoTeksti(String.Format("{0}.", tulos.Position));
                t.HorizontalAlignment = HorizontalAlignment.Left;
                t.TextColor           = new Color(239, 239, 239);
                siw.Add(t);

                var n = LuoTeksti(tulos.Name);
                n.SizeMode            = TextSizeMode.None;
                n.HorizontalAlignment = HorizontalAlignment.Left;
                n.XMargin             = 20;
                n.HorizontalSizing    = Sizing.Expanding;
                siw.Add(n);

                var s = LuoTeksti(String.Format("{0}", tulos.Score));
                s.HorizontalAlignment = HorizontalAlignment.Right;
                s.TextColor           = new Color(173, 171, 169);
                siw.Add(s);

                if (i % 2 == 0)
                {
                    t.TextColor = Color.Darker(t.TextColor, 30);
                    n.TextColor = Color.Darker(n.TextColor, 30);
                    s.TextColor = Color.Darker(s.TextColor, 30);
                }

                Tulokset.Add(siw);
            }

            Nappirivi = LuoWidgetti();
            Sisältö.Add(Nappirivi);

            SuljeNappi = LuoNappi(RandomGen.SelectOne <string>("Perkele", "Saatana", "Jumalauta"));
            SuljeNappi.HorizontalAlignment = HorizontalAlignment.Right;
            SuljeNappi.Color = new Color(250, 158, 26);

            SuljeNappi.Clicked += this.Close;
            Nappirivi.Add(SuljeNappi);
        }
Esempio n. 34
0
        /// <summary>
        /// Luo tilannenäytön
        /// </summary>
        protected void CreateDisplay()
        {
            Widget laatikko = new Widget(Screen.WidthSafe, Screen.HeightSafe / 10);
            laatikko.Y = Screen.Bottom + laatikko.Height / 2;
            laatikko.X = Screen.Left + laatikko.Width / 2;
            laatikko.Color = Color.DarkBlue;

            Label label = new Label("Mathplex is loading...");
            label.TextColor = Color.LightGray;
            laatikko.Add(label);

            display = laatikko;

            this.Add(laatikko);
        }
Esempio n. 35
0
    void luolaskin()
    {
        laskuri = new IntMeter(0);

        Widget pisteRuutu = new Widget(100, 50);
        pisteRuutu.Layout = new VerticalLayout();
        pisteRuutu.X = Screen.LeftSafe + 150;
        pisteRuutu.Y = Screen.TopSafe - 100;
        pisteRuutu.Color = Color.Transparent;
        Add(pisteRuutu);

        Label pisteTeksti = new Label("Points: ");
        pisteRuutu.Add(pisteTeksti);

        Label pisteNaytto = new Label();
        pisteNaytto.BindTo(laskuri);
        pisteRuutu.Add(pisteNaytto);
    }
Esempio n. 36
0
    /// <summary>
    /// Luo ja asentaa HUD:n ruudulle.
    /// </summary>
    /// <param name="p">Pelin viite</param>
    /// <param name="sydantenMaara">Sydänten lukumäärä ruudulla</param>
    public static void Luo(LegendOfPallo p, int sydantenMaara)
    {
        Paalla = true;

        if (sydantenMaara >= 0) //Jos olio ei ole tuhoutumaton
        {
            hp = sydantenMaara;
        }


        HorizontalLayout asettelu = new HorizontalLayout();

        asettelu.Spacing      = 8;
        asettelu.LeftPadding  = 8;
        asettelu.RightPadding = 8;

        HorizontalLayout asetteluB = new HorizontalLayout();

        asetteluB.Spacing      = 8;
        asetteluB.LeftPadding  = 8;
        asetteluB.RightPadding = 48;


        sydamet       = new Widget(asettelu);
        sydamet.Color = Color.Black;
        p.Add(sydamet);

        pommit  = LuoTavaranWidget(asettelu, Animaatiot.BombPickupImage, pommiLaskuri);
        avaimet = LuoTavaranWidget(asettelu, Animaatiot.KeyPickupImage, avainLaskuri);
        kolikot = LuoTavaranWidget(asettelu, Animaatiot.CoinPickupImage, kolikkoLaskuri);
        elamat  = LuoTavaranWidget(asettelu, Animaatiot.LivesImage, elamaLaskuri);
        score   = LuoTavaranWidget(asetteluB, "Score: ", pisteLaskuri);
        level   = LuoTavaranWidget(asetteluB, "Level: ", kenttaLaskuri);

        p.Add(pommit);
        p.Add(avaimet);
        p.Add(kolikot);
        p.Add(elamat);
        p.Add(score);
        p.Add(level);

        for (int i = 0; i < hp; ++i)
        {
            Widget sydanKuva = new Widget(32, 32);
            sydanKuva.Image = Animaatiot.HeartPickupImage;
            healthBar.Add(sydanKuva);
            sydamet.Add(healthBar[i]);
        }


        sydamet.Bottom = Game.Screen.Bottom + 8;
        sydamet.X      = Game.Screen.Center.X;

        elamat.Left    = Game.Screen.Left;
        elamat.Bottom  = Game.Screen.Bottom + 8;
        pommit.Left    = elamat.Right;
        pommit.Bottom  = elamat.Bottom;
        avaimet.Left   = pommit.Right;
        avaimet.Bottom = elamat.Bottom;
        kolikot.Left   = avaimet.Right;
        kolikot.Bottom = elamat.Bottom;

        score.Right  = Game.Screen.Right;
        score.Bottom = elamat.Bottom;
        level.Right  = score.Left - 64;
        level.Bottom = elamat.Bottom;
    }
Esempio n. 37
0
    void luoHVeitsilaskin()
    {
        hVeitsiLaskuri = new IntMeter(HeittoVeitsienMaara);

        Widget pisteRuutu = new Widget(100, 50);
        pisteRuutu.Layout = new VerticalLayout();
        pisteRuutu.X = Screen.RightSafe - 150;
        pisteRuutu.Y = Screen.TopSafe - 100;
        pisteRuutu.Color = Color.Transparent;
        Add(pisteRuutu);

        Label pisteTeksti = new Label("Knives left: ");
        pisteRuutu.Add(pisteTeksti);

        Label pisteNaytto = new Label();
        pisteNaytto.BindTo(hVeitsiLaskuri);
        pisteRuutu.Add(pisteNaytto);
    }
Esempio n. 38
0
        public void AddChild(IWidgetBackend widget)
        {
            var w = ((IGtkWidgetBackend)widget).Widget;

            Widget.Add(w);
        }
Esempio n. 39
0
 public ActionResult AddWidget(Widget widget) {
     widget.WidgetID = Guid.NewGuid();
     widget.LanguageCode = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
     widget.Title = widget.Title ?? "";
     widget.Body = widget.Body ?? "";
     //save em
     widget.Add(User.Identity.Name);
     return Json(widget);
 }
Esempio n. 40
0
    int ShowNewPersonalBest(int new_k, double new_totd)
    {
        string text  = "";
        int    stars = 0;

        if (new_k <= instance.BKS_k)
        {
            if (new_totd <= instance.BKS_val * 1.05)
            {
                stars = 3;
                text += "Erinomaisesti reititetty.";
                if (new_totd == instance.BKS_val)
                {
                    text += " Itseasiassa löysit optimiratkaisun, eli parhaan mahdollisen reitityksen.";
                }
            }
            else if (new_totd <= instance.BKS_val * 1.20)
            {
                stars = 2;
                text += "Hyvin reititetty. Reittejä voi kuitenkin vielä parantaa. Keksitkö miten?";
            }
            else
            {
                stars = 1;
                text += "Kelpo reititys. Pystytkö muokkaamaan reitit lyhyemmiksi?";
            }
        }
        else if (new_k - 1 == instance.BKS_k)
        {
            if (new_totd < instance.BKS_val * 1.20)
            {
                stars = 2;
                text += "Hyvin reititetty. Kujetukset voisi vielä silti tehdä pienemmällä määrällä autoja. Keksitkö miten?";
            }
            else
            {
                stars = 1;
                text += "Kelpo reititys. Pystyt varmasti kuitenkin parantamaan sitä!";
            }
        }
        if (stars > 0)
        {
            Widget levelCompleteWindow = new Widget(Screen.Width / 4, Screen.Height / 3);
            levelCompleteWindow.Layout = new VerticalLayout();

            var instanceButton = VRPProblemSelector.CreateInstanceButton(Screen.Width / 4, currentInstanceMetadata.ProblemName, stars);
            levelCompleteWindow.Add(instanceButton);
            var infotext = new Label(text);
            infotext.SizeMode = TextSizeMode.Wrapped;
            levelCompleteWindow.Add(infotext);

            Widget continueOrNext = new Widget(new HorizontalLayout());

            var continueBtn = new PushButton("Jatka yrittämistä");
            continueBtn.Clicked += () => Remove(levelCompleteWindow);
            continueOrNext.Add(continueBtn);

            var nextBtn = new PushButton("Seuraava tehtävä");
            nextBtn.Clicked += () => ChooseNextLevel();
            continueOrNext.Add(nextBtn);

            levelCompleteWindow.Add(continueOrNext);

            Add(levelCompleteWindow, -1);
            StarXplosion(1, stars, instanceButton);

            // emulate mb release
            Timer.SingleShot(0.1, () => MouseBtnGoesUp());
        }
        return(stars);
    }
Esempio n. 41
0
 private void AddChildNode( Widget parent, AbstractRecord r )
 {
     TreeNode n = RootContext.CreateWidget<TreeNode>();
        recordToNode[r] = n;
        n.OnClick += new EventHandler<ClickEventArgs>(nodeSelectManager);
        n.Title = r[TitleKey].ToString();
        n.Record = r;
        parent.Add(n);
        if( r[ChildrenKey] != null )
       	recurseBind(n,r[ChildrenKey] as IRecordList);
 }