Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
M
MusicBigWatermelon
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
MusicBigWatermelon
Commits
3e4b65bc
Commit
3e4b65bc
authored
Aug 03, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合成音乐
parent
6d0dd035
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
7 deletions
+70
-7
HttpTool.cs
Assets/Base/UnityTool/HTTP/HttpTool.cs
+0
-1
EventCenter.cs
Assets/FunScripts/Core/EventCenter.cs
+7
-1
AudioManager.cs
Assets/Scripts/Controllers/AudioManager.cs
+1
-2
GameController.cs
Assets/Scripts/Controllers/GameController.cs
+4
-1
MainPanel.cs
Assets/Scripts/Panel/MainPanel.cs
+58
-2
No files found.
Assets/Base/UnityTool/HTTP/HttpTool.cs
View file @
3e4b65bc
...
...
@@ -84,7 +84,6 @@ public class HttpTool : MonoBehaviour
private
IEnumerator
PostRequest
<
T
>(
string
BaseURL
,
string
methodName
,
string
jsonString
,
Dictionary
<
string
,
object
>
postParas
,
Action
<
T
>
success
,
Action
<
string
,
string
>
failed
)
{
string
url
=
BaseURL
+
methodName
+
"?"
+
addParams
(
postParas
);
Debug
.
unityLogger
.
Log
(
HttpLogTag
,
url
);
using
(
UnityWebRequest
webRequest
=
new
UnityWebRequest
(
url
,
"POST"
))
{
if
(
jsonString
!=
null
&&
jsonString
.
Length
>
0
)
...
...
Assets/FunScripts/Core/EventCenter.cs
View file @
3e4b65bc
using
System.Collections
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.Events
;
...
...
@@ -71,4 +72,9 @@ public class EventCenter : BaseMgr<EventCenter>
{
eventdic
=
null
;
}
internal
void
AddUpdateListener
(
string
v1
,
object
v2
)
{
throw
new
NotImplementedException
();
}
}
Assets/Scripts/Controllers/AudioManager.cs
View file @
3e4b65bc
...
...
@@ -4,11 +4,10 @@ using UnityEngine;
public
class
AudioManager
:
MonoBaseMgr
<
AudioManager
>
{
private
GameObject
PlayMusic
;
private
AudioSource
mAudiSource
;
private
void
Awake
()
{
mAudiSource
=
PlayMusic
.
AddComponent
<
AudioSource
>();
mAudiSource
=
transform
.
gameObject
.
AddComponent
<
AudioSource
>();
}
public
void
PlayAudio
(
string
MusicUrl
)
...
...
Assets/Scripts/Controllers/GameController.cs
View file @
3e4b65bc
...
...
@@ -59,7 +59,10 @@ public class GameController : MonoBehaviour
}
/// <summary>
/// 合成歌曲上报
/// </summary>
/// <param name="song_id"></param>
public
void
GetNoteCompleted
(
int
song_id
)
{
Dictionary
<
string
,
object
>
paras
=
new
Dictionary
<
string
,
object
>();
...
...
Assets/Scripts/Panel/MainPanel.cs
View file @
3e4b65bc
...
...
@@ -6,19 +6,25 @@ using UnityEngine.UI;
public
class
MainPanel
:
BasePanel
{
private
int
nextSongId
=
0
;
private
List
<
string
>
notesList
=
null
;
private
int
playNoteIndex
=
0
;
private
bool
IsSuccess
=
false
;
public
override
void
OnHide
(
object
data
=
null
)
{
}
public
override
void
OnInit
(
object
data
=
null
)
{
EventCenter
.
Getinstance
().
AddUpdateListener
(
"FlyNote"
,
AddSongProgress
);
GetHomeInfo
();
GetNextNoteList
(
nextSongId
);
}
public
override
void
OnRefresh
(
object
data
=
null
)
{
}
private
void
GetHomeInfo
()
{
...
...
@@ -32,4 +38,54 @@ public class MainPanel : BasePanel
Debug
.
unityLogger
.
Log
(
"首页信息 "
+
code
+
" msg "
+
msg
);
}));
}
//监听碰撞时间增加音符
private
void
AddSongProgress
()
{
if
(
IsSuccess
)
{
return
;
}
if
(
notesList
!=
null
&&
notesList
.
Count
>
0
)
{
if
(
notesList
.
Count
>
playNoteIndex
)
{
AudioManager
.
Getinstance
().
PlayAudio
(
notesList
[
playNoteIndex
]);
playNoteIndex
++;
}
if
(
playNoteIndex
==
notesList
.
Count
)
{
IsSuccess
=
true
;
Debug
.
unityLogger
.
Log
(
"合成音符红包"
);
}
GetControl
<
Text
>(
"ProgressTv"
).
text
=
playNoteIndex
+
"/"
+
notesList
.
Count
;
GetControl
<
Image
>(
"ProgressBar"
).
fillAmount
=
playNoteIndex
/
(
float
)
notesList
.
Count
;
}
}
/// <summary>
/// 获取接下来将要掉落的音符组及所属歌曲
/// </summary>
public
void
GetNextNoteList
(
int
song_id
)
{
Dictionary
<
string
,
object
>
paras
=
new
Dictionary
<
string
,
object
>();
paras
.
Add
(
"song_id"
,
song_id
);
HttpTool
.
Instance
.
_Get
(
"app/v1/watermelon/notes"
,
paras
,
new
Action
<
List
<
string
>>((
result
)
=>
{
IsSuccess
=
false
;
playNoteIndex
=
0
;
notesList
=
result
;
GetControl
<
Text
>(
"ProgressTv"
).
text
=
"0/"
+
result
.
Count
;
GetControl
<
Image
>(
"ProgressBar"
).
fillAmount
=
0
/
(
float
)
result
.
Count
;
Debug
.
unityLogger
.
Log
(
""
);
}),
new
Action
<
string
,
string
>((
code
,
msg
)
=>
{
Debug
.
unityLogger
.
Log
(
"获取下一组生成的球 "
+
code
+
" msg "
+
msg
);
}));
}
}
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