public TableCandyData(ushort objNo, string displayName, string displayNameEn, CandyType ctype, float throwDexterity, int hpRecover, int hpBad, int satRecover, int satBad, int stateBad, int stateRecover, string description, string descriptionEn) { ObjNo = objNo; DisplayName = displayName; DisplayNameEn = displayNameEn; CType = ctype; ThrowDexterity = throwDexterity; HpRecover = hpRecover; HpBad = hpBad; SatRecover = satRecover; SatBad = satBad; StateBad = stateBad; StateRecover = stateRecover; Description = description; DescriptionEn = descriptionEn; }
void CreateMatrix() { for (int i = 0; i < _rows; ++i) { for (int j = 0; j < _columns; ++j) { CandyType newCandyType = RandomGenerator.NextCandy(); while (CheckHorizontal(newCandyType, i, j) || CheckVertical(newCandyType, i, j)) { newCandyType = RandomGenerator.NextCandy(); } _candies[i][j] = ((GameObject)Instantiate(Resources.Load(newCandyType.ToString()), _placeHolders[i][j], Quaternion.identity)).GetComponent <Candy>(); _candies[i][j].gameObject.name = i.ToString() + "_" + j.ToString(); _candies[i][j].transform.parent = transform; } } if (CheckForMatches()) { var candies = GetAllCandies(); foreach (var candy in candies) { Destroy(candy.gameObject); } CreateMatrix(); } }
public ActionResult DeleteConfirmed(int id) { CandyType candyType = db.CandyTypes.Find(id); db.CandyTypes.Remove(candyType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ButtonCandyType(CandyType type) { InitializeComponent(); _type = type; button_main.Background = new ImageBrush(new BitmapImage(new Uri(type.ImageUrl))); (button_main.Background as ImageBrush).Stretch = Stretch.UniformToFill; button_main.Content = type.Name; button_main.Click += CandyType_Click; }
public ActionResult Edit([Bind(Include = "ID,Name,Description")] CandyType candyType) { if (ModelState.IsValid) { db.Entry(candyType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(candyType)); }
private Candy Spawn(CandyType type) { GameObject CandyObject = null; Candy Candy = null; switch (type) { case CandyType.Banana: CandyObject = _CandyPooler.SpawnObject(BANANA, Vector3.zero, Quaternion.identity); break; case CandyType.Grapes: CandyObject = _CandyPooler.SpawnObject(GRAPES, Vector3.zero, Quaternion.identity); break; case CandyType.Watermelon: CandyObject = _CandyPooler.SpawnObject(WATERMELON, Vector3.zero, Quaternion.identity); break; case CandyType.Cherry: CandyObject = _CandyPooler.SpawnObject(CHERRY, Vector3.zero, Quaternion.identity); break; case CandyType.Apple: CandyObject = _CandyPooler.SpawnObject(APPLE, Vector3.zero, Quaternion.identity); break; case CandyType.TriangleCandy: CandyObject = _CandyPooler.SpawnObject(TRIANGLE, Vector3.zero, Quaternion.identity); break; case CandyType.SquareCandy: CandyObject = _CandyPooler.SpawnObject(SQUARE, Vector3.zero, Quaternion.identity); break; case CandyType.PentagonCandy: CandyObject = _CandyPooler.SpawnObject(PENTAGON, Vector3.zero, Quaternion.identity); break; case CandyType.HexagonCandy: CandyObject = _CandyPooler.SpawnObject(HEXAGON, Vector3.zero, Quaternion.identity); break; case CandyType.Scatter: CandyObject = _CandyPooler.SpawnObject(SCATTER, Vector3.zero, Quaternion.identity); break; case CandyType.Jackpot: CandyObject = _CandyPooler.SpawnObject(JACKPOT, Vector3.zero, Quaternion.identity); break; } Candy = CandyObject.GetComponent <Candy>(); CandyObject.SetActive(false); return(Candy); }
public ActionResult Create([Bind(Include = "ID,Name,Description")] CandyType candyType) { if (ModelState.IsValid) { db.CandyTypes.Add(candyType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(candyType)); }
public CandyObject CreateCandy(int x, int y, CandyType type) { GameObject obj = Instantiate(candyPrefabDict[type], CorrectPostion(x, y), Quaternion.identity); //设置父对象 obj.transform.parent = transform; CandyObject create = obj.transform.GetComponent <CandyObject>(); create.Init(x, y, type); return(create); }
public int Check4TilesVer(CandyType candyType, int row, int column) { if (row >= 3 && candyType == _candies[row - 3][column].Type) { return(row - 3); } else if (row <= 6 && candyType == _candies[row + 1][column].Type) { return(row + 1); } return(-1); }
public CreateCandyChange(CandyType tipBomboana, Coordonate coordonateCandy) : base() { TipBomboana = tipBomboana; CoordonateCandy = coordonateCandy; Type = ChangeType.CreateCandy; Dependent = new List <Coordonate>(); Dependent.Add(coordonateCandy); Affected = new List <Coordonate>(); Affected.Add(coordonateCandy); }
public void ShowNoti(CandyType type, int count, float gold) { Index++; GameObject txt = _UIPooler.SpawnWithNewParent(NOTI, GameplayUI.transform, GameplayUI.transform.position, Quaternion.identity); TextFadeVFX fade = txt.GetComponent <TextFadeVFX>(); fade.StartVFX("Match " + count + " " + type.ToString() + " Claim" + gold, Index); if (Index == 3) { Index = 0; } }
public int Check4TilesHor(CandyType candyType, int row, int column) { if (column >= 3 && candyType == _candies[row][column - 3].Type) { return(column - 3); } else if (column <= 6 && candyType == _candies[row][column + 1].Type) { return(column + 1); } return(-1); }
private bool CheckPotentialVerticalMatch(Candy candy) { CandyType type = candy.type; if (candy.y >= 2) { if (grid[candy.x, candy.y - 1].candy.type == type && grid[candy.x, candy.y - 2].candy.type == type) { return(true); } } return(false); }
// GET: CandyTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CandyType candyType = db.CandyTypes.Find(id); if (candyType == null) { return(HttpNotFound()); } return(View(candyType)); }
private bool CheckPotentialHorizontalMatch(Candy candy) { CandyType type = candy.type; if (candy.x >= 2) { if (grid[candy.x - 1, candy.y].candy.type == type && grid[candy.x - 2, candy.y].candy.type == type) { return(true); } } return(false); }
public ImageCandy(CandyType candyType) : base() { Width = 64; Height = 64; BitmapImage logo = new BitmapImage(); logo.BeginInit(); Type = CandyType.Fulger; switch (candyType) { case CandyType.Inimioara: logo.UriSource = new Uri("C:\\Users\\Andreea Florea\\Desktop\\tenerife\\joculet T\\joculet\\Resources\\heart.png"); Type = CandyType.Inimioara; break; case CandyType.Steluta: logo.UriSource = new Uri("C:\\Users\\Andreea Florea\\Desktop\\tenerife\\joculet T\\joculet\\Resources\\starnew.png"); break; case CandyType.Norisor: logo.UriSource = new Uri("C:\\Users\\Andreea Florea\\Desktop\\tenerife\\joculet T\\joculet\\Resources\\cloud.png"); break; case CandyType.SemiLuna: logo.UriSource = new Uri("C:\\Users\\Andreea Florea\\Desktop\\tenerife\\joculet T\\joculet\\Resources\\moonnew.png"); break; case CandyType.Fulger: logo.UriSource = new Uri("C:\\Users\\Andreea Florea\\Desktop\\tenerife\\joculet T\\joculet\\Resources\\thunder.png"); break; } logo.EndInit(); Source = logo; }
public Candy(Color c, CandyType t = CandyType.Normal) { color = c; type = t; }
public CandyInfo(CandyType type) { Id = (int)type; Name = type.ToString(); Image = $"img/{type.ToString().ToLower()}.png"; }
public void AddCandy(CandyType typeOfCandy, int howMany) { _db.SaveNewCandy(Name, typeOfCandy, howMany); }
public void GiveCandy(CandyType type, string receiver) { _db.RemoveCandy(Name, type); _db.SaveNewCandy(receiver, type, 1); }
public CashPaymentViewModel(CandyType type, string amount, BuyViewModel parentViewModel) { Type = type; Amount = amount; BackCommand = new RelayCommand(() => parentViewModel.GoToModal(ApplicationPage.None)); }
public BuyViewModel(CandyType type, string amount) { Type = type; Amount = amount; // Create commands CancelCommand = new RelayCommand(() => { PageUnloadAnimation = PageAnimation.SlideOutToRight; IoC.Application.GoToPage(ApplicationPage.Categories, new CategoriesViewModel { PageLoadAnimation = PageAnimation.SlideInFromLeft }); }); BackCommand = new RelayCommand(() => { PageUnloadAnimation = PageAnimation.SlideOutToRight; IoC.Application.GoToPage(ApplicationPage.CandyDetails, new CandyDetailsViewModel(Type) { PageLoadAnimation = PageAnimation.SlideInFromLeft }); }); CardCommand = new RelayCommand(() => { DarkeningGridVisibility = Visibility.Visible; DarkeningGridOpacity = 0.9f; IoC.Application.DarkeningGridOpacity = 0.9f; IoC.Application.PayButtonVisibility = Visibility.Visible; GoToModal(ApplicationPage.ModalCardPayment, new CardPaymentViewModel(Type, Amount, this)); }); CashCommand = new RelayCommand(() => { DarkeningGridVisibility = Visibility.Visible; DarkeningGridOpacity = 0.9f; IoC.Application.DarkeningGridOpacity = 0.9f; IoC.Application.PayButtonVisibility = Visibility.Visible; GoToModal(ApplicationPage.ModalCashPayment, new CashPaymentViewModel(Type, Amount, this)); }); PayCommand = new RelayCommand(() => { DarkeningGridVisibility = Visibility.Visible; DarkeningGridOpacity = 0.9f; IoC.Application.DarkeningGridOpacity = 0.9f; IoC.Application.PayButtonVisibility = Visibility.Visible; // 1/3 risk of not being successful. var rand = IoC.Application.Random.Next(2); bool successful = rand != 1; if (successful) { GoToModal(ApplicationPage.ModalPaymentSuccess, new PaymentSuccessViewModel(this)); } else { GoToModal(ApplicationPage.ModalPaymentFailure, new PaymentFailureViewModel(this)); } IoC.Application.PayButtonVisibility = Visibility.Hidden; }); // Update application BuyViewModel property. IoC.Application.BuyViewModel = this; }
public void Add(Person person, CandyType type) { Bags[person].Add(type); Sum[person] += person.Preferences[type]; Calculate(); }
bool CheckHorizontal(CandyType candyType, int row, int column) { return (column >= 2 && candyType == _candies [row] [column - 1].Type && candyType == _candies [row] [column - 2].Type); }
private static async Task <List <CandyCategory> > LoadCategoryConfig(string configFolderPath) { var filePath = $"{configFolderPath}{Path.DirectorySeparatorChar}candycategories.yaml"; if (!File.Exists(filePath)) { File.Create(filePath).Dispose(); } var candyCategories = new List <CandyCategory>(); var root = "candycategories"; var yamlFile = new YamlFile(filePath); if (yamlFile.GetString(root) != null) { foreach (var child in yamlFile.GetChildren(root)) { var candyCategory = new CandyCategory { Name = yamlFile.GetString($"{root}.{child}.name"), ImageUrl = yamlFile.GetString($"{root}.{child}.imageurl"), }; var candyTypes = new List <CandyType>(); foreach (var candyType in yamlFile.GetChildren($"{root}.{child}.candytypes")) { var candyTypeObject = new CandyType { Category = candyCategory, Name = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.name"), ImageUrl = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.imageurl"), Price = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.price"), Ingredients = new List <Ingredient>(), Sizes = new List <string>(), }; foreach (var ingredient in yamlFile.GetChildren($"{root}.{child}.candytypes.{candyType}.ingredients")) { candyTypeObject.Ingredients.Add(new Ingredient { Name = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.ingredients.{ingredient}.name"), IsAllergic = bool.Parse(yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.ingredients.{ingredient}.allergic")), WarningImagePath = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.ingredients.{ingredient}.warningimage"), }); } foreach (var size in yamlFile.GetChildren($"{root}.{child}.candytypes.{candyType}.sizes")) { candyTypeObject.Sizes.Add(yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.sizes.{size}.name")); } candyTypes.Add(candyTypeObject); } candyCategory.CandyTypes = candyTypes; candyCategories.Add(candyCategory); } } return(candyCategories); }
public void Remove(Person person, CandyType type) { Bags[person].Remove(type); Sum[person] -= person.Preferences[type]; Calculate(); }
public void RemoveCandyList(CandyType Type, List <Candy> Candies) { switch (Type) { case CandyType.Banana: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(BANANA, item.gameObject, true); } break; case CandyType.Grapes: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(GRAPES, item.gameObject, true); } break; case CandyType.Watermelon: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(WATERMELON, item.gameObject, true); } break; case CandyType.Cherry: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(CHERRY, item.gameObject, true); } break; case CandyType.Apple: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(APPLE, item.gameObject, true); } break; case CandyType.TriangleCandy: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(TRIANGLE, item.gameObject, true); } break; case CandyType.SquareCandy: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(SQUARE, item.gameObject, true); } break; case CandyType.PentagonCandy: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(PENTAGON, item.gameObject, true); } break; case CandyType.HexagonCandy: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(HEXAGON, item.gameObject, true); } break; case CandyType.Scatter: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(SCATTER, item.gameObject, true); } break; case CandyType.Jackpot: foreach (Candy item in Candies) { _CandyPooler.ReturnToPool(JACKPOT, item.gameObject, true); } break; } }
public void Set(CandyType type, int genre) { MyInfo.SetCode(type, genre); }
bool CheckVertical(CandyType candyType, int row, int column) { return (row >= 2 && candyType == _candies [row - 1] [column].Type && candyType == _candies [row - 2] [column].Type); }
public CandyConfig(CandyColor candyColor, CandyType candyType) { this.CandyColor = candyColor; this.CandyType = candyType; }
public override void Print() { base.Print(); Console.WriteLine(CandyType.ToString().ToLower() + " " + Name + " Weight: " + Weight + " Calories: " + Calories + " Sugar: " + Sugar); }
//Constructor public Candy(string flavor, string name, CandyType type) { Flavor = flavor; Name = name; Type = type; }
public Candy(CandyType type, double sugar, double calories, string name, double price, double weight) : base(name, price, weight) { this.Sugar = sugar; this.Calories = calories; }