Пример #1
0
    private void getIPType(string serverIp, string serverPorts, out string newServerIp, out AddressFamily mIPType)
    {
        mIPType     = AddressFamily.InterNetwork;
        newServerIp = serverIp;
        try
        {
            string mIpv6 = IOSBridgeManager.GetIPv6(serverIp, serverPorts);

            if (!string.IsNullOrEmpty(mIpv6))
            {
                string[] m_StrTemp = System.Text.RegularExpressions.Regex.Split(mIpv6, "&&");
                if (m_StrTemp != null && m_StrTemp.Length >= 2)
                {
                    string IPType = m_StrTemp[1];
                    if (IPType == "ipv6")
                    {
                        newServerIp = m_StrTemp[0];
                        mIPType     = AddressFamily.InterNetworkV6;
                    }
                }
            }
        }
        catch (Exception e)
        {
            Debug.LogError("ipv6: " + e.Message);
        }
    }
Пример #2
0
 //每一次调用只会请求一次定位,不会连续返回
 public void StartLocation()
 {
     //定位
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         IOSBridgeManager.StartLocation();
     }
     else if (Application.platform == RuntimePlatform.Android)
     {
         using (AndroidJavaClass jc = new AndroidJavaClass("com.damaiapp.ncmj.location.LocationUtil"))
         {
             jc.CallStatic("startLocation");
         }
     }
 }
Пример #3
0
    //苹果分享协程
    private IEnumerator iOSShareScreenshot(bool shareToTimeLine)
    {
        Application.CaptureScreenshot("ShareView.png");
        Debug.Log("start capture");

        while (!System.IO.File.Exists(Application.persistentDataPath + "/ShareView.png"))
        {
            Debug.Log(System.IO.File.Exists(Application.persistentDataPath + "/ShareView.png"));

            yield return(new WaitForSeconds(0.05f));;
        }

        if (shareToTimeLine)
        {
            IOSBridgeManager.DMShareScreenshotToWechatTimeline();
        }
        else
        {
            IOSBridgeManager.DMShareScreenshotToWechatSession();
        }
    }
Пример #4
0
 //分享给微信朋友圈
 public void ShareWechatTimeLine(string title, string desc, string urlStr)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         IOSBridgeManager.DMShareWechatTimeline(title, desc, urlStr);
     }
     else if (Application.platform == RuntimePlatform.Android)
     {
         Util.StartCoroutine(Util.DelayToInvokeDo(() =>
         {
             using (AndroidJavaClass jc = new AndroidJavaClass("com.damaiapp.ncmj.third.wx.WechatUtil"))
             {
                 //要传递过去的参数
                 object[] message = new object[3];
                 message[0]       = title;  // title
                 message[1]       = desc;   // desc
                 message[2]       = urlStr; // urlStr
                 jc.CallStatic("ShareWechatTimeLine", message);
             }
         }, 0.5f));
     }
 }