Пример #1
0
        private void OnRadioButtonClick(object obj)
        {
            var type = Enum.Parse <MyPinType>(obj.ToString());

            switch (type)
            {
            case MyPinType.Start:
                Pin.IconPath = IconsPath.StartEndPin;
                Pin.Label    = MyPinType.Start.ToString();
                Pin.MyType   = MyPinType.Start;
                break;

            case MyPinType.Waypoint:
                Pin.IconPath = IconsPath.WaypointPin;
                Pin.MyType   = MyPinType.Waypoint;
                Pin.Label    = "";
                break;

            case MyPinType.End:
                Pin.IconPath = IconsPath.StartEndPin;
                Pin.MyType   = MyPinType.End;
                Pin.Label    = MyPinType.End.ToString();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            TypeSelected?.Invoke(Pin);
        }
Пример #2
0
        private void btn_Click(object sender, EventArgs e)
        {
            if (sender == btnStandard)
            {
                Type = ConnectionType.Wizard;
            }
            else if (sender == btnSdkLoginControl)
            {
                Type = ConnectionType.Sdk;
            }
            else if (sender == btnCertificate)
            {
                Type = ConnectionType.Certificate;
            }
            else if (sender == btnClientSecret)
            {
                Type = ConnectionType.ClientSecret;
            }
            else if (sender == btnMfa)
            {
                Type = ConnectionType.Mfa;
            }
            else
            {
                Type = ConnectionType.ConnectionString;
            }

            TypeSelected?.Invoke(this, new EventArgs());
        }
Пример #3
0
 private void btn_Click(object sender, EventArgs e)
 {
     if (sender == btnStandard)
     {
         Type = ConnectionType.Wizard;
     }
     else if (sender == btnSdkLoginControl)
     {
         Type = ConnectionType.Sdk;
     }
     else if (sender == btnConnectionString)
     {
         Type = ConnectionType.ConnectionString;
     }
     else
     {
         Type = ConnectionType.ServicePrincipal;
     }
     TypeSelected?.Invoke(this, new EventArgs());
 }
Пример #4
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.GetRayIntersection(ray);
            //Check is hit and is not a tile.
            if (hit.collider != null && hit.collider.gameObject.GetComponent <Tile>() == null)
            {
                if (hit.collider.gameObject.tag == Constants.UNIT_TAG)
                {
                    selected = TypeSelected.UNIT;
                    gameManager.setSelected(hit.collider.gameObject);
                    GameObject tile = InputHelper.getObjectInLayerAtPoint(MapLayer.TILE, Input.mousePosition);
                    if (tile == null)
                    {
                        Debug.Log("TERRIBLE NO TILE BENEATH UNIT");
                    }
                    else
                    {
                        Debug.Log(hit.collider.gameObject.GetComponent <Unit>());
                        moveDisplayController.displayMovesFor(hit.collider.gameObject.GetComponent <Unit>(), tile.GetComponent <Tile>());
                    }
                }
                selectedObject = hit.collider.gameObject;
                return;
            }
            else
            {
                selected   = TypeSelected.CAMERA;
                oldPos     = transform.position;
                dragOrigin = Camera.main.ScreenToViewportPoint(Input.mousePosition);
            }
        }

        if (Input.GetMouseButton(0) && TypeSelected.CAMERA == selected)
        {
            Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition) - dragOrigin;
            transform.position = oldPos + -pos * dragSpeed;
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (selected == TypeSelected.UNIT)
            {
                GameObject topLayer = InputHelper.getObjectInLayerAtPoint(MapLayer.ANY, Input.mousePosition);
                if (topLayer != null)
                {
                    if (topLayer.GetComponent <Unit>() != null)
                    {
                        Unit selectedUnit = selectedObject.GetComponent <Unit>();
                        if (gameManager.FightUnit(selectedUnit, topLayer.GetComponent <Unit>()))
                        {
                            //display fight Anim
                        }
                        else
                        {
                            //Error state handle
                            Debug.Log("Undoing select unit");
                            moveDisplayController.hideMovesFor(selectedUnit,
                                                               InputHelper.getObjectInLayerAtPoint(MapLayer.TILE, selectedUnit.transform.position).GetComponent <Tile>());
                        }
                    }
                }
            }
            else if (selected == TypeSelected.BUILDING)
            {
                //TODO
            }
            else if (selected == TypeSelected.TILE)
            {
                //TODO handle case for type
            }
            selectedObject = null;
            selected       = TypeSelected.VOID;
        }
    }