Esempio n. 1
0
 private void Awake()
 {
     instance       = this;
     levelText.text = string.Format(levelText.text, "Puzzle");
     cellOri        = wordCell.GetComponent <RectTransform> ().anchoredPosition;
     min            = wordCell.GetComponent <RectTransform> ().sizeDelta.x;
     blockOri       = block.GetComponent <RectTransform> ().anchoredPosition;
     InitColor();
     SetColor();
     saveBtn.onClick.AddListener(() => {
         Save();
         modifierWord.gameObject.SetActive(false);
         startSetBlock.gameObject.SetActive(false);
     });
     modifierWord.onClick.AddListener(() => {
         currentBlock = null;
         currentItem  = null;
         downItem     = null;
         //blockText = "";
         blockGroup.gameObject.SetActive(false);
         wordGroup.gameObject.SetActive(true);
         opGroup.SetActive(true);
         letterGroup.SetActive(true);
         colorGroup.SetActive(false);
         modifierWord.gameObject.SetActive(false);
         startSetBlock.gameObject.SetActive(true);
         saveBtn.gameObject.SetActive(false);
         setColor = false;
     });
     startSetBlock.onClick.AddListener(() => {
         modifierWord.gameObject.SetActive(true);
         blockGroup.gameObject.SetActive(true);
         SetHintCell();
         SetBlockGrid();
         setColor = true;
         opGroup.SetActive(false);
         letterGroup.SetActive(false);
         colorGroup.SetActive(true);
         currentItem = null;
         letter      = "";
         startSetBlock.gameObject.SetActive(false);
         saveBtn.gameObject.SetActive(true);
     });
 }
Esempio n. 2
0
    //克隆方格
    private PuzzleCell CloneCell(int i, int j, int index)
    {
        PuzzleCell cell = Instantiate(wordCell, wordGroup);

        cell.name = "word" + i.ToString() + j.ToString();
        cell.GetComponent <RectTransform> ().anchoredPosition = new Vector2(cellOri.x + (min + 2) * j, cellOri.y - (min + 2) * i);
        cell.pos.x = i;
        cell.pos.y = j;
        cell.SetText("");
        cell.ClearColor();
        cell.SetSize(min);
        cell.transform.SetSiblingIndex(index);
        cell.gameObject.SetActive(true);

        return(cell);
    }