示例#1
0
    internal static void RestartGame()
    {
        //throw new System.NotImplementedException();
        couldControl = true;

        foreach (int id in myPuzzleAnswers.Keys)
        {
            myPuzzleAnswers[id].isBlocked     = false;
            myPuzzleAnswers[id].currentAnswer = false;
        }

        SavingDataManager.CreateInstance().ClearCurrentLevel();
        if (currentChequer != null)
        {
            currentChequer.RefreshOperatableGrids();
        }
        if (null != topLayerCamera)
        {
            topLayerCamera.HideTopWindow();
        }
        operatingGridFlag     = GridFlag.White;
        currentOperationState = OperationState.Pen;
        currentGameState      = GameState.IsPuzzled;

        Application.LoadLevel(GameConstants.MainSceneName);
    }
示例#2
0
    static void TryToInvokeGameWinEvent()
    {
        bool allMatched = true;

        foreach (AnswerData answer in myPuzzleAnswers.Values)
        {
            if (answer.standardAnswer != answer.currentAnswer)
            {
                allMatched = false;
                break;
            }
        }
        if (allMatched)
        {
            //Debug.Log("you win , congratulations !");
            if (null != currentChequer)
            {
                currentChequer.ShowAnswerData();
            }
            currentGameState = GameState.Victory;
            if (null != currentLevelData)
            {
                SavingDataManager.CreateInstance().SaveToVictory();
            }
        }
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        #region ------- init some of root transform -------
        if (null == transOfDataRoot)
        {
            transOfDataRoot = this.transform;
        }
        if (null == transOfGridRoot)
        {
            transOfGridRoot = this.transform;
        }
        if (null == transOfClueRoot)
        {
            transOfClueRoot = this.transform;
        }
        if (null == transOfAnswerText)
        {
            transOfAnswerText = this.transform;
        }
        if (null == transOfBorders)
        {
            transOfBorders = this.transform;
        }
        #endregion

        MainGame.maxColumns     = this.columnCount;
        MainGame.maxRows        = this.rowCount;
        MainGame.currentChequer = this;

        SetPuzzleAnswersToGame();
        //注意:OperatableGrid和Clue都是基于MainGame的Answer而生成的,注意先后顺序
        AutoCreateOperatableGrid();
        AutoCreateClues();


        //建议在这儿加load,并refresh——或者,至少要在这之前load完玩家偏好
        {
            Debug.Log("ido , i do");
            SavingDataManager.CreateInstance().Load();
            this.RefreshOperatableGrids();
        }

        HideDataOnGameStart();
        MainGame.couldControl = true;
    }
示例#4
0
    private void SetAndDisplayNewColor()
    {
        if (shouldChangeColor)
        {
            MainGame.ChangeMyAnswer(this.ID, this.operationState);

            DisplayNewColor();

            if (MainGame.currentGameState == GameState.IsPuzzled)
            {
                SavingDataManager.CreateInstance().Save();
            }
            else
            {
                //SavingDataManager.CreateInstance().SaveToVictory();
            }
        }
    }
示例#5
0
 void AutoSetInfoByLevelInfo()
 {
     if (info != null)
     {
         if (info.mainChequerObject != null)
         {
             Chequer cq = info.mainChequerObject.transform.GetChild(0).GetComponent <Chequer>();
             if (null != cq)
             {
                 lbChequerSize.text = string.Format("{0}x{1}", cq.columnCount, cq.rowCount);
             }
         }
         if (SavingDataManager.CreateInstance().CheckHasPassedLevel(info.levelID))//已通过这个关卡
         {
             tex2dLogo.mainTexture = info.previewTexture;
             lbLevelName.text      = info.levelName;
         }
         else
         {
             lbLevelName.text = "???";
         }
         lbLevelId.text = string.Format("Level{0} - ", indexForClassic.ToString("00"));
     }
 }