//根据配置项 获得配置项目对应的URL页面内容 static public void GetURLPageContent(string cfgItemName, Action <string> onLoad) { Action <string> loadURL = delegate(string url) { HTTPTool.GetText(url, onLoad); }; GetURL(cfgItemName, loadURL); }
//------------------------------------------------------------------------// static private void Init(Action <bool> initFinish) { //Debug.Log("ServerConfig-->Init()-->ServerConfig.Instance.CfgMapURL:" + ServerConfig.Instance.CfgMapURL); Action <string> getMapCfgAction = delegate(string cfgMapContent) { if (string.IsNullOrEmpty(cfgMapContent) || cfgMapContent == "") { UIWindowUpdate.Instance.ShowTips(LanguageConfig.GetText(15)); Init(initFinish); return; } CfgURLConfig.LoadFromText(cfgMapContent, "CfgURLConfig"); string cfgURL = CfgURLConfig.GetCfgURL(ServerConfig.Instance.Version); //Debug.Log("ServerConfig-->Init()-->getMapCfgAction-->cfgURL:" + cfgURL); Action <string> getCfgAction = delegate(string cfgContent) { ServerURLConfig.LoadFromText(cfgContent, "ServerURLConfig"); foreach (var item in ServerURLConfig.dataMap) { //Debug.Log("ServerConfig-->Init()-->getMapCfgAction-->getCfgAction-->cfg name:"+item.Value.name + " url:" + item.Value.url); switch (item.Value.name.ToLower()) { case "noticedata": NoticeURL = item.Value.url; break; case "paomadeng": PaoMaDengURL = item.Value.url; break; case "contact": ContactURL = item.Value.url; break; case "help": HelpURL = item.Value.url; break; case "serverlist": ServerListURL = item.Value.url; break; case "androidversion": AndroidVersionURL = item.Value.url; break; case "iosversion": IOSVersionURL = item.Value.url; break; case "windowsversion": WindowsVersionURL = item.Value.url; break; case "game": GameConfigURL = item.Value.url; break; case "agreement": AgreementURL = item.Value.url; break; } } IsInit = true; initFinish(true); }; HTTPTool.GetText(cfgURL, getCfgAction); }; HTTPTool.GetText(ServerConfig.Instance.CfgMapURL, getMapCfgAction); }
static public void GetAgreementData(Action <string> onLoad) { if (IsInit) { HTTPTool.GetText(AgreementURL, onLoad); } else { Action <bool> initAction = delegate(bool result) { HTTPTool.GetText(AgreementURL, onLoad); }; Init(initAction); } }
static public void GetVersionData(Action <string> onLoad) { if (IsInit) { HTTPTool.GetText(GetCurrentVersionURL(), onLoad); } else { Action <bool> initAction = delegate(bool result) { HTTPTool.GetText(GetCurrentVersionURL(), onLoad); }; Init(initAction); } }
static public void GetPaoMaDengData(Action <string> onLoad) { if (IsInit) { HTTPTool.GetText(PaoMaDengURL, onLoad); } else { Action <bool> initAction = delegate(bool result) { HTTPTool.GetText(PaoMaDengURL, onLoad); }; Init(initAction); } }
static public void GetGameConfigData(Action <string> onLoad) { //Debug.Log("ServerURLManager.cs-->GetGameConfigData-->GameConfigURL:" + GameConfigURL + " Init:" + IsInit); if (IsInit) { HTTPTool.GetText(GameConfigURL, onLoad); } else { Action <bool> initAction = delegate(bool result) { HTTPTool.GetText(GameConfigURL, onLoad); }; Init(initAction); } }