Example #1
0
        public T DeserializeObjFromFile <T>(string varFileName)
        {
            T t = default(T);

            if (string.IsNullOrEmpty(varFileName))
            {
                return(t);
            }
            string filePath = ResContext.GetSavePath() + "/" + varFileName;

            byte[] bytes = null;
            try
            {
                bytes = File.ReadAllBytes(filePath);
            }
            catch (Exception e)
            {
                Helper.Log(e.Message);
            }
            if (bytes == null || bytes.Length == 0)
            {
                Helper.Log("LocalCfg DeserializeObjFromFile:Error caused by null file bytes,path: " + filePath);
                return(t);
            }
            return(DeserializeObjFromBytes <T>(bytes));
        }
        void OnResManagerInited()
        {
            string shuaishuai_prefab_path;

#if ASSETBUNDLE_MODE
            shuaishuai_prefab_path = "role/shuaishuai";
#else
            shuaishuai_prefab_path = "Model/Role/Boy_shuai/Shuaishuai(Merged)";
#endif
            ResContext.LoadAssetAsync(shuaishuai_prefab_path, "Shuaishuai(Merged)", typeof(GameObject), OnLoadShuaishuai);

            string Joe_prefab_path;
#if ASSETBUNDLE_MODE
            Joe_prefab_path = "role/joe";
#else
            Joe_prefab_path = "Model/Role/Joe/Joe(Merged)";
#endif
            ResContext.LoadAssetAsync(Joe_prefab_path, "Joe(Merged)", typeof(GameObject), OnLoadJoe);

            string Mage_prefab_path = "role/mage";
#if ASSETBUNDLE_MODE
            Mage_prefab_path = "role/mage";
#else
            Mage_prefab_path = "Model/Role/Mage/Mage(Merged)";
#endif
            ResContext.LoadAssetAsync(Mage_prefab_path, "Mage(Merged)", typeof(GameObject), OnLoadMage);

            string LittleSister_prefab_path = "role/littlesister";
#if ASSETBUNDLE_MODE
            LittleSister_prefab_path = "role/littlesister";
#else
            LittleSister_prefab_path = "Model/Role/Little_girl/LittleSister(Merged)";
#endif
            ResContext.LoadAssetAsync(LittleSister_prefab_path, "LittleSister(Merged)", typeof(GameObject), OnLoadLittleSister);
        }
Example #3
0
        void OnResourceManagerInitialized()
        {
            ConnectionManager.GetInstance().CreateConnection(ConnectionManager.ServerType.Logic, "127.0.0.1", 6000, null);

            ModelManager.GetSingleton().InitModel();
            AudioAdapter.Instance.Initialize();
#if ASSETBUNDLE_MODE
            ResourceManager.LoadAssetAsync("ui/common/atlas", "NULL", typeof(TextAsset), OnLoadedUICommonAtlas);
            ResourceManager.LoadAssetAsync("ui/common/dialog", "NULL", typeof(TextAsset), OnLoadedUICommonDialogs);
            ResourceManager.LoadAssetAsync("ui/common/font", "NULL", typeof(TextAsset), OnLoadedUIFont);
            ResourceManager.LoadAssetAsync("ui/common/localization", "Chinese", typeof(TextAsset), OnLoadedUILocalization);
#else
            ResContext.LoadAssetAsync("Localization/Chinese", string.Empty, typeof(TextAsset), OnLoadedUILocalization);
#endif
        }
Example #4
0
        /// <summary>
        /// 判断DB文件是否存在
        /// </summary>
        /// <returns></returns>
        private bool IsDbExist()
        {
            string filePath = "{0}database/{1}";

            filePath = Helper.Format(filePath, ResContext.GetSavePath(), DATABASE_NAME);

            if (File.Exists(filePath))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        public void SetupDatabasePath(LoadAssetCallback func)
        {
            if (IsOpen())
            {
                if (func != null)
                {
                    func(null, null);
                }
                return;
            }

            string root = "sdcard/db/QiuMo.bytes";

            //string root = "C:/QiuMo.bytes";
            if (File.Exists(root))
            {
                Helper.Log("Get Database Success");
                byte[] tembyte = File.ReadAllBytes(root);
                if (tembyte != null)
                {
                    Open(tembyte);
                }
                if (func != null)
                {
                    func(null, null);
                }
                return;
            }
            else
            {
                Helper.Log("File not exist!");
            }

            string filePath = "{0}{1}";

            Helper.Format(filePath, DATABASE_FILE_PATH, DATABASE_NAME);

            LoadAssetCallback tempCallback = delegate(UnityEngine.Object varObj, ResourceLoadParam varParam)
            {
                OnLoadDBFileFinsh(varObj, varParam);
                if (func != null)
                {
                    func(varObj, varParam);
                }
            };

            ResContext.LoadAssetAsync(filePath, DATABASE_NAME, typeof(TextAsset), tempCallback);
        }
Example #6
0
 public ValuesController(ResContext _ctx, ILogger <ValuesController> _log)
 {
     ctx = _ctx;
     log = _log;
 }
Example #7
0
 public HomeController(ResContext context)
 {
     _rContext = context;
 }
Example #8
0
 public MainModel()
 {
     _fileContext = new FileContext();
     _resContext  = new ResContext();
 }