Example #1
0
    void Start()
    {
        jumpButtonUp   = true;
        jumpButtonDown = false;

        pickUpButtonUp = true;

        itemSpecialActionButtonUp = true;


        DontDestroyOnLoad(this.gameObject);

        activeDynamicButtons = new List <DynamicButton>();
        dynamicButtonsStore  = new List <DynamicButton>();

        controlCanvas           = transform.GetComponentInChildren <ControlCanvas>();
        pickUpButton            = transform.GetChild(0).Find("PickUp").gameObject;
        itemSpecialActionButton = transform.GetChild(0).Find("ItemSpecialAction").gameObject;
        throwButton             = transform.GetChild(0).Find("ThrowItemButton").gameObject;
        jumpButton = transform.GetChild(0).Find("Jump").gameObject;

        pickUpButton.SetActive(false);
        itemSpecialActionButton.SetActive(false);

        arrowsHolder = gameObject.transform.Find("Controls").Find("Arrows").GetComponent <RectTransform>();

        if (Instance == this)
        {
            GameManager.Instance.virtualJoystick = this;
        }

        Debug.Log("control canvas initiated");
    }
        private void ScopeMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            _isDragging = true;

            ControlCanvas.CaptureMouse();
            _firstMousePoint = _lastMousePoint = e.GetPosition(this);
        }
 // Update is called once per frame
 void Update()
 {
     if (pressed)
     {
         VirtualJoystick.horizontalValue = -1 * ControlCanvas.StartCounter();
     }
 }
Example #4
0
        public CanvasGR3(Size tam)
        {
            //paneles = new List<Panel>();
            Figuras     = new Lista_Figuras();
            CanvasPanel = new Panel();

            relaciones           = new List <Figura_Relacion>();
            CanvasPanel.Location = new System.Drawing.Point(0, 150);
            CanvasPanel.Size     = new Size(tam.Width * 2, tam.Height * 2);
            ControlCanvas.DefineOrigin(CanvasPanel, this);
            InitializeComponent();
        }
Example #5
0
        public void CrearPanel()//permite crear un panel con una clase
        {
            Figura_Clase fig = new Figura_Clase();

            fig.DibujarFigura();

            ControlExtension.Draggable(fig.Contenedor, true);
            ControlCanvas.Relatable(fig.Contenedor, true);
            CargarFigura(fig);

            /*foreach(Control con in fig.ReturnControls())
             * {
             *  CanvasPanel.Controls.Add(con);
             * }*/
            CanvasPanel.Controls.Add(fig.Contenedor);

            //Console.WriteLine("Hola" + fig.Contenedor.Location);
        }
    //  MindWoxGoogleSignIn googleSignIn;


    public override void Attached()
    {
        // googleSignIn = FindObjectOfType<MindWoxGoogleSignIn>();

        //update transforms over network
        state.SetTransforms(state.PlayerTransform, gameObject.transform);
        if (entity.IsOwner)
        {
            //enable camera and controls
            gameObject.transform.GetChild(0).gameObject.SetActive(true);
            ControlCanvas.SetActive(true);
            //  state.Username = googleSignIn.username;
            state.isKinematic = false;
        }

        //  state.AddCallback("Username", AddUser);
        state.SetAnimator(GetComponent <Animator>());
        state.Animator.applyRootMotion = entity.IsOwner;
        state.OnPlayVideo = playVideo;
    }
        private void ScopeMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            ControlCanvas.ReleaseMouseCapture();
            if (!_isDragging)
            {
                return;
            }

            _isDragging = false;

            var endPosition = e.GetPosition(this);

            endPosition.X += (4 * ScrollPosition);

            var startPosition = _firstMousePoint;

            startPosition.X += (4 * ScrollPosition);

            AddScopeMeasure(startPosition, endPosition);
            InvalidateVisual();
        }
        private void ScopeMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            var position = e.GetPosition(this);

            if (!ValidatePosition(position))
            {
                ControlCanvas.ReleaseMouseCapture();
                _isDragging = false;

                InvalidateVisual();
            }


            if (_isDragging)
            {
                _lastMousePoint = position;
                InvalidateVisual();
            }

            CursorX.Content = "X: " + position.X;
            CursorY.Content = "Y: " + position.Y;
        }
 private void ControlCanvas_MouseLeave(object sender, MouseEventArgs e)
 {
     _isDragging = false;
     ControlCanvas.ReleaseMouseCapture();
 }
Example #10
0
 public virtual void OnPointerExit(PointerEventData ped)
 {
     VirtualJoystick.horizontalValue = 0;
     ControlCanvas.ResetCounter();
     pressed = false;
 }
Example #11
0
    public virtual void OnPointerDown(PointerEventData ped)
    {
        ControlCanvas.ResetCounter(); // might have to be removed

        pressed = true;
    }
Example #12
0
 private void Start()
 {
     instance = this;
 }