Esempio n. 1
0
    public static void salvaSuFile()
    {
        inizializza();

        //PREPARO COLORI
        string stato = "";

        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getCentFrontColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getCentBackColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getCentRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getCentLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getCentUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getCentDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigFrontUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigFrontLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigFrontRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigFrontDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigBackUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigBackLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigBackRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigBackDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigRightLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigRightRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigLeftLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigLeftRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigLeftDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigUpUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigUpLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigUpRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigUpDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigDownUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigDownLeftColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigDownRightColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getSpigDownDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertFrontRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertFrontRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertFrontLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertFrontLeftDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertBackRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertBackRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertBackLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertBackLeftDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertLeftRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertLeftRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertLeftLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertLeftLeftDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertRightRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertRightRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertRightLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertRightLeftDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertUpRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertUpRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertUpLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertUpLeftDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertDownRightUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertDownRightDownColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertDownLeftUpColor()) + ",";
        stato += "#" + ColorUtility.ToHtmlStringRGBA(m_StatoCubo.getVertDownLeftDownColor()) + "\n";

        //PREPARO MOSSE
        string mosseEseguite = "" + m_GameManagerComponent.GetNumMosseEseguite() + "\n";

        //PREPARO TEMPO
        string tempo = "";

        tempo += m_GameManagerComponent.GetTimerOre() + ",";
        tempo += m_GameManagerComponent.GetTimerMinuti() + ",";
        tempo += m_GameManagerComponent.GetTimerSecondi();

        StreamWriter writer = null;
        bool         saved  = false;

        m_Saving = true;
        while (!saved)
        {
            try {
                writer = new StreamWriter(FOLDER + m_GiocoFilename, false);
                writer.Write(stato);
                writer.Write(mosseEseguite);
                writer.Write(tempo);
                writer.Close();
                saved    = true;
                m_Saving = false;
            } catch (Exception e) {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }

        SalvaMD5(m_GiocoFilename);
        salvaOpzioni();
    }