Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
29da8486
Commit
29da8486
authored
Nov 12, 2021
by
huangwenjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
canvas编辑器可显示
parent
fa8b779c
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6942 additions
and
21239 deletions
+6942
-21239
default.js
c_client/config/default.js
+39
-22
package-lock.json
c_client/minigame/package-lock.json
+0
-12
package.json
c_client/minigame/package.json
+1
-1
yarn.lock
c_client/minigame/yarn.lock
+4
-4
canvasComp.axml
...nt/src/components/_miniprogram/canvasComp/canvasComp.axml
+1
-6
canvasComp.js
...ient/src/components/_miniprogram/canvasComp/canvasComp.js
+13
-7
output.js
c_client/src/components/_miniprogram/canvasComp/output.js
+6884
-21187
No files found.
c_client/config/default.js
View file @
29da8486
export
default
{
hasCanvas
:
false
,
// 是否开启游戏模块自动注入dist
defaultPlugins
:
[
[
'@pluve/taro-plugin-mars'
,
// taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置
{
usingComponents
:
{
// 原生组件引入
enable
:
true
,
include
:
[
'pages/index/index'
,
'pages/packagePrize/myPrize/myPrize'
,
'pages/packageGame/game/game'
]
}
}
]
],
canvasPages
:
[
{
'root'
:
'pages/packageGame/game/game.json'
,
'comRoot'
:
'components/_miniprogram/canvasComp/canvasComp'
},
// 游戏组件
{
'root'
:
'pages/index/index.json'
,
'comRoot'
:
'components/_miniprogram/lottieAnimation/lottieAnimation'
}
// Lottie组件
],
// 引入cavas组件页面(更改canvas引用路径)
canvasComps
:
[
// 拷贝相关页面和依赖到dist目录
{
from
:
'minigame/node_modules'
,
to
:
'dist/node_modules'
},
{
from
:
'src/components/_miniprogram/canvasComp'
,
to
:
'dist/components/_miniprogram/canvasComp'
},
// 游戏组建引入
{
from
:
'src/components/_miniprogram/lottieAnimation'
,
to
:
'dist/components/_miniprogram/lottieAnimation'
},
// lottie 动画组件
{
from
:
'src/lottie'
,
to
:
'dist/lottie'
},
// lottie json文件
hasCanvas
:
true
,
// 是否开启游戏模块自动注入dist
defaultPlugins
:
[
[
'@pluve/taro-plugin-mars'
,
// taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置
{
usingComponents
:
{
// 原生组件引入
enable
:
true
,
include
:
[
'pages/index/index'
,
'pages/packagePrize/myPrize/myPrize'
,
'pages/packageGame/game/game'
]
}
}
]
}
\ No newline at end of file
],
canvasPages
:
[{
'root'
:
'pages/packageGame/game/game.json'
,
'comRoot'
:
'components/_miniprogram/canvasComp/canvasComp'
},
// 游戏组件
{
'root'
:
'pages/index/index.json'
,
'comRoot'
:
'components/_miniprogram/lottieAnimation/lottieAnimation'
}
// Lottie组件
],
// 引入cavas组件页面(更改canvas引用路径)
canvasComps
:
[
// 拷贝相关页面和依赖到dist目录
{
from
:
'minigame/node_modules'
,
to
:
'dist/node_modules'
},
{
from
:
'src/components/_miniprogram/canvasComp'
,
to
:
'dist/components/_miniprogram/canvasComp'
},
// 游戏组建引入
{
from
:
'src/components/_miniprogram/lottieAnimation'
,
to
:
'dist/components/_miniprogram/lottieAnimation'
},
// lottie 动画组件
{
from
:
'src/lottie'
,
to
:
'dist/lottie'
},
// lottie json文件
]
}
c_client/minigame/package-lock.json
deleted
100644 → 0
View file @
fa8b779c
{
"version"
:
"1.0.0"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"fyge"
:
{
"version"
:
"2.0.31"
,
"resolved"
:
"https://registry.npmjs.org/fyge/-/fyge-2.0.23.tgz"
,
"integrity"
:
"sha512-5EA6FHrwpp9sAMyctuyE+gyUH10uGT5PPp1O1gZfohJNx1/bkCPcUomnXApa8367tJ5UiPhiVi3dZeqUdJiZVQ=="
}
}
}
c_client/minigame/package.json
View file @
29da8486
...
...
@@ -4,6 +4,6 @@
"main"
:
""
,
"license"
:
"MIT"
,
"dependencies"
:
{
"fyge"
:
"2.0.
31
"
"fyge"
:
"2.0.
43
"
}
}
c_client/minigame/yarn.lock
View file @
29da8486
...
...
@@ -2,7 +2,7 @@
# yarn lockfile v1
fyge@2.0.
31
:
version "2.0.
31
"
resolved "http
s://registry.yarnpkg.com/fyge/-/fyge-2.0.31.tgz#49afcdfef92e23b53e42bef6a93f3b2211af281e
"
integrity sha
512-HIt26NvgQ5udlI5jJwYgVSqBdfy1qX0+L1TseJNuyUVWgzkNGjQy2rGnXXA2yuWoSgWoDGtKfL94CC9FCAsNyg=
=
fyge@2.0.
43
:
version "2.0.
43
"
resolved "http
://npm.dui88.com:80/fyge/-/fyge-2.0.43.tgz#0e587104e4050772014810f85d01a7bed4f1482f
"
integrity sha
1-DlhxBOQFB3IBSBD4XQGnvtTxSC8
=
c_client/src/components/_miniprogram/canvasComp/canvasComp.axml
View file @
29da8486
<view class="farmer-container-plants canvas">
<canvas id="canvas" type="2d" class="canvas" disable-scroll="true"
onTouchStart="onMouseEvent"
onTouchMove="onMouseEvent"
onTouchEnd="onMouseEvent"
onReady="onCanvasReady"
></canvas>
<canvas id="canvas" type="webgl" class="canvas" disable-scroll="true" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady"></canvas>
</view>
\ No newline at end of file
c_client/src/components/_miniprogram/canvasComp/canvasComp.js
View file @
29da8486
import
{
Main
}
from
'./output'
;
import
{
Main
}
from
'./output'
;
/**
* 直接取,app
*/
...
...
@@ -26,8 +28,8 @@ Component({
const
dpr
=
my
.
getSystemInfoSync
().
pixelRatio
const
windowWidth
=
my
.
getSystemInfoSync
().
windowWidth
;
const
windowHeight
=
my
.
getSystemInfoSync
().
windowHeight
;
ccc
.
width
=
windowWidth
*
dpr
+
dpr
;
//重新修改会有误差
ccc
.
height
=
windowHeight
*
dpr
+
dpr
;
// ccc.width = windowWidth * dpr + dpr;
//重新修改会有误差
//
ccc.height = windowHeight * dpr + dpr;
// console.log(Main)
console
.
log
(
ccc
.
width
,
ccc
.
height
)
if
(
!
this
.
main
)
{
...
...
@@ -48,7 +50,7 @@ Component({
let
netName
=
e
.
data
.
netName
;
//接口参数
let
parameter
=
e
.
data
.
parameter
;
if
(
netName
.
indexOf
(
"mine"
)
==
0
)
{
if
(
netName
.
indexOf
(
"mine"
)
==
0
)
{
// 和游戏页面通信
this
.
props
.
onMessage
({
type
:
'message'
,
...
...
@@ -61,12 +63,16 @@ Component({
postMessage
:
(
netName
,
data
)
=>
this
.
postMessage
(
netName
,
data
)
}
})
}
else
{
this
.
postMessage
(
netName
,
{
success
:
false
})
}
else
{
this
.
postMessage
(
netName
,
{
success
:
false
})
}
},
postMessage
(
netName
,
data
)
{
this
.
main
&&
this
.
main
.
dispatchGlobalEvent
({
type
:
netName
},
data
)
//以防复用事件event串了,就用这种方式
this
.
main
&&
this
.
main
.
dispatchGlobalEvent
({
type
:
netName
},
data
)
//以防复用事件event串了,就用这种方式
},
//鼠标事件
onMouseEvent
(
e
)
{
...
...
c_client/src/components/_miniprogram/canvasComp/output.js
View file @
29da8486
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment