Ejemplo n.º 1
0
    private void DrawCameraList(IMDrawManager component, bool isPlaying)
    {
        if (!isPlaying)         // Unity isn't running
        {
            return;
        }

        Space();

        List <IMDrawCamera> cameraList = IMDrawCamera.GetCameraList();

        if (cameraList.Count > 0)
        {
            IMDrawCamera child;

            for (int index = 0; index < cameraList.Count; ++index)
            {
                child = cameraList[index];

                if (child == null)
                {
                    continue;
                }

                EditorGUILayout.BeginHorizontal();

                if (isPlaying)
                {
                    // Indicate if this camera is the current target
                    if (child == IMDrawManager.TargetCamera)
                    {
                        GUILayout.Label("►", EditorStyles.whiteLabel, GUILayout.Width(15f));
                    }
                    else
                    {
                        GUILayout.Space(20f);
                    }
                }

                GUILayout.Label(string.Format("Priority:{0}", child.Priority), EditorStyles.whiteLabel, GUILayout.Width(100f));

                GUILayout.Label(child != null ? child.name : "null", EditorStyles.whiteLabel);

                if (IMDrawManager.TargetCamera != child)
                {
                    if (GUILayout.Button("Set as target", GUILayout.Width(90f)))
                    {
                        IMDrawManager.TargetCamera = child;
                    }
                }

                EditorGUILayout.EndHorizontal();
            }
        }
        else
        {
            GUILayout.Label("No active IMDrawCamera components found.", EditorStyles.whiteLabel);
        }
    }
Ejemplo n.º 2
0
    /// <summary>Flush draw commands on all cameras.</summary>
    public void FlushAll()
    {
        List <IMDrawCamera> cameraList = IMDrawCamera.GetCameraList();

        for (int i = 0; i < cameraList.Count; ++i)
        {
            cameraList[i].FlushImmediate();
        }
    }
Ejemplo n.º 3
0
    void OnGUI()
    {
        if (IMDrawManager.Instance != this)
        {
            return;
        }

        List <IMDrawCamera> cameraList = IMDrawCamera.GetCameraList();

        for (int i = 0; i < cameraList.Count; ++i)
        {
            cameraList[i].GUIDraw();
        }
    }
Ejemplo n.º 4
0
    private IMDrawCamera GetCamera(int instanceID)
    {
        if (instanceID != 0)
        {
            List <IMDrawCamera> cameraList = IMDrawCamera.GetCameraList();

            for (int i = 0; i < cameraList.Count; ++i)
            {
                if (instanceID == cameraList[i].GetInstanceID())
                {
                    return(cameraList[i]);
                }
            }
        }

        return(null);
    }
Ejemplo n.º 5
0
    private void OnBeginFrame()
    {
        ScreenWidth  = Screen.width;
        ScreenHeight = Screen.height;

        float deltaTime = Time.deltaTime;

        List <IMDrawCamera> cameraList = IMDrawCamera.GetCameraList();

        for (int i = 0; i < cameraList.Count; ++i)
        {
            if (cameraList[i] != null)
            {
                cameraList[i].OnBeginFrame(deltaTime);
            }
        }
    }