Ejemplo n.º 1
0
 public Idle(Sol player)
 {
     _Player             = player;
     _Player._Velocity.x = 0;
 }
Ejemplo n.º 2
0
    static void Main()
    {
        Sol mySol = new Sol();

        mySol.Solve();
    }
Ejemplo n.º 3
0
 public Jump(Sol player)
 {
     _Player             = player;
     _Player._Velocity.y = _Player._JumpForce;
 }
Ejemplo n.º 4
0
 public Falling(Sol player)
 {
     _Player = player;
 }
Ejemplo n.º 5
0
 public BWalk(Sol player)
 {
     _Player           = player;
     _Player._Velocity = new Vector2(_Player._MoveSpeed, _Player._Velocity.y);
 }
Ejemplo n.º 6
0
 public FWalk(Sol player)
 {
     _Player = player;
 }
Ejemplo n.º 7
0
 public Crouch(Sol player)
 {
     _Player = player;
 }
        public ActionResult CreateOrUpdate([FromBody] Sol sol)
        {
            if (sol == null || string.IsNullOrEmpty(sol.SolLicenceNumber) || !sol.SolLicenceNumber.Contains("-"))
            {
                return(BadRequest());
            }

            // format of the "SolLicenceNumber" field is {EventLicenceNumber}-{LocationReference}

            string solIdEscaped = sol.SolLicenceNumber.Replace("'", "''");

            if (solIdEscaped.Contains("-"))
            {
                solIdEscaped = solIdEscaped.Substring(0, solIdEscaped.IndexOf("-"));
            }


            // string locationReference = sol.SolLicenceNumber.Substring(sepLicenceNumber.Length);

            // determine if the record is new.
            MicrosoftDynamicsCRMadoxioSpecialevent existingRecord =
                _dynamicsClient.GetSpecialEventByLicenceNumber(solIdEscaped);

            if (existingRecord == null) // new record
            {
                MicrosoftDynamicsCRMadoxioSpecialevent newRecord = new MicrosoftDynamicsCRMadoxioSpecialevent()
                {
                    AdoxioCapacity = sol.Capacity,
                    AdoxioSpecialeventdescripton = sol.EventDescription,
                    AdoxioEventname = AdjustString255(sol.EventName),
                    AdoxioSpecialeventpermitnumber = solIdEscaped,
                    // applicant
                    AdoxioSpecialeventapplicant      = AdjustString255(sol.Applicant?.ApplicantName),
                    AdoxioSpecialeventapplicantemail = AdjustString255(sol.Applicant?.EmailAddress),
                    AdoxioSpecialeventapplicantphone = sol.Applicant?.PhoneNumber,
                    // location
                    AdoxioSpecialeventstreet1    = AdjustString255(sol.Applicant?.Address?.Address1),
                    AdoxioSpecialeventstreet2    = AdjustString255(sol.Applicant?.Address?.Address2),
                    AdoxioSpecialeventcity       = AdjustString255(sol.Applicant?.Address?.City),
                    AdoxioSpecialeventpostalcode = sol.Applicant?.Address?.PostalCode,
                    AdoxioSpecialeventprovince   = AdjustString255(sol.Applicant?.Address?.Province),
                    // responsible individual
                    AdoxioResponsibleindividualfirstname     = AdjustString255(sol.ResponsibleIndividual?.FirstName),
                    AdoxioResponsibleindividuallastname      = AdjustString255(sol.ResponsibleIndividual?.LastName),
                    AdoxioResponsibleindividualmiddleinitial = AdjustString255(sol.ResponsibleIndividual?.MiddleInitial),
                    AdoxioResponsibleindividualposition      = AdjustString255(sol.ResponsibleIndividual?.Position),
                    AdoxioResponsibleindividualsir           = sol.ResponsibleIndividual?.SirNumber,
                    // tasting event
                    AdoxioTastingevent = sol.TastingEvent
                };

                newRecord.AdoxioSpecialeventSpecialeventlocations = new List <MicrosoftDynamicsCRMadoxioSpecialeventlocation>();

                newRecord.AdoxioSpecialeventSpecialeventlocations.Add(ExtractLocation(sol));


                // notes
                if (sol.SolNote != null)
                {
                    newRecord.AdoxioSpecialeventSpecialeventnotes =
                        new List <MicrosoftDynamicsCRMadoxioSpecialeventnote>();

                    foreach (var item in sol.SolNote)
                    {
                        newRecord.AdoxioSpecialeventSpecialeventnotes.Add(
                            new MicrosoftDynamicsCRMadoxioSpecialeventnote()
                        {
                            AdoxioNote   = item.Text,
                            AdoxioAuthor = AdjustString255(item.Author),
                            Createdon    = AdjustDateTime(item.CreatedDate),
                            Modifiedon   = AdjustDateTime(item.LastUpdatedDate)
                        });
                    }
                }

                // terms and conditions
                if (sol.TsAndCs != null)
                {
                    newRecord.AdoxioSpecialeventSpecialeventtsacs =
                        new List <MicrosoftDynamicsCRMadoxioSpecialeventtandc>();
                    foreach (var item in sol.TsAndCs)
                    {
                        var newTandC = new MicrosoftDynamicsCRMadoxioSpecialeventtandc()
                        {
                            AdoxioTermsandcondition = item.Text,
                            AdoxioOriginator        = AdjustString255(item.Originator)
                        };

                        if (item.TandcType == TandcType.GlobalCondition)
                        {
                            newTandC.AdoxioTermsandconditiontype = true;
                        }

                        newRecord.AdoxioSpecialeventSpecialeventtsacs.Add(newTandC);
                    }
                }

                try
                {
                    newRecord = _dynamicsClient.Specialevents.Create(newRecord);
                    _logger.Information($"Created special event {newRecord.AdoxioSpecialeventid}");
                }
                catch (HttpOperationException httpOperationException)
                {
                    _logger.Error(httpOperationException, "Error creating special event record");
                    // fail
                    return(StatusCode(500, "Server Error creating record."));
                }
            }
            else // existing record.
            {
                if (sol.Location != null)
                {
                    MicrosoftDynamicsCRMadoxioSpecialeventlocation location = ExtractLocation(sol);

                    try
                    {
                        location = _dynamicsClient.Specialeventlocations.Create(location);
                        _logger.Information(
                            $"Created new special event location {location.AdoxioSpecialeventlocationid}");
                    }
                    catch (HttpOperationException httpOperationException)
                    {
                        _logger.Error(httpOperationException, "Error creating special event schedule");
                        // fail
                        return(StatusCode(500, "Server Error creating record."));
                    }

                    // now bind the record to the parent.

                    var specialEventLocationData = _dynamicsClient.GetEntityURI("adoxio_specialeventlocations",
                                                                                location.AdoxioSpecialeventlocationid);

                    var oDataIdEventLocation = new Odataid
                    {
                        OdataidProperty = specialEventLocationData
                    };
                    try
                    {
                        _dynamicsClient.Specialevents.AddReference(existingRecord.AdoxioSpecialeventid,
                                                                   "adoxio_specialevent_specialeventlocations", oDataIdEventLocation);
                    }
                    catch (HttpOperationException odee)
                    {
                        Log.Error(odee, "Error adding reference to adoxio_specialevent_specialeventlocations");
                    }
                }
            }


            return(Ok());
        }
Ejemplo n.º 9
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            GL.ClearColor(Color.Black);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);

            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

            // Sol
            GL.GenTextures(1, out textura);
            GL.BindTexture(TextureTarget.Texture2D, textura);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            BitmapData dataSun = bitmapSun.LockBits(new System.Drawing.Rectangle(0, 0, bitmapSun.Width, bitmapSun.Height),
                                                    ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, dataSun.Width, dataSun.Height, 0,
                          OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, dataSun.Scan0);
            bitmapSun.UnlockBits(dataSun);

            // Terra
            GL.GenTextures(2, out textura);
            GL.BindTexture(TextureTarget.Texture2D, textura);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            BitmapData dataEarth = bitmapEarth.LockBits(new System.Drawing.Rectangle(0, 0, bitmapEarth.Width, bitmapEarth.Height),
                                                        ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, dataEarth.Width, dataEarth.Height, 0,
                          OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, dataEarth.Scan0);
            bitmapEarth.UnlockBits(dataEarth);

            // campo de visão da câmera sintética
            Visao  = new Vector3(50, 50, 50);
            Target = new Vector3(0, 0, 0);
            Longe  = 100.0f;
            Perto  = 1.0f;

            // Matriz sol
            Transformacao4D matrizSolNova = new Transformacao4D();

            matrizSolNova.AtribuirTranslacao(40, 0, 0);
            Sol = matrizSolNova.MultiplicarMatriz(Sol);
            // terra passa a ser "filho" do sol
            Terra = Sol.MultiplicarMatriz(Terra);

            //cria terra
            Transformacao4D matrizTerraNova = new Transformacao4D();

            matrizTerraNova.AtribuirEscala(1.5, 1.5, 1.5);
            matrizTerraNova.AtribuirTranslacao(20, 0, 0);
            Terra = matrizTerraNova.MultiplicarMatriz(Terra);
            // Matriz atribui filho lua a terra
            Lua = Terra.MultiplicarMatriz(Lua);

            //cria lua
            Transformacao4D matrizLuaNova = new Transformacao4D();

            matrizLuaNova.AtribuirEscala(0.3, 0.3, 0.3);
            Lua = matrizLuaNova.MultiplicarMatriz(Lua);
        }