中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

十四 手游開發神器 cocos2d-x editor 之串聯游戲流程

發布時間:2020-06-23 20:47:57 來源:網絡 閱讀:6287 作者:makeapp628 欄目:游戲開發

一般游戲都包括幾個流程,加載界面,開始界面,選關界面,主界面,暫停界面等等;這節我將這些流程都串聯起來;


代碼下載:http://www.kuaipan.cn/file/id_25348935635745200.htm?source=1


loading界面;

十四 手游開發神器 cocos2d-x editor 之串聯游戲流程

LoadingLayer.ccbx


[html]view plaincopy十四 手游開發神器 cocos2d-x editor 之串聯游戲流程十四 手游開發神器 cocos2d-x editor 之串聯游戲流程
  1. <?xmlversion="1.0"encoding="UTF-8"?>

  2. <Document

  3. jsControlled="true"

  4. jsController=""

  5. resolution="default"

  6. >

  7. <Resolutions>

  8. <ResolutioncenteredOrigin="false"ext="iphone"height="1280"width="720"name="default"scale="1"/>

  9. <ResolutioncenteredOrigin="false"ext="iphone"height="720"width="1280"name="default1"scale="1"/>

  10. </Resolutions>

  11. <Animations>

  12. <AnimationautoPlay="true"

  13. id="0"

  14. name="Default Timeline"

  15. length="10"

  16. chainedId="0"

  17. offset="0.0"

  18. position="0.0"

  19. resolution="30"

  20. scale="128">

  21. <CallbackChannel>

  22. </CallbackChannel>

  23. <SoundChannel>

  24. </SoundChannel>

  25. </Animation>

  26. </Animations>

  27. <Layer

  28. positionX="0"positionY="0"

  29. width="100"height="100"sizeType="Percent"

  30. anchorPointX="0.5"anchorPointY="0.5"ignoreAnchorPoint="true"

  31. scaleX="1"scaleY="1"

  32. touchEnabled="true"positionType="LeftBottom"target="Owner">

  33. <LayerColorpositionType="LeftBottom"width="720"height="1280"positionX="0"positionY="0"anchorPointX="0"

  34. anchorPointY="0"color="#ffff40b8"target="Doc"/>

  35. <SpritepositionType="LeftBottom"width="245.0"height="72.0"positionX="381.0"positionY="661.0"anchorPointX="0.5"

  36. anchorPointY="0.5"src="Resources/snow_packer.plist/sa_loading_0001.png"

  37. target="Owner"/>

  38. </Layer>

  39. </Document>



開始界面;

十四 手游開發神器 cocos2d-x editor 之串聯游戲流程

StartLayer.ccbx


[html]view plaincopy十四 手游開發神器 cocos2d-x editor 之串聯游戲流程十四 手游開發神器 cocos2d-x editor 之串聯游戲流程
  1. <?xmlversion="1.0"encoding="UTF-8"?>

  2. <Document

  3. jsControlled="true"

  4. jsController="StartLayer"

  5. resolution="default"

  6. >

  7. <Resolutions>

  8. <ResolutioncenteredOrigin="false"ext="iphone"height="1280"width="720"name="default"scale="1"/>

  9. <ResolutioncenteredOrigin="false"ext="iphone"height="720"width="1280"name="default1"scale="1"/>

  10. </Resolutions>

  11. <Animations>

  12. <AnimationautoPlay="true"

  13. id="0"

  14. name="Default Timeline"

  15. length="10"

  16. chainedId="0"

  17. offset="0.0"

  18. position="0.0"

  19. resolution="30"

  20. scale="128">

  21. <CallbackChannel>

  22. </CallbackChannel>

  23. <SoundChannel>

  24. </SoundChannel>

  25. </Animation>

  26. </Animations>

  27. <Layer

  28. positionX="0"positionY="0"

  29. width="100"height="100"sizeType="Percent"

  30. anchorPointX="0.5"anchorPointY="0.5"ignoreAnchorPoint="true"

  31. scaleX="1"scaleY="1"

  32. touchEnabled="true"positionType="LeftBottom"visible="true">

  33. <LayerColorpositionType="LeftBottom"width="720"height="1280"positionX="0"positionY="0"anchorPointX="0"

  34. anchorPointY="0"color="#ff10ff9e"/>

  35. <MenupositionType="LeftBottom"width="40"height="40"positionX="354.0"positionY="712.0"anchorPointX="0.5"

  36. anchorPointY="0.5">

  37. <MenuItempositionType="LeftBottom"width="203"height="129"positionX="0"positionY="0"anchorPointX="0.5"

  38. anchorPointY="0.5"onClick="onPlayClicked"normalImage="Resources/snow_packer.plist/m_play.png"

  39. target="Doc"selectedImage="Resources/snow_packer.plist/m_play.png"/>

  40. </Menu>

  41. </Layer>

  42. </Document>


StartLayer.js



[javascript]view plaincopy十四 手游開發神器 cocos2d-x editor 之串聯游戲流程十四 手游開發神器 cocos2d-x editor 之串聯游戲流程
  1. //

  2. // CleanerScoreScene class

  3. //

  4. var StartLayer = function () {  

  5.    cc.log("StartLayer")  

  6. this.LoadingLayer = this.LoadingLayer || {};  

  7. this.passTime = 0;  

  8. this.goStart = false;  

  9. };  

  10. StartLayer.prototype.onDidLoadFromCCB = function () {  

  11. //    this.rootNode.onUpdate = function (dt)

  12. //    {

  13. //        this.controller.onUpdate();

  14. //    };

  15. //    this.rootNode.schedule(this.rootNode.onUpdate);

  16. if (sys.platform == 'browser') {  

  17. this.onEnter();  

  18.    }  

  19. else {  

  20. this.rootNode.onEnter = function () {  

  21. this.controller.onEnter();  

  22.        };  

  23.    }  

  24. this.rootNode.onExit = function () {  

  25. this.controller.onExit();  

  26.    };  

  27. this.rootNode.schedule(function (dt) {  

  28. this.controller.onUpdate(dt);  

  29.    });  

  30. };  

  31. StartLayer.prototype.onEnter = function () {  

  32. this.LoadingLayer = cc.BuilderReader.loadAsNodeFrom("", "LoadingLayer", this);  

  33. this.LoadingLayer.setPosition(cc.p(0, 0));  

  34. this.LoadingLayer.setZOrder(200);  

  35. this.rootNode.addChild(this.LoadingLayer);  

  36. //  cc.Director.getInstance().pause();

  37. /*this.LoadingLayer.scheduleOnce(this.removeLoading, 1);*/

  38. this.goStart = true;  

  39. this.startTime = this.passTime;  

  40. }  

  41. StartLayer.prototype.removeLoading = function () {  

  42. // if (this.LoadingLayer) {

  43.    cc.log("removeLoading");  

  44. // cc.Director.getInstance().resume();

  45. this.LoadingLayer.removeFromParent();  

  46. }  

  47. StartLayer.prototype.onUpdate = function (dt) {  

  48. this.passTime += dt;  

  49. if (this.passTime - this.startTime > 3 && this.goStart) {  

  50. this.removeLoading();  

  51. this.goStart = false;  

  52.    }  

  53. }  

  54. StartLayer.prototype.onPlayClicked = function () {  

  55.    cc.BuilderReader.runScene("", "GameSelectLayer");  

  56. }  

  57. StartLayer.prototype.onExit = function () {  

  58. }  

繼續請點擊:http://makeapp.blog.51cto.com/8596155/1361300

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

泰兴市| 格尔木市| 德化县| 浮山县| 木兰县| 通许县| 运城市| 区。| 孝感市| 乌兰浩特市| 化德县| 库尔勒市| 汤阴县| 息烽县| 界首市| 溧水县| 惠水县| 青浦区| 福鼎市| 中牟县| 济南市| 应城市| 大关县| 平江县| 德格县| 江安县| 中江县| 江陵县| 临澧县| 天水市| 灵丘县| 滦平县| 织金县| 隆昌县| 永康市| 永和县| 万源市| 鄢陵县| 昆明市| 黎城县| 郯城县|