Beispiel #1
0
    public void ShowSolutions()
    {
        ResetTimer();
        if (rl.cfopSolver.IsSolved())
        {
            alreadySolved.SetActive(true);
            StartCoroutine(ShowAlreadySolved());
            return;
        }

        guideCanvas.SetActive(true);
        solutionsPanel.SetActive(true);
        guideHeader.SetActive(false);
        note.SetActive(false);
        guide.SetActive(false);
        guideSettings.SetActive(false);
        ColorBlock cb = cfopButton.colors;

        cb.disabledColor  = new Color32(25, 25, 25, 255);
        cfopButton.colors = advancedButton.colors = cb;

        if (PlayerPrefs.GetInt("whiteCross", 0) == 1)
        {
            int   count = 0;
            float temp  = PlayerPrefs.GetFloat("layersRSK", 5f);
            PlayerPrefs.SetFloat("layersRSK", 1000f);

            while (rl.cube[22].transform.GetChild(0).gameObject.GetComponent <Renderer>().material.color != Color.white && count++ < 3)
            {
                rl.R(0); rl.M(1); rl.L(1);
                rl.cfopSolver.x(0);
            }
            count = 0;
            while (rl.cube[22].transform.GetChild(0).transform.GetComponent <Renderer>().material.color != Color.white && count++ < 3)
            {
                rl.F(0); rl.S(0); rl.B(1);
                rl.cfopSolver.z(0);
            }

            PlayerPrefs.SetFloat("layersRSK", temp);
        }

        advancedSolution = GetAdvancedSolution();
        cfopSolution     = rl.cfopSolver.Solve();


        advSolutionText.GetComponent <Text>().text = advancedSolution;

        for (int i = 0; i < cfopSolution.Count; i++)
        {
            if (cfopSolution[i].Count == 1 && cfopSolution[i][0] == "y")
            {
                cfopSol[i].GetComponent <Text>().text = cfopSolution[i][0] + " (Already Solved)";
            }
            else if (cfopSolution[i].Count == 0)
            {
                cfopSol[i].GetComponent <Text>().text = "Already Solved";
            }
            else
            {
                string a = "";
                foreach (string s in cfopSolution[i])
                {
                    a += s + " ";
                }
                cfopSol[i].GetComponent <Text>().text = a;
            }
        }

        for (int i = cfopSolution.Count; i < 7; i++)
        {
            cfopSol[i].GetComponent <Text>().text = "Already Solved";
        }
    }