예제 #1
0
 private void IconsBox_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         RightClickMenu.Show(this, e.Location);
     }
 }
예제 #2
0
 private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         RightClickMenu.Show(Cursor.Position);
     }
 }
예제 #3
0
        private void TasView_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu)
            {
                RightClickMenu.Show(TasView, e.X, e.Y);
            }
            else if (e.Button == MouseButtons.Left)
            {
                ClearLeftMouseStates();
            }

            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (_rightClickFrame != -1)
                {
                    _rightClickInput     = null;
                    _rightClickOverInput = null;
                    _rightClickFrame     = -1;
                    CurrentTasMovie.ChangeLog.EndBatch();
                }
            }

            _supressContextMenu = false;

            DoTriggeredAutoRestoreIfNeeded();
        }
예제 #4
0
    void MouseEvents_RIGHTCLICK(Ray qamRay, bool hold)
    {
        if ((!hold) && (!UnitMenuIsOn))
        {
            if (!IsLocked)
            {
                if (MouseEvents.State.Position.AsUnitUnderCursor)
                {
                    UnitScript ClickedUnit = MouseEvents.State.Position.AsUnitUnderCursor;

                    if (IsOtherUnit(ClickedUnit.gameObject))
                    {//--------------- I think of adding anozher Menu like InteractionMenu or what.
                        //-------------it would contain Interaction specific comamds like Guard, GroupMove, BuildAGroup, TakeLeadership, and so on...
                        //-------------butt now this Rightclick will handle the focus to the other Unit and call it's CommandOptionsMenu
                        ClickedUnit.gameObject.AddComponent <Focus>();
                        RightClickMenu.PopUpGUI(ClickedUnit);
                        GUIScript.SelectedGroup.ResetGroup();
                    }
                    else
                    {//---------------the Focussed Unit (This unit) was Rightclicked self.
                        RightClickMenu.PopUpGUI(UNIT);
                    }
                }
                else
                {//------------ Rightclick on Ground...
                    GameObject.Destroy(gameObject.GetComponent <Focus>());
                }
            }
            else if (IsLockedToThis)
            {
                UNIT.Options.OptionsBase_RIGHTCLICK(qamRay, hold);
            }
        }
    }
예제 #5
0
    public void Update()
    {
        position = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
        dragging = IsDragging();

        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit))
        {
            ObjectInformation info = hit.transform.GetComponent <ObjectInformation> ();
            if (info)
            {
                if (Input.GetMouseButtonUp(0) && info.item.type != ItemType.Deployer)
                {
                    player.AddToInventory(info.item, info.item.count);
                    info.item.DestroyWorldObject();
                }
                else if (Input.GetMouseButtonUp(1))
                {
                    RightClickMenu rcm = transform.gameObject.AddComponent <RightClickMenu> ();
                    rcm.Init(info.item, WindowType.WorldObject);
                    print(info.item.type.ToString());
                }
            }
        }
    }
예제 #6
0
 void Start()
 {
     rcm        = this;
     trans      = gameObject.GetComponent <RectTransform>();
     map        = GameObject.Find("MapGenerator").GetComponent <MapGenerator>();
     mousePos   = new Vector2();
     toolTipPos = trans.anchoredPosition;
     hideMenu();
 }
예제 #7
0
 private void Start()
 {
     if (instance)
     {
         DestroyImmediate(this);
     }
     else
     {
         instance = this;
     }
 }
예제 #8
0
    void WindowFunction(int windowID)
    {
        int x = 0, y = 0;

        //for each item in inventory
        foreach (Item item in player.inventory_items)
        {
            //index position of the item : add to y
            if (x >= width)
            {
                x -= width;
                y++;
            }
            if (!item.nullified)
            {
                if (item.type != ItemType.Null)
                {
                    //default button : used with all items : add window top border
                    Vector2 position = new Vector2((button_size + button_margin) * x + button_margin, (button_size + button_margin) * y + skin.window.border.top + button_margin),
                            size     = new Vector2(button_size, button_size);
                    Rect button      = new Rect(position, size);

                    //item button
                    if (GUI.Button(button, item.texture))
                    {
                        //Left clicked the item
                        if (Event.current.button == 0 && item.equip_location != null)                          //left clicked

                        //equip to the first equip_location

                        {
                            player.Equip(item, item.equip_location [0]);
                            return;

                            //Right clicked the item
                        }
                        else if (Event.current.button == 1)
                        {
                            //add right click menu to the player object as a script
                            RightClickMenu rcm = transform.gameObject.AddComponent <RightClickMenu> ();
                            rcm.Init(item, WindowType.Inventory);
                        }
                    }
                    if (item.stackable)
                    {
                        GUI.Label(button, item.count.ToString());
                    }
                }
            }
            x++;
        }
    }
예제 #9
0
 private void HistoryView_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         RightClickMenu.Show(HistoryView, e.X, e.Y);
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (HistoryView.selectedItem == -1)
         {
             HistoryView.SelectItem(_hackSelect, true);
         }
     }
 }
예제 #10
0
        public void OnRightClickMenuCreated(RightClickMenu rightClickMenu)
        {
            var contextMenu = (ContextMenu)(_rightClickMenuContextMenu.GetValue(rightClickMenu));
            var modsGroup   = new MenuItem("Mods");

            foreach (var modMenuItem in _modMenuItems)
            {
                AddMenuItem(modMenuItem, modsGroup);
            }
            if (!_modMenuItems.Any())
            {
                modsGroup.Enabled = false;
            }
            contextMenu.Items.Insert(contextMenu.Items.Count - 1, modsGroup);
        }
예제 #11
0
 private void PrvwBtn_Click(object sender, EventArgs e)
 {
     if (!IsPreviewEnabled)
     {
         RightClickMenu.Show(PrvwBtn, new System.Drawing.Point(1, 20));
     }
     else
     {
         IsPreviewEnabled         = false;
         StartNormalPrvw1.Enabled = true;
         StartNormalPrvw2.Enabled = true;
         StartNormalPrvw3.Enabled = true;
         StartCustomPrvw.Enabled  = true;
     }
 }
예제 #12
0
        private void TasView_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu)
            {
                RightClickMenu.Show(TasView, e.X, e.Y);
            }
            else if (e.Button == MouseButtons.Left)
            {
                CurrentTasMovie.SupressGreenzonging = false;
                _startMarkerDrag      = false;
                _startFrameDrag       = false;
                _startBoolDrawColumn  = string.Empty;
                _startFloatDrawColumn = string.Empty;
                // Exit float editing if value was changed with cursor
                if (_floatEditRow != -1 && _floatPaintState != CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn))
                {
                    _floatEditRow = -1;
                    RefreshDialog();
                }
                _floatPaintState = 0;
                _floatEditYPos   = -1;
                _leftButtonHeld  = false;

                if (_floatEditRow == -1)
                {
                    CurrentTasMovie.ChangeLog.EndBatch();
                }
            }

            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (_rightClickFrame != -1)
                {
                    _rightClickInput = null;
                    _rightClickFrame = -1;
                    CurrentTasMovie.ChangeLog.EndBatch();
                }
            }

            _supressContextMenu = false;

            DoTriggeredAutoRestoreIfNeeded();
        }
예제 #13
0
    public void Start()
    {
        player = GetComponent <Player>();
        skin   = Resources.Load("GUI Skins/Normal") as GUISkin;

        //set the size of the rect : start with 0 height, will be determined later in WindowFunction
        size = new Vector2(button_width, 0);

        //get the right_click_menu on the player
        RightClickMenu rcm = transform.GetComponent <RightClickMenu> ();

        if (rcm != this)        //if a right_click_menu already exists, delete it
        {
            Destroy(rcm);
        }

        //set the position of the menu at the cursor
        position = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
    }
예제 #14
0
 public static unsafe void Notify(PluginNotification* notification)
 {
     switch (notification->Reason)
     {
         case PluginNotificationReason.DatabaseLoaded:
             DataSource = new DataSource(
                 databasePath: Marshal.PtrToStringAnsi(notification->DatabasePath),
                 mainWnd: notification->MainWnd);
             RightClickMenu = new RightClickMenu(DataSource);
             break;
         case PluginNotificationReason.DatabaseUnloaded:
             DataSource.DatabasePath = null;
             break;
         case PluginNotificationReason.StatusRightClick:
             RightClickMenu.ContextMenu.IsOpen = true;
             break;
         case PluginNotificationReason.SettingsChange:
             break;
     }
 }
예제 #15
0
    void Start()
    {
        rectTransform = GetComponent <RectTransform>();

        beBlock      = GetComponent <BEBlock>();
        holding      = false;
        isDragging   = false;
        holdCounter  = 0;
        onDragCanvas = GameObject.FindGameObjectWithTag("onDragCanvas").transform;
        mainCanvas   = GameObject.FindGameObjectWithTag("GameController").transform.GetChild(1).gameObject;

        foreach (Transform child in mainCanvas.transform)
        {
            if (child.GetComponent <RightClickMenu>())
            {
                rightClickMenu = child.GetComponent <RightClickMenu>();
            }
        }

        StartCoroutine(BELayoutRebuild.DelayedLayoutRebuild(beBlock));
    }
예제 #16
0
        private void ObjectGrid_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == 0 && e.RowIndex != -1)
            {
                DataGridViewCheckBoxCell cell = ObjectGrid.Rows[e.RowIndex].Cells[0] as DataGridViewCheckBoxCell;
                if ((bool)cell.EditingCellFormattedValue)
                {
                    ObjectGrid.Rows[e.RowIndex].ReadOnly = false;
                }
                else
                {
                    ObjectGrid.Rows[e.RowIndex].ReadOnly          = true;
                    ObjectGrid.Rows[e.RowIndex].Cells[0].ReadOnly = false;
                }
            }

            if (e.Button == MouseButtons.Right)
            {
                RightClickMenu.Show(Cursor.Position.X, Cursor.Position.Y);
                currentCell = new Tuple <int, int>(e.RowIndex, e.ColumnIndex);
            }
        }
        public static unsafe void Notify(PluginNotification *notification)
        {
            switch (notification->Reason)
            {
            case PluginNotificationReason.DatabaseLoaded:

                mainWnd        = notification->MainWnd;
                RightClickMenu = new RightClickMenu(notification->MainWnd);
                break;

            case PluginNotificationReason.DatabaseUnloaded:
                break;

            case PluginNotificationReason.StatusRightClick:

                RightClickMenu.ContextMenu.IsOpen = true;
                break;

            case PluginNotificationReason.SettingsChange:
                break;
            }
        }
예제 #18
0
    void WindowFunction(int windowID)
    {
        int index = 0;

        foreach (Rect r in slots)
        {
            GUI.Box(r, "");

            if (player.equipment_items [index] != null)
            {
                if (player.equipment_items [index].type != ItemType.Null)
                {
                    if (player.equipment_items [index] != null)
                    {
                        Item    item = player.equipment_items [index];
                        Vector2 position;
                        Rect    button;

                        button = slots [index];

                        if (GUI.Button(button, item.texture))
                        {
                            if (Input.GetMouseButtonUp(0))
                            {
                                player.Unequip(item);
                            }
                            else if (Input.GetMouseButtonUp(1))
                            {
                                RightClickMenu rcm = transform.gameObject.AddComponent <RightClickMenu> ();
                                rcm.Init(item, WindowType.Equipment);
                            }
                        }
                    }
                }
            }
            index++;
        }
    }
예제 #19
0
파일: Plugin.cs 프로젝트: ywscr/amibroker
        public static unsafe void Notify(PluginNotification *notification)
        {
            switch (notification->Reason)
            {
            case PluginNotificationReason.DatabaseLoaded:
                DataSource = new DataSource(
                    databasePath: Marshal.PtrToStringAnsi(notification->DatabasePath),
                    mainWnd: notification->MainWnd);
                RightClickMenu = new RightClickMenu(DataSource);
                break;

            case PluginNotificationReason.DatabaseUnloaded:
                DataSource.DatabasePath = null;
                break;

            case PluginNotificationReason.StatusRightClick:
                RightClickMenu.ContextMenu.IsOpen = true;
                break;

            case PluginNotificationReason.SettingsChange:
                break;
            }
        }
예제 #20
0
        private void TasView_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu && TasView.SelectedRows.Any())
            {
                if (Global.MovieSession.Movie.FrameCount < TasView.SelectedRows.Max())
                {
                    // trying to be smart here
                    // if a loaded branch log is shorter than selection, keep selection until you attempt to call context menu
                    // you might need it when you load again the branch where this frame exists
                    TasView.DeselectAll();
                    RefreshTasView();
                }
                else
                {
                    RightClickMenu.Show(TasView, e.X, e.Y);
                }
            }
            else if (e.Button == MouseButtons.Left)
            {
                ClearLeftMouseStates();
            }

            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (_rightClickFrame != -1)
                {
                    _rightClickInput     = null;
                    _rightClickOverInput = null;
                    _rightClickFrame     = -1;
                    CurrentTasMovie.ChangeLog.EndBatch();
                }
            }

            _supressContextMenu = false;

            DoTriggeredAutoRestoreIfNeeded();
        }
예제 #21
0
 public void AskForOrder()
 {
     RightClickMenu.PopUpGUI(this);
 }
예제 #22
0
 public void OnRightClickMenuCreated(RightClickMenu rightClickMenu)
 {
     var contextMenu = (ContextMenu)(_rightClickMenuContextMenu.GetValue(rightClickMenu));
     var modsGroup = new MenuItem("Mods");
     foreach (var modMenuItem in _modMenuItems)
     {
         AddMenuItem(modMenuItem, modsGroup);
     }
     if (!_modMenuItems.Any())
     {
         modsGroup.Enabled = false;
     }
     contextMenu.Items.Insert(contextMenu.Items.Count - 1, modsGroup);
 }
예제 #23
0
    public void click()
    {
        Unit u = mg.getCurrentUnit();

        if (action.hasMovement())
        {
            mg.lastPlayerPath  = mg.getCurrentUnit().currentPath;
            mg.currentKeysTile = action.movementTile;
        }
        if (action.movementTypes.Contains(MovementType.Move))
        {
            u.unitMovement    = UnitMovement.Move;
            u.currentMoveDist = u.moveDistLeft;
            u.startMoving(false);
        }
        if (action.movementTypes.Contains(MovementType.BackStep))
        {
            u.unitMovement    = UnitMovement.BackStep;
            u.currentMoveDist = 1;
            u.startMoving(true);
        }
        if (action.minorTypes.Contains(MinorType.Escape))
        {
            u.unitMovement    = UnitMovement.Escape;
            u.currentMoveDist = 2;
            u.startMoving(true);
        }
        if (action.standardTypes.Contains(StandardType.Attack))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startAttacking();
        }
        if (action.standardTypes.Contains(StandardType.OverClock))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startAttacking(true);
        }
        if (action.standardTypes.Contains(StandardType.Throw))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startThrowing();
        }
        if (action.standardTypes.Contains(StandardType.Intimidate))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startIntimidating();
        }
        if (action.standardTypes.Contains(StandardType.InstillParanoia))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startInstillingParanoia();
        }
        if (action.minorTypes.Contains(MinorType.Invoke))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startInvoking();
        }
        if (action.minorTypes.Contains(MinorType.Stealth))
        {
            u.rollStealth();
        }
        if (action.movementTypes.Contains(MovementType.Recover))
        {
            u.recover();
        }
        if (action.gameMasterTypes.Contains(GameMasterType.Damage1))
        {
            action.actualTile.getCharacter().damage(1, null);            // MapGenerator.mg.selectedUnit);
            Debug.Log(MapGenerator.mg.selectedUnit.getName());
            action.actualTile.getCharacter().showDamage(1, true, false);
        }
        if (action.gameMasterTypes.Contains(GameMasterType.Heal1))
        {
            action.actualTile.getCharacter().gainHealth(1);
            action.actualTile.getCharacter().showHitpoints(1, true);
        }
        if (action.gameMasterTypes.Contains(GameMasterType.Heal10))
        {
            action.actualTile.getCharacter().gainHealth(10);
            action.actualTile.getCharacter().showHitpoints(10, true);
        }

        /*	if (action.minorTypes.Contains(MinorType.OneOfMany))  {
         *
         *      }*/
        if (action.standardTypes.Contains(StandardType.Heal))
        {
            u.attackEnemy = action.actualTile.getCharacter();
            u.startHealing();
        }
        if (action.minorTypes.Contains(MinorType.Loot))
        {
            u.lootTile = action.actualTile;
        }
        if (action.minorTypes.Contains(MinorType.TurretOn) || action.minorTypes.Contains(MinorType.TurretOff))
        {
            u.turretTile = action.actualTile;
        }
        if (action.standardTypes.Contains(StandardType.PickUpTrap))
        {
            u.pickUpTrapTile = action.actualTile;            // (action.actualTile.getCharacter() as TrapUnit).trap;
        }
        if (action.standardTypes.Contains(StandardType.PickUpTurret))
        {
            u.pickUpTurretTile = action.actualTile;            //(action.actualTile.getCharacter() as TurretUnit).turret;
        }
        if (action.standardTypes.Contains(StandardType.MoveBody))
        {
            u.moveUnit = action.actualTile.getCharacter();
            MapGenerator.mg.resetRanges();
        }
        if (action.minorTypes.Contains(MinorType.Examine))
        {
            u.examineUnit(action.actualTile.getCharacter());
            u.useMinor(MinorType.Examine, false, false);
        }
        RightClickMenu.hideMenu(true);
    }
예제 #24
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);


            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                mouseDown    = false;
                oldXLocation = -1;
                bool ignoreClick = false;
                if (Math.Abs(offset) > 5)
                {
                    TabOffset  += offset;
                    ignoreClick = true;
                }

                offset = 0;
                if (tabRects == null)
                {
                    UpdateTabRects();
                }

                if (!ignoreClick)
                {
                    for (int i = 0; i < tabRects.Count; i++)
                    {
                        if (tabRects[i].XButtonRect.Contains(e.Location))
                        {
                            if (baseTabControl.TabCount > 1 && i == BaseTabControl.SelectedIndex)
                            {
                                if (i == 0)
                                {
                                    baseTabControl.SelectTab(1);
                                }
                                else
                                {
                                    baseTabControl.SelectTab(i - 1);
                                }
                                Application.DoEvents();
                            }
                            baseTabControl.TabPages.RemoveAt(i);
                            previousSelectedTabIndex = -1;
                            UpdateTabRects();
                            return;
                        }
                        else if (tabRects[i].TabRect.Contains(e.Location))
                        {
                            baseTabControl.SelectedIndex = i;
                        }
                    }
                }
                animationSource = e.Location;
                UpdateTabRects();
                Invalidate();
            }
            else
            {
                RightClickLocation = e.Location;
                RightClickMenu.Show(PointToScreen(e.Location));
            }
        }