/// <summary> /// 重設場景 /// </summary> public void Reset() { IsStart = false; IsEnding = false; PlayingInfo = new ScenePlayingInfo(SceneInfo.SceneID, Level, SceneInfo.GetPlayingTimeLimit(Level)); SceneSlow = 1F; GameObjects.Clear(); EffectObjects.Clear(); Waves.Clear(); SetWave(); int maxWave = 0; foreach (WaveLine wave in Waves) { maxWave = Math.Max(maxWave, wave.Length); } WaveNo.Limit = maxWave; WaveNo.Value = 0; WaveCounter.Value = 0; MenuCooldownCounter.Value = MenuCooldownCounter.Limit; Padding padding = Global.DefaultMainRectanglePadding; MainRectangle = new Rectangle(padding.Left, padding.Top, Width - padding.Horizontal, Height - padding.Vertical); }
/// <summary> /// 結算成績 /// </summary> /// <param name="playInfo">場景挑戰記錄</param> public void Settlement(ScenePlayingInfo playInfo) { if (playInfo.SceneID != SceneID) { return; } Settlement(playInfo.Level, playInfo.PlayingTime.Value, playInfo.Score, playInfo.Complete); }
public ObjectUIGameMenu(DirectionType anchor, int x, int y, MoveBase moveObject, ScenePlayingInfo playingInfo, int mode) : base(anchor, x, y, 380, 240 + playingInfo.ScoreDetail.Count * _DetailHeight, new DrawUIFrame(Color.Empty, Color.DarkSlateBlue, 2, 20), moveObject) { _DrawCommandAction = new DrawUIText(Color.Black, Color.White, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "", Global.CommandFont, GlobalFormat.MiddleCenter); _DrawCommandActionHover = new DrawUIText(Color.Black, Color.White, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "", Global.CommandFont, GlobalFormat.MiddleCenter); _UICommandAction = new ObjectUI(210, Layout.Height - 75, 150, 50, _DrawCommandAction); _UICommandAction.DrawObjectHover = _DrawCommandActionHover; _UICommandAction.Layout.Depend.SetObject(this); _UICommandAction.Layout.Depend.Anchor = DirectionType.TopLeft; _UICommandAction.Propertys.Add(new PropertyShadow(-4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandAction.Click += (s, e) => { OnActionButtonClick(_ActionCommand); }; _DrawCommandBack = new DrawUIText(Color.Black, Color.White, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "回選單", Global.CommandFont, GlobalFormat.MiddleCenter); _DrawCommandBackHover = new DrawUIText(Color.Black, Color.White, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "回選單", Global.CommandFont, GlobalFormat.MiddleCenter); _UICommandBack = new ObjectUI(20, Layout.Height - 75, 150, 50, _DrawCommandBack); _UICommandBack.DrawObjectHover = _DrawCommandBackHover; _UICommandBack.Layout.Depend.SetObject(this); _UICommandBack.Layout.Depend.Anchor = DirectionType.TopLeft; _UICommandBack.Propertys.Add(new PropertyShadow(4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandBack.Click += (s, e) => { OnBackButtonClick(); }; _DrawCommandUpdate = new DrawUIText(Color.Black, Color.White, Color.FromArgb(150, 225, 255, 225), Color.Black, 2, 10, "上傳分數", _UpdateFont, GlobalFormat.MiddleCenter); _DrawCommandUpdateHover = new DrawUIText(Color.Black, Color.White, Color.FromArgb(200, 255, 235, 220), Color.Black, 2, 10, "上傳分數", _UpdateFont, GlobalFormat.MiddleCenter); _UICommandUpdate = new ObjectUI(270, 10, 90, 25, _DrawCommandUpdate); _UICommandUpdate.DrawObjectHover = _DrawCommandUpdateHover; _UICommandUpdate.Layout.Depend.SetObject(this); _UICommandUpdate.Layout.Depend.Anchor = DirectionType.TopLeft; _UICommandUpdate.Propertys.Add(new PropertyShadow(4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandUpdate.Click += (s, e) => { if (Global.Online) { Global.SQL.AddParameter("@SceneID", PlayingInfo.SceneID); Global.SQL.AddParameter("@Level", PlayingInfo.Level); Global.SQL.AddParameter("@PlayerName", GlobalPlayer.PlayerName); Global.SQL.AddParameter("@Score", PlayingInfo.Score); if (Global.SQL.Run(@"set time_zone = '+8:00'; insert into Score (SceneID,Level,PlayerName,Score,UpdateTime) values (@SceneID,@Level,@PlayerName,@Score,now())")) { _DrawCommandUpdate.Text = "上傳成功"; _DrawCommandUpdateHover.Text = "上傳成功"; _UICommandUpdate.Enabled = false; } else { _DrawCommandUpdate.Text = "上傳失敗"; _DrawCommandUpdateHover.Text = "上傳失敗"; } } else { _DrawCommandUpdate.Text = "不可用"; _DrawCommandUpdateHover.Text = "不可用"; _UICommandUpdate.Enabled = false; } }; UIObjects.Add(_UICommandBack); UIObjects.Add(_UICommandAction); UIObjects.Add(_UICommandUpdate); PlayingInfo = playingInfo; Mode = mode; }