本文整理汇总了C#中Sound.CreatePlayer方法的典型用法代码示例。如果您正苦于以下问题:C# Sound.CreatePlayer方法的具体用法?C# Sound.CreatePlayer怎么用?C# Sound.CreatePlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sound
的用法示例。
在下文中一共展示了Sound.CreatePlayer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeButtonEvents
private void InitializeButtonEvents()
{
DialogShowButton.ButtonAction += (sender, e) =>
{
CustomDialog dialog = new CustomDialog();
dialog.Show();
};
PopupListShowButton.ButtonAction += (sender, e) =>
{
Sound se = new Sound("/Application/assets/GAME_SE_01.wav");
sp = se.CreatePlayer();
sp.Play();
};
bgmButton.ButtonAction += (sender, e) =>
{
if (!bgm_play)
{
bp.Play();
bgmButton.Text = "BGMStop";
}
else
{
bp.Pause();
bgmButton.Text = "BGMPlay";
}
bgm_play = !bgm_play;
};
}
示例2: InitSound
public static void InitSound()
{
stage1 = new Bgm("/Application/resourses/stage1.mp3");
stage1boss = new Bgm("/Application/resourses/stage1boss.mp3");
title = new Bgm("/Application/resourses/title.mp3");
gameover = new Bgm("/Application/resourses/gameover.mp3");
bgmPlayer = stage1.CreatePlayer();
sound = new Sound("/Application/resourses/shot.wav");
shot = sound.CreatePlayer();
sound = new Sound("/Application/resourses/hidan.wav");
hidan = sound.CreatePlayer();
sound = new Sound("/Application/resourses/siren.wav");
siren = sound.CreatePlayer();
sound = new Sound("/Application/resourses/stageClear.wav");
stageClear = sound.CreatePlayer();
sound = new Sound("/Application/resourses/system1.wav");
ok = sound.CreatePlayer();
sound = new Sound("/Application/resourses/system2.wav");
cancel = sound.CreatePlayer();
sound = new Sound("/Application/resourses/damage.wav");
tekihidan = sound.CreatePlayer();
sound = new Sound("/Application/resourses/skillSE1.wav");
skill1 = sound.CreatePlayer();
sound = new Sound("/Application/resourses/skillSE2.wav");
skill2 = sound.CreatePlayer();
sound = new Sound("/Application/resourses/stageClear.wav");
stageClear = sound.CreatePlayer();
sound = new Sound("/Application/resourses/tick.wav");
ticktuck = sound.CreatePlayer();
}
示例3: GameScene
public GameScene()
{
this.Camera.SetViewFromViewport();
_physics = new PongPhysics();
ball = new Ball(_physics.SceneBodies[(int)PongPhysics.BODIES.Ball]);
_player = new Paddle(Paddle.PaddleType.PLAYER,
_physics.SceneBodies[(int)PongPhysics.BODIES.Player]);
_ai = new Paddle(Paddle.PaddleType.AI,
_physics.SceneBodies[(int)PongPhysics.BODIES.Ai]);
_scoreboard = new Scoreboard();
this.AddChild(_scoreboard);
this.AddChild(ball);
this.AddChild(_player);
this.AddChild(_ai);
// This is debug routine that will draw the physics bounding box around the players paddle
if(DEBUG_BOUNDINGBOXS)
{
this.AdHocDraw += () => {
var bottomLeftPlayer = _physics.SceneBodies[(int)PongPhysics.BODIES.Player].AabbMin;
var topRightPlayer = _physics.SceneBodies[(int)PongPhysics.BODIES.Player].AabbMax;
Director.Instance.DrawHelpers.DrawBounds2Fill(
new Bounds2(bottomLeftPlayer*PongPhysics.PtoM,topRightPlayer*PongPhysics.PtoM));
var bottomLeftAi = _physics.SceneBodies[(int)PongPhysics.BODIES.Ai].AabbMin;
var topRightAi = _physics.SceneBodies[(int)PongPhysics.BODIES.Ai].AabbMax;
Director.Instance.DrawHelpers.DrawBounds2Fill(
new Bounds2(bottomLeftAi*PongPhysics.PtoM,topRightAi*PongPhysics.PtoM));
var bottomLeftBall = _physics.SceneBodies[(int)PongPhysics.BODIES.Ball].AabbMin;
var topRightBall = _physics.SceneBodies[(int)PongPhysics.BODIES.Ball].AabbMax;
Director.Instance.DrawHelpers.DrawBounds2Fill(
new Bounds2(bottomLeftBall*PongPhysics.PtoM,topRightBall*PongPhysics.PtoM));
};
}
//Now load the sound fx and create a player
_pongSound = new Sound("/Application/audio/pongblip.wav");
_pongBlipSoundPlayer = _pongSound.CreatePlayer();
Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);
}
示例4: SoundCheckCache
/// <summary>
/// 判断音乐是否加装
/// </summary>
/// <param name='name'>
/// 音效名称
/// </param>
private void SoundCheckCache(string name)
{
if (SoundDictionary.ContainsKey(name))
return;
var sound = new Sound(SoundPath + name);
var player = sound.CreatePlayer();
SoundDictionary[name] = player;
}
示例5: Initialize
public static void Initialize()
{
clock = new Stopwatch();
clock.Start();
backgroundMusic = new Bgm("/Application/assets/music.mp3");
backgroundPlayer = backgroundMusic.CreatePlayer();
backgroundPlayer.Loop = true;
backgroundPlayer.Play();
presentSound = new Sound("/Application/assets/jinglebell.wav");
presentSoundPlayer = presentSound.CreatePlayer();
isPlaying = true;
// Set up the graphics system
graphics = new GraphicsContext ();
gen= new Random();
NewGame(0);
currentGameState = GameState.Menu;
menuDisplay = new MenuDisplay(graphics);
}
示例6: CheckCache
public void CheckCache(string name)
{
if (SoundDatabase.ContainsKey(name)){
return;
}
Console.WriteLine(AssetsPrefix + name);
using (var sound = new Sound(AssetsPrefix + name) )
{
var player = sound.CreatePlayer();
SoundDatabase[name] = player;
}
}
示例7: Initialize
// 初期化
public void Initialize()
{
// GameEngine2D 画面クリアー色の設定
Director.Instance.GL.Context.SetClearColor (Colors.Grey20);
// 画面解像度情報
// ScreenSize = new Vector2i (854, 480);
ScreenSize = new Vector2i (960, 544);
// 効果音の設定
var soundObj = new Sound ("/Application/assets/se.wav");
Sound = soundObj.CreatePlayer ();
// BGMの設定
bgm = new Bgm ("/Application/assets/bgm.mp3");
player = bgm.CreatePlayer ();
player.Loop = true; // リピート再生する
// BGMの再生
player.Play ();
// シーン生成(ノードのルートになる)
var scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene ();
// 2Dゲーム向けにカメラを設定
scene.Camera.SetViewFromViewport ();
// GameEngine2Dを実行
Director.Instance.RunWithScene (scene, true);
Pause = false;
World = new Node ();
// Interface = new Node ();
// シーンにWorldを追加する
scene.AddChild (World);
// シーンにInterface(UIで利用する)を追加する
// scene.AddChild (Interface);
// 背景登録
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 6; x++) {
var backGround = new BackGround (new Vector2 (x * 192, y * 128));
World.AddChild (backGround);
}
}
// 自機(プレイヤー)登録
Player = new Player (new Vector2 (Game.Instance.ScreenSize.X/2, 100));
World.AddChild (Player);
// 敵機(ボス)登録
Boss = new Boss (new Vector2 (Game.Instance.ScreenSize.X/2, 250));
World.AddChild (Boss);
// UI登録
UI = new UI ();
//Interface.AddChild (UI);
scene.AddChild (UI);
// 当たり判定処理の生成
HitTest = new HitTest ();
// 登録キュー
AddQueue = new List<GameEntity> ();
// 削除キュー
RemoveQueue = new List<GameEntity> ();
}
示例8: Initialize
public static void Initialize()
{
// Set up the graphics system
graphics = new GraphicsContext ();
// Background.cs initialization.
background = new Background(graphics);
// Fore ground
foreground = new Foreground (graphics);
// Create clock from System.Dianogstic
clock = new Stopwatch();
clock.Start();
rand = new Random(); // rand.Next(-100, 230); this will perform random calculation.
// Music.
Bgm bgm = new Bgm("/Application/Resources/bgm.mp3");
// This will create a music based on the music file installed.
bgmPlayer = bgm.CreatePlayer();
/* For this lines I experiencing problems is because
* the sound file I manually import is not working well
* with PSM sdk. It is there with some standard that will
* that more time in configuring it.
* **********************************************************/
Sound noise=new Sound("/Application/Resources/missile_shot.wav");
FireShots = noise.CreatePlayer();
Sound Explode=new Sound("/Application/Resources/explosion.wav");
Explosion = Explode.CreatePlayer();
/* Game start with game enumaration transition to states.
* These lines below must be written after all of the initialization.
* */
currentState = GameStates.Menu;
// New games starts ^^
NewGame();
// Menu displays. Only once in initialize.
Menus = new MenuDisplays(graphics);
}
示例9: Add
public static void Add(string name, Sound sound)
{
_sounds[name.ToLower()]=sound;
_players[name.ToLower()]=sound.CreatePlayer();
}
示例10: CheckCache
public void CheckCache(string name)
{
if (SoundDatabase.ContainsKey(name))
return;
var sound = new Sound(AssetsPrefix + name);
var player = sound.CreatePlayer();
SoundDatabase[name] = player;
}
示例11: CheckCache
public void CheckCache(string name)
{
if (SoundDatabase.ContainsKey(name)){
return;
}
using (var sound = new Sound(AssetsPrefix + name) )
{
var player = sound.CreatePlayer();
SoundDatabase[name] = player;
#if DEBUG
System.Console.WriteLine("SOUND CACHE: " + AssetsPrefix + name + " ADDED. " + SoundDatabase.Keys.Count + " sounds in SoundDatabase");
#endif
}
}