Пример #1
0
 protected override void Awake()
 {
     base.Awake();
     instance  = this;
     blockOri  = block.GetComponent <RectTransform> ().anchoredPosition;
     cellOri   = letterCell.GetComponent <RectTransform> ().anchoredPosition;
     saveData  = TextManager.Instance.ReadProgress <PuzzleSaveData> ("PuzzleProgress.json");
     hint.info = "puzzlehintcost";
     hint.SetHint();
     hint.HintEvent += ClickHint;
     InitColor();
     SetReadData();
 }
Пример #2
0
    //保存进度
    private void SaveProcess()
    {
        PuzzleSaveData data = new PuzzleSaveData();

        for (int i = 0; i < wordRow; i++)
        {
            List <bool> show = new List <bool> ();
            for (int j = 0; j < wordCol; j++)
            {
                show.Add(cellGroup[i * wordCol + j].isShowing);
            }
            data.letterShow.Add(show);
        }
        for (int j = 0; j < notPlaceRightBlock.Count; j++)
        {
            data.HintBlock.Add(notPlaceRightBlock[j].blockNum);
        }
        for (int w = 0; w < place.Count; w++)
        {
            data.HintBlock.Add(place[w].blockNum);
        }

        for (int m = 0; m < blocks.Count; m++)
        {
            PuzzleBlockPosition pos = new PuzzleBlockPosition();
            float x = blocks[m].GetComponent <RectTransform> ().anchoredPosition.x;
            float y = blocks[m].GetComponent <RectTransform> ().anchoredPosition.y;
            pos.x = x.ToString();
            pos.y = y.ToString();
            data.blockPosition.Add(pos);

            if (blocks[m].cells.Count != 0)
            {
                data.blockNum.Add(blocks[m].blockNum);
                List <int> index = new List <int> ();
                for (int n = 0; n < blocks[m].cells.Count; n++)
                {
                    index.Add(blocks[m].cells[n].transform.GetSiblingIndex());
                }
                data.blockPlaceCell.Add(index);
            }
        }
        TextManager.Instance.SaveProgress <PuzzleSaveData> ("PuzzleProgress.json", data);
    }