public void ChangeDataTypeBonys(TypeBonus parTypeBonus) { switch (parTypeBonus) { case TypeBonus.NonBonus: varReceipt.varSumBonus = 0; break; case TypeBonus.Bonus: //Треба врахуватикількість позицій по чеку. varReceipt.varSumBonus = (varReceipt.varSumReceipt <= varClient.varSumMoneyBonus ?varReceipt.varSumReceipt : varClient.varSumMoneyBonus); break; case TypeBonus.BonusWithOutRest: //Треба врахуватикількість позицій по чеку. if (varReceipt.varSumReceipt <= varClient.varSumMoneyBonus) { varReceipt.varSumBonus = varReceipt.varSumReceipt - 1; } else { varReceipt.varSumBonus = Math.Truncate(varClient.varSumMoneyBonus) + varReceipt.varSumReceipt - Math.Truncate(varReceipt.varSumReceipt) + ((varReceipt.varSumReceipt - Math.Truncate(varReceipt.varSumReceipt) >= varClient.varSumMoneyBonus - Math.Truncate(varClient.varSumMoneyBonus)) ? -1.0m:0.0m); } break; case TypeBonus.BonusFromRest: varReceipt.varSumBonus = -(1 - (varReceipt.varSumReceipt - Math.Truncate(varReceipt.varSumReceipt))); break; case TypeBonus.BonusToRest: varReceipt.varSumBonus = varReceipt.varSumReceipt - Math.Truncate(varReceipt.varSumReceipt); break; } }
public void SetType(Type t, TypeBonus tb) { type = t; typeBonus = tb; if (typeBonus != TypeBonus.Normal) { offset = new Vector2(8, 8); } else { offset = new Vector2(3, 3); } }
private Rectangle GetSprite(Type type, TypeBonus typeBonus) { if (typeBonus == TypeBonus.Normal) { Dictionary <Type, Rectangle> dict = new Dictionary <Type, Rectangle> { { Type.Yellow, new Rectangle(0, 10, 334, 340) }, { Type.Green, new Rectangle(339, 10, 334, 340) }, { Type.Red, new Rectangle(682, 10, 334, 340) }, { Type.Blue, new Rectangle(1040, 10, 334, 340) }, { Type.Pink, new Rectangle(1393, 10, 334, 340) } }; return(dict[type]); } else if (typeBonus == TypeBonus.Hline) { Dictionary <Type, Rectangle> dict = new Dictionary <Type, Rectangle> { { Type.Yellow, new Rectangle(32, 2380, 231, 221) }, { Type.Green, new Rectangle(362, 2380, 231, 221) }, { Type.Red, new Rectangle(731, 2380, 231, 221) }, { Type.Blue, new Rectangle(1095, 2380, 231, 221) }, { Type.Pink, new Rectangle(1425, 2380, 231, 221) } }; return(dict[type]); } else if (typeBonus == TypeBonus.Vline) { Dictionary <Type, Rectangle> dict = new Dictionary <Type, Rectangle> { { Type.Yellow, new Rectangle(34, 2090, 221, 231) }, { Type.Green, new Rectangle(359, 2090, 221, 231) }, { Type.Red, new Rectangle(731, 2090, 221, 231) }, { Type.Blue, new Rectangle(1095, 2090, 221, 231) }, { Type.Pink, new Rectangle(1425, 2090, 221, 231) } }; return(dict[type]); } else { Dictionary <Type, Rectangle> dict = new Dictionary <Type, Rectangle> { { Type.Yellow, new Rectangle(34, 1760, 230, 280) }, { Type.Green, new Rectangle(365, 1760, 230, 280) }, { Type.Red, new Rectangle(730, 1760, 230, 280) }, { Type.Blue, new Rectangle(1097, 1760, 230, 280) }, { Type.Pink, new Rectangle(1425, 1760, 230, 280) } }; return(dict[type]); } }
public void Init(BonusConfig Config, int IndexConfig) { try { var val = Config.ListBonus[IndexConfig]; this.CurrentBonus = val.CurrentBonus; this.Value = val.Value; this.SpeedZ = val.SpeedZ; } catch (Exception e) { Debug.LogError("FAIL INIT " + e.Message); } }
public Bonus GetBonus(TypeBonus find) { Bonus bonus = new Bonus(); bonus.type = find; Bonus temp; for (int i = 0; i < sourse.Count; i++) { temp = sourse[i].GetBonus(); if (temp.type == find) { bonus.value += temp.value; } } return(bonus); }
public void ApplyBonus(int x, int y, TypeBonus type) { if (type == TypeBonus.Bomb) { for (int i = -1; i <= 1; ++i) { for (int j = -1; j <= 1; ++j) { if (map[x + i, y + j] != null && !map[x + i, y + j].Match) { map[x + i, y + j].Match = true; ApplyBonusAnimation(x + i, y + j); ApplyMatchAnimation(x + i, y + j); //ApplyBonus(x + i, y + j, map[x + i, y + j].TypeBonus); } } } } else if (type == TypeBonus.Hline) { //for (int i = 1; i <= ColSize-2; ++i) { // if (map[i, y] != null && !map[i, y].Match) { // map[i, y].Match = true; // ApplyBonusAnimation(i, y); // ApplyMatchAnimation(i, y); // //ApplyBonus(i, y, map[i, y].TypeBonus); // } //} } else if (type == TypeBonus.Vline) { //for (int i = 1; i <= RowSize-2; ++i) { // if (map[x, i] != null && !map[x, i].Match) { // map[x, i].Match = true; // ApplyBonusAnimation(x, i); // ApplyMatchAnimation(x, i); // //ApplyBonus(x, i, map[x, i].TypeBonus); // } //} } }
private void AddCombo(int i, int j, TypeBonus type, HashSet <Vector2> matchItems) { int x = i, y = j; if (matchItems.Contains(new Vector2((int)(cell1Pos.X), (int)(cell1Pos.Y)))) { x = (int)(cell1Pos.X); y = (int)(cell1Pos.Y); } else if (matchItems.Contains(new Vector2((int)(cell2Pos.X), (int)(cell2Pos.Y)))) { x = (int)(cell2Pos.X); y = (int)(cell2Pos.Y); } map[x, y].SetType(map[x, y].Type, type); ApplyBonusAnimation(x, y); ApplyMatchAnimation(x, y); //ApplyBonus(x, y, map[x, y].TypeBonus); }
public Bonus(Vector2 position, TypeBonus pouvoir) : base(position) { this.TypeBonus = pouvoir; }
/// <summary> /// Будує вікно оплати в залежності від вибраного методу. /// </summary> /// <param name="varTypePay"></param> /// <param name="varTypeBonus"></param> void SetViewPay(TypePay parTypePay = TypePay.Cash, TypeBonus parTypeBonus = TypeBonus.NonBonus) { System.Drawing.Font varFontBold = new Font(PrintHotKeyPos.Font, FontStyle.Bold); System.Drawing.Font varFontNormal = new Font(PrintHotKeyPos.Font, FontStyle.Regular); if ((parTypePay == TypePay.Partiall || parTypePay == TypePay.Pos) && GlobalVar.varModelPos[0] == -1) { parTypePay = TypePay.Cash; } // засткова оплата бонусами і здача тільки в готівковому режимі. if (parTypePay != TypePay.Cash && (parTypeBonus != TypeBonus.NonBonus || parTypeBonus != TypeBonus.Bonus)) { parTypeBonus = TypeBonus.NonBonus; } this.varTypePay = parTypePay; this.varTypeBonus = parTypeBonus; this.PrintHotKeyPos.Visible = (GlobalVar.varModelPos[0] >= 0); this.PrintHotKeyNonCash.Visible = true; this.PrintHotKeyPartiall.Visible = false; // Доробити по прававам чи налаштуванням системи. this.PrintHotKeyBonus.Visible = (varWork.varClient.varSumMoneyBonus > 0); this.PrintHotKeyBonusWithOutRest.Visible = (varWork.varClient.varSumMoneyBonus > 0) && (varTypePay == TypePay.Cash); this.PrintHotKeyBonusFromRest.Visible = varWork.varClient.varIsUseBonusFromRest && (varTypePay == TypePay.Cash); this.PrintHotKeyBonusToRest.Visible = varWork.varClient.varIsUseBonusToRest && (varTypePay == TypePay.Cash) && (varWork.varClient.varSumMoneyBonus - Math.Truncate(varWork.varClient.varSumMoneyBonus) <= varWork.varReceipt.varSumReceipt); // Виділяємо текучий Режим. this.PrintHotKeyCash.Font = (this.varTypePay == TypePay.Cash) ? varFontBold:varFontNormal; this.PrintHotKeyPos.Font = (this.varTypePay == TypePay.Pos) ? varFontBold:varFontNormal; this.PrintHotKeyNonCash.Font = (this.varTypePay == TypePay.NonCash) ? varFontBold:varFontNormal; this.PrintHotKeyPartiall.Font = (this.varTypePay == TypePay.Partiall) ? varFontBold:varFontNormal; // Виділяємо текучий режим списання бонусів. this.PrintHotKeyBonus.Font = (this.varTypeBonus == TypeBonus.Bonus) ? varFontBold:varFontNormal; this.PrintHotKeyBonusWithOutRest.Font = (this.varTypeBonus == TypeBonus.BonusWithOutRest) ? varFontBold:varFontNormal; this.PrintHotKeyBonusToRest.Font = (this.varTypeBonus == TypeBonus.BonusToRest) ? varFontBold:varFontNormal; this.PrintHotKeyBonusFromRest.Font = (this.varTypeBonus == TypeBonus.BonusFromRest) ? varFontBold:varFontNormal; varWork.ChangeDataTypeBonys(this.varTypeBonus); this.LabelBonus.Text = this.varTypeBonus == TypeBonus.BonusFromRest ? "На бонусний" : "Вик. Бонусів"; this.PrintPaySum.Value = varWork.varReceipt.varSumReceipt - varWork.varReceipt.varSumBonus; this.PrintUsedBonus.Value = varWork.varReceipt.varSumBonus; this.PrintUsedBonus.Enabled = (this.varTypeBonus == TypeBonus.Bonus); this.PrintHotKeyPos.Visible = (GlobalVar.varModelPos[0] >= 0); this.PrintHotKeyQuickPOS.Visible = (GlobalVar.varModelPos[1] >= 0); //Якщо більше 1пос термінала this.LabelPos.Visible = this.PrintPos.Visible = (GlobalVar.varModelPos[0] >= 0); this.LabelSlip.Visible = this.PrintSlip.Visible = (GlobalVar.varModelPos[0] >= 0); this.LabelCash.Enabled = this.PrintCash.Enabled = (parTypePay == TypePay.Partiall || parTypePay == TypePay.Cash); this.LabelPos.Enabled = this.PrintPos.Enabled = (parTypePay == TypePay.Partiall); this.LabelSlip.Enabled = this.PrintSlip.Enabled = (parTypePay == TypePay.Partiall || parTypePay == TypePay.Pos) && GlobalVar.varModelPos[0] >= 0 && !GlobalVar.varIsPosConnect; //this.LabelBonus.Enabled = this.PrintToBonus.Enabled = this.PrintUsedBonus.Enabled = (parTypeBonus==TypeBonus.NonBonus && varClient.varSumMoneyBonus>0) ; this.LabelRest.Enabled = this.PrintRest.Enabled = false; this.LabelRest.Visible = this.PrintRest.Visible = (parTypePay == TypePay.Partiall || parTypePay == TypePay.Cash); // RecalcPrintSum(); if (parTypePay == TypePay.Cash || parTypePay == TypePay.Partiall) { this.PrintCash.Focus(); } else if (parTypePay == TypePay.Pos) { if (GlobalVar.varModelPos[0] >= 0 && GlobalVar.varIsPosConnect) { this.ButtonPrintReceipt.Focus(); } else { this.PrintSlip.Focus(); } } }
public Bonus(Coords coords) : base(coords) { Random random = new Random(); Type = (TypeBonus)random.Next(3); }
public static extern void AfficherTypeBonus(TypeBonus v);