示例#1
0
    /** 初始化 */
    public static void load(Action func)
    {
        _loader = new ShineLoader();

        _loader.setCompleteCall(() =>
        {
            XML xml = _loader.getXML();

            foreach (XML xl in xml.getChildrenByName("loginURL"))
            {
                loginURLs.add(xl.getProperty("value"));
            }

            loginHttpURL = getRandomLoginURL();
            cdnURL       = xml.getChildrenByNameOne("cdnURL").getProperty("value");

            //正式版本
            if (ShineSetting.isRelease)
            {
                ShineGlobal.cdnSourcePath = cdnURL;
            }

            XML tt;

            if ((tt = xml.getChildrenByNameOne("isOfficial")) != null)
            {
                ShineSetting.isOfficial = StringUtils.strToBoolean(tt.getProperty("value"));
            }

            _loader.unload();
            func();
        });

        _loader.loadStreamingAsset(ShineGlobal.settingPath);
    }
示例#2
0
    /** 初始化服务器列表 */
    public static void loadServerList(Action func)
    {
        _loader.setCompleteCall(() =>
        {
            XML xml = _loader.getXML();

            if (xml != null)
            {
                foreach (XML xl in xml.getChildrenByName("server"))
                {
                    serverList.add(xl.getProperty("name"));
                    serverList.add(xl.getProperty("value"));
                }
            }
            else
            {
                Ctrl.throwError("未找到服务器列表配置:", ShineGlobal.serverListPath);
            }

            _loader.unload();
            func();
        });

        _loader.loadStreamingAsset(ShineGlobal.serverListPath);
    }
示例#3
0
    /** 加载配置 */
    public void load(Action overCall)
    {
        _overCall = overCall;

        _loader = new ShineLoader();
        _loader.setCompleteCall(loadOver);
        _loader.loadResource(ShineGlobal.configPath);
    }
示例#4
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);
            }
        }
    }