Beispiel #1
0
        public void addPhysObj(GUIComponent sender, OnMouseClickEventArgs args)
        {
            GUIAddPhysPanel gfp = new GUIAddPhysPanel(Game);

            gfp.Initialize();
            gfp.OnBoxOk += new GUIAddPhysPanel.BoxOkHandler(newPhysicsObject);
            guimanager.AddComponent(gfp);
        }
Beispiel #2
0
 /// <summary>
 /// Up Scroll Button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 void ScrollUp(GUIComponent sender, OnMouseClickEventArgs args)
 {
     if (topItem > 0)
     {
         topItem--;
         UpdateList();
         PosBar.UpdateLocation(PosBar.Location + new Vector2(0, 0 - barIntervals));
     }
 }
Beispiel #3
0
 /// <summary>
 /// Down Scroll Button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 void ScrollDown(GUIComponent sender, OnMouseClickEventArgs args)
 {
     if (topItem < Items.Count - numItems)
     {
         topItem++;
         UpdateList();
         PosBar.UpdateLocation(PosBar.Location + new Vector2(0, barIntervals));
     }
 }
Beispiel #4
0
        void OkMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
        {
            // Update Depth
            GUIListBox depthEdit = (GUIListBox)this.getComponent("depth_edit");

            Art.ScreenDepth = float.Parse(depthEdit.getSelectedItem());

            ((GUIManager)Game.Services.GetService(typeof(IGUIManager))).RemoveComponent(Name);
        }
Beispiel #5
0
 void OCList(GUIComponent sender, OnMouseClickEventArgs args)
 {
     ListOpen = !ListOpen;
     if (ListOpen)
     {
         OpenCloseList.Caption = "-";
     }
     else
     {
         OpenCloseList.Caption = "+";
     }
 }
Beispiel #6
0
        public void testFunction(GUIComponent sender, OnMouseClickEventArgs args)
        {
            //console.Write("BUTTON PRESSED");
            //GUIEditBox testbox = (GUIEditBox)guimanager.GetComponent("texturename");
            //console.Write(testbox.Text);
            //LoadTexture(testbox.Text, new Vector2(0, 0));
            GUIOpenFileDialog ofd = new GUIOpenFileDialog(Game);

            ofd.Initialize();
            ofd.OnBoxOk += new GUIOpenFileDialog.BoxOkHandler(selectTexture);
            guimanager.AddComponent(ofd);
        }
        void OkMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
        {
            string selectedItem = fileList.getSelectedLabel();

            //throw new NotImplementedException();
            if (selectedItem != null)
            {
                // load fileList.getSelectedItem();
                if (OnBoxOk != null)
                {
                    //fire off any mouseclick event handlers that are listening
                    OnBoxOk(selectedItem, camera.Position, ((GUICheckbox)getComponent("isphys")).Checked);
                }
            }
            Close();
        }
Beispiel #8
0
        /// <summary>
        /// Rad Dragging of the Scrollbar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void DragScroll(GUIComponent sender, OnMouseClickEventArgs args)
        {
            float mousePos = input.MousePosition.Y;

            if (lastMousePos != null)
            {
                if (mousePos > lastMousePos + 2.5)
                {
                    ScrollDown(sender, args);
                }
                else if (mousePos < lastMousePos - 2.5)
                {
                    ScrollUp(sender, args);
                }
            }

            this.lastMousePos = input.MousePosition.Y;
        }
Beispiel #9
0
        void OkMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
        {
            float  bounciness = Convert.ToSingle(((GUIEditBox)getComponent("edtBouncy")).Text) / 1000;
            float  mass       = Convert.ToSingle(((GUIEditBox)getComponent("edtMass")).Text);
            float  friction   = Convert.ToSingle(((GUIEditBox)getComponent("edtFriction")).Text) / 1000;
            string texture    = ((GUIListBox)getComponent("list box")).getSelectedLabel();

            texture = "LevelArt\\" + texture.Substring(0, texture.Length - 4);


            if (OnBoxOk != null)
            {
                //fire off any mouseclick event handlers that are listening
                OnBoxOk(texture, mass, bounciness, friction);
            }


            ((GUIManager)Game.Services.GetService(typeof(IGUIManager))).RemoveComponent(Name);
        }
Beispiel #10
0
        /// <summary>
        /// Ensures that only one value is selected at a time
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void SelectItem(GUIComponent sender, OnMouseClickEventArgs args)
        {
            GUIListBoxItem listBox = (GUIListBoxItem)sender;

            if (selectedItem == "")
            {
                // If nothing is currently selected, select.
                listBox.SelectItem(true);
                selectedItem     = listBox.Name;
                currentItem.Text = listBox.Text;
                OCList(this, null);
            }
            else if (selectedItem == listBox.Name)
            {
                // If this item is already selected, deselect it.
                //listBox.SelectItem(false);
                //selectedItem = "";
                //currentItem.Text = "Select Item ...";
            }
            else
            {
                // If there's something else selected, remove it, then add the new one
                foreach (GUIListBoxItem lbi in Items)
                {
                    if (lbi.Name == selectedItem)
                    {
                        lbi.SelectItem(false);
                    }
                }

                listBox.SelectItem(true);
                selectedItem     = listBox.Name;
                currentItem.Text = listBox.Text;
                OCList(this, null);
            }
        }
 void CancelMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
 {
     ((GUIManager)Game.Services.GetService(typeof(IGUIManager))).RemoveComponent(Name);
 }
 void PauseButtonMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
 {
     Paused = true;
 }
 void PlayButtonMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
 {
     Paused = false;
 }
 void CancelMouseClick(GUIComponent sender, OnMouseClickEventArgs args)
 {
     Close();
 }