Пример #1
0
 void localClickEnd(ButtonClick button)
 {
     if (button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTrigger)
     {
         triggerPressed = false;
     }
 }
Пример #2
0
 void clickEnd(ButtonClick button)
 {
     if ((int)button.button == (int)teleportCondition)
     {
         clicking = false;
     }
 }
Пример #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (sender == ButtonHPlus)
     {
         ButtonClick?.Invoke(this, 1);
     }
     if (sender == ButtonHMinus)
     {
         ButtonClick?.Invoke(this, 2);
     }
     if (sender == ButtonVPlus)
     {
         ButtonClick?.Invoke(this, 3);
     }
     if (sender == ButtonVMinus)
     {
         ButtonClick?.Invoke(this, 4);
     }
     if (sender == ButtonAuto)
     {
         ButtonClick?.Invoke(this, 5);
     }
     if (sender == ButtonLarger)
     {
         ButtonClick?.Invoke(this, 6);
     }
     if (sender == ButtonSmaller)
     {
         ButtonClick?.Invoke(this, 7);
     }
 }
Пример #4
0
 void localClickStart(ButtonClick click)
 {
     if (click.button == EasyInputConstants.CONTROLLER_BUTTON.AButton)
     {
         EasyInputHelper.resetMotion();
     }
 }
Пример #5
0
 void localClickStart(ButtonClick button)
 {
     if (button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTrigger)
     {
         EasyInputHelper.resetMotion();
     }
 }
Пример #6
0
        void clickEnd(ButtonClick button)
        {
            if ((int)button.button == (int)grabCondtion && grabMode)
            {
                clicking         = false;
                previousClicking = false;
                grabMode         = false;
                if (myRigidbody != null)
                {
                    if (dropCondition == EasyInputConstants.DROP_MODE.Drop)
                    {
                        myRigidbody.velocity        = Vector3.zero;
                        myRigidbody.angularVelocity = Vector3.zero;
                    }
                    else if (dropCondition == EasyInputConstants.DROP_MODE.ThrowLatestVelocity)
                    {
                        myRigidbody.velocity        = ((lastFramePosition - twoFramesAgoPosition) / Time.deltaTime) * throwSensitivity;
                        myRigidbody.angularVelocity = Vector3.zero;
                    }
                    else if (dropCondition == EasyInputConstants.DROP_MODE.ThrowAvgLastTwoFrames)
                    {
                        myRigidbody.velocity        = ((lastFramePosition - threeFramesAgoPosition) / (2 * Time.deltaTime)) * throwSensitivity;
                        myRigidbody.angularVelocity = Vector3.zero;
                    }
                }
            }

            if (button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTouchClick)
            {
                padClick   = false;
                clickDelta = 0f;
            }
        }
Пример #7
0
    //测试
    //SynopsisSystem syn;

    #endregion

    #region 生命周期

    private void Awake()
    {
        CurrentUIType.UIForms_ShowMode = UIFormShowMode.Normal;
        #region abandon
        //测试
        //bg = transform.Find("Bg").gameObject;
        //nameTxt = transform.Find("Bg/Text/name").GetComponent<Text>();
        //description = transform.Find("Bg/Text/description").GetComponent<Text>();
        //rewards = transform.Find("Bg/Text/rewards").GetComponent<Text>();
        //need = transform.Find("Bg/Text/needbig").GetComponent<Text>();
        //button = transform.Find("Bg/Text/Button").GetComponent<Button>();
        //header = transform.Find("Bg/Text/header").GetComponent<Text>();
        #endregion

        bg          = this.gameObject;
        nameTxt     = UnityHelper.FindTheChildNode(gameObject, "NameText").GetComponent <Text>();
        description = UnityHelper.FindTheChildNode(gameObject, "Description Text").GetComponent <Text>();
        need        = UnityHelper.FindTheChildNode(gameObject, "Needbig").GetComponent <Text>();
        Debug.Log(need.name);
        header = UnityHelper.FindTheChildNode(gameObject, "Title Text").GetComponent <Text>();
        Debug.Log(header.name);
        button = UnityHelper.FindTheChildNode(gameObject, "Button").GetComponent <Button>();
        Debug.Log(button.name);
        exit    = UnityHelper.FindTheChildNode(gameObject, "Exit").GetComponent <Button>();
        rewards = UnityHelper.FindTheChildNode(gameObject, "Rewards").GetComponent <Text>();
        Debug.Log(rewards.name);
        showUI      = new ShowUI();
        buttonClick = new ButtonClick();
        EventCenter.AddListener <TaskSystem, NpcSystem, TalkSystem>(EventDefine.ShowTaskButton, ShowButtonAndState);
        EventCenter.AddListener(EventDefine.Init, InitButton);
        EventCenter.AddListener <TaskSystem>(EventDefine.ShowUI, ShowPanel);
        EventCenter.AddListener <SynopsisSystem>(EventDefine.SetTaskPanel, SetTaskPanel);
        EventCenter.AddListener <SynopsisSystem, TalkSystem>(EventDefine.SetTaskPanelEndTalk, ShowTaskPanel);
    }
Пример #8
0
 void localClickEnd(ButtonClick click)
 {
     if (click.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTouchClick)
     {
         isClicking = false;
     }
 }
Пример #9
0
        void QueryInput(float unscaledDeltaTime)
        {
            // Detect input for pause button (make sure no managed dialogs are shown, either).
            if ((NumManagedMenus <= 0) && (Input.GetButtonDown(PauseInput) == true))
            {
                // Attempt to grab the pause menu
                if (PauseMenu != null)
                {
                    if (PauseMenu.CurrentState == IMenu.State.Hidden)
                    {
                        PauseMenu.Show();

                        // Indicate button is clicked
                        ButtonClick.Play();
                    }
                    else if (PauseMenu.CurrentState == IMenu.State.Visible)
                    {
                        PauseMenu.Hide();

                        // Indicate button is clicked
                        ButtonClick.Play();
                    }
                }
            }
        }
Пример #10
0
        void localClickEnd(ButtonClick button)
        {
            if (buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireAtRepeatRate || buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireOnceAtButtonDown)
            {
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.AButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTouchClick)
                {
                    submit = false;
                }
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.BButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.Back)
                {
                    cancel = false;
                }
            }
            else
            {
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.AButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTouchClick)
                {
                    submit            = true;
                    submitForOneFrame = true;
                }
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.BButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.Back)
                {
                    cancel            = true;
                    cancelForOneFrame = true;
                }
            }

            if (button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTrigger || button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRHMDPadTap)
            {
                triggerUpThisFrame = true;
            }
        }
Пример #11
0
 void localButtonLongClickStart(ButtonClick button)
 {
     if (button.button == myButton && (button.player == player || player == EasyInputConstants.PLAYER_NUMBER.Any))
     {
         onLongClickStart.Invoke(button);
     }
 }
Пример #12
0
    public void Initialize(ButtonClick onButtonClick)
    {
        _popup.SetActive(false);

        _replayButton.onClick.AddListener(() => onButtonClick("Game"));
        _menuButton.onClick.AddListener(() => onButtonClick("Menu"));
    }
Пример #13
0
    public void Start()
    {
        Debug.Log(SceneManager.GetActiveScene().name);
        _buttonClick = GameObject.Find("StartButton").GetComponent <ButtonClick>();
        _eneCtrl     = GameObject.Find("Enemy").GetComponent <EnemyController>();
        _namelist    = _buttonClick.namelist;
        //GameObject hero = GameObject.Find("self");

        //主人公カメラ視点設定
        if (SceneManager.GetActiveScene().name == "Classroom_q2")
        {
            iTween.MoveTo(this.gameObject, iTween.Hash("path", iTweenPath.GetPath(PathName), "time", time));
            iTween.RotateTo(this.gameObject, iTween.Hash("x", 20, "y", 90, "z", 0, "time", time));
        }
        else
        {
            transform.position = new Vector3(-5, 2.7f, 1);
            transform.rotation = Quaternion.Euler(20, 90, 0);
        }

        enemy = GameObject.Find("Enemy");
        //enemy.name = "enemy";
        enemy.AddComponent <Rigidbody>();
        enemy.GetComponent <Rigidbody>().useGravity  = false;
        enemy.GetComponent <Rigidbody>().isKinematic = true;
    }
Пример #14
0
 void LocalClick(ButtonClick button)
 {
     if (button.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTrigger)
     {
         this.triggerClick = !this.triggerClick;
     }
 }
Пример #15
0
 void click(ButtonClick button)
 {
     if ((int)button.button == (int)teleportCondition)
     {
         clicking = true;
     }
 }
Пример #16
0
        void endThrow(ButtonClick click)
        {
            if (click.button == EasyInputConstants.CONTROLLER_BUTTON.GearVRTrigger && !preventThrowAgain)
            {
                //reset the motion variables
                EasyInputHelper.resetMotion();
                throwInProcess    = false;
                preventThrowAgain = true;
                temp               = transform.position;
                temp.y             = .5f;
                transform.position = temp;

                //here we do the throw after some sanity checks
                myRigidbody.AddRelativeForce(currentThrow, ForceMode.Impulse);
                myRigidbody.AddRelativeTorque(currentTorque, ForceMode.Impulse);


                //the sudden drop of the ball makes it want to bounce off the alley prevent this in the rigidbody
                temp   = myRigidbody.velocity;
                temp.y = 0f;
                myRigidbody.velocity = temp;

                //start clock to reset the scene
                Invoke("resetScene", 8f);
            }
        }
Пример #17
0
    public void RefreshDisplay()
    {
        items = inventory.GetItems();
        Logger.log("Items in inventory: " + items.Length);

        items = SortInventory(items);

        for (int i = 0; i < items.Length; i++)
        {
            GameObject instance = Instantiate(slotPrefab, slotParent);
            int        ii       = i;
            //instance.GetComponent<Button>().onClick.AddListener(() => displayDetails(ii));
            ButtonClick click = instance.GetComponent <ButtonClick>();
            click.leftClick.AddListener(() => DisplayDetails(ii));
            click.rightClick.AddListener(() => DisplayContext(ii));
            instance.GetComponent <InventorySlot>().Display(items[i]);
            Logger.log("Added listener with ID: " + i);
        }

        slotText.text   = "Items: " + inventory.GetSlotsUsed() + "/" + playerProperties.slotCapacity;
        weightText.text = "Capacity: " + playerProperties.weight.Value + "/" + playerProperties.maxWeight.Value;

        float gradientTime = playerProperties.weight.Value / playerProperties.maxWeight.Value;

        //Logger.log("Time: " + gradientTime);
        weightText.color = weightTextGradient.Evaluate(gradientTime);

        slotText.gameObject.SetActive(playerProperties.GetSlotCapacityEnabled());
        weightText.gameObject.SetActive(playerProperties.GetWeightCapacityEnabled()); //Only show texts if type capacity is enabled
    }
Пример #18
0
 private void label_Click(object sender, EventArgs e)
 {
     if (ButtonClick != null)
     {
         ButtonClick.Invoke(this, e);
     }
 }
Пример #19
0
 void localClickStart(ButtonClick button)
 {
     if (button.button == EasyInputConstants.CONTROLLER_BUTTON.MenuButton)
     {
         SceneManager.LoadScene("MasterExample");
     }
 }
Пример #20
0
 void localButtonDoubleClickEnd(ButtonClick button)
 {
     if (button.button == myButton && (button.player == player || player == EasyInputConstants.PLAYER_NUMBER.Any))
     {
         onDoubleClickEnd.Invoke(button);
     }
 }
Пример #21
0
 void localButtonDoubleClickEnd(ButtonClick button)
 {
     if (button.button == myButton)
     {
         onDoubleClickEnd.Invoke(button);
     }
 }
Пример #22
0
 void clickEnd(ButtonClick button)
 {
     if ((int)button.button == (int)grabCondtion)
     {
         clicking = false;
     }
 }
Пример #23
0
 void localButtonClick(ButtonClick button)
 {
     if (button.button == myButton)
     {
         onClick.Invoke(button);
     }
 }
Пример #24
0
 void localButtonClickStart(ButtonClick button)
 {
     if (button.button == myButton)
     {
         onClickStart.Invoke(button);
     }
 }
Пример #25
0
        void localClickStart(ButtonClick button)
        {
            if (buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireAtRepeatRate || buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireOnceAtButtonDown)
            {
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.AButton)
                {
                    submit = true;
                }
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.BButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.XButton)
                {
                    cancel = true;
                }
            }

            //check if we should only do for one frame
            if (buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireOnceAtButtonDown)
            {
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.AButton)
                {
                    submitForOneFrame = true;
                }
                if (button.button == EasyInputConstants.CONTROLLER_BUTTON.BButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.XButton)
                {
                    cancelForOneFrame = true;
                }
            }
        }
Пример #26
0
 void localClickEnd(ButtonClick button)
 {
     if (buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireAtRepeatRate || buttonMode == EasyInputConstants.INPUT_MODULE_BUTTON_MODE.FireOnceAtButtonDown)
     {
         if (button.button == EasyInputConstants.CONTROLLER_BUTTON.AButton)
         {
             submit = false;
         }
         if (button.button == EasyInputConstants.CONTROLLER_BUTTON.BButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.XButton)
         {
             cancel = false;
         }
     }
     else
     {
         if (button.button == EasyInputConstants.CONTROLLER_BUTTON.AButton)
         {
             submit            = true;
             submitForOneFrame = true;
         }
         if (button.button == EasyInputConstants.CONTROLLER_BUTTON.BButton || button.button == EasyInputConstants.CONTROLLER_BUTTON.XButton)
         {
             cancel            = true;
             cancelForOneFrame = true;
         }
     }
 }
 private void pCollapse_Click(object sender, EventArgs e)
 {
     if (pCollapse.Visible)
     {
         ButtonClick?.Invoke(this, EventArgs.Empty);
     }
 }
 void localButtonQuickClickEnd(ButtonClick button)
 {
     if (button.button == myButton)
     {
         onQuickClickEnd.Invoke();
     }
 }
Пример #29
0
 private void ButtonSystem()
 {
     if (mouseOnIt || clicked == true) //&& buttonHighLight == (ButtonClick)System.Enum.Parse(typeof(ButtonClick), this.name)))
     {
         TextMesh.fontSize = fontSizeMax;
         if (Input.GetMouseButtonDown(0))
         {
             if (clicked == false)
             {
                 clicked = true;
                 //Convert the name of the object to an enum
                 buttonHighLight = (ButtonClick)System.Enum.Parse(typeof(ButtonClick), this.name);
             }
             else
             {
                 clicked         = false;
                 buttonHighLight = ButtonClick.None;
             }
             //Debug.Log(buttonHighLight);
         }
     }
     if (!mouseOnIt && Input.GetMouseButtonDown(0))
     {
         TextMesh.fontSize = defaultFontSize;
         buttonHighLight   = ButtonClick.None;
         Debug.Log(buttonHighLight);
     }
 }
Пример #30
0
 void click(ButtonClick button)
 {
     if ((int)button.button == (int)grabCondtion)
     {
         clicking = true;
     }
 }
Пример #31
0
        public Button(HUD h, Texture2D tex, ButtonClick c)
        {
            hud = h;
            position = Vector2.Zero;
            texture = tex;
            click = c;

            center = new Vector2(texture.Width / 2, texture.Height / 2);
        }
 void Awake()
 {
     if (!Instance)
         Instance = this;
     else if (Instance != this)
     {
         Destroy(gameObject);
         return;
     }
 }
Пример #33
0
        public HUD(Game1 game, SpriteBatch sb)
            : base(game)
        {
            windowSizeX = Game.Window.ClientBounds.Width;
            windowSizeY = Game.Window.ClientBounds.Height;

            verticalPosition = windowSizeY - 40;

            colorButtonClick = new ButtonClick(game.dialogBox.ColorSelection);
            saveButtonClick = new ButtonClick(game.dialogBox.SaveDialog);
            loadButtonClick = new ButtonClick(game.dialogBox.LoadDialog);

            spriteBatch = sb;
        }
Пример #34
0
 protected void OnClicked(EventArgs e, ref bool isOk, ButtonClick button, Bitmap icon)
 {
     if (OnButtonClick != null)
         OnButtonClick(e, ref isOk, button,icon);
 }