示例#1
0
 //start SetBoard funs
 public void SetBoard()//clean the board
 {
     foreach (Button Bnt in Buttons)
     {
         Bnt.GetComponentInChildren <Text>().text = "_";
         Bnt.interactable = true;
     }
 }
示例#2
0
 public void SetBoard(string Target)//set the board by state string
 {
     index = 0;
     foreach (Button Bnt in Buttons)
     {
         Bnt.GetComponentInChildren <Text>().text = Target[index] + "";
         index++;
         //   Debug.Log("set button num=" + (int.Parse(Bnt.name.Replace("Button-", ""))));
         //   Debug.Log("set button text=" + Bnt.GetComponentInChildren<Text>());
     }
     //Debug.Log(index + " buttons text= " + Target);
 }
示例#3
0
    public void SetBoard(BitArray Target, string token) //set the board by bitarray
    {
        int index = 0;

        foreach (Button Bnt in Buttons)
        {
            if (Target[index])
            {
                Bnt.GetComponentInChildren <Text>().text = token;
            }


            Debug.Log(index + " buttons text= " + Target[index]);
            Debug.Log("set button num=" + (int.Parse(Bnt.name.Replace("Button-", ""))));
            Debug.Log("set button text=" + Bnt.GetComponentInChildren <Text>().text);
            index++;
        }
    }
示例#4
0
    public string GetBoard()//get board data and return it as a string Layer/w-123456789...
    {
        str = "";
        if (GameHeader.OnEditWin)
        {
            str += "W-";
        }


        foreach (Button Bnt in Buttons)
        {
            str += Bnt.GetComponentInChildren <Text>().text;
        }
        if (GameHeader.NeedToTrns)//if we use diffrent Tokens=> if Tokens!= X O @ &
        {
            foreach (string key in GameHeader.TokenTrns.Keys)
            {
                str.Replace(key, GameHeader.TokenTrns[key]);
            }
        }
        return(str);
    }