public static void init() { #if DEBUG sout.println("KeySoundPlayer#init"); #endif m_sound_previewer = new BSoundPlayer[48]; m_temp_player = null; m_prepared = new bool[127]; string cache_path = Utility.getKeySoundPath(); for (int i = 0; i <= 126; i++) { string path = Path.Combine(cache_path, i + ".wav"); if (File.Exists(path)) { m_prepared[i] = true; if (36 <= i && i <= 83) { try { m_sound_previewer[i - 36] = new BSoundPlayer(path); } catch (Exception ex) { serr.println("KeySoundPlayer#init; ex=" + ex); } } } else { m_prepared[i] = false; } } }
protected void HandleUpdate() { _secondsLeft -= Time.deltaTime; if (_secondsLeft <= 0) { BSoundPlayer.PlayVictoryMusic(); BMain.instance.GoToPage(BPageType.ScorePage); return; } _timeLabel.text = ((int)_secondsLeft) + " Seconds Left"; if (_secondsLeft < 10) //make the timer red with 10 seconds left { _timeLabel.color = new Color(1.0f, 0.2f, 0.0f); } _framesTillNextBanana--; if (_framesTillNextBanana <= 0) { if (_totalBananasCreated % 4 == 0) //every 4 bananas, make the bananas come a little bit sooner { _maxFramesTillNextBanana--; } _framesTillNextBanana = _maxFramesTillNextBanana; CreateBanana(); } //loop backwards so that if we remove a banana from _bananas it won't cause problems for (int b = _bananas.Count - 1; b >= 0; b--) { BBanana banana = _bananas[b]; //remove a banana if it falls off screen if (banana.y < -Futile.screen.halfHeight - 50) { _bananas.Remove(banana); _bananaContainer.RemoveChild(banana); } } _frameCount++; }
void initDrawing() { bg = new Bitmap(bg, this.Size); centerFormat = new StringFormat(StringFormatFlags.NoWrap); centerFormat.Alignment = StringAlignment.Center; centerFormat.LineAlignment = StringAlignment.Center; selectionButtons = new Button[] { btnSlot0, btnSlot1, btnSlot2, btnSlot3, btnSlot4, btnSlot5, btnSlot6, }; bgmPlayer = new BSoundPlayer("BGM45515.mp3"); bgmPlayer.advancedloop = true; bgmPlayer.loopMilliTime = 45515; }
public static void play(int note) { if (note < 0 || 127 <= note) { return; } try { if (!m_prepared[note]) { return; } if (36 <= note && note <= 83) { if (m_sound_previewer[note - 36] != null) { try { m_sound_previewer[note - 36].play(); } catch (Exception ex) { serr.println("KeySoundPlayer#play; ex=" + ex); } } } else { if (m_temp_player == null) { m_temp_player = new BSoundPlayer(); } string path = Path.Combine(Utility.getKeySoundPath(), note + ".wav"); if (File.Exists(path)) { m_temp_player.setSoundLocation(path); m_temp_player.play(); } } } catch {; } }
public void HandleGotBanana(BBanana banana) { CreateBananaExplodeEffect(banana); _bananaContainer.RemoveChild(banana); _bananas.Remove(banana); BMain.instance.score++; if (BMain.instance.score == 1) { _scoreLabel.text = "1 Banana"; } else { _scoreLabel.text = BMain.instance.score + " Bananas"; } BSoundPlayer.PlayBananaSound(); }
private void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; //Time.timeScale = 0.1f; bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(true, true, true, shouldSupportPortraitUpsideDown); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2"); //iPad fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/BananaLargeAtlas"); Futile.atlasManager.LoadAtlas("Atlases/BananaGameAtlas"); Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix + ".png", "Atlases/FranchiseFont" + Futile.resourceSuffix); _stage = Futile.stage; BSoundPlayer.PlayRegularMusic(); GoToPage(BPageType.TitlePage); }
private void HandleAgainButtonRelease(FButton button) { BSoundPlayer.PlayRegularMusic(); BMain.instance.GoToPage(BPageType.InGamePage); }