Beispiel #1
0
    public IEnumerator loadMap()
    {
        root _data = DataSave.GetData();

        numMap       = _data._Level;
        gameStrategy = _data._strategy;

        Debug.Log(_data.height + " - " + _data.width + " list " + _data.data.Count);
        field = new Field(_data.height, _data.width);
        field.initField(true);
        Debug.Log(_data.data.Count);
        for (int i = 0; i < _data.data.Count; i++)
        {
            var coords = field.findCoordsById(_data.data[i]._id);
            field.array[coords.i, coords.j].setId(_data.data[i]._id);
            field.array[coords.i, coords.j].setRandomNum(_data.data[i]._randomNum);
            field.array[coords.i, coords.j].setState(_data.data[i]._state);
        }

        placeCells();

        yield return(new WaitForEndOfFrame());

        cellState = _data._scellState;

        //grid.enabled = false;
        // SortHierarchy();
    }
Beispiel #2
0
    public IEnumerator Start()
    {
        PareDelegateHandler        += PareDelegateHandlerDebug;
        ButtonHoldDelegateHandler  += ButtonHoldDelegateHandlerDebug;
        ButtonTouchDelegateHandler += ButtonTouchDelegateHandlerDebug;

        gameStrategy        = GameStrategy.Normal;
        countPhotos         = DownloadManager.instance.GetCount();
        numMap              = 1;
        cellStateTMP        = 0;
        cellState           = 0;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        transformUnity      = new TransformUnity();
        mainCamera          = Camera.main;
        LR   = new LineRenderer();
        Line = GameObject.FindGameObjectsWithTag("Line");

        Application.targetFrameRate = 60;


        stats = PlayerStats.instance;
        if (loadGame)
        {
            stats.LoadData();
            StartCoroutine(loadMap());
        }
        else
        {
            stats.LoadData();
            stats.SetPointsTo(0);
        }


        #region GridLoading
        if (loadGame == false)
        {
            yield return(StartCoroutine(CreateButtonCells()));
        }
        else
        {
            if (DataSave.GetData() != null)
            {
                Debug.Log("load map");
                yield return(StartCoroutine(loadMap()));
            }
            else
            {
                yield return(StartCoroutine(CreateButtonCells()));

                _Timer.AddTime();
            }
        }
        #endregion
        Camera.main.transparencySortMode = TransparencySortMode.Orthographic;

        ui.Init();

        if (loadGame)
        {
            _Timer.SetTime(DataSave.GetData().time);
        }
        else
        {
            _Timer.StartTimer();
        }

        //Save();
        if (PlayerPrefs.HasKey("_tut2"))
        {
            ui.GetComponent <Canvas>().renderMode  = RenderMode.ScreenSpaceCamera;
            ui.GetComponent <Canvas>().worldCamera = Camera.main;
        }
    }