Esempio n. 1
0
    // 按键处理
    public void OnMessage(Engine.MessageCode code, object param1 = null, object param2 = null, object param3 = null)
    {
        if (m_Camera == null)
        {
            return;
        }

        // 只在windows下有效
        if (code == Engine.MessageCode.MessageCode_KeyDown)
        {
            KeyCode kc = (KeyCode)param1;
            OnKeyDown(kc);
        }

        if (code == Engine.MessageCode.MessageCode_Key)
        {
            KeyCode kc = (KeyCode)param1;
            OnKeyPress(kc);
            Engine.Utility.Log.Trace("KeyCode:{0}", kc.ToString());
        }

        if (code == Engine.MessageCode.MessageCode_KeyUp)
        {
            KeyCode kc = (KeyCode)param1;
            OnKeyUp(kc);
        }
    }
Esempio n. 2
0
 public void OnMessage(Engine.MessageCode code, object param1 = null, object param2 = null, object param3 = null)
 {
     if (m_ActiveCtrl != null)
     {
         m_ActiveCtrl.OnMessage(code, param1, param2, param3);
     }
 }
Esempio n. 3
0
    public void OnMessage(Engine.MessageCode code, object param1 = null, object param2 = null, object param3 = null)
    {
        if (m_AudioListenerTrans != null && m_Target != null)
        {
            m_AudioListenerTrans.position = m_Target.GetPos();
        }

        // Engine.Utility.Log.Error("CameraFollow MessageCode{0}", code.ToString());

        // 处理多点触摸改变镜头距离
        switch (code)
        {
        case Engine.MessageCode.MessageCode_MultipleMove:       // 多点触摸滑动
        {
            float fDistance = (float)param1;
            m_fProgress += -fDistance * 0.1f / 100f;
            if (m_fProgress < 0.0f)
            {
                m_fProgress = 0.0f;
            }
            if (m_fProgress > 1.0f)
            {
                m_fProgress = 1.0f;
            }
            SetCameraOffset(m_fProgress);
            break;
        }

        default:
        {
            break;
        }
        }
    }