Esempio n. 1
0
    private void downloader(bool first)
    {
        #if UNITY_ANDROID && !UNITY_EDITOR

        if(GooglePlayDownloader.RunningOnAndroid())//Only on Android
        {
            if(first)
                new GooglePlayDownloader();

            string expPath = GooglePlayDownloader.GetExpansionFilePath();
            if (expPath == null)
            {

                obbError = LocalisationMang.translate("Could not download OBB file: external storage is not available");
                connection = null;
                return;

            }
            else
            {
                string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
                string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath);

                if (mainPath == null || patchPath == null){
                    /*if(!fetching){
                                fetching = true;
                                GooglePlayDownloader.FetchOBB();
                            }*/
                    return;
                }
            }
        }
        #endif
    }
Esempio n. 2
0
    private void proceedToNextTask()
    {
        bool canProceed = false;

        if(currIndex < (routineList.Count-1))
        {
            currIndex++;
            bool foundNext = false;
            while(! foundNext)
            {
                if(currIndex >= routineList.Count)
                {
                    break;
                }
                else if(routineList[currIndex] != null)
                {
                    currRoutine = routineList[currIndex];
                    foundNext = true;
                    canProceed = true;
                    break;
                }
                else
                {
                    currIndex++;
                }
            }
        }

        if( ! canProceed)
        {
            notifyAllListeners("WaiterScript","AllDone",null);
            Destroy(this);
        }
    }
 public void setUserDetails(string un,string ID,LanguageCode l)
 {
     username = un;
     userID = ID;
     language = l;
     state = 1;
     loading_status = new ConnectionError("Data assigned",RoutineStatus.IDLE);
 }
Esempio n. 4
0
 public void init(List<GetRoutine> para_waitList)
 {
     routineList = para_waitList;
     if(routineList != null)
     {
         currRoutine = routineList[0];
     }
 }
Esempio n. 5
0
    public GetRoutine errorHandler(GetRoutine error)
    {
        if (error.getError().Contains("401")){
            //Need to refresh token
            return requestRefreshAuthentication();

        }else if (error.getError().Contains("403")){
            //Need to refresh token
            return new ConnectionError("Wrong username or password",RoutineStatus.ERROR);

        }else if (error.getError().Contains("Could not resolve host" )||(error.getError().Contains("couldn't connect to host" ))){

            return new ConnectionError("No internet connection",RoutineStatus.ERROR);

        }else{

            return error;
        }
    }
Esempio n. 6
0
    //Request recommendation from the server and call actiivtyLaunced
    public void launchSurpriseQuest(int la, int diff)
    {
        launcherMode = Mode.PLAY;
        launcherDetails = "Album";

        recommendationRequests = wvServCom.requestSuggestion(la,diff);
        deactivateWVInterface();
        worldView.setLoadingIconVisibility(true);
    }
Esempio n. 7
0
    //int status = 0;
    void Update()
    {
        if (connection!=null){
            //server_script
            if((connection.status()==RoutineStatus.READY ) ){//||(connection.status()==RoutineStatus.IDLE)

                UserLogNoTimestamp log = new UserLogNoTimestamp(userLoginData.username,ApplicationID.LOGGING_SCREEN,Tag.LOGIN);
                log.setValue("Connected");
                server_script.logData(log);//Log successfull log in//also change the status of the connection to IDLE//Maybe too late
                connection = new ConnectionError("Connected",RoutineStatus.IDLE);
                wvServCom =  server.AddComponent<WorldViewServerCommunication>();//This script will launch on Awake a request User Details
                acServCom = server.AddComponent<ActivityServerCommunication>();

            }else if(connection.status()==RoutineStatus.ERROR){

                connectingInProgressFlag = false;

                setConnectButtonVisibility(true);

                GetRoutine  server_response = server_script.errorHandler(connection);

                UserLogNoTimestamp log = new UserLogNoTimestamp(userLoginData.username,ApplicationID.LOGGING_SCREEN,Tag.LOGIN);
                log.setValue(server_response.getError());

                server_script.logData(log);//Log fail log in

                error = server_response.getError();
                connection = null;
                return;
            }else if(connection.status()==RoutineStatus.WAIT){
                //GUI.Label(new Rect(20,220,500,20), "Connecting...");
                return;
            }
        }else
            return;

        downloader(false);

        if(wvServCom.Loading().status()==RoutineStatus.READY){

            message = "Loading saved data";
            SaveFileManager.loadSaveFromPlayerDownload(wvServCom.loadSavefile(),wvServCom.language,WorldViewServerCommunication.userProfile.getLiteracyProfile());//status changes to IDLE

            acServCom.setUserDetails(wvServCom.getUsername(),wvServCom.getUserID(),wvServCom.language);

            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Create (Application.persistentDataPath + "/username.gd");
            userLoginData.language = LocalisationMang.langCode;
            bf.Serialize(file, userLoginData);
            file.Close();

            Debug.LogWarning("Removed the flip between Milton and Monica");

            WorldViewServerCommunication.clearError();

            Application.LoadLevel("PlayerCustomisationScene");

        }else if(wvServCom.Loading().status()==RoutineStatus.WAIT){
            return;
        }else if(wvServCom.Loading().status()==RoutineStatus.ERROR){

            error = wvServCom.Loading().getError();
            connectingInProgressFlag = false;

            //loading = false;
            //askedForSaveFile = false;
            //loadedSaveFlag = false;
            setConnectButtonVisibility(true);
            connection = null;
        }
    }
Esempio n. 8
0
    void Update()
    {
        switch(loading){

            case -1:
                if(wvServCom.Loading().status()==RoutineStatus.READY){

                SaveFileManager.loadSaveFromPlayerDownload(wvServCom.loadSavefile(),wvServCom.language,WorldViewServerCommunication.userProfile.getLiteracyProfile());//status changes to IDLE
                    acServCom.setUserDetails(wvServCom.getUsername(),wvServCom.getUserID(),wvServCom.language);

                    loading = 0;
                }else if(wvServCom.Loading().status()!=RoutineStatus.WAIT){
                    Debug.LogWarning("TODO: Server could not be initialised");
                }
                break;
            case 0://WAIT UNTIL UPDATE POP UPS ARE DO

                break;

            case 1:
                SaveFileManager.saveGameStateToServer(wvServCom);
                events = false;
                news = false;
                suggestionStatus = wvServCom.requestSuggestion();
                newsfeedDownloadStatus = wvServCom.requestNewsfeed(1);

                loading = 2;

                break;

            case 2://WAIT for suggestions

            //Keeps track of suggestions
                if(suggestionStatus.status()==RoutineStatus.READY)
                {

                    createEvents(wvServCom.loadDifficultyAndActivity());//status changes to IDLE
                    events = true;

                }else if(suggestionStatus.status()==RoutineStatus.ERROR){
                    events = true;

                }

                //Keep track of newsfeed
                if(newsfeedDownloadStatus.status() == RoutineStatus.READY)
                {
                // Fill up the local newsfeed.
                    fillupLocalNewsfeedWithServNewsfeed(wvServCom.getNewsfeed());//Status is changed to IDLE
                    news = true;
                }else if(newsfeedDownloadStatus.status() == RoutineStatus.ERROR){

                    //Could not get news feed
                    fillupLocalNewsfeedWithServNewsfeed(new UserLog[0]);
                    news = true;

                }

                if(news&events)
                    loading = 3;

                break;

            case 3:

                if(unlockingCharacters ||  unlockingLocations ||unlockingDifficulty)//wait until unlock pop ups are done
                    break;

                //longInititalisation();

                activateWVInterface(false);

                worldView.setLoadingIconVisibility(false);

                loading = 4;

                break;

        }

        if(loading>3){//Loaded

            if(recommendationRequests!=null){//Need data for surprise activity (waiting for recommendation)

                if(recommendationRequests.status()==RoutineStatus.READY){

                    worldView.setLoadingIconVisibility(false);

                    List<PackagedNextActivity> activity = wvServCom.loadDifficultyAndActivity();
                    List<ApplicationID> availableAcsInWorld = gbMang.getAvailableActivities();

                    if (activity.Count>0){

                        foreach(PackagedNextActivity a in activity){

                            for(int i=0;i<a.activity.Length;i++){//Different ouptions

                                ApplicationID activityID = a.getActivities()[i];
                                if(availableAcsInWorld.Contains(activityID)){

                                    int activityOwner = LocalisationMang.getOwnerNpcOfActivity(activityID);

                                    ExternalParams extParams = new ExternalParams(activityID, gbMang.getNpcIDForLangAreaDifficulty(a.category,a.index) ,a.category,a.index,a.level[i],false);

                                    this.launchQuest(extParams,activityOwner ,launcherDetails,launcherMode);

                                    recommendationRequests = null;
                                    return;

                                }
                            }
                        }
                    }

                    //WorldViewServerCommunication.setError("Server could not recommend an activity");
                    activateWVInterface();
                    recommendationRequests = null;

                    /*ApplicationID reqAcPKey = LocalisationMang.getRandomApplicableActivityPKeyForLangArea(surpriseActivity[0],new List<ApplicationID>());
                    int activityOwnerDefault = LocalisationMang.getOwnerNpcOfActivity(reqAcPKey);

                    ExternalParams extParamsDefault = new ExternalParams(reqAcPKey,gbMang.getNpcIDForLangAreaDifficulty(surpriseActivity[0],surpriseActivity[1]),surpriseActivity[0],surpriseActivity[1],LocalisationMang.requestLevelStatic(reqAcPKey, surpriseActivity[0],surpriseActivity[1], 0),false);
                    */

                }else if(recommendationRequests.status()==RoutineStatus.ERROR){

                    UnityEngine.Debug.LogError("Server error when retrieving recommendation");//Error window should appear automatically

                    worldView.setLoadingIconVisibility(false);
                    activateWVInterface();
                    recommendationRequests = null;

                }

            }

            if(startRequested){

                if(acServCom.Loading().status() == RoutineStatus.READY){
                    startRequested = false;
                    worldView.setLoadingIconVisibility(false);
                    handleImmediateActivityStart();

                }else if(acServCom.Loading().status() == RoutineStatus.ERROR){

                    //Error message automatic
                    abortQuest();
                }

            }

        }
    }
Esempio n. 9
0
    void Start()
    {
        gameObject.AddComponent<AudioSource>();

        if(File.Exists(Application.persistentDataPath + "/username.gd")) {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(Application.persistentDataPath + "/username.gd", FileMode.Open);
            try{
                userLoginData = (UserLoginData)bf.Deserialize(file);
            }catch(System.Exception ex){
                Debug.LogError(ex.Message);
                userLoginData = new UserLoginData("SmartEnglish","test","englishteacher","test",LanguageCode.EN);
            }
            file.Close();
        }else{

            userLoginData = new UserLoginData("SmartEnglish","test","englishteacher","test",LanguageCode.EN);
            //userLoginData = new UserLoginData("SmartGreek","SmartGreek","GreekTeacher2","password");

        }

        LocalisationMang.langCode = userLoginData.language;

        poRef = PersistentObjMang.getInstance();

        connectionTest=new ConnectionError("",RoutineStatus.IDLE);
        //testConnection();

        prepUIElements();

        downloader(true);
    }
Esempio n. 10
0
 void testConnection()
 {
     setUp();
     connection_test_script = server.AddComponent<ILearnRWServer>();
     connectionTest = connection_test_script.requestServerVersion();
 }
Esempio n. 11
0
    private bool validateCredentials()
    {
        if  (authenticationService.status()==RoutineStatus.READY){
            authentication = authenticationService.getPackage();
        }else if(refreshService.status()==RoutineStatus.READY){
            authentication = refreshService.getPackage();
        }else if(authenticationService.status()==RoutineStatus.ERROR){
            int errorCode =0;
            try{
                errorCode = System.Convert.ToInt32(authenticationService.getError().Split(' ')[0]);
            }catch{};

            if (errorCode==403){//Wrong password
                connectionStatus = new ConnectionError(errorCode+" Wrong username or password",RoutineStatus.ERROR);
                return false;
            }else{
                connectionStatus = new ConnectionError(errorCode+" Unexpected connection error",RoutineStatus.ERROR);
                return false;
            }
        }else if(refreshService.status()==RoutineStatus.ERROR){
            int errorCode =0;
            try{
                errorCode = System.Convert.ToInt32(authenticationService.getError().Split(' ')[0]);
            }catch{};			if (errorCode==403){//Wrong refresh token
                connectionStatus = new ConnectionError(errorCode+" Wrong refresh token; authenticate again",RoutineStatus.ERROR);
                return false;
            }else{
                connectionStatus = new ConnectionError(errorCode+" Unexpected connection error",RoutineStatus.ERROR);
                return false;
            }
        }else if(authentication==null){
            connectionStatus = new ConnectionError("400 Authenticate token not available; authenticate",RoutineStatus.ERROR);
            return false;
        }
        connectionStatus = new ConnectionError("0 Connection is ok",RoutineStatus.READY);;
        return true;
    }
 public GetRoutine requestSuggestion()
 {
     next_activity_query = server.requestNextActivity(userID);
     return next_activity_query;
 }
Esempio n. 13
0
    public GetRoutine flushLogs()
    {
        if (validateCredentials()){
            //Debug.Log(JsonHelper.serialiseObject<List<UserLog>>(logs));
            //StartCoroutine(userLogsService.post("token="+authentication.getAuth(),JsonHelper.serialiseObject<List<UserLog>>(logs)));

            if (logs.Count==0)
                return null;//nothing to do here

            GetRoutine<List<int>> individualCall = new GetRoutine<List<int>>(server_url + "/logs_array",requests,responses);

            StartCoroutine(individualCall.post("?token="+authentication.getAuth(),JsonHelper.serialiseObject<List<UserLogNoTimestamp>>(logs)));

            /*foreach(UserLogNoTimestamp ul in logs){
                Debug.Log("Flush: "+ul.word+" "+ul.problem_category+" "+ul.problem_index+" "+ul.getTag()+" "+ul.getUsername());

            }*/

            logs = new List<UserLogNoTimestamp>();
            return individualCall;
        }else{
            return connectionStatus;
        }
    }
Esempio n. 14
0
 public GetRoutine errorHandler(GetRoutine error_message)
 {
     return error_message;
 }
 public GetRoutine requestSuggestion(string character,ApplicationID game)
 {
     next_activity_query = server.requestNextActivity(userID, character,game.ToString());
     return next_activity_query;
 }
 public void saveProgress(string game_state)
 {
     Debug.Log("Save game state!");
     UserLogNoTimestamp log = basicLog(Tag.SAVEFILE);
     log.setValue(game_state);
     server.logData(log);
     saveRoutine = server.flushLogs();
 }
 public GetRoutine requestSuggestion(string character)
 {
     next_activity_query = server.requestNextActivity(userID, character);
     return next_activity_query;
 }
 public GetRoutine requestSuggestion(int languageArea,int difficulty,ApplicationID game)
 {
     next_activity_query = server.requestNextActivity(userID, languageArea, difficulty,game.ToString());
     return next_activity_query;
 }
 public GetRoutine requestSuggestion(int languageArea,int difficulty)
 {
     next_activity_query = server.requestNextActivity(userID, languageArea, difficulty);
     return next_activity_query;
 }
    protected int loadingUserDetails()
    {
        if(user_details_query == null){
            Debug.Log("Requesting user details");
            user_details_query = server.requestUserDetails();

        }

        if (user_details_query.status()==RoutineStatus.READY){

            Debug.Log("Get user details");

            PackagedUserDetails pud = server.getUserDetails();

            username = pud.getUsername();
            userID = pud.getID();

            language = pud.getLanguage();

            LocalisationMang.init(language);

            return state+1;

        }else if( user_details_query.status()==RoutineStatus.ERROR ){

            Debug.LogError("Processing error: "+user_details_query.getError());

            GetRoutine  server_response = server.errorHandler(user_details_query);

            loading_status = server_response;
            return -1;

        }else{
            return state;
        }
    }
Esempio n. 21
0
    public void initiateOwnActivity(int charID)
    {
        launcherMode = Mode.ADVENTURE;
        launcherDetails = "ActivityOwner";

        //		recommendationRequests = wvServCom.requestSuggestion(lA,diff,LocalisationMang.getMainApplicationID(charID));
        recommendationRequests = wvServCom.requestSuggestion(gbMang.getNPCserverName(charID),LocalisationMang.getMainApplicationID(charID));
        deactivateWVInterface();
        worldView.setLoadingIconVisibility(true);

        //int diff = gbMang.getDiffForNPCID(diagPersonID)[UnityEngine.Random.Range(0,gbMang.getDiffForNPCID(diagPersonID).Count)  ];
        //activitySurpriseLaunched(lA,diff);
    }
Esempio n. 22
0
    //public ILearnRWServer(){
    void Awake()
    {
        Debug.Log("Server Awake");
        if (debugging){
            if(requests==null)
                requests = new List<string>();
            if(responses==null)
                responses = new List<string>();

        }

        authenticationService = new GetRoutine<PackagedAuthentication>(server_url + "/user/auth",requests,responses);
        refreshService = new GetRoutine<PackagedAuthentication>(server_url + "/user/newtokens",requests,responses);
        userDetailsService = new GetRoutine<PackagedUserDetails>(server_url + "/user/details",requests,responses);
        userProfileService = new GetRoutine<PackagedUserProfile>(server_url + "/profile",requests,responses);

        userLogsService = new GetRoutine<PackagedUserLogs>(server_url + "/lastLogs",requests,responses);
        newsFeedService = new GetRoutine<PackagedUserLogs>(server_url + "/lastLogs",requests,responses);
        //		userLogsService = new GetRoutine<PackagedUserLogs>(server_url + "/logs",requests,responses);
        savefileService = new GetRoutine<PackagedUserLogs>(server_url + "/lastLogs",requests,responses);

        //postUserLogsService= new GetRoutine<UserLog>(server_url + "/logs");
        //postUserLogsService= new GetRoutine<List<int>>(server_url + "/logs_array",requests,responses);

        nextActivityService = new GetRoutine<List<PackagedNextActivity>>(server_url + "/activity/next_UoM",requests,responses);
        nextWordsService = new GetRoutine<List<PackagedNextWord>>(server_url + "/activity/new_data_UoM",requests,responses);
        levelService = new GetRoutine<LevelJSON>(server_url+"/activity/next_test/",requests,responses);

        profileUpdateService = new GetRoutine<List<PackagedProfileUpdate>>(server_url+"/profile/update",requests,responses);

        serverInfoService = new GetRoutine<PackagedServerInfo>(server_url+"/info/version/",requests,responses);

        logs = new List<UserLogNoTimestamp>();
    }
Esempio n. 23
0
 void setUpOnlineServerDual()
 {
     setUp();
     server_script = server.AddComponent<ILearnRWServer>();
     connection = server_script.requestAuthentication(userLoginData.username,userLoginData.password,userLoginData.teacher_username,userLoginData.teacher_password);
 }
    void Update()
    {
        if (loading_status.status()==RoutineStatus.ERROR){

            Debug.LogError(loading_status.getError());
            return;

        }

        switch(state){

        case 0://Loading user details

            state = loadingUserDetails();
            break;

        case 1:

            Debug.Log("Request user profile");
            profile_query = server.requestUserProfile(userID);
            state = 2;
            break;

        case 2:

            if(profile_query.status()== RoutineStatus.READY){
                Debug.Log("Get user profile");

                userProfile = server.getUserProfile();

                if (Application.platform == RuntimePlatform.Android){
                    tts = gameObject.AddComponent<TTS_android>();
                }else{
                    tts = gameObject.AddComponent<TTS_googletranslate>();
                }

                tts.init(9,9,language.ToString());

                Debug.Log("Request save logs");

                saved_data_query = server.requestSavefile();

                state = 3;
                break;

            }else if(profile_query.status()== RoutineStatus.ERROR){

                Debug.LogError(profile_query.getError());
                state = 1;
                //userProfile = new PackagedUserProfile();

                break;

            }else{
                break;
            }

        case 3:

            if(saved_data_query.status() == RoutineStatus.READY){

                PackagedUserLogs pul = server.getSaveFiles();
                //OLD//PackagedUserLogs pul = server.getUserLogs();

                int number_pages = pul.getTotalPages();
                Debug.Log("Get save logs: "+pul.page+"/"+number_pages);
                if (number_pages>0){
                    /*saved_data_query = server.requestUserLogs(
                        null,
                        null,
                        number_pages,
                        new string[]{Tag.SAVEFILE.ToString()} ,
                    ApplicationID.GAME_WORLD.ToString(),
                    null);//Request last page
                    */

                    game_state = processSaveFile(pul.getLogs());
                    loading_status = new ConnectionError("Savefile loaded",RoutineStatus.READY);

                    state = 5;

                }else{

                    game_state = "";
                    loading_status = new ConnectionError("New savefile",RoutineStatus.READY);
                    state = 5;

                }

            }else if(saved_data_query.status() == RoutineStatus.ERROR){

                loading_status = new ConnectionError("Couldn't load first page of save file. "+saved_data_query.getError(),RoutineStatus.ERROR);
                //state = -1;
                state = 5;
                Debug.Log("Safenet?");
                loading_status = new ConnectionError("Could not load first page",RoutineStatus.READY);

            }

            break;

        }

        if (saveRoutine!=null){

            if(saveRoutine.status()==RoutineStatus.READY){

                List<int> result = ((GetRoutine<List<int>>)saveRoutine).getPackage();

                string output = "Flush success!";

                foreach(int a in result)
                    output+=", "+a;

                Debug.Log(output);

            }else if(saveRoutine.status()==RoutineStatus.ERROR){

                Debug.Log("Flush error!");
                saveRoutine = null;
            }
        }
    }
    public GetRoutine requestNewsfeed(int page)
    {
        newsfeed_query = server.requestNewsFeed(
        null,
        null,
        page,
        new string[]{Tag.APP_ROUND_SESSION_END.ToString()} ,
        null,
        null);

        return newsfeed_query;
    }
Esempio n. 26
0
    void OnGUI()
    {
        /*if(GUI.Button(new Rect(10,10,50,50),"TTS")){

            if(tts==null){
            if (Application.platform == RuntimePlatform.Android){
                tts = gameObject.AddComponent<TTS_android>();
            }else{
                tts = gameObject.AddComponent<TTS_googletranslate>();
            }

            tts.init(9,9,LocalisationMang.langCode.ToString());

            tts.fetch(new string[]{"dyslexia"});

            }
            AudioClip word = tts.say("dyslexia");

            if(word==null)
                error = "TTS didnt work";
            else
                audio.PlayOneShot(word);

        }*/

        if( ! hasInitGUIStyles)
        {
            initGUI();
        }

        //By default if connectionTest is disabled
        if (connectionTest.status()==RoutineStatus.IDLE){

            if(loginPageID == 0)
            {

                GUI.color = Color.white;

                int sectionCount = (selectedOption+1);

                for(int i=0; i<sectionCount; i++)
                {
                    string sectionSuffix = "-S"+i;

                    string sectionTitleName = "SectionTitle"+sectionSuffix;
                    string sectionUsernameTitleName = "UsernameTitle"+sectionSuffix;
                    string sectionUsernameFieldName = "UsernameField"+sectionSuffix;
                    string sectionPasswordTitleName = "PasswordTitle"+sectionSuffix;
                    string sectionPasswordFieldName = "PasswordField"+sectionSuffix;

                    GUI.color = Color.red;
                    if (i==0)
                        if(error!="")
                            GUI.Label(uiBounds[sectionTitleName],LocalisationMang.translate(error),sectionTitleStyle);
                        else if(obbError!="")
                            GUI.Label(uiBounds[sectionTitleName],LocalisationMang.translate(obbError),sectionTitleStyle);

                    GUI.color = Color.black;

                    GUI.Label(uiBounds[sectionUsernameTitleName],textContent[sectionUsernameTitleName],fieldTitleStyle);
                    GUI.Label(uiBounds[sectionPasswordTitleName],textContent[sectionPasswordTitleName],fieldTitleStyle);
                    GUI.color = Color.white;

                    if(i == 0)
                    {
                        // Student.
                        userLoginData.username = GUI.TextField(uiBounds[sectionUsernameFieldName],userLoginData.username,25,textFieldStyle);
                        userLoginData.password = GUI.PasswordField(uiBounds[sectionPasswordFieldName],userLoginData.password,'*',25,passFieldStyle);
                    }
                    else
                    {
                        // Teacher
                        userLoginData.teacher_username = GUI.TextField(uiBounds[sectionUsernameFieldName],userLoginData.teacher_username,25,textFieldStyle);
                        userLoginData.teacher_password = GUI.PasswordField(uiBounds[sectionPasswordFieldName],userLoginData.teacher_password,'*',25,passFieldStyle);
                    }
                }

                if( ! connectingInProgressFlag)
                {
                    selectedOption = GUI.SelectionGrid(uiBounds["LoginOptionButtonsArea"],selectedOption,optionTextures,2,selectionGridStyle);

                    if((prevSelOption != selectedOption))
                    {
                        if(selectedOption == 0)
                        {
                            transform.FindChild("StudentLoginArea").gameObject.SetActive(true);
                            transform.FindChild("TeacherLoginArea").gameObject.SetActive(false);
                        }
                        else
                        {
                            transform.FindChild("StudentLoginArea").gameObject.SetActive(true);
                            transform.FindChild("TeacherLoginArea").gameObject.SetActive(true);
                        }

                        prevSelOption = selectedOption;
                    }else{
                        selectedOption = prevSelOption;
                    }

                    GUI.color = Color.black;
                    GUI.color = Color.clear;

                    if(GUI.Button(uiBounds["DoneButtonTop"],""))
                    {
                        triggerSoundAtCamera("BubbleClick",1f,false);
                        // Trigger login procedures.
                        if(selectedOption == 1)
                        {
                            if(((userLoginData.teacher_username != "")&&(userLoginData.teacher_password != ""))&&
                            ((userLoginData.username != "")&&(userLoginData.password != "")))
                            {
                                setUpOnlineServerDual();
                            }
                        }
                        else
                        {
                            if((userLoginData.username != "")&&(userLoginData.password != ""))
                            {
                                setUpOnlineServer();
                            }
                        }

                        setConnectButtonVisibility(false);
                    }
                    GUI.color = Color.white;
                }else{

                    if((error=="")&&(obbError=="")){
                        if(wvServCom!=null){
                            switch(wvServCom.getStatus()){

                                case 0: message = "Checking username and password"; break;
                                case 1: message = "Loading user details"; break;
                                case 2: message = "Waiting for user profile"; break;
                                case 3: message = "Waiting for saved data"; break;
                                case 4: message = "..."; break;
                                //case 5: message = "Server has sent all the data"; break;

                            }

                        }

                        GUI.Label(uiBounds["SectionTitle-S0"],LocalisationMang.translate(message),sectionTitleStyle);
                        //GUI.Label(uiBounds["SectionTitle-S1"],LocalisationMang.translate(message),sectionTitleStyle);
                    }

                }

                GUI.color = Color.white;
            }

        }else{//USed only when testConnection is active

            GUI.Label(new Rect(20,220,500,20), "Testing connection!");

            if (connectionTest.status()==RoutineStatus.ERROR){
                GUI.Label(new Rect(20,280,500,20), "Connection Error: ");
                GUI.Label(new Rect(20,320,600,20), connectionTest.getError());
                if(GUI.Button(new Rect(20,360,80,40), "Continue")) {
                    Destroy((Component)connection_test_script);
                    connectionTest = new ConnectionError("Ignore error for now", RoutineStatus.IDLE);
                }

            }else if(connectionTest.status()==RoutineStatus.READY){
                GUI.Label(new Rect(20,280,500,20), "Server version is: "+connection_test_script.getServerInfo().version);
                Destroy((Component)connection_test_script);
            }

        }
    }
Esempio n. 27
0
 void setUpOfflineServer()
 {
     setUp();
     server_script = server.AddComponent<ILearnRWOffline>();
     ILearnRWOffline castVersion = (ILearnRWOffline) server_script;
     castVersion.language = LocalisationMang.langCode.ToString();
     connection = server_script.requestAuthentication(userLoginData.username,userLoginData.password);
 }
 public IEnumerator <Params> GetCoroutine()
 {
     return(GetRoutine()(initialParams));
 }
Esempio n. 29
0
    public void initiateActivityForChar(int charID)
    {
        launcherMode = Mode.ADVENTURE;
        launcherDetails = "Quest";

        recommendationRequests = wvServCom.requestSuggestion(gbMang.getNPCserverName(charID));
        deactivateWVInterface();
        worldView.setLoadingIconVisibility(true);
    }