Example #1
0
    void Awake()
    {
        _montage = GameObject.Find("MainScene").GetComponent<Montage>();
        _guistart = GameObject.Find("MainScene").GetComponent<GUIStart>();
        _cb = GetComponent<GUIDialogBox>();
        _plugPhoto = GameObject.Find("MainScene").GetComponent<PluginPhotoManagerGUI>();

        #if UNITY_ANDROID
        //s'il y à un fichier autosave.cub enregistré, affichage boîte de dialogue proposant de charger cette scène
        if (PlayerPrefs.GetInt("autosave") == 1)
        {
            Debug.Log(" autosave à 1");
            string path = usefullData.SavePath + "autosave" + usefullData.SaveNewFileExtention;
            if (File.Exists(path))
            {
                _guistart.enabled = false;
                _askAutosave = true;
                _cb.showMe(true, GUI.depth);
                _cb.setBtns(TextManager.GetText("GUIMenuRight.Yes"),
                      TextManager.GetText("GUIMenuRight.No"));
                _cb.setText(TextManager.GetText("GUIMenuRight.AskAutoSave1") + "\n" + TextManager.GetText("GUIMenuRight.AskAutoSave2"));

            }
            PlayerPrefs.SetInt("autosave", 0);
        }
        #endif
    }
Example #2
0
    public static IEnumerator Deactivate(GUIDialogBox cb, bool saveBefore)
    {
        if(Application.internetReachability != NetworkReachability.NotReachable)
        {
            EncodeToolSet encoder = new EncodeToolSet();
            string login = PlayerPrefs.GetString(usefullData.k_logIn);
            string mdp = PlayerPrefs.GetString(usefullData.k_password);
            string code = encoder.createSendCode(false,false,int.Parse(login),mdp);

            WWWForm deactForm = new WWWForm();
            deactForm.AddField("ac", code);

            WWW sender = new WWW(usefullData.DeactivationUrl,deactForm);

            yield return sender;

            if(sender.error != null)
            {
                Debug.Log("ERROR : "+sender.error);
            }
            else
            {
                Debug.Log("Deactivation result "+sender.text);
                usefullData.DeleteLogo();
                PlayerPrefs.DeleteAll();
                //SetAllowQuit(true);
                InterProcess.Stop();
                #if UNITY_STANDALONE_WIN
                System.Diagnostics.Process.GetCurrentProcess().Kill();
        #else
                UnityEngine.Application.Quit();
        #endif
            }
        }
        else if(saveBefore)
        {
            cb.showMe(true,GUI.depth);
                cb.setBtns(TextManager.GetText("GUIMenuRight.Yes"),
                    TextManager.GetText("GUIMenuRight.No"),
                    TextManager.GetText("GUIMenuRight.Save"));

            cb.setText(TextManager.GetText("GUIMenuRight.ConnectionFailed"));
        }
    }