Exemple #1
0
    public RenderTexture Initialize(int _playerNumber, Song _song, Song.Difficulty _difficulty, Vector2 _output, Pool _pool, PoolIndex _poolIndex, uint _resolution, float _speed)
    {
        playerNumber = _playerNumber;
        layerMask    = 1 << (10 + playerNumber);
        song         = _song;
        switch (_difficulty)
        {
        case Song.Difficulty.Easy:
            notes = song.data.notes.easy;
            break;

        case Song.Difficulty.Medium:
            notes = song.data.notes.medium;
            break;

        case Song.Difficulty.Hard:
            notes = song.data.notes.hard;
            break;

        case Song.Difficulty.Expert:
            notes = song.data.notes.expert;
            break;
        }
        pool           = _pool;
        index          = new PoolIndex();
        resolution     = _resolution;
        nextBar        = resolution;
        speed          = _speed;
        index          = _poolIndex;
        lastNoteHit    = true;
        activeNotes    = new List <NoteInstance>();
        activeBars     = new List <BarInstance>();
        willRemove     = new List <NoteInstance>();
        willRemoveBars = new List <BarInstance>();
        nextLine       = new Line();
        nextLine.note  = new List <NoteInstance>();
        nextLine.fred  = new bool[5];

        noteCounter.Initialize();

        output = new RenderTexture(Mathf.CeilToInt(_output.x), Mathf.CeilToInt(_output.y), 16, RenderTextureFormat.ARGB32);
        cam.GetComponent <Camera>().targetTexture = output;
        cam.GetComponent <Camera>().cullingMask   = layerMask;
        SetLayerRecursive(transform, 10 + playerNumber);

        playerInput = new PlayerInput(PlayerInput.Device.Xinput, playerNumber);

        return(output);
    }
Exemple #2
0
 public void Dispose()
 {
     song = null;
     foreach (Transform child in transform)
     {
         if (child.name.ToLower().Contains("pool"))
         {
             Destroy(child.gameObject);
         }
     }
     cam.gameObject.SetActive(false);
     pool  = null;
     index = null;
     Destroy(gameObject);
 }
Exemple #3
0
        public bool Equals(Pickup other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   HasBeenPickedUp.Equals(other.HasBeenPickedUp) &&
                   Value.Equals(other.Value) &&
                   ObjectIndex.Equals(other.ObjectIndex) &&
                   RegenerationTime.Equals(other.RegenerationTime) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   PoolIndex.Equals(other.PoolIndex) &&
                   Position.Equals(other.Position));
        }
        /// <summary>
        /// This method will throw exception if the validation fail.
        /// </summary>
        public void ValidateProperties()
        {
            // Wallet Address
            if (PoolIndex != PoolIndexes.nicehash)
            {
                if (string.IsNullOrEmpty(this.WalletAddress) || !this.WalletAddress.StartsWith("0x"))
                {
                    throw new FormatException("EthWalletAddress missing or format error.");
                }
            }
            else
            {
                if (string.IsNullOrEmpty(this.BtcWalletAddress) || !this.BtcWalletAddress.StartsWith("0x"))
                {
                    throw new FormatException("BtcWalletAddress missing or format error for nicehash pool.");
                }
            }

            // Host Url Index
            int indexCode = PoolIndex.GetHashCode();

            if (indexCode < 0 || indexCode > PoolHostUrls.Count)
            {
                throw new IndexOutOfRangeException("Index is out of range.");
            }

            if (PoolHostIndex < 0 || PoolHostIndex >= PoolHostUrls[indexCode].Count)
            {
                throw new IndexOutOfRangeException("Host URL index is out of range.");
            }

            // Special Checks
            if (string.IsNullOrEmpty(this.WorkerName))
            {
                throw new FormatException("WorkerName missing or format error.");
            }

            if (PoolIndex == PoolIndexes.miningpoolhub)
            {
                this.UserName = this.WorkerName;

                if (string.IsNullOrEmpty(this.UserName))
                {
                    throw new FormatException("UserName missing for the miningpoolhub pool.");
                }

                if (string.IsNullOrEmpty(this.WorkerPassword))
                {
                    throw new FormatException("WorkerPWD missing for the miningpoolhub pool.");
                }
            }

            if (PoolIndex == PoolIndexes.ethermine)
            {
                // TODO: Add this to config UI later
                this.IsSSL = false;

                if (this.IsSSL == null)
                {
                    throw new ArgumentNullException("IsSSL is not specified for ethermine pool.");
                }
            }
        }