old mode 100755
new mode 100644
| | |
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 控制事件(不支持Enable和Disable,都归为Mid)
|
| | | /// 点击后自动还原状态的控制事件(只有Mid,left,right,up,down)
|
| | | /// </summary>
|
| | | public Action<DirectionEnum> ControlEvent = null;
|
| | | public Action<DirectionEnum> AutoRecoverControlEvent = null;
|
| | | /// <summary>
|
| | | /// 是否使用点击特效,一旦设置为true,则点击之后,会自动还原回Enable状态
|
| | | /// 点击后不会还原状态的控制事件(只有enable,Mid,left,right,up,down。 enable:手指松开方向键后触发)
|
| | | /// </summary>
|
| | | public bool UseClickStau = false;
|
| | | public Action<DirectionEnum> NotRecoverControlEvent = null;
|
| | | /// <summary>
|
| | | /// 能否控制方向
|
| | | /// </summary>
|
| | |
| | | //开启等待线程(不允许狂点)
|
| | | this.StartWaitThread();
|
| | |
|
| | | this.ControlEvent?.Invoke(DirectionEnum.Mid);
|
| | | this.AutoRecoverControlEvent?.Invoke(DirectionEnum.Mid);
|
| | | this.NotRecoverControlEvent?.Invoke(DirectionEnum.Mid);
|
| | | };
|
| | |
|
| | | //上按钮
|
| | |
| | | //不能控制方向
|
| | | this.CanDirection = false;
|
| | | }
|
| | | else if (direction == DirectionEnum.Enable)
|
| | | else
|
| | | {
|
| | | //能够控制方向
|
| | | this.CanDirection = true;
|
| | |
| | | }
|
| | |
|
| | | //如果使用特效的话
|
| | | if (this.UseClickStau == true)
|
| | | if (this.AutoRecoverControlEvent != null)
|
| | | {
|
| | | //切换图片
|
| | | this.SetDirectionImage(direction);
|
| | | //开启等待线程(不允许狂点)
|
| | | this.StartWaitThread();
|
| | |
|
| | | this.AutoRecoverControlEvent?.Invoke(direction);
|
| | | }
|
| | | else
|
| | | {
|
| | | //切换图片
|
| | | this.SetDirectionImage(DirectionEnum.Enable);
|
| | | this.NotRecoverControlEvent?.Invoke(DirectionEnum.Enable);
|
| | | }
|
| | | this.ControlEvent?.Invoke(direction);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | private void DirectionDownClickEvent(DirectionEnum direction)
|
| | | {
|
| | | //如果不使用特效的话
|
| | | if (this.CanClick == false || this.CanDirection == false || this.UseClickStau == true)
|
| | | if (this.CanClick == false || this.CanDirection == false || this.NotRecoverControlEvent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //切换图片
|
| | | this.SetDirectionImage(direction);
|
| | | this.NotRecoverControlEvent?.Invoke(direction);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | this.CanClick = true;
|
| | |
|
| | | //如果不使用特效的话
|
| | | if (this.UseClickStau == false)
|
| | | if (this.NotRecoverControlEvent != null)
|
| | | {
|
| | | return;
|
| | | }
|