// Stone Click function void StoneClick(object sender, System.EventArgs e) { System.Windows.Forms.Control ThisStone; ThisStone = (System.Windows.Forms.Label)sender; string sRef; if (ThisStone.Text == "" && sc.UsedStoneNum < 71) { if (Landing(ThisStone)) { // What is clicked and how many points lblMessageDisplay.Text = ThisStone.Name + " / " + Convert.ToString(sc.RecentScore); sc.UsedStoneNum = sc.UsedStoneNum + 1; ThisStone.Text = skl.Stocks.ElementAt(sc.UsedStoneNum).Name; ThisStone.ForeColor = skl.Stocks.ElementAt(sc.UsedStoneNum).Col; Stone s = sel.GetStone(ThisStone.Name); s.Text = ThisStone.Text; s.StoneColor = skl.Stocks.ElementAt(sc.UsedStoneNum).Col; // Fruit display statement sRef = skl.Stocks.ElementAt(sc.UsedStoneNum).Name; switch (sRef) { case "A": ThisStone.BackgroundImage = Properties.Resources.A; break; case "B": ThisStone.BackgroundImage = Properties.Resources.B; break; case "C": ThisStone.BackgroundImage = Properties.Resources.C; break; case "D": ThisStone.BackgroundImage = Properties.Resources.D; break; case "E": ThisStone.BackgroundImage = Properties.Resources.E; break; case "F": ThisStone.BackgroundImage = Properties.Resources.F; break; } // Background color setting ThisStone.BackColor = skl.Stocks.ElementAt(sc.UsedStoneNum).Col; sSteps[sc.UsedStoneNum] = ThisStone.Name; sc.FourWay = sc.FourWay + sc.RecentFourWay; // FourWay bonus calculation sc.FourWayBonus = 0; if (sc.RecentFourWay == 1) { ThisStone.BackColor = Color.DarkBlue; ThisStone.ForeColor = Color.DarkBlue; BonusScores(); // Bonus scores calculation } sc.Score = sc.Score + sc.RecentScore; sc.FourWayScore = sc.FourWayScore + sc.FourWayBonus; NextStep(); } } }
private void DisplayFirstSixStone() { //Display the first six stone, all must be different color and fruit string[] sStarterStones = new string[6]; Color[] cStarterStones = new Color[6]; string[] sStartingPositions = new string[] { "A1", "L1", "A8", "L8", "F4", "G5" }; int iRef1, iRef2; Array.Copy(sFruitName, sStarterStones, 6); Array.Copy(cStoneColor, cStarterStones, 6); sc.UsedStoneNum = -1; for (int k = 0; k < 72; ++k) { if (sc.UsedStoneNum < 6) { iRef1 = Array.IndexOf(sStarterStones, skl.Stocks.ElementAt(k).Name); iRef2 = Array.IndexOf(cStarterStones, skl.Stocks.ElementAt(k).Col); if (iRef1 > -1 && iRef2 > -1) { sc.UsedStoneNum = sc.UsedStoneNum + 1; ThisStone = this.Controls.Find(sStartingPositions[sc.UsedStoneNum], true).FirstOrDefault() as Control; ThisStone.Text = skl.Stocks.ElementAt(k).Name; ThisStone.ForeColor = skl.Stocks.ElementAt(k).Col; //ThisStone.Text = sStockName[k] + cStockColor[k]; //debug only Stone s = sel.GetStone(sStartingPositions[sc.UsedStoneNum]); s.Text = skl.Stocks.ElementAt(k).Name; s.StoneColor = skl.Stocks.ElementAt(k).Col; sRef = skl.Stocks.ElementAt(k).Name; switch (sRef) { case "A": ThisStone.BackgroundImage = Properties.Resources.A; break; case "B": ThisStone.BackgroundImage = Properties.Resources.B; break; case "C": ThisStone.BackgroundImage = Properties.Resources.C; break; case "D": ThisStone.BackgroundImage = Properties.Resources.D; break; case "E": ThisStone.BackgroundImage = Properties.Resources.E; break; case "F": ThisStone.BackgroundImage = Properties.Resources.F; break; } ThisStone.BackColor = skl.Stocks.ElementAt(k).Col; sSteps[sc.UsedStoneNum] = sStartingPositions[sc.UsedStoneNum]; sStarterStones[iRef1] = ""; cStarterStones[iRef2] = cTable; //point is that this is not among the properties if (k != sc.UsedStoneNum) { //Change stones in stock as in use order string refName = skl.Stocks.ElementAt(k).Name; Color refCol = skl.Stocks.ElementAt(k).Col; skl.Stocks.ElementAt(k).Name = skl.Stocks.ElementAt(sc.UsedStoneNum).Name; skl.Stocks.ElementAt(k).Col = skl.Stocks.ElementAt(sc.UsedStoneNum).Col; skl.Stocks.ElementAt(sc.UsedStoneNum).Name = refName; skl.Stocks.ElementAt(sc.UsedStoneNum).Col = refCol; } } } } }