public TimeSpan GetTimeLimit(EigoTestMondai mondai) { var shomon = mondai as Shomon; if (null != shomon) { // return GetTimeLimit(shomon).Multiply(Difficulty); return GetTimeLimit(shomon).Multiply(TimeLimitTweak); } var ankimon = mondai as Ankimon; if (null != ankimon) { // return GetTimeLimit(ankimon).Multiply(Difficulty); return GetTimeLimit(ankimon).Multiply(TimeLimitTweak); } var chumon = mondai as Chumon; if (null != chumon) { return GetTimeLimit(chumon); } throw new InvalidOperationException(); }
public ChumonResultState(EPuzzleWindow window, EigoTestMondai mondai, ChumonResult chumonResult, MondaiResult mondaiResult) : base(window) { _mondai = mondai; _chumonResult = chumonResult; DrawingObjectRoot.BackColor = EPuzzleColors.Color109; // var imageFile = ResultImageManager.Instance.GetFile(_mondai.Parent.GetGradeString(mondaiResult.所要時間)); // var imageFile = ResultImageManager.Instance.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間)); var image = window.EPuzzleData.CurrentUserInfo.ResultImageManager.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo)); if (null != image) { // var imageItem = new ImageItem(imageFile, true); var imageItem = new ImageItem(image.Shrink((int)DrawingObjectRoot.Width, (int)DrawingObjectRoot.Height)); imageItem.Left = 0f; imageItem.Top = 0f; imageItem.Position = DrawingObjectPosition.Absolute; Items.Add(imageItem); #if DEBUG { // 使用したファイルの記録 var imagePath = (string)image.Tag; Clipboard.SetText(imagePath); var path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "usedImages.txt"); File.AppendAllText(path, imagePath + Environment.NewLine); } #endif // DEBUG // ResultImageManager.Instance.UpdateAccessTime(fileName); // ResultImageManager.Instance.SaveFileIfItPassed(TimeSpan.FromMinutes(10d)); } var w1 = 180f; var h1 = EPuzzleFonts.ChumonResultState_Default.Height; var backColor = EPuzzleColors.Color107; var kirokuBox = new KirokuBox2() { BorderLine = false, Position = DrawingObjectPosition.Absolute, Width = 200, UserInfo = Window.EPuzzleData.CurrentUserInfo, Chumon = (Chumon)_mondai.Parent, Color = EPuzzleColors.ChumonResultState_KirokuBox2_Color, BackColor = EPuzzleColors.ChumonResultState_KirokuBox2_BackColor, BackColorA = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorA, BackColorB = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorB, LineColor = EPuzzleColors.ChumonResultState_KirokuBox2_LineColor, NodeColor = EPuzzleColors.ChumonResultState_KirokuBox2_NodeColor, }; Items.Add(kirokuBox); var box = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, Color = EPuzzleColors.Color108, BackColor = backColor, Width = w1, PaddingLeft = 10f, PaddingRight = 10f, PaddingTop = 10f, PaddingBottom = 10f, BorderLine = false, }; Items.Add(box); { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = mondai.Parent.LongName, Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("グレード: {0}({1:0.00})", mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo), mondai.Parent.GetGrade(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var duration = mondai.Parent.復習までの猶予期間を取得(window.EPuzzleData.CurrentUserInfo); if (null != duration) { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("復習猶予期間: {0:0.0}日", ((TimeSpan)duration).TotalDays), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("基準時間: {0}", EigoTestMondai.符号無時間文字列(_mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("所要時間: {0}", EigoTestMondai.符号無時間文字列(mondaiResult.所要時間)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("基準との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - _mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } /* { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("Perfect: {0}", string.Join("", chumonResult.ShomonResults.Select(x => x.IsPerfect ? "■" : "□").ToArray())), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); }*/ { var height = 25f; var stars = chumonResult.ShomonResults.Select(x => { var star = new Pentagram(2) { Color = EPuzzleColors.PerfectStarOnChumonResultState, Width = height, Height = height, Tag = x.IsPerfect, PaddingLeft = 3f, PaddingBottom = 3f, }; return star; }).ToArray(); /* for (int i = 0; i < stars.Length; i++) { stars[i].Left = stars[0].OuterWidth * i; stars[i].Top = DrawingObjectRoot.Height - stars[0].OuterHeight; } */ for (int i = 0; i < stars.Length; i++) { stars[i].Left = stars[0].OuterWidth * i; stars[i].Top = 0f; } if (stars.Any()) { var starbox = new DrawingObjectContainer() { Position = DrawingObjectPosition.Absolute, Left = 0f, Top = DrawingObjectRoot.Height - stars.First().OuterHeight, Width = stars.Last().OuterRight - stars.First().OuterLeft, Height = stars.First().OuterHeight, // BackColor = EPuzzleColors.Color107, }; starbox.Items.AddRange(stars); Items.Add(starbox); } // Items.AddRange(stars); } /* { var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id); if (null != bestMondaiResult) { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("最速記録: {0}", EigoTestMondai.符号無時間文字列(bestMondaiResult.所要時間)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } } { var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id); if (null != bestMondaiResult) { var item = new EigoTestLabelItem() { Color = EPuzzleColors.Color108, Text = string.Format("最速との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - bestMondaiResult.所要時間)), Font = EPuzzleFonts.ChumonResultState_Default, Width = w1, Height = h1, StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, }, }; box.Items.Add(item); } }*/ /* var retryButton = new EigoTestButtonItem() { Position = DrawingObjectPosition.Absolute, Color = EPuzzleColors.Color108, Text = "再挑戦", Name = "retryButton", Font = EPuzzleFonts.ChumonResultState_Default, Width = 80, Height = h1, }; Items.Add(retryButton);*/ /* // 右がbox box.Left = DrawingObjectRoot.Width - ( box.OuterWidth + kirokuBox.OuterWidth ); box.Top = DrawingObjectRoot.Height - box.OuterHeight; kirokuBox.Height = box.OuterHeight; kirokuBox.Left = DrawingObjectRoot.Width - kirokuBox.OuterWidth; kirokuBox.Top = box.Top; */ box.Left = DrawingObjectRoot.Width - box.OuterWidth; box.Top = DrawingObjectRoot.Height - box.OuterHeight; kirokuBox.Height = box.OuterHeight; kirokuBox.Left = box.OuterLeft - kirokuBox.OuterWidth; kirokuBox.Top = box.Top; Action0 += (sender, e) => { MouseUpInternal(new MouseEventInfo(new PointF(0f, 0f), MouseButtons.Left)); }; }
public WindowState CreateMondaiState(EigoTestMondai mondai) { var shomon = mondai as Shomon; if (null != shomon) { return CreateShomonState(shomon); } var ankimon = mondai as Ankimon; if (null != ankimon) { return new AnkimonState(this, ankimon); } throw new InvalidOperationException(); }
public static void NextItemAndPreviousItemを設定する(IList<EigoTestMondai> list, EigoTestMondai parent, bool recursive = true) { var count = list.Count(); for (var i = 0; i < count; i++) { list[i].PreviousItem = 0 < i ? list[i-1] : null; list[i].NextItem = i < count - 1 ? list[i+1] : null; list[i].Parent = parent; } if (!recursive) return; foreach (var item in list) { NextItemAndPreviousItemを設定する(item.Items, item); } }
public void Unlock(EigoTestMondai mondai) { if (mondai is Chumon) { Window.EPuzzleData.CurrentUserInfo.MondaiResults.AddNew(mondai.Id, EPuzzleTime.Now, TimeSpan.FromSeconds(1d)); } else if (mondai is Daimon) { foreach (var id in mondai.GetAllItems().OfType<Chumon>().Select(x => x.Id)) { Unlock(id); } } else { throw new ArgumentException(); } }