//private Dictionary<string, string> moduleName2AssemblyName = new Dictionary<string, string>(); public void Init(IGameMain gameMain) { mGameMain = gameMain; RegModuleList.Clear(); RegModuleList["CardDeck"] = typeof(CardDeckModule); RegModuleList["UIMgr"] = typeof(UIMgr); RegModuleList["ResLoader"] = typeof(ResLoader); RegModuleList["LogicTree"] = typeof(LogicTree); RegModuleList["DialogModule"] = typeof(DialogModule); RegModuleList["SpeEventMgr"] = typeof(SpeEventMgr); RegModuleList["RoleModule"] = typeof(RoleModule); RegModuleList["CoreManager"] = typeof(CoreManager); RegModuleList["SkillTreeMgr"] = typeof(SkillTreeMgr); mMapType[typeof(CardDeckModule)] = "CardDeck"; mMapType[typeof(UIMgr)] = "UIMgr"; mMapType[typeof(ResLoader)] = "ResLoader"; mMapType[typeof(LogicTree)] = "LogicTree"; mMapType[typeof(DialogModule)] = "DialogModule"; mMapType[typeof(SpeEventMgr)] = "SpeEventMgr"; mMapType[typeof(RoleModule)] = "RoleModule"; mMapType[typeof(CoreManager)] = "CoreManager"; }
public static IGameMain GetInstance() { if (mInstance == null) { Type type = typeof(GameMain); GameMain gameMain = (GameMain)FindObjectOfType(type); mInstance = gameMain; } return(mInstance); }
public static void GPMain(IGameMain gameMain) { #if DEBUG ProcMain.WriteLog = message => { using (StreamWriter writer = new StreamWriter(@"C:\tmp\Game.log", LogWrote, Encoding.UTF8)) { writer.WriteLine("[" + DateTime.Now + "] " + message); } LogWrote = true; }; #else ProcMain.WriteLog = message => { }; #endif HandleDam.Transaction(hDam => { GameGround.I = new GameGround(); GameGround.I.Handles = hDam; GPMain2(gameMain); }); }
private static void GPMain2(IGameMain gameMain) { gameMain.Init(); GameGround.I.Init(); GameGround.I.LoadFromDatFile(); GameGround.I.Config.LoadConfig(); // DxLib > #if DEBUG DX.SetApplicationLogSaveDirectory(@"C:\tmp"); #endif DX.SetOutApplicationLogValidFlag(GameDefine.DEBUG_MODE ? 1 : 0); // DxLib のログを出力 1: する 0: しない DX.SetAlwaysRunFlag(1); // ? 非アクティブ時に 1: 動く 0: 止まる SetMainWindowTitle(); //DX.SetGraphMode(GameDefine.SCREEN_SIZE.W, GameDefine.SCREEN_SIZE.H, 32); DX.SetGraphMode(GameGround.I.RealScreenSize.W, GameGround.I.RealScreenSize.H, 32); DX.ChangeWindowMode(1); // 1: ウィンドウ 0: フルスクリーン //DX.SetFullSceneAntiAliasingMode(4, 2); // 適当な値が分からん。フルスクリーン廃止したので不要 DX.SetWindowIconHandle(gameMain.GetIcon()); // ウィンドウ左上のアイコン if (GameGround.I.Config.DisplayIndex != -1) { DX.SetUseDirectDrawDeviceIndex(GameGround.I.Config.DisplayIndex); } if (DX.DxLib_Init() != 0) { throw new GameError("Error on DxLib_Init()"); } SetMouseDispMode(GameGround.I.RO_MouseDispMode); // ? マウスを表示 true: する false: しない DX.SetWindowSizeChangeEnableFlag(0); // ウィンドウの右下をドラッグで伸縮 1: する 0: しない DX.SetDrawScreen(DX.DX_SCREEN_BACK); DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR); // これをデフォルトとする。 // < DxLib // *.Reset { GameDrawPicture.DPE.Reset(); GameCommonEffect.CEE.Reset(); //PE_Reset(); // TODO } GameGround.I.MonitorRect = new I4Rect(); { int dummy1; int dummy2; int dummy3; int dummy4; DX.GetDefaultState( out GameGround.I.MonitorRect.W, out GameGround.I.MonitorRect.H, out dummy1, out dummy2, out GameGround.I.MonitorRect.L, out GameGround.I.MonitorRect.T, out dummy3, out dummy4 ); } if ( GameGround.I.MonitorRect.W < 1 || IntTools.IMAX < GameGround.I.MonitorRect.W || GameGround.I.MonitorRect.H < 1 || IntTools.IMAX < GameGround.I.MonitorRect.H || GameGround.I.MonitorRect.L < -IntTools.IMAX || IntTools.IMAX < GameGround.I.MonitorRect.L || GameGround.I.MonitorRect.T < -IntTools.IMAX || IntTools.IMAX < GameGround.I.MonitorRect.T ) { throw new GameError(); } try { gameMain.Main(); } catch (GameError.EndProc) { } // Codevil の EndProc() ... GameGround.I.SaveToDatFile(); GameGround.I.GameHandles.Burst(); GameGround.I.Fnlz(); if (DX.DxLib_End() != 0) { throw new GameError("Erred on DxLib_End()"); } // ... Codevil の EndProc() }
public void Release() { mInstance = null; }
public void SetModuleName(IGameMain gameMain, string name) { mGameMain = gameMain; mModuleName = name; }