void Client_OnGambleStoneWinNotify(GambleStoneRoundInfo roundInfo, GambleStoneInningInfo inningInfo, GambleStonePlayerBetRecord maxWinner) { try { //this.CurrentRoundInfo.ParentObject = roundInfo; this.CurrentInningInfo.ParentObject = inningInfo; this.CurrentRoundInfo.SetWinnedInningColor(inningInfo.InningIndex - 1, inningInfo.WinnedColor); if (GambleStoneInningFinished != null) { GambleStoneInningFinished(inningInfo, maxWinner); } //if (!string.IsNullOrEmpty(this.CurrentInningPlayerBetRecord.InningID)) { this.CurrentInningPlayerBetRecord.Clear(); App.UserVMObject.AsyncGetPlayerInfo(); } //if (maxWinner != null && !string.IsNullOrEmpty(maxWinner.UserName)) //{ // MyMessageBox.ShowInfo(maxWinner.UserName + " 赢得 " + maxWinner.WinnedStone + " 矿石"); //} } catch (Exception exc) { MyMessageBox.ShowInfo("疯狂猜石开奖失败。"); LogHelper.Instance.AddErrorLog("疯狂猜石开奖失败。", exc); } }
public GambleStoneInningRunner(GambleStoneRoundInfo roundInfo, GambleStoneInningInfo inning, GambleStoneDailyScheme dailyScheme, ReferBetInInningInfo referInfo) { this._roundInfo = roundInfo; this._inningInfo = inning; this._dailyScheme = dailyScheme; this._referInfo = referInfo; }
void GambleStoneVMObject_GambleStoneInningFinished(GambleStoneInningInfo inningInfo, GambleStonePlayerBetRecord maxWinner) { _syn.Post(o => { if (maxWinner == null || string.IsNullOrEmpty(maxWinner.UserName) || maxWinner.WinnedStone == 0) { this.txtWinnerNotice.Text = ""; } else { this.txtWinnerNotice.Text = maxWinner.UserName + " 赢得 " + maxWinner.WinnedStone + " 矿石"; } if (inningInfo != null && inningInfo.InningIndex > 0 && inningInfo.InningIndex <= 64) { BitmapImage bmp = null; switch (inningInfo.WinnedColor) { case GambleStoneItemColor.Red: //bmp = new BitmapImage(new Uri(@"../../Resources/gamblered.png", UriKind.Relative)); bmp = bmpRed; break; case GambleStoneItemColor.Green: //bmp = new BitmapImage(new Uri(@"../../Resources/gamblegreen.png", UriKind.Relative)); bmp = bmpGreen; break; case GambleStoneItemColor.Blue: //bmp = new BitmapImage(new Uri(@"../../Resources/gambleblue.png", UriKind.Relative)); bmp = bmpBlue; break; case GambleStoneItemColor.Purple: //bmp = new BitmapImage(new Uri(@"../../Resources/gambleyellow.png", UriKind.Relative)); bmp = bmpPurple; break; default: break; } //this.imgCurrentWinnedColor.Source = bmp; this.imgSplitStone1.Visibility = System.Windows.Visibility.Visible; this.imgSplitStone2.Visibility = System.Windows.Visibility.Visible; this.imgSplitStone3.Visibility = System.Windows.Visibility.Visible; this.imgSplitStone4.Visibility = System.Windows.Visibility.Visible; SetNewValueToStoryboard(inningInfo.InningIndex - 1, bmp); Storyboard StoryboardOpenGamble = this.FindResource("StoryboardOpenGamble") as Storyboard; if (StoryboardOpenGamble != null) { StoryboardOpenGamble.Begin(); } } }, null); }
public void RaiseOnGambleStoneWinNotify(GambleStoneRoundInfo roundInfo, GambleStoneInningInfo inningInfo, GambleStonePlayerBetRecord maxWinner) { Action <GambleStoneRoundInfo, GambleStoneInningInfo, GambleStonePlayerBetRecord> handler = this.OnGambleStoneWinNotify; if (null != handler) { handler(roundInfo, inningInfo, maxWinner); } }
public void CreateNewInning() { GambleStoneInningInfo inning = new GambleStoneInningInfo() { ID = Guid.NewGuid().ToString(), InningIndex = this.RoundInfo.FinishedInningCount + 1, RoundID = this.RoundInfo.ID, State = GambleStoneInningStatusType.Readying, CountDownSeconds = ReadyTimeSeconds, }; this.CurrentInningRunner = new GambleStoneInningRunner(this.RoundInfo, inning, this.DailyScheme, this.ReferBetInInning); this.CurrentInningRunner.GambleStoneInningWinnedNotifyAllClient += CurrentInningRunner_GambleStoneInningWinnedNotifyAllClient; }
public bool AddGambleStoneInningInfo(GambleStoneRoundInfo round, GambleStoneInningInfo inning, CustomerMySqlTransaction myTrans) { MySqlCommand mycmd = null; try { string tableName = GambleStoneInningInfoTableNamePrefix + round.TableName; mycmd = myTrans.CreateCommand(); string sqlSelectTableText = "show tables where Tables_in_" + MyDBHelper.DataBaseServerName + " = @tableName "; mycmd.CommandText = sqlSelectTableText; mycmd.Parameters.AddWithValue("@tableName", tableName); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); adapter.Dispose(); if (table.Rows.Count == 0) { //表不存在,则创建 mycmd.CommandText = string.Format(this.sqlCreateGambleStoneInningInfoTable, round.TableName); mycmd.ExecuteNonQuery(); } string sqlText = "insert into " + tableName + " (`id`,`InningIndex`,`RoundID`,`CountDownSeconds`,`State`,`BetRedStone`,`BetGreenStone`,`BetBlueStone`,`BetPurpleStone`,`WinnedColor`,`WinnedTimes`,`WinnedOutStone`) " + " values (@ID,@InningIndex,@RoundID,@CountDownSeconds,@State,@BetRedStone,@BetGreenStone,@BetBlueStone,@BetPurpleStone,@WinnedColor,@WinnedTimes,@WinnedOutStone ) "; mycmd.CommandText = sqlText; mycmd.Parameters.AddWithValue("@ID", inning.ID); mycmd.Parameters.AddWithValue("@InningIndex", inning.InningIndex); mycmd.Parameters.AddWithValue("@RoundID", inning.RoundID); mycmd.Parameters.AddWithValue("@CountDownSeconds", inning.CountDownSeconds); mycmd.Parameters.AddWithValue("@State", (byte)inning.State); mycmd.Parameters.AddWithValue("@BetRedStone", inning.BetRedStone); mycmd.Parameters.AddWithValue("@BetGreenStone", inning.BetGreenStone); mycmd.Parameters.AddWithValue("@BetBlueStone", inning.BetBlueStone); mycmd.Parameters.AddWithValue("@BetPurpleStone", inning.BetPurpleStone); mycmd.Parameters.AddWithValue("@WinnedColor", inning.WinnedColor); mycmd.Parameters.AddWithValue("@WinnedTimes", inning.WinnedTimes); mycmd.Parameters.AddWithValue("@WinnedOutStone", inning.WinnedOutStone); mycmd.ExecuteNonQuery(); return(true); } finally { mycmd.Dispose(); } }
public GambleStoneInningInfoUIModel(GambleStoneInningInfo parent) { this.ParentObject = parent; }
void CurrentInningRunner_GambleStoneInningWinnedNotifyAllClient(GambleStoneRoundInfo roundInfo, GambleStoneInningInfo inningInfo, GambleStonePlayerBetRecord maxWinner) { if (this.GambleStoneInningWinnedNotifyAllClient != null) { GambleStoneInningWinnedNotifyAllClient(roundInfo, inningInfo, maxWinner); } }