public SceneMapSelect() { sceneType = scene.SceneType.MapSelect; _loader = new MapLoader(); _loader.OnMapLoaded += (s, e) => { _loadedMap = e.Map; _loadEnd = true; _loading = false; }; _loader.OnMapLoadCanceled += (s, e) => { _loadedException = e.Exception; _loadedMap = null; _loadingMapInfo = null; _loadEnd = true; _loading = false; }; _mapInfos = new List<MapInfo>(); _keys = new Key[] { Key.UpArrow, Key.DownArrow, Key.LeftArrow, Key.RightArrow, Key.Return, Key.Escape, Key.One, Key.Two, Key.R }; _builtinMapInfos = new MapInfo[] { EmptyMap.GetMapInfo(), EmptyFixedMap.GetMapInfo(), RandomMap.GetMapInfo(3), RandomMap.GetMapInfo(5), RandomEndlessMap.GetMapInfo(3) }; _randItems = new string[_builtinMapInfos.Length + 1]; for (int i = 0; i < _builtinMapInfos.Length; i++) { _randItems[i] = _builtinMapInfos[i].MapName; } _randItems[_randItems.Length - 1] = Properties.Resources.MenuItem_ReloadMap; _cursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Foreground); _strongCursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Strong); #region レイアウト初期化 Size escSize = ResourceManager.MiddlePFont.SizeText(_escItems[0].ToString()); _escRect = new Rectangle( Constants.ScreenWidth - Constants.RightBottomItemMargin - escSize.Width - Constants.CursorMargin, Constants.ScreenHeight - Constants.RightBottomItemMargin - escSize.Height, escSize.Width + Constants.CursorMargin, escSize.Height); _expRect = new Rectangle( Constants.HeaderX + Constants.UnderHeaderMargin, Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin, Constants.ScreenWidth - Constants.UnderHeaderMargin * 2, ResourceManager.SmallPFont.Height); int top = _expRect.Bottom + Constants.SubHeaderBottomMargin; int bottom = _escRect.Top - Constants.UnderHeaderMargin; _mapRect = new Rectangle( Constants.HeaderX + Constants.UnderHeaderMargin + Constants.CursorMargin, top, (int)((Constants.ScreenWidth - (Constants.HeaderX + Constants.UnderHeaderMargin * 2) - Constants.MenuColumnGap) / 2.0) - Constants.CursorMargin, bottom - top); _randRect = new Rectangle( _mapRect.Right + Constants.MenuColumnGap + Constants.CursorMargin, _mapRect.Top, _mapRect.Width, _mapRect.Height); #endregion _randSurfaces = new SurfaceCollection(); _randRects = new Rectangle[_randItems.Length]; ImageUtil.CreateStrMenu(_randItems, Constants.Color_Foreground, ref _randSurfaces, ref _randRects, _randRect.Width); _randRects[_randRects.Length - 1].Offset(0, ResourceManager.SmallPFont.Height); _escSurfaces = new SurfaceCollection(); _escRects = new Rectangle[_escItems.Length]; ImageUtil.CreateStrMenu(_escItems, Constants.Color_Strong, ResourceManager.MiddlePFont, ref _escSurfaces, ref _escRects, _escRect.Width, ResourceManager.MiddlePFont.Height); }
public SceneOption() : base() { sceneType = SceneType.Option; _deviceInfos = new List <DeviceInfo>(); _keys = new Key[] { Key.UpArrow, Key.DownArrow, Key.RightArrow, Key.LeftArrow, Key.Return, Key.Escape//, Key.Space }; Size escSize = ResourceManager.MiddlePFont.SizeText(_endHeadStrs[0].ToString()); _endHeadRect = new Rectangle( Constants.ScreenWidth - Constants.RightBottomItemMargin - escSize.Width - Constants.CursorMargin, Constants.ScreenHeight - Constants.RightBottomItemMargin - escSize.Height, escSize.Width + Constants.CursorMargin, escSize.Height); _devHeadRect = new Rectangle( Constants.HeaderX + Constants.UnderHeaderMargin, Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin, (int)((Constants.ScreenWidth - (Constants.HeaderX + Constants.UnderHeaderMargin * 2) - Constants.MenuColumnGap) / 2.0), ResourceManager.MiddlePFont.Height); int devRectTop = _devHeadRect.Bottom + Constants.SubHeaderBottomMargin; int devRectBottm = _endHeadRect.Top - Constants.UnderHeaderMargin; _devRect = new Rectangle( _devHeadRect.X + Constants.CursorMargin, devRectTop, _devHeadRect.Right - (_devHeadRect.X + Constants.CursorMargin), devRectBottm - devRectTop); _calHeadRect = new Rectangle(_devRect.Right + Constants.MenuColumnGap, _devHeadRect.Top, _devHeadRect.Width, _devHeadRect.Height); _calRect = new Rectangle(_calHeadRect.X + Constants.CursorMargin, _devRect.Y, _devRect.Width, _devRect.Height); _calMenuRect = new Rectangle(_calRect.X, _calRect.Y + (int)(ResourceManager.SmallPFont.Height * Constants.MenuLineHeight), _calRect.Width, _calRect.Height - Constants.WaveHeight - Constants.WaveInfoHeight - (int)(ResourceManager.SmallPFont.Height * Constants.MenuLineHeight)); _calWaveRect = new Rectangle(_calRect.X, _calRect.Bottom - Constants.WaveHeight, _calRect.Width, Constants.WaveHeight); _cursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Foreground); _headCursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Strong); _calSurfaces = new SurfaceCollection(); _calRects = new Rectangle[_calStrs.Length]; ImageUtil.CreateStrMenu(_calStrs, Constants.Color_Foreground, ResourceManager.SmallPFont, ref _calSurfaces, ref _calRects, _calRect.Width); _endHeadSurfaces = new SurfaceCollection(); _endHeadRects = new Rectangle[1]; ImageUtil.CreateStrMenu(_endHeadStrs, Constants.Color_Strong, ResourceManager.MiddlePFont, ref _endHeadSurfaces, ref _endHeadRects, _endHeadRect.Width); _minFreqs = new Queue <double>(Constants.FreqAvgMaxCount); _maxFreqs = new Queue <double>(Constants.FreqAvgMaxCount); }
public SceneMapSelect() { sceneType = scene.SceneType.MapSelect; _loader = new MapLoader(); _loader.OnMapLoaded += (s, e) => { _loadedMap = e.Map; _loadEnd = true; _loading = false; }; _loader.OnMapLoadCanceled += (s, e) => { _loadedException = e.Exception; _loadedMap = null; _loadingMapInfo = null; _loadEnd = true; _loading = false; }; _mapInfos = new List <MapInfo>(); _keys = new Key[] { Key.UpArrow, Key.DownArrow, Key.LeftArrow, Key.RightArrow, Key.Return, Key.Escape, Key.One, Key.Two, Key.R }; _builtinMapInfos = new MapInfo[] { EmptyMap.GetMapInfo(), EmptyFixedMap.GetMapInfo(), RandomMap.GetMapInfo(3), RandomMap.GetMapInfo(5), RandomEndlessMap.GetMapInfo(3) }; _randItems = new string[_builtinMapInfos.Length + 1]; for (int i = 0; i < _builtinMapInfos.Length; i++) { _randItems[i] = _builtinMapInfos[i].MapName; } _randItems[_randItems.Length - 1] = Properties.Resources.MenuItem_ReloadMap; _cursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Foreground); _strongCursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Strong); #region レイアウト初期化 Size escSize = ResourceManager.MiddlePFont.SizeText(_escItems[0].ToString()); _escRect = new Rectangle( Constants.ScreenWidth - Constants.RightBottomItemMargin - escSize.Width - Constants.CursorMargin, Constants.ScreenHeight - Constants.RightBottomItemMargin - escSize.Height, escSize.Width + Constants.CursorMargin, escSize.Height); _expRect = new Rectangle( Constants.HeaderX + Constants.UnderHeaderMargin, Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin, Constants.ScreenWidth - Constants.UnderHeaderMargin * 2, ResourceManager.SmallPFont.Height); int top = _expRect.Bottom + Constants.SubHeaderBottomMargin; int bottom = _escRect.Top - Constants.UnderHeaderMargin; _mapRect = new Rectangle( Constants.HeaderX + Constants.UnderHeaderMargin + Constants.CursorMargin, top, (int)((Constants.ScreenWidth - (Constants.HeaderX + Constants.UnderHeaderMargin * 2) - Constants.MenuColumnGap) / 2.0) - Constants.CursorMargin, bottom - top); _randRect = new Rectangle( _mapRect.Right + Constants.MenuColumnGap + Constants.CursorMargin, _mapRect.Top, _mapRect.Width, _mapRect.Height); #endregion _randSurfaces = new SurfaceCollection(); _randRects = new Rectangle[_randItems.Length]; ImageUtil.CreateStrMenu(_randItems, Constants.Color_Foreground, ref _randSurfaces, ref _randRects, _randRect.Width); _randRects[_randRects.Length - 1].Offset(0, ResourceManager.SmallPFont.Height); _escSurfaces = new SurfaceCollection(); _escRects = new Rectangle[_escItems.Length]; ImageUtil.CreateStrMenu(_escItems, Constants.Color_Strong, ResourceManager.MiddlePFont, ref _escSurfaces, ref _escRects, _escRect.Width, ResourceManager.MiddlePFont.Height); }
public SceneOption() : base() { sceneType = SceneType.Option; _deviceInfos = new List<DeviceInfo>(); _keys = new Key[] { Key.UpArrow, Key.DownArrow, Key.RightArrow, Key.LeftArrow, Key.Return, Key.Escape//, Key.Space }; Size escSize = ResourceManager.MiddlePFont.SizeText(_endHeadStrs[0].ToString()); _endHeadRect = new Rectangle( Constants.ScreenWidth - Constants.RightBottomItemMargin - escSize.Width - Constants.CursorMargin, Constants.ScreenHeight - Constants.RightBottomItemMargin - escSize.Height, escSize.Width + Constants.CursorMargin, escSize.Height); _devHeadRect = new Rectangle( Constants.HeaderX + Constants.UnderHeaderMargin, Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin, (int)((Constants.ScreenWidth - (Constants.HeaderX + Constants.UnderHeaderMargin * 2) - Constants.MenuColumnGap) / 2.0), ResourceManager.MiddlePFont.Height); int devRectTop = _devHeadRect.Bottom + Constants.SubHeaderBottomMargin; int devRectBottm = _endHeadRect.Top - Constants.UnderHeaderMargin; _devRect = new Rectangle( _devHeadRect.X + Constants.CursorMargin, devRectTop, _devHeadRect.Right - (_devHeadRect.X + Constants.CursorMargin), devRectBottm - devRectTop); _calHeadRect = new Rectangle(_devRect.Right + Constants.MenuColumnGap, _devHeadRect.Top, _devHeadRect.Width, _devHeadRect.Height); _calRect = new Rectangle(_calHeadRect.X + Constants.CursorMargin, _devRect.Y, _devRect.Width, _devRect.Height); _calMenuRect = new Rectangle(_calRect.X, _calRect.Y + (int)(ResourceManager.SmallPFont.Height * Constants.MenuLineHeight), _calRect.Width, _calRect.Height - Constants.WaveHeight - Constants.WaveInfoHeight - (int)(ResourceManager.SmallPFont.Height * Constants.MenuLineHeight)); _calWaveRect = new Rectangle(_calRect.X, _calRect.Bottom - Constants.WaveHeight, _calRect.Width, Constants.WaveHeight); _cursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Foreground); _headCursor = ResourceManager.GetColoredCursorGraphic(Constants.Color_Strong); _calSurfaces = new SurfaceCollection(); _calRects = new Rectangle[_calStrs.Length]; ImageUtil.CreateStrMenu(_calStrs, Constants.Color_Foreground, ResourceManager.SmallPFont, ref _calSurfaces, ref _calRects, _calRect.Width); _endHeadSurfaces = new SurfaceCollection(); _endHeadRects = new Rectangle[1]; ImageUtil.CreateStrMenu(_endHeadStrs, Constants.Color_Strong, ResourceManager.MiddlePFont, ref _endHeadSurfaces, ref _endHeadRects, _endHeadRect.Width); _minFreqs = new Queue<double>(Constants.FreqAvgMaxCount); _maxFreqs = new Queue<double>(Constants.FreqAvgMaxCount); }