示例#1
0
        public static Vector3 Set3DUIWorldPos_ByScreenPoint(ref Vector3 worldPos, bool bMiniMap, out float finalScreenX, out float finalScreenY)
        {
            finalScreenX = (finalScreenY = 0f);
            MinimapSys theMinimapSys = Singleton <CBattleSystem> .GetInstance().TheMinimapSys;

            if (theMinimapSys == null)
            {
                return(Vector3.zero);
            }
            Vector2 vector = (!bMiniMap) ? Singleton <CBattleSystem> .get_instance().world_UI_Factor_Big : Singleton <CBattleSystem> .get_instance().world_UI_Factor_Small;

            Vector2 vector2 = new Vector2(worldPos.x * vector.x, worldPos.z * vector.y);

            vector2.x *= Sprite3D.Ratio();
            vector2.y *= Sprite3D.Ratio();
            Vector2 vector3 = (!bMiniMap) ? theMinimapSys.GetBMFianlScreenPos() : theMinimapSys.GetMMFianlScreenPos();

            vector2.x += vector3.x;
            vector2.y += vector3.y;
            Vector3 position      = new Vector3(vector2.x, vector2.y, (float)MiniMapSysUT.UI3D_Depth);
            Camera  currentCamera = Singleton <Camera_UI3D> .GetInstance().GetCurrentCamera();

            if (currentCamera == null)
            {
                return(Vector3.zero);
            }
            finalScreenX = position.x;
            finalScreenY = position.y;
            return(currentCamera.ScreenToWorldPoint(position));
        }
            private void _updateNodePosition(GameObject node, PoolObjHandle <ActorRoot> actorRoot, bool bSmallMap)
            {
                if (!actorRoot)
                {
                    return;
                }
                if (node != null)
                {
                    MinimapSys theMinimapSys = Singleton <CBattleSystem> .GetInstance().TheMinimapSys;

                    if (theMinimapSys == null)
                    {
                        return;
                    }
                    Vector3 vector  = (Vector3)actorRoot.get_handle().location;
                    Vector2 vector2 = (!bSmallMap) ? theMinimapSys.GetBMFianlScreenPos() : theMinimapSys.GetMMFianlScreenPos();
                    Vector2 vector3 = (!bSmallMap) ? theMinimapSys.bmFinalScreenSize : theMinimapSys.mmFinalScreenSize;
                    float   x;
                    float   y;
                    node.transform.position = MiniMapSysUT.Set3DUIWorldPos_ByScreenPoint(ref vector, bSmallMap, out x, out y);
                    if (!this.IsRectInside(x, y, this.small_track_width, this.small_track_height, vector2.x, vector2.y, vector3.x, vector3.y))
                    {
                        this.SetUpdateAble(false);
                    }
                }
            }
        public static Vector2 CalcScreenPosInMapByWorldPos(ref Vector3 worldPos, bool bMiniMap)
        {
            MinimapSys theMinimapSys = Singleton <CBattleSystem> .GetInstance().TheMinimapSys;

            if (theMinimapSys == null)
            {
                return(Vector3.zero);
            }
            Vector2 vector = bMiniMap ? Singleton <CBattleSystem> .instance.world_UI_Factor_Small : Singleton <CBattleSystem> .instance.world_UI_Factor_Big;
            Vector2 result = new Vector2(worldPos.x * vector.x, worldPos.z * vector.y);

            result.x *= Sprite3D.Ratio();
            result.y *= Sprite3D.Ratio();
            Vector2 vector2 = bMiniMap ? theMinimapSys.GetMMFianlScreenPos() : theMinimapSys.GetBMFianlScreenPos();

            result.x += vector2.x;
            result.y += vector2.y;
            return(result);
        }