示例#1
0
    /** 同步加载全部配置(Editor用)(场景编辑器) */
    public void loadSyncForEditorAll()
    {
        string path = ResourceInfoControl.getStreamingAssetsPath(ShineGlobal.configPath, false);

        BytesReadStream stream = FileUtils.readFileForBytesReadStream(path);

        if (stream == null)
        {
            Ctrl.throwError("未找到" + ShineGlobal.configPath + ",需要执行configExport");
        }
        else
        {
            afterReadConfig(toRead(stream));
        }
    }
示例#2
0
    protected void toLoadGame(bool isForEditor)
    {
        if (ShineSetting.useHotFix)
        {
            if (!ShineSetting.isRelease)
            {
                bool   useRelease = true;
                string dd         = useRelease ? "Release" : "Debug";

                //TODO:临时读取路径
                ShineGlobal.hotfixDllPath = "../../hotfix/Temp/bin/" + dd + "/hotfix.dll";
                // ShineGlobal.hotfixPDBPath="../hotfix/Temp/bin/"+dd+"/hotfix.pdb";
            }

            //android或者本地开启反射
            if (Application.platform == RuntimePlatform.Android || ShineSetting.useReflectDll)
            {
                string mName = isForEditor ? "mainForEditor" : "main";

                string dllPath;

                if (ShineSetting.isRelease)
                {
                    dllPath = ResourceInfoControl.getResourceSavePath(ShineGlobal.hotfixDllPath);
                }
                else
                {
                    dllPath = ResourceInfoControl.getStreamingAssetsPath(ShineGlobal.hotfixDllPath, false);
                }

                MethodInfo method = Assembly.LoadFrom(dllPath).GetType("HGameApp").GetMethod(mName);

                if (method == null)
                {
                    Ctrl.throwError("不能没有入口方法:HGameApp::" + mName);
                    return;
                }

                method.Invoke(null, null);

                if (!isForEditor)
                {
                    _stepTool.completeStep(LoadGame);
                }
            }
            else
            {
                if (isForEditor)
                {
                    byte[] dllBytes = FileUtils.readFileForBytes(ResourceInfoControl.getStreamingAssetsPath(ShineGlobal.hotfixDllPath, false));
                    onLogicDllLoaded(dllBytes, null, isForEditor);
                }
                else
                {
                    _loader = new ShineLoader();
                    _loader.setCompleteCall(() =>
                    {
                        byte[] dllBytes = _loader.getBytes();
                        _loader.unload();

                        onLogicDllLoaded(dllBytes, null, isForEditor);
                        //
                        //					if(!ShineSetting.isRelease)
                        //					{
                        //						_loader.setCompleteCall(()=>
                        //						{
                        //							byte[] pdbBytes=_loader.getWWW().bytes;
                        //							_loader.unload();
                        //
                        //							onLogicDllLoaded(dllBytes,pdbBytes);
                        //						});
                        //
                        //						_loader.loadFromFileWithoutPlatform(MainSetting.logicPDBPath);
                        //					}
                        //					else
                        //					{
                        //						onLogicDllLoaded(dllBytes,null);
                        //					}
                    });

                    //不是发布模式
                    if (ShineSetting.isRelease)
                    {
                        _loader.loadResource(ShineGlobal.hotfixDllPath);
                    }
                    else
                    {
                        _loader.loadStreamingAsset(ShineGlobal.hotfixDllPath);
                    }
                }
            }
        }
        else
        {
            callGAppMain(isForEditor);

            if (!isForEditor)
            {
                _stepTool.completeStep(LoadGame);
            }
        }
    }