コード例 #1
0
    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);
    }
コード例 #2
0
 public string GetResourceName(BoardIcon icon)
 {
     if (_boardIconMap.ContainsKey(icon))
     {
         return(_boardIconMap[icon]);
     }
     throw new ArgumentException($"Icon {icon} not found in BoardIcons resource mapping table");
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
ファイル: Square.cs プロジェクト: durwood/whoLetTheGoatsOut
 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}");
     }
 }
コード例 #6
0
    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);
    }
コード例 #7
0
    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);
    }
コード例 #8
0
    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);
    }
コード例 #9
0
 public Stream GetIcon(BoardIcon icon)
 {
     return(GetImage(_icons.GetResourceName(icon)));
 }