zoukankan      html  css  js  c++  java
  • Unity判断网络连接类型

    使用NetworkReachability判断手机游戏当前的网络连接类型,是wifi还是234G

     1 using UnityEngine;
     2 using System.Collections;
     3 
     4 public class Test : MonoBehaviour {
     5 
     6     string str;
     7     // Use this for initialization
     8     void Start () {
     9         if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
    10         {
    11             str = "2G/3G/4G";
    12         }
    13         else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
    14         {
    15             str = "wifi";
    16         }
    17         else if (Application.internetReachability == NetworkReachability.NotReachable)
    18         {
    19             str = "No Network";
    20         }
    21         
    22 
    23     }
    24     
    25     // Update is called once per frame
    26     void Update () {
    27         
    28     }
    29 
    30     void OnGUI()
    31     {
    32         GUILayout.Label(str);
    33     }
    34 }
  • 相关阅读:
    品优购注册页
    品优购详情页---产品细节模块product_detail
    品优购详情页---产品详细信息区域 iteminfo_wrap
    poj 3684
    POJ 2785
    POJ 3185
    POJ 3279
    POJ 3276
    POJ 2566
    POJ 2100
  • 原文地址:https://www.cnblogs.com/zhangbaochong/p/4855709.html
Copyright © 2011-2022 走看看