示例#1
0
        protected IGREffectParticles attachEffect(string effid, bool single = true)
        {
            IGREffectParticles iGREffectParticles = this.createEffect(effid, single);
            bool flag = iGREffectParticles != null;

            if (flag)
            {
                GREntity3D gREntity3D = this.m_gr as GREntity3D;
                bool       flag2      = gREntity3D != null;
                if (!flag2)
                {
                    DebugTrace.print("attachEffect should be IGRCharacter!");
                }
            }
            return(iGREffectParticles);
        }
示例#2
0
        protected IGREffectParticles attachEffect(string effid, bool single = true)
        {
            IGREffectParticles eff = createEffect(effid, single);

            if (eff != null)
            {
                GREntity3D grc = (m_gr as GREntity3D);
                if (grc != null)
                {
                    //if (grc.rootObj != null && !grc.rootObj.contains(eff.graphObject as IGraphObject3D))
                    //{
                    //    grc.rootObj.addChild(eff.graphObject as IGraphObject3D);
                    //}
                }
                else
                {
                    DebugTrace.print("attachEffect should be IGRCharacter!");
                }
            }

            return(eff);
        }
示例#3
0
        private void update(float tmSlice)
        {
            this.m_bTowTouchZoom = false;
            bool flag  = Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer;
            bool flag2 = flag;

            if (flag2)
            {
                float num = Input.GetAxis("Mouse ScrollWheel");
            }
            else
            {
                bool flag3 = 2 == Input.touchCount;
                if (flag3)
                {
                    bool flag4 = !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId) || !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(1).fingerId);
                    if (flag4)
                    {
                        bool flag5 = Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(1).phase == TouchPhase.Moved;
                        if (flag5)
                        {
                            Vector2 vector = Input.GetTouch(0).position - Input.GetTouch(1).position;
                            bool    flag6  = 0f == this.m_fTwoTouchDis;
                            if (flag6)
                            {
                                this.m_fTwoTouchDis = vector.magnitude;
                            }
                            else
                            {
                                float magnitude = vector.magnitude;
                                float num       = (magnitude - this.m_fTwoTouchDis) * 0.0125f;
                                this.m_fTwoTouchDis  = vector.magnitude;
                                this.m_bTowTouchZoom = true;
                            }
                        }
                    }
                }
                else
                {
                    this.m_fTwoTouchDis = 0f;
                }
            }
            bool flag7 = Input.GetMouseButtonDown(0) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began);

            if (flag7)
            {
                bool flag8 = (flag && EventSystem.current.IsPointerOverGameObject()) || (!flag && EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId));
                if (flag8)
                {
                    base.dispatchEvent(GameEvent.Create(MouseClickMgr.EVENT_TOUCH_UI, this, EventSystem.current.currentSelectedGameObject, false));
                }
                else
                {
                    bool flag9 = GRMap.GAME_CAM_CAMERA != null && GRMap.GAME_CAM_CAMERA.gameObject.active;
                    if (flag9)
                    {
                        Ray        ray = GRMap.GAME_CAM_CAMERA.ScreenPointToRay(Input.mousePosition);
                        RaycastHit raycastHit;
                        bool       flag10 = Physics.Raycast(ray, out raycastHit);
                        if (flag10)
                        {
                            Object3DBehaviour component = raycastHit.transform.gameObject.GetComponent <Object3DBehaviour>();
                            bool flag11 = component != null;
                            if (flag11)
                            {
                                IGraphObject3D obj        = component.obj;
                                GREntity3D     gREntity3D = obj.helper["$graphObj"] as GREntity3D;
                                gREntity3D.dispathEvent(Define.EventType.RAYCASTED, null);
                            }
                        }
                    }
                    else
                    {
                        bool flag12 = this.curScenceCamera != null && this.curScenceCamera.gameObject.active;
                        if (flag12)
                        {
                            Ray        ray2 = this.curScenceCamera.ScreenPointToRay(Input.mousePosition);
                            RaycastHit raycastHit2;
                            bool       flag13 = Physics.Raycast(ray2, out raycastHit2);
                            if (flag13)
                            {
                                base.dispatchEvent(GameEvent.Create(MouseClickMgr.EVENT_TOUCH_GAME_OBJECT, this, raycastHit2.transform.gameObject, false));
                            }
                        }
                    }
                }
            }
        }
        void update(float tmSlice)
        {
            m_bTowTouchZoom = false;
            float fmsw  = 0.0f;
            bool  inWin = Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer ||
                          Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer;

            //处理镜头的拉近拉远

            if (inWin)
            {
                fmsw = Input.GetAxis("Mouse ScrollWheel");
            }
            else
            {
                if (2 == Input.touchCount)
                {
                    //只要有一个手指不在UI上,就可以处理拉近拉远
                    if (false == EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId) || false == EventSystem.current.IsPointerOverGameObject(Input.GetTouch(1).fingerId))
                    {
                        if (Input.GetTouch(0).phase == TouchPhase.Moved || Input.GetTouch(1).phase == TouchPhase.Moved)
                        {
                            Vector2 two_touch_pos_offset = Input.GetTouch(0).position - Input.GetTouch(1).position;
                            if (0.0f == m_fTwoTouchDis)
                            {
                                m_fTwoTouchDis = two_touch_pos_offset.magnitude;
                            }
                            else
                            {
                                float cur_dis = two_touch_pos_offset.magnitude;
                                fmsw           = (cur_dis - m_fTwoTouchDis) * 0.0125f;
                                m_fTwoTouchDis = two_touch_pos_offset.magnitude;

                                m_bTowTouchZoom = true;
                            }
                        }
                    }
                }
                else
                {
                    m_fTwoTouchDis = 0.0f;
                }
            }

            if (false) //a3暂时屏蔽,滚轮拉近拉远的处理
            {
                if (fmsw != 0f || m_UpdateNearCamNow)
                {
                    m_UpdateNearCamNow = false;
                    //debug.Log("鼠标的滚轮在动 " + fmsw);
                    GRMap.M_FToCameraNearStep += fmsw * 0.2f;

                    if (GRMap.M_FToCameraNearStep < 0f)
                    {
                        GRMap.M_FToCameraNearStep = 0f;
                    }
                    if (GRMap.M_FToCameraNearStep > 1f)
                    {
                        GRMap.M_FToCameraNearStep = 1f;
                    }

                    //读取主角的坐骑的摄像机参数
                    Vector3 near_pos = GRMap.M_VGame_Cam_FARpos;
                    near_pos.x *= lgSelfPlayer.instance.m_fCameraNearXZ;
                    near_pos.y  = lgSelfPlayer.instance.m_fCameraNearH;
                    near_pos.z *= lgSelfPlayer.instance.m_fCameraNearXZ;

                    Vector3 near_angle = GRMap.M_VGame_Cam_FARrot;
                    near_angle.x = 30f;

                    GRMap.GAME_CAM_CUR.transform.localPosition    = Vector3.Lerp(GRMap.M_VGame_Cam_FARpos, near_pos, GRMap.M_FToCameraNearStep);
                    GRMap.GAME_CAM_CUR.transform.localEulerAngles = Vector3.Lerp(GRMap.M_VGame_Cam_FARrot, near_angle, GRMap.M_FToCameraNearStep);
                }
            }


            bool mouseTouch = Input.GetMouseButtonDown(0);

            if (mouseTouch || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))
            {
                // if(ui_main_camera==null)
                //     ui_main_camera = GameObject.Find("ui_main_camera").GetComponent<Camera>();
                // Vector3 stwp = ui_main_camera.ScreenToWorldPoint(Input.mousePosition);
                //stwp.z = 0f;

                //if (mouseTouch)
                //{
                //    FightText.play(FightText.MOUSE_POINT, Input.mousePosition, 0);
                //}
                //else
                //{
                //    for (int i = 0; i < Input.touchCount; i++)
                //    {
                //        Touch t = Input.GetTouch(i);
                //        FightText.play(FightText.MOUSE_POINT, t.position, 0);
                //    }
                //}

                if ((inWin && EventSystem.current.IsPointerOverGameObject()) ||
                    (!inWin && EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                    )
                {
                    dispatchEvent(GameEvent.Create(EVENT_TOUCH_UI, this, EventSystem.current.currentSelectedGameObject));

                    //    debug.Log("当前触摸在UI上");
                }
                else if (GRMap.GAME_CAM_CAMERA != null && GRMap.GAME_CAM_CAMERA.gameObject.active)
                {
                    //   debug.Log("当前触摸不在UI上:" + GRMap.GAME_CAM_CAMERA.active);

                    Ray        ray = GRMap.GAME_CAM_CAMERA.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit))
                    {
                        Object3DBehaviour behav = hit.transform.gameObject.GetComponent <Object3DBehaviour>();
                        if (behav != null)
                        {
                            IGraphObject3D obj    = behav.obj;
                            GREntity3D     hitEnt = obj.helper["$graphObj"] as GREntity3D;
                            hitEnt.dispathEvent(Define.EventType.RAYCASTED, null);
                        }
                    }
                }
                else if (curScenceCamera != null && curScenceCamera.gameObject.active == true)
                {
                    Ray        ray = curScenceCamera.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit))
                    {
                        dispatchEvent(GameEvent.Create(EVENT_TOUCH_GAME_OBJECT, this, hit.transform.gameObject));
                    }
                }
            }
        }