Exemplo n.º 1
0
        //private SpriteSheet _spriteSheet;

        public StarshipMk1(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass = 0, double propellantMass = 1200000)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, null)
        {
            StageOffset = new DVector2(0, 0);

            Fins    = new Fin[2];
            Fins[0] = new Fin(this, new DVector2(0.0, -12.0), new DVector2(2.8, 10.2), 0.2, "Textures/Spacecrafts/ITS/FwdFlap.png", -1.4);
            Fins[1] = new Fin(this, new DVector2(0.0, 15.0), new DVector2(4.1, 14.1), 0.2, "Textures/Spacecrafts/ITS/Flap.png", 1.4);

            Engines = new IEngine[3];
            for (int i = 0; i < 3; i++)
            {
                double engineOffsetX = (i - 1.0) / 4.0;
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.4);
                Engines[i] = new RaptorSL(i, this, offset);
            }

            //_spriteSheet = new SpriteSheet("Textures/Spacecrafts/Its/scaledShip.png", 12, 12);

            string texturePath = "Its/StarshipMk1.png";
            string fullPath    = Path.Combine("Textures/Spacecrafts", texturePath);

            this.Texture = new Bitmap(fullPath);

            this.payloadMass = payloadMass;
        }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (total_ != null)
            {
                hash ^= Total.GetHashCode();
            }
            if (zap_ != null)
            {
                hash ^= Zap.GetHashCode();
            }
            if (nds_ != null)
            {
                hash ^= Nds.GetHashCode();
            }
            if (deb_ != null)
            {
                hash ^= Deb.GetHashCode();
            }
            if (fin_ != null)
            {
                hash ^= Fin.GetHashCode();
            }
            if (mon_ != null)
            {
                hash ^= Mon.GetHashCode();
            }
            if (oth_ != null)
            {
                hash ^= Oth.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 3
0
        //private SpriteSheet _spriteSheet;

        public BFS300(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass = 0, double propellantMass = 1000000)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, null)
        {
            StageOffset = new DVector2(0, 0);

            Fins    = new Fin[2];
            Fins[0] = new Fin(this, new DVector2(0.2, -22), new DVector2(-2.5, 5), 0, "Textures/Spacecrafts/ITS/Canard.png");
            Fins[1] = new Fin(this, new DVector2(2.2, 20.2), new DVector2(5.86, 14.5), -Math.PI / 6);

            Engines = new IEngine[7];
            for (int i = 0; i < 7; i++)
            {
                double engineOffsetX = (i - 3.5) / 3.5;
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.45);
                Engines[i] = new RaptorSL300(i, this, offset);
            }

            //_spriteSheet = new SpriteSheet("Textures/Spacecrafts/Its/scaledShip.png", 12, 12);

            string texturePath = "Its/BFS3.png";
            string fullPath    = Path.Combine("Textures/Spacecrafts", texturePath);

            this.Texture = new Bitmap(fullPath);

            this.payloadMass = payloadMass;
        }
Exemplo n.º 4
0
        //private SpriteSheet _spriteSheet;

        public Starship2P2P(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass = 0, double propellantMass = 1000000)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, null)
        {
            StageOffset = new DVector2(0, 0);

            Fins    = new Fin[2];
            Fins[0] = new Fin(this, new DVector2(-1.2, -18.0), new DVector2(2.5, 5), 0, "Textures/Spacecrafts/ITS/Canard2.png", 1.5);
            Fins[1] = new Fin(this, new DVector2(2.0, 17.2), new DVector2(5.86, 13.0), -Math.PI / 6, "Textures/Spacecrafts/ITS/Fin.png", 3);

            Engines = new IEngine[9];
            for (int i = 0; i < 9; i++)
            {
                double engineOffsetX = (i - 4.0) / 4.0;
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.4);
                Engines[i] = new RaptorSL300(i, this, offset);
            }

            //_spriteSheet = new SpriteSheet("Textures/Spacecrafts/Its/scaledShip.png", 12, 12);

            string texturePath = "Its/Starship.png";
            string fullPath    = Path.Combine("Textures/Spacecrafts", texturePath);

            this.Texture = new Bitmap(fullPath);

            this.payloadMass = payloadMass;
        }
Exemplo n.º 5
0
        //private SpriteSheet _spriteSheet;

        public MiniBFS(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass = 0, double propellantMass = 100000)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, null)
        {
            StageOffset = new DVector2(0, 0);

            Fins    = new Fin[2];
            Fins[0] = new Fin(this, new DVector2(0.2, -8.95), new DVector2(-1, 2), 0, "Textures/Spacecrafts/ITS/Canard.png");
            Fins[1] = new Fin(this, new DVector2(0.8, 8.2), new DVector2(2.38, 5.89), -Math.PI / 6);

            Engines = new IEngine[1];
            for (int i = 0; i < 1; i++)
            {
                var offset = new DVector2(0.0, Height * 0.4);
                Engines[i] = new Merlin1D(i, this, offset);
            }

            //_spriteSheet = new SpriteSheet("Textures/Spacecrafts/Its/scaledShip.png", 12, 12);

            string texturePath = "Its/miniBFS.png";
            string fullPath    = Path.Combine("Textures/Spacecrafts", texturePath);

            this.Texture = new Bitmap(fullPath);

            this.payloadMass = payloadMass;
        }
Exemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     if (vida <= 0)
     {
         Fin.show();
     }
 }
Exemplo n.º 7
0
        private static WsFrame readHeader(byte[] header)
        {
            // FIN
            Fin fin = (header[0] & 0x80) == 0x80 ? Fin.FINAL : Fin.MORE;
            // RSV1
            Rsv rsv1 = (header[0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF;
            // RSV2
            Rsv rsv2 = (header[0] & 0x20) == 0x20 ? Rsv.ON : Rsv.OFF;
            // RSV3
            Rsv rsv3 = (header[0] & 0x10) == 0x10 ? Rsv.ON : Rsv.OFF;
            // Opcode
            Opcode opcode = (Opcode)(header[0] & 0x0f);
            // MASK
            Mask masked = (header[1] & 0x80) == 0x80 ? Mask.MASK : Mask.UNMASK;
            // Payload len
            byte payloadLen = (byte)(header[1] & 0x7f);

            return(new WsFrame {
                Fin = fin,
                Rsv1 = rsv1,
                Rsv2 = rsv2,
                Rsv3 = rsv3,
                Opcode = opcode,
                Masked = masked,
                PayloadLen = payloadLen
            });
        }
Exemplo n.º 8
0
        internal WebSocketFrame(
            Fin fin, Opcode opcode, PayloadData payloadData, bool compressed = false)
        {
            Fin    = fin;
            Rsv1   = IsOpcodeData(opcode) && compressed ? Rsv.On : Rsv.Off;
            Rsv2   = Rsv.Off;
            Rsv3   = Rsv.Off;
            Opcode = opcode;

            var len = payloadData.Length;

            if (len < 126)
            {
                PayloadLength         = (byte)len;
                ExtendedPayloadLength = Array.Empty <byte>();
            }
            else if (len < 0x010000)
            {
                PayloadLength         = 126;
                ExtendedPayloadLength = ((ushort)len).ToByteArray(Endianness.Big);
            }
            else
            {
                PayloadLength         = 127;
                ExtendedPayloadLength = len.ToByteArray(Endianness.Big);
            }

            Mask        = Mask.Off;
            MaskingKey  = Array.Empty <byte>();
            PayloadData = payloadData;
        }
Exemplo n.º 9
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButton("Tap"))
     {
         iTween.Resume(player);
         iTween.Resume(electron);
         iTween.Resume(STC);
         iTween.Resume(elec2);
         iTween.Resume(elec3);
         iTween.Resume(elec4);
         iTween.Resume(hone);
         iTween.Resume(htwo);
         iTween.FadeTo(membInfo, 0f, 0.5f);
         iTween.FadeTo(mtrcabInfo, 0f, 0.5f);
         iTween.FadeTo(STCinfo, 0f, 0.5f);
         iTween.FadeTo(CYMAInfo, 0f, 0.5f);
         iTween.FadeTo(QUINOLInfo, 0f, 0.5f);
         iTween.FadeTo(HInfo, 0f, 0.5f);
         if (count >= 2)
         {
             HowLook.CrossFadeAlpha(1.0f, 1.0f, false);
         }
         if (count >= 7)
         {
             FirstPer.CrossFadeAlpha(1.0f, 1.0f, false);
         }
         if (count >= 8)
         {
             Fin.CrossFadeAlpha(1.0f, 1.0f, false);
         }
     }
 }
Exemplo n.º 10
0
        public WsFrame(Fin fin, Opcode opcode, Mask mask, PayloadData payloadData)
        {
            if (payloadData.IsNull())
            {
                throw new ArgumentNullException("payloadData");
            }

            if (isControl(opcode) && payloadData.Length > 125)
            {
                throw new ArgumentOutOfRangeException("payloadData",
                                                      "The control frame must have a payload length of 125 bytes or less.");
            }

            if (!isFinal(fin) && isControl(opcode))
            {
                throw new ArgumentException("The control frame must not be fragmented.");
            }

            Fin         = fin;
            Opcode      = opcode;
            Mask        = mask;
            PayloadData = payloadData;

            init();
        }
Exemplo n.º 11
0
 public static Fin <Func <B, C> > Apply <A, B, C>(this Func <A, Func <B, C> > fabc, Fin <A> fa)
 {
     if (fa.IsFail)
     {
         return(Fin <Func <B, C> > .Fail(fa.Error));
     }
     return(fabc(fa.Value));
 }
Exemplo n.º 12
0
 public void ReadTotalSamplesTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <ulong> totalSamples = Flac.ReadTotalSamples(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(totalSamples.IsSucc);
         ((ulong)totalSamples).Should().Be(model.Record.TotalSamples);
     }
 }
Exemplo n.º 13
0
 public void ReadSampleRateTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <uint> sampleRate = Flac.ReadSampleRate(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(sampleRate.IsSucc);
         ((uint)sampleRate).Should().Be(model.Record.SampleRateHertz);
     }
 }
Exemplo n.º 14
0
 public void ReadNumChannelsTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <byte> channels = Flac.ReadNumChannels(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(channels.IsSucc);
         ((byte)channels).Should().Be((byte)model.Record.Channels);
     }
 }
Exemplo n.º 15
0
 public void ReadBitDepthTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <byte> bitDepth = Flac.ReadBitDepth(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(bitDepth.IsSucc);
         ((byte)bitDepth).Should().Be(model.Record.BitDepth);
     }
 }
        private async Task <bool> InnerBroadcast(Fin final, Opcode opcode, byte[] data)
        {
            var results =
                Sessions.TakeWhile(session => _state == ServerState.Start)
                .Select(session => session.Context.WebSocket.InnerSend(final, opcode, data))
                .ToArray();
            await Task.WhenAll(results).ConfigureAwait(false);

            return(results.All(x => x.Result));
        }
Exemplo n.º 17
0
        public WsFrame(Fin fin, Opcode opcode, Mask mask, PayloadData payloadData)
            : this()
        {
            Fin         = fin;
            Opcode      = opcode;
            Masked      = mask;
            PayloadData = payloadData;

            init();
        }
Exemplo n.º 18
0
        public WsFrame(Fin fin, Opcode opcode, Mask mask, PayloadData payloadData)
            : this()
        {
            Fin         = fin;
            Opcode      = opcode;
            Masked      = payloadData.Length != 0 ? mask : Mask.UNMASK;
            PayloadData = payloadData;

            init();
        }
Exemplo n.º 19
0
 public static Vertex TrueEndVertex(this Fin fin)
 {
     if (!(fin.IsReversed ^ fin.Edge.IsReversed))
     {
         return(fin.Edge.EndVertex);
     }
     else
     {
         return(fin.Edge.StartVertex);
     }
 }
Exemplo n.º 20
0
 public WebSocketFrameHeader(Fin fin, Mask mask, Opcode opcode, ulong payloadLength)
 {
     myFin            = fin;
     myMask           = mask;
     Opcode           = opcode;
     myPayloadLength  = PayloadLengthByte(payloadLength);
     ExtPayloadLength = payloadLength;
     myRsv1           = Rsv.Off;
     myRsv2           = Rsv.Off;
     myRsv3           = Rsv.Off;
 }
Exemplo n.º 21
0
 public static double TrueEndParam(this Fin fin)
 {
     if (!(fin.IsReversed ^ fin.Edge.IsReversed))
     {
         return(fin.Edge.Bounds.Start);
     }
     else
     {
         return(fin.Edge.Bounds.End);
     }
 }
Exemplo n.º 22
0
 public static Fin <C> Apply <A, B, C>(this Func <A, B, C> fabc, Fin <A> fa, Fin <B> fb)
 {
     if (fa.IsFail)
     {
         return(Fin <C> .Fail(fa.Error));
     }
     if (fb.IsFail)
     {
         return(Fin <C> .Fail(fb.Error));
     }
     return(fabc(fa.Value, fb.Value));
 }
Exemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     iTween.MoveTo(player, iTween.Hash("path", iTweenPath.GetPath("toShew"),
                                       "time", 3,
                                       "easetype", iTween.EaseType.easeInOutSine,
                                       "oncomplete", "showShewInfo"));
     iTween.Pause(player);
     HowLook.CrossFadeAlpha(0.0f, 0.0f, false);
     FirstPer.CrossFadeAlpha(0.0f, 0.0f, false);
     Fin.CrossFadeAlpha(0.0f, 0.0f, false);
     count++;
 }
Exemplo n.º 24
0
        public void IsPcmWaveFileTest()
        {
            var model = this.data[FixtureModel.SM4BatNormal1];

            using var stream = model.ToTargetInformation(this.RealFileSystem).FileStream;

            Fin <bool> isWave = Wave.IsPcmWaveFile(stream);

            Assert.True(isWave.IsSucc);

            ((bool)isWave).Should().Be(model.IsWave);
        }
Exemplo n.º 25
0
 public static Fin <B> Apply <A, B>(this Fin <Func <A, B> > fab, Fin <A> fa)
 {
     if (fab.IsFail)
     {
         return(Fin <B> .Fail(fab.Error));
     }
     if (fa.IsFail)
     {
         return(Fin <B> .Fail(fa.Error));
     }
     return(fab.Value(fa.Value));
 }
Exemplo n.º 26
0
        private Task <bool> SendAsync(Fin fin, Opcode opcode, Mask mask, byte[] data, bool compressed)
        {
            lock (_forConn)
            {
                if (_readyState != WebSocketState.Open)
                {
                    return(Task.FromResult(false));
                }

                return(WriteBytesAsync(
                           WebSocketFrame.CreateWebSocketFrame(fin, opcode, mask, data, compressed).ToByteArray()));
            }
        }
Exemplo n.º 27
0
        private bool send(Fin fin, Opcode opcode, Mask mask, byte[] data, bool compressed)
        {
            lock (_forConn)
            {
                if (_readyState != WebSocketState.Open)
                {
                    return(false);
                }

                return(writeBytes(
                           WebSocketFrame.CreateWebSocketFrame(fin, opcode, mask, data, compressed).ToByteArray()));
            }
        }
Exemplo n.º 28
0
        public WsFrame(Fin fin, Opcode opcode, Mask mask, PayloadData payloadData)
            : this()
        {
            Fin    = fin;
            Opcode = opcode;
            //Masked = payloadData.Length != 0 ? mask : Mask.UNMASK;
            //client->server always mask whatever having payload
            //https://github.com/wsky/websocket-sharp/issues/2
            Masked      = mask;
            PayloadData = payloadData;

            init();
        }
Exemplo n.º 29
0
        void IDisposable.Dispose()
        {
            VtsGL.wglMakeCurrent(hDC, hRC);
            Fin?.Invoke(this, new EventArgs());
            VtsGL.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero);

            VtsGL.ReleaseDC(Handle, hDC);
            if (hRC != IntPtr.Zero)
            {
                VtsGL.wglDeleteContext(hRC);
                hRC = IntPtr.Zero;
            }
        }
Exemplo n.º 30
0
        public List <int> GetListaDeHoras()
        {
            List <int> listaHoras = new List <int>();
            int        total      = Math.Abs(Fin.Subtract(Inicio).Hours);
            DateTime   inicio     = Inicio;

            for (int i = 1; i <= total; i++)
            {
                listaHoras.Add(int.Parse(inicio.ToString("HH")));
                inicio = inicio.AddHours(1);
            }
            return(listaHoras);
        }
Exemplo n.º 31
0
    private bool send (Fin fin, Opcode opcode, byte[] data, bool compressed)
    {
      lock (_forConn) {
        if (_readyState != WebSocketState.Open) {
          _logger.Error ("The sending has been interrupted.");
          return false;
        }

        return sendBytes (new WebSocketFrame (fin, opcode, data, compressed, _client).ToArray ());
      }
    }
Exemplo n.º 32
0
 private WsFrame createFrame(Fin fin, Opcode opcode, PayloadData payloadData)
 {
     return _isClient
            ? new WsFrame(fin, opcode, payloadData)
            : new WsFrame(fin, opcode, Mask.UNMASK, payloadData);
 }
Exemplo n.º 33
0
        private bool send(Fin fin, Opcode opcode, byte[] data, bool compressed)
        {
            lock (_forState)
            {
                if (_readyState != WebSocketState.Open)
                {
#if COMPAT
                    Log.Error("The sending has been interrupted.");
#else
                    "The sending has been interrupted.".Error();
#endif
                    return false;
                }

                return SendBytes(new WebSocketFrame(fin, opcode, data, compressed, _client).ToArray());
            }
        }
Exemplo n.º 34
0
        private static WsFrame createFrame(
      Fin fin, Opcode opcode, PayloadData payloadData, bool compressed, bool client)
        {
            var mask = client ? Mask.MASK : Mask.UNMASK;
              var frame = new WsFrame (fin, opcode, mask, payloadData, compressed);

              return frame;
        }
Exemplo n.º 35
0
        private bool send(Fin fin, Opcode opcode, byte[] data, bool compressed)
        {
            lock (_forConn) {
            if (_readyState != WebSocketState.Open) {
              _logger.Error ("Closing the connection has been done.");
              return false;
            }

            return sendBytes (
              new WebSocketFrame (fin, opcode, data, compressed, _client).ToByteArray ());
              }
        }
Exemplo n.º 36
0
        private bool send(Fin fin, Opcode opcode, Mask mask, byte[] data, bool compressed)
        {
            lock (_forConn)
            {
                if (_readyState != WebSocketState.Open)
                {
                    return false;
                }

                return writeBytes(
                  WebSocketFrame.CreateWebSocketFrame(fin, opcode, mask, data, compressed).ToByteArray());
            }
        }
Exemplo n.º 37
0
 private bool send(Fin fin, Opcode opcode, byte[] data)
 {
     var frame = createFrame(fin, opcode, new PayloadData(data));
     return send(frame);
 }
Exemplo n.º 38
0
        private bool send(Fin fin, Opcode opcode, byte[] data, bool compressed)
        {
            lock (_forState) {
            if (_readyState != WebSocketState.Open) {
              _logger.Error ("The state of the connection has been changed.");
              return false;
            }

            var frame = new WebSocketFrame (fin, opcode, data, compressed, _client);
            return sendBytes (frame.ToArray ());
              }
        }
Exemplo n.º 39
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     objTrans = this.transform;
     fin = gameCont.GetComponent<Fin> ();
 }
Exemplo n.º 40
0
 private bool send(Fin fin, Opcode opcode, byte [] data, bool compressed)
 {
     var frame = createFrame (fin, opcode, new PayloadData (data), compressed, _client);
       return send (frame);
 }
Exemplo n.º 41
0
        private static WsFrame createDataFrame(
          Fin fin, Opcode opcode, PayloadData payloadData, CompressionMethod method, bool compressed, bool client)
        {
            var mask = client ? Mask.MASK : Mask.UNMASK;
            var compress = compressed ? CompressionMethod.NONE : method;
            var frame = new WsFrame(fin, opcode, mask, payloadData, compress);
            if (compressed)
                frame.PerMessageCompressed = true;

            return frame;
        }