Recently brother to me White cat operation how to do, 0.0 results White Cat No Android client can not play, read the next video introduction to simply do the next
:
Core code:
usingUnityengine;usingSystem.Collections;usingSystem.Collections.Generic;usingSystem; Public classTest:monobehaviour {PrivateTest () {}PrivateVector3 Startmousedown; PrivateVector3 Lastmousedown; Private floatPresstimer; Private BOOLIscounter;//Start Count Private BOOLIsdrag;//Start dragging Private BOOLislasting;//Start a Persistent click Public floatPresstime;//Click Public floatPresslastingtime;//Persistent clicks Public floatDragdistance;//drag is greater than how much to begin to take effect #regionEvent Public StaticAction<vector3>startpressevent; Public StaticAction<vector3>endpressevent; Public StaticAction<vector3>startdragevent; Public StaticAction<vector3>enddragevent; Public StaticAction<vector3>startlastingevent; Public StaticAction<vector3>endlastingevent; #endregion #regionTest methodvoidAwake () {startpressevent+=startpress; Endpressevent+=endpress; Startdragevent+=StartDrag; Enddragevent+=EndDrag; Startlastingevent+=startlasting; Endlastingevent+=endlasting; } Private voidstartpress (Vector3 v) {Debug.Log ("Start Click event"); } Private voidendpress (Vector3 v) {Debug.Log ("End Click event"); } Private voidStartDrag (Vector3 v) {Debug.Log ("Start Drag Event"); } Private voidEndDrag (Vector3 v) {Debug.Log ("End Drag Event"); } Private voidstartlasting (Vector3 v) {Debug.Log ("start a Continuous click event"); } Private voidendlasting (Vector3 v) {Debug.Log ("End Persistent Click event"); } #endregion //Update is called once per frame voidUpdate () {if(Input.getmousebuttondown (0) ) {Iscounter=true; Startmousedown=input.mouseposition; } if(Input.getmousebuttonup (0) ) {Lastmousedown=input.mouseposition; Iscounter=false; if(Isdrag) {//Drag if(Enddragevent! =NULL) enddragevent (input.mouseposition); Isdrag=false; } Else if(islasting) {//Persistent clicks if(Endlastingevent! =NULL) endlastingevent (input.mouseposition); Islasting=false; } Else { //Click if(Endpressevent! =NULL) endpressevent (input.mouseposition); } } if(iscounter) {//Start CountPresstimer + =Time.deltatime; } Else { if(Presstimer >0&& Presstimer <presstime) {Debug.Log ("Click"); if(Startpressevent! =NULL) startpressevent (input.mouseposition); } Presstimer=0f; } if(Iscounter && mathf.abs (vector3.distance (Startmousedown, input.mouseposition)) > Dragdistance && Islasting = =false) {Debug.Log ("is dragging"); Isdrag=true; if(Startdragevent! =NULL) startdragevent (input.mouseposition); //let the character move in the direction of whose fingers return; } if(Iscounter && presstimer > presslastingtime && isdrag = =false) {Debug.Log ("Persistent clicks"); Islasting=true; if(Startlastingevent! =NULL) startlastingevent (input.mouseposition); //The skill icon appears and then slides to the skill to trigger the skill. return; } }}
Unity5 + Ugui Production
Full Demo:http://yunpan.cn/cjhbiaxvzemax access Password 7607
Unity White cat Operation Small instance