if Flag='Play' then
begin
New(ppMain);
ppMain:=MainList.Items[PageNum];
//读入缓存图片
RelaxBmp.LoadFromFile(RelaxGraphic);
//设置滚动条起始点和最大长度
TrackBar1.Position:=ppMain.mmPlayNum;
TrackBar1.Max:=ppMain.TotalNum;
//播放背景音乐
if ppMain.BackMusic<>'' then
if (BackMusicFlag='') or (BackMusicFlag='Stop') then
begin
MediaPlayer1.FileName:=ppMain.BackMusic;
MediaPlayer1.Open;
MediaPlayer1.Play;
BackMusicFlag:='Play';
end;
//选择时间点动画
if ppMain.mmPlayNum<=ppMain.TotalNum then
begin
for I := 0 to ppMain.mpmList.Count-1do
// Iterate
begin
New(pmImage);
pmImage:=ppMain.mpmList.Items;
for J := 0 to pmImage.MoveList.Count-1do
// Iterate
begin
New(pmmImage);
pmmImage:=pmImage.MoveList.Items[J];
if pmmImage.mmTime=ppMain.mmPlayNum then
begin
pmImage.Left:=pmmImage.mmX;
pmImage.Top:=pmmImage.mmY;
pmImage.NowNum:=pmmImage.ImageNum;
Break;
end;
end;
// for
end;
// for
//选择时间点语音
for I := 0 to ppMain.mptmList.Count-1do
// Iterate
begin
New(pTalkMusic);
pTalkMusic:=ppMain.mptmList.Items;
if (ppMain.TotalNum-ppMain.mmPlayNum)<5 then
Break;
if pTalkMusic.MusicStart=ppMain.mmPlayNum then
begin
if MusicFlag='PlayingMusic' then
begin
ThreadAudio1.Stop;
end;
DXSound.Initialize;
ThreadAudio1 := TAudioFileStream.Create(DXSound.DSound);
ThreadAudio1.AutoUpdate := True;
ThreadAudio1.BufferLength := 1000;
ThreadAudio1.FileName := pTalkMusic.MusicName;
//ThreadAudio1.Volume := -500;
ThreadAudio1.Play;
MusicFlag:='PlayingMusic';
end;
end;
// for
Inc(ppMain.mmPlayNum);
StillStretchDraw(RelaxBmp);
MotiveStretchDraw(RelaxBmp);
TalkStretchDraw(RelaxBmp);
BackImage.Canvas.Draw(0,0,RelaxBmp);
end
else
begin
Inc(PageNum);
New(ppMain);
ppMain:=MainList.Items[PageNum-1];
if ppMain.BackMusic<>'' then
begin
MediaPlayer1.Stop;
MediaPlayer1.Close;
BackMusicFlag:='';
end;
if PageNum=MainList.Count then
begin
if MusicFlag='PlayingMusic' then
begin
ThreadAudio1.Stop;
end;
BackMusicFlag:='';
Timer1.Enabled:=False;
MusicFlag:='';
Flag:='Null';
//动画
PageNum:=0;
New(ppMain);
ppMain:=MainList.Items[PageNum];
ppMain.mmPlayNum:=0;
MenuForm.StretchGraphic(ppMain.BackImage);
RelaxBmp.LoadFromFile(RelaxGraphic);
TrackBar1.Position:=ppMain.mmPlayNum;
TrackBar1.Max:=ppMain.TotalNum;
StillStretchDraw(RelaxBmp);
MotiveStretchDraw(RelaxBmp);
TalkStretchDraw(RelaxBmp);
BackImage.Canvas.Draw(0,0,RelaxBmp);
Play.Enabled:=True;
Stop.Enabled:=False;
FileBtn.Enabled:=True;
BackImageBtn.Enabled:=True;
StillBtn.Enabled:=True;
MotiveBtn.Enabled:=True;
TalkBtn.Enabled:=True;
BackMusicBtn.Enabled:=True;
MusicTalkBtn.Enabled:=True;
end
else
begin
New(ppMain);
ppMain:=MainList.Items[PageNum];
ppMain.mmPlayNum:=0;
MenuForm.StretchGraphic(ppMain.BackImage);
BackMusicFlag:='';
end;
end;
end;
liangdewei你先看一下吧,希望你能快的回答,谢谢