示例#1
0
    void initScrollView()
    {
        //监听 鼠标 按下和抬起动作
        EventTriggerListener.GetListener(m_scrollViewRect.gameObject).OnMouseDown = this.OnMouseDown;
        EventTriggerListener.GetListener(m_scrollViewRect.gameObject).OnMouseUp   = this.OnMouseUp;

        //限制竖直滑动
        this.m_scrollRect.vertical = false;

        //scrollView
        this.m_scrollViewRect.pivot = new Vector2(0.5f, 0.5f);

        //viewport
        this.m_viewportRect.sizeDelta     = Vector2.zero;
        this.m_viewportRect.pivot         = new Vector2(0, 1);
        this.m_viewportRect.anchorMax     = Vector2.one;
        this.m_viewportRect.anchorMin     = Vector2.zero;
        this.m_viewportRect.localScale    = Vector3.one;
        this.m_viewportRect.localPosition = new Vector3(-this.m_viewWidth / 2, this.m_viewHeight / 2, 0);

        //content
        this.m_contentRect.sizeDelta     = new Vector2(this.m_viewWidth * this.Count, 0);
        this.m_contentRect.pivot         = new Vector2(0, 1);
        this.m_contentRect.anchorMin     = Vector2.zero;
        this.m_contentRect.anchorMax     = new Vector2(0, 1);
        this.m_contentRect.localScale    = Vector3.one;
        this.m_contentRect.localPosition = Vector3.zero;
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        EventTriggerListener.GetListener(goBtnShowAll).onPointerClick += delegate(GameObject go, PointerEventData data)
        {
            for (int j = 0; j < bcRoom.Length; j++)
            {
                bcRoom[j].enabled = false;
            }
            goFloat.SetActive(true);
            goInfo.SetActive(false);
        };

        for (int i = 0; i < goBtnArea.Length; i++)
        {
            EventTriggerListener.GetListener(goBtnArea[i]).onPointerClick += delegate(GameObject go, PointerEventData data)
            {
                for (int j = 0; j < bcRoom.Length; j++)
                {
                    bcRoom[j].enabled = true;
                }
                goFloat.SetActive(false);
                goInfo.SetActive(false);
            };
        }
    }
示例#3
0
 void RegistButtonClickEvent()
 {
     foreach (AllBuildingLocationLeftUIButtonController btn in buttons)
     {
         EventTriggerListener.GetListener(btn.gameObject).onPointerClick += LocationButtonClick;
     }
 }
示例#4
0
    void Init()
    {
        EventTriggerListener.GetListener(goBtnList).onPointerClick += delegate(GameObject go, PointerEventData data)
        {
            goBtnList.GetComponentInChildren <Image>().color = new Color32(16, 142, 154, 255);
            goBtnPlan.GetComponentInChildren <Image>().color = new Color32(12, 104, 113, 255);

            goDropDown_1.SetActive(true);
            goDropDown_2.SetActive(false);

            goTable_1.SetActive(true);
            goTable_2.SetActive(false);
        };

        EventTriggerListener.GetListener(goBtnPlan).onPointerClick += delegate(GameObject go, PointerEventData data)
        {
            goBtnList.GetComponentInChildren <Image>().color = new Color32(12, 104, 113, 255);
            goBtnPlan.GetComponentInChildren <Image>().color = new Color32(16, 142, 154, 255);

            goDropDown_1.SetActive(false);
            goDropDown_2.SetActive(true);

            goTable_1.SetActive(false);
            goTable_2.SetActive(true);
        };

        goBtnList.GetComponentInChildren <Image>().color = new Color32(16, 142, 154, 255);
        goBtnPlan.GetComponentInChildren <Image>().color = new Color32(12, 104, 113, 255);

        goDropDown_1.SetActive(true);
        goDropDown_2.SetActive(false);

        goTable_1.SetActive(true);
        goTable_2.SetActive(false);
    }
示例#5
0
 void BuildButton()
 {
     for (int i = 0; i < Buttons.Count; i++)
     {
         EventTriggerListener.GetListener(Buttons[i].gameObject).onPointerClick += ButtonClickEventHandler;
     }
 }
示例#6
0
 void Start()
 {
     EventTriggerListener.GetListener(transform.Find("Button").gameObject).onPointerClick +=
         (go) => { CloseUIForm(); };
     EventTriggerListener.GetListener(transform.Find("Button (1)").gameObject).onPointerClick +=
         (go) => { Debug.Log("整理"); };
 }
示例#7
0
    /// <summary>
    /// 初始化
    /// </summary>
    protected void Init()
    {
        if (initDoneFlag)
        {
            return;
        }
        OnInitFront();
        OnInitSkinFront();
        OnInitSkin();
        OnInitSkinDone();

        Button[] colliders = this.GetComponentsInChildren <Button>(true);
        for (int i = 0, len = colliders.Length; i < len; i++)
        {
            Button collider = colliders[i];
            EventTriggerListener listener = EventTriggerListener.GetListener(collider.gameObject);
            listener.onPointerClick = OnClick;
            colliderList.Add(collider);
        }

        //Toggle[] Togglecolliders = this.GetComponentsInChildren<Toggle>(true);
        //for (int i = 0, len = Togglecolliders.Length; i < len; i++)
        //{
        //    Toggle Toggle = Togglecolliders[i];
        //    EventTriggerListener listener = EventTriggerListener.GetListener(Toggle.gameObject);
        //    listener.onPointerClick = OnClick;
        //    TogglecolliderList.Add(Toggle);
        //}

        OnInitDone();



        _initDoneFlag = true;
    }
示例#8
0
    IEnumerator FindUI(string name)
    {
        //寻找目标
        GameObject go = UnityHelper.FindTheChildNode(_canvas, name).gameObject;

        while (go == null)
        {
            yield return(new WaitForSeconds(0.1f));

            Debug.Log("wait");
            go = UnityHelper.FindTheChildNode(_canvas, name).gameObject;
        }

        //高亮
        maskTra = UnityHelper.FindTheChildNode(_canvas, "_UIMaskPanel").transform;
        maskTra.gameObject.SetActive(true);
        maskTra.SetAsLastSibling();
        Canvas canvas = go.AddComponent <Canvas>();

        canvas.overrideSorting = true;
        canvas.sortingOrder    = 1;
        go.AddComponent <GraphicRaycaster>();

        //设置监听
        EventTriggerListener.GetListener(go).onPointerClick += CancelHightLight;
    }
示例#9
0
文件: Panel2.cs 项目: lvcoc/UIGuide
 void Start()
 {
     EventTriggerListener.GetListener(transform.Find("Button").gameObject).onPointerClick +=
         (go) => { gameObject.SetActive(false); };
     EventTriggerListener.GetListener(transform.Find("Button (1)").gameObject).onPointerClick +=
         (go) => { Debug.Log("整理"); };
 }
示例#10
0
 void CancelHightLight(GameObject go)
 {
     Destroy(go.GetComponent <GraphicRaycaster>());
     Destroy(go.GetComponent <Canvas>());
     Next();
     EventTriggerListener.GetListener(go).onPointerClick -= CancelHightLight;
 }
 void BuildButton()
 {
     foreach (Button btn in buttons)
     {
         EventTriggerListener.GetListener(btn.gameObject).onPointerClick += ButtonClick;
     }
 }
示例#12
0
 void Start()
 {
     Init();
     EventTriggerListener.GetListener(skillImage.gameObject).onBeginDrag += OnBeginDrag;
     EventTriggerListener.GetListener(skillImage.gameObject).onDrag      += OnDrag;
     EventTriggerListener.GetListener(skillImage.gameObject).onEndDrag   += OnEndDrag;
 }
 void BuildButtons()
 {
     for (int i = 0; i < SwitchButtons.Count; i++)
     {
         Button b = SwitchButtons[i];
         EventTriggerListener.GetListener(b.gameObject).onPointerClick += SwitchButtonClick;
     }
 }
示例#14
0
    // Use this for initialization
    void Start()
    {
        tr = transform.parent.parent;

        EventTriggerListener.GetListener(gameObject).onPointerClick += delegate(GameObject go, PointerEventData data)
        {
            tr.SetAsLastSibling();
        };
    }
示例#15
0
    void Awake()
    {
        uiTop      = GameObject.FindGameObjectWithTag(Tags.UITop).transform;
        shutCutImg = transform.Find("ShutCut").GetComponent <Image>();
        shutCutImg.gameObject.tag = Tags.ShutCut;
        canvasGroup = shutCutImg.GetComponent <CanvasGroup>();

        EventTriggerListener.GetListener(shutCutImg.gameObject).onBeginDrag += OnBeginDrag;
        EventTriggerListener.GetListener(shutCutImg.gameObject).onDrag      += OnDrag;
        EventTriggerListener.GetListener(shutCutImg.gameObject).onEndDrag   += OnEndDrag;
    }
示例#16
0
    public Button btnForgetPassword;                //忘记密码

    // Use this for initialization
    void Start()
    {
        toggleRemeberPassword.isOn = false;
        ifPassword.contentType     = InputField.ContentType.Password;

        EventTriggerListener.GetListener(btnLogin.gameObject).onPointerClick +=
            delegate(GameObject go, PointerEventData data)
        {
            OnBtnLoginClick();
        };
    }
 void BuildElement()
 {
     for (int i = 0; i < items.Length; i++)
     {
         OneFloorFolderItemController item = items[i];
         RectTransform rect = item.GetComponent <RectTransform>();
         rect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, (ItemTitleHeight + titleSpace) * i, ItemTitleHeight);
         item.Index = i;
         EventTriggerListener.GetListener(item.TitleButton.gameObject).onPointerClick += ItemButtonClick;
     }
 }
    void Start()
    {
        GameObject           go       = GameObject.Find("Button");
        EventTriggerListener listener = EventTriggerListener.GetListener(go);

        listener._onPointerClick += (x) => { Debug.Log("Button Click"); };

        //transform.ChainSetParent(go.transform)
        //        .ChainSetPosition(Vector3.zero)
        //        .ChainSetLocalEulerAngles(Vector3.up * 90)
        //        .ChainSetLocalScale(Vector3.one * 2);
    }
示例#19
0
 private void Awake()
 {
     _instance  = this;
     PersonName = transform.Find("LoginBg/PersonInformationControl/PersonInformationPanel/PersonName").GetComponent <Text>();
     profession = transform.Find("LoginBg/PersonInformationControl/PersonInformationPanel/PersonPosition").GetComponent <Text>();
     right      = transform.Find("LoginBg/Panel/rightbtn").GetComponent <Button>();
     left       = transform.Find("LoginBg/Panel/leftbtn").GetComponent <Button>();
     EventTriggerListener.GetListener(left.gameObject).onPointerDown  += onleftdown;
     EventTriggerListener.GetListener(left.gameObject).onPointerUp    += onleftup;
     EventTriggerListener.GetListener(right.gameObject).onPointerDown += onrightdown;
     EventTriggerListener.GetListener(right.gameObject).onPointerUp   += onrightup;
 }
    void Awake()
    {
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button").gameObject).onPointerClick +=
            (go) => { UIManager.GetInstance().ShowUIForms("EquipPanel"); };
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button (1)").gameObject).onPointerClick +=
            (go) => { UIManager.GetInstance().ShowUIForms("BagPanel"); };
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button (2)").gameObject).onPointerClick +=
            (go) => { GuideManager.Instance.Next(); };
        EventTriggerListener.GetListener(UnityHelper.FindTheChildNode(gameObject, "Button (3)").gameObject).onPointerClick +=
            (go) => { GuideManager.Instance.Next(); };

        GuideManager.Instance.Init();
    }
示例#21
0
    void Start()
    {
        foreach (ToolbarMainButtonController mainButton in mainButtons)
        {
            EventTriggerListener.GetListener(mainButton.gameObject).onSelect   += FirstSelectHandler;
            EventTriggerListener.GetListener(mainButton.gameObject).onDeselect += FirstDisSelectHandler;
        }

        //foreach (Button btn in secondButtons)
        //{
        //    btn.onClick.AddListener(delegate () { SecondClickHandler(btn.GetComponentInChildren<Text>().text); });
        //}
    }
示例#22
0
    void Awake()
    {
        EventTriggerListener.GetListener(UIManager.Instance.Find("Button")).onPointerClick +=
            (go) => { UIManager.Instance.Show("EquipPanel"); };
        EventTriggerListener.GetListener(UIManager.Instance.Find("Button (1)")).onPointerClick +=
            (go) => { UIManager.Instance.Show("BagPanel"); };
        EventTriggerListener.GetListener(UIManager.Instance.Find("Button (2)")).onPointerClick +=
            (go) => { GuideManager.Instance.Next(); };
        EventTriggerListener.GetListener(UIManager.Instance.Find("Button (3)")).onPointerClick +=
            (go) => { GuideManager.Instance.Next(); };

        GuideManager.Instance.Init();
    }
示例#23
0
        private void CancelHightLight()
        {
            if (maskClickGO == null)
            {
                return;
            }
            GameObject target = maskClickGO;

            mask.gameObject.SetActive(false);
            arrow.gameObject.SetActive(false);
            hollowOffRect.gameObject.SetActive(false);
            EventTriggerListener.GetListener(target).onPointerClick -= OnClickTargetHandle;
            maskClickGO = null;
        }
 static int GetListener(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
         EventTriggerListener   o    = EventTriggerListener.GetListener(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#25
0
    /// <summary>
    /// 销毁
    /// </summary>
    void OnDestroy()
    {
        mInstance = null;

        StopPressWait();

        EventTriggerListener.GetListener(mPowerButtonObject).onPointerClick -= OnClick;
        EventTriggerListener.GetListener(mPowerButtonObject).onPointerDown  += OnDown;
        EventTriggerListener.GetListener(mPowerButtonObject).onPointerUp    += OnUp;

        ClientEventManager <ClientEvent> .Instance.UnsubscribeClientEvent(ClientEvent.SKILL_KEY_POS_SET, OnSkillUpdate);

        ClientEventManager <ClientEvent> .Instance.UnsubscribeClientEvent(ClientEvent.SKILL_KEY_CONFIG_CHOOSED, OnSkillUpdate);

        ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.CE_NET_RECONNECT, OnNetReconnect);
    }
示例#26
0
 void Init()
 {
     btnItem = GetComponent <AllBuildingLocationLeftUIButtonController>();
     EventTriggerListener.GetListener(gameObject).onPointerClick += delegate(GameObject go, PointerEventData data)
     {
         StartCoroutine(SetCamera());
     };
     if (name != "儿科综合楼")
     {
         OnDisSelect();
     }
     else
     {
         goCurrentNormalBuilding = this;
         OnSelect();
     }
 }
示例#27
0
        /// <summary>
        /// 点击目标物体的回调
        /// </summary>
        /// <param name="click_obj"></param>
        /// <param name="guide_obj"></param>
        /// <param name="guide_step"></param>
        void OnClickTarget(GameObject click_obj, GuideGameObject guide_obj, Guide.Step guide_step)
        {
            if (m_GuideStep == null || mUIObject == null)
            {
                return;
            }

            if ((guide_obj.CopyObj != null && click_obj == guide_obj.CopyObj) ||
                (guide_obj.CopyObj == null && click_obj == guide_obj.TargetObject))
            {
                if (guide_obj.TargetObject == null)
                {
                    Close();
                    return;
                }

                // 执行guide_obj.TargetObject的点击事件
                if (guide_step.EventType == 1)
                {
                    ExecuteEvents.Execute <IPointerClickHandler>(guide_obj.TargetObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerClickHandler);
                }
                else
                {
                    ExecuteEvents.Execute <IPointerDownHandler>(guide_obj.TargetObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerDownHandler);
                    ExecuteEvents.Execute <IPointerUpHandler>(guide_obj.TargetObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerUpHandler);
                }

                if (click_obj != null)
                {
                    var event_listen = EventTriggerListener.GetListener(click_obj);
                    event_listen.onPointerClick -= OnClick;
                }

                if (m_GuideStep != null && m_GuideStep.TargetTrigger != null)
                {
                    m_GuideStep.TargetTrigger.NotifyClick();
                }
                else
                {
                    Close();
                }
            }
        }
示例#28
0
    /// <summary>
    /// 新手引导入口
    /// </summary>
    public void Next()
    {
        if (isFinish || currentIndex > guideList.Count)
        {
            return;
        }

        if (currentIndex != 0 && guideList[currentIndex - 1].go.GetComponent <EventTriggerListener>() != null)
        {
            EventTriggerListener.GetListener(guideList[currentIndex - 1].go).onClick -= null;
        }

        if (maskPrefabs == null)
        {
            maskPrefabs = Instantiate(Resources.Load <GameObject>("RectGuidance_Panel"), this.transform);
        }

        maskPrefabs.GetComponent <RectGuidance>().Init(guideList[currentIndex].go.GetComponent <Image>());;

        currentIndex++;

        if (currentIndex < guideList.Count)
        {
            EventTriggerListener.GetListener(guideList[currentIndex - 1].go).onClick += (go) =>
            {
                Next();
            };
        }

        else if (currentIndex == guideList.Count)
        {
            EventTriggerListener.GetListener(guideList[currentIndex - 1].go).onClick += (go) =>
            {
                maskPrefabs.gameObject.SetActive(false);

                EventTriggerListener.GetListener(guideList[currentIndex - 1].go).onClick -= null;

                isFinish = true;
                Debug.Log("新手引导结束");
            };
        }
    }
示例#29
0
 private void ShowHightLight(string widgtName)
 {
     StartCoroutine(FindTarget(widgtName, (go) =>
     {
         maskClickGO             = go;
         RectTransform target    = go.transform as RectTransform;
         Vector2 targetSize      = GameUtils.GetSize(target);
         hollowOffRect.pivot     = target.pivot;
         hollowOffRect.sizeDelta = targetSize;
         hollowOffRect.position  = target.position;
         hollowOffRect.gameObject.SetActive(true);
         mask.GetComponent <HollowOutMask>().isRaycast = false;
         if (guideItem.type == config.GuideConfig.GuideType.Click)
         {
             EventTriggerListener.GetListener(go).onPointerClick += OnClickTargetHandle;
             SetArrow(go.transform as RectTransform, arrow);
             arrow.gameObject.SetActive(true);
             mask.GetComponent <HollowOutMask>().isRaycast = true;
         }
     }));
 }
示例#30
0
        /// <summary>
        /// 设置ui的通用事件监听器
        /// </summary>
        private void SetupGenericEventListener(GameObject target_object, OnClickDel click_handle)
        {
            if (mUIObject == null)
            {
                return;
            }

            // 如果没有目标物体的监听事件,则使用GuideWindow来进行监听
            if (target_object != null)
            {
                var event_listen = EventTriggerListener.GetListener(target_object);
                event_listen.onPointerClick += OnClick;
            }
            else
            {
                var event_listen = EventTriggerListener.GetListener(m_EventMask);
                event_listen.onPointerClick += OnClick;
            }

            OnClickListener = click_handle;
        }