unity 屏幕旋转 相关 笔记

 void Awake()
    {
      //  强制屏幕四个方向不旋转的方法
        //纵向 上下 两个方向
        Screen.autorotateToPortrait = false;
        Screen.autorotateToPortraitUpsideDown = false;


        //横向 上下两个方向
        Screen.autorotateToLandscapeLeft = false;
        Screen.autorotateToLandscapeRight = false;


    }
    //自动处理旋转
    void Update()
    {
        //处理横向两个方向旋转
        if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft)
        {
            if (Screen.orientation != ScreenOrientation.LandscapeLeft)
            {
                Screen.orientation = ScreenOrientation.LandscapeLeft;
            }
        }
        else if (Input.deviceOrientation == DeviceOrientation.LandscapeRight)
        {
            if (Screen.orientation != ScreenOrientation.LandscapeRight)
            {
                Screen.orientation = ScreenOrientation.LandscapeRight;
            }


        }
        else
       //处理纵向两个方向的旋转
       if (Input.deviceOrientation == DeviceOrientation.Portrait)
        {
            if (Screen.orientation != ScreenOrientation.Portrait)
            {
                Screen.orientation = ScreenOrientation.Portrait;
            }
        }
        else if (Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown)
        {
            if (Screen.orientation != ScreenOrientation.PortraitUpsideDown)
            {
                Screen.orientation = ScreenOrientation.PortraitUpsideDown;
            }
        }

    }

键盘类型总结

 //
    // Summary:
    //     ///
    //     Describes the type of keyboard.
    //     ///
    public enum TouchScreenKeyboardType
    {
        //
        // Summary:
        //     ///
        //     Default keyboard for the current input method.
        //     ///
        Default = 0,
        //
        // Summary:
        //     ///
        //     Keyboard displays standard ASCII characters.
        //     ///
        ASCIICapable = 1,
        //
        // Summary:
        //     ///
        //     Keyboard with numbers and punctuation.
        //     ///
        NumbersAndPunctuation = 2,
        //
        // Summary:
        //     ///
        //     Keyboard optimized for URL entry.
        //     ///
        URL = 3,
        //
        // Summary:
        //     ///
        //     Numeric keypad designed for PIN entry.
        //     ///
        NumberPad = 4,
        //
        // Summary:
        //     ///
        //     Keypad designed for entering telephone numbers.
        //     ///
        PhonePad = 5,
        //
        // Summary:
        //     ///
        //     Keypad designed for entering a person's name or phone number.
        //     ///
        NamePhonePad = 6,
        //
        // Summary:
        //     ///
        //     Keyboard optimized for specifying email addresses.
        //     ///
        EmailAddress = 7,
        //
        // Summary:
        //     ///
        //     Keyboard designed for Nintendo Network Accounts (available on Wii U only).
        //     ///
        NintendoNetworkAccount = 8
    }
}




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值