internal void SetEffect(int item) { itemId = item; cardCount = ConfigData.GetItemConsumerConfig(itemId).RandomCardCatalog[0]; coverEffect = new CoverEffect[cardCount]; cardOpenArray = new int[cardCount]; cardPos = new int[cardCount * 2]; for (int i = 0; i < cardCount; i++) { cardPos[i * 2] = 20 + 135 * i; cardPos[i * 2 + 1] = 40; } for (int i = 0; i < cardCount; i++) { var region = new SubVirtualRegion(1 + i, cardPos[i * 2], cardPos[i * 2 + 1], 120, 150, 1 + i); vRegion.AddRegion(region); } Width = 135* cardCount + 20; }
internal void SetEffect(int item) { itemId = item; cardCount = ConfigData.GetItemConsumerConfig(itemId).RandomCardCatalog[0]; coverEffect = new CoverEffect[cardCount]; cardOpenArray = new int[cardCount]; cardPos = new int[cardCount * 2]; for (int i = 0; i < cardCount; i++) { cardPos[i * 2] = 20 + 135 * i; cardPos[i * 2 + 1] = 40; } for (int i = 0; i < cardCount; i++) { var region = new SubVirtualRegion(1 + i, cardPos[i * 2], cardPos[i * 2 + 1], 120, 150); vRegion.AddRegion(region); } Width = 135 * cardCount + 20; }
private void CheckMouseMove(int mouseX, int mouseY) { lastMouseX = mouseX; lastMouseY = mouseY; foreach (SubVirtualRegion subRegion in subRegions.Values) { if (mouseX > subRegion.x && mouseX < subRegion.x + subRegion.width && mouseY > subRegion.y && mouseY < subRegion.y + subRegion.height) { if (selectRegion == null || subRegion.id != selectRegion.id) { if (selectRegion!=null) { selectRegion.Left(); } selectRegion = subRegion; selectRegion.Enter(); if (RegionEntered!=null) { RegionEntered(selectRegion.info, selectRegion.x + selectRegion.width + 1, selectRegion.y, selectRegion.GetKeyValue()); } } return; } } if (selectRegion != null) { selectRegion.Left(); selectRegion = null; if (RegionLeft!=null) { RegionLeft(); } } }
public void AddRegion(SubVirtualRegion region) { region.Parent = parent; subRegions.Add(region.id, region); }