Ejemplo n.º 1
0
        public static void Complex(UserInterface ui)
        {
            makePopup(ui, new opt[] {
            new opt(OptType.info, "Shit son"),
            new opt(OptType.textBox, "Write here")
            }, "THIS IS SO COMPLEX",
                delegate
                {
                    return true;

                });
        }
Ejemplo n.º 2
0
        public Sidebar(UserInterface ui)
        {
            this.game = ui.game;
            //this.room = ui.game.room;
            this.ui = ui;
            NotImplemented = delegate {
                PopUp.Toast("Not Implemented. Take a hike.");
                //throw new NotImplementedException();
            };
            manager = game.Manager;

            manager.SetSkin("Green");
        }
        //public Group activeGroup = null;
        public InspectorArea(Sidebar sidebar, Control parent, int Left, int Top)
        {
            //get rid of these if not needed.
            this.game = sidebar.game;
            this.ui = sidebar.ui;
            this.sidebar = sidebar;
            this.manager = sidebar.manager;
            this.parent = parent;

            this.Left = Left;
            this.Top = Top;

            this.GenerateFields = true; //todo: set to true when usermode is set up (so you can see fields in debug)
            //this.ActiveInspectorParent = sidebar.ActiveInspectorParent;

            Initialize();
        }
        public KeyManager(UserInterface ui, Dictionary<KeyBundle, KeyAction> Keybinds = null)
        {
            this.ui = ui;
            //this.newKeyboardState = Keyboard.GetState();
            oldKeyboardState = Keyboard.GetState();
            oldMouseState = Mouse.GetState();

            if (Keybinds != null)
            {
                this.Keybinds = Keybinds;

            }
        }
Ejemplo n.º 5
0
 public void attatchToSidebar(UserInterface ui)
 {
     //We put the Procs In OrbItProcs
     processManager = new ProcessManager();
     processManager.SetProcessKeybinds();
     ui.sidebar.UpdateGroupComboBoxes();
 }
 internal static UserInterface Start()
 {
     ui = new UserInterface();
     return ui;
 }
Ejemplo n.º 7
0
 private void GlobalKeyBinds(UserInterface ui)
 {
     ui.keyManager.addGlobalKeyAction("exitgame", KeyCodes.Escape, OnPress: () => Exit());
     ui.keyManager.addGlobalKeyAction("togglesidebar", KeyCodes.OemTilde, OnPress: ui.ToggleSidebar);
     ui.keyManager.addGlobalKeyAction("switchview", KeyCodes.PageDown, OnPress: ui.SwitchView);
     ui.keyManager.addGlobalKeyAction("removeall", KeyCodes.Delete, OnPress: () => ui.sidebar.btnRemoveAllNodes_Click(null, null));
 }
Ejemplo n.º 8
0
        protected override void Initialize()
        {
            Assets.LoadAssets(Content);
            base.Initialize();
            base.MainWindow.TransparentClientArea = true;
            room = new Room(this, ScreenWidth, ScreenHeight-40);
            setResolution(prefWindowedResolution, false);

            globalGameMode = new GlobalGameMode(this);
            frameRateCounter = new FrameRateCounter(this);

            Player.CreatePlayers(room);
            ui = UserInterface.Start();
            ui.Initialize();
            room.attatchToSidebar(ui);
            GlobalKeyBinds(ui);
        }
Ejemplo n.º 9
0
        public static void makePopup(UserInterface ui, opt[] options, String title = "Hey! Listen!", ConfirmDelegate action = null)
        {
            Manager manager = ui.game.Manager;
            bool confirmed = false;
            object[] answer = new object[options.Length];

            bool[] answered = new bool[options.Length];
            ConfirmDelegate emptyDelegate = delegate{ return true;};
            action = action ?? emptyDelegate;
            Dialog window = new Dialog(manager);
            window.Text = title;
            window.Init();
            window.ShowModal();
            window.Caption.Text = "";
            window.Description.Text = "";
            window.Width = 200;
            window.Height = 200;
            window.SetPosition(20, OrbIt.ScreenHeight / 4);
            int heightCounter = window.Caption.Top;
            int i = 0;

            Button btnOk = new Button(manager);
            btnOk.Top = window.Description.Top + window.Description.Height;
            btnOk.Anchor = Anchors.Top;
            btnOk.Parent = window;
            btnOk.Text = "Ok";
            btnOk.Left = btnOk.Left = window.Width / 2 - btnOk.Width / 2;
            btnOk.Init();

            foreach (opt opt in options)
            {
                if (opt.type.In(OptType.info,OptType.prompt))
                {
                    Label info = new Label(manager);
                    info.Init();
                    info.Parent = window;
                    info.Left = VertPadding;
                    info.Width = window.Width - VertPadding * 5;
                    string message = ((string)opt.content).wordWrap(MAX_CHARS_PER_LINE);
                    info.Text = message;
                    info.Height = (info.Text.Count(x => x == '\n')+1) * info.Height;
                    info.Top = heightCounter; heightCounter += info.Height + VertPadding;
                }
                if (opt.type == OptType.dropDown)
                {
                    ComboBox cbBox = new ComboBox(manager);
                    cbBox.Init();
                    cbBox.Parent = window;
                    cbBox.MaxItems = 20; // TODO : ERROR?
                    cbBox.Width = window.Width - VertPadding * 5;
                    cbBox.Left = VertPadding;
                    cbBox.Top = heightCounter; heightCounter += cbBox.Height + VertPadding;
                    ObservableCollection<object> q = (ObservableCollection<object>)opt.content;
                    foreach (object o in q) cbBox.Items.Add(o);
                    q.CollectionChanged += delegate(object s, NotifyCollectionChangedEventArgs e) { cbBox.Items.syncToOCDelegate(e); };
                    int qq = i; answer[qq] = null;
                    cbBox.ItemIndexChanged += delegate {  answer[qq] = (cbBox.Items.ElementAt(cbBox.ItemIndex)); };
                    cbBox.ItemIndexChanged += opt.action;
                }
                if (opt.type == OptType.textBox)
                {
                    TextBox tbName = new TextBox(manager);
                    tbName.Init();
                    tbName.Parent = window;
                    tbName.Width = window.Width - VertPadding * 5;
                    tbName.Left = VertPadding;
                    tbName.Top = heightCounter; heightCounter += tbName.Height + VertPadding;
                    int qq = i; answer[qq] = null;
                    tbName.TextChanged += delegate { answer[qq] = tbName.Text; };
                    tbName.KeyUp += delegate(object sender, KeyEventArgs e)
                    {
                        if (e.Key == Keys.Enter)
                        { confirmed = true; if (action(true, answer)) window.Close(); }
                    };
                    tbName.TextChanged += opt.action;
                }

                if (opt.type == OptType.radialButton)
                {
                    GroupPanel gp = new GroupPanel(manager);
                    gp.Init();
                    gp.Parent = window;
                    gp.Width = window.Width - VertPadding * 5;
                    gp.Left = VertPadding;
                    int qq = i; answer[qq] = -1;
                    for (int j = 0; j < ((string[])opt.content).Length; j++)
                    {
                        RadioButton rb = new RadioButton(manager);
                        rb.Init();
                        rb.Parent = gp;
                        rb.Text = (string)opt.content;
                        int jj = j;
                        rb.Click += delegate { answer[qq] = jj; };
                        rb.Click += opt.action;
                    }
                    gp.Top = heightCounter; heightCounter += gp.Height + VertPadding;
                }
                if (opt.type == OptType.checkBox)
                {
                    CheckBox cb = new CheckBox(manager);
                    cb.Init();
                    cb.Parent = window;
                    cb.Width = window.Width - VertPadding * 5;
                    cb.Left = VertPadding;
                    cb.Top = heightCounter; heightCounter += cb.Height + VertPadding;
                    int qq = i; answer[qq] = false;
                    cb.Text = (string)opt.content;
                    cb.Click += delegate { answer[qq] = cb.Checked; };
                    cb.Click += opt.action;
                }
                i++;
            }
            if (options.Any<opt>(x => x.type != OptType.info))
            {
                btnOk.Left = VertPadding;
                Button btnCancel = new Button(manager);
                btnCancel.Init();
                btnCancel.Parent = window;
                btnCancel.Top = heightCounter;
                btnCancel.Text = "Cancel";
                btnCancel.Left = VertPadding * 2 + btnOk.Width;
                btnCancel.Click += delegate { window.Close(); action(false, answer); };
            }

            btnOk.Click += delegate {
                confirmed = true;
                window.Close(ModalResult.Cancel);
                bool res = action(true, answer);
                if (!res)
                {
                    window.Show();
                };
            };
            btnOk.Top = heightCounter;
            window.Closing += delegate { if (confirmed == false) action(false, answer); };
            window.Height = (btnOk.Top) + 70;
            manager.Add(window);
        }