Esempio n. 1
0
        public void Fatal(string message, params object[] args)
        {
            if (args.Length > 0)
            {
                message = string.Format(message, args);
            }

            WriteLog(LogLevel.FATAL, message);
            WriteLog(LogLevel.FATAL, UtilTools.GetCallStack());
        }
Esempio n. 2
0
        public void Load()
        {
            try {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }

                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Elements("configs");
                    if (xElement == null)
                    {
                        return;
                    }

                    var elements = xElement.Elements("config");
                    foreach (var em in elements)
                    {
                        TaskConfig item = new TaskConfig();
                        if (item.Load(em))
                        {
                            switch (item.taskType)
                            {
                            case TaskType.Level:
                                levelList.Add(item);
                                break;

                            case TaskType.Daily:
                                dailyList.Add(item);
                                break;

                            case TaskType.Achieve:
                                achieveList.Add(item);
                                break;
                            }

                            dataList.Add(item);
                        }
                    }
                }
            }
            catch (Exception e) {
                LoggerSystem.Instance.Error("data/Task.Xml resource failed " + e.ToString());
            }
        }
Esempio n. 3
0
        public void Load()
        {
            mapVersion.Clear();
            mapDictionary.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }

                /// 试着用www 读取
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element("maps");
                    if (xElement == null)
                    {
                        return;
                    }

                    var elements = xElement.Elements("map");
                    foreach (var em in elements)
                    {
                        MapListConfig item = new MapListConfig();
                        if (item.Load(em))
                        {
                            MapConfig tmc = new MapConfig(item.mapID);
                            tmc.Load();
                            mapDictionary.Add(item.mapID, tmc);
                            mapVersion.Add(item.mapID, item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error("maplist resource failed " + e.ToString());
            }

            LoadExtraData();
        }
Esempio n. 4
0
        public bool LoadStreamingAssets(string path, out object asset)
        {
            asset = null;
            string fullpath = UtilTools.GetStreamAssetsByPlatform("/" + path);

            if (localAssets.ContainsKey(fullpath))
            {
                var la = localAssets [fullpath];
                asset = saveRoot + la.assetBundlePath;

                return(true);
            }

            return(false);
        }
Esempio n. 5
0
        public void Load()
        {
            firstNameList.Clear();
            lastNameList.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element("randNames");
                    if (xElement == null)
                    {
                        return;
                    }
                    var elements = xElement.Elements("randName");
                    foreach (var em in elements)
                    {
                        NameConfig item = new NameConfig();
                        if (item.Load(em))
                        {
                            if (item.type == 0)
                            {
                                firstNameList.Add(item);
                            }
                            else
                            {
                                lastNameList.Add(item);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error("data/RandomName.xml resource failed " + e.ToString());
            }
        }
        /// <summary>
        /// 启动时根据本地语言设置,读取数据配置
        /// </summary>
        public void Load()
        {
            mDataList.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }
                /// 试着用www 读取
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element("languages");
                    if (xElement == null)
                    {
                        return;
                    }

                    SystemLanguage language    = (SystemLanguage)LocalAccountStorage.Get().localLanguage;
                    string         strLanguage = GetLanguageNameConfig(language);

                    var elements = xElement.Elements("language");
                    foreach (var em in elements)
                    {
                        LanguageConfig item = new LanguageConfig();
                        if (item.Load(em, strLanguage))
                        {
                            mDataList.Add(item.mID, item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error("data/dictionary.xml resource failed " + e.ToString());
            }
        }
        public void Load()
        {
            dataList.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }
                /// 试着用www 读取
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }


                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element("camps");
                    if (xElement == null)
                    {
                        return;
                    }

                    var elements = xElement.Elements("camp");
                    foreach (var em in elements)
                    {
                        CampConfig item = new CampConfig();
                        if (item.Load(em))
                        {
                            dataList.Add(item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error("data/Camp.xml resource failed " + e.ToString());
            }
        }
Esempio n. 8
0
        public void Load()
        {
            aiStrategy.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }

                /// 试着用www 读取
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element("aistrategys");
                    if (xElement == null)
                    {
                        return;
                    }

                    var aistrategy = xElement.Elements("aistrategy");
                    foreach (var ai in aistrategy)
                    {
                        AIStrategyConfig item = new AIStrategyConfig();
                        if (item.Load(ai))
                        {
                            aiStrategy.Add(item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error(Path() + "resource failed !" + e.ToString());
            }
        }
Esempio n. 9
0
        public void Load()
        {
            mlcList.Clear();
            mbcList.Clear();
            mpcList.Clear();
            try
            {
                string url = UtilTools.GetStreamAssetsByPlatform(Path());
                if (string.IsNullOrEmpty(url))
                {
                    return;
                }

                /// 试着用www 读取
                WWW www = new WWW(url);
                while (!www.isDone)
                {
                    ;
                }

                //text = Resources.Load(Path()).ToString();

                if (!string.IsNullOrEmpty(www.text))
                {
                    XDocument xmlDoc   = XDocument.Parse(www.text);
                    var       xElement = xmlDoc.Element(root);
                    if (xElement == null)
                    {
                        return;
                    }

                    id           = xElement.GetAttribute("id", "");
                    player_count = Convert.ToInt32(xElement.GetAttribute("player_count", "0"));
                    vertical     = Convert.ToBoolean(xElement.GetAttribute("vertical", ""));
                    audio        = xElement.GetAttribute("audio", "");
                    defaultai    = xElement.GetAttribute("defaultAIStrategy", "-1");
                    teamAITypes  = xElement.GetAttribute("teamAITypes", "");
                    if (teamAITypes != "")
                    {
                        string[] ids = teamAITypes.Split(',');
                        foreach (var item in ids)
                        {
                            teamAiType.Add(Convert.ToInt32(item));
                        }
                    }
                    for (int i = teamAiType.Count; i < (int)TEAM.TeamMax; i++)
                    {
                        teamAiType.Add(-1);
                    }

                    //读取所有mapbuilding数据
                    var elements_mbs = xElement.Elements("mapbuildings");
                    if (elements_mbs != null)
                    {
                        foreach (var em in elements_mbs)
                        {
                            var elements_mb = em.Elements("mapbuilding");
                            foreach (var em_mb in elements_mb)
                            {
                                MapBuildingConfig item = new MapBuildingConfig();
                                if (item.Load(em_mb))
                                {
                                    mbcList.Add(item);
                                }
                            }
                        }
                    }
                    //读取所有mapline数据
                    var elements_mls = xElement.Elements("maplines");
                    if (elements_mls != null)
                    {
                        foreach (var em in elements_mls)
                        {
                            var elements_ml = em.Elements("mapline");
                            foreach (var em_ml in elements_ml)
                            {
                                MapLineConfig item = new MapLineConfig();
                                if (item.Load(em_ml))
                                {
                                    mlcList.Add(item);
                                }
                            }
                        }
                    }
                    //读取所有mapplayer数据
                    var elements_mps = xElement.Elements("mapplayers");
                    if (elements_mps != null)
                    {
                        foreach (var em in elements_mps)
                        {
                            var elements_mp = em.Elements("mapplayer");
                            foreach (var em_mp in elements_mp)
                            {
                                MapPlayerConfig item = new MapPlayerConfig();
                                if (item.Load(em_mp))
                                {
                                    mpcList.Add(item);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggerSystem.Instance.Error("data/maplist/" + name + ".xml resource failed " + e.ToString());
            }
        }
Esempio n. 10
0
 public static string FormatDataProviderPath(string datapath)
 {
     return(System.IO.Path.Combine(UtilTools.GetStreamAssetsByPlatform(), datapath));
 }