Ejemplo n.º 1
0
    public override void AttachEvent()
    {
        base.AttachEvent();
        AddChildMouseClickEvent("Skill1", OnButtonSkill1Clicked);
        AddChildMouseClickEvent("Skill2", OnButtonSkill2Clicked);
        AddChildMouseClickEvent("Skill3", OnButtonSkill3Clicked);
        AddChildMouseClickEvent("Skill4", OnButtonSkill4Clicked);
        AddChildMouseClickEvent("Skill5", OnButtonSkill5Clicked);
        AddChildMouseClickEvent("Skill6", OnButtonSkill6Clicked);
        AddChildMouseClickEvent("AddLevel2", OnButtonAddLevel2Clicked);
        AddChildMouseClickEvent("AddLevel3", OnButtonAddLevel3Clicked);
        AddChildMouseClickEvent("AddLevel4", OnButtonAddLevel4Clicked);
        AddChildMouseClickEvent("AddLevel5", OnButtonAddLevel5Clicked);
        AddChildMouseClickEvent("AddLevel6", OnButtonAddLevel6Clicked);
        AddChildMouseClickEvent("ActorLevelButton", OnButtOnAddActorLevel);

        AddChildMouseLongPressEvent("Skill1", OnButtonLongSkill1Clicked);
        AddChildMouseLongPressEvent("Skill2", OnButtonLongSkill2Clicked);
        AddChildMouseLongPressEvent("Skill3", OnButtonLongSkill3Clicked);
        AddChildMouseLongPressEvent("Skill4", OnButtonLongSkill4Clicked);
        AddChildMouseLongPressEvent("Skill5", OnButtonLongSkill5Clicked);
        AddChildMouseLongPressEvent("Skill6", OnButtonLongSkill6Clicked);

        AddChildMouseClickEvent("AutoAttack", OnButtonMarkAutoAttackClicked);
        AddChildMouseClickEvent("changeTarget", OnButtonChangeTargetClicked);
        AddChildMouseClickEvent("Return", OnButtonChangeSkillClicked);
        AddChildMouseClickEvent("AddComboBtn", OnButtonAddComboClicked);
        UpdateMarkState();

        JoystickWrap joystick = WindowRoot.GetComponent <JoystickWrap>();

        if (joystick != null)
        {
            if (joystick.m_axisMapping != null && joystick.m_axisMapping.Count > 0)
            {
                joystick.m_axisMapping[0].m_axisEvent += OnMoveClicked;
            }
            if (joystick.m_mapping != null)
            {
                for (int i = 0; i < joystick.m_mapping.Count; i++)
                {
                    if (joystick.m_mapping[i].m_name == "Scroll")
                    {
                        joystick.m_mapping[i].m_keyEvent += OnScrollClicked;
                    }
                    if (joystick.m_mapping[i].m_name == "SwitchActor")
                    {
                        joystick.m_mapping[i].m_keyEvent += SwitchActor;
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    // 自动翻滚 [8/3/2015 tgame]
    public void OnScrollClicked(JoystickWrap.JoystickKeyMapping k)
    {
        Vector3      f        = m_mainPlayer.MainObj.transform.forward;
        JoystickWrap joystick = WindowRoot.GetComponent <JoystickWrap>();

        if (joystick.m_axisMapping != null && joystick.m_axisMapping.Count > 0)
        {
            JoystickWrap.JoystickAxisMapping axis = joystick.m_axisMapping[0];
            if (axis.GetVector3D().sqrMagnitude > 0.01f)
            {
                f = axis.GetVector3D() * 5.0f;
            }
        }

        f = m_mainPlayer.MainPos + f * 3.0f;
        m_mainPlayer.CurrentCmd = new MainPlayer.Cmd(f, Player.ENCmdType.enRoll);
    }