移除原fc的代码
686
fc/css/gbajs.css
@ -1,686 +0,0 @@
|
||||
@charset "utf-8";
|
||||
a,mark {
|
||||
color:inherit
|
||||
}
|
||||
html {
|
||||
color:#000;
|
||||
background:#fff;
|
||||
font-family:Arial,'Microsoft YaHei';
|
||||
font-size:34px;
|
||||
-webkit-user-select:none;
|
||||
user-select:none;
|
||||
-webkit-overflow-scrolling:touch
|
||||
}
|
||||
body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,li,ol,p,pre,strong,td,textarea,th,ul {
|
||||
padding:0;
|
||||
margin:0
|
||||
}
|
||||
table {
|
||||
border-collapse:collapse;
|
||||
border-spacing:0
|
||||
}
|
||||
img {
|
||||
display:block;
|
||||
border:0;
|
||||
max-width:100%
|
||||
}
|
||||
a {
|
||||
text-decoration:none;
|
||||
outline:0
|
||||
}
|
||||
em,i,strong {
|
||||
font-style:inherit;
|
||||
font-weight:inherit
|
||||
}
|
||||
li {
|
||||
list-style:none
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-size:100%;
|
||||
font-weight:400
|
||||
}
|
||||
button,input,optgroup,option,select,textarea {
|
||||
font-family:inherit;
|
||||
font-size:inherit;
|
||||
font-style:inherit;
|
||||
font-weight:inherit
|
||||
}
|
||||
mark {
|
||||
background-color:rgba(0,0,0,0)
|
||||
}
|
||||
.clearfix:after {
|
||||
content:"\200B";
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both
|
||||
}
|
||||
.none,[v-cloak] {
|
||||
display:none
|
||||
}
|
||||
.dire-wrap,.key-wrap {
|
||||
display:inline-block;
|
||||
overflow:hidden;
|
||||
will-change:auto;
|
||||
contain:style;
|
||||
backface-visibility:hidden
|
||||
}
|
||||
.mask {
|
||||
position:fixed;
|
||||
width:100%;
|
||||
height:100%;
|
||||
left:0;
|
||||
top:0;
|
||||
z-index:95;
|
||||
background:rgba(0,0,0,.7)
|
||||
}
|
||||
.tx_ov {
|
||||
overflow:hidden;
|
||||
white-space:nowrap;
|
||||
text-overflow:ellipsis
|
||||
}
|
||||
.tx_wrap {
|
||||
word-break:break-all;
|
||||
word-wrap:break-word
|
||||
}
|
||||
body {
|
||||
background:#000
|
||||
}
|
||||
.dc-centre,.dc-dire,.dire-ctrl,.key-btn {
|
||||
background-size:100% 100%
|
||||
}
|
||||
#screen {
|
||||
position:absolute;
|
||||
width:256px;
|
||||
height:240px;
|
||||
top:calc((100vh + 50px - 256px)/ 2);
|
||||
right: 240px;
|
||||
transform:scale(3.3333,3.3333) rotate(90deg);
|
||||
border:none;
|
||||
overflow:hidden
|
||||
}
|
||||
.ctrl-wrap {
|
||||
position:fixed;
|
||||
height:100vh;
|
||||
width:100%;
|
||||
top:0;
|
||||
left:0
|
||||
}
|
||||
.dc-centre,.dc-dire,.dire-ctrl,.dire-wrap,.key-btn,.key-wrap {
|
||||
position:absolute
|
||||
}
|
||||
.dire-wrap {
|
||||
width:390px;
|
||||
height:390px;
|
||||
top:-10px;
|
||||
left:-10px
|
||||
}
|
||||
.dire-ctrl {
|
||||
width:290px;
|
||||
height:290px;
|
||||
margin:50px;
|
||||
background-image:url(../resources/7.png);
|
||||
overflow:hidden
|
||||
}
|
||||
.dc-centre {
|
||||
width:124px;
|
||||
height:124px;
|
||||
background-image:url(../resources/8.png);
|
||||
will-change:auto;
|
||||
contain:style
|
||||
}
|
||||
.dc-dire {
|
||||
width:384px;
|
||||
height:384px;
|
||||
margin:3px;
|
||||
background-image:url(../resources/9.png);
|
||||
will-change:auto;
|
||||
contain:style
|
||||
}
|
||||
.key-wrap {
|
||||
width:100vw;
|
||||
height:390px;
|
||||
bottom:20px;
|
||||
left:20px
|
||||
}
|
||||
.key-btn {
|
||||
width:150px;
|
||||
height:150px;
|
||||
line-height:150px;
|
||||
text-align:center;
|
||||
font-size:56px;
|
||||
transform:rotate(90deg);
|
||||
font-weight:700;
|
||||
color:rgba(255,255,255,.5);
|
||||
opacity:.5;
|
||||
background-image:url(../resources/8.png)
|
||||
}
|
||||
.key-btn.kay-B {
|
||||
top:88px;
|
||||
left:90px;
|
||||
opacity:.7
|
||||
}
|
||||
.key-btn.kay-A {
|
||||
top:220px;
|
||||
left:0px;
|
||||
opacity:.7
|
||||
}
|
||||
.key-btn.kay-Y {
|
||||
top:88px;
|
||||
left:232px
|
||||
}
|
||||
.key-btn.kay-X {
|
||||
top:256px;
|
||||
left:162px
|
||||
}
|
||||
.key-btn.kay-AB {
|
||||
top:220px;
|
||||
left:222px
|
||||
}
|
||||
.key-btn.flat-btn {
|
||||
width:120px;
|
||||
height:80px;
|
||||
font-size:30px;
|
||||
line-height:80px
|
||||
}
|
||||
.key-btn.kay-SE {
|
||||
top:120px;
|
||||
right:60px
|
||||
}
|
||||
.key-btn.kay-ST {
|
||||
top:260px;
|
||||
right:60px
|
||||
}
|
||||
.btn-on {
|
||||
transform:scale(.9,.9) rotate(90deg)
|
||||
}
|
||||
.layui-m-layer {
|
||||
position:relative;
|
||||
z-index:19891014
|
||||
}
|
||||
.layui-m-layer * {
|
||||
-webkit-box-sizing:content-box;
|
||||
-moz-box-sizing:content-box;
|
||||
box-sizing:content-box
|
||||
}
|
||||
.layui-m-layermain,.layui-m-layershade {
|
||||
position:fixed;
|
||||
left:0;
|
||||
top:0;
|
||||
width:100%;
|
||||
height:100%
|
||||
}
|
||||
.layui-m-layershade {
|
||||
background-color:rgba(0,0,0,.7);
|
||||
pointer-events:auto
|
||||
}
|
||||
.layui-m-layermain {
|
||||
display:table;
|
||||
pointer-events:none
|
||||
}
|
||||
.layui-m-layermain .layui-m-layersection {
|
||||
display:table-cell;
|
||||
vertical-align:middle;
|
||||
text-align:center
|
||||
}
|
||||
.layui-m-layerchild {
|
||||
position:relative;
|
||||
display:inline-block;
|
||||
text-align:left;
|
||||
background-color:#fff;
|
||||
font-size:2.6vh;
|
||||
border-radius:20px;
|
||||
box-shadow:0 0 8px rgba(0,0,0,.1);
|
||||
pointer-events:auto;
|
||||
-webkit-overflow-scrolling:touch;
|
||||
-webkit-animation-fill-mode:both;
|
||||
animation-fill-mode:both;
|
||||
-webkit-animation-duration:.2s;
|
||||
animation-duration:.2s
|
||||
}
|
||||
@-webkit-keyframes layui-m-anim-scale {
|
||||
0% {
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.5);
|
||||
transform:scale(.5)
|
||||
}
|
||||
100% {
|
||||
opacity:1;
|
||||
-webkit-transform:scale(1);
|
||||
transform:scale(1)
|
||||
}
|
||||
}@keyframes layui-m-anim-scale {
|
||||
0% {
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.5);
|
||||
transform:scale(.5)
|
||||
}
|
||||
100% {
|
||||
opacity:1;
|
||||
-webkit-transform:scale(1);
|
||||
transform:scale(1)
|
||||
}
|
||||
}.layui-m-anim-scale {
|
||||
animation-name:layui-m-anim-scale;
|
||||
-webkit-animation-name:layui-m-anim-scale
|
||||
}
|
||||
@-webkit-keyframes layui-m-anim-up {
|
||||
0% {
|
||||
opacity:0;
|
||||
-webkit-transform:translateY(1600px);
|
||||
transform:translateY(1600px)
|
||||
}
|
||||
100% {
|
||||
opacity:1;
|
||||
-webkit-transform:translateY(0);
|
||||
transform:translateY(0)
|
||||
}
|
||||
}@keyframes layui-m-anim-up {
|
||||
0% {
|
||||
opacity:0;
|
||||
-webkit-transform:translateY(1600px);
|
||||
transform:translateY(1600px)
|
||||
}
|
||||
100% {
|
||||
opacity:1;
|
||||
-webkit-transform:translateY(0);
|
||||
transform:translateY(0)
|
||||
}
|
||||
}.layui-m-anim-up {
|
||||
-webkit-animation-name:layui-m-anim-up;
|
||||
animation-name:layui-m-anim-up
|
||||
}
|
||||
.layui-m-layer0 .layui-m-layerchild {
|
||||
width:70%
|
||||
}
|
||||
.layui-m-layer1 .layui-m-layerchild {
|
||||
border:none;
|
||||
border-radius:0
|
||||
}
|
||||
.layui-m-layer2 .layui-m-layerchild {
|
||||
width:15vh;
|
||||
border:none;
|
||||
padding:35px 0;
|
||||
box-shadow:none;
|
||||
color:#fff;
|
||||
background-color:rgba(0,0,0,.7)
|
||||
}
|
||||
.layui-m-layerchild h3 {
|
||||
padding:0 5%;
|
||||
height:7.5vh;
|
||||
line-height:7.5vh;
|
||||
font-size:2.8vh;
|
||||
font-weight:400;
|
||||
border-radius:20px 20px 0 0;
|
||||
text-align:center;
|
||||
border-bottom:1px solid #E0E0E0
|
||||
}
|
||||
.layui-m-layerbtn span,.layui-m-layerchild h3 {
|
||||
text-overflow:ellipsis;
|
||||
overflow:hidden;
|
||||
white-space:nowrap
|
||||
}
|
||||
.layui-m-layercont {
|
||||
padding:8% 10%;
|
||||
line-height:4vh;
|
||||
text-align:center
|
||||
}
|
||||
.layui-m-layer1 .layui-m-layercont {
|
||||
padding:0;
|
||||
text-align:left
|
||||
}
|
||||
.layui-m-layer2 .layui-m-layercont {
|
||||
text-align:center;
|
||||
padding:0;
|
||||
line-height:0
|
||||
}
|
||||
.layui-m-layer2 .layui-m-layercont i {
|
||||
width:3vh;
|
||||
height:3vh;
|
||||
margin-left:1vh;
|
||||
display:inline-block;
|
||||
background-color:#fff;
|
||||
border-radius:100%;
|
||||
-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;
|
||||
animation:layui-m-anim-loading 1.4s infinite ease-in-out;
|
||||
-webkit-animation-fill-mode:both;
|
||||
animation-fill-mode:both
|
||||
}
|
||||
.layui-m-layerbtn,.layui-m-layerbtn span {
|
||||
position:relative;
|
||||
text-align:center;
|
||||
border-radius:0 0 20px 20px
|
||||
}
|
||||
.layui-m-layer2 .layui-m-layercont p {
|
||||
margin-top:2vh;
|
||||
font-size:2.5vh
|
||||
}
|
||||
@-webkit-keyframes layui-m-anim-loading {
|
||||
0%,100%,80% {
|
||||
transform:scale(0);
|
||||
-webkit-transform:scale(0)
|
||||
}
|
||||
40% {
|
||||
transform:scale(1);
|
||||
-webkit-transform:scale(1)
|
||||
}
|
||||
}@keyframes layui-m-anim-loading {
|
||||
0%,100%,80% {
|
||||
transform:scale(0);
|
||||
-webkit-transform:scale(0)
|
||||
}
|
||||
40% {
|
||||
transform:scale(1);
|
||||
-webkit-transform:scale(1)
|
||||
}
|
||||
}.layui-m-layer2 .layui-m-layercont i:first-child {
|
||||
margin-left:0;
|
||||
-webkit-animation-delay:-.32s;
|
||||
animation-delay:-.32s
|
||||
}
|
||||
.layui-m-layer2 .layui-m-layercont i.layui-m-layerload {
|
||||
-webkit-animation-delay:-.16s;
|
||||
animation-delay:-.16s
|
||||
}
|
||||
.layui-m-layer2 .layui-m-layercont>div {
|
||||
line-height:3.3vh;
|
||||
padding-top:14px;
|
||||
margin-bottom:40px;
|
||||
font-size:3vh
|
||||
}
|
||||
.layui-m-layerbtn {
|
||||
display:block;
|
||||
display:-moz-box;
|
||||
display:-webkit-box;
|
||||
width:100%;
|
||||
height:7.5vh;
|
||||
line-height:7.5vh;
|
||||
font-size:0;
|
||||
border-top:1px solid #ddd;
|
||||
background-color:#FFF
|
||||
}
|
||||
.layui-m-layerbtn span {
|
||||
display:block;
|
||||
-moz-box-flex:1;
|
||||
box-flex:1;
|
||||
-webkit-box-flex:1;
|
||||
font-size:2.8vh;
|
||||
cursor:pointer;
|
||||
color:#0084ff
|
||||
}
|
||||
.layui-m-layerbtn span[yes] {
|
||||
border-radius:0 0 20px
|
||||
}
|
||||
.layui-m-layerbtn span[no] {
|
||||
border-right:1px solid #ddd;
|
||||
border-radius:0 0 0 20px
|
||||
}
|
||||
.layui-m-layerbtn span:active {
|
||||
background-color:#F6F6F6
|
||||
}
|
||||
.layui-m-layerend {
|
||||
position:absolute;
|
||||
right:14px;
|
||||
top:20px;
|
||||
width:60px;
|
||||
height:60px;
|
||||
border:0;
|
||||
font-weight:400;
|
||||
background:0 0;
|
||||
cursor:pointer;
|
||||
-webkit-appearance:none;
|
||||
font-size:6vh
|
||||
}
|
||||
.layui-m-layerend::after,.layui-m-layerend::before {
|
||||
position:absolute;
|
||||
left:10px;
|
||||
top:30px;
|
||||
content:'';
|
||||
width:18px;
|
||||
height:1px;
|
||||
background-color:#999;
|
||||
transform:rotate(45deg);
|
||||
-webkit-transform:rotate(45deg);
|
||||
border-radius:12px
|
||||
}
|
||||
.layui-m-layerend::after {
|
||||
transform:rotate(-45deg);
|
||||
-webkit-transform:rotate(-45deg)
|
||||
}
|
||||
body .layui-m-layer .layui-m-layer-footer {
|
||||
position:fixed;
|
||||
width:95%;
|
||||
max-width:100%;
|
||||
margin:0 auto;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:20px;
|
||||
background:0 0
|
||||
}
|
||||
.layui-m-layer-footer .layui-m-layercont {
|
||||
padding:20px;
|
||||
border-radius:20px 20px 0 0;
|
||||
background-color:rgba(255,255,255,.8)
|
||||
}
|
||||
.layui-m-layer-footer .layui-m-layerbtn {
|
||||
display:block;
|
||||
height:auto;
|
||||
background:0 0;
|
||||
border-top:none
|
||||
}
|
||||
.layui-m-layer-footer .layui-m-layerbtn span {
|
||||
background-color:rgba(255,255,255,.8)
|
||||
}
|
||||
.layui-m-layer-footer .layui-m-layerbtn span[no] {
|
||||
color:#FD482C;
|
||||
border-top:1px solid #c2c2c2;
|
||||
border-radius:0 0 20px 20px
|
||||
}
|
||||
.layui-m-layer-footer .layui-m-layerbtn span[yes] {
|
||||
margin-top:20px;
|
||||
border-radius:20px
|
||||
}
|
||||
body .layui-m-layer .layui-m-layer-msg {
|
||||
width:auto;
|
||||
max-width:90%;
|
||||
margin:0 auto;
|
||||
background-color:rgba(0,0,0,.7);
|
||||
color:#fff
|
||||
}
|
||||
.layui-m-layer-msg .layui-m-layercont {
|
||||
padding:20px 40px;
|
||||
font-size:2.8vh
|
||||
}
|
||||
/*html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: none;
|
||||
}
|
||||
canvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}*/
|
||||
/*span {
|
||||
color: red;
|
||||
bottom: 0px;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
display: none;
|
||||
font-size: 40pt;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
vertical-align: bottom;
|
||||
font-family: monospace;
|
||||
display:none;
|
||||
}*/
|
||||
.background-div{
|
||||
position: fixed;
|
||||
background-color: #000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
.info-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 110vw;
|
||||
height: 250vw;
|
||||
background-color: #000;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
background-image:url(../resources/invite-mask.jpg);
|
||||
background-repeat:no-repeat;
|
||||
background-size: 100%
|
||||
}
|
||||
#mask-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
.container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.real .dire-ctrl {
|
||||
background-image:url(../resources/rocker.png);
|
||||
}
|
||||
|
||||
.real .dc-centre {
|
||||
display: none;
|
||||
}
|
||||
.real .dc-dire {
|
||||
background-image:url(../resources/direct-shadow.png);
|
||||
}
|
||||
|
||||
.real .direct-wrap {
|
||||
display: grid;
|
||||
}
|
||||
.direct-btn {
|
||||
}
|
||||
.real .key-btn {
|
||||
opacity:1!important;
|
||||
background-image:url(../resources/button.png)!important;
|
||||
}
|
||||
|
||||
.real .flat-btn {
|
||||
background-image:url(../resources/flat-button.png)!important;;
|
||||
opacity:.7!important;;
|
||||
width:150px!important;
|
||||
}
|
||||
.real .kay-SE {
|
||||
top:100px!important;
|
||||
}
|
||||
.real .kay-ST {
|
||||
right:60px!important;;
|
||||
}
|
||||
.hidden {
|
||||
display: none!important;
|
||||
}
|
||||
.menu-back {
|
||||
background-color: #000;
|
||||
opacity: 0.5;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right:0;
|
||||
display: none;
|
||||
}
|
||||
.menu-container {
|
||||
background-color: white;
|
||||
width: 100vw;
|
||||
height: 60vw;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -50vw;
|
||||
margin-top: -30vw;
|
||||
transform: rotate(90deg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.menu-container .menu-title {
|
||||
height: 80px;
|
||||
padding: 10px 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #777;
|
||||
}
|
||||
.menu-container .menu-body {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
}
|
||||
.menu-body .row {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
padding: 15px;
|
||||
margin-bottom: 5px;
|
||||
display: flex;
|
||||
}
|
||||
.menu-body .row .row-title {
|
||||
width: 30%;
|
||||
color: #777;
|
||||
}
|
||||
.menu-body .row .row-body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
}
|
||||
.row-body .row-part{
|
||||
width: 50%;
|
||||
}
|
||||
.row-part input[type='radio']{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.menu-container .menu-footer {
|
||||
height: 80px;
|
||||
display: flex;
|
||||
}
|
||||
.menu-container .menu-footer .left-part {
|
||||
flex:1;
|
||||
}
|
||||
.menu-container .menu-footer .right-part {
|
||||
display: flex;
|
||||
padding: 5px 20px;
|
||||
}
|
||||
.menu-container .menu-footer .menu-btn {
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
border: 1px solid #ddd;
|
||||
margin-right: 10px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.menu-btn.btn-success{
|
||||
color: #fff;
|
||||
background-color: #449d44;
|
||||
border-color: #398439;
|
||||
}
|
||||
#menu_btn{
|
||||
top: 120px;
|
||||
right: 60px;
|
||||
width: 120px;
|
||||
height: 80px;
|
||||
font-size: 30px;
|
||||
line-height: 80px;
|
||||
text-align: center;
|
||||
transform: rotate(90deg);
|
||||
font-weight: 700;
|
||||
color: rgba(255,255,255,.5);
|
||||
opacity: .5;
|
||||
position: absolute;
|
||||
background-size: 100% 100%;
|
||||
background-image: url(../resources/8.png);
|
||||
z-index: 10;
|
||||
}
|
||||
#menu_btn.real{
|
||||
background-image: url(../resources/flat-button.png);
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="viewport" content="width=750,minimum-scale=0.4,maximum-scale=1,user-scalable=no">
|
||||
<title></title>
|
||||
<link href="css/gbajs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/tiny-browser-require@1.0.0/require.js"></script>
|
||||
<!--<script type="text/javascript" src="js/require.js"></script>-->
|
||||
<script type="text/javascript" src="js/jcfw/httpcli.js"></script>
|
||||
<script type="text/javascript" src="js/jcfw/httpclient.js"></script>
|
||||
<script type="text/javascript" src="js/jcfw/urlbuilder.js"></script>
|
||||
<script type="text/javascript" src="js/jcfw/jcgamelog.js"></script>
|
||||
<script type="text/javascript" src="js/logger.js"></script>
|
||||
<script type="text/javascript" src="js/long.js"></script>
|
||||
<script type="text/javascript" src="js/bytebuffer.js"></script>
|
||||
<script type="text/javascript" src="js/protobuf.js"></script>
|
||||
<script type="text/javascript" src="js/jcmatchvs.js"></script>
|
||||
<script type="text/javascript" src="js/netWorkHandle.js"></script>
|
||||
<script type="text/javascript" src="js/network.js?"></script>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/nes-embed.js"></script>
|
||||
<script type="text/javascript" src="js/js.cookie.js"></script>
|
||||
<script type="text/javascript" src="js/options.js"></script>
|
||||
<script type="text/javascript">
|
||||
var showInviteMask = function() {
|
||||
document.getElementById('info-mask').style.display = '';
|
||||
}
|
||||
var hideInviteMask = function (){
|
||||
document.getElementById('info-mask').style.display = 'none';
|
||||
}
|
||||
wx.miniProgram.getEnv(function(res) {
|
||||
console.log(res) // true
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<div id="emulator"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <script src="js/rq.js" data-main="js/index.js"></script> -->
|
||||
<div class='background-div'></div>
|
||||
<canvas id="screen" width="256" height="240"></canvas>
|
||||
<div class="" id="menu_btn">选项</div>
|
||||
<div id="ctrl-wrap" class="ctrl-wrap real">
|
||||
<div class="dire-wrap">
|
||||
<div class="dire-ctrl">
|
||||
<div class="dc-centre"></div>
|
||||
</div>
|
||||
<div class="dc-dire"></div>
|
||||
</div>
|
||||
<div class="key-wrap">
|
||||
<div class="key-btn kay-A" data-key="A">A</div>
|
||||
<div class="key-btn kay-B" data-key="B">B</div>
|
||||
<!-- <div class="key-btn kay-Y" data-key="Y">L</div>-->
|
||||
<!-- <div class="key-btn kay-X" data-key="X">R</div>-->
|
||||
<div class="key-btn kay-AB" data-key="AB">AB</div>
|
||||
<div class="key-btn kay-SE flat-btn" data-key="SE">选择</div>
|
||||
<div class="key-btn kay-ST flat-btn" data-key="ST">开始</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='info-mask' id='info-mask' style="display: none;">
|
||||
<!-- <img id='mask-img' src='resources/invite-mask.jpg'> -->
|
||||
</div>
|
||||
<div class="menu-back" id="menu_back">
|
||||
</div>
|
||||
<div class="menu-container hidden" id="menu_container">
|
||||
<div class="menu-title">选项</div>
|
||||
<div class="menu-body">
|
||||
<div class="row">
|
||||
<div class="row-title">按键类型</div>
|
||||
<div class="row-body">
|
||||
<div class="row-part">
|
||||
<input type="radio" value="O" id="radio0" name="key_type" class="md-radiobtn">摇杆
|
||||
</div>
|
||||
<div class="row-part">
|
||||
<input type="radio" value="N" id="radio1" name="key_type" class="md-radiobtn">按键
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu-footer">
|
||||
<div class="left-part"></div>
|
||||
<div class="right-part">
|
||||
<div class="menu-btn" id="cancel_btn">取消</div>
|
||||
<div class="menu-btn btn-success" id="save_btn">确定</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,63 +0,0 @@
|
||||
NetEnum = {
|
||||
STARTGAME:1,
|
||||
ENTERGAME:2,
|
||||
CHANGECLOTH:3,
|
||||
JUMP:100,
|
||||
USEITEM:101,
|
||||
ENDITEM:102,
|
||||
STARTMATCH:103,
|
||||
SETROBOT:104,
|
||||
}
|
||||
|
||||
nwh = function(){
|
||||
this.functionarr=[];
|
||||
var self = this;
|
||||
this.process=function(msg){
|
||||
var data = JSON.parse(msg.content);
|
||||
data.uid = msg.srcUserId;
|
||||
this.functionarr[data.m](data)
|
||||
};
|
||||
this.processFrame =function(msg){
|
||||
for(var i=0;i<msg.frameItems.length;i++){
|
||||
var data = JSON.parse(msg.frameItems[i].content);
|
||||
data.uid = msg.frameItems[i].srcUserID;
|
||||
this.functionarr[data.m](data)
|
||||
}
|
||||
};
|
||||
this.functionarr[NetEnum.STARTGAME] = function(data){
|
||||
self.NetWorkManage.cleanCb();
|
||||
// // Main.stageId = 9;
|
||||
// Main.gameNetMode = true;
|
||||
// cc.director.emit('changeScene');
|
||||
// Main.uiM.loadScene("GameScene");
|
||||
}
|
||||
|
||||
this.functionarr[NetEnum.ENTERGAME] = function(data){
|
||||
self.NetWorkManage.onEnter();
|
||||
};
|
||||
this.functionarr[NetEnum.JUMP] = function(data){
|
||||
worker.postMessage({ f:"netkeypad",
|
||||
data:data.v
|
||||
});
|
||||
};
|
||||
|
||||
this.functionarr[NetEnum.USEITEM] = function(data){
|
||||
// Main.game.UIS.netEff(data.uid,data.v,true);
|
||||
};
|
||||
this.functionarr[NetEnum.ENDITEM] = function(data){
|
||||
//Main.game.UIS.netEff(data.uid,data.v,false);
|
||||
};
|
||||
|
||||
this.functionarr[NetEnum.CHANGECLOTH] = function(data){
|
||||
cc.director.emit('roomChangeCloth',data);
|
||||
};
|
||||
|
||||
this.functionarr[NetEnum.STARTMATCH] = function(data){
|
||||
cc.director.emit('startMatch');
|
||||
};
|
||||
|
||||
this.functionarr[NetEnum.SETROBOT] = function(data){
|
||||
cc.director.emit('setRobot',data);
|
||||
};
|
||||
}
|
||||
NetWorkHandle = new nwh();
|
3651
fc/js/bytebuffer.js
@ -1,206 +0,0 @@
|
||||
|
||||
|
||||
var httpcli = function(){
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {},
|
||||
|
||||
// start () {},
|
||||
|
||||
// update (dt) {},
|
||||
|
||||
this.init=function(){
|
||||
this.cachemsg = [];
|
||||
this._needretry = false;
|
||||
this._retrycount = 3;
|
||||
this._retryms = 3000;
|
||||
this._runningcount = 0;
|
||||
this._maxrunning = 10;
|
||||
// this._retry_tid = setInterval(this._retry.bind(this), this._retryms);
|
||||
};
|
||||
|
||||
this.httpGet=function(url, cbRes, cbErr){
|
||||
// var realurl = url;
|
||||
// if(urldata){
|
||||
// if(realurl.indexOf("?") == -1){
|
||||
// realurl += "?";
|
||||
// }else{
|
||||
// realurl += "&";
|
||||
// }
|
||||
// realurl += encodeURIComponent(urldata);
|
||||
// }
|
||||
return this.httpsend(url, null, cbRes, cbErr, 'GET');
|
||||
};
|
||||
|
||||
this.httpPost=function(url, postdata, cbRes, cbErr){
|
||||
return this.httpsend(url, postdata, cbRes, cbErr, 'POST');
|
||||
};
|
||||
|
||||
this.httpsend=function(url, urldata, cbRes, cbErr, smethod, isretry){
|
||||
if(this._runningcount < this._maxrunning){
|
||||
return this._httpsend(url, urldata, cbRes, cbErr, smethod, isretry);
|
||||
}else if(!isretry){
|
||||
let obj = {
|
||||
u: url,
|
||||
v: urldata,
|
||||
successcb: cbRes,
|
||||
errcb: cbErr
|
||||
};
|
||||
this.cachemsg.push(obj);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
this._httpsend=function(url, urldata, cbRes, cbErr, smethod, isretry){
|
||||
this._runningcount++;
|
||||
let self = this;
|
||||
if(typeof(XMLHttpRequest) != 'undefined'){
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4){
|
||||
self._runningcount--;
|
||||
if(xhr.status >= 200 && xhr.status < 400) {
|
||||
var response = xhr.responseText;
|
||||
cbRes && cbRes(response);
|
||||
}else{
|
||||
if(!isretry && self._needretry){
|
||||
let obj = {
|
||||
u: url,
|
||||
v: urldata,
|
||||
successcb: cbRes,
|
||||
errcb: cbErr
|
||||
};
|
||||
self.cachemsg.push(obj);
|
||||
}else{
|
||||
cbErr && cbErr(xhr.status, xhr.statusText);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// xhr.onabort = function(){
|
||||
// self._runningcount--;
|
||||
// };
|
||||
xhr.onerror = function(){
|
||||
self._runningcount--;
|
||||
};
|
||||
xhr.open(smethod, url, true);
|
||||
xhr.send(urldata);
|
||||
return xhr;
|
||||
}else if(typeof(wx) != 'undefined'){
|
||||
var jsobj = urldata? JSON.parse(urldata): null;
|
||||
var xhr = wx.request({
|
||||
url: url,
|
||||
data: jsobj,
|
||||
method: smethod,
|
||||
success: function(res){
|
||||
console.log("[wx]request success!" + res.statusCode);
|
||||
if(res.statusCode >= 200 && res.statusCode < 400) {
|
||||
var restext = JSON.stringify(res.data);
|
||||
cbRes && cbRes(restext);
|
||||
}else{
|
||||
cbErr && cbErr(res.statusCode, res.msg);
|
||||
}
|
||||
},
|
||||
fail: function(res){
|
||||
console.log("[wx]request fail!"+ JSON.stringify(res));
|
||||
if(!isretry && self._needretry){
|
||||
let obj = {
|
||||
u: url,
|
||||
v: urldata,
|
||||
successcb: cbRes,
|
||||
errcb: cbErr
|
||||
};
|
||||
self.cachemsg.push(obj);
|
||||
}else{
|
||||
cbErr && cbErr(-1, res.msg);
|
||||
}
|
||||
// cbErr && cbErr(-1, res.msg);
|
||||
},
|
||||
complete: function(){
|
||||
self._runningcount--;
|
||||
console.log("[wx]request complete!");
|
||||
}
|
||||
});
|
||||
return xhr;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this._retry=function(){
|
||||
if(this.cachemsg.length > 0){
|
||||
this.cachemsg.forEach(element => {
|
||||
let obj = element;
|
||||
if(obj.retrying){
|
||||
return;
|
||||
}
|
||||
let bneedretry = false;
|
||||
if(!obj.retry_count){
|
||||
obj.retry_count = 1;
|
||||
obj.passtime = 0;
|
||||
}
|
||||
obj.passtime += this._retryms;
|
||||
bneedretry = (obj.passtime >= obj.retry_count * this._retryms);
|
||||
|
||||
if(bneedretry && !obj.retrying){
|
||||
obj.retrying = true;
|
||||
let method = obj.v? 'POST': 'GET';
|
||||
this.httpsend(obj.u, obj.v, (restext) => {
|
||||
obj.successcb && obj.successcb(restext);
|
||||
let idx = this.cachemsg.findIndex((element) => {
|
||||
return element == obj;
|
||||
});
|
||||
if(idx != -1){
|
||||
this.cachemsg.splice(idx, 1);
|
||||
}
|
||||
}, (errcode, errmsg) => {
|
||||
obj.retrying = false;
|
||||
obj.passtime = 0;
|
||||
obj.retry_count++;
|
||||
if(obj.retry_count >= this._retrycount){
|
||||
obj.errcb && obj.errcb(errcode, errmsg);
|
||||
let idx = this.cachemsg.findIndex((element) => {
|
||||
return element == obj;
|
||||
});
|
||||
if(idx != -1){
|
||||
this.cachemsg.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
}, method, true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.setRetryCount=function(count){
|
||||
this.retrycount = count;
|
||||
};
|
||||
|
||||
this.setRetryInterval=function(millsec){
|
||||
if(millsec != this._retryms){
|
||||
this._retryms = millsec;
|
||||
if(this._retry_tid){
|
||||
clearInterval(this._retry_tid);
|
||||
this._retry_tid = 0;
|
||||
}
|
||||
}
|
||||
if(!this._retry_tid){
|
||||
this._retry_tid = setInterval(this._retry.bind(this), this._retryms);
|
||||
}
|
||||
};
|
||||
|
||||
this.setNeedRetry=function(needretry){
|
||||
this._needretry = needretry;
|
||||
// if(!this._needretry && this._retry_tid){
|
||||
// clearInterval(this._retry_tid);
|
||||
// this._retry_tid = 0;
|
||||
// }else if(this._needretry && !this._retry_tid){
|
||||
// this._retry_tid = setInterval(this._retry.bind(this), this._retryms);
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
require.register('httpcli', function(module, exports, require) {
|
||||
module.exports = httpcli;
|
||||
});
|
@ -1,53 +0,0 @@
|
||||
|
||||
|
||||
var httpcli = require('httpcli');
|
||||
require.register('common/httpclient', function(module, exports, require) {
|
||||
module.exports = {
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {},
|
||||
|
||||
// start () {},
|
||||
|
||||
// update (dt) {},
|
||||
getInstance(){
|
||||
if(!this._instance){
|
||||
this._instance = new httpcli();
|
||||
this._instance.init();
|
||||
this._instance.setRetryInterval(3000);
|
||||
this._instance.setNeedRetry(true);
|
||||
}
|
||||
return this._instance;
|
||||
},
|
||||
|
||||
httpGet(url, cbRes, cbErr){
|
||||
// var realurl = url;
|
||||
// if(urldata){
|
||||
// if(realurl.indexOf("?") == -1){
|
||||
// realurl += "?";
|
||||
// }else{
|
||||
// realurl += "&";
|
||||
// }
|
||||
// realurl += encodeURIComponent(urldata);
|
||||
// }
|
||||
return this.httpsend(url, null, cbRes, cbErr, 'GET');
|
||||
},
|
||||
|
||||
httpPost(url, postdata, cbRes, cbErr){
|
||||
return this.httpsend(url, postdata, cbRes, cbErr, 'POST');
|
||||
},
|
||||
|
||||
httpsend(url, urldata, cbRes, cbErr, smethod){
|
||||
return this.getInstance().httpsend(url, urldata, cbRes, cbErr, smethod);
|
||||
},
|
||||
|
||||
JSON_parse(text){
|
||||
try{
|
||||
return JSON.parse(text);
|
||||
}catch(err){
|
||||
console.log(err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
@ -1,969 +0,0 @@
|
||||
|
||||
|
||||
var httpclient = require('common/httpclient');
|
||||
var urlbuilder = require('common/urlbuilder');
|
||||
|
||||
const JC_LOG_T = {
|
||||
lauch:{
|
||||
key: 1,
|
||||
subkey: 1,
|
||||
},
|
||||
|
||||
entermain:{
|
||||
key: 1,
|
||||
subkey: 2,
|
||||
},
|
||||
|
||||
show:{
|
||||
key: 1,
|
||||
subkey: 3
|
||||
},
|
||||
|
||||
hide:{
|
||||
key: 1,
|
||||
subkey: 3
|
||||
},
|
||||
|
||||
jumpapp:{
|
||||
key: 1,
|
||||
subkey: 4
|
||||
},
|
||||
|
||||
loginFailed:{
|
||||
key: 1,
|
||||
subkey: 5
|
||||
},
|
||||
|
||||
launchsysteminfo:{
|
||||
key: 1,
|
||||
subkey: 6
|
||||
},
|
||||
|
||||
logined:{
|
||||
key: 11,
|
||||
subkey: 1
|
||||
},
|
||||
|
||||
authed:{
|
||||
key: 11,
|
||||
subkey: 2
|
||||
},
|
||||
|
||||
authfail:{
|
||||
key: 11,
|
||||
subkey: 3
|
||||
},
|
||||
|
||||
startgame:{
|
||||
key: 11,
|
||||
subkey: 4
|
||||
},
|
||||
|
||||
restartgame:{
|
||||
key: 11,
|
||||
subkey: 4
|
||||
},
|
||||
|
||||
gameover:{
|
||||
key: 11,
|
||||
subkey: 6
|
||||
},
|
||||
|
||||
againgame:{
|
||||
key: 11,
|
||||
subkey: 4
|
||||
},
|
||||
|
||||
productitem:{
|
||||
key: 11,
|
||||
subkey: 8
|
||||
},
|
||||
|
||||
useitem:{
|
||||
key: 11,
|
||||
subkey: 9
|
||||
},
|
||||
|
||||
share:{
|
||||
key: 11,
|
||||
subkey: 10
|
||||
},
|
||||
|
||||
inviter:{
|
||||
key: 11,
|
||||
subkey: 11
|
||||
},
|
||||
|
||||
systeminfo:{
|
||||
key: 11,
|
||||
subkey: 20
|
||||
},
|
||||
|
||||
advinfo:{
|
||||
key: 11,
|
||||
subkey: 21
|
||||
},
|
||||
|
||||
vslogin:{
|
||||
key: 11,
|
||||
subkey: 24
|
||||
},
|
||||
|
||||
vsreconnect:{
|
||||
key: 11,
|
||||
subkey: 25
|
||||
},
|
||||
|
||||
vsroomcreate:{
|
||||
key: 11,
|
||||
subkey: 26
|
||||
},
|
||||
|
||||
vsroomjoin:{
|
||||
key: 11,
|
||||
subkey: 27
|
||||
},
|
||||
|
||||
vsroomleave:{
|
||||
key: 11,
|
||||
subkey: 28
|
||||
},
|
||||
|
||||
vsroomsetstate:{
|
||||
key: 11,
|
||||
subkey: 29
|
||||
},
|
||||
|
||||
business:{
|
||||
key: 11,
|
||||
subkey: 30
|
||||
},
|
||||
|
||||
buttonclick:{
|
||||
key: 11,
|
||||
subkey: 31
|
||||
},
|
||||
|
||||
msgevent:{
|
||||
key: 11,
|
||||
subkey: 32
|
||||
}
|
||||
};
|
||||
|
||||
const _SHOW_FLAG = 2;
|
||||
const _HIDE_FLAG = 1;
|
||||
|
||||
const _ONLINE_KEY = 'jc_online_flags';
|
||||
|
||||
// 说明:带下划线的函数是内部函数,无需关心
|
||||
|
||||
const jcgamelog = {
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {},
|
||||
|
||||
// start () {},
|
||||
|
||||
// update (dt) {},
|
||||
__uuid(len, radix) {
|
||||
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
||||
var uuid = [], i;
|
||||
radix = radix || chars.length;
|
||||
|
||||
if (len) {
|
||||
// Compact form
|
||||
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
|
||||
} else {
|
||||
// rfc4122, version 4 form
|
||||
var r;
|
||||
|
||||
// rfc4122 requires these characters
|
||||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
|
||||
uuid[14] = '4';
|
||||
|
||||
// Fill in random data. At i==19 set the high bits of clock sequence as
|
||||
// per rfc4122, sec. 4.1.5
|
||||
for (i = 0; i < 36; i++) {
|
||||
if (!uuid[i]) {
|
||||
r = 0 | Math.random() * 16;
|
||||
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uuid.join('');
|
||||
},
|
||||
|
||||
_buildReportUrl(typeobj){
|
||||
this.urlbd.clear();
|
||||
this.urlbd.addKV('c', 'GameLog')
|
||||
.addKV('a', 'reportLog')
|
||||
.addKV('gameid', this.gameid)
|
||||
.addKV('channel', this.channelid)
|
||||
.addKV('account_id', this.accountid)
|
||||
.addKV('session_id', this.sessionid)
|
||||
.addKV('access_token', this.token)
|
||||
.addKV('wid', this.wid)
|
||||
.addKV('sid', this.sid)
|
||||
.addKV('ptid', this.ptid)
|
||||
.addKV('logclass1', typeobj.key)
|
||||
.addKV('logclass2', typeobj.subkey)
|
||||
.addKV('localuuid', this.localid)
|
||||
.addKV('from_appid', this.fromid)
|
||||
;
|
||||
//console.log("[gamelog]");
|
||||
//console.log(JSON.stringify(typeobj));
|
||||
return this.urlbd.baseurl;
|
||||
},
|
||||
|
||||
_buildReportUserUrl(){
|
||||
this.urlbd.clear();
|
||||
this.urlbd.addKV('c', 'GameLog')
|
||||
.addKV('a', 'reportUser')
|
||||
.addKV('gameid', this.gameid)
|
||||
.addKV('channel', this.channelid)
|
||||
.addKV('account_id', this.accountid)
|
||||
.addKV('session_id', this.sessionid)
|
||||
.addKV('access_token', this.token)
|
||||
;
|
||||
return this.urlbd.baseurl;
|
||||
},
|
||||
|
||||
_buildShowHideMsg(showflag){
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
str2: this.fromid,
|
||||
str3: this.accountid,
|
||||
str4: this.nickName,
|
||||
num1: showflag,
|
||||
num2: -1
|
||||
};
|
||||
|
||||
let msg = {
|
||||
u: this._buildReportUrl(showflag == _SHOW_FLAG? JC_LOG_T.show: JC_LOG_T.hide),
|
||||
v: JSON.stringify(data),
|
||||
ext: showflag
|
||||
};
|
||||
|
||||
return msg;
|
||||
},
|
||||
|
||||
_report(typeobj, valueobj, successcb, failcb){
|
||||
let url = this._buildReportUrl(typeobj);
|
||||
let value = JSON.stringify(valueobj);
|
||||
var self = this;
|
||||
httpclient.httpPost(url, value, function(restext){
|
||||
let obj = httpclient.JSON_parse(restext);
|
||||
if(obj.errcode == 0){
|
||||
//console.log('[_report]success!'+JSON.stringify(obj));
|
||||
successcb && successcb();
|
||||
}else{
|
||||
//console.log('[_report]'+url);
|
||||
//console.log('[_report]failed!'+obj.errcode+":"+obj.errmsg);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
}, function(errcode, errmsg){
|
||||
//console.log('[_report]'+url);
|
||||
//console.log('[_report]failed!'+errcode+":"+errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
let nflag = -1;
|
||||
if(typeobj.key == JC_LOG_T.show.key && typeobj.subkey == JC_LOG_T.show.subkey){
|
||||
nflag = valueobj.num1;
|
||||
}
|
||||
let msg = {
|
||||
u: url,
|
||||
v: value,
|
||||
ext: nflag
|
||||
}
|
||||
self.cachemsg.push(msg);
|
||||
});
|
||||
},
|
||||
|
||||
_reportUser(valueobj, successcb, failcb){
|
||||
let url = this._buildReportUserUrl();
|
||||
let value = JSON.stringify(valueobj);
|
||||
var self = this;
|
||||
httpclient.httpPost(url, value, function(restext){
|
||||
let obj = httpclient.JSON_parse(restext);
|
||||
if(obj.errcode == 0){
|
||||
//console.log('[_reportUser]success!'+JSON.stringify(obj));
|
||||
successcb && successcb();
|
||||
}else{
|
||||
//console.log('[_reportUser]failed!'+obj.errcode+":"+obj.errmsg);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
}, function(errcode, errmsg){
|
||||
//console.log('[_reportUser]failed!'+errcode+":"+errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
let nflag = -1;
|
||||
let msg = {
|
||||
u: url,
|
||||
v: value,
|
||||
ext: nflag
|
||||
}
|
||||
self.cachemsg.push(msg);
|
||||
});
|
||||
},
|
||||
|
||||
_retry(){
|
||||
if(this.cachemsg.length > 0){
|
||||
let obj = this.cachemsg[0];
|
||||
var self = this;
|
||||
httpclient.httpPost(obj.u, obj.v, function(restext){
|
||||
if(obj.ext >= 0){
|
||||
self.showflag = obj.ext;
|
||||
self._saveflag(self.showflag);
|
||||
}
|
||||
self.cachemsg.shift();
|
||||
}, function(errcode, errmsg){
|
||||
//console.log('[_retry_report]failed!'+errcode+":"+errmsg);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_saveflag(showflag){
|
||||
},
|
||||
|
||||
_loadflag(){
|
||||
},
|
||||
|
||||
_handlelaunch(res){
|
||||
if(res){
|
||||
if(res.query && res.query.weixinadinfo){
|
||||
let wxaddr = res.query.weixinadinfo.split('.');
|
||||
let ad = wxaddr[0];
|
||||
if(ad && ad != ''){
|
||||
this.fromadvid = ad;
|
||||
}
|
||||
}
|
||||
this.launchparam = res.query;
|
||||
if(res.referrerInfo && res.referrerInfo.appId){
|
||||
this.setFromAppID(res.referrerInfo.appId);
|
||||
this.launchparam = res.referrerInfo.extraData;
|
||||
}else if(res.query && res.query.scene){
|
||||
this.setFromAppID(res.query.scene);
|
||||
}
|
||||
this.scene = res.scene? res.scene: 0;
|
||||
}
|
||||
},
|
||||
|
||||
_handleLoginInfo(res){
|
||||
if(res.account_id && res.session_id){
|
||||
this.setAccountID(res.account_id, res.session_id);
|
||||
}
|
||||
if(res && res.nickname && res.nickname != ''){
|
||||
this.setNickName(res.nickname);
|
||||
}
|
||||
},
|
||||
|
||||
_handleAuthInfo(res){
|
||||
if(res && res.nickname && res.nickname != ''){
|
||||
this.setNickName(res.nickname);
|
||||
}
|
||||
},
|
||||
|
||||
//【通用函数】生成本地匿名ID
|
||||
generateUUID(){
|
||||
return this.__uuid(32, 62);
|
||||
},
|
||||
|
||||
// 初始化(上报前必须调用此函数)【使用jcfw.init的话此函数无需手动调用】
|
||||
init(channelid, gameid, isoffical, owner, url){
|
||||
this.gameid = gameid;
|
||||
this.channelid = channelid;
|
||||
this.accountid = this.accountid? this.accountid: '';
|
||||
this.sessionid = this.sessionid? this.sessionid: '';
|
||||
this.token = this.token? this.token: '';
|
||||
this.localid = this.localid? this.localid: '';
|
||||
this.nickname = this.nickname? this.nickname: '';
|
||||
this.fromid = this.fromid? this.fromid: '';
|
||||
this.fromadvid = this.fromadvid? this.fromadvid: '';
|
||||
this.scene = this.scene? this.scene: 0;
|
||||
this._tempuuid = '';
|
||||
this._starttime = 0;
|
||||
this._launchtime = 0;
|
||||
this.needsubmit = false;
|
||||
this.urlbd = new urlbuilder(url);
|
||||
this.showflag = this._loadflag();
|
||||
this.cachemsg = [];
|
||||
if(this.showflag == _SHOW_FLAG){
|
||||
this.cachemsg.push(this._buildShowHideMsg(this.showflag));
|
||||
}
|
||||
this.showflag = null;
|
||||
setInterval(this._retry.bind(this), 5000);
|
||||
//console.log("[jcgamelog]init:"+gameid + "|" + channelid + "|" + isoffical);
|
||||
},
|
||||
|
||||
// 【暂未使用】
|
||||
setSubmitFlag(bsubmit){
|
||||
this.needsubmit = bsubmit;
|
||||
},
|
||||
|
||||
// 登陆成功后调用,传入accountid和sessionid【使用jcfw.login的话此函数无需手动调用】
|
||||
setAccountID(accountid, sessionid, exobj){
|
||||
if(!this.accountid || this.accountid != accountid){
|
||||
this.accountid = accountid;
|
||||
}
|
||||
if(!this.sessionid || this.sessionid != sessionid){
|
||||
this.sessionid = sessionid;
|
||||
}
|
||||
if(exobj){
|
||||
this.wid = exobj.wid;
|
||||
this.sid = exobj.sid;
|
||||
this.ptid = exobj.ptid;
|
||||
}
|
||||
},
|
||||
|
||||
// 设置昵称【无需手动调用】
|
||||
setNickName(nickname){
|
||||
if(!this.nickname || this.nickname != nickname){
|
||||
this.nickname = nickname;
|
||||
}
|
||||
},
|
||||
|
||||
// 设置本app从哪个appid跳转过来的【使用jcfw.init的话此函数无需手动调用】
|
||||
setFromAppID(appid){
|
||||
if(!this.fromid || this.fromid != appid){
|
||||
this.fromid = appid;
|
||||
}
|
||||
},
|
||||
|
||||
// 设置本地匿名ID(本地生成匿名id后调用)【使用jcfw.init的话此函数无需手动调用】
|
||||
setLocalUUID(uuid){
|
||||
if(!this.localid || this.localid != uuid){
|
||||
this.localid = uuid;
|
||||
}
|
||||
},
|
||||
|
||||
setSystemInfo(info){
|
||||
|
||||
},
|
||||
|
||||
// 【暂未使用】
|
||||
setToken(token){
|
||||
this.token = token;
|
||||
},
|
||||
|
||||
handlelaunch(res, cb){
|
||||
this._launchtime = new Date().getTime();
|
||||
var param = 0;
|
||||
var uid = '';
|
||||
var stype = 0;
|
||||
var invid = '';
|
||||
if(res){
|
||||
this._handlelaunch(res);
|
||||
param = res.query.activity_param? res.query.activity_param: 0;
|
||||
uid = res.query.localuuid? res.query.localuuid: '';
|
||||
stype = res.query.sharetype? res.query.sharetype: 0;
|
||||
invid = res.query.inviter_id? res.query.inviter_id: '';
|
||||
}
|
||||
this.logLauchDefault(res);
|
||||
cb && cb(stype, param, uid, invid, this.fromid, this.scene, this.launchparam);
|
||||
},
|
||||
|
||||
//////////////////统计函数////////////////////
|
||||
// 启动游戏--------游戏启动后上报【使用jcfw.init的话此函数无需手动调用】
|
||||
logLaunch(launch_option){
|
||||
this._launchtime = new Date().getTime();
|
||||
this._handlelaunch(launch_option);
|
||||
this.logLauchDefault(launch_option);
|
||||
},
|
||||
|
||||
//启动游戏(内部调用)
|
||||
logLauchDefault(launch_option){
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
str2: this.fromid,
|
||||
ext: launch_option? JSON.stringify(launch_option): null,
|
||||
str3: this.fromadvid,
|
||||
num1: this.scene
|
||||
}
|
||||
this._report(JC_LOG_T.lauch, data);
|
||||
},
|
||||
|
||||
// 登陆成功--------游戏登陆成功后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
logLoginSuccess(res, costtime){
|
||||
let nowtime = new Date().getTime();
|
||||
let dttime = nowtime - this._launchtime;
|
||||
this._handleLoginInfo(res);
|
||||
let data = {
|
||||
str1: res.nickname,
|
||||
str2: res.unionid,
|
||||
str3: res.country,
|
||||
str4: res.province,
|
||||
str5: res.city,
|
||||
str6: this.localid,
|
||||
num1: costtime? costtime: 0,
|
||||
num2: dttime,
|
||||
str7: this.fromadvid
|
||||
}
|
||||
//console.log('[launchcost]'+dttime);
|
||||
this._report(JC_LOG_T.logined, data);
|
||||
},
|
||||
|
||||
// 登陆失败---------游戏登陆失败后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
logLoginFailed(neterr, logicerr, errmsg){
|
||||
let data = {
|
||||
error_code_net: neterr,
|
||||
error_code_logic: logicerr,
|
||||
error_msg: errmsg
|
||||
};
|
||||
this._report(JC_LOG_T.loginFailed, data);
|
||||
},
|
||||
|
||||
// 授权成功--------微信获取userinfo后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
logAuthSuccess(res){
|
||||
this._handleAuthInfo(res);
|
||||
let data = {
|
||||
str1: res.nickName,
|
||||
num1: res.gender,
|
||||
str3: res.country,
|
||||
str4: res.province,
|
||||
str5: res.city,
|
||||
str6: this.localid,
|
||||
str7: res.avatarUrl? res.avatarUrl: '',
|
||||
str8: res.language
|
||||
}
|
||||
this._report(JC_LOG_T.authed, data);
|
||||
},
|
||||
|
||||
// 授权失败--------微信获取userinfo时,用户拒绝授权后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
logAuthFail(){
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
str2: this.localid
|
||||
}
|
||||
this._report(JC_LOG_T.authfail, data);
|
||||
},
|
||||
|
||||
// 分享---------------用户分享时上报【使用jcfw.shareNormal/shareCapture的话此函数无需手动调用】
|
||||
logShare(businessid, sharetokenid, param){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: sharetokenid? sharetokenid: '',
|
||||
num1: businessid,
|
||||
str3: param? param: ''
|
||||
}
|
||||
this._report(JC_LOG_T.share, data);
|
||||
},
|
||||
|
||||
// 分享点击-------------当用户点击别人分享的卡片进入游戏时上报【使用jcfw.login的话此函数无需手动调用】
|
||||
logShareInvite(inviterid, businessid, sharetokenid, param){
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
str2: inviterid,
|
||||
num1: businessid,
|
||||
str3: sharetokenid? sharetokenid: sharetokenid,
|
||||
str4: param? param: ''
|
||||
}
|
||||
this._report(JC_LOG_T.inviter, data);
|
||||
},
|
||||
|
||||
// 系统信息-------------获取用户系统信息后上报【使用jcfw.init的话此函数无需手动调用】
|
||||
logSysInfo(res, typeobj){
|
||||
let data = {
|
||||
str1: res.brand,
|
||||
str2: res.model,
|
||||
str3: res.language,
|
||||
str4: res.version,
|
||||
str5: res.platform,
|
||||
str6: res.SDKVersion,
|
||||
str7: res.system,
|
||||
num1: res.pixelRatio,
|
||||
num2: res.screenWidth,
|
||||
num3: res.screenHeight,
|
||||
num4: res.windowWidth,
|
||||
num5: res.windowHeight,
|
||||
num6: res.benchmarkLevel
|
||||
// ext: JSON.stringify(res)
|
||||
};
|
||||
this._report(typeobj, data);
|
||||
},
|
||||
|
||||
logSystemInfo(res){
|
||||
if(!res){
|
||||
return;
|
||||
}
|
||||
this.logSysInfo(res, JC_LOG_T.systeminfo);
|
||||
},
|
||||
|
||||
logLaunchSystemInfo(res){
|
||||
if(!res){
|
||||
return;
|
||||
}
|
||||
this.logSysInfo(res, JC_LOG_T.launchsysteminfo);
|
||||
},
|
||||
|
||||
// 开始游戏---------开始一局游戏时上报【使用jcfw.gameStart的话此函数无需手动调用】
|
||||
logStartGame(param, startmode){
|
||||
this._tempuuid = this.generateUUID();
|
||||
this._starttime = new Date().getTime();
|
||||
let data = {
|
||||
str1: this.fromid,
|
||||
str2: this._tempuuid,
|
||||
str3: param? param: '',
|
||||
str4: this.nickname,
|
||||
str5: this.localid,
|
||||
num1: startmode? startmode: 0
|
||||
}
|
||||
this._report(JC_LOG_T.startgame, data);
|
||||
},
|
||||
|
||||
// 重新开始游戏---------重新开始一局游戏时上报【使用jcfw.gameStart的话此函数无需手动调用】
|
||||
logRestartGame(param){
|
||||
this._tempuuid = this.generateUUID();
|
||||
this._starttime = new Date().getTime();
|
||||
let data = {
|
||||
str1: this.fromid,
|
||||
str2: this._tempuuid,
|
||||
str3: param? param: '',
|
||||
str4: this.nickname,
|
||||
str5: this.localid,
|
||||
num1: 1
|
||||
}
|
||||
this._report(JC_LOG_T.restartgame, data);
|
||||
},
|
||||
|
||||
// 上报游戏还活着
|
||||
logGameAlive(param){
|
||||
//this._tempuuid = this.generateUUID();
|
||||
this._starttime = new Date().getTime();
|
||||
let data = {
|
||||
str1: this.fromid,
|
||||
str2: this._tempuuid,
|
||||
str3: param? param: '',
|
||||
str4: this.nickname,
|
||||
str5: this.localid,
|
||||
num1: 3
|
||||
}
|
||||
this._report(JC_LOG_T.restartgame, data);
|
||||
},
|
||||
|
||||
// 游戏结束---------本局游戏结束时上报【使用jcfw.gameOver的话此函数无需手动调用】
|
||||
logGameover(param, score, endflag){
|
||||
let nowtime = new Date().getTime();
|
||||
let data = {
|
||||
str1: this.fromid,
|
||||
str2: this._tempuuid,
|
||||
str3: param? param: '',
|
||||
num1: score,
|
||||
str4: this.nickname,
|
||||
str5: this.localid,
|
||||
num2: nowtime - this._starttime,
|
||||
num3: endflag? endflag: 0
|
||||
}
|
||||
this._report(JC_LOG_T.gameover, data);
|
||||
},
|
||||
|
||||
// 再来一次----------再来一次时上报【使用jcfw.gameStart的话此函数无需手动调用】
|
||||
logTryAgain(param){
|
||||
this._tempuuid = this.generateUUID();
|
||||
let data = {
|
||||
str1: this.fromid,
|
||||
str2: this._tempuuid,
|
||||
str3: param? param: '',
|
||||
str4: this.nickname,
|
||||
str5: this.localid,
|
||||
num1: 2
|
||||
}
|
||||
this._report(JC_LOG_T.againgame, data);
|
||||
},
|
||||
|
||||
// 显示-----------------------app显示时上报(eg:wx.onShow)【使用jcfw.gameShow的话此函数无需手动调用】
|
||||
logShow(bIgnoreFlag){
|
||||
if(!bIgnoreFlag){
|
||||
let bok = !this.showflag || this.showflag == _HIDE_FLAG;
|
||||
if(!bok){
|
||||
return;
|
||||
}
|
||||
this.showflag = _SHOW_FLAG;
|
||||
}
|
||||
|
||||
let nowtime = new Date().getTime();
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
str2: this.fromid,
|
||||
str3: this.accountid,
|
||||
str4: this.nickName,
|
||||
num1: _SHOW_FLAG,
|
||||
num2: nowtime - this._launchtime
|
||||
};
|
||||
this._report(JC_LOG_T.show, data, ()=>{
|
||||
if(!bIgnoreFlag){
|
||||
this._saveflag(this.showflag);
|
||||
}
|
||||
}, () => {
|
||||
});
|
||||
},
|
||||
|
||||
// 隐藏-----------------------app隐藏时上报(eg:wx.onHide)【使用jcfw.gameHide的话此函数无需手动调用】
|
||||
logHide(bIgnoreFlag){
|
||||
if(!bIgnoreFlag){
|
||||
let bok = this.showflag && this.showflag == _SHOW_FLAG;
|
||||
if(!bok){
|
||||
return;
|
||||
}
|
||||
this.showflag = _HIDE_FLAG;
|
||||
}
|
||||
let nowtime = new Date().getTime();
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
str2: this.fromid,
|
||||
str3: this.accountid,
|
||||
str4: this.nickName,
|
||||
num1: _HIDE_FLAG,
|
||||
num2: nowtime - this._launchtime
|
||||
};
|
||||
this._report(JC_LOG_T.hide, data, ()=>{
|
||||
if(!bIgnoreFlag){
|
||||
this._saveflag(this.showflag);
|
||||
}
|
||||
}, () => {
|
||||
});
|
||||
},
|
||||
|
||||
// 产出道具----------道具产出时上报【使用jcfw.gameGetItem的话此函数无需手动调用】
|
||||
logProductItem(itemid, itemcount, reson, resonparam){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
num1: itemid,
|
||||
num2: itemcount,
|
||||
num3: reson,
|
||||
num4: resonparam
|
||||
}
|
||||
this._report(JC_LOG_T.productitem, data);
|
||||
},
|
||||
|
||||
// 使用道具----------使用道具时上报【使用jcfw.gameUseItem的话此函数无需手动调用】
|
||||
logUseItem(itemid, itemcount, reson, resonparam){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
num1: itemid,
|
||||
num2: itemcount,
|
||||
num3: reson,
|
||||
num4: resonparam
|
||||
}
|
||||
this._report(JC_LOG_T.useitem, data);
|
||||
},
|
||||
|
||||
// 运营活动上报---------------开始运营活动时上报
|
||||
logBusiness(businessid, actionid){
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
str2: this.localid,
|
||||
num1: businessid,
|
||||
num2: actionid
|
||||
};
|
||||
this._report(JC_LOG_T.business, data);
|
||||
},
|
||||
|
||||
// 进入游戏主界面-------------主界面显示时上报
|
||||
logEnterMainScene(dt){
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
str2: this.fromid,
|
||||
num1: dt? dt: 0
|
||||
};
|
||||
this._report(JC_LOG_T.entermain, data);
|
||||
},
|
||||
|
||||
// 跳转到其他app--------------跳转到其他app时上报(eg: wx.navigateMiniProgram)
|
||||
logJumpApp(appid, appparam, jumpres){
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
str2: this.fromid,
|
||||
str3: this.accountid,
|
||||
str4: this.nickName,
|
||||
str5: appid,
|
||||
str6: appparam,
|
||||
num1: jumpres? jumpres: 0
|
||||
};
|
||||
this._report(JC_LOG_T.jumpapp, data);
|
||||
},
|
||||
|
||||
// 广告相关-----------------处理广告时上报(eg: 激励广告出现时)
|
||||
logAdvInfo(advid, actiontype, actionparam){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: advid,
|
||||
num1: actiontype,
|
||||
str3: actionparam
|
||||
};
|
||||
this._report(JC_LOG_T.advinfo, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】登陆【无需主动调用】
|
||||
logVS_login(){
|
||||
let data = {
|
||||
str1: this.nickName
|
||||
};
|
||||
this._report(JC_LOG_T.vslogin, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】重连【无需主动调用】
|
||||
logVS_reconnect(roomid){
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
str2: roomid
|
||||
};
|
||||
this._report(JC_LOG_T.vsreconnect, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】创建房间【无需主动调用】
|
||||
logVS_createRoom(roomname, maxplayer){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: roomname,
|
||||
num1: maxplayer
|
||||
};
|
||||
this._report(JC_LOG_T.vsroomcreate, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】加入房间【无需主动调用】
|
||||
logVS_joinRoom(roomid, customdata, israndom){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: roomid? roomid: '',
|
||||
num1: israndom? 1: 0,
|
||||
str3: customdata
|
||||
};
|
||||
this._report(JC_LOG_T.vsroomjoin, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】离开房间【无需主动调用】
|
||||
logVS_leaveRoom(roomid, customdata){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: roomid,
|
||||
str3: customdata
|
||||
};
|
||||
this._report(JC_LOG_T.vsroomleave, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】游戏准备【无需主动调用】
|
||||
logVS_gameReady(roomid, customdata, isready){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: roomid,
|
||||
num1: isready? 1: 0,
|
||||
str3: customdata
|
||||
};
|
||||
this._report(JC_LOG_T.vsroomsetstate, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】游戏开始【无需主动调用】
|
||||
logVS_gameStart(roomid, customdata){
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
str2: roomid,
|
||||
num1: 2,
|
||||
str3: customdata
|
||||
};
|
||||
this._report(JC_LOG_T.vsroomsetstate, data);
|
||||
},
|
||||
|
||||
// 按钮事件----------------点击按钮时上报
|
||||
logButtonClick(buttonname, param, buttonsubname){
|
||||
let data = {
|
||||
nickname: this.nickname,
|
||||
button_name: buttonname,
|
||||
button_param: param? param: ''
|
||||
};
|
||||
if(buttonsubname){
|
||||
data.button_subname = buttonsubname;
|
||||
}
|
||||
this._report(JC_LOG_T.buttonclick, data);
|
||||
},
|
||||
|
||||
logMsg(msgid, msgname, errcode, reqcontent, rspcontent, passtime){
|
||||
let data = {
|
||||
msg_id: msgid,
|
||||
msg_name: msgname,
|
||||
msg_error: errcode,
|
||||
req_content: reqcontent,
|
||||
rsp_content: rspcontent,
|
||||
msg_cosumetime: passtime
|
||||
};
|
||||
this._report(JC_LOG_T.msgevent, data);
|
||||
},
|
||||
|
||||
// 设置角色属性
|
||||
/* 调用示例:角色初始化时
|
||||
run(){
|
||||
let obj = {
|
||||
level: 1,
|
||||
money: 10000,
|
||||
...
|
||||
};
|
||||
jcfw.gamelog.userSet(obj);
|
||||
}
|
||||
*/
|
||||
userSet(kvobj){
|
||||
let data = {
|
||||
set: kvobj
|
||||
};
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
// 设置角色属性(仅允许设置一次)
|
||||
/* 调用示例:改名时(如果有此功能)
|
||||
run(){
|
||||
let obj = {
|
||||
nickname: "abc"
|
||||
};
|
||||
jcfw.gamelog.userSet(obj);
|
||||
}
|
||||
*/
|
||||
userSetOnce(kvobj){
|
||||
let data = {
|
||||
set_once: kvobj
|
||||
};
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
// 增加/减少角色数值属性
|
||||
/* 调用示例:角色升级时
|
||||
run(){
|
||||
let obj = {
|
||||
level: 1
|
||||
};
|
||||
jcfw.gamelog.userAdd(obj);
|
||||
}
|
||||
*/
|
||||
userAdd(kvobj){
|
||||
let data = {
|
||||
add: kvobj
|
||||
};
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
/*可以一次调用set/setonce/add */
|
||||
userReport(setobj, setonceobj, addobj){
|
||||
let data = {
|
||||
set: setobj,
|
||||
set_once: setonceobj,
|
||||
add: addobj
|
||||
};
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} externalID 外部调用的ID
|
||||
* @param {object} logFunc 外部调用的方法
|
||||
* @param {string} p1 参数1
|
||||
* @param {string} p2 参数2
|
||||
* @param {string} p3 参数3
|
||||
* @param {string} p4 参数4
|
||||
*/
|
||||
externalLog(externalID, logFunc, p1, p2, p3, p4){
|
||||
let tmpid = this.gameid;
|
||||
this.gameid = externalID;
|
||||
logFunc && logFunc.call(this,p1,p2,p3,p4);
|
||||
this.gameid = tmpid;
|
||||
}
|
||||
};
|
||||
|
||||
require.register('jsgamelog', function(module, exports, require) {
|
||||
module.exports = jcgamelog;
|
||||
});
|
@ -1,35 +0,0 @@
|
||||
require.register('common/urlbuilder', function(module, exports, require) {
|
||||
module.exports = function(url){
|
||||
this.orginurl = url;
|
||||
this.baseurl = url;
|
||||
this.checked = false;
|
||||
this.addKV=function(key, value){
|
||||
if(typeof(value) == 'undefined'){
|
||||
return this;
|
||||
}
|
||||
this._checkurl();
|
||||
var str = encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
this.baseurl += str;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clear=function(){
|
||||
this.baseurl = this.orginurl;
|
||||
this.checked = false;
|
||||
};
|
||||
|
||||
this._checkurl=function(){
|
||||
if(!this.checked){
|
||||
if(this.baseurl.indexOf("?") == -1){
|
||||
this.baseurl += "?";
|
||||
}else{
|
||||
this.baseurl += "&";
|
||||
}
|
||||
this.checked = true;
|
||||
}else{
|
||||
this.baseurl += "&";
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
});
|
1550
fc/js/jcmatchvs.js
2
fc/js/jquery.js
vendored
@ -1,163 +0,0 @@
|
||||
/*!
|
||||
* JavaScript Cookie v2.2.0
|
||||
* https://github.com/js-cookie/js-cookie
|
||||
*
|
||||
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||||
* Released under the MIT license
|
||||
*/
|
||||
;(function (factory) {
|
||||
var registeredInModuleLoader;
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
registeredInModuleLoader = true;
|
||||
}
|
||||
if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
registeredInModuleLoader = true;
|
||||
}
|
||||
if (!registeredInModuleLoader) {
|
||||
var OldCookies = window.Cookies;
|
||||
var api = window.Cookies = factory();
|
||||
api.noConflict = function () {
|
||||
window.Cookies = OldCookies;
|
||||
return api;
|
||||
};
|
||||
}
|
||||
}(function () {
|
||||
function extend () {
|
||||
var i = 0;
|
||||
var result = {};
|
||||
for (; i < arguments.length; i++) {
|
||||
var attributes = arguments[ i ];
|
||||
for (var key in attributes) {
|
||||
result[key] = attributes[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function decode (s) {
|
||||
return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
||||
}
|
||||
|
||||
function init (converter) {
|
||||
function api() {}
|
||||
|
||||
function set (key, value, attributes) {
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
attributes = extend({
|
||||
path: '/'
|
||||
}, api.defaults, attributes);
|
||||
|
||||
if (typeof attributes.expires === 'number') {
|
||||
attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
|
||||
}
|
||||
|
||||
// We're using "expires" because "max-age" is not supported by IE
|
||||
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
||||
|
||||
try {
|
||||
var result = JSON.stringify(value);
|
||||
if (/^[\{\[]/.test(result)) {
|
||||
value = result;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
value = converter.write ?
|
||||
converter.write(value, key) :
|
||||
encodeURIComponent(String(value))
|
||||
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||
|
||||
key = encodeURIComponent(String(key))
|
||||
.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
|
||||
.replace(/[\(\)]/g, escape);
|
||||
|
||||
var stringifiedAttributes = '';
|
||||
for (var attributeName in attributes) {
|
||||
if (!attributes[attributeName]) {
|
||||
continue;
|
||||
}
|
||||
stringifiedAttributes += '; ' + attributeName;
|
||||
if (attributes[attributeName] === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Considers RFC 6265 section 5.2:
|
||||
// ...
|
||||
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
||||
// character:
|
||||
// Consume the characters of the unparsed-attributes up to,
|
||||
// not including, the first %x3B (";") character.
|
||||
// ...
|
||||
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
||||
}
|
||||
|
||||
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
||||
}
|
||||
|
||||
function get (key, json) {
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var jar = {};
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all.
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
var i = 0;
|
||||
|
||||
for (; i < cookies.length; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var cookie = parts.slice(1).join('=');
|
||||
|
||||
if (!json && cookie.charAt(0) === '"') {
|
||||
cookie = cookie.slice(1, -1);
|
||||
}
|
||||
|
||||
try {
|
||||
var name = decode(parts[0]);
|
||||
cookie = (converter.read || converter)(cookie, name) ||
|
||||
decode(cookie);
|
||||
|
||||
if (json) {
|
||||
try {
|
||||
cookie = JSON.parse(cookie);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
jar[name] = cookie;
|
||||
|
||||
if (key === name) {
|
||||
break;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return key ? jar[key] : jar;
|
||||
}
|
||||
|
||||
api.set = set;
|
||||
api.get = function (key) {
|
||||
return get(key, false /* read as raw */);
|
||||
};
|
||||
api.getJSON = function (key) {
|
||||
return get(key, true /* read as json */);
|
||||
};
|
||||
api.remove = function (key, attributes) {
|
||||
set(key, '', extend(attributes, {
|
||||
expires: -1
|
||||
}));
|
||||
};
|
||||
|
||||
api.defaults = {};
|
||||
|
||||
api.withConverter = init;
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
return init(function () {});
|
||||
}));
|
@ -1,31 +0,0 @@
|
||||
|
||||
var log = require('jsgamelog')
|
||||
|
||||
function getParameter (t) {
|
||||
var e = window.location.search,
|
||||
i = new RegExp(t + "=([^&?]*)", "ig");
|
||||
return e.match(i) ? e.match(i)[0].substr(t.length + 1) : null
|
||||
}
|
||||
|
||||
window.log = log;
|
||||
var env = getParameter('version');
|
||||
var isTest = (!env || env==='test') ? '-test' : '';
|
||||
var url = 'https://gamelog'+isTest+'.kingsome.cn/webapp/index.php'
|
||||
|
||||
window.log.init(6001, 8004, false, '', url);
|
||||
var accountId = getParameter('account_id');
|
||||
var sessionId = getParameter('session_id')
|
||||
window.log.setAccountID(accountId, sessionId);
|
||||
|
||||
var id = getParameter('id');
|
||||
var netmode = getParameter("roomId")?1:0;
|
||||
|
||||
var logObj = {
|
||||
gid: id,
|
||||
m: netmode
|
||||
}
|
||||
window.log.logStartGame(logObj);
|
||||
|
||||
setInterval(function () {
|
||||
window.log.logGameAlive(logObj);
|
||||
}, 60000)
|
1220
fc/js/long.js
@ -1,392 +0,0 @@
|
||||
var SCREEN_WIDTH = 256;
|
||||
var SCREEN_HEIGHT = 240;
|
||||
var FRAMEBUFFER_SIZE = SCREEN_WIDTH*SCREEN_HEIGHT;
|
||||
|
||||
var canvas_ctx, image;
|
||||
var framebuffer_u8, framebuffer_u32;
|
||||
|
||||
var AUDIO_BUFFERING = 512;
|
||||
var SAMPLE_COUNT = 4*1024;
|
||||
var SAMPLE_MASK = SAMPLE_COUNT - 1;
|
||||
var audio_samples_L = new Float32Array(SAMPLE_COUNT);
|
||||
var audio_samples_R = new Float32Array(SAMPLE_COUNT);
|
||||
var audio_write_cursor = 0, audio_read_cursor = 0;
|
||||
|
||||
// require(['network.js'], function (foo) {
|
||||
// network = foo
|
||||
// });
|
||||
function getParameter (t) {
|
||||
var e = window.location.search,
|
||||
i = new RegExp(t + "=([^&?]*)", "ig");
|
||||
return e.match(i) ? e.match(i)[0].substr(t.length + 1) : null
|
||||
}
|
||||
var netmode = getParameter("roomId")?true:false;
|
||||
var worker = new Worker('./lib/jsnes.min.js');
|
||||
worker.postMessage({
|
||||
f:"netmode",
|
||||
data:netmode
|
||||
});
|
||||
|
||||
|
||||
var KEY_MAP = {
|
||||
ST: 13,
|
||||
SE: 9,
|
||||
A: 65,
|
||||
B: 83,
|
||||
Y: 50,
|
||||
X: 49,
|
||||
AB: [65, 83],
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
LEFT: 37,
|
||||
RIGHT: 39,
|
||||
L_D: [37, 40],
|
||||
L_U: [37, 38],
|
||||
R_D: [39, 40],
|
||||
R_U: [39, 38]
|
||||
};
|
||||
var player = 1;
|
||||
window.vm = {
|
||||
oldDire: null,
|
||||
keyEvent: function(t, e, i) {
|
||||
var r = KEY_MAP[t];
|
||||
Array.isArray(r) ? (vm.simulateKeyPress(r[0], e), vm.simulateKeyPress(r[1], e)) : vm.simulateKeyPress(r, e)
|
||||
},
|
||||
initCtrl: function() {
|
||||
var s;
|
||||
vm.initGameDireCtrl(function(t, e) {
|
||||
var i = -1 == t ? s : ["DOWN", "L_D", "LEFT", "L_U", "UP", "R_U", "RIGHT", "R_D"][t],
|
||||
r = -1 == t;
|
||||
s && (s != i || r) && vm.keyEvent(s, "keyup", e), s = i, !r && vm.keyEvent(i, "keydown", e)
|
||||
}), vm.initGameKeyCtrl(), $(".ctrl-wrap").on("click contextmenu touchstart touchmove touchend touchcancel tap", function(t) {
|
||||
return t.stopPropagation(), t.preventDefault(), !1
|
||||
})
|
||||
},
|
||||
initGameDireCtrl: function(u) {
|
||||
var d = this,
|
||||
t = $(".dire-wrap"),
|
||||
p = $(".dc-centre"),
|
||||
e = $(".dire-ctrl"),
|
||||
l = $(".dc-dire"),
|
||||
i = e.offset(),
|
||||
n = i.top,
|
||||
a = i.left,
|
||||
f = p.width() / 2,
|
||||
m = e.width() / 2,
|
||||
r = function() {
|
||||
p.css({
|
||||
transform: "translate3d(83px,83px,0)"
|
||||
}), p.css("opacity", "1"), l.css("opacity", "0")
|
||||
},
|
||||
y = function(t, e) {
|
||||
var i = t[e];
|
||||
if (!i) return {
|
||||
x: 160,
|
||||
y: 500
|
||||
};
|
||||
var r = i.pageX - a,
|
||||
s = i.pageY - n;
|
||||
return 600 < s ? y(t, e + 1) : {
|
||||
x: r,
|
||||
y: s
|
||||
}
|
||||
};
|
||||
r(), t.on("touchstart touchmove", function(t) {
|
||||
var e, i, r = y(t.touches, 0),
|
||||
s = r.x,
|
||||
n = r.y,
|
||||
a = Math.atan2(n - m, s - m) / (Math.PI / 180);
|
||||
if (l.css("transform", "rotate(" + a + "deg)"), d.onCtrlDire(a, u), (e = m - s, i = m - n, Math.sqrt(e * e + i * i)) <= 86) {
|
||||
var o = s - f,
|
||||
h = n - f;
|
||||
p.css("transform", "translate3d(" + o + "px," + h + "px,0)")
|
||||
} else {
|
||||
var c = a * Math.PI / 180;
|
||||
o = m + 86 * Math.cos(c) - f, h = m + 86 * Math.sin(c) - f;
|
||||
p.css("transform", "translate3d(" + o + "px," + h + "px,0)")
|
||||
}
|
||||
"touchstart" === t.type && (p.css("opacity", "0.8"), l.css("opacity", "0.6"))
|
||||
}).on("touchend", function() {
|
||||
r(), u(-1, 0), d.oldDire = -1
|
||||
})
|
||||
},
|
||||
initGameKeyCtrl: function() {
|
||||
var s = this;
|
||||
$(".key-btn").bind("touchstart touchend", function(t) {
|
||||
var e = $(t.target),
|
||||
i = e.attr("data-key"),
|
||||
r = "touchstart" === t.type;
|
||||
s.keyEvent(i, r ? "keydown" : "keyup", 0), e[r ? "addClass" : "removeClass"]("btn-on")
|
||||
})
|
||||
},
|
||||
onCtrlDire: function(t, e) {
|
||||
this.onCtrlDire;
|
||||
var i ;//= Math.round((t + 180) / 45) % 8;
|
||||
var abst = Math.abs(t);
|
||||
if((abst>=35&&abst<=55)||(abst>=125&&abst<=145)){
|
||||
i = Math.round((t + 180) / 45) % 8;
|
||||
}
|
||||
else{
|
||||
i = Math.round((t + 180) / 90) % 4*2;
|
||||
}
|
||||
this.oldDire != i && (e(i, t), this.oldDire = i)
|
||||
},
|
||||
simulateKeyPress: function(t, e) {
|
||||
if(!netmode){
|
||||
worker.postMessage({ f:"keypad",
|
||||
data:{keyCode:t,action:e}
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
var data = {
|
||||
m:NetEnum.JUMP,
|
||||
v:{
|
||||
keyCode:t,
|
||||
keyaction:e,
|
||||
player:player
|
||||
},
|
||||
}
|
||||
NetWorkManage.sendFrameEvent(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function startGame(){
|
||||
var gameId = getParameter("id")
|
||||
var path = "https://h5games-al.kingsome.cn/emulator-static/roms/" + gameId + ".nes"
|
||||
nes_load_url("screen", path)
|
||||
vm.initCtrl()
|
||||
|
||||
if(netmode){
|
||||
var roomId = getParameter("roomId")
|
||||
NetWorkManage.initengine();
|
||||
NetWorkManage.cbOnLogin = function(res){
|
||||
if(res.status==0){
|
||||
console.log(res)
|
||||
NetWorkManage.cbOnLogin = null;
|
||||
if(roomId =="0"){
|
||||
NetWorkManage.engine.createRoom('testroom',2,"");
|
||||
}
|
||||
else{
|
||||
player = 2;
|
||||
NetWorkManage.engine.joinRoom(roomId,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
NetWorkManage.cbOnJoinRoom = function(res){
|
||||
NetWorkManage.gameStart();
|
||||
};
|
||||
var updateframe =function(){
|
||||
if(NetWorkManage.frames.length >0 ){
|
||||
var fr = NetWorkManage.frames.shift();
|
||||
if(fr.isnet == true){
|
||||
NetWorkHandle.processFrame(fr);
|
||||
}
|
||||
worker.postMessage({ f:"updateframe"});
|
||||
if(fr.frameIndex<NetWorkManage.frameIndex){
|
||||
updateframe();
|
||||
}
|
||||
}
|
||||
}
|
||||
setInterval(function() {
|
||||
updateframe();
|
||||
},1000/60)
|
||||
|
||||
}
|
||||
}
|
||||
function checkSession_id(res){
|
||||
try{
|
||||
if(JSON.parse(res.target.response).errcode==0){
|
||||
startGame();
|
||||
}
|
||||
}catch(e){}
|
||||
}
|
||||
window.onload = function(){
|
||||
var noCheck = getParameter('nt');
|
||||
if (noCheck) {
|
||||
startGame()
|
||||
} else {
|
||||
var account_id = getParameter("account_id")
|
||||
var session_id = getParameter("session_id")
|
||||
var url;
|
||||
if(getParameter("version")==="product"){
|
||||
url = "https://login.kingsome.cn/webapp/index.php?c=Login&a=sessionAuth"
|
||||
}
|
||||
else{
|
||||
url = "https://login-test.kingsome.cn/webapp/index.php?c=Login&a=sessionAuth"
|
||||
}
|
||||
url += "&account_id=";
|
||||
url += account_id;
|
||||
url += "&session_id=";
|
||||
url += session_id;
|
||||
|
||||
var ajax = new XMLHttpRequest();
|
||||
ajax.onload = checkSession_id;
|
||||
ajax.open("GET", url, true);
|
||||
ajax.send(null);
|
||||
}
|
||||
}
|
||||
|
||||
var script_processor=null
|
||||
var audio_ctx = null
|
||||
function initAudioEvent() {
|
||||
script_processor && (script_processor.disconnect(audio_ctx.destination), script_processor.onaudioprocess = null, script_processor = null)
|
||||
audio_ctx && audio_ctx.close().catch(handleError)
|
||||
window.AudioContext = window.webkitAudioContext || window.AudioContext
|
||||
audio_ctx = new window.AudioContext ();
|
||||
script_processor = audio_ctx.createScriptProcessor(4096, 0, 2);
|
||||
script_processor.onaudioprocess = audio_callback;
|
||||
script_processor.connect(audio_ctx.destination);
|
||||
|
||||
$(".key-btn").unbind("touchstart", initAudioEvent)
|
||||
|
||||
}
|
||||
// function onAnimationFrame(){
|
||||
// window.requestAnimationFrame(onAnimationFrame);
|
||||
|
||||
// // image.data.set(framebuffer_u8);
|
||||
// // canvas_ctx.putImageData(image, 0, 0);
|
||||
// nes.frame();
|
||||
// }
|
||||
|
||||
function audio_remain(){
|
||||
return (audio_write_cursor - audio_read_cursor) & SAMPLE_MASK;
|
||||
}
|
||||
|
||||
function audio_callback(e){
|
||||
|
||||
// var i = e.outputBuffer.getChannelData(0),
|
||||
// s = e.outputBuffer.getChannelData(1),
|
||||
// r = i.length;
|
||||
// t.buffer.size() < 2 * r && t.onBufferUnderrun && t.onBufferUnderrun(t.buffer.size(), 2 * r);
|
||||
// try {
|
||||
// var n = t.buffer.deqN(2 * r)
|
||||
// } catch(e) {
|
||||
// for (var h = (t.buffer.size(), 0); h < r; h++) i[h] = 0,
|
||||
// s[h] = 0;
|
||||
// return
|
||||
// }
|
||||
// for (var a = 0; a < r; a++) i[a] = n[2 * a],
|
||||
// s[a] = n[2 * a + 1]
|
||||
|
||||
|
||||
|
||||
var dst = e.outputBuffer;
|
||||
var len = dst.length;
|
||||
|
||||
|
||||
|
||||
var dst_l = dst.getChannelData(0);
|
||||
var dst_r = dst.getChannelData(1);
|
||||
for(var i = 0; i < len; i++){
|
||||
var src_idx = (audio_read_cursor + i) & SAMPLE_MASK;
|
||||
dst_l[i] = audio_samples_L[src_idx];
|
||||
dst_r[i] = audio_samples_R[src_idx];
|
||||
}
|
||||
|
||||
audio_read_cursor = (audio_read_cursor + len) & SAMPLE_MASK;
|
||||
|
||||
}
|
||||
|
||||
// function keyboard(callback, event){
|
||||
// var player = 1;
|
||||
// switch(event.keyCode){
|
||||
// case 38: // UP
|
||||
// callback(player, jsnes.Controller.BUTTON_UP); break;
|
||||
// case 40: // Down
|
||||
// callback(player, jsnes.Controller.BUTTON_DOWN); break;
|
||||
// case 37: // Left
|
||||
// callback(player, jsnes.Controller.BUTTON_LEFT); break;
|
||||
// case 39: // Right
|
||||
// callback(player, jsnes.Controller.BUTTON_RIGHT); break;
|
||||
// case 65: // 'a' - qwerty, dvorak
|
||||
// case 81: // 'q' - azerty
|
||||
// callback(player, jsnes.Controller.BUTTON_A); break;
|
||||
// case 83: // 's' - qwerty, azerty
|
||||
// case 79: // 'o' - dvorak
|
||||
// callback(player, jsnes.Controller.BUTTON_B); break;
|
||||
// case 9: // Tab
|
||||
// callback(player, jsnes.Controller.BUTTON_SELECT); break;
|
||||
// case 13: // Return
|
||||
// callback(player, jsnes.Controller.BUTTON_START); break;
|
||||
// default: break;
|
||||
// }
|
||||
// }
|
||||
|
||||
function nes_init(canvas_id){
|
||||
var canvas = document.getElementById(canvas_id);
|
||||
canvas_ctx = canvas.getContext("2d");
|
||||
image = canvas_ctx.getImageData(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
canvas_ctx.fillStyle = "black";
|
||||
canvas_ctx.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
// Allocate framebuffer array.
|
||||
var buffer = new ArrayBuffer(image.data.length);
|
||||
|
||||
worker.postMessage({
|
||||
f:"setBuffer",
|
||||
data:image.data.length
|
||||
});
|
||||
|
||||
|
||||
framebuffer_u8 = new Uint8ClampedArray(buffer);
|
||||
framebuffer_u32 = new Uint32Array(buffer);
|
||||
$(".key-btn").bind("touchstart", initAudioEvent)
|
||||
// Setup audio.
|
||||
// var aaa = window.webkitAudioContext || window.AudioContext
|
||||
// var audio_ctx = new aaa();
|
||||
// var script_processor = audio_ctx.createScriptProcessor(4096, 0, 2);
|
||||
// script_processor.onaudioprocess = audio_callback;
|
||||
// script_processor.connect(audio_ctx.destination);
|
||||
}
|
||||
var bodgeInterval
|
||||
function nes_boot(rom_data){
|
||||
worker.postMessage({
|
||||
f:"nesloadROM",
|
||||
data:rom_data
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// function nes_load_data(canvas_id, rom_data){
|
||||
// nes_init(canvas_id);
|
||||
// nes_boot(rom_data);
|
||||
// }
|
||||
|
||||
function nes_load_url(canvas_id, path){
|
||||
nes_init(canvas_id);
|
||||
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("GET", path);
|
||||
req.overrideMimeType("text/plain; charset=x-user-defined");
|
||||
req.onerror = () => console.log(`Error loading ${path}: ${req.statusText}`);
|
||||
|
||||
req.onload = function() {
|
||||
if (this.status === 200) {
|
||||
nes_boot(this.responseText);
|
||||
} else if (this.status === 0) {
|
||||
// Aborted, so ignore error
|
||||
} else {
|
||||
req.onerror();
|
||||
}
|
||||
};
|
||||
|
||||
req.send();
|
||||
}
|
||||
worker.onmessage = function(event){
|
||||
if(event.data.f == "frame"){
|
||||
// framebuffer_u8 = event.data.data
|
||||
image.data.set(event.data.data.framebuffer_u8);
|
||||
canvas_ctx.putImageData(image, 0, 0);
|
||||
|
||||
audio_samples_L=event.data.data.audio_samples_L
|
||||
audio_samples_R=event.data.data.audio_samples_R
|
||||
audio_read_cursor=event.data.data.audio_read_cursor
|
||||
}
|
||||
}
|
||||
// document.addEventListener('keydown', (event) => {keyboard(nes.buttonDown, event)});
|
||||
// document.addEventListener('keyup', (event) => {keyboard(nes.buttonUp, event)});
|
@ -1,12 +0,0 @@
|
||||
var NetEnum ={
|
||||
STARTGAME:1,
|
||||
ENTERGAME:2,
|
||||
CHANGECLOTH:3,
|
||||
JUMP:100,
|
||||
USEITEM:101,
|
||||
ENDITEM:102,
|
||||
STARTMATCH:103,
|
||||
SETROBOT:104,
|
||||
}
|
||||
|
||||
module.exports = NetEnum
|
329
fc/js/network.js
@ -1,329 +0,0 @@
|
||||
var jsMatchvs = JCMatchVS
|
||||
var jcmsghandler = JCMsgHandler
|
||||
|
||||
|
||||
|
||||
nwm = function(){
|
||||
this.response = null;
|
||||
this.online = false;
|
||||
this.engine = null;
|
||||
this.roomUserInfoList = [];
|
||||
this.frames=[];
|
||||
this.inRoom = false;
|
||||
|
||||
|
||||
this.cleanCb = function(){
|
||||
this.cbOnLogin = null;
|
||||
this.cbOnCreateRoom =null;
|
||||
this.cbOnJoinRoom = null;
|
||||
this.cbjoinRoomNotify = null;
|
||||
this.cbleaveRoomNotify = null;
|
||||
this.cbRoomMerge = null;
|
||||
};
|
||||
this.clean = function(){
|
||||
this.online = false;
|
||||
this.frameIndex = 0;
|
||||
this.cleanCb();
|
||||
this.roomUserInfoList = [];
|
||||
if(this.engine){
|
||||
this.engine.loginOut();
|
||||
this.engine.reconnectcount = 999;
|
||||
this.engine.disconnect();
|
||||
this.engine = null;
|
||||
}
|
||||
|
||||
}
|
||||
this.init = function(){
|
||||
var response = new jcmsghandler();
|
||||
NetWorkHandle.NetWorkManage = this;
|
||||
var self = this;
|
||||
response.initResponse = function(res){
|
||||
if(res.status==0){
|
||||
self.engine.login();
|
||||
}
|
||||
}
|
||||
response.netResponse = function(res){
|
||||
if(res.status==0){
|
||||
console.log('net 成功');
|
||||
}
|
||||
}
|
||||
response.joinRoomResponse= function(res){
|
||||
// console.log(res);
|
||||
if(!(res.status==0||res.status==-3)){
|
||||
wx.miniProgram.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
else{
|
||||
if(self.cbOnJoinRoom){
|
||||
self.cbOnJoinRoom(res);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
response.joinRoomNotify= function(res){
|
||||
// var temp = res;
|
||||
// temp.userProfile = JSON.parse(temp.userProfile);
|
||||
// self.roomUserInfoList.push(temp);
|
||||
hideInviteMask();
|
||||
if(self.cbjoinRoomNotify){
|
||||
self.cbjoinRoomNotify(res);
|
||||
}
|
||||
}
|
||||
response.loginResponse = function(res){
|
||||
if(res.status==0){
|
||||
self.online = true;
|
||||
console.log('login成功');
|
||||
//console.log(res);
|
||||
|
||||
}
|
||||
if(self.cbOnLogin){
|
||||
self.cbOnLogin(res);//create or join
|
||||
}
|
||||
}
|
||||
response.createRoomResponse= function(res){
|
||||
if(res.status==0){
|
||||
console.log('createRoom成功');
|
||||
console.log(res.roomID);
|
||||
self.roomID = res.roomID;
|
||||
wx.miniProgram.postMessage({ data: self.roomID })
|
||||
showInviteMask();
|
||||
}
|
||||
if(self.cbOnCreateRoom){
|
||||
self.cbOnCreateRoom(res);
|
||||
}
|
||||
}
|
||||
response.sendEventResponse = function(res) {
|
||||
console.log('自己广播');
|
||||
res.srcUserId = SDKManage.account_id;
|
||||
console.log(res);
|
||||
NetWorkHandle.process(res);
|
||||
}
|
||||
response.sendRoomEvtNotify= function(res){
|
||||
console.log("收到广播")
|
||||
console.log(res);
|
||||
NetWorkHandle.process(res);
|
||||
}
|
||||
response.reconnectResponse = function(){
|
||||
|
||||
}
|
||||
|
||||
response.sendFrameEventResponse = function (res) {
|
||||
|
||||
}
|
||||
response.joinOverResponse = function(res) {
|
||||
console.log("joinOverResponse");
|
||||
console.log(res);
|
||||
}
|
||||
|
||||
//自己离开房间回调
|
||||
response.leaveRoomResponse = function(res) {
|
||||
console.log('自己离开房间');
|
||||
console.log( res);
|
||||
}
|
||||
//其他成员离开房间回调
|
||||
response.leaveRoomNotify = function(res) {
|
||||
console.log('其他成员离开房间');
|
||||
console.log(res);
|
||||
for(var i = 0;i<self.roomUserInfoList.length;i++){
|
||||
if(self.roomUserInfoList[i].userId == res.userId){
|
||||
self.roomUserInfoList.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(self.cbleaveRoomNotify){
|
||||
self.cbleaveRoomNotify(res);
|
||||
}
|
||||
}
|
||||
response.logoutResponse = function(res) {
|
||||
console.log("登出")
|
||||
console.log(res);
|
||||
}
|
||||
|
||||
response.gameStartResponse= function(res) {
|
||||
console.log("gameStart");
|
||||
console.log(res);
|
||||
self.engine.joinOver();
|
||||
self.engine.setFrameSync(10);
|
||||
}
|
||||
response.frameUpdate = function(res){
|
||||
res.isnet = true;
|
||||
self.frames.push(res);
|
||||
for(var i=0;i<5;i++){
|
||||
self.frames.push({frameIndex:res.frameIndex,isnet:false});
|
||||
}
|
||||
self.frameIndex = res.frameIndex;
|
||||
}
|
||||
response.setFrameSyncResponse= function(res){
|
||||
}
|
||||
response.joinOverRoomNotify = function(res){
|
||||
|
||||
}
|
||||
response.netWorkStateNotify= function(res){
|
||||
console.log(res);
|
||||
if(res.state ==1){
|
||||
for(var i = 0;i<self.roomUserInfoList.length;i++){
|
||||
if(self.roomUserInfoList[i].userId == res.userID){
|
||||
self.roomUserInfoList.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(self.cbleaveRoomNotify){
|
||||
self.cbleaveRoomNotify(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
response.joinOverResponse= function(res){
|
||||
console.log(res);
|
||||
}
|
||||
|
||||
response.onSMSetRoomParam = function(res){
|
||||
console.log(res);
|
||||
}
|
||||
response.onSMRoomMergeNotify = function(res){
|
||||
console.log(res);
|
||||
self.roomUserInfoList = [];
|
||||
for(var i=0;i<res.target_room_user_info_list.length;i++){
|
||||
var temp = res.target_room_user_info_list[i];
|
||||
temp.userProfile = JSON.parse(temp.user_profile);
|
||||
temp.userId = temp.account_id;
|
||||
self.roomUserInfoList.push(temp);
|
||||
}
|
||||
if(self.cbRoomMerge){
|
||||
self.cbRoomMerge(res)
|
||||
}
|
||||
}
|
||||
response.destroyRoomNotify= function(res){
|
||||
self.frames = [];
|
||||
}
|
||||
response.onSMResetRoom= function(res){
|
||||
|
||||
}
|
||||
jcmsghandler.prototype.pushMsg = function(res){
|
||||
|
||||
}
|
||||
this.response = response;
|
||||
setInterval(function() {
|
||||
self.heart();
|
||||
},
|
||||
10000)
|
||||
};
|
||||
this.heart = function(dt){
|
||||
if(this.online&&this.engine){
|
||||
this.engine.heart();
|
||||
}
|
||||
}
|
||||
this.initengine = function(){
|
||||
this.clean();
|
||||
var engine = new jsMatchvs();
|
||||
engine.__classCreate();
|
||||
engine.init(this.response, 6001, 'beta', "8004", null);
|
||||
engine.setUserId((new Date()).getTime().toString());
|
||||
engine.setToken("");
|
||||
engine.reconnectmax = -1;
|
||||
this.engine = engine;
|
||||
return this.engine;
|
||||
};
|
||||
this.leaveRoom =function(){
|
||||
if(this.engine){
|
||||
this.engine.leaveRoom();
|
||||
}
|
||||
};
|
||||
this.joinOver=function(){
|
||||
if(this.engine){
|
||||
this.engine.joinOver();
|
||||
}
|
||||
};
|
||||
this.sendRoomEvent=function(v){
|
||||
if(this.engine){
|
||||
this.engine.sendRoomEvent(JSON.stringify(v));
|
||||
}
|
||||
}
|
||||
this.sendFrameEvent=function(v){
|
||||
if(this.engine){
|
||||
this.engine.sendFrameEvent(JSON.stringify(v));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.startGame = function(){
|
||||
var data = {
|
||||
m:NetEnum.STARTGAME,
|
||||
}
|
||||
this.sendRoomEvent(data);
|
||||
this.playerCount = this.roomUserInfoList.length-Main.robotCount;
|
||||
}
|
||||
|
||||
this.enterGame =function(){
|
||||
var data = {
|
||||
m:NetEnum.ENTERGAME,
|
||||
}
|
||||
this.sendRoomEvent(data);
|
||||
}
|
||||
this.onEnter = function(){
|
||||
if(this.engine){
|
||||
this.engine.gameStart('go');
|
||||
}
|
||||
};
|
||||
this.gameStart= function(){
|
||||
this.engine.gameStart('go');
|
||||
};
|
||||
this.sendJump= function(){
|
||||
var data = {
|
||||
m:NetEnum.JUMP,
|
||||
}
|
||||
this.sendFrameEvent(data);
|
||||
};
|
||||
|
||||
this.useItem= function(itemid){
|
||||
var data = {
|
||||
m:NetEnum.USEITEM,
|
||||
v:itemid,
|
||||
}
|
||||
this.sendFrameEvent(data);
|
||||
};
|
||||
this.endItem= function(itemid){
|
||||
var data = {
|
||||
m:NetEnum.ENDITEM,
|
||||
v:itemid,
|
||||
}
|
||||
this.sendFrameEvent(data);
|
||||
};
|
||||
|
||||
this.changeCloth = function(cid){
|
||||
var data = {
|
||||
m:NetEnum.CHANGECLOTH,
|
||||
v:cid
|
||||
}
|
||||
this.sendRoomEvent(data);
|
||||
}
|
||||
this.startMatch = function(){
|
||||
var data = {
|
||||
m:NetEnum.STARTMATCH,
|
||||
}
|
||||
this.sendRoomEvent(data);
|
||||
}
|
||||
|
||||
this.setRobot = function(c){
|
||||
var data = {
|
||||
m:NetEnum.SETROBOT,
|
||||
v:c
|
||||
}
|
||||
this.sendRoomEvent(data);
|
||||
}
|
||||
this.setRoomParam =function(v){
|
||||
if(this.engine){
|
||||
this.engine.setRoomParam(v);
|
||||
}
|
||||
};
|
||||
|
||||
this.resetRoom =function(){
|
||||
if(this.engine){
|
||||
this.engine.resetRoom(0);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
NetWorkManage = new nwm();
|
||||
NetWorkManage.init();
|
@ -1,37 +0,0 @@
|
||||
$(function () {
|
||||
let keyType = Cookies.get('key_type') || 'N';
|
||||
console.log(`keyType: ${keyType}`);
|
||||
let setKeyType = function (keyType) {
|
||||
$("[name=key_type]").val([keyType]);
|
||||
if (keyType === 'N') {
|
||||
$('#ctrl-wrap').addClass('real');
|
||||
$('#menu_btn').addClass('real');
|
||||
} else {
|
||||
$('#ctrl-wrap').removeClass('real');
|
||||
$('#menu_btn').removeClass('real');
|
||||
}
|
||||
Cookies.set('key_type', keyType);
|
||||
}
|
||||
setKeyType(keyType);
|
||||
$('#menu_btn').click(function () {
|
||||
console.log('menu btn click');
|
||||
showMenu();
|
||||
});
|
||||
let showMenu = function() {
|
||||
$('#menu_back').show();
|
||||
$('#menu_container').removeClass('hidden');
|
||||
}
|
||||
let hideMenu = function() {
|
||||
$('#menu_back').hide();
|
||||
$('#menu_container').addClass('hidden');
|
||||
}
|
||||
|
||||
$('#cancel_btn').click(function () {
|
||||
hideMenu();
|
||||
})
|
||||
$('#save_btn').click(function () {
|
||||
keyType = $('input[name="key_type"]:checked').val();
|
||||
setKeyType(keyType);
|
||||
hideMenu();
|
||||
})
|
||||
})
|
5246
fc/js/protobuf.js
@ -1,50 +0,0 @@
|
||||
// Usage
|
||||
//
|
||||
// require.register("browser/debug.js", function(module, exports, require){
|
||||
// // Module code goes here
|
||||
// });
|
||||
//
|
||||
// var debug = require("browser/debug.js");
|
||||
|
||||
function require(p){
|
||||
var path = require.resolve(p);
|
||||
var mod = require.modules[path];
|
||||
if (!mod) throw new Error('failed to require "' + p + '"');
|
||||
if (!mod.exports) {
|
||||
mod.exports = {};
|
||||
mod.call(mod.exports, mod, mod.exports, require.relative(path));
|
||||
}
|
||||
return mod.exports;
|
||||
}
|
||||
|
||||
require.modules = {};
|
||||
|
||||
require.resolve = function (path){
|
||||
var orig = path;
|
||||
var reg = path + '.js';
|
||||
var index = path + '/index.js';
|
||||
return require.modules[reg] && reg
|
||||
|| require.modules[index] && index
|
||||
|| orig;
|
||||
};
|
||||
|
||||
require.register = function (path, fn){
|
||||
require.modules[path] = fn;
|
||||
};
|
||||
|
||||
require.relative = function (parent) {
|
||||
return function(p){
|
||||
if ('.' != p.charAt(0)) return require(p);
|
||||
var path = parent.split('/');
|
||||
var segs = p.split('/');
|
||||
path.pop();
|
||||
|
||||
for (var i = 0; i < segs.length; i++) {
|
||||
var seg = segs[i];
|
||||
if ('..' == seg) path.pop();
|
||||
else if ('.' != seg) path.push(seg);
|
||||
}
|
||||
|
||||
return require(path.join('/'));
|
||||
};
|
||||
};
|
122
fc/lib/jsnes.min.js
vendored
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 386 KiB |
122
fc/resources/jsnes.min.js
vendored
@ -1,372 +0,0 @@
|
||||
//syntax = "proto2";
|
||||
|
||||
package kingsomevs;
|
||||
|
||||
/*
|
||||
约定:
|
||||
CM前缀:客户端发给服务器的消息(client message)
|
||||
SM前缀:服务器发给客户的的消息(server message)
|
||||
MF前缀:消息的内嵌字段,只能作为其他消息的内嵌字段不能send(message field)
|
||||
custom_data: 自定义用户数据,透传数据
|
||||
_e后缀:枚举类型
|
||||
|
||||
网络包格式:msghead + msgbody
|
||||
msghead: packagelen + msgid + magiccode = 2 + 2 + 4 = 8字节
|
||||
msgbody: protobuf数据
|
||||
msghead说明
|
||||
packagelen(unsigned short): 双字节网络包长度,
|
||||
msgid(unsigned short): 双字节消息id
|
||||
magiccode(unsigned int): 4字节魔数,并且为固定常数0xAABBCCAA,占位符客户端不需什么处理
|
||||
*/
|
||||
|
||||
//操作结果公用类型
|
||||
message MFOptResult
|
||||
{
|
||||
optional int32 error_code = 1; //错误代码
|
||||
optional string error_msg = 2; //错误描述
|
||||
optional string debug_msg = 3; //调试用
|
||||
}
|
||||
|
||||
//房间用户信息
|
||||
message MFRoomUserInfo
|
||||
{
|
||||
optional string account_id = 1; //用户id
|
||||
optional string user_profile = 2; //玩家简介,可以填写昵称、段位等信息
|
||||
optional int32 user_idx = 3; //用户索引,按用户加入房间的顺序递增
|
||||
}
|
||||
|
||||
//房间机器人信息
|
||||
message MFRoomRobotInfo
|
||||
{
|
||||
optional string robot_uniid = 1; //机器人唯一id
|
||||
optional string robot_name = 2; //机器人名字
|
||||
optional string avatar_url = 3; //头像地址,空的话本地随机头像
|
||||
}
|
||||
|
||||
//房间事件信息
|
||||
message MFRoomEventInfo
|
||||
{
|
||||
optional string custom_data = 1; //透传字段
|
||||
optional string src_account_id = 2; //事件发起者id
|
||||
}
|
||||
|
||||
//房间信息
|
||||
message MFRoomInfo
|
||||
{
|
||||
optional string room_id = 1; //房间
|
||||
optional string owner_id = 2; //房间创建者的用户ID
|
||||
optional string room_property = 3; // 房间属性
|
||||
optional int32 _timestamp = 4; //时间戳毫秒(相对于房间创建时间时)
|
||||
optional int32 create_time = 5; //创建时间
|
||||
optional int32 max_player = 6; //最大玩家数
|
||||
optional int32 allow_merge = 7 [default = 0]; //允许合并 0:否 1:是
|
||||
repeated MFRoomRobotInfo robot_list = 8; //机器人列表 size() == max_player
|
||||
optional int32 started = 9; //0:游戏未开始 1:游戏已经开始
|
||||
optional int32 reset_count = 10; //房间重置次数 创建时为0之后每重置一次++
|
||||
optional int32 join_over = 11; //0:允许加入 1:不允许加入
|
||||
optional int32 auto_exit_room = 12; //连接断开后自动退房间 0:不退(还可以重连) 1:自动退(无法重连只能再走一次加房间流程)
|
||||
}
|
||||
|
||||
//创建房间信息
|
||||
message MFCreateRoomInfo
|
||||
{
|
||||
optional string room_name = 1; //房间名
|
||||
optional int32 max_player = 2; //最大玩家数
|
||||
optional int32 allow_merge = 3 [default = 0]; //允许合并 0:否 1:是
|
||||
optional int32 auto_exit_room = 4; //连接断开后自动退房间 0:不退(还可以重连) 1:自动退(无法重连只能再走一次加房间流程)
|
||||
}
|
||||
|
||||
//帧事件项
|
||||
message MFFrameItem
|
||||
{
|
||||
optional string src_account_id = 1; //用户id
|
||||
optional string custom_data = 2; //透传数据
|
||||
optional double timestamp = 3; //时间戳(单位毫秒)
|
||||
}
|
||||
|
||||
//帧事件
|
||||
message MFFrameEventInfo
|
||||
{
|
||||
optional int32 frame_index = 1; //帧序号
|
||||
repeated MFFrameItem frame_items = 2; //同步帧内的数据包数组
|
||||
optional int32 frame_wait_count = 3; //同步帧内的数据包数组数量
|
||||
}
|
||||
|
||||
//-------------------------mfxxx end---------------------------------------
|
||||
|
||||
//登录
|
||||
message CMLogin
|
||||
{
|
||||
optional string account_id = 1; //用户id
|
||||
optional string session_id = 2; //session_id
|
||||
optional string game_id = 3; //game_id
|
||||
optional string device_id = 4; //device_id
|
||||
}
|
||||
message SMLogin
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1: 失败
|
||||
optional string room_id = 2; //房间id
|
||||
}
|
||||
|
||||
//心跳
|
||||
message CMPing
|
||||
{
|
||||
}
|
||||
message SMPing
|
||||
{
|
||||
}
|
||||
|
||||
//创建房间
|
||||
message CMCreateRoom
|
||||
{
|
||||
optional MFCreateRoomInfo create_room_info = 1; //创建房间信息
|
||||
optional string user_profile = 2; //玩家简介,可以填写昵称、段位等信息
|
||||
}
|
||||
message SMCreateRoom
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1: 失败 -2: 未登录 -3: 已在房间 -4:正在匹配
|
||||
optional string room_id = 2; //房间id
|
||||
optional int32 create_time = 5; //创建时间
|
||||
optional MFRoomInfo room_info = 6; //房间信息
|
||||
}
|
||||
|
||||
//加入随机房间
|
||||
message CMJoinRandomRoom
|
||||
{
|
||||
optional int32 max_player = 1; //最大玩家数
|
||||
optional string user_profile = 2; //玩家简介,可以填写昵称、段位等信息
|
||||
}
|
||||
message SMJoinRandomRoom
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -3: 已在房间 -4:正在匹配
|
||||
optional MFRoomInfo room_info = 2; //房间信息
|
||||
repeated MFRoomUserInfo room_user_info_list = 3; //房间用户信息列表
|
||||
}
|
||||
|
||||
//加入指定房间
|
||||
message CMJoinRoom
|
||||
{
|
||||
optional string room_id = 1; //房间id
|
||||
optional string user_profile = 2; //玩家简介,可以填写昵称、段位等信息
|
||||
}
|
||||
message SMJoinRoom
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1: 房间id不存在 -2: 房间已满 -3: 已在房间 -4:正在匹配 -5:无法加入
|
||||
optional MFRoomInfo room_info = 2; //房间信息
|
||||
repeated MFRoomUserInfo room_user_info_list = 3; //房间用户信息列表
|
||||
}
|
||||
|
||||
//加入房间通知
|
||||
message SMRoomPeerJoinNotify
|
||||
{
|
||||
optional MFRoomUserInfo room_user_info = 1; //房间用户信息
|
||||
}
|
||||
|
||||
//踢人
|
||||
message CMKickPlayer
|
||||
{
|
||||
optional string account_id = 1; //用户id
|
||||
optional string custom_data = 2; //透传数据
|
||||
}
|
||||
message SMKickPlayer
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1: 失败
|
||||
optional string account_id = 2; //用户id
|
||||
optional string custom_data = 3; //透传数据
|
||||
}
|
||||
|
||||
//踢人notify
|
||||
message SMRoomKickPlayerNotify
|
||||
{
|
||||
optional string account_id = 1; //用户id
|
||||
optional string custom_data = 2; //透传数据
|
||||
optional string owner_id = 3; //房主
|
||||
}
|
||||
|
||||
//加入房间结束
|
||||
message CMJoinOver
|
||||
{
|
||||
optional string custom_data = 1; //自定义内容
|
||||
}
|
||||
message SMJoinOver
|
||||
{
|
||||
optional MFOptResult result = 1; //
|
||||
optional string custom_data = 2; //自定义内容
|
||||
}
|
||||
|
||||
//加入房间结束notify
|
||||
message SMJoinOverNotify
|
||||
{
|
||||
optional string custom_data = 1; //透传数据
|
||||
}
|
||||
|
||||
//加入房间开启
|
||||
message CMJoinOpen
|
||||
{
|
||||
optional string custom_data = 1; //自定义内容
|
||||
}
|
||||
message SMJoinOpen
|
||||
{
|
||||
optional MFOptResult result = 1; //
|
||||
optional string custom_data = 2; //自定义内容
|
||||
}
|
||||
|
||||
//加入房间开启notify
|
||||
message SMJoinOpenNotify
|
||||
{
|
||||
optional string custom_data = 1; //自定义内容
|
||||
}
|
||||
|
||||
//游戏开始
|
||||
message CMGameStart
|
||||
{
|
||||
optional string custom_data = 1; //自定义内容
|
||||
}
|
||||
message SMGameStart
|
||||
{
|
||||
optional MFOptResult result = 1; //
|
||||
optional string custom_data = 2; //自定义内容
|
||||
}
|
||||
|
||||
//发送房间数据
|
||||
message CMSendRoomEvent
|
||||
{
|
||||
optional string custom_data = 1; //消息内容
|
||||
}
|
||||
message SMSendRoomEvent
|
||||
{
|
||||
optional MFOptResult result = 1; //
|
||||
optional string event_id = 2; //事件唯一id
|
||||
optional string custom_data = 3; //消息内容
|
||||
optional int32 _timestamp = 4; //时间戳毫秒(相对于房间创建时间时)
|
||||
}
|
||||
|
||||
//房间数据同步消息
|
||||
message SMRoomEventNotify
|
||||
{
|
||||
optional string src_account_id = 1; //事件发起者id
|
||||
optional string event_id = 2; //事件唯一id
|
||||
optional string custom_data = 3; //消息内容
|
||||
optional int32 _timestamp = 4; //时间戳毫秒(相对于房间创建时间时)
|
||||
}
|
||||
|
||||
//发送离开房间
|
||||
message CMLeaveRoom
|
||||
{
|
||||
optional string custom_data = 1; //自定义内容
|
||||
}
|
||||
message SMLeaveRoom
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1: 未在房间中
|
||||
optional string room_id = 2; //房间id
|
||||
optional string account_id = 3; //用户id
|
||||
optional string custom_data = 4; //消息内容
|
||||
}
|
||||
|
||||
//设置房间参数
|
||||
message CMSetRoomParam
|
||||
{
|
||||
optional int32 allow_merge = 1 [default = 0]; //允许合并 0:否 1:是
|
||||
}
|
||||
message SMSetRoomParam
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 其他失败
|
||||
}
|
||||
|
||||
//重置房间状态 当前重置的信息:started 帧事件相关所有字段
|
||||
//注意帧率会改为0客户端需要再次设置帧率会开启新的帧事件
|
||||
message CMResetRoom
|
||||
{
|
||||
optional int32 join_over = 1; //重置后 0:允许加入 1:不允许加入
|
||||
}
|
||||
message SMResetRoom
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 其他失败
|
||||
}
|
||||
|
||||
//强退房间(客户端matchvs sdk层实现,应用层不要主动调用该方法)
|
||||
//客户端记录最后一次进入的房间,当玩家要进入或者创建新的房间时候应主动发CMForceExitRoom消息退上一个房间
|
||||
message CMForceExitRoom
|
||||
{
|
||||
optional string room_id = 1; //房间id
|
||||
}
|
||||
|
||||
//其他人离开房间通知
|
||||
message SMRoomPeerLeaveNotify
|
||||
{
|
||||
optional string room_id = 1; //房间id
|
||||
optional MFRoomUserInfo room_user_info = 2; //房间用户信息
|
||||
optional int32 reason = 3; //0:主动退出 1:断线自动退房(auto_exit_room) 2:CMForceExitRoom
|
||||
}
|
||||
|
||||
//设置同步帧率
|
||||
message CMSetFrameSync
|
||||
{
|
||||
optional int32 frame_rate = 1; //每秒钟同步的帧数
|
||||
}
|
||||
message SMSetFrameSync
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1: frame_rate大于30
|
||||
optional int32 frame_rate = 2; //每秒钟同步的帧数
|
||||
}
|
||||
|
||||
//发送帧事件
|
||||
message CMSendFrameEvent
|
||||
{
|
||||
optional string custom_data = 1; //透传
|
||||
}
|
||||
message SMSendFrameEvent
|
||||
{
|
||||
optional MFOptResult result = 1; //操作结果
|
||||
}
|
||||
|
||||
//断线重连
|
||||
message CMReConnect
|
||||
{
|
||||
optional string room_id = 1; //房间
|
||||
optional string account_id = 2; //用户id
|
||||
optional string session_id = 3; //session_id
|
||||
}
|
||||
message SMReConnect
|
||||
{
|
||||
optional MFOptResult result = 1; //error_code 0: 成功 -1:session已失效 -2:房间不存在 -3
|
||||
optional MFRoomInfo room_info = 2; //房间信息
|
||||
repeated MFRoomUserInfo room_user_info_list = 3; //房间用户信息列表
|
||||
}
|
||||
|
||||
//房间内玩家收到帧同步的回调
|
||||
//注意 需要在客户端保持帧同步的状态,服务器不会保存
|
||||
message SMFrameEventUpdateNotify
|
||||
{
|
||||
optional MFFrameEventInfo frame_info = 1; //帧信息
|
||||
}
|
||||
|
||||
//房间解散通知
|
||||
message SMRoomDisbandNotify
|
||||
{
|
||||
optional string room_id = 1; //房间id
|
||||
}
|
||||
|
||||
//房间合并通知 source 并入 target
|
||||
message SMRoomMergeNotify
|
||||
{
|
||||
optional string source_room_id = 1; //源房间id
|
||||
optional MFRoomInfo target_room_info = 2; //房间信息
|
||||
repeated MFRoomUserInfo target_room_user_info_list = 3; //房间用户信息列表
|
||||
}
|
||||
|
||||
//房间重置通知
|
||||
message SMRoomResetNotify
|
||||
{
|
||||
optional MFRoomInfo room_info = 1; //房间信息
|
||||
repeated MFRoomUserInfo room_user_info_list = 2; //房间用户信息列表
|
||||
}
|
||||
|
||||
//网络状态
|
||||
message SMNetWorkStateNotify
|
||||
{
|
||||
optional string room_id = 1; //房间id
|
||||
optional string account_id = 2; //账号
|
||||
optional int32 state = 3; //网络断开状态 1-网络异常,正在重连 2-重连成功 3-重连失败,退出房间
|
||||
optional string owner = 4; //房主id
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
//syntax = "proto2";
|
||||
package kingsomevs;
|
||||
|
||||
//消息id定义
|
||||
enum CMMessageId_e
|
||||
{
|
||||
_CMBegin_ = 1;
|
||||
|
||||
_CMPing = 50;
|
||||
|
||||
_CMLogin = 100;
|
||||
_CMCreateRoom = 101;
|
||||
_CMJoinRandomRoom = 102;
|
||||
_CMJoinRoom = 103;
|
||||
_CMKickPlayer = 104;
|
||||
_CMJoinOver = 105;
|
||||
_CMJoinOpen = 106;
|
||||
_CMGameStart = 107;
|
||||
_CMSendRoomEvent = 108;
|
||||
_CMLeaveRoom = 109;
|
||||
_CMSetRoomParam = 110;
|
||||
_CMResetRoom = 111;
|
||||
_CMForceExitRoom = 112;
|
||||
_CMSetFrameSync = 120;
|
||||
_CMSendFrameEvent = 121;
|
||||
_CMReConnect = 130;
|
||||
|
||||
_CMEnd_ = 2000;
|
||||
}
|
||||
|
||||
enum SMMessageId_e
|
||||
{
|
||||
_SMBegin_ = 1;
|
||||
|
||||
_SMPing = 50;
|
||||
|
||||
_SMLogin = 100;
|
||||
_SMCreateRoom = 101;
|
||||
_SMJoinRandomRoom = 102;
|
||||
_SMJoinRoom = 103;
|
||||
_SMKickPlayer = 104;
|
||||
_SMJoinOver = 105;
|
||||
_SMJoinOpen = 106;
|
||||
_SMGameStart = 107;
|
||||
_SMSendRoomEvent = 108;
|
||||
_SMLeaveRoom = 109;
|
||||
_SMSetRoomParam = 110;
|
||||
_SMResetRoom = 111;
|
||||
_SMSetFrameSync = 120;
|
||||
_SMSendFrameEvent = 121;
|
||||
_SMReConnect = 130;
|
||||
|
||||
_SMRoomPeerJoinNotify = 200;
|
||||
_SMRoomKickPlayerNotify = 201;
|
||||
_SMRoomEventNotify = 202;
|
||||
_SMRoomPeerLeaveNotify = 203;
|
||||
_SMRoomDisbandNotify = 204;
|
||||
_SMJoinOverNotify = 205;
|
||||
_SMJoinOpenNotify = 206;
|
||||
_SMRoomMergeNotify = 207;
|
||||
_SMRoomResetNotify = 208;
|
||||
_SMFrameEventUpdateNotify = 210;
|
||||
_SMNetWorkStateNotify = 220;
|
||||
|
||||
_SMEnd_ = 2000;
|
||||
}
|
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 32 KiB |