void RenderSpecial() { xxx = 0; yyy = false; if (uiController.isGameOver == false) { for (int i = 0; i < listHieuUng.Count; i++) { HieuUng hieuUng = listHieuUng[i].GetComponent <HieuUng>(); indexRandom = hieuUng.RenderSpecial(); InstantiateItemDacBiet(); if (_indexX != -1 && _indexY != -1) { hieuUng.MoveItween(arrGem[_indexX][_indexY].transform.position, 2f); } } } listHieuUng.Clear(); }
private void btnChangeViewLogin_Click(object sender, EventArgs e) { PanelDangNhap.BringToFront(); HieuUng.Show(PanelDangNhap); }
private void btnChangeViewRegis_Click_1(object sender, EventArgs e) { panelRegister.BringToFront(); HieuUng.Show(panelRegister); PanelDangNhap.Hide(); }
//hàm khi đang kéo public void OnDrag(PointerEventData eventData) { Vector2 pos = GetPositionTouch(eventData);//lấy vị trí kéo int x = GetIndexGemX(pos); int y = GetIndexGemY(pos); if (x < 0 || y < 0 || x > countCollumn - 1 || y > countRow - 1) { return; } if (ListDelete == null) { return; } if (ListDelete.Count <= 0 || ListDelete[0] == null) { return; } //nếu cục kéo tới tồn tại if (arrGem[x][y] != null) { Gem gem = arrGem[x][y].GetComponent <Gem>(); if (gem.inDex == ListDelete[0].GetComponent <Gem>().inDex&& KiemTraKhoangCach(arrGem[x][y], ListDelete[ListDelete.Count - 1]) <= 1.2f)//kiem tra de dua vao listDelete { if (!listMove.Contains(arrGem[x][y])) { listMove.Add(arrGem[x][y]); } if (!listMouse.Contains(arrGem[x][y])) { listMouse.Add(arrGem[x][y]); } if (!ListDelete.Contains(arrGem[x][y]) && ListDelete.Count >= 1) //kiem tra xem doi tuong chon da co trong ListDelete chua { InstantiateConect(ListDelete[ListDelete.Count - 1], arrGem[x][y]); //xuat ket noi ra man hinh //neu cuc keo duoc chua 1 trong so cac cuc dac biet se bao cho nguoi choi biet if (gem.isSpecial || gem.isSpecialCollum || gem.isSpecialRow) { GameObject _hieuUngObj = Instantiate(hieuUng, arrGem[x][y].transform.position, Quaternion.identity) as GameObject; HieuUng _hieuUng = _hieuUngObj.GetComponent <HieuUng>(); if (_hieuUng != null) { if (gem.isSpecial) { _hieuUng.isSpecial = true; } if (gem.isSpecialCollum) { _hieuUng.isSpecialCollum = true; } if (gem.isSpecialRow) { _hieuUng.isSpecialRow = true; } } listHieuUng.Add(_hieuUngObj); } if (!ListDelete.Contains(arrGem[x][y])) { ListDelete.Add(arrGem[x][y]); } listItween.Add(arrGem[x][y]); SetSoundDrag(ListDelete); if (ListDelete[ListDelete.Count - 1] != null) { ListDelete[ListDelete.Count - 1].GetComponent <Gem>().ChangSprite(); } if (ListDelete.Contains(arrGem[x][y]) && arrGem[x][y].GetComponent <Gem>().cucDacBiet == true) { int a = arrGem[x][y].GetComponent <Gem>().PosX(); int b = arrGem[x][y].GetComponent <Gem>().PosY(); CucDacBiet(a, b); } } if (ListDelete.Count >= 2) { if (arrGem[x][y] == ListDelete[ListDelete.Count - 2] && listConect.Count >= 1)//neu nguoi choi quay lai cuc phia trc co { Gem _gem = ListDelete[ListDelete.Count - 1].GetComponent <Gem>(); if (_gem.isSpecial || _gem.isSpecialCollum || _gem.isSpecialRow) { Destroy(listHieuUng[listHieuUng.Count - 1]); listHieuUng.Remove(listHieuUng[listHieuUng.Count - 1]); } //listItween.Add(ListDelete[ListDelete.Count - 1]); _gem.ResetSprite(); listDeleteNen.Remove(ListDelete[ListDelete.Count - 1]); ListDelete.RemoveAt(ListDelete.Count - 1); Destroy(listConect[listConect.Count - 1]); listConect.RemoveAt(listConect.Count - 1); SetSoundDrag(ListDelete); } } for (int i = 0; i < listMouse.Count; i++) { if (listMouse[i].GetComponent <Gem>().cucDacBiet == true) { GameObject m = listMouse[i]; if (!ListDelete.Contains(listMouse[i])) { int a = m.gameObject.GetComponent <Gem>().PosX(); int b = m.gameObject.GetComponent <Gem>().PosY(); ResetCucDacBiet(a, b); } } } } } listDeleteNen.Clear(); for (int i = 0; i < ListDelete.Count; i++) { if (!listDeleteNen.Contains(ListDelete[i])) { listDeleteNen.Add(ListDelete[i]); } } for (int i = 0; i < listDeleteNen.Count; i++) { Gem g = listDeleteNen[i].GetComponent <Gem>(); if (g != null) { if (g.destroyCollum == true) { AddRow(g.row); break; } if (g.destroyRow == true) { AddCollumn(g.collumn); break; } } } //MoveSpecial(listMouse, ListDelete[ListDelete.Count - 1]); Move(listMove, ListDelete[ListDelete.Count - 1]); uiController.countDelete = ListDelete.Count; }