Commit 1645edfb authored by wildfirecode's avatar wildfirecode

增加可跑的物理游戏

parent 280e6cf9
......@@ -14,4 +14,5 @@ if (cmd === 'build' && process.argv[3] === 'prod') {
if (process.argv[4] === 'exml')
cmd = 'buildProdEXML';
}
build[cmd](...remain);
\ No newline at end of file
build[cmd]();
// build[cmd](...remain);
\ No newline at end of file
{
"engineVersion": "5.2.7",
"compilerVersion": "5.2.7",
"template": {},
"target": {
"current": "web"
},
"eui": {
"exmlRoot": [
"resource/eui_skins"
],
"themes": [
"resource/default.thm.json"
],
"exmlPublishPolicy": "commonjs"
},
"modules": [
{
"name": "egret"
},
{
"name": "eui"
},
{
"name": "assetsmanager"
},
{
"name": "tween"
},
{
"name": "game"
},
{
"name": "promise"
}
]
}
\ No newline at end of file
......@@ -38,6 +38,7 @@
<script src="libs/modules/promise/promise.js"></script>
<script src="libs/zepto.min.js"></script>
<script src="libs/security.js"></script>
<script src="libs/physics/physics.min.js"></script>
<!-- <script src="default.thm.js"></script> -->
<script src="output.js"></script>
<script>
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"alert_3","version":5,"files":["../assets/alert/Bitmap-4.png","../assets/alert/Bitmap-2.png","../assets/alert/Bitmap-1.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"loading_2","version":5,"files":["../assets/loading/bg.png","../assets/loading/progress.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"msg_0","version":5,"files":["../assets/msg/msgBg.png","../assets/msg/x.png","../assets/msg/sureBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"playScene_1","version":5,"files":["../assets/playScene/wheelBg2.png","../assets/playScene/wating.png","../assets/playScene/startBtnBg.png","../assets/playScene/sideLightL.png","../assets/playScene/sideLightD.png","../assets/playScene/ruleBtn.png","../assets/playScene/redPacket.png","../assets/playScene/outShell.png","../assets/playScene/myCreditsBg.png","../assets/playScene/multiple3.png","../assets/playScene/multiple.png","../assets/playScene/heartB.png","../assets/playScene/go.png","../assets/playScene/gift.png","../assets/playScene/finger.png","../assets/playScene/earnPanel.png","../assets/playScene/coinIcon.png","../assets/playScene/coinf8.png","../assets/playScene/coinf7.png","../assets/playScene/coinf6.png","../assets/playScene/coinf5.png","../assets/playScene/coinf4.png","../assets/playScene/coinf3.png","../assets/playScene/coinf2.png","../assets/playScene/coinf1.png","../assets/playScene/circleLight2.png","../assets/playScene/circleLight1.png","../assets/playScene/+.png","../assets/playScene/-_.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"rule_4","version":5,"files":["../assets/rule/ruleBg.png","../assets/rule/X.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_0","version":5,"files":["../assets/circle.png","../assets/rect.png"]}
\ No newline at end of file
{"mc":{
"coin":{
"frameRate":24,
"labels":[
{"name":"rotate","frame":1,"end":8}
],
"events":[
],
"frames":[
{
"res":"DB0A020",
"x":0,
"y":0
},
{
"res":"11118EED",
"x":0,
"y":0
},
{
"res":"3ED3A22C",
"x":8,
"y":0
},
{
"res":"EA81E94D",
"x":20,
"y":0
},
{
"res":"9D677726",
"x":37,
"y":0
},
{
"res":"7A80B82A",
"x":20,
"y":0
},
{
"res":"AA7CF946",
"x":8,
"y":0
},
{
"res":"2E51F51A",
"x":0,
"y":0
}
]
}},
"res":{
"AA7CF946":{"x":176,"y":97,"w":78,"h":94},
"11118EED":{"x":1,"y":1,"w":93,"h":94},
"EA81E94D":{"x":191,"y":1,"w":53,"h":94},
"2E51F51A":{"x":96,"y":1,"w":93,"h":94},
"7A80B82A":{"x":1,"y":193,"w":53,"h":94},
"3ED3A22C":{"x":96,"y":97,"w":78,"h":94},
"9D677726":{"x":56,"y":193,"w":20,"h":94},
"DB0A020":{"x":1,"y":97,"w":93,"h":94}
}}
\ No newline at end of file
{"mc":{
"go":{
"frameRate":20,
"labels":[
{"name":"light","frame":1,"end":30}
],
"events":[
],
"frames":[
{
"res":"A9D1D9F7",
"x":8,
"y":5
},
{
"res":"A9D1D9F7",
"x":8,
"y":5
},
{
"res":"165B8393",
"x":8,
"y":5
},
{
"res":"165B8393",
"x":8,
"y":5
},
{
"res":"C533ADB8",
"x":8,
"y":5
},
{
"res":"C533ADB8",
"x":8,
"y":5
},
{
"res":"7C56153B",
"x":6,
"y":5
},
{
"res":"C3226410",
"x":6,
"y":5
},
{
"res":"C3226410",
"x":6,
"y":5
},
{
"res":"8A450EA9",
"x":8,
"y":5
},
{
"res":"764FAFD2",
"x":8,
"y":5
},
{
"res":"A86D3DEA",
"x":8,
"y":5
},
{
"res":"F8A55074",
"x":8,
"y":4
},
{
"res":"6DDF7B77",
"x":8,
"y":4
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"AF8A3362",
"x":8,
"y":5
},
{
"res":"10E93F01",
"x":8,
"y":5
}
]
}},
"res":{
"10E93F01":{"x":709,"y":1,"w":174,"h":176},
"C3226410":{"x":1,"y":1,"w":176,"h":176},
"764FAFD2":{"x":1,"y":179,"w":174,"h":176},
"C533ADB8":{"x":1,"y":357,"w":174,"h":176},
"6DDF7B77":{"x":533,"y":1,"w":174,"h":177},
"F8A55074":{"x":357,"y":1,"w":174,"h":177},
"A86D3DEA":{"x":177,"y":179,"w":174,"h":176},
"165B8393":{"x":709,"y":179,"w":174,"h":176},
"A9D1D9F7":{"x":353,"y":180,"w":174,"h":176},
"AF8A3362":{"x":529,"y":180,"w":174,"h":176},
"7C56153B":{"x":179,"y":1,"w":176,"h":176},
"8A450EA9":{"x":177,"y":357,"w":174,"h":176}
}}
\ No newline at end of file
{
"groups": [
{
"keys": "msgBg_png,x_png,sureBtn_png",
"name": "msg"
},
{
"keys": "wheelBg2_png,wating_png,startBtnBg_png,sideLightL_png,sideLightD_png,ruleBtn_png,redPacket_png,outShell_png,myCreditsBg_png,multiple3_png,multiple_png,heartB_png,goBtn_png,goBtn_json,go_png,gift_png,finger_png,earnPanel_png,coinIcon_png,coinf8_png,coinf7_png,coinf6_png,coinf5_png,coinf4_png,coinf3_png,coinf2_png,coinf1_png,coin_png,coin_json,circleLight2_png,circleLight1_png,+_png,-__png,playSceneBg_jpg",
"name": "playScene"
},
{
"keys": "bg_png,progress_png",
"name": "loading"
},
{
"keys": "Bitmap-4_png,Bitmap-2_png,Bitmap-1_png",
"name": "alert"
},
{
"keys": "ruleBg_png,X_png",
"name": "rule"
},
{
"keys": "playSceneBg_jpg",
"keys": "bg_jpg,circle_png,jj_jpg,rect_png",
"name": "preload"
}
],
"resources": [
{
"url": "assets/alert/Bitmap-1.png",
"type": "image",
"name": "Bitmap-1_png"
},
{
"url": "assets/alert/Bitmap-2.png",
"type": "image",
"name": "Bitmap-2_png"
},
{
"url": "assets/alert/Bitmap-4.png",
"type": "image",
"name": "Bitmap-4_png"
},
{
"url": "assets/msg/msgBg.png",
"type": "image",
"name": "msgBg_png"
},
{
"url": "assets/msg/sureBtn.png",
"type": "image",
"name": "sureBtn_png"
},
{
"url": "assets/msg/x.png",
"type": "image",
"name": "x_png"
},
{
"url": "assets/playScene/+.png",
"type": "image",
"name": "+_png"
},
{
"url": "assets/playScene/-_.png",
"type": "image",
"name": "-__png"
},
{
"url": "assets/playScene/circleLight1.png",
"type": "image",
"name": "circleLight1_png"
},
{
"url": "assets/playScene/circleLight2.png",
"type": "image",
"name": "circleLight2_png"
},
{
"url": "assets/playScene/coin.png",
"type": "image",
"name": "coin_png"
},
{
"url": "assets/playScene/coinIcon.png",
"type": "image",
"name": "coinIcon_png"
},
{
"url": "assets/playScene/coinf1.png",
"type": "image",
"name": "coinf1_png"
},
{
"url": "assets/playScene/coinf2.png",
"type": "image",
"name": "coinf2_png"
},
{
"url": "assets/playScene/coinf3.png",
"type": "image",
"name": "coinf3_png"
},
{
"url": "assets/playScene/coinf4.png",
"type": "image",
"name": "coinf4_png"
},
{
"url": "assets/playScene/coinf5.png",
"type": "image",
"name": "coinf5_png"
},
{
"url": "assets/playScene/coinf6.png",
"type": "image",
"name": "coinf6_png"
},
{
"url": "assets/playScene/coinf7.png",
"url": "assets/bg.jpg",
"type": "image",
"name": "coinf7_png"
"name": "bg_jpg"
},
{
"url": "assets/playScene/coinf8.png",
"name": "circle_png",
"type": "image",
"name": "coinf8_png"
"url": "assets/circle.png"
},
{
"url": "assets/playScene/earnPanel.png",
"name": "jj_jpg",
"type": "image",
"name": "earnPanel_png"
},
{
"url": "assets/playScene/finger.png",
"type": "image",
"name": "finger_png"
},
{
"url": "assets/playScene/gift.png",
"type": "image",
"name": "gift_png"
},
{
"url": "assets/playScene/go.png",
"type": "image",
"name": "go_png"
},
{
"url": "assets/playScene/goBtn.png",
"type": "image",
"name": "goBtn_png"
},
{
"url": "assets/playScene/heartB.png",
"type": "image",
"name": "heartB_png"
},
{
"url": "assets/playScene/multiple.png",
"type": "image",
"name": "multiple_png"
},
{
"url": "assets/playScene/multiple3.png",
"type": "image",
"name": "multiple3_png"
},
{
"url": "assets/playScene/myCreditsBg.png",
"type": "image",
"name": "myCreditsBg_png"
},
{
"url": "assets/playScene/outShell.png",
"type": "image",
"name": "outShell_png"
},
{
"url": "assets/playScene/redPacket.png",
"type": "image",
"name": "redPacket_png"
},
{
"url": "assets/playScene/ruleBtn.png",
"type": "image",
"name": "ruleBtn_png"
},
{
"url": "assets/playScene/sideLightD.png",
"type": "image",
"name": "sideLightD_png"
},
{
"url": "assets/playScene/sideLightL.png",
"type": "image",
"name": "sideLightL_png"
},
{
"url": "assets/playScene/startBtnBg.png",
"type": "image",
"name": "startBtnBg_png"
},
{
"url": "assets/playScene/wating.png",
"type": "image",
"name": "wating_png"
},
{
"url": "assets/playScene/wheelBg2.png",
"type": "image",
"name": "wheelBg2_png"
},
{
"url": "assets/loading/bg.png",
"type": "image",
"name": "bg_png"
},
{
"url": "assets/loading/progress.png",
"type": "image",
"name": "progress_png"
},
{
"url": "assets/rule/X.png",
"type": "image",
"name": "X_png"
},
{
"url": "assets/rule/ruleBg.png",
"type": "image",
"name": "ruleBg_png"
},
{
"url": "assets/playScene/coin.json",
"type": "json",
"name": "coin_json"
},
{
"url": "assets/playScene/goBtn.json",
"type": "json",
"name": "goBtn_json"
"url": "assets/jj.jpg"
},
{
"url": "assets/playScene/playSceneBg.jpg",
"name": "rect_png",
"type": "image",
"name": "playSceneBg_jpg"
"url": "assets/rect.png"
}
]
}
\ No newline at end of file
{
"skins": {},
"skins": {
"eui.Button": "resource/eui_skins/ButtonSkin.exml",
"eui.CheckBox": "resource/eui_skins/CheckBoxSkin.exml",
"eui.HScrollBar": "resource/eui_skins/HScrollBarSkin.exml",
"eui.HSlider": "resource/eui_skins/HSliderSkin.exml",
"eui.Panel": "resource/eui_skins/PanelSkin.exml",
"eui.TextInput": "resource/eui_skins/TextInputSkin.exml",
"eui.ProgressBar": "resource/eui_skins/ProgressBarSkin.exml",
"eui.RadioButton": "resource/eui_skins/RadioButtonSkin.exml",
"eui.Scroller": "resource/eui_skins/ScrollerSkin.exml",
"eui.ToggleSwitch": "resource/eui_skins/ToggleSwitchSkin.exml",
"eui.VScrollBar": "resource/eui_skins/VScrollBarSkin.exml",
"eui.VSlider": "resource/eui_skins/VSliderSkin.exml",
"eui.ItemRenderer": "resource/eui_skins/ItemRendererSkin.exml"
},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/AlertSkin.exml",
"resource/skins/LoadingSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/PlaySkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/component/ResultPanel.exml",
"resource/skins/component/WheelBg.exml",
"resource/skins/component/WheelGift.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml",
"resource/skins/ui/StartButtonSkin.exml"
"resource/eui_skins/ButtonSkin.exml",
"resource/eui_skins/CheckBoxSkin.exml",
"resource/eui_skins/HScrollBarSkin.exml",
"resource/eui_skins/HSliderSkin.exml",
"resource/eui_skins/ItemRendererSkin.exml",
"resource/eui_skins/PanelSkin.exml",
"resource/eui_skins/ProgressBarSkin.exml",
"resource/eui_skins/RadioButtonSkin.exml",
"resource/eui_skins/ScrollerSkin.exml",
"resource/eui_skins/TextInputSkin.exml",
"resource/eui_skins/ToggleSwitchSkin.exml",
"resource/eui_skins/VScrollBarSkin.exml",
"resource/eui_skins/VSliderSkin.exml"
],
"path": "resource/default.thm.json"
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<e:Skin class="skins.ButtonSkin" states="up,down,disabled" minHeight="50" minWidth="100" xmlns:e="http://ns.egret.com/eui">
<e:Image width="100%" height="100%" scale9Grid="1,3,8,8" alpha.disabled="0.5"
source="button_up_png"
source.down="button_down_png"/>
<e:Label id="labelDisplay" top="8" bottom="8" left="8" right="8"
size="20"
textColor="0xFFFFFF" verticalAlign="middle" textAlign="center"/>
<e:Image id="iconDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.CheckBoxSkin" states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected" xmlns:e="http://ns.egret.com/eui">
<e:Group width="100%" height="100%">
<e:layout>
<e:HorizontalLayout verticalAlign="middle"/>
</e:layout>
<e:Image fillMode="scale" alpha="1" alpha.disabled="0.5" alpha.down="0.7"
source="checkbox_unselect_png"
source.upAndSelected="checkbox_select_up_png"
source.downAndSelected="checkbox_select_down_png"
source.disabledAndSelected="checkbox_select_disabled_png"/>
<e:Label id="labelDisplay" size="20" textColor="0x707070"
textAlign="center" verticalAlign="middle"
fontFamily="Tahoma"/>
</e:Group>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.HScrollBarSkin" minWidth="20" minHeight="8" xmlns:e="http://ns.egret.com/eui">
<e:Image id="thumb" source="roundthumb_png" scale9Grid="3,3,2,2" height="8" width="30" verticalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.HSliderSkin" minWidth="20" minHeight="8" xmlns:e="http://ns.egret.com/eui">
<e:Image id="track" source="track_sb_png" scale9Grid="1,1,4,4" width="100%"
height="6" verticalCenter="0"/>
<e:Image id="thumb" source="thumb_png" verticalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8" ?>
<e:Skin class="skins.ItemRendererSkin" states="up,down,disabled" minHeight="50" minWidth="100" xmlns:e="http://ns.egret.com/eui">
<e:Image width="100%" height="100%" scale9Grid="1,3,8,8" alpha.disabled="0.5"
source="button_up_png"
source.down="button_down_png"/>
<e:Label id="labelDisplay" top="8" bottom="8" left="8" right="8"
size="20" fontFamily="Tahoma"
textColor="0xFFFFFF" text="{data}" verticalAlign="middle" textAlign="center"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.PanelSkin" minHeight="230" minWidth="450" xmlns:e="http://ns.egret.com/eui">
<e:Image left="0" right="0" bottom="0" top="0" source="border_png" scale9Grid="2,2,12,12" />
<e:Group id="moveArea" left="0" right="0" top="0" height="45">
<e:Image left="0" right="0" bottom="0" top="0" source="header_png"/>
<e:Label id="titleDisplay" size="20" fontFamily="Tahoma" textColor="0xFFFFFF"
wordWrap="false" left="15" right="5" verticalCenter="0"/>
</e:Group>
<e:Button id="closeButton" label="close" bottom="5" horizontalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.ProgressBarSkin" minWidth="30" minHeight="18" xmlns:e="http://ns.egret.com/eui">
<e:Image source="track_pb_png" scale9Grid="1,1,4,4" width="100%"
height="100%" verticalCenter="0"/>
<e:Image id="thumb" height="100%" width="100%" source="thumb_pb_png"/>
<e:Label id="labelDisplay" textAlign="center" verticalAlign="middle"
size="15" fontFamily="Tahoma" textColor="0x707070"
horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.RadioButtonSkin" states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected" xmlns:e="http://ns.egret.com/eui">
<e:Group width="100%" height="100%">
<e:layout>
<e:HorizontalLayout verticalAlign="middle"/>
</e:layout>
<e:Image fillMode="scale" alpha="1" alpha.disabled="0.5" alpha.down="0.7"
source="radiobutton_unselect_png"
source.upAndSelected="radiobutton_select_up_png"
source.downAndSelected="radiobutton_select_down_png"
source.disabledAndSelected="radiobutton_select_disabled_png"/>
<e:Label id="labelDisplay" size="20" textColor="0x707070"
textAlign="center" verticalAlign="middle"
fontFamily="Tahoma"/>
</e:Group>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.ScrollerSkin" minWidth="20" minHeight="20" xmlns:e="http://ns.egret.com/eui">
<e:HScrollBar id="horizontalScrollBar" width="100%" bottom="0"/>
<e:VScrollBar id="verticalScrollBar" height="100%" right="0"/>
</e:Skin>
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<e:Skin class="skins.TextInputSkin" minHeight="40" minWidth="300" states="normal,disabled,normalWithPrompt,disabledWithPrompt" xmlns:e="http://ns.egret.com/eui">
<e:Image width="100%" height="100%" scale9Grid="1,3,8,8" source="button_up_png"/>
<e:Rect height="100%" width="100%" fillColor="0xffffff"/>
<e:EditableText id="textDisplay" verticalCenter="0" left="10" right="10"
textColor="0x000000" textColor.disabled="0xff0000" width="100%" height="24" size="20" />
<e:Label id="promptDisplay" verticalCenter="0" left="10" right="10"
textColor="0xa9a9a9" width="100%" height="24" size="20" touchEnabled="false" includeIn="normalWithPrompt,disabledWithPrompt"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.ToggleSwitchSkin" states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected" xmlns:e="http://ns.egret.com/eui">
<e:Image source="on_png"
source.up="off_png"
source.down="off_png"
source.disabled="off_png"/>
<e:Image source="handle_png"
horizontalCenter="-18"
horizontalCenter.upAndSelected="18"
horizontalCenter.downAndSelected="18"
horizontalCenter.disabledAndSelected="18"
verticalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.VScrollBarSkin" minWidth="8" minHeight="20" xmlns:e="http://ns.egret.com/eui">
<e:Image id="thumb" source="roundthumb_png" scale9Grid="3,3,2,2" height="30" width="8" horizontalCenter="0"/>
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="skins.VSliderSkin" minWidth="25" minHeight="30" xmlns:e="http://ns.egret.com/eui">
<e:Image id="track" source="track_png" scale9Grid="1,1,4,4" width="7" height="100%" horizontalCenter="0"/>
<e:Image id="thumb" source="thumb_png" horizontalCenter="0" />
</e:Skin>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="AlertSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="Bitmap-1_png" y="175" horizontalCenter="0"/>
<e:Button id="confirmBtn" label="{data.btnTxt}" y="361" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="Bitmap-2_png" source.down="Bitmap-2_png" source.disabled="Bitmap-2_png" horizontalCenter.down="0" verticalCenter.down="0"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="closeBtn" label="" x="586.18" y="143">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="Bitmap-4_png" source.down="Bitmap-4_png" source.disabled="Bitmap-4_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label text="{data.message}" y="239" textColor="0x000000" horizontalCenter="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="loadingSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:tween="egret.tween.*">
<w:Declarations>
</w:Declarations>
<e:Image y="288" source="bg_png" horizontalCenter="0"/>
<e:Image id="waitImg" source="progress_png" y="380" anchorOffsetX="28" anchorOffsetY="28" horizontalCenter="0" rotation="{data.speed}"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="MsgSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Rect id="dark" width="750" height="1624" x="0" y="0" fillAlpha="0.5"/>
<e:Image id="bg" y="160" x="105.5" source="msgBg_png"/>
<e:Button id="confirmBtn" label="{data.btnTxt}" y="610" x="209.5">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="sureBtn_png" source.down="sureBtn_png" source.disabled="sureBtn_png"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="closeBtn" label="" x="562.83" y="398.51">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="x_png" source.down="x_png" source.disabled="x_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="msgTxt" text="{data.message}" y="469.51" textColor="0xeeeeee" anchorOffsetX="0" width="380.66" anchorOffsetY="0" height="113.34" size="34" textAlign="center" horizontalCenter="0"/>
<e:Button id="creditsOutBtn" label="" x="209.33" y="610">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="sureBtn_png" source.down="sureBtn_png" source.disabled="sureBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="PlaySkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" >
<e:Image id="gamebg" x="0" y="0" source="playSceneBg_jpg"/>
<e:Button id="ruleBtn" label="" skinName="ui.IconButtonSkin" icon="ruleBtn_png" name="ruleBtn" horizontalCenter="-340" verticalCenter="-522.5"/>
<e:Button id="addBtn" label="" icon="+_png" name="addBtn" skinName="ui.IconButtonSkin" horizontalCenter="129.5" verticalCenter="388"/>
<e:Button id="reduceBtn" label="" icon="-__png" name="reduceBtn" skinName="ui.IconButtonSkin" anchorOffsetX="0" anchorOffsetY="0" horizontalCenter="-61.5" verticalCenter="388"/>
<e:Component id="WheelBg" skinName="WheelBg" width="603" height="603" horizontalCenter="0" verticalCenter="-23.5"/>
<e:Image id="outShell" source="outShell_png" verticalCenter="-20.5" horizontalCenter="3.5"/>
<e:Button id="startBtn" label="" icon="startBtnBg_png" horizontalCenter="0.5" verticalCenter="-40" skinName="ui.StartButtonSkin"/>
<e:Label id="unitTxt" text="投入积分" x="201.61" y="960" anchorOffsetX="0" width="63.39" anchorOffsetY="0" height="63.97" textAlign="center" textColor="0xffc303" fontFamily="微软雅黑"/>
<e:Label id="costTxt" text="40" size="40" anchorOffsetX="0" width="132" x="343" y="974.24" textAlign="center"/>
<e:Image id="myCreditsBg" source="myCreditsBg_png" y="884" horizontalCenter="0"/>
<e:Image x="233.31" y="893" anchorOffsetX="0" width="36" anchorOffsetY="0" height="36" source="coinIcon_png"/>
<e:Label id="userCreditsUnitName" text="总积分积分" x="276.8" y="898.34" anchorOffsetX="0" width="156.03" size="22" textColor="0xf7de4c" fontFamily="微软雅黑" height="25.33" anchorOffsetY="0"/>
<e:Label id="userCreditsNum" text="2000" x="384.33" y="895" anchorOffsetX="0" width="129.87" size="30" textAlign="center" textColor="0xf7de4c" height="24"/>
<e:Image id="circleLight1" source="circleLight1_png" y="265" height="630" width="630" horizontalCenter="0"/>
<e:Image id="circleLight2" source="circleLight2_png" width="630" height="630" horizontalCenter="0" verticalCenter="-23"/>
<e:Image id="sideLightD" source="sideLightD_png" x="46" y="396"/>
<e:Image id="sideLightL" source="sideLightL_png" x="-10" y="361.67"/>
<e:Image id="finger" source="finger_png" horizontalCenter="87.5" verticalCenter="44"/>
<e:Panel id="resulePanel" width="374" height="159" skinName="component.ResultPanel" anchorOffsetX="187" anchorOffsetY="79.5" scaleX="0" scaleY="0" horizontalCenter="-1" verticalCenter="-23.5"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="RuleSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Rect id="dark" width="750" height="1624" x="0" y="0" fillAlpha="0.5"/>
<e:Image id="ruleBg" source="ruleBg_png" horizontalCenter="0.5" verticalCenter="-231"/>
<e:Button id="closeBtn" label="" horizontalCenter="296.5" verticalCenter="-561">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="X_png" source.down="X_png" source.disabled="X_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="component.ResultPanel" width="378" height="164" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="bg" source="earnPanel_png" x="0" y="0"/>
<e:Label id="credits" text="0" x="41.5" y="65" size="64" anchorOffsetX="0" width="292" textAlign="center"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="WheelBg" width="603" height="603" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="wheelBg" source="wheelBg2_png" anchorOffsetX="301.5" anchorOffsetY="301.5" left="0" top="0"/>
<e:Image source="gift_png" x="176.5" y="76.5" rotation="-22.5"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="WheelGift" width="92" height="300" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="gift" source="gift_png" y="61" horizontalCenter="0"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ui.IconButtonSkin" xmlns:e="http://ns.egret.com/eui" xmlns:ns1="*" states="up,down,disabled" >
<e:Image id="iconDisplay" source="" horizontalCenter="0" verticalCenter="0" scaleX.down="0.95" scaleY.down="0.95"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ui.ProgressBarSkin" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="thumb" source="loading_progress_thumb" x="3" y="3"/>
<e:Image id="track" source="loading_progress_track" scale9Grid="16,13,2,2" width="404"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ui.StartButtonSkin" xmlns:e="http://ns.egret.com/eui" xmlns:ns1="*" states="up,down,disabled,wating" >
<e:Image id="iconDisplay" source="" horizontalCenter="0" verticalCenter="0" scaleX.down="0.95" scaleY.down="0.95"/>
<e:Image source="startBtnBg_png" includeIn="wating" x="0" y="0"/>
<e:Image source="wating_png" includeIn="wating" horizontalCenter="0" verticalCenter="23.5"/>
<e:Image source="startBtnBg_png" includeIn="disabled" x="0" y="0"/>
<e:Image source="go_png" includeIn="disabled" x="62" y="143"/>
<e:Image source="startBtnBg_png" includeIn="down" x="0" y="0" scaleX="0.95" scaleY="0.95"/>
<e:Image source="go_png" includeIn="down" horizontalCenter="0.5" verticalCenter="25.5" scaleX="0.95" scaleY="0.95"/>
<e:Image source="startBtnBg_png" includeIn="up" horizontalCenter="0" verticalCenter="0"/>
<e:Image source="go_png" includeIn="up" horizontalCenter="0.5" verticalCenter="25.5"/>
</e:Skin>
\ No newline at end of file
export default class LoadingUI extends egret.Sprite implements RES.PromiseTaskReporter {
public constructor() {
super();
this.createView();
}
private textField: egret.TextField;
private createView(): void {
this.textField = new egret.TextField();
this.addChild(this.textField);
this.textField.y = 300;
this.textField.width = 480;
this.textField.height = 100;
this.textField.textAlign = "center";
}
public onProgress(current: number, total: number): void {
this.textField.text = `Loading...${current}/${total}`;
}
}
import { DataManager, NetManager } from "duiba-tw";
import Msg from "./alert/Msg";
import AssetAdapter from "./AssetAdapter";
import PanelCtrl from "./ctrls/panelCtrl";
import SceneCtrl from "./ctrls/sceneCtrl";
import Loading from "./loading/Loading";
import PlayScene from "./playScene/PlayScene";
import RulePanel from "./rulePanel/RulePanel";
import ThemeAdapter from "./ThemeAdapter";
import { ModuleTypes } from "./types/sceneTypes";
import { getResPath } from "./utils";
import layers from "./views/layers";
class Main extends eui.UILayer {
/**
* 创建场景界面
* Create scene interface
*/
protected createGameScene(): void {
let img: egret.Bitmap = new egret.Bitmap();
img = this.createBitmapByName("bg_jpg");
img.width = this.stage.stageWidth;
img.height = this.stage.stageHeight;
this.addChild(img);
this.CreateWorld();
this.CreatePlane();
this.addEventListener(egret.Event.ENTER_FRAME, this.update, this);
this.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onButtonClick, this);
}
//使用P2物理引擎创建物理应用的过程大致分为5个步骤:
// 1创建world世界
// 2创建shape形状
// 3创建body刚体
// 4实时调用step()函数,更新物理模拟计算
// 5基于形状、刚体,使用Egret渲染,显示物理模拟效果
//创建Word世界
private world: p2.World;
private CreateWorld() {
this.world = new p2.World();
//设置world为睡眠状态
this.world.sleepMode = p2.World.BODY_SLEEPING;
// gravity=[x,y] x为水平方向重力,正数表示方向向右。y为垂直方向重力,正数表示方向向下。
this.world.gravity = [0, 10];
// this.world.gravity = [0, 10];
}
//生成地板Plane
private planeBody: p2.Body;
private CreatePlane() {
let planeShape: p2.Plane = new p2.Plane();
this.planeBody = new p2.Body({
type: p2.Body.STATIC, //刚体类型
position: [0, this.stage.stageHeight], //刚体的位置
});
this.planeBody.angle = Math.PI;//Plane相当于地面,默认面向Y轴方向。将地面翻转180度
this.planeBody.displays = [];
this.planeBody.addShape(planeShape);
this.world.addBody(this.planeBody);
}
private shpeBody: p2.Body;
//贴图显示对象
private display: egret.DisplayObject;
private onButtonClick(e: egret.TouchEvent) {
if (Math.random() > 0.5) {
//添加方形刚体
var boxShape = new p2.Box({ width: 140, height: 80 });
this.shpeBody = new p2.Body({
mass: 1,
position: [e.stageX, e.stageY],
angularVelocity: 1//下落时旋转的速度
});
this.shpeBody.addShape(boxShape);
this.world.addBody(this.shpeBody);
this.display = this.createBitmapByName("rect_png");
this.display.width = boxShape.width;
this.display.height = boxShape.height;
console.log(e.stageX, e.stageY);
}
else {
//添加圆形刚体
var circleShape = new p2.Circle({ radius: 60 });
this.shpeBody = new p2.Body({ mass: 1, position: [e.stageX, e.stageY] });
this.shpeBody.addShape(circleShape);
this.world.addBody(this.shpeBody);
this.display = this.createBitmapByName("circle_png");
this.display.width = circleShape.radius * 2
this.display.height = circleShape.radius * 2
}
//Egret中加载进来的图像,其原点默认为左上角,而P2中刚体的原点处于其中心位置,如下图(盗了一张图)
this.display.anchorOffsetX = this.display.width / 2
this.display.anchorOffsetY = this.display.height / 2;
this.display.x = -100;
this.display.y = -100;
this.display.rotation = 270
this.shpeBody.displays = [this.display];
this.addChild(this.display);
}
//帧事件,步函数
private update() {
this.world.step(1);
var l = this.world.bodies.length;
for (var i: number = 0; i < l; i++) {
var boxBody: p2.Body = this.world.bodies[i];
var box: egret.DisplayObject = boxBody.displays[0];
if (box) {
box.x = boxBody.position[0];
box.y = boxBody.position[1];
//这里刷新图片旋转
box.rotation = boxBody.angle * 180 / Math.PI;
if (boxBody.sleepState == p2.Body.SLEEPING) {
box.alpha = 0.5;
}
else {
box.alpha = 1;
}
}
}
}
/**
* 根据name关键字创建一个Bitmap对象。name属性请参考resources/resource.json配置文件的内容。
*/
private createBitmapByName(name: string): egret.Bitmap {
var result: egret.Bitmap = new egret.Bitmap();
var texture: egret.Texture = RES.getRes(name);
result.texture = texture;
return result;
}
protected createChildren(): void {
super.createChildren();
// alert(1)
egret.lifecycle.addLifecycleListener((context) => {
// custom lifecycle plugin
......@@ -34,23 +146,7 @@ class Main extends eui.UILayer {
egret.registerImplementation("eui.IAssetAdapter", assetAdapter);
egret.registerImplementation("eui.IThemeAdapter", new ThemeAdapter());
egret.ImageLoader.crossOrigin = "anonymous";
DataManager.ins.gameCfgData = window['CFG'];
DataManager.ins.gameCfgData.gameInfo.gameId = window["gameId"];
NetManager.ins.getCredits(()=>{});
layers.init(this);
Loading.init(layers.topLayer);
PanelCtrl.instance.init(layers.popupLayer);
SceneCtrl.instance.init(layers.sceneLayer);
this.stage.scaleMode = egret.StageScaleMode.FIXED_WIDTH;
PanelCtrl.instance.registerPanelClass(ModuleTypes.MSG_PANEL, Msg);
PanelCtrl.instance.registerPanelClass(ModuleTypes.RULE_PANEL, RulePanel);
SceneCtrl.instance.registerSceneClass(ModuleTypes.PALY_SCENE, PlayScene);
this.runGame().catch(e => {
console.log(e);
})
......@@ -59,7 +155,11 @@ class Main extends eui.UILayer {
private async runGame() {
await this.loadResource()
this.createGameScene();
RES.loadGroup("msg", 10);
const result = await RES.getResAsync("description_json")
await platform.login();
const userInfo = await platform.getUserInfo();
console.log(userInfo);
}
private async loadResource() {
......@@ -68,8 +168,7 @@ class Main extends eui.UILayer {
// this.stage.addChild(loadingView);
await RES.loadConfig("default.res.json", getResPath() + "resource/");
await this.loadTheme();
// await RES.loadGroup("msg", 10);
// this.stage.removeChild(loadingView);
await RES.loadGroup("preload", 0);
}
catch (e) {
console.error(e);
......@@ -87,32 +186,6 @@ class Main extends eui.UILayer {
})
}
private textfield: egret.TextField;
/**
* 创建场景界面
* Create scene interface
*/
protected createGameScene(): void {
NetManager.ins.getInfo(() => {
// 等待开奖 ↓
if (DataManager.ins.getInfoData.status.code == 4) {
// 已开奖 ↓
} else if (DataManager.ins.getInfoData.status.code == 5) {
// 正常游戏 ↓
} else {
SceneCtrl.instance.change(ModuleTypes.PALY_SCENE)
}
});
// setTimeout(() => {
// // panelCtrl.showAlertPanel('te111st');
// // Loading.instace.show()
// }, 3000);
}
}
window['Main'] = Main;
\ No newline at end of file
......@@ -12,7 +12,7 @@ declare interface Platform {
}
export class DebugPlatform implements Platform {
class DebugPlatform implements Platform {
async getUserInfo() {
return { nickName: "username" }
}
......@@ -22,9 +22,15 @@ export class DebugPlatform implements Platform {
}
export declare let platform: Platform;
if (!window.platform) {
window.platform = new DebugPlatform();
}
declare let platform: Platform;
export declare interface Window {
declare interface Window {
platform: Platform
}
......
import Panel from "../views/Panel";
export default class Alert extends Panel {
set message(val) {
}
set btnTxt(val) {
}
start(data) {
const { message, btnTxt } = data;
this.data.message = message;
this.data.btnTxt = btnTxt || '确定';
}
protected get skinKey() { return 'Alert' }
protected get closeBtns(): eui.Button[] {
return [this['closeBtn'], this['confirmBtn']]
}
}
\ No newline at end of file
import Panel from "../views/Panel";
export default class Msg extends Panel {
constructor(){
super()
}
set message(val) {
}
set btnTxt(val) {
}
start(data) {
const { msg } = data;
this.data.message = msg;
this['msgTxt'].text = `${this.data.message }`
switch(data.type){
case 'creditsOut':
if(this['creditsOutBtn']){
this['creditsOutBtn'].visible = true;
this['creditsOutBtn'].enabled = true;
}
if(this['confirmBtn']){
this['confirmBtn'].visible = false;
this['confirmBtn'].enabled = false;
}
break;
case 'err':
if(this['creditsOutBtn']){
this['creditsOutBtn'].visible = false;
this['creditsOutBtn'].enabled = false;
}
if(this['confirmBtn']){
this['confirmBtn'].visible = true;
this['confirmBtn'].enabled = true;
}
break;
default:
if(this['creditsOutBtn']){
this['creditsOutBtn'].visible = false;
this['creditsOutBtn'].enabled = false;
}
if(this['confirmBtn']){
this['confirmBtn'].visible = true;
this['confirmBtn'].enabled = true;
}
break;
}
}
protected get creditsOutBtns(): eui.Button[] {
return [this['creditsOutBtn']]
}
protected get closeBtns(): eui.Button[] {
return [this['closeBtn']]
}
protected get skinKey() { return 'Msg' }
}
\ No newline at end of file
import { getSkinPath } from "../utils";
export default class ComponentBase extends eui.Component {
protected data: any;
constructor() {
super();
this.data = {};
this.skinName = getSkinPath(this.skinKey);
this.addEventListener(egret.Event.COMPLETE, this.onSkinComplete, this);
if (this.skin) {
this.onSkinComplete();
}
}
protected initEvents() { }
protected removeEvents() { }
start(data?) {
}
protected get skinKey() { return null }
protected onSkinComplete() {
this.initEvents();
}
destroy() {
this.removeEvents();
}
}
\ No newline at end of file
import { NetManager, DataManager } from "duiba-tw";
import Loading from "../../loading/Loading";
const getStartOrderStatus = (callback: Function, customizedType?: number) => {
NetManager.ins.getStartStatus(
callback,
DataManager.ins.doStartData.ticketId,
() => { return DataManager.ins.getStartStatusData.code != 1; },
5,
customizedType);
}
/**
* 开始游戏
* @param {string} isAgain 是否是再来一次
* @param {number} credits 主动要求花费多少积分玩游戏
* @param {number} customizedType xx类型
*/
export default
(isAgain = false, credits?: number, customizedType?: number) => new Promise((resolve) => {
if (window['requirelogin']) {
window['requirelogin']();
return;
}
const callback = (data) => {
Loading.instace.hide();
resolve(data);
}
Loading.instace.show();
NetManager.ins.doStart((success: boolean) => {
if (success) {
getStartOrderStatus(callback, customizedType);
} else {
callback(success);
}
},
isAgain,
credits,
customizedType);
});
\ No newline at end of file
import { DataManager, NetManager } from "duiba-tw";
import Loading from "../../loading/Loading";
export default
() => new Promise((resolve) => {
const _callback = (data) => {
Loading.instace.hide();
resolve(data);
}
Loading.instace.show();
if (DataManager.ins.getRuleData) {
_callback(true);
} else {
NetManager.ins.getRule(_callback);
}
})
import { NetManager } from "duiba-tw";
import Loading from "../../loading/Loading";
/**
* 实时排行榜
* @param {number} type 0总排行榜 1今日排行榜 2 多游戏总排行榜 3 昨日排行榜
* @param {number} count 返回榜单长度 最大50
*/
export default (callback, type, count) => {
const _callback = (data) => {
Loading.instace.hide();
callback(data);
}
Loading.instace.show();
NetManager.ins.realtimerank(_callback, type, count);
}
\ No newline at end of file
import { ModuleTypes } from "../types/sceneTypes";
import Panel from "../views/Panel";
export default class PanelCtrl {
private _parent: egret.Sprite;
private _mask: egret.Shape;
static _instance: PanelCtrl;
static get instance() {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl())
}
init(parent: egret.Sprite) {
this._parent = parent;
}
show(type: ModuleTypes, data?) {
const cls = this._panelClassMap[type];
const panel: Panel = new cls(data);
this._current = panel;
panel.start(data);
this.add(panel);
}
private add(panel: Panel) {
this._parent.addChild(panel);
panel.addEventListener('onDestroy', this.onPanelHide, this);
panel.addEventListener('onCreditsOut', this.onCreditsOut, this);
}
private remove(panel: Panel) {
this._parent.removeChild(panel);
}
private onPanelHide(e: egret.Event) {
const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
panel.removeEventListener('onCreditsOut', this.onCreditsOut, this);
this.remove(panel);
}
private onCreditsOut(e: egret.Event){
if(!window['CFG'] || !window['CFG'].appInfo) return;
window.location.href = window['CFG'].appInfo.earnCreditsUrl;
}
private _panelClassMap: any;
registerPanelClass(name, definition) {
this._panelClassMap = this._panelClassMap || {};
this._panelClassMap[name] = definition;
}
private _current: Panel;
closeCurrent() {
if (this._current)
this.remove(this._current);
}
}
\ No newline at end of file
import { ModuleTypes } from "../types/sceneTypes";
import Scene from "../views/Scene";
export default class SceneCtrl {
private _parent: egret.Sprite;
private _currentScene: Scene;
static _instance: SceneCtrl;
static get instance() {
return SceneCtrl._instance || (SceneCtrl._instance = new SceneCtrl())
}
init(parent: egret.Sprite) {
this._parent = parent;
}
change(type: ModuleTypes) {
if (this._currentScene) {
this._currentScene.destroy();
this._parent.removeChild(this._currentScene);
}
const cls = this._sceneClassMap[type];
const scene: Scene = new cls();
scene.start();
this.addToStage(scene);
}
private addToStage(scene: Scene) {
this._currentScene = scene;
this._parent.addChild(scene);
}
private _sceneClassMap: any;
registerSceneClass(name, definition) {
this._sceneClassMap = this._sceneClassMap || {};
this._sceneClassMap[name] = definition;
}
}
\ No newline at end of file
import { ModuleTypes } from "../types/sceneTypes";
import PanelCtrl from "./panelCtrl";
export default (message: string, btnTxt?: string) => {
PanelCtrl.instance.show(ModuleTypes.ALERT_PANEL, { message: message, btnTxt: btnTxt })
}
\ No newline at end of file
import ComponentBase from "../components/ComponentBase";
export default class Loading extends ComponentBase {
private static _parent: egret.Sprite;
private static _instance: Loading;
static get instace(): Loading {
return Loading._instance || (Loading._instance = new Loading());
}
constructor() {
super();
this.horizontalCenter = 0;
this.verticalCenter = 0;
}
show() {
Loading._parent.addChild(this);
if (this.skin && !this.hasEventListener(egret.Event.ENTER_FRAME))
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
hide() {
Loading._parent.removeChild(this);
if (this.hasEventListener(egret.Event.ENTER_FRAME))
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
static init(parent: egret.Sprite) {
Loading._parent = parent;
}
onSkinComplete(): any {
super.onSkinComplete();
if (!this.hasEventListener(egret.Event.ENTER_FRAME))
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
}
onEnterFrame() {
this.data.speed += 5;
}
protected get skinKey() { return 'Loading' }
}
This diff is collapsed.
import { NetManager } from 'duiba-tw';
import { DataManager } from 'duiba-tw';
import Panel from "../views/Panel";
export default class RulePanel extends Panel {
constructor(){
super()
NetManager.ins.getRule(()=>{
var tx:egret.TextField = new egret.TextField;
tx.width = this.stage.stageWidth - 220;
tx.textFlow = (new egret.HtmlTextParser).parser(
DataManager.ins.getRuleData ? DataManager.ins.getRuleData.ruleText :
(DataManager.ins.ajaxElementData ? DataManager.ins.ajaxElementData.rule :
(window['ruleCFG'] ? window['ruleCFG'] : "规则")
)
);
tx.x = 110;
tx.y = 330;
tx.textColor = 0x333333;
this.addChild( tx );
})
}
protected get skinKey() { return 'Rule' }
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment