Exemple #1
0
    /**
     *===============================================
     * 获取配置信息
     *===============================================
     */
    protected void LoadSdkConifg()
    {
        string    str    = GetSdkConfig();
        SDKConfig result = JsonFx.Json.JsonReader.Deserialize <SDKConfig>(str);

        ServerInfoConfig.AddConfig(result);
    }
Exemple #2
0
        public static string GetAddressByServerName(string serverName)
        {
            ServerInfoConfig serverInfoConfig =
                World.Instance.GetComponent <ConfigComponent>().GetCategory <ServerInfoCategory>()[serverName];
            string address = serverInfoConfig.Host + ":" + serverInfoConfig.Port;

            return(address);
        }
Exemple #3
0
    /**
     *===============================================
     * 获取sdk配置信息
     *===============================================
     */
    protected void LoadSdkConifg()
    {
        string config = GetSdkConfig();

        if (config == null)
        {
            return;
        }
        SDKConfig result = JsonFx.Json.JsonReader.Deserialize <SDKConfig>(config);

        ServerInfoConfig.AddConfig(result);
    }
Exemple #4
0
 private bool IsTestType()
 {
     if (ServerInfoConfig.GetServerInfoType() == ServerInfoType.inner ||
         ServerInfoConfig.GetServerInfoType() == ServerInfoType.sout ||
         ServerInfoConfig.GetServerInfoType() == ServerInfoType.sout_test)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #5
0
    private void Login(string data)
    {
        LoginUser user = JsonFx.Json.JsonReader.Deserialize <LoginUser>(data);

        if (user.Platform == null || user.Platform.Equals(""))
        {
            user.Platform = ServerInfoConfig.GetPlatform();
        }
        if (user.AgentId == null || user.AgentId.Equals(""))
        {
            user.AgentId = ServerInfoConfig.GetAgentID();
        }
        if (user.Channel == null || user.Channel.Equals(""))
        {
            user.Channel = user.Platform;
        }
        LuaManager.instance.CallFunction("LoginManager.OnSdkLoginSuccess", user);
    }
Exemple #6
0
    public static void Startup(ServerInfoType serverInfoType)
    {
        if (m_instance == null)
        {
            GameObject go = GameWorld.GetGameObject();
            m_instance = GameUtils.GetScript <GameWorld>(go);
        }

        ServerInfoConfig.Init(serverInfoType);

        if (GameConfig.showFPS)
        {
            m_instance.gameObject.AddComponent <FPS>();
        }

        m_instance.gameObject.AddComponent <Loom>();

        m_instance.StartGame();
    }
Exemple #7
0
    /// <summary>
    /// 检测apk版本,确认是否需要强制更新
    /// </summary>
    /// <returns> false:需要强更; true:不需要强更 </returns>
    private static bool CheckAPKVersion()
    {
        string url = ServerInfoConfig.GetApkURL();

        if (string.IsNullOrEmpty(url))
        {
            return(true);
        }

        url += "?sign=" + SDK.GetInstance().GetBundleID() + "&game=" + ServerInfoConfig.GetGame();
        string result = HttpUtil.Get(url);

        if (string.IsNullOrEmpty(result))
        {
            return(true);
        }

        ApkVersionInfo versionInfo = JsonFx.Json.JsonReader.Deserialize <ApkVersionInfo>(result);

        if (null == versionInfo)
        {
            return(true);
        }

        int toVersion  = Util.ParseVersion(versionInfo.version);
        int curVersion = Util.ParseVersion(ServerInfoConfig.GetVersion());

        if (curVersion < toVersion)
        {
            UpdateNoticePanel.Show(versionInfo.notice, () =>
            {
                Application.OpenURL(versionInfo.url);
            });
            return(false);
        }

        return(true);
    }
Exemple #8
0
    private static void CaptureLog(string condition, string stacktrace, LogType type)
    {
        if (type == LogType.Error)
        {
            errorDict.Clear();

            string url = ServerInfoConfig.GetErrorURL();
            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            errorDict.Add("msg", condition + "\n" + stacktrace);
            errorDict.Add("game", ServerInfoConfig.GetGame());
            errorDict.Add("environment", "android");
            string deviceID = "";
            //string deviceID = SystemInfo.deviceUniqueIdentifier;
            if (!string.IsNullOrEmpty(deviceID))
            {
                errorDict.Add("deviceId", deviceID);
            }
            string deviceName = "";
            if (!string.IsNullOrEmpty(deviceName))
            {
                errorDict.Add("deviceName", deviceName);
            }
            string platform = "jzwl";
            if (!string.IsNullOrEmpty(platform))
            {
                errorDict.Add("platform", platform);
            }
            string accountName = "";
            if (!string.IsNullOrEmpty(accountName))
            {
                errorDict.Add("account", accountName);
            }
            string accountTicket = "";
            if (!string.IsNullOrEmpty(accountName))
            {
                errorDict.Add("ticket", accountTicket);
            }
            long playerId = 0;
            if (playerId != 0)
            {
                errorDict.Add("playerId", playerId.ToString());
            }

            if (errorDict != null && errorDict.Count > 0)
            {
                string reqUrl = url + "?";
                foreach (KeyValuePair <string, string> post_arg in errorDict)
                {
                    reqUrl += post_arg.Key + "=" + WWW.EscapeURL(post_arg.Value, System.Text.Encoding.UTF8) + "&";
                }
                reqUrl = reqUrl.Remove(reqUrl.Length - 1);

                try
                {
                    System.Net.WebRequest  wReq  = System.Net.WebRequest.Create(reqUrl);
                    System.Net.WebResponse wResp = wReq.GetResponse();
                    wResp.GetResponseStream();
                }
                catch (System.Exception)
                {
                    //errorMsg = ex.Message;
                }
            }
        }
    }
Exemple #9
0
 protected string GetSdkJavaClass()
 {
     return(ServerInfoConfig.GetSdkClass());
 }
Exemple #10
0
 public static string HOST_RES_ZIP()
 {
     return(ServerInfoConfig.GetResZipURL() + PathUtils.osDir + "/");
 }