亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

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

十四 手游開發神器 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

西峡县| 青龙| 陵水| 林甸县| 建昌县| 于田县| 镇康县| 萍乡市| 水富县| 绥化市| 旺苍县| 汾西县| 扶余县| 堆龙德庆县| 库伦旗| 伊春市| 兴安盟| 天长市| 北宁市| 衡水市| 台北市| 镇原县| 德庆县| 信丰县| 信宜市| 方正县| 吉木萨尔县| 九龙县| 开平市| 阿拉善左旗| 娱乐| 福州市| 策勒县| 安化县| 农安县| 平塘县| 桃园县| 康保县| 金山区| 兴国县| 金沙县|