Example #1
0
    private void Activate()
    {
        if (m_isActivating)
        {
            return;
        }
        m_isActivating = true;
        MogoGlobleUIManager.Instance.ShowGlobleStaticText(true, LanguageData.GetContent(50001));
        string url = SystemConfig.GetActivateKeyUrl(MogoWorld.thePlayer.dbid, keyInput.text);
        //Debug.LogError("url:" + url);


        Action action = () =>
        {
            Mogo.Util.Utils.GetHttp(url,
                                    (resp) =>
            {
                Driver.Invoke(() =>
                {
                    MogoGlobleUIManager.Instance.ShowGlobleStaticText(false, "");
                    m_isActivating = false;
                    int respCode   = int.Parse(resp);

                    if (respCode != 0)
                    {
                        if (respCode == 5)
                        {
                            MogoMsgBox.Instance.ShowFloatingText(LanguageData.GetContent(50007));
                        }
                        else
                        {
                            MogoMsgBox.Instance.ShowFloatingText(LanguageData.GetContent(respCode + 50001));
                        }
                    }
                });
            },
                                    (errodCode) =>
            {
                Driver.Invoke(() =>
                {
                    //Debug.LogError("haha");
                    MogoMsgBox.Instance.ShowMsgBox("network error:" + errodCode);
                    m_isActivating = false;
                    MogoGlobleUIManager.Instance.ShowGlobleStaticText(false, "");
                });
            }
                                    );
        };

        action.BeginInvoke(null, null);
    }