关于橙光游戏的本地打包发布说明

2019-05-29  本文已影响0人  laputa19

对于2017版本而言,发布的游戏实际上包含2部分,一个是执行器,或者RTP,就是h5目录,大约100M,一部分是游戏本体, 就是工程目录.一般的小游戏可能几十M, 稍微像样点的就突破百兆了.
如果是熟悉的人内部交流,会多次发布的话,那么可以分开发布h5目录和游戏目录.这种情况下,可以每个游戏对应一个cmd,当然,这就要求不同人的H5目录和游戏目录都是一样的.
如果是发布给陌生人,h5目录就需要和游戏目录一起发布,而且因为无法保证别人的解压目录是相同的,所以改cmd方法就不方便了.这种情况下,我们可以通过修改main.js来支持相对目录.
例如:h5目录复制到c:\avg\h5, 游戏目录保存到c:\avg\h5\作品1
在h5目录下新建run.cmd,内容为

AVG_Web_Browser .

修改h5/resources/app/main.js
修改以下几行:

        var electronPath = require('path');
            var rootPath = electronPath.resolve(__dirname, '../../')
            path1=encodeURIComponent(rootPath+'/index.html?mark=pc');
            path2=encodeURIComponent(rootPath+'/我的作品1');
            path3=encodeURIComponent(rootPath+'/userData');
            let string = '{"OpenWindow":{"Width":"962","Height":"571","Pathname":"'+path1+'","Local":"True","Protocol":"file:","Slashes":"True","ProjectName":"我的作品1","itleBarStyle":"","SkipTaskbar":"False","Guid":"","Uid":"0","Gindex":"0","SessionID":"","MSource":"10","AlwaysOnTop":"False","OpenGame":{"ProjectWidth":960,"ProjectHeight":540,"MapID":1,"ProjectPath":"'+path2+'","FilePath":"'+path3+'"}}}';
            
            //let string = '{"OpenWindow":{"Width":"962","Height":"571","Pathname":"c%3A%2Fh5%2Findex.html%3Fmark%3Dpc","Local":"True","Protocol":"file:","Slashes":"True","ProjectName":"我的作品14","itleBarStyle":"","SkipTaskbar":"False","Guid":"","Uid":"0","Gindex":"0","SessionID":"","MSource":"10","AlwaysOnTop":"False","OpenGame":{"ProjectWidth":960,"ProjectHeight":540,"MapID":1,"ProjectPath":"c%3A%2Favg%2F%E6%88%91%E7%9A%84%E4%BD%9C%E5%93%811","FilePath":"c%3A%2Fh5%2FuserData"}}}';
        // let string = `{"OpenWindow":{"Width":"700","Height":"540","Pathname":"//tagcpt01-test-www.66rpg.com/tag/tool_tag?mark=pc","Local":"False","Protocol":"","Slashes":"True","ProjectName":"我的作品14","TitleBarStyle":"hidden","SkipTaskbar":"False","Guid":"5c32e309eac2a4b86c3a36bee0e4fecb","Uid":"39440522","Gindex":"0","SessionID":"d3add490785461401ab91760fa65b133","MSource":"10","AlwaysOnTop":"False","OpenGame":""}}`
 

每次发布前,记得修改path2和projectname
path1根据不同版本,可能需要修改

path1=encodeURIComponent(rootPath+'/bin/index.html?mark=pc');

这样压缩为avg.rar
拿到其他机器,解压到其他目录,比如d:/avg
运行run.cmd也是可以的.

上一篇下一篇

猜你喜欢

热点阅读