Exemplo n.º 1
0
 public SteveMovement(Steve steve)
 {
     this.steve = steve;
     horizontal = steve.horizontal;
     vertical = steve.vertical;
     this.bob = steve.bob;
 }
Exemplo n.º 2
0
 public BobMovement(Bob bob)
 {
     this.bob = bob;
     horizontal = bob.horizontal;
     vertical = bob.vertical;
     this.steve = bob.steve;
 }
Exemplo n.º 3
0
	// Use this for initialization
	void Start () {
        fader = ui.GetComponent<Fading>();
		dialog = ui.GetComponent<Dialog>();
		bob = bobGO.GetComponent<Bob>();
		bob.inputEnable = false;

		if(Model.Instance.previousScene == "ChambreNuit" || Model.Instance.previousScene == "Intro")
		{
			dialogDisplayed = false;
			SoundScript.playDay();
			SoundScript.FadeIn();
		}
		else
		{
			Debug.Log("From Salon");
			dialogDisplayed = true;
			bob.inputEnable = true;
			bob.transform.position = new Vector3(4.4f, -0.9f, -3f);
			bob.transform.localScale = new Vector2(-1, 1);
		}
	}
Exemplo n.º 4
0
        public Laberinto(List<string> niveles,List<string> eniveles)
        {
            this.niveles = niveles;
            this.eniveles = eniveles;
            indiceNivel = 0;
            bloques = Laberinto.armarBloques(niveles[indiceNivel++],out this.pared);

            jugadores = new List<Jugador>();
            Jugador jugador = new Bub();
            jugador.Laberinto = this;
            jugadores.Add(jugador);
            jugador = new Bob();
            jugador.Laberinto = this;
            jugadores.Add(jugador);

            /*enemigos = new List<IEnemigo>();
            Robotito robotito = new Robotito(new System.Drawing.Point(48, 64), Direccion.derecha);
            robotito.Laberinto = this;
            enemigos.Add(robotito);
            robotito = new Robotito(new System.Drawing.Point(48, 76), Direccion.derecha);
            robotito.Laberinto = this;
            enemigos.Add(robotito);
            Viejita viej = new Viejita(new System.Drawing.Point(48, 84), Direccion.derecha);
            viej.Laberinto = this;
            enemigos.Add(viej);*/
            enemigos = Laberinto.armarEnemigos(eniveles[0]);
            foreach (IEnemigo e in enemigos)
                ((ObjetoVivo)e).Laberinto = this;

            objetosDisparados = new List<ObjetoDisparado>();
            burbujas = new List<Burbuja>();
            frutas = new List<Fruta>();
            transcurridoFinal = 0;
            transicion = false;
            indiceTransicion = 0;
        }
        public async Task <IActionResult> PostOutputAsync([FromQuery, Required] long roundId, [FromBody, Required] OutputRequest request)
        {
            if (roundId < 0 ||
                request.Level < 0 ||
                !ModelState.IsValid)
            {
                return(BadRequest());
            }

            CcjRound round = Coordinator.TryGetRound(roundId);

            if (round is null)
            {
                TryLogLateRequest(roundId, CcjRoundPhase.OutputRegistration);
                return(NotFound("Round not found."));
            }

            if (round.Status != CcjRoundStatus.Running)
            {
                TryLogLateRequest(roundId, CcjRoundPhase.OutputRegistration);
                return(Gone("Round is not running."));
            }

            CcjRoundPhase phase = round.Phase;

            if (phase != CcjRoundPhase.OutputRegistration)
            {
                TryLogLateRequest(roundId, CcjRoundPhase.OutputRegistration);
                return(Conflict($"Output registration can only be done from OutputRegistration phase. Current phase: {phase}."));
            }

            if (request.OutputAddress.Network != Network)
            {
                // RegTest and TestNet address formats are sometimes the same.
                if (Network == Network.Main)
                {
                    return(BadRequest($"Invalid OutputAddress Network."));
                }
            }

            if (request.OutputAddress == Constants.GetCoordinatorAddress(Network))
            {
                Logger.LogWarning($"Bob is registering the coordinator's address. Address: {request.OutputAddress}, Level: {request.Level}, Signature: {request.UnblindedSignature}.");
            }

            if (request.Level > round.MixingLevels.GetMaxLevel())
            {
                return(BadRequest($"Invalid mixing level is provided. Provided: {request.Level}. Maximum: {round.MixingLevels.GetMaxLevel()}."));
            }

            if (round.ContainsRegisteredUnblindedSignature(request.UnblindedSignature))
            {
                return(NoContent());
            }

            MixingLevel mixinglevel = round.MixingLevels.GetLevel(request.Level);
            Signer      signer      = mixinglevel.Signer;

            if (signer.VerifyUnblindedSignature(request.UnblindedSignature, request.OutputAddress.ScriptPubKey.ToBytes()))
            {
                using (await OutputLock.LockAsync())
                {
                    Bob bob = null;
                    try
                    {
                        bob = new Bob(request.OutputAddress, mixinglevel);
                        round.AddBob(bob);
                        round.AddRegisteredUnblindedSignature(request.UnblindedSignature);
                    }
                    catch (Exception ex)
                    {
                        return(BadRequest($"Invalid outputAddress is provided. Details: {ex.Message}"));
                    }

                    int bobCount      = round.CountBobs();
                    int blindSigCount = round.CountBlindSignatures();
                    if (bobCount == blindSigCount)                     // If there'll be more bobs, then round failed. Someone may broke the crypto.
                    {
                        await round.ExecuteNextPhaseAsync(CcjRoundPhase.Signing);
                    }
                }

                return(NoContent());
            }
            return(BadRequest("Invalid signature provided."));
        }
Exemplo n.º 6
0
 public void Statement_containing_question_mark()
 {
     Assert.Equal("Whatever.", Bob.Response("Ending with ? means a question."));
 }
Exemplo n.º 7
0
 public void Shouting_with_special_characters()
 {
     Assert.Equal("Whoa, chill out!", Bob.Response("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"));
 }
Exemplo n.º 8
0
 public void No_letters()
 {
     Assert.Equal("Whatever.", Bob.Response("1, 2, 3"));
 }
Exemplo n.º 9
0
 public void Stating_something()
 {
     Assert.Equal("Whatever.", Bob.Response("Tom-ay-to, tom-aaaah-to."));
 }
Exemplo n.º 10
0
 public void Using_acronyms_in_regular_speech()
 {
     Assert.Equal("Whatever.", Bob.Response("It's OK if you don't want to go to the DMV."));
 }
		public void DeepClone_ComplicatedMultiInterfaceInheritance(TypeModel model)
		{
			var bob = new Bob();
			var clone = (Bob)model.DeepClone(bob);
		}
Exemplo n.º 12
0
 public void Asking_a_question()
 {
     Assert.Equal("Sure.", Bob.Response("Does this cryogenic chamber make me look fat?"));
 }
Exemplo n.º 13
0
        public async Task <IActionResult> PostOutputAsync([FromQuery] string roundHash, [FromBody] OutputRequest request)
        {
            if (string.IsNullOrWhiteSpace(roundHash) ||
                request is null ||
                string.IsNullOrWhiteSpace(request.OutputAddress) ||
                string.IsNullOrWhiteSpace(request.SignatureHex) ||
                !ModelState.IsValid)
            {
                return(BadRequest());
            }

            CcjRound round = Coordinator.TryGetRound(roundHash);

            if (round is null)
            {
                return(NotFound("Round not found."));
            }

            if (round.Status != CcjRoundStatus.Running)
            {
                return(Gone("Round is not running."));
            }

            CcjRoundPhase phase = round.Phase;

            if (phase != CcjRoundPhase.OutputRegistration)
            {
                return(Conflict($"Output registration can only be done from OutputRegistration phase. Current phase: {phase}."));
            }

            BitcoinAddress outputAddress;

            try
            {
                outputAddress = BitcoinAddress.Create(request.OutputAddress, Network);
            }
            catch (FormatException ex)
            {
                return(BadRequest($"Invalid OutputAddress. Details: {ex.Message}"));
            }

            if (RsaKey.PubKey.Verify(ByteHelpers.FromHex(request.SignatureHex), outputAddress.ScriptPubKey.ToBytes()))
            {
                using (await OutputLock.LockAsync())
                {
                    Bob bob = null;
                    try
                    {
                        bob = new Bob(outputAddress);
                        round.AddBob(bob);
                    }
                    catch (Exception ex)
                    {
                        return(BadRequest($"Invalid outputAddress is provided. Details: {ex.Message}"));
                    }

                    if (round.CountBobs() == round.AnonymitySet)
                    {
                        await round.ExecuteNextPhaseAsync(CcjRoundPhase.Signing);
                    }
                }

                return(NoContent());
            }
            return(BadRequest("Invalid signature provided."));
        }
Exemplo n.º 14
0
 public void Question_with_only_numbers()
 {
     Assert.Equal("Sure.", Bob.Response("4?"));
 }
Exemplo n.º 15
0
 public void Only_numbers()
 {
     Assert.Equal("Whatever.", Bob.Response("1, 2, 3"));
 }
Exemplo n.º 16
0
 public void Forceful_question()
 {
     Assert.Equal("Whoa, chill out!", Bob.Response("WHAT THE HELL WERE YOU THINKING?"));
 }
Exemplo n.º 17
0
 public void Forceful_question()
 {
     Assert.Equal("Calm down, I know what I'm doing!", Bob.Response("WHAT'S GOING ON?"));
 }
Exemplo n.º 18
0
 public void Asking_gibberish()
 {
     Assert.Equal("Sure.", Bob.Response("fffbbcbeab?"));
 }
Exemplo n.º 19
0
 public void Prattling_on()
 {
     Assert.Equal("Sure.", Bob.Response("Wait! Hang on. Are you going to be OK?"));
 }
	void Awake()
	{
		fader = transform.parent.GetComponent<Fading>();
		bob = bobGO.GetComponent<Bob>();
	}
Exemplo n.º 21
0
 public void Asking_a_numeric_question()
 {
     Assert.Equal("Sure.", Bob.Response("You are, what, like 15?"));
 }
Exemplo n.º 22
0
 public void Prolonged_silence()
 {
     Assert.Equal("Fine. Be that way!", Bob.Response("          "));
 }
Exemplo n.º 23
0
 public void Talking_forcefully()
 {
     Assert.Equal("Whatever.", Bob.Response("Let's go make out behind the gym!"));
 }
Exemplo n.º 24
0
 public void Shouting()
 {
     Assert.Equal("Whoa, chill out!", Bob.Response("WATCH OUT!"));
 }
Exemplo n.º 25
0
 public void Forceful_question()
 {
     Assert.Equal("Calm down, I know what I'm doing!", Bob.Response("WHAT THE HELL WERE YOU THINKING?"));
 }
Exemplo n.º 26
0
 public void Alternate_silence()
 {
     Assert.Equal("Fine. Be that way!", Bob.Response("\t\t\t\t\t\t\t\t\t\t"));
 }
Exemplo n.º 27
0
 public void Shouting_numbers()
 {
     Assert.Equal("Whoa, chill out!", Bob.Response("1, 2, 3 GO!"));
 }
Exemplo n.º 28
0
 public void Multiple_line_question()
 {
     Assert.Equal("Whatever.", Bob.Response("\nDoes this cryogenic chamber make me look fat?\nNo."));
 }
Exemplo n.º 29
0
 public void Question_with_no_letters()
 {
     Assert.Equal("Sure.", Bob.Response("4?"));
 }
Exemplo n.º 30
0
 public void Starting_with_whitespace()
 {
     Assert.Equal("Whatever.", Bob.Response("         hmmmmmmm..."));
 }
Exemplo n.º 31
0
 public void Shouting_with_no_exclamation_mark()
 {
     Assert.Equal("Whoa, chill out!", Bob.Response("I HATE THE DMV"));
 }
Exemplo n.º 32
0
 public void Ending_with_whitespace()
 {
     Assert.Equal("Sure.", Bob.Response("Okay if like my  spacebar  quite a bit?   "));
 }
Exemplo n.º 33
0
 public void Non_letters_with_question()
 {
     Assert.Equal("Sure.", Bob.Response(":) ?"));
 }
Exemplo n.º 34
0
 public void Other_whitespace()
 {
     Assert.Equal("Fine. Be that way!", Bob.Response("\n\r \t"));
 }
Exemplo n.º 35
0
	void Awake()
    {
        fader = transform.parent.GetComponent<Fading>();
		bob = GameObject.Find("Bob").GetComponent<Bob>();
    }
Exemplo n.º 36
0
 public void Non_question_ending_with_whitespace()
 {
     Assert.Equal("Whatever.", Bob.Response("This is a statement ending with whitespace      "));
 }
Exemplo n.º 37
0
 public void Shouting_gibberish()
 {
     Assert.Equal("Whoa, chill out!", Bob.Response("FCECDFCAAB"));
 }
 public EditBob(Bob target)
     : base(target)
 {
 }