Exemplo n.º 1
0
        /// <summary>
        /// Запускает потоки отслеживающие изменения счёты рынков. Так же метод вызывает запуск события, для отображения загрузки.
        /// </summary>
        public void StartThreads()
        {
            LoadedEvent?.Invoke(new LoadedEventArgs(true, false));
            var thread = new Thread(() =>
                                    {;
                                     //Load all markets
                                     GetAll(TypeDBO.BetFair);
                                     GetAll(TypeDBO.Bet365);
                                     GetAll(TypeDBO.SkyBet);
                                     //End load markets
                                    });

            thread.Start();
            while (true)
            {
                if (isStop)
                {
                    return;
                }
                if ((NewSkyBet.isLoad) && (Bet365.isLoad))
                {
                    break;
                }
                Application.DoEvents();
                Thread.Sleep(100);
            }
            LoadedEvent?.Invoke(new LoadedEventArgs(false, true));
        }
Exemplo n.º 2
0
    /// <summary>
    /// Load the specified midiFile with tempo (bpm).
    /// </summary>
    public void Load(TextAsset midiFile, float bpm = -1)
    {
        if (_isPlaying)
        {
            _multiSequencer = null;
            _isPlaying      = false;
        }

        if (bpm != -1)
        {
            _midiFileTempo = bpm;
        }

        _midiFile = midiFile;
        MidiFileContainer song = MidiFileLoader.Load(_midiFile.bytes);

        _multiSequencer = new MidiMultiTrackSequencer(song, _midiFileTempo);
        _isLoaded       = true;

        MidiFileInfo info = _multiSequencer.info;

        _onLoadedEvent.Invoke(midiFile, info);
    }
Exemplo n.º 3
0
 protected virtual void RaiseLoadedEvent()
 {
     // Raise the event in a thread-safe manner using the ?. operator.
     LoadedEvent?.Invoke(this, new EventArgs());
 }
Exemplo n.º 4
0
    public void LoadLevel(string level)
    {
        LEVEL_NAME = level;
        if (levelParent != null)
        {
            Destroy(levelParent);
        }

        //Load level assets
        Result = CATHODE.AlienLevel.Load(LEVEL_NAME, SharedVals.instance.PathToEnv);

        //Load all textures - TODO: flip array and load V2 first? - I suspect V1 is first as A:I loads V1s passively throughout, and then V2s by zone
        LoadedTexturesGlobal = new AlienTexture[GlobalTextures.BIN.Header.EntryCount];
        LoadedTexturesLevel  = new AlienTexture[Result.LevelTextures.BIN.Header.EntryCount];
        bool[] TextureLoadTrackerGlobal = new bool[GlobalTextures.BIN.Header.EntryCount];
        bool[] TextureLoadTrackerLevel  = new bool[Result.LevelTextures.BIN.Header.EntryCount];
        for (int i = 0; i < GlobalTextures.PAK.Header.EntryCount; i++)
        {
            int binIndex = GlobalTextures.PAK.Entries[i].BINIndex;
            LoadedTexturesGlobal[binIndex]     = LoadTexture(i, 2, !TextureLoadTrackerGlobal[binIndex]);
            TextureLoadTrackerGlobal[binIndex] = true;
        }
        for (int i = 0; i < Result.LevelTextures.PAK.Header.EntryCount; i++)
        {
            int binIndex = Result.LevelTextures.PAK.Entries[i].BINIndex;
            LoadedTexturesLevel[binIndex]     = LoadTexture(i, 0, !TextureLoadTrackerLevel[binIndex]);
            TextureLoadTrackerLevel[binIndex] = true;
        }

        //Load all materials
        LoadedMaterials = new Material[Result.ModelsMTL.Header.MaterialCount];
        for (int i = 0; i < Result.ModelsMTL.Header.MaterialCount; i++)
        {
            LoadMaterial(i);
        }

        //Load all models
        LoadedModels = new GameObjectHolder[Result.ModelsBIN.Header.ModelCount];
        for (int i = 0; i < Result.ModelsPAK.Models.Count; i++)
        {
            LoadModel(i);
        }

        //Populate the level with "movers"
        levelParent = new GameObject(LEVEL_NAME);
        for (int i = 0; i < Result.ModelsMVR.Entries.Count; i++)
        {
            GameObject thisParent = new GameObject("MVR: " + i + "/" + Result.ModelsMVR.Entries[i].REDSIndex + "/" + Result.ModelsMVR.Entries[i].ModelCount);
            Matrix4x4  m          = Result.ModelsMVR.Entries[i].Transform;
            thisParent.transform.position   = m.GetColumn(3);
            thisParent.transform.rotation   = Quaternion.LookRotation(m.GetColumn(2), m.GetColumn(1));
            thisParent.transform.localScale = new Vector3(m.GetColumn(0).magnitude, m.GetColumn(1).magnitude, m.GetColumn(2).magnitude);
            thisParent.transform.parent     = levelParent.transform;
            for (int x = 0; x < Result.ModelsMVR.Entries[i].ModelCount; x++)
            {
                CATHODE.Misc.alien_reds_entry RenderableElement = Result.RenderableREDS.Entries[(int)Result.ModelsMVR.Entries[i].REDSIndex + x];
                SpawnModel(RenderableElement.ModelIndex, RenderableElement.MaterialLibraryIndex, thisParent);
            }
        }

        //Pull content from COMMANDS
        //CommandsLoader cmdLoader = gameObject.AddComponent<CommandsLoader>();
        //StartCoroutine(cmdLoader.LoadCommandsPAK(levelPath));

        LevelLoadCompleted?.Invoke(Result);
    }
Exemplo n.º 5
0
 void Start()
 {
     Task.Run(LoadAbilities).ContinueWith(result => LoadedEvent?.Invoke(abilities), TaskScheduler.FromCurrentSynchronizationContext());
 }