public Voice getString(int id, byte leftChara, byte rightChara) { switch(leftChara){ case Const.testVoice: switch(rightChara){ case Const.testVoice: this.voice = new VoiceSample(); //this.voice = voice.getVoice(id); break; } break; // case "test2": // switch(rightChara){ // case "test2": // this.voice = new TestVoice2(); // this.voice = voice.getVoice(id); // break; // } // break; } //100下二桁が00で終わってたら00-09までランダムにセリフを選ぶ(idが合わない場合はデフォルトのセリフを選ぶ) if(id%100 == 0){ id += this.random.Next(0,10);//0-9 } this.voice = voice.getVoice(id); return this.voice; }
public override Scene Initialize() { scene.Camera.SetViewFromViewport(); str = new SpriteUV[4]; //max4行 voice = selectVoice.getString(Const.NOVELID,Const.LEFTCHARACTER,Const.RIGHTCHARACTER); //画像描画クラス background = DrawPicture.DrawSprite((string)this.voice.getBackground()[0], 0*Const.FIX, 0*Const.FIX, Const.DISPLAY_WIDTH, Const.DISPLAY_HEIGHT,scene); charaLeft = DrawPicture.DrawSprite((string)this.voice.getCharaLeft()[0], 0*Const.FIX, 0*Const.FIX, (float)Const.GRID_SIZE*(Const.GRID_NUM_X/3), Const.DISPLAY_HEIGHT,scene); //左の人 if(this.voice.getCharaLeftFlip()[0]){DrawPicture.FlipHorizontal(this.charaLeft);} charaMid = DrawPicture.DrawSprite((string)this.voice.getCharaMid()[0], (float)(Const.GRID_NUM_X/3)*Const.FIX, 0*Const.FIX, (float)Const.GRID_SIZE*Const.GRID_NUM_X/3, Const.DISPLAY_HEIGHT,scene); //真ん中の人 if(this.voice.getCharaMidFlip()[0]){DrawPicture.FlipHorizontal(this.charaMid);} charaRight = DrawPicture.DrawSprite((string)this.voice.getCharaRight()[0], (float)(Const.GRID_NUM_X*2/3), 0*Const.FIX, (float)Const.GRID_SIZE*Const.GRID_NUM_X/3, Const.DISPLAY_HEIGHT,scene); //右の人 if(this.voice.getCharaRightFlip()[0]){DrawPicture.FlipHorizontal(this.charaRight);} textBox = DrawPicture.DrawSprite("textBox.png", 0*Const.FIX, 6*Const.FIX, Const.GRID_SIZE*20*Const.FIX, Const.GRID_SIZE*5.2f*Const.FIX,scene); //テキストボックス name = WriteString.DrawSprite((string)this.voice.getNameList()[0],1.5f*Const.FIX,6.4f*Const.FIX,Const.FONT_SIZE_MESSAGE,new ImageColor(255,255,255,255),scene); for (int i = 0; i < 4; i++){ //台詞の書き込み str[i]= WriteString.DrawSprite((string)this.voice.getStrList()[i], 1*Const.FIX, (float)(7.2+i*0.8)*Const.FIX, Const.FONT_SIZE_MESSAGE, new ImageColor(255,255,255,255), scene); } //effect(効果音)もbgmも一つにつき一回newする。 this.soundPlayer = Audio.SetEffect("/Application/sound/Bullet.wav"); Audio.SetBgm("/Application/sound/GameBgm.mp3"); // Audio.StartBgm(); return scene; }
//シーン終了時に呼び出す public override void Terminate() { this.scene.RemoveAllChildren(true);//必要 terminateの最初に Audio.StopBgm(); scene = null; name = null; //喋ってるキャラの名前 for (int j =0; j < 4; j++){ str[j] = null; } str = null; //台詞 background = null; //背景 charaLeft = null; //左の人 charaMid = null; //真ん中の人 charaRight = null; //右の人 textBox = null; //テキストボックス selectVoice = null; voice = null; this.soundPlayer.Dispose(); }