Exemple #1
0
        /// <summary>
        /// Convenience method for loading files asynchronously
        /// to a sample bank. This method instantiates, configures and 
        /// enqueues a AGATLoadingOperation. Use NewOperation if you need 
        /// more control over progress callbacks.
        /// </summary>
        public void LoadFilesToSampleBank( string[] filePaths, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false )
        {
            AGATLoadingOperation operation = new LoadingOperation( allocationMode, filePaths.Length, targetBank.AddLoadedFile, forceMono );
            int i;
            for( i = 0; i < filePaths.Length; i++ )
            {
                operation.AddFile( filePaths[ i ], pathType );
            }

            operation.OnOperationCompleted = onOperationCompleted;

            EnqueueOperation( operation );
        }
Exemple #2
0
        /// <summary>
        /// Convenience method for loading files asynchronously
        /// to a sample bank. All wav and ogg files of the specified folder
        /// will be loaded. 
        /// This method instantiates, configures and enqueues a AGATLoadingOperation.
        /// Use the NewOperation method if you need more control over progress callbacks.
        /// </summary>
        public void LoadFolderToSampleBank( string folderPath, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false )
        {
            folderPath = GATPathsHelper.GetAbsolutePath( folderPath, pathType, false );
            if( Directory.Exists( folderPath ) == false )
            {
                throw new GATException( "No such directory!" );
            }

            string[] files = Directory.GetFiles( folderPath );

            if( files.Length == 0 )
            {
                #if UNITY_EDITOR || GAT_DEBUG
                Debug.LogError( "Directory exists but is empty" );
                #endif
                return;
            }

            LoadFilesToSampleBank( files, PathRelativeType.Absolute, targetBank, allocationMode, onOperationCompleted, forceMono );
        }
Exemple #3
0
 /// <summary>
 /// Loads specific StreamingAssets samples from the referenced Sound Bank.
 /// Async operation.
 /// </summary>
 public void LoadStreamingAssetsAsync(List <string> sampleNames, OperationCompletedHandler onCompleted)
 {
     string[] fullPaths = _soundBank.GetFullPathsInStreamingAssets(sampleNames);
     GATAudioLoader.SharedInstance.LoadFilesToSampleBank(fullPaths, PathRelativeType.Absolute, this, _allocationMode, onCompleted);
 }
Exemple #4
0
 /// <summary>
 /// Loads specific StreamingAssets samples from the referenced Sound Bank.
 /// Async operation.
 /// </summary>
 public void LoadStreamingAssetsAsync( List< string > sampleNames, OperationCompletedHandler onCompleted )
 {
     string[] fullPaths = _soundBank.GetFullPathsInStreamingAssets( sampleNames );
     GATAudioLoader.SharedInstance.LoadFilesToSampleBank( fullPaths, PathRelativeType.Absolute, this, _allocationMode, onCompleted );
 }
 private void CreateNewGameCompleted(object sender, CreateNewGameCompletedEventArgs args)
 {
     OperationCompletedHandler handler = myCreateNewGameCompletedHandler;
       if (handler != null)
       {
     myCreateNewGameCompletedHandler = null;
     if (args.Error != null)
     {
       handler(false, args.Error.Message);
     }
     else
     {
       switch(args.Result)
       {
     case CreateNewGameResult.Ok:
       handler(true, null);
       break;
     case CreateNewGameResult.LoginRequired:
       handler(false, "Ошибка коммуникации");
       break;
     case CreateNewGameResult.YouHaveActiveGame:
       handler(false, "У вас уже есть активная игра");
       break;
     case CreateNewGameResult.GameNameInUse:
       handler(false, string.Format("Имя игры '{0}' занято", myGameToCreateName));
       break;
     default:
       throw new ArgumentOutOfRangeException();
       }
     }
       }
 }
 private void StartLoginCompleted(object sender, StartLoginCompletedEventArgs args)
 {
     if (myPassword != null)
       {
     if (args.Error != null)
     {
       OperationCompletedHandler handler = myLoginCompletedHandler;
       if (handler != null)
       {
     myLoginCompletedHandler = null;
     handler(false, args.Error.Message);
       }
       return;
     }
     string encryptedText = EncryptionUtil.EncryptStringToString(args.Result, myPassword);
     myProxy.AuthorizeLoginAsync(encryptedText);
       }
 }
 private void AuthorizeLoginCompleted(object sender, AuthorizeLoginCompletedEventArgs args)
 {
     OperationCompletedHandler handler = myLoginCompletedHandler;
       if (handler != null)
       {
     myLoginCompletedHandler = null;
     if (args.Error != null)
     {
       handler(false, args.Error.Message);
     }
     else
     {
       switch(args.Result)
       {
     case AuthorizeLoginResult.Ok:
       handler(true, null);
       break;
     case AuthorizeLoginResult.WrongNameOrPassword:
       handler(false, "Неверный логин/пароль");
       break;
     case AuthorizeLoginResult.NoLoginStarted:
       handler(false, "Ошибка связи");
       break;
     default:
       throw new ArgumentOutOfRangeException();
       }
     }
       }
 }
 public void Login(string login, string password, OperationCompletedHandler completedHandler)
 {
     myPassword = password;
       myLoginCompletedHandler = completedHandler;
       myProxy.StartLoginAsync(login);
 }
 public void CreateNewGame(string gameName, string gamePassword, IEnumerable<PlayerInfo> players, OperationCompletedHandler completedHandler)
 {
     myCreateNewGameCompletedHandler = completedHandler;
       myGameToCreateName = gameName;
       string gamePasswordEncoded = EncryptionUtil.EncryptStringToString(gamePassword, myPassword);
       myProxy.CreateNewGameAsync(myGameToCreateName, gamePasswordEncoded, new ObservableCollection<PlayerInfo>(players));
 }
Exemple #10
0
        /// <summary>
        /// Convenience method for loading files asynchronously
        /// to a sample bank. All wav and ogg files of the specified folder
        /// will be loaded.
        /// This method instantiates, configures and enqueues a AGATLoadingOperation.
        /// Use the NewOperation method if you need more control over progress callbacks.
        /// </summary>
        public void LoadFolderToSampleBank(string folderPath, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false)
        {
            folderPath = GATPathsHelper.GetAbsolutePath(folderPath, pathType, false);
            if (Directory.Exists(folderPath) == false)
            {
                throw new GATException("No such directory!");
            }

            string[] files = Directory.GetFiles(folderPath);

            if (files.Length == 0)
            {
                                #if UNITY_EDITOR || GAT_DEBUG
                Debug.LogError("Directory exists but is empty");
                                #endif
                return;
            }

            LoadFilesToSampleBank(files, PathRelativeType.Absolute, targetBank, allocationMode, onOperationCompleted, forceMono);
        }
Exemple #11
0
        /// <summary>
        /// Convenience method for loading files asynchronously
        /// to a sample bank. This method instantiates, configures and
        /// enqueues a AGATLoadingOperation. Use NewOperation if you need
        /// more control over progress callbacks.
        /// </summary>
        public void LoadFilesToSampleBank(string[] filePaths, PathRelativeType pathType, GATSampleBank targetBank, GATDataAllocationMode allocationMode, OperationCompletedHandler onOperationCompleted, bool forceMono = false)
        {
            AGATLoadingOperation operation = new LoadingOperation(allocationMode, filePaths.Length, targetBank.AddLoadedFile, forceMono);
            int i;

            for (i = 0; i < filePaths.Length; i++)
            {
                operation.AddFile(filePaths[i], pathType);
            }

            operation.OnOperationCompleted = onOperationCompleted;

            EnqueueOperation(operation);
        }