/// public メソッド ///--------------------------------------------------------------------------- /// シーンの初期化 public bool Init(DemoGame.SceneManager sceneMgr) { /// ゲーム制御開始 GameCtrlManager.GetInstance().Start(); /// 配置情報のセット SetupObjPlaceData.Load(); setupLyout(); AppSound.GetInstance().PlayBgm(AppSound.BgmId.Main, true); AppDispEff.GetInstance().SetFadeIn(0xffffff, 10, true); useSceneMgr = sceneMgr; GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.GraphicsDevice useGraphDev = ctrlResMgr.GraphDev; pauseFlag = false; return(true); }
/// フレーム処理 public bool Update() { switch (taskId) { case 0: if (AppSound.GetInstance().IsBgmPlaing() == false) { AppLyout.GetInstance().SetSprite(AppLyout.SpriteId.TouchScreen); taskId++; } break; case 1: if (AppInput.GetInstance().TouchRelease == true) { alphaCnt = 0; AppDispEff.GetInstance().SetFadeOut(0xffffff, 5, true); taskId++; break; } alphaCnt++; if (alphaCnt < 100) { alpha += 0.02f; if (alpha >= 1.0f) { alpha = 1.0f; alphaCnt = 100; } } else { alpha -= 0.02f; if (alpha < 0.25f) { alpha = 0.25f; alphaCnt = 0; } } break; case 2: if (AppDispEff.GetInstance().NowEffId != AppDispEff.EffId.FadeOut) { useSceneMgr.Next((new SceneTitle()), false); } alpha = 0.0f; break; } GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); ctrlResMgr.FrameResult(); AppLyout.GetInstance().SetAlpha(AppLyout.SpriteId.TouchScreen, alpha); return(true); }
/// 描画処理 public bool Render() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.GraphicsDevice useGraphDev = ctrlResMgr.GraphDev; useGraphDev.Graphics.SetClearColor(0.5f, 0.5f, 0.5f, 0.0f); useGraphDev.Graphics.Clear(); /// ゲーム制御 ctrlResMgr.Draw(); /// /// デバック用FPS表示 /// DemoGame.Graphics2D.AddSprite( "Fps", "ms : "+GameCtrlManager.GetInstance().GetMs()+ /// " (Fps : "+((int)GameCtrlManager.GetInstance().GetFps())+")", 0xffffffff, /// 2, useGraphDev.DisplayHeight-28 ); /// /// DemoGame.Graphics2D.AddSprite( "Mem", "CollNum : "+AppDebug.CollCnt+"(MS:"+AppDebug.TimeCal+")", 0xffffffff, /// 2, useGraphDev.DisplayHeight-28*2 ); /// DemoGame.Graphics2D.AddSprite( "Wood", "("+AppDebug.WoodCnt+")", 0xffffffff, 2, useGraphDev.DisplayHeight-28*2 ); /// AppDebug.WoodCnt = 0; //#if DEBUG // DemoGame.Graphics2D.AddSprite( "Fps", GameCtrlManager.GetInstance().GetMs()+ "ms", 0xffffffff, 0, 30); //#endif AppDebug.CollCnt = 0; /// 開始からしばらくの間、メッセージを表示 if (startMessCnt < 180) { renderStartMess(); startMessCnt++; } if (pauseFlag == true) { renderPause(); } /// レイアウトの描画 AppLyout.GetInstance().Render(); AppDispEff.GetInstance().Draw(useGraphDev); useGraphDev.Graphics.SwapBuffers(); DemoGame.Graphics2D.RemoveSprite("Fps"); DemoGame.Graphics2D.RemoveSprite("Mess"); DemoGame.Graphics2D.RemoveSprite("Pause"); #if DEBUG_MODE /// DemoGame.Graphics2D.RemoveSprite( "Mem" ); /// DemoGame.Graphics2D.RemoveSprite( "Wood" ); #endif return(true); }
/// 継承メソッド ///--------------------------------------------------------------------------- /// 初期化 public override bool DoInit() { /// シーンマネージャの生成 ///--------------------------------------------- sceneMgr = new DemoGame.SceneManager(); if (sceneMgr.Init() == false) { return(false); } /// デバックパラメータの初期化 ///--------------------------------------------- AppDebug.Init(); /// 入力クラスのセットアップ ///--------------------------------------------- AppInput.GetInstance().Init(inputGPad, inputTouch, graphicsDevice); /// レイアウトクラスのセットアップ ///--------------------------------------------- AppLyout.GetInstance().Init(graphicsDevice); //SocketSample.GetInstance().Init(); //SocketSample.GetInstance().start(); /// シーンパラメータマネージャのセットアップ ///--------------------------------------------- GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); ctrlResMgr.Init(); ctrlResMgr.SetGraphicsDevice(graphicsDevice); /// 画面効果クラスのセットアップ ///--------------------------------------------- AppDispEff.GetInstance().Init(); /// デバック系のセットアップ ///--------------------------------------------- DemoGame.RenderGeometry.Init("/Application/shaders/AmbientColor.cgx", null); sceneMgr.Next((new SceneDataLoad()), false); return(true); }
/// フレーム public override bool DoUpdate() { AppInput.GetInstance().Frame(); if (AppDispEff.GetInstance().Frame()) { return(true); } sceneMgr.Update(); GameCtrlManager.GetInstance().SetFps(GetFps()); GameCtrlManager.GetInstance().SetMs(GetMs()); return(true); }
/// フレーム処理:終了 private bool updateEnd() { if (taskId == 0) { setPageArrow(-1); AppLyout.GetInstance().ClearSprite(AppLyout.SpriteId.Back_on); AppLyout.GetInstance().SetSprite(AppLyout.SpriteId.Back_off); taskId++; return(true); } if (AppDispEff.GetInstance().NowEffId != AppDispEff.EffId.FadeOut) { useSceneMgr.Prev(); } return(true); }
/// 描画処理 public bool Render() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.GraphicsDevice useGraphDev = ctrlResMgr.GraphDev; useGraphDev.Graphics.SetClearColor(0.5f, 0.5f, 0.5f, 0.0f); useGraphDev.Graphics.Clear(); ctrlResMgr.Draw(); /// レイアウトの描画 AppLyout.GetInstance().Render(); AppDispEff.GetInstance().Draw(useGraphDev); useGraphDev.Graphics.SwapBuffers(); return(true); }
/// 描画処理 public bool Render() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.GraphicsDevice useGraphDev = ctrlResMgr.GraphDev; useGraphDev.Graphics.SetClearColor(0.0f, 0.025f, 0.25f, 0.0f); useGraphDev.Graphics.Clear(); DemoGame.Graphics2D.RemoveSprite("mess"); DemoGame.Graphics2D.AddSprite("mess", " Now Loading ...", 0xffffffff, 20, 120); DemoGame.Graphics2D.DrawSprites(); AppDispEff.GetInstance().Draw(useGraphDev); useGraphDev.Graphics.SwapBuffers(); DemoGame.Graphics2D.RemoveSprite("mess"); return(true); }
/// フレーム処理 public bool Update() { switch (taskId) { case 0: if (AppDispEff.GetInstance().NowEffId != AppDispEff.EffId.FadeIn) { taskId++; } break; case 1: checkInputButtons(); if (eventState != 0) { if ((eventState & EveStateId.GameStart) != 0) { AppDispEff.GetInstance().SetFadeOut(0xffffff, 10, true); fadeFlag = true; } taskId++; } break; case 2: if (AppDispEff.GetInstance().NowEffId != AppDispEff.EffId.FadeOut) { if ((eventState & EveStateId.GameStart) != 0) { useSceneMgr.Next((new SceneGameMain()), false); } } break; } // GameCtrlManager.GetInstance().FrameTitle(); return(true); }
/// public メソッド ///--------------------------------------------------------------------------- /// シーンの初期化 public bool Init(DemoGame.SceneManager sceneMgr) { taskId = 0; useSceneMgr = sceneMgr; eventState = 0; AppLyout.GetInstance().ClearSpriteAll(); // AppLyout.GetInstance().SetSprite( AppLyout.SpriteId.Logo ); GameCtrlManager.GetInstance().Start(); /// 配置情報のセット SetupObjPlaceData.Load(); AppDispEff.GetInstance().SetFadeIn(0xffffff, 5, true); fadeFlag = false; fadeCount = 0; return(true); }
/// 破棄 public override bool DoTerm() { if (sceneMgr != null) { sceneMgr.Term(); } sceneMgr = null; GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); ctrlResMgr.Term(); AppDispEff.GetInstance().Term(); AppDebug.Term(); AppInput.GetInstance().Term(); AppLyout.GetInstance().Term(); AppSound.GetInstance().Term(); DemoGame.RenderGeometry.Term(); Data.ModelDataManager.GetInstance().Term(); return(true); }
/// 描画処理 public bool Render() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.GraphicsDevice useGraphDev = ctrlResMgr.GraphDev; useGraphDev.Graphics.SetClearColor(0.5f, 0.5f, 0.5f, 0.0f); useGraphDev.Graphics.Clear(); GameCtrlManager.GetInstance().DrawTitle(); DemoGame.Graphics2D.FillRect(0x80000040, 0, 0, useGraphDev.DisplayWidth, useGraphDev.DisplayHeight); /// BGの描画 if (pageTbl.sprBg != null) { DemoGame.Graphics2D.DrawSprite(pageTbl.sprBg, touchMoveX, 0); } /// イメージ画の描画 for (int i = 0; i < trlDataTbl[pageNow].GetInfoNum(); i++) { if (pageTbl.sprObj[i] != null) { DemoGame.Graphics2D.DrawSprite(pageTbl.sprObj[i], touchMoveX, 0); } } /// フォントの表示 for (int i = 0; i < trlDataTbl[pageNow].GetInfoNum(); i++) { DemoGame.Graphics2D.FillRect(0x20000040, pageFontPosTbl[(startPosIdx + i) * 2 + 0] + AppLyout.GetInstance().OffsetW - 110 + touchMoveX, pageFontPosTbl[(startPosIdx + i) * 2 + 1] + AppLyout.GetInstance().OffsetH - 62, 220, 124); for (int j = 0; j < trlDataTbl[pageNow].GetMessLen(i); j++) { int strW = DemoGame.Graphics2D.CurrentFont.GetTextWidth(trlDataTbl[pageNow].GetMess(i, j)); int strH = DemoGame.Graphics2D.CurrentFont.Size; int posX = pageFontPosTbl[(startPosIdx + i) * 2 + 0] + AppLyout.GetInstance().OffsetW - strW / 2; int posY = pageFontPosTbl[(startPosIdx + i) * 2 + 1] + AppLyout.GetInstance().OffsetH - (trlDataTbl[pageNow].GetMessLen(i) * strH / 2) + j * strH; DemoGame.Graphics2D.AddSprite("Mess" + i * 10 + j, trlDataTbl[pageNow].GetMess(i, j), 0xffffffff, touchMoveX + posX, posY); } } /// スプライトの描画 AppLyout.GetInstance().Render(); for (int i = 0; i < trlDataTbl[pageNow].GetInfoNum(); i++) { for (int j = 0; j < trlDataTbl[pageNow].GetMessLen(i); j++) { DemoGame.Graphics2D.RemoveSprite("Mess" + i * 10 + j); } } AppDispEff.GetInstance().Draw(useGraphDev); useGraphDev.Graphics.SwapBuffers(); return(true); }