Esempio n. 1
0
        protected override void Update()
        {
            if (CanGhost && (Clock.CurrentTime - CanGhostFrom) > 2000 && clickType == AutoClickType.Up)
            {
                clickType = AutoClickType.Press;
                clickTime = Clock.CurrentTime - 25;

                Active.Hold();
            }

            if (clickType == AutoClickType.Press && clickTime + 100 < Clock.CurrentTime)
            {
                Swap();
                clickType = AutoClickType.Up;
            }

            if (IsHolding)
            {
                Texture.Texture = HoldTexture;
            }
            else if (Left.IsDown)
            {
                Texture.Texture = LeftTexture;
            }
            else if (Right.IsDown)
            {
                Texture.Texture = RightTexture;
            }
            else
            {
                Texture.Texture = NeutralTexture;
            }
        }
Esempio n. 2
0
 public void Release()
 {
     if (clickType == AutoClickType.Down)
     {
         Swap();
         clickType = AutoClickType.Up;
     }
 }
Esempio n. 3
0
        public void Hold()
        {
            if (clickType != AutoClickType.Up)
            {
                Swap();
            }

            IsHolding = true;
            clickType = AutoClickType.Down;
            clickTime = Clock.CurrentTime;
        }
Esempio n. 4
0
        public void Press()
        {
            if (clickType != AutoClickType.Up)
            {
                Swap();
            }

            clickType = AutoClickType.Press;
            clickTime = Clock.CurrentTime;
            Active.Hold();
        }
Esempio n. 5
0
    /// <summary>
    /// 显示窗口
    /// </summary>
    /// <param name="title">标题</param>
    /// <param name="message">内容</param>
    /// <param name="type">类型</param>
    /// <param name="okAction">确定回调</param>
    /// <param name="cancelAction">取消回调</param>
    public void Show(string title, string message, float countDown = 0f, AutoClickType autoType = AutoClickType.None, MessageViewType type = MessageViewType.Ok, Action okAction = null, Action cancelAction = null)
    {
        gameObject.transform.localPosition = Vector3.zero;
        lblTitle.text   = title;
        lblMessage.text = message;

        switch (type)
        {
        case MessageViewType.Ok:
            btnOk.transform.localPosition = new Vector3(0, btnOk.transform.localPosition.y, 0);
            btnCancel.gameObject.SetActive(false);
            btnOk.gameObject.SetActive(true);
            break;

        case MessageViewType.OkAndCancel:
            btnOk.transform.localPosition = new Vector3(-218, btnOk.transform.localPosition.y, 0);
            btnCancel.gameObject.SetActive(true);
            btnOk.gameObject.SetActive(true);
            break;

        case MessageViewType.None:
            btnCancel.gameObject.SetActive(false);
            btnOk.gameObject.SetActive(false);
            break;
        }
        m_AutoType   = autoType;
        m_fCountDown = countDown;
        switch (autoType)
        {
        case AutoClickType.None:
            m_TextOk.SafeSetText("确定");
            m_TextCancel.SafeSetText("取消");
            break;

        case AutoClickType.Cancel:
            m_TextOk.SafeSetText("确定");
            break;

        case AutoClickType.Ok:
            m_TextCancel.SafeSetText("取消");
            break;
        }

        OnOkClickHandler = okAction;
        OnCancelHandler  = cancelAction;
    }
Esempio n. 6
0
 /// <summary>
 /// 关闭窗口
 /// </summary>
 private void Close()
 {
     m_AutoType   = AutoClickType.None;
     m_fCountDown = 0.0f;
     gameObject.transform.localPosition = new Vector3(0, 5000, 0);
 }
Esempio n. 7
0
    /// <summary>
    /// 显示消息窗口
    /// </summary>
    /// <param name="title">标题</param>
    /// <param name="message">内容</param>
    /// <param name="type">类型</param>
    /// <param name="okAction">确定回调</param>
    /// <param name="cancelAction">取消回调</param>
    public void ShowMessage(string title, string message, MessageViewType type = MessageViewType.Ok, Action okAction = null, Action cancelAction = null, float countDown = 0.0f, AutoClickType autoType = AutoClickType.None)
    {
        if (m_MessageView == null)
        {
            GameObject go = ResourcesManager.Instance.Load(ResourceType.UIWindow, "pan_Message");
            m_MessageView = go.GetOrCreatComponent <UIMessageView>();
        }
        m_MessageView.gameObject.SetParent(CurrentUIScene.Container_Center, true);
        m_MessageView.gameObject.transform.localPosition = Vector3.zero;
        m_MessageView.gameObject.transform.localScale    = Vector3.one;
        m_MessageView.gameObject.GetComponent <RectTransform>().sizeDelta = Vector2.zero;

        Canvas canvas = m_MessageView.GetComponent <Canvas>();

        canvas.overrideSorting = true;
        canvas.sortingOrder    = 1000;
        LogSystem.Log("显示消息窗口:" + message);
        m_MessageView.Show(title, message, countDown, autoType, type, okAction, cancelAction);
    }
Esempio n. 8
0
 /// <summary>
 /// 显示窗口
 /// </summary>
 /// <param name="title">标题</param>
 /// <param name="message">内容</param>
 /// <param name="type">类型</param>
 /// <param name="okAction">确定回调</param>
 /// <param name="cancelAction">取消回调</param>
 protected void ShowMessage(string title, string message, MessageViewType type = MessageViewType.Ok, Action okAction = null, Action cancelAction = null, float countDown = 0.0f, AutoClickType autoType = AutoClickType.None)
 {
     UIViewManager.Instance.ShowMessage(title, message, type, okAction, cancelAction, countDown, autoType);
 }