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
0e676516
Commit
0e676516
authored
Aug 03, 2021
by
LiLiuZhou
Browse files
Options
Browse Files
Download
Plain Diff
1
parents
ddc84216
0fa10fd5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
7 deletions
+73
-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
+61
-2
No files found.
Assets/Base/UnityTool/HTTP/HttpTool.cs
View file @
0e676516
...
@@ -84,7 +84,6 @@ public class HttpTool : MonoBehaviour
...
@@ -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
)
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
);
string
url
=
BaseURL
+
methodName
+
"?"
+
addParams
(
postParas
);
Debug
.
unityLogger
.
Log
(
HttpLogTag
,
url
);
using
(
UnityWebRequest
webRequest
=
new
UnityWebRequest
(
url
,
"POST"
))
using
(
UnityWebRequest
webRequest
=
new
UnityWebRequest
(
url
,
"POST"
))
{
{
if
(
jsonString
!=
null
&&
jsonString
.
Length
>
0
)
if
(
jsonString
!=
null
&&
jsonString
.
Length
>
0
)
...
...
Assets/FunScripts/Core/EventCenter.cs
View file @
0e676516
using
System.Collections
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.Events
;
using
UnityEngine.Events
;
...
@@ -71,4 +72,9 @@ public class EventCenter : BaseMgr<EventCenter>
...
@@ -71,4 +72,9 @@ public class EventCenter : BaseMgr<EventCenter>
{
{
eventdic
=
null
;
eventdic
=
null
;
}
}
internal
void
AddUpdateListener
(
string
v1
,
object
v2
)
{
throw
new
NotImplementedException
();
}
}
}
Assets/Scripts/Controllers/AudioManager.cs
View file @
0e676516
...
@@ -4,11 +4,10 @@ using UnityEngine;
...
@@ -4,11 +4,10 @@ using UnityEngine;
public
class
AudioManager
:
MonoBaseMgr
<
AudioManager
>
public
class
AudioManager
:
MonoBaseMgr
<
AudioManager
>
{
{
private
GameObject
PlayMusic
;
private
AudioSource
mAudiSource
;
private
AudioSource
mAudiSource
;
private
void
Awake
()
private
void
Awake
()
{
{
mAudiSource
=
PlayMusic
.
AddComponent
<
AudioSource
>();
mAudiSource
=
transform
.
gameObject
.
AddComponent
<
AudioSource
>();
}
}
public
void
PlayAudio
(
string
MusicUrl
)
public
void
PlayAudio
(
string
MusicUrl
)
...
...
Assets/Scripts/Controllers/GameController.cs
View file @
0e676516
...
@@ -61,7 +61,10 @@ public class GameController : MonoBehaviour
...
@@ -61,7 +61,10 @@ public class GameController : MonoBehaviour
}
}
/// <summary>
/// 合成歌曲上报
/// </summary>
/// <param name="song_id"></param>
public
void
GetNoteCompleted
(
int
song_id
)
public
void
GetNoteCompleted
(
int
song_id
)
{
{
Dictionary
<
string
,
object
>
paras
=
new
Dictionary
<
string
,
object
>();
Dictionary
<
string
,
object
>
paras
=
new
Dictionary
<
string
,
object
>();
...
...
Assets/Scripts/Panel/MainPanel.cs
View file @
0e676516
...
@@ -6,11 +6,18 @@ using UnityEngine.UI;
...
@@ -6,11 +6,18 @@ using UnityEngine.UI;
public
class
MainPanel
:
BasePanel
public
class
MainPanel
:
BasePanel
{
{
<<<<<<<
HEAD
protected
override
void
Awake
()
protected
override
void
Awake
()
{
{
base
.
Awake
();
base
.
Awake
();
EventCenter
.
Getinstance
().
AddUpdateListener
(
"RegisterPanel"
,()=>
{
UIMgr
.
Getinstance
().
RegisterPanel
<
MainPanel
>(
this
);
});
EventCenter
.
Getinstance
().
AddUpdateListener
(
"RegisterPanel"
,()=>
{
UIMgr
.
Getinstance
().
RegisterPanel
<
MainPanel
>(
this
);
});
}
}
=======
private
int
nextSongId
=
0
;
private
List
<
string
>
notesList
=
null
;
private
int
playNoteIndex
=
0
;
private
bool
IsSuccess
=
false
;
>>>>>>>
0f
a10fd520ad3cd02f948768758850a333bc8c2c
public
override
void
OnHide
(
object
data
=
null
)
public
override
void
OnHide
(
object
data
=
null
)
{
{
...
@@ -18,7 +25,9 @@ public class MainPanel : BasePanel
...
@@ -18,7 +25,9 @@ public class MainPanel : BasePanel
public
override
void
OnInit
(
object
data
=
null
)
public
override
void
OnInit
(
object
data
=
null
)
{
{
EventCenter
.
Getinstance
().
AddUpdateListener
(
"FlyNote"
,
AddSongProgress
);
GetHomeInfo
();
GetHomeInfo
();
GetNextNoteList
(
nextSongId
);
}
}
public
override
void
OnRefresh
(
object
data
=
null
)
public
override
void
OnRefresh
(
object
data
=
null
)
...
@@ -37,4 +46,54 @@ public class MainPanel : BasePanel
...
@@ -37,4 +46,54 @@ public class MainPanel : BasePanel
Debug
.
unityLogger
.
Log
(
"首页信息 "
+
code
+
" msg "
+
msg
);
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