コード例 #1
0
    private void CheckForDisplay()
    {
        Camera camera = GetComponent <Camera>();

        int displayIdx = camera.targetDisplay;

        if (displayIdx < Display.displays.Length)
        {
            Display d = Display.displays[displayIdx];
            if (!d.active)
            {
                d.Activate();
            }
            Debug.Log("Activated external observer camera on display #" + displayIdx + " with " + d.systemWidth + "x" + d.systemHeight);

            // set some parameters
            camera.nearClipPlane   = mainCamera.nearClipPlane;
            camera.farClipPlane    = mainCamera.farClipPlane;
            camera.stereoTargetEye = StereoTargetEyeMask.None;
            camera.backgroundColor = mainCamera.backgroundColor;

            gameObject.SetActive(true);
            tempLerpFactorOverride = 1;             // immediately align
        }
        else
        {
            // no external display > shut down this node
            gameObject.SetActive(false);
            Debug.Log("Could not activate external observer camera on display #" + displayIdx);
        }
    }
コード例 #2
0
    public void ActivateDisplay(int displayIndex)
    {
        if (Application.isEditor)
        {
            return;
        }
        if (displayIndex >= Display.displays.Length)
        {
            Debug.LogError("Invalid display index");
            return;
        }
        Display d = Display.displays[displayIndex];

        int   width       = d.systemWidth;
        int   height      = d.systemHeight;
        float aspectRatio = ((float)width) / height;

        //if (aspectRatio > 1)
        //{
        //    Camera.main.fieldOfView = 100;
        //}
        //else
        //{
        //    Camera.main.fieldOfView = Mathf.Rad2Deg * 2.0f * Mathf.Atan(Mathf.Tan(100 * 0.5f) / aspectRatio);
        //}
        d.Activate();
        //d.Activate(width, height, 60);
        //d.SetParams(width, height, 0, 0);
        //c.aspect = aspectRatio;
        //c.targetDisplay = displayIndex;
    }
コード例 #3
0
ファイル: DisplayWrap.cs プロジェクト: xophiix/CsToLua
    static int Activate(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Display obj = LuaScriptMgr.GetNetObject <Display>(L, 1);

        obj.Activate();
        return(0);
    }
コード例 #4
0
ファイル: Engine.cs プロジェクト: CodeMoshete/screensaver
    void Start()
    {
        int numDisplays = Mathf.Min(AvailableCameras.Count, Display.displays.Length);

        for (int i = 0; i < numDisplays; ++i)
        {
            Display currentDisplay = Display.displays[i];
            currentDisplay.Activate();
            AssignRandomCamera(i);
        }
    }
コード例 #5
0
ファイル: Inner.cs プロジェクト: HaniL-Kim/Dummy
 //
 public void ActivateInner()
 { // Flip Anim Frame(16) Event2
     display.Activate();
     if (display.flagHit == true)
     {
         return;
     }
     //
     if (isDanger)
     {
         MineController.instance.BeginAlert(mineType, this);
     }
 } // End ShowDisplay()
コード例 #6
0
ファイル: WindowComponent.cs プロジェクト: oulehui/Rplidar
        /// <summary>
        /// 读取完配置调用
        /// </summary>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        private void SetResolution(int x1, int y1, int x2, int y2)
        {
            m_WallResolution = new Vector2Int(x1, y1);
            m_LandResolution = new Vector2Int(x2, y2);

            m_WallDisplay = Display.displays[0];
            m_WallDisplay.SetRenderingResolution(m_WallResolution.x, m_WallResolution.y);

            if (Display.displays.Length > 1 && m_IsOpenLand)
            {
                m_GroundDisplay = Display.displays[1];
                //激活第二面屏
                m_GroundDisplay.Activate();
                m_GroundDisplay.SetRenderingResolution(m_LandResolution.x, m_LandResolution.y);
            }
        }
コード例 #7
0
    public static int Activate(IntPtr l)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(l);
            if (num == 1)
            {
                Display display = (Display)LuaObject.checkSelf(l);
                display.Activate();
                LuaObject.pushValue(l, true);
                result = 1;
            }
            else if (num == 4)
            {
                Display display2 = (Display)LuaObject.checkSelf(l);
                int     width;
                LuaObject.checkType(l, 2, out width);
                int height;
                LuaObject.checkType(l, 3, out height);
                int refreshRate;
                LuaObject.checkType(l, 4, out refreshRate);
                display2.Activate(width, height, refreshRate);
                LuaObject.pushValue(l, true);
                result = 1;
            }
            else
            {
                LuaObject.pushValue(l, false);
                LuaDLL.lua_pushstring(l, "No matched override function Activate to call");
                result = 2;
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
コード例 #8
0
        void Start()
        {
            System.Text.StringBuilder infoText = new System.Text.StringBuilder();

            int displayCount = Display.displays.Length;

            infoText.AppendLine("Total display count: " + displayCount);

            for (int d = 0; d < displayCount; d++)
            {
                Display display = Display.displays[d];

                bool activate = d < _expectedDisplayCount;
                if (activate)
                {
                    display.Activate(display.systemWidth, display.systemHeight, 60);
                }

                infoText.AppendLine("\tDisplay #" + (d + 1) + (activate ? " (ACTIVE)" : "") + (display == Display.main ? " (main)" : ""));
                infoText.AppendLine("\t\tRender: " + display.renderingWidth + "x" + display.renderingHeight + ", System: " + display.systemWidth + "x" + display.systemHeight);
            }

            _onInfoEvent.Invoke(infoText.ToString());
        }