Beispiel #1
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;
        }
    }
Beispiel #2
0
    public static bool saveGameStateToServer(WorldViewServerCommunication para_wvsCom)
    {
        bool successFlag = false;

        try
        {

            GameObject poRef = PersistentObjMang.getInstance();
            DatastoreScript ds = poRef.GetComponent<DatastoreScript>();

            SaveVersioningInfo saveVersionInfo = (SaveVersioningInfo) ds.getData("GameVersionData");
            PlayerAvatarSettings playerAvSettings = (PlayerAvatarSettings) ds.getData("PlayerAvatarSettings");
            //WorldStateData worldstate = (WorldStateData) ds.getData("WorldViewState");
            GhostbookManagerLight gbMang = GhostbookManagerLight.getInstance();
            LightSatchel gbSatchelState = gbMang.getSatchelState();

            ILearnRWSaveB saveFile = new ILearnRWSaveB(saveVersionInfo,playerAvSettings,gbSatchelState);

            string saveFileAsString = "";
            saveFileAsString = ObjectSerializerHelper.serialiseObjToString<ILearnRWSaveB>(saveFile);
            para_wvsCom.saveProgress(saveFileAsString);
            successFlag = true;

        //	ILearnRWSaveFilePackage savePackage = ObjectSerializerHelper.deserialiseObjFromString<ILearnRWSaveFilePackage>(saveFileAsString);

        //	SaveVersioningInfo saveVersionInfo2 =  savePackage.getGameVersionInfo();
        //	ILearnRWSaveA castSave = (ILearnRWSaveA) savePackage;

            Debug.Log("SaveManager: Success in SAVING player file.");

        }
        catch(System.Exception ex)
        {
            Debug.LogError("SaveManager: Failed to SAVE player file.");
            Debug.LogError(ex.ToString());
            successFlag = false;
        }

        return successFlag;
    }
Beispiel #3
0
    void Awake()
    {
        Debug.Log("ProgressScript is Awake");

        GameObject servComObj = getServerObject();

        wvServCom = servComObj.GetComponent<WorldViewServerCommunication>();
        acServCom = servComObj.GetComponent<ActivityServerCommunication>();

        if((wvServCom == null)||(acServCom==null))
        {
            Debug.LogError("Something went wrong; WorldViewServerCommunication should be ready");
            wvServCom = servComObj.AddComponent<WorldViewServerCommunication>();
            acServCom = servComObj.AddComponent<ActivityServerCommunication>();

            loading = -1;
        }else{

            loading = 0;
        }
    }