Ejemplo n.º 1
0
        /// <summary>
        /// 获取登录地址
        /// </summary>
        /// <param name="webType"></param>
        /// <returns></returns>
        protected string GetWebLoginURL(EAdvanceLoginType webType)
        {
            string url = "";

            if (Debug.isDebugBuild)        // 测试版
            {
                url = "http://openapi.wxg.dev.q1.com/";
            }
            else                            // 正式版
            {
                url = "http://openapi.game.q1.com/";
            }

            if (webType == EAdvanceLoginType.EALT_QQ)
            {
                //QQ
                url += "account/loginfrom.aspx?account=qq";
            }
            else if (webType == EAdvanceLoginType.EALT_WeChat)
            {
                // 微信
                url += "account/loginfrom.aspx?account=23";
            }

            return(url);
        }
Ejemplo n.º 2
0
        public void OnAdvanceLoginClick(int nLoginType)
        {
            if (nLoginType < 0 || nLoginType > (int)EAdvanceLoginType.EALT_WeChat)
            {
                return;
            }


            AdvanceLoginType = (EAdvanceLoginType)nLoginType;

            if (null != m_BrowserInstance)
            {
                m_BrowserInstance.OnToolbarUrlFieldEndEdit(GetWebLoginURL(AdvanceLoginType));
                return;
            }

            UIMsgCmdData msg = new UIMsgCmdData((int)WndMsgID.WND_MSG_CREATEHERO_WEBBROWSER_STATE, 1, "", IntPtr.Zero, 0);

            UISystem.Instance.SendTargetWndMessage(WndID.WND_ID_LOGIN, WndMsgID.WND_MSG_CREATEHERO_WEBBROWSER_STATE, msg);

            m_WebBrowserResNode = UISystem.Instance.GetResNode("UI/Widgets/WebBrowser/WebBrowser");
            if (m_WebBrowserResNode.IsValid())
            {
                m_BrowserInstance            = m_WebBrowserResNode.InstanceMainRes <UBrowser>();
                m_BrowserInstance.Width      = (int)WebBrowserSize.x;
                m_BrowserInstance.Height     = (int)WebBrowserSize.y;
                m_BrowserInstance.InitialURL = GetWebLoginURL(AdvanceLoginType);
                m_BrowserInstance.SetToolbarType(UWebBrowserToolbarWidget.EToolbar.ETB_Close);

                m_BrowserInstance.GetRectTransform.SetParent(GetAttachParent(), false);
                m_BrowserInstance.GetRectTransform.anchoredPosition = WebBrowserPosOffset;

                m_BrowserInstance.OnJsQueryEvent.RemoveListener(OnJSQueryEvent);
                m_BrowserInstance.OnJsQueryEvent.AddListener(OnJSQueryEvent);

                m_BrowserInstance.OnDisConnectedEvent.RemoveListener(OnDisConnectedEvent);
                m_BrowserInstance.OnDisConnectedEvent.AddListener(OnDisConnectedEvent);
            }
        }