public BoardIcon GenerateSpecialIconByMatch(int pX, int pY, int pAmount, string pGeneratesTag) { for (int i = 0; i < m_SpecialIcons.Count; i++) { if (pAmount >= 8) { if (pGeneratesTag == m_SpecialIcons[i].GeneratesTag) { BoardIcon tBoardIcon = Instance.GenerateIcon(pX, pY, m_SpecialIcons[i]); tBoardIcon.Type = BoardIcon.E_Type.SPECIAL; return(tBoardIcon); } } if (m_SpecialIcons[i].GeneratesTag == "ALL") { if (pAmount == m_SpecialIcons[i].MatchValueToGenerate) { BoardIcon tBoardIcon = Instance.GenerateIcon(pX, pY, m_SpecialIcons[i]); tBoardIcon.Type = BoardIcon.E_Type.SPECIAL; return(tBoardIcon); } } if (pAmount == m_SpecialIcons[i].MatchValueToGenerate && pGeneratesTag == m_SpecialIcons[i].GeneratesTag) { BoardIcon tBoardIcon = Instance.GenerateIcon(pX, pY, m_SpecialIcons[i]); tBoardIcon.Type = BoardIcon.E_Type.SPECIAL; return(tBoardIcon); } } return(null); }
public string GetResourceName(BoardIcon icon) { if (_boardIconMap.ContainsKey(icon)) { return(_boardIconMap[icon]); } throw new ArgumentException($"Icon {icon} not found in BoardIcons resource mapping table"); }
public Combo GetCombo(BoardIcon pIcon1, BoardIcon pIcon2) { for (int i = 0; i < m_Combos.Count; i++) { if ((m_Combos[i].Icon1.Tag == pIcon1.STag && m_Combos[i].Icon2.Tag == pIcon2.STag) || (m_Combos[i].Icon2.Tag == pIcon1.STag && m_Combos[i].Icon1.Tag == pIcon2.STag)) { return(m_Combos[i]); } } return(null); }
public SpecialIcon GetSpecialIcon(BoardIcon pIcon) { for (int i = 0; i < m_SpecialIcons.Count; i++) { if (pIcon.STag == m_SpecialIcons[i].Tag) { return(m_SpecialIcons[i]); } } return(null); }
public void LoadIcon(BoardIcon icon) { try { var iconImage = _resourceLoader.GetIcon(icon); Image = new Bitmap(iconImage); } catch { MessageBox.Show($"Error accessing image resource for BoardIcon {icon}"); } }
public BoardIcon GenerateIcon(int pX, int pY, Icon pIconData) { GameObject tNewIcon = Instantiate(m_PrefabBaseIconSetting, m_BoardRoot); tNewIcon.name = pIconData.Tag; BoardIcon tBoardIcon = InitBoardIcon(ref tNewIcon, pX, pY); tBoardIcon.SetBoardData(pIconData); return(tBoardIcon); }
public BoardIcon GenerateRandomIcon(int pX, int pY) { int tRandoIndex = UnityEngine.Random.Range(0, m_Icons.Count); Icon tIcon = m_Icons[tRandoIndex]; GameObject tNewIcon = Instantiate(m_PrefabBaseIconSetting, m_BoardRoot); tNewIcon.name = tIcon.Tag; BoardIcon tBoardIcon = InitBoardIcon(ref tNewIcon, pX, pY); tBoardIcon.SetBoardData(tIcon); return(tBoardIcon); }
public BoardIcon InitBoardIcon(ref GameObject pIconGameObject, int pX, int pY) { //set position pIconGameObject.transform.position = new Vector2(pX, pY); //set sprite renderer configure SpriteRenderer tSpriteRenderer = pIconGameObject.GetComponent <SpriteRenderer>(); BoardIcon tBoardIcon = pIconGameObject.GetComponent <BoardIcon>(); tBoardIcon.SpriteRenderer = tSpriteRenderer; // Set row // column tBoardIcon.row = pX; tBoardIcon.colunm = pY; return(tBoardIcon); }
public Stream GetIcon(BoardIcon icon) { return(GetImage(_icons.GetResourceName(icon))); }