Exemplo n.º 1
0
        //   private static IEnumerator iCloud_Save(Byte[] data)
        //{
        //	JCloudDocumentOperation operation = JCloudDocument.DirectoryExists("FF9_SaveDocument");
        //	while (!operation.finished)
        //	{
        //		yield return null;
        //	}
        //	if (operation.error != null)
        //	{
        //		Social.HandleDocumentError(operation.error.Value);
        //		yield return new Social.ResponseData(false, operation.error.Value);
        //		yield break;
        //	}
        //	if (!(Boolean)operation.result)
        //	{
        //		operation = JCloudDocument.DirectoryCreate("FF9_SaveDocument");
        //		while (!operation.finished)
        //		{
        //			yield return null;
        //		}
        //		if (operation.error != null)
        //		{
        //			Social.HandleDocumentError(operation.error.Value);
        //			yield return new Social.ResponseData(false, operation.error.Value);
        //			yield break;
        //		}
        //	}
        //    operation = JCloudDocument.FileWriteAllBytes("FF9_SaveDocument/" + GetCloudSaveFileName(), data);
        //	while (!operation.finished)
        //	{
        //		yield return null;
        //	}
        //	if (operation.error != null)
        //	{
        //		Social.HandleDocumentError(operation.error.Value);
        //		yield return new Social.ResponseData(false, operation.error.Value);
        //		yield break;
        //	}
        //	yield return new Social.ResponseData(true, null);
        //	yield break;
        //}

        //private static IEnumerator iCloud_Load()
        //{
        //	JCloudDocumentOperation operation = JCloudDocument.FileReadAllBytes("FF9_SaveDocument/" + GetCloudSaveFileName());
        //	while (!operation.finished)
        //	{
        //		yield return null;
        //	}
        //	if (operation.error != null)
        //	{
        //		Social.HandleDocumentError(operation.error.Value);
        //		yield return new Social.ResponseData(null, operation.error.Value);
        //		yield break;
        //	}
        //	Social._icloudError = (String)null;
        //	Byte[] gameBytes = operation.result as Byte[];
        //	yield return new Social.ResponseData(gameBytes, null);
        //	yield break;
        //}

        //private static IEnumerator iCloud_FileExist()
        //{
        //	JCloudDocumentOperation operation = JCloudDocument.FileExists("FF9_SaveDocument/" + GetCloudSaveFileName());
        //	while (!operation.finished)
        //	{
        //		yield return null;
        //	}
        //	if (operation.error != null)
        //	{
        //		Social.HandleDocumentError(operation.error.Value);
        //		yield return new Social.ResponseData(null, operation.error.Value);
        //		yield break;
        //	}
        //	Social._icloudError = (String)null;
        //	yield return new Social.ResponseData(operation.result, null);
        //	yield break;
        //}

        private static IEnumerator Steam_Save(Byte[] data)
        {
            Boolean success = false;

            Social.ResponseData returnData = new Social.ResponseData(null, null);
            try
            {
                String rootDir = Social.GetRootDir_SteamCloud();
                if (!Directory.Exists(rootDir))
                {
                    Directory.CreateDirectory(rootDir);
                }
                String filePath = Social.GetFilePath_SteamCloud();
                File.WriteAllBytes(filePath, data);
                success = true;
            }
            catch (Exception)
            {
                success             = false;
                returnData.m_status = Social.ResponseData.Status.UnknownError;
            }
            returnData.m_data = success;
            yield return(returnData);

            yield break;
        }
Exemplo n.º 2
0
        public static IEnumerator Cloud_Load(MonoBehaviour owner, Action <byte[], Social.ResponseData.Status> callback)
        {
            global::Debug.Log("in Cloud_Load 1");
            global::Debug.Log("in Cloud_Load 2");
            object result = null;

            Social.ResponseData.Status status = Social.ResponseData.Status.UnknownError;
            byte[] readBytes = null;
            if (Application.platform != RuntimePlatform.IPhonePlayer)
            {
                if (Application.platform != RuntimePlatform.Android)
                {
                    if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
                    {
                        Social.CoroutineWithData cd = new Social.CoroutineWithData(owner, Social.Steam_Load());
                        yield return(cd.coroutine);

                        result = cd.result;
                    }
                }
            }
            global::Debug.Log("in Cloud_Load 5");
            if (result != null)
            {
                Social.ResponseData resultData = (Social.ResponseData)result;
                if (resultData.m_data != null)
                {
                    readBytes = (byte[])resultData.m_data;
                }
                status = resultData.m_status;
            }
            global::Debug.Log("in Cloud_Load 6");
            callback(readBytes, status);
            yield break;
        }
Exemplo n.º 3
0
        public static IEnumerator Cloud_IsFileExist(MonoBehaviour owner, Action <bool, Social.ResponseData.Status> callback)
        {
            global::Debug.Log("IN CLOUD_ISFILEEXIST1");
            bool isSuccess = false;

            Social.ResponseData.Status status = Social.ResponseData.Status.UnknownError;
            object result = null;

            if (Application.platform != RuntimePlatform.IPhonePlayer)
            {
                if (Application.platform != RuntimePlatform.Android)
                {
                    if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
                    {
                        Social.CoroutineWithData cd = new Social.CoroutineWithData(owner, Social.Steam_FileExist());
                        yield return(cd.coroutine);

                        result = cd.result;
                    }
                }
            }
            global::Debug.Log("IN CLOUD_ISFILEEXIST3");
            if (result != null)
            {
                Social.ResponseData resultData = (Social.ResponseData)result;
                if (resultData.m_data != null)
                {
                    isSuccess = (bool)resultData.m_data;
                }
                status = resultData.m_status;
            }
            global::Debug.Log("IN CLOUD_ISFILEEXIST4");
            callback(isSuccess, status);
            yield break;
        }
Exemplo n.º 4
0
        public static IEnumerator Cloud_Save(MonoBehaviour owner, byte[] data, TimeSpan playTime, Action <bool, Social.ResponseData.Status> callback)
        {
            bool isSuccess = false;

            Social.ResponseData.Status status = Social.ResponseData.Status.UnknownError;
            object result = null;

            if (Application.platform != RuntimePlatform.IPhonePlayer)
            {
                if (Application.platform != RuntimePlatform.Android)
                {
                    if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
                    {
                        Social.CoroutineWithData cd = new Social.CoroutineWithData(owner, Social.Steam_Save(data));
                        yield return(cd.coroutine);

                        result = cd.result;
                    }
                }
            }
            if (result != null)
            {
                Social.ResponseData resultData = (Social.ResponseData)result;
                if (resultData.m_data != null)
                {
                    isSuccess = (bool)resultData.m_data;
                }
                status = resultData.m_status;
            }
            callback(isSuccess, status);
            yield break;
        }