Пример #1
0
        public void SaveSettings()
        {
            SettingsController.SetMode((Modes)mode.value);
            SettingsController.SetLanguage(Language.GetAllLanguages()[language.value]);
            SettingsController.SetForeignLanguage(Language.GetAllLanguages()[foreignLanguage.value]);
            SettingsController.SetSubtitleTrigger((SubtitleTrigger)subtitleTrigger.value);
            SettingsController.SetTranslateLanguage((TranslateLanguage)translateLanguage.value);


            string m        = SettingsController.GetMode().ToString();
            string lang     = SettingsController.GetLanguage().ToString();
            string foreign  = SettingsController.GetForeignLanguage().ToString();
            string subtitle = SettingsController.GetSubtitleTrigger().ToString();
            string trans    = SettingsController.GetTranslateLanguage().ToString();

            mode.value              = (int)SettingsController.GetMode();
            language.value          = Language.GetAllLanguages().IndexOf(SettingsController.GetLanguage());
            foreignLanguage.value   = Language.GetAllLanguages().IndexOf(SettingsController.GetForeignLanguage());
            subtitleTrigger.value   = (int)SettingsController.GetSubtitleTrigger();
            translateLanguage.value = (int)SettingsController.GetTranslateLanguage();

            string url = "http://37.148.210.36:8081/saveSettingsMessage";
            //  string json = "{\"Mode\":\""+m+"\",\"NativeLanguageCode\":\"" + lang + "\",\"ForeignLanguageCode\":\"" + foreign + "\",\"SubtitleTrigger\":\"" + subtitle + "\",\"TranslateLanguage\":\"" + trans + "\"}";
            string json = "{\"Mode\":\"" + mode.value + "\",\"NativeLanguageCode\":\"" + lang + "\",\"ForeignLanguageCode\":\"" + foreign + "\",\"SubtitleTrigger\":\"" + subtitleTrigger.value + "\",\"TranslateLanguage\":\"" + translateLanguage.value + "\"}";

            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("Content-Type", "application/json");

            HttpResponseHandler myHandler1 = (int statusCode, string responseText, byte[] responseData) =>
            {
                Debug.Log(responseText);
                Debug.Log(statusCode);
            };

            HttpRequest.Send(this, "POST", url, dict, json, myHandler1);
            Debug.Log(json);

            if (subtitleTrigger.value == 2)
            {
                Global.galleryReturnScene = "Face2DFacemark";
                SceneManager.LoadScene("Face2DFacemark");
            }
            else
            {
                Global.galleryReturnScene = "MainScreenUI";
                SceneManager.LoadScene("MainScreenUI");
            }
            //SceneManager.LoadScene("MainScreenUI");
            //Application.Quit();
        }
Пример #2
0
        void Start()
        {
            AddOptionsToMode();
            AddOptionsToLanguage();
            AddOptionsToForeignLanguage();
            AddOptionsToSubtitleTrigger();
            AddOptionsToTranslateLanguage();

            mode.onValueChanged.AddListener(delegate { OnModeChange(); });
            language.onValueChanged.AddListener(delegate { OnLanguagesChange(); });
            foreignLanguage.onValueChanged.AddListener(delegate { OnForeignLanguagesChange(); });
            subtitleTrigger.onValueChanged.AddListener(delegate { OnSubtitleTriggerChange(); });
            translateLanguage.onValueChanged.AddListener(delegate { OnTranslateLanguageChange(); });
            apply.onClick.AddListener(delegate { OnClickApplyButton(); });

            mode.value              = (int)SettingsController.GetMode();
            language.value          = Language.GetAllLanguages().IndexOf(SettingsController.GetLanguage());
            foreignLanguage.value   = Language.GetAllLanguages().IndexOf(SettingsController.GetForeignLanguage());
            subtitleTrigger.value   = (int)SettingsController.GetSubtitleTrigger();
            translateLanguage.value = (int)SettingsController.GetTranslateLanguage();
        }
Пример #3
0
 void Start()
 {
     userId = SettingsController.GetUserId();
     loadOcrMedia();
 }