Desno365 / DesnoGuns-Mod

:gun: :bomb: Guns. Weapons. Explosions. This is the DesnoGuns Mod!
http://desno365.net/minecraft/desnoguns-mod/
Other
15 stars 3 forks source link

Can't move the aim of the player while shooting #1

Open Desno365 opened 9 years ago

Desno365 commented 9 years ago

Reported only on some devices. Can't find what causes the bug.

Bug saw by me on Samsung Galaxy Tab 8.9 with Android 4.0.4. It was reported also on samsung galaxy S3 (SPH-L710), Samsung Galaxy Note 3 and on Samsung Galaxy S4. (maybe it's a problem of Samsung devices?).

Devices that I'm sure don't have the bug: Moto G (1st Gen.), Nexus 4, One Plus One.

The bug happens when the user clicks the fire button, then with another finger he touches outside the fire button, devices with the bug give the second touch (the outside touch) to the fire button View, this means that users with the bug that are holding the fire button can't do anything else than shooting, they can't move the aiming or move the player for example.

I tried a fix for the bug in this way (with no luck unfortunately):

shotText.setOnTouchListener(new android.view.View.OnTouchListener()
{
    onTouch: function(v, event)
    {
        var rect = new android.graphics.Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
        if(!rect.contains(v.getLeft() + event.getX(), v.getTop() + event.getY())) // detect if the event happens inside the view
        {
            // this code is executed when the user press the fire button outside the fire button (it doesn't make sense, but that's the bug).
            currentActivity.getWindow().getRootView().onTouchEvent(event); // I tried here to give the touch event to the decor view or to the root view, no one of these worked.
            //currentActivity.getWindow().getDecorView().onTouchEvent(event);
        }
        var action = event.getActionMasked();
        if(action == android.view.MotionEvent.ACTION_POINTER_DOWN)
        {
            clientMessage("second touch"); // ACTION POINTER DOWN means that a multi touch event has just been added
        }

        onTouchWeaponShootCreative(event, currentGun); // this is just the code the mod executes for shooting, it has nothing to do with the bug.
        return false;
    }

That's all for now, maybe my explanation wasn't really good, sorry for that, also my English is not the best.

ghost commented 8 years ago

this is hard to fix, have you ever get a help from @zhuowei and told him to fix this?

or Maybe some Samsung devices are fake

mikey1134 commented 8 years ago

I used to do some JavaScript Programming a few years back with Arduino and GameBoy, so wouldn't there be a way to run both scripts at once? Also, couldnt the button be activated, when at a certain coordinate point, the weapon will fire? I'm probably wrong on this one, but I'm going to try and see if I can get this to work.

mikey1134 commented 8 years ago

Another thing we could try is if when you aim, you change a variable, ex. aimTrig = true, so we can just hit a block instead of having to hit the fire button. That block could also be air. I will try to make an example program.

ghost commented 8 years ago

Can't help cuz maybe ask questions on stackoverflow.com?