Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_ac2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
template admin
dfzx_ac2
Commits
10ae6f6e
Commit
10ae6f6e
authored
Mar 24, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
c58b3a1c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
21 deletions
+35
-21
form.component.ts
form/src/app/form/form.component.ts
+3
-3
Cartoon.js
play/assets/tmpGame/script/Cartoon.js
+15
-8
GameLogic.js
play/assets/tmpGame/script/GameLogic.js
+9
-1
Scene.js
play/assets/tmpGame/script/Scene.js
+8
-9
No files found.
form/src/app/form/form.component.ts
View file @
10ae6f6e
...
...
@@ -208,9 +208,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
refresh
();
/* Remove this when commit */
//
if(location.href.indexOf("localhost") != -1) {
//
(<any> window).axios.post(`http://www.datalist.com.cn:8060/json/save/${this.KEY}`, this.item)
//
}
if
(
location
.
href
.
indexOf
(
"
localhost
"
)
!=
-
1
)
{
(
<
any
>
window
).
axios
.
post
(
`http://www.datalist.com.cn:8060/json/save/
${
this
.
KEY
}
`
,
this
.
item
)
}
/* Remove this when commit */
console
.
log
(
"
保存
"
,
this
.
item
)
...
...
play/assets/tmpGame/script/Cartoon.js
View file @
10ae6f6e
...
...
@@ -275,8 +275,10 @@ export default class Cartoon {
// console.log(`Get remote image from [${url}]`)
return
new
Promise
((
resovle
,
reject
)
=>
{
this
.
getSpriteFrimeByUrl
(
url
).
then
((
fr
)
=>
{
let
sx
=
width
/
fr
.
getRect
().
width
;
let
sy
=
height
/
fr
.
getRect
().
height
;
let
relWidth
=
fr
.
getRect
().
width
;
let
relHeight
=
fr
.
getRect
().
height
;
let
sx
=
width
/
relWidth
;
let
sy
=
height
/
relHeight
;
let
s
=
1
;
if
(
fillType
)
{
s
=
Math
.
max
(
sx
,
sy
)
...
...
@@ -287,15 +289,20 @@ export default class Cartoon {
// fr.width = s * fr.getRect().width;
// fr.height = s * fr.getRect().height;
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
fr
;
resovle
()
resovle
(
[
relWidth
,
relHeight
]
)
})
})
}
mountLocalImageToNode
(
name
,
node
,
width
,
height
,
fillType
)
{
// console.log(`Get local image from [Canvas/res/img/${name}]`)
let
relWidth
=
null
;
let
relHeight
=
null
;
if
(
name
)
{
const
sf
=
cc
.
find
(
'
Canvas/res/img/
'
+
name
).
getComponent
(
cc
.
Sprite
).
spriteFrame
;
relWidth
=
fr
.
getRect
().
width
;
relHeight
=
fr
.
getRect
().
height
;
let
sx
=
width
/
sf
.
getRect
().
width
;
let
sy
=
height
/
sf
.
getRect
().
height
;
let
s
=
1
;
...
...
@@ -307,7 +314,10 @@ export default class Cartoon {
node
.
setScale
(
s
)
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
;
}
return
node
;
return
new
Promise
((
resolve
,
reject
)
=>
{
resovle
([
relWidth
,
relHeight
])
});
}
mountImageToNode
(
url
,
node
,
width
,
height
,
fillType
)
{
...
...
@@ -315,10 +325,7 @@ export default class Cartoon {
if
(
urlreg
.
test
(
url
))
{
return
this
.
mountRemoteImageToNode
(
url
,
node
,
width
,
height
,
fillType
)
}
else
{
this
.
mountLocalImageToNode
(
url
,
node
,
width
,
height
,
fillType
)
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
()
})
return
this
.
mountLocalImageToNode
(
url
,
node
,
width
,
height
,
fillType
)
}
}
...
...
play/assets/tmpGame/script/GameLogic.js
View file @
10ae6f6e
...
...
@@ -469,7 +469,15 @@ export default class GameLogic {
if
(
item
.
type
==
'
Image
'
)
{
let
image
=
bubble
.
node
.
getChildByName
(
"
image_container
"
)
image
.
active
=
true
;
this
.
g_cartoon
.
mountImageToNode
(
item
.
image_url
,
image
,
160
,
80
)
this
.
g_cartoon
.
mountImageToNode
(
item
.
image_url
,
image
,
160
,
80
).
then
(([
width
,
height
])
=>
{
let
s
=
width
/
height
let
r
=
165
let
h
=
Math
.
floor
(
Math
.
sqrt
(
r
*
r
/
(
s
*
s
+
1
)))
let
w
=
s
*
h
image
.
scaleX
=
w
/
width
;
image
.
scaleY
=
h
/
height
;
})
}
else
{
let
text
=
bubble
.
node
.
getChildByName
(
"
text_container
"
)
text
.
active
=
true
;
...
...
play/assets/tmpGame/script/Scene.js
View file @
10ae6f6e
...
...
@@ -110,15 +110,14 @@ cc.Class({
},
getData
(
cb
)
{
cb
(
this
.
getDefaultData
());
// cc.loader.load( "http://www.datalist.com.cn:8060/json/DataKey_dfzx_ppp", function( err, res) {
// console.log(res)
// if(err) {
// cb(this.getDefaultData());
// } else {
// cb(JSON.parse(res));
// }
// });
cc
.
loader
.
load
(
"
http://www.datalist.com.cn:8060/json/DataKey_dfzx_ppp
"
,
function
(
err
,
res
)
{
if
(
err
)
{
cb
(
this
.
getDefaultData
());
}
else
{
cb
(
JSON
.
parse
(
res
));
}
});
},
getDefaultData
()
{
...
...
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