示例#1
0
        void Awake()
        {
            try{
                DontDestroyOnLoad(this);
                s_GameMaim = this;
                s_Root     = this.gameObject;

                FrameHandle.UF_AddHandle(Debugger.UF_GetInstance());
                //System
                FrameHandle.UF_AddHandle(MessageSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(UpgradeSystem.UF_GetInstance());
                //FrameHandle.UF_AddHandle(NetworkSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(AssetSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(CEntitySystem.UF_GetInstance());
                //FrameHandle.UF_AddHandle(LuaFramework.UF_GetInstance());
                //manager
                FrameHandle.UF_AddHandle(PDataManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(ShaderManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(AudioManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(UIManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(FXManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(NavigateManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(MotionManager.UF_GetInstance());
                //FrameHandle.UF_AddHandle(PerformActionManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RaycastManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(VoiceManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RenderPreviewManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RefObjectManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(CheckPointManager.UF_GetInstance());

                FrameHandle.UF_AddHandle(SimulationManager.Instance);

                //setting
                GTime.FrameRate     = 60;
                GTime.FixedTimeRate = 0.016f;
                GTime.RunDeltaTime  = 0.016f;

                Screen.sleepTimeout = SleepTimeout.NeverSleep;
                VendorSDK.UF_Init();

                //VestBinder.Bind();
            }
            catch (System.Exception e) {
                Debugger.UF_Exception(e);
            }
        }
示例#2
0
        private IEnumerator UF_Start(DelegateMethod callback)
        {
            //获取当前资源版本号

            UF_ResfreshVersion();

            UF_LogInfo("localAssetVersion: " + localAssetVersion);
            UF_LogInfo("appAssetVersion: " + appAssetVersion);
            UF_LogInfo("appVersion: " + appVersion);

            callback(STATE_SUCCESS);

            //发送打点
            CheckPointManager.UF_Send(5);

            yield break;
        }
示例#3
0
        //载入全局配置
        internal static IEnumerator UF_InitGameConfigs()
        {
            GlobalConfig = new ConfigFile();
            UserConfig   = new ConfigFile(GlobalPath.ResPersistentPath + "user_setting.ini");

            yield return(GameMain.Instance.StartCoroutine(UF_IELoadSettingsFile(GlobalConfig, "settings.ini")));

            //app打包配置
            yield return(GameMain.Instance.StartCoroutine(UF_IELoadSettingsFile(GlobalConfig, "appsettings.ini")));

            //渠道配置
            yield return(GameMain.Instance.StartCoroutine(UF_IELoadSettingsFile(GlobalConfig, "vdsettings.ini")));

            //for test
#if UNITY_EDITOR
            IsAppCheck = GlobalSettings.UF_GetGlobalValue("DEBUG", "REVIEW") == "1";
#endif

            if (IsAppCheck)
            {
                //审核配置覆盖
                yield return(GameMain.Instance.StartCoroutine(UF_IELoadSettingsFile(GlobalConfig, "rwsettings.ini")));
            }

            CheckPointManager.UF_Send(2);

            ResPrefix = GlobalSettings.UF_GetGlobalValue("APP", "RES_PREFIX");
            ResSuffix = GlobalSettings.UF_GetGlobalValue("APP", "RES_SUFFIX");

            ResBKey           = GHelper.UF_ParseInt(GlobalSettings.UF_GetGlobalValue("APP", "RES_BKEY"));
            EncBKey           = GHelper.UF_ParseInt(GlobalSettings.UF_GetGlobalValue("APP", "ENC_KEY"));
            IsRawAsset        = InstallMode == "raw";
            Debugger.IsActive = GlobalSettings.UF_GetGlobalValue("DEBUG", "CONSOLE") == "1" ||
                                GlobalSettings.UF_GetUserValue("DEBUG", "PIN_CONSOLE") == "1";
            yield return(null);

            CheckPointManager.UF_Send(3);
        }
示例#4
0
        //比较base包判断是否需要覆盖安装
        private IEnumerator UF_Install(DelegateMethod callback)
        {
            int int_version_current    = 0;
            int int_local_base_version = 1;

            try{
                int_version_current    = int.Parse(localAssetVersion);
                int_local_base_version = int.Parse(appAssetVersion);
            }catch (System.Exception e) {
                UF_LogError(e.Message);
                //UF_LogError(e.StackTrace);
            }

            if (int_version_current < int_local_base_version)
            {
                DelegateMethod install_callback = delegate(object param) {
                    int retcode = (int)param;
                    if (retcode == 0)
                    {
                        callback(STATE_SUCCESS);
                    }
                    else
                    {
                        UF_ShowMessageBox(string.Format("{0}:{1}", GlobalText.LAN_INSTALL_ERROR, retcode), GlobalText.LAN_CONFIRM, (e) => { callback(STATE_ERROR); });
                    }
                };
                //多重闭包解决,如果有问题,用while(true){yield return null} 方式
                m_UpgradeFiles.UF_InstallBase(install_callback);
                CheckPointManager.UF_Send(6);
            }
            else
            {
                //包体已经安装
                callback(STATE_SUCCESS);
            }
            yield return(null);
        }
示例#5
0
        //根据base包比较判断是否需要更新
        private IEnumerator UF_Upgrade(DelegateMethod callback)
        {
            //忽略版本更新检查
            if (IngoreResVersionCheck)
            {
                callback(STATE_SUCCESS); yield break;
            }

            //先检查源站文件是否能正常下载,否则去CDN获取文件
            string urlVersionFile = UF_GetUpgradeFileURL(GlobalSettings.UrlRawAssetsUpgrade);

            UF_LogInfo("URL Raw Res Version:" + urlVersionFile);
            //获取资源版本列表
            //检查是否与更新包
            WWW wwwResVersionFile = new WWW(urlVersionFile);

            yield return(wwwResVersionFile);

            if (!string.IsNullOrEmpty(wwwResVersionFile.error))
            {
                UF_LogError(string.Format("Upgrade -> Raw wwwResVersionFile error[{0}]  \n errorinfo:[{1}]", wwwResVersionFile.url, wwwResVersionFile.error));
                wwwResVersionFile.Dispose();
                UF_LogInfo("Upgrade -> Try to download version file from CDN");
                urlVersionFile = UF_GetUpgradeFileURL(GlobalSettings.UrlAssetsUpgrade);
                UF_LogInfo("URL CDN Res Version:" + urlVersionFile);
                wwwResVersionFile = new WWW(urlVersionFile);
                yield return(wwwResVersionFile);
            }

            if (!string.IsNullOrEmpty(wwwResVersionFile.error))
            {
                UF_LogError(string.Format("wwwResVersionFile error[{0}]  \n errorinfo:[{1}]", wwwResVersionFile.url, wwwResVersionFile.error));
                //无法获取更新文件,是否跳过更新
                AlertDialog.UF_ShowOkCancel(GlobalText.LAN_WARNING, GlobalText.LAN_CANCLE, GlobalText.LAN_CONFIRM, GlobalText.LAN_ERROR_CHECK_UPGRADE,
                                            (e) => { callback(STATE_ERROR); }, (e) => { callback(STATE_SUCCESS); });
                yield break;
            }
            string txtVersionFile = wwwResVersionFile.text;

            wwwResVersionFile.Dispose();
            //判断更新包大小情况
            m_LstUpdateFileInfo.Clear();

            webUpgradInfo = txtVersionFile;

            Debugger.UF_LogTag("version", string.Format("Upgrade:{0} \n {1}", urlVersionFile, txtVersionFile));

            UF_WrapUpdateList(txtVersionFile, localAssetVersion, m_LstUpdateFileInfo);

            CheckPointManager.UF_Send(7);

            //没有需要更新的更新包则跟新完成
            if (m_LstUpdateFileInfo.Count == 0)
            {
                callback(STATE_SUCCESS);
                yield break;
            }
            else
            {
                //更新包大小比较建议
                float size = 0;
                for (int k = 0; k < m_LstUpdateFileInfo.Count; k++)
                {
                    size += m_LstUpdateFileInfo[k].size;
                }
                size = (int)(size / (float)(1024 * 1024));

                DelegateMethod DelegateExctureUpdate = delegate(object param) {
                    m_UpgradeFiles.UF_Upgrade(m_LstUpdateFileInfo, (e) => {
                        if (!(bool)e)
                        {
                            UF_ShowMessageBox(GlobalText.LAN_ERROR_CHECK_UPGRADE, GlobalText.LAN_CONFIRM, (k) => {
                                //更新失败
                                callback(STATE_ERROR);
                            });
                        }
                        else
                        {
                            callback(STATE_SUCCESS);
                        }
                    });
                };

//wifi 下载提示
//                if (size > SizeUpgradeAdvice) {
//                    ShowMessageBox(string.Format(AppLanguages.LValue("LAN_UPDATE_TIPS"), size), AppLanguages.LValue("LAN_START_UPDATE"), DelegateExctureUpdate);
//                }
//                else {
                DelegateExctureUpdate(null);
//                }
            }
        }