Esempio n. 1
0
    void FixedUpdate()
    {
        //	update gravity vector

        switch (gravityDown)
        {
        case GravityDown.Absolute:
            _thrustVector = Vector3.up;
            break;

        case GravityDown.Relative:
            _thrustVector = _transform.up;
            break;
        }

        //	update relative forces on vehicle

        foreach (Vector3 v3lp in liftPoints)
        {
            Vector3 worldPosition = transform.TransformPoint(v3lp);

            Vector3 forceVector = _thrustVector;
            forceVector *= (_mass + linearLift - 1) * factorLift * hoverAltitude;
            forceVector /= Mathf.Pow(GetAltitudeAtPoint(_transform.TransformPoint(v3lp)), geometricLift);

            _rigidbody.AddForceAtPosition(forceVector, worldPosition, ForceMode.Acceleration);

            if (_debugTick)
            {
                Debug.Log("forceVector: " + forceVector.magnitude +
                          ", altitude: " + UU.Trunc(GetAltitudeAtPoint(_transform.position), 2) +
                          ", divisor: " + Mathf.Pow(GetAltitudeAtPoint(_transform.TransformPoint(v3lp)), geometricLift));
            }
        }

        if (enableGravityKeel)
        {
            RaycastHit data;
            if (Physics.Raycast(_transform.position, -_thrustVector, out data, 18))
            {
                //	rotate toward 'level' as indicated by the surface below
                SelfRightNonKinematic(data.normal);
            }
            else
            {
                //	raycast hit nothing, so we migh be flipped over, or very high
                //	so rotate toward the 'universal' level
                SelfRightNonKinematic(Vector3.up);
            }
        }

        _debugTick = false;
    }
Esempio n. 2
0
    void OnGUI()
    {
        if (!showGUI)
        {
            return;
        }

        GUILayout.BeginHorizontal();
        GUILayout.Space(guiPosition.x);
        GUILayout.BeginVertical();
        GUILayout.Space(guiPosition.y);
        GUILayout.Label(stringId + "( " + UU.Trunc(_altitude, 1) + " : " + UU.Trunc(_buoyancyVector.magnitude, 1) + ")");

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
Esempio n. 3
0
    void OnCollisionStay(Collision other)
    {
        float impactMagnitude = other.gameObject.rigidbody.velocity.magnitude;

        for (int i = 1 + (int)(impactMagnitude * .1f * Random.value); i > 0 && impactMagnitude > 0.1f; i--)
        {
            Vector3 impactVelocity = UU.RandomVector(1);
            impactVelocity.y = Mathf.Abs(impactVelocity.y);

            Vector3 contactPosition  = UU.RandomPointOnPolygonEdge(UU.ContactPointsToVector3Array(other.contacts));
            float   particleSize     = Random.Range(1f, 4f);
            float   particleLifetime = Random.Range(1, 5);
            Color   particleColor    = UU.RandomColor(Palette.Brown, .2f);

            _particles.Emit(contactPosition, impactVelocity, particleSize, particleLifetime, particleColor);
        }
    }
Esempio n. 4
0
            void Handle(Input.SignT Action)
            {
                UU  uu = null;
                var p  = this.Parent as MasterPage;

                if (Action.Value < 0)                 // AutoSign In/Out
                {
                    if (!string.IsNullOrEmpty(Token)) // AutoSignIn
                    {
                        uu = Db.SQL <UU>("select r from UU r where r.Token = ?", Token).FirstOrDefault();
                        if (uu == null)
                        {
                            Token   = "";
                            p.Token = "";
                            Mesaj   = "Hatali Token";
                        }
                        else
                        {
                            p.Token = Token;
                            Mesaj   = "Signed";
                        }
                    }
                    else  // AutoSignOut
                    {
                        p.Token = "";
                        Mesaj   = "UnSigned";
                    }
                }
                else
                {
                    if (IsOpened)   // SignIn
                    {
                        if (!string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Pwd))
                        {
                            uu = Db.SQL <UU>("select r from UU r where r.Email = ?", Email).FirstOrDefault();
                            if (uu != null)  // SignIn
                            {
                                if (uu.Pwd == Pwd)
                                {
                                    Pwd      = "";
                                    Token    = uu.Token;
                                    p.Token  = uu.Token;
                                    Mesaj    = "SignedIn";
                                    IsOpened = false;
                                }
                                else
                                {
                                    Pwd     = "";
                                    Token   = "";
                                    p.Token = "";
                                    Mesaj   = "Hatali eMail/Password";
                                }
                            }
                            else                                           // SignUp
                            {
                                var newToken = H.EncodeQueryString(Email); // CreateToken
                                Db.Transact(() =>
                                {
                                    new UU
                                    {
                                        Email       = Email,
                                        Pwd         = Pwd,
                                        Token       = newToken,
                                        InsTS       = DateTime.Now,
                                        IsConfirmed = false,
                                    };
                                });
                                var email = H.EncodeQueryString(Email);
                                H.SendMail(email);
                                Email = "";
                                Pwd   = "";
                                Token = "";
                                Mesaj = "Mailinize gelen linki týklayarak doðrulama iþlemini tamamlayýn.";
                            }
                        }
                    }
                    else                                  // SignOut / SignIn Request
                    {
                        if (!string.IsNullOrEmpty(Token)) // SignOut
                        {
                            Token   = "";
                            p.Token = "";
                            Mesaj   = "SignedOut";
                        }
                        else   // SignIn Request
                        {
                            IsOpened = true;
                        }
                    }
                }
            }
Esempio n. 5
0
        public void Register()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            // Workspace home page (landing page from launchpad) dashboard alias

            Handle.GET("/bodved2", () =>
            {
                //MasterPage master = GetMasterPageFromSession();
                //return master;

                return(Self.GET("/bodved/DDs"));
                //return Self.GET("/");
            });

            Handle.GET("/bodved", () =>
            {
                return(Self.GET("/"));
            });

            Handle.GET("/", () =>
            {
                //MasterPage master = GetMasterPageFromSession();
                //return master;

                return(Self.GET("/bodved/DDs"));
            });

            Handle.GET("/bodved/organizations", () =>
            {
                MasterPage master = GetMasterPageFromSession();

                /*
                 * if (!(master.CurrentPage is OrganizationsPage))
                 * {
                 *  master.CurrentPage = GetLauncherPage("/bodved/partials/organizations");
                 *  //(master.CurrentPage as OrganizationsPage).Init();
                 * }*/
                return(master);
            });

            Handle.GET("/bodved/AboutPage", () =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is PPsPage))
                {
                    master.CurrentPage = GetLauncherPage("/bodved/partials/aboutpage");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/PPs", () =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is PPsPage))
                {
                    master.CurrentPage = GetLauncherPage("/bodved/partials/PPs");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/DDs", () =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is DDsPage))
                {
                    master.CurrentPage = GetLauncherPage("/bodved/partials/DDs");
                }
                (master.CurrentPage as DDsPage).canMdfy = master.Token == "" ? false : true;
                return(master);
            });

            Handle.GET("/bodved/CurEvents", () =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CurEventsPage))
                {
                    master.CurrentPage = GetLauncherPage("/bodved/partials/CurEvents");
                }
                return(master);
            });

            Handle.GET("/bodved/PPRDs/{?}", (int dnm) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is PPRDsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/PPRDs/{dnm}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CCs/{?}", (int dnm) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CCsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CCs/{dnm}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CE/{?}", (ulong cc) =>
            {
                // Event? CET/CEF neye gidecegini bul
                CC CC = Db.FromId <CC>(cc);

                MasterPage master = GetMasterPageFromSession();

                if (CC.Skl == "T")
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CC2CETs/{cc}");
                }
                else if (CC.Skl == "F")
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CEFs/{cc}");
                }

                return(master);
            });

            Handle.GET("/bodved/CK/{?}", (ulong cc) =>
            {
                // Katilanlar? CT/CF neye gidecegini bul
                CC CC = Db.FromId <CC>(cc);

                MasterPage master = GetMasterPageFromSession();

                if (CC.Skl == "T")
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CTs/{cc}");
                }
                else if (CC.Skl == "F")
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CFs/{cc}");
                }

                return(master);
            });

            Handle.GET("/bodved/CF2CEFs/{?}/{?}", (ulong cc, ulong pp) =>
            {
                MasterPage master = GetMasterPageFromSession();
                //if (!(master.CurrentPage is CT2CETsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CF2CEFs/{cc}/{pp}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CT2CETs/{?}", (ulong ct) =>
            {
                MasterPage master = GetMasterPageFromSession();
                //if (!(master.CurrentPage is CT2CETsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CT2CETs/{ct}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CTPs/{?}", (ulong ct) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CTPsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CTPs/{ct}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CETs/{?}", (ulong cc) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CTsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CETs/{cc}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CET2CETXs/{?}/{?}", (ulong cet, ulong ct) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CET2CETXsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CET2CETXs/{cet}/{ct}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CET2MACsInp/{?}", (ulong cet) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CET2MACsInpPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CET2MACsInp/{cet}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CET2MACs/{?}", (ulong cet) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CET2MACsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CET2MACs/{cet}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/CEF2MACs/{?}", (ulong cet) =>
            {
                MasterPage master = GetMasterPageFromSession();
                if (!(master.CurrentPage is CEF2MACsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/CEF2MACs/{cet}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/PP2MACs/{?}", (ulong pp) =>
            {
                MasterPage master = GetMasterPageFromSession();
                //if (!(master.CurrentPage is PP2MACsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/PP2MACs/{pp}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            Handle.GET("/bodved/PP2PPRDs/{?}", (ulong pp) =>
            {
                MasterPage master = GetMasterPageFromSession();
                //if (!(master.CurrentPage is PP2MACsPage))
                {
                    master.CurrentPage = GetLauncherPage($"/bodved/partials/PP2PPRDs/{pp}");
                    //(master.CurrentPage as CCsPage).Init();
                }
                return(master);
            });

            ///////////////////////////////////////////////////

            // Lookup calisma
            Handle.GET("/bodved/PPjson/{?}", (long ticks) =>
            {
                var json = new PPsJson();
                //ticks den sonra degisenleri gonder
                var dt          = new DateTime(ticks);
                json.PPs.Data   = Db.SQL <PP>("SELECT r FROM PP r where r.ObjectNo > ?", 0);
                json.Read.Ticks = DateTime.Now.Ticks;
                return(json);
            });

            Handle.POST("/bodved/PUTjson/{?}", (string unp) =>
            {
                var es = ""; // EncodeQueryString("*****@*****.**");
                var ds = ""; // DecodeQueryString(es);

                //SendMail();

                return($"{unp} : {es} {ds}");
            });

            /*
             * Handle.PUT("/bodved/Sign", (UserInfo ui) =>
             * {
             *  UU uu = null;
             *  var aaa = Session.Current;
             *  MasterPage master = GetMasterPageFromSession();
             *
             *  if ( !string.IsNullOrEmpty(ui.token) && string.IsNullOrEmpty(ui.email) && string.IsNullOrEmpty(ui.pwd))  // AutoSignIn
             *  {
             *      uu = Db.SQL<UU>("select r from UU r where r.Token = ?", ui.token).FirstOrDefault();
             *      if(uu == null)
             *      {
             *          ui.token = "";
             *          ui.mesaj = "Tekrar Giriş Yapın.";
             *      }
             *      else
             *      {
             *          //var session = Session.Ensure();
             *          //session.Store["bodved"] = ui;
             *          //MasterPage master = GetMasterPageFromSession();
             *          //master.Token = ui.token;
             *          ui.mesaj = "";
             *      }
             *
             *  }
             *  else if (!string.IsNullOrEmpty(ui.email) && !string.IsNullOrEmpty(ui.pwd))  // Sign Up/In
             *  {
             *      uu = Db.SQL<UU>("select r from UU r where r.Email = ?", ui.email).FirstOrDefault();
             *      if(uu == null)  // SignUp
             *      {
             *          string newToken = EncodeQueryString(ui.email); // CreateToken
             *          Db.Transact(() =>
             *          {
             *              new UU
             *              {
             *                  Email = ui.email,
             *                  Pwd = ui.pwd,
             *                  Token = newToken,
             *                  InsTS = DateTime.Now,
             *                  IsConfirmed = false,
             *              };
             *          });
             *          var email = EncodeQueryString(ui.email);
             *          SendMail(email);
             *          ui.email = "";
             *          ui.pwd = "";
             *          ui.mesaj = "Mailinize gelen linki tıklayarak doğrulama işlemini tamamlayın.";
             *      }
             *      else  // SignIn
             *      {
             *          if(uu.Pwd == ui.pwd)
             *          {
             *              ui.pwd = "";
             *              ui.token = uu.Token;
             *              ui.mesaj = "LoggedIn";
             *          }
             *          else
             *          {
             *              ui.pwd = "";
             *              ui.token = "";
             *              ui.mesaj = "Hatali eMail/Password";
             *          }
             *      }
             *  }
             *
             *  return ui;
             *
             *  //return $"{es} {ds}";
             *  //return $"{signTxt} : {es} {ds}";
             * });
             */
            Handle.GET("/bodved/confirmemail/{?}", (string deMail) =>
            {
                MasterPage master = GetMasterPageFromSession();
                var eMail         = H.DecodeQueryString(deMail);

                master.Token = "";

                UU uu = Db.SQL <UU>("select r from UU r where r.Email = ?", eMail).FirstOrDefault();
                if (uu != null)
                {
                    Db.Transact(() =>
                    {
                        uu.IsConfirmed = true;
                    });
                    master.Token = uu.Token;
                    //return master; // Self.GET("/bodved/DDs");
                }
                return(master);
            });
        }