Beispiel #1
0
 public void InitializeMap()
 {
     this.ellipsePoints = new Vector3[this.vesselOrbitLinePrefab.GetChild(0).GetComponent <LineRenderer>().positionCount];
     for (int i = 0; i < this.ellipsePoints.Length; i++)
     {
         this.ellipsePoints[i] = this.vesselOrbitLinePrefab.GetChild(0).GetComponent <LineRenderer>().GetPosition(i);
         Vector3[] array = this.ellipsePoints;
         int       num   = i;
         array[num].y          = array[num].y * 0.5f;
         this.ellipsePoints[i] = this.ellipsePoints[i].normalized;
     }
     this.mainLines     = new OrbitLines.OrbitLinesPack(this.vesselOrbitLinePrefab);
     this.selectedLines = new OrbitLines.OrbitLinesPack(this.vesselOrbitLinePrefab);
     this.orbitLineMaterials.Add(CelestialBodyData.Type.Star, this.sunMaterial);
     this.orbitLineMaterials.Add(CelestialBodyData.Type.Planet, this.planetMaterial);
     this.orbitLineMaterials.Add(CelestialBodyData.Type.Moon, this.moonMaterial);
     this.mapRefs.Add(Ref.solarSystemRoot, this.CreateMapCelestialBody(Ref.solarSystemRoot, base.transform, 0, true, false, false));
     this.sunGlow.parent        = this.mapRefs[Ref.solarSystemRoot].holder;
     this.sunGlow.localPosition = Vector3.zero;
     foreach (CelestialBodyData celestialBodyData in Ref.solarSystemRoot.satellites)
     {
         this.mapRefs.Add(celestialBodyData, this.CreateMapCelestialBody(celestialBodyData, base.transform, 200, true, true, celestialBodyData.atmosphereData.hasAtmosphere));
         foreach (CelestialBodyData celestialBodyData2 in celestialBodyData.satellites)
         {
             this.mapRefs.Add(celestialBodyData2, this.CreateMapCelestialBody(celestialBodyData2, this.mapRefs[celestialBodyData].holder, 100, true, true, celestialBodyData2.atmosphereData.hasAtmosphere));
         }
     }
     this.following = new OrbitLines.Target(Ref.GetPlanetByName(Ref.controller.startAdress));
     this.UpdateMapZoom(-this.mapPosition.z);
     TransferWindow.GenerateMeshPlanetTW(ref this.transferWindowPlanet, 0.05f, 0.006f, 1f, null);
     TransferWindow.GenerateMeshPlanetTW(ref this.transferWindowOrbit, 0.05f, 0f, 1f, null);
     this.CreateNewTransferWindow();
 }
Beispiel #2
0
        public IHttpActionResult PutTransferWindow(int id, TransferWindow transferWindow)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != transferWindow.Id)
            {
                return(BadRequest());
            }

            TransferWindow t = _uow.TransferWindows.Get(id);

            if (t == null)
            {
                return(NotFound());
            }

            t.Period      = transferWindow.Period;
            t.EndTime     = transferWindow.EndTime;
            t.StartTime   = transferWindow.StartTime;
            t.Price       = transferWindow.Price;
            t.SmartGridId = transferWindow.SmartGridId;
            t.SumOfTrades = transferWindow.SumOfTrades;

            _uow.Complete();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        internal static async void TransferItemsAsync(object items, string destination, bool isUpload)
        {
            NetworkClient client = await newInstance();

            bool isNewClient = (client != null);

            if (!isNewClient)
            {
                client = mainClient; Lock();
            }

            TransferWindow.Initialize(Owner, client);

            await client.TransferItemsAsync(items, destination, isUpload);

            if (isNewClient)
            {
                client.Dispose();
            }
            else
            {
                UnLock();
            }

            items = null;
        }
Beispiel #4
0
 public void UpdateMapZoom(double newZoom)
 {
     if (newZoom < 0.0)
     {
         newZoom = -newZoom;
     }
     if (newZoom > 20000000.0)
     {
         newZoom = 20000000.0;
     }
     if (newZoom < 0.15000000596046448)
     {
         newZoom = 0.15000000596046448;
     }
     this.mapPosition.z = -newZoom;
     if (this.following.GetFollowingBody().orbitData.SOI * 10.0 / 10000.0 < -this.mapPosition.z)
     {
         this.SwitchFollowingBody(this.following.GetFollowingBody().parentBody);
     }
     this.TryFollowSattelites();
     this.UpdateOrbitLinesVisibility();
     if (this.transferWindowData.transferType == TransferWindow.TransferType.ToNeighbour)
     {
         TransferWindow.UpdateTransferWindowAlpha(this.transferWindowPlanet.GetComponent <MeshRenderer>().sharedMaterial, this.transferWindowData);
     }
 }
Beispiel #5
0
        public IHttpActionResult GetTransferWindow(int id)
        {
            TransferWindow transferWindow = _uow.TransferWindows.Get(id);

            if (transferWindow == null)
            {
                return(NotFound());
            }

            return(Ok(transferWindow));
        }
Beispiel #6
0
        public IHttpActionResult PostTransferWindow(TransferWindow transferWindow)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _uow.TransferWindows.Add(transferWindow);
            _uow.Complete();

            return(CreatedAtRoute("DefaultApi", new { id = transferWindow.Id }, transferWindow));
        }
Beispiel #7
0
        public IHttpActionResult DeleteTransferWindow(int id)
        {
            TransferWindow transferWindow = _uow.TransferWindows.Get(id);

            if (transferWindow == null)
            {
                return(NotFound());
            }

            _uow.TransferWindows.Remove(transferWindow);
            _uow.Complete();

            return(Ok(transferWindow));
        }
Beispiel #8
0
        /// <summary>
        /// Button Method to TRANSFER money
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BTN_Clients_Transfer(object sender, RoutedEventArgs e)
        {
            if (TV_Departments.SelectedItem != null & LV_Clients.SelectedItem != null)
            {
                if ((TV_Departments?.SelectedItem as Department <Client>).Name != Bank.bankName)
                {
                    TransferWindow tranferWidnow = new TransferWindow(this,
                                                                      LV_Clients.SelectedItem as Client,
                                                                      Bank.Departments[0].Departments.IndexOf(TV_Departments?.SelectedItem as Department <Client>));

                    tempDept = TV_Departments?.SelectedItem as Department <Client>;

                    tempDept.TransferNotification += GetTransferNotification;
                    tranferWidnow.Show();
                }
            }
        }
Beispiel #9
0
    private void PositionTransferWindowMarkers(List <Orbit> orbits)
    {
        bool flag = false;

        TransferWindow.PositionPlanetMarker(ref flag, ref this.transferWindowPlanet, this.transferWindowData);
        if (this.transferWindowPlanet.gameObject.activeSelf != flag)
        {
            this.transferWindowPlanet.gameObject.SetActive(flag);
        }
        bool flag2 = false;

        TransferWindow.PositionOrbitMarker(ref flag2, ref this.transferWindowOrbit, orbits, this.transferWindowData);
        if (this.transferWindowOrbit.gameObject.activeSelf != flag2)
        {
            this.transferWindowOrbit.gameObject.SetActive(flag2);
        }
    }
        private void InitializeWindow()
        {
            _fromAccount           = new AccountBuilder().Build();
            _toAccount             = new AccountBuilder().Build();
            _allAccountsOfCustomer = new List <Account> {
                _fromAccount, _toAccount
            };

            _window = new TransferWindow(_fromAccount, _allAccountsOfCustomer, _accountServiceMock.Object);
            _window.Show();

            _fromAccountTextBlock  = _window.GetPrivateFieldValueByName <TextBlock>("FromAccountTextBlock");
            _toAccountsComboBox    = _window.FindVisualChildren <ComboBox>().First();
            _amountTextBox         = _window.GetPrivateFieldValueByName <TextBox>("AmountTextBox");
            _errorMessageTextBlock = _window.GetPrivateFieldValueByName <TextBlock>("ErrorMessageTextBlock");
            _transferButton        = _window.GetPrivateFieldValueByName <Button>("TransferButton");
        }
Beispiel #11
0
    public static void PositionOrbitMarker(ref bool show, ref MeshFilter meshFilterOrbit, List <Orbit> orbits, TransferWindow.Data transferWindow)
    {
        if (transferWindow.transferType == TransferWindow.TransferType.None)
        {
            return;
        }
        if (orbits.Count == 0)
        {
            return;
        }
        if (orbits[0].orbitType == Orbit.Type.Encounter)
        {
            return;
        }
        double ejectionOrbitHeight = Math.Min(orbits[0].periapsis * 1.35, orbits[0].apoapsis);

        TransferWindow.UpdateLocalTransferWindowMarker(ref show, ref meshFilterOrbit, ejectionOrbitHeight, orbits[0], transferWindow);
    }
Beispiel #12
0
        public void Setup()
        {
            _accountRepositoryMock = new Mock <IAccountRepository>();
            _fromAccount           = new AccountBuilder().WithId().Build();
            _toAccount             = new AccountBuilder().WithId().Build();
            _allAccountsOfCustomer = new List <Account> {
                _fromAccount, _toAccount
            };

            _window = new TransferWindow(_fromAccount, _allAccountsOfCustomer, _accountRepositoryMock.Object);
            _window.Show();

            _fromAccountTextBlock  = _window.GetPrivateFieldValueByName <TextBlock>("FromAccountTextBlock");
            _toAccountsComboBox    = _window.FindVisualChildren <ComboBox>().First();
            _amountTextBox         = _window.GetPrivateFieldValueByName <TextBox>("AmountTextBox");
            _errorMessageTextBlock = _window.GetPrivateFieldValueByName <TextBlock>("ErrorMessageTextBlock");
            _transferButton        = _window.GetPrivateFieldValueByName <Button>("TransferButton");
        }
        private void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            if (!GlobalVariables.UserOnline)
            {
                var signinWindow = new LoginWindow();
                if (signinWindow.ShowDialog(StaticMainWindow.Window) == false)
                {
                    return;
                }
            }
            StaticMainWindow.Window.UpdateLoginSuccessfully();
            var request        = new DownloadMotionStoreRequest(MotionID);
            var transferWindow = new TransferWindow(request, Info.title);

            if (transferWindow.ShowDialog(StaticMainWindow.Window) == true)
            {
                ViewModel.DownloadButtonContent = "Installed";
                GlobalFunction.SaveIconImage(ViewModel.CoverImage, MotionID);
            }
        }
Beispiel #14
0
    public static void SetParents(TransferWindow.Data transferWindowData, Transform markerPlanet, Transform markerOrbit, Material meshPlanetMaterial)
    {
        if (transferWindowData.transferType == TransferWindow.TransferType.None)
        {
            return;
        }
        markerOrbit.parent        = Ref.map.mapRefs[transferWindowData.departure].holder;
        markerOrbit.localPosition = Vector3.zero;
        if (transferWindowData.transferType != TransferWindow.TransferType.ToNeighbour)
        {
            return;
        }
        bool  flag = transferWindowData.firstNeighbour.orbitData.orbitHeightM > transferWindowData.secondNeighbour.orbitData.orbitHeightM;
        float num  = (float)(transferWindowData.firstNeighbour.orbitData.orbitHeightM / 10000.0);

        markerPlanet.localScale    = new Vector3(num, (!flag) ? (-num) : num, 1f);
        markerPlanet.parent        = Ref.map.mapRefs[transferWindowData.firstNeighbour.parentBody].holder;
        markerPlanet.localPosition = Vector3.zero;
        TransferWindow.UpdateTransferWindowAlpha(meshPlanetMaterial, transferWindowData);
    }
Beispiel #15
0
    private static void UpdateLocalTransferWindowMarker(ref bool show, ref MeshFilter meshFilterOrbit, double ejectionOrbitHeight, Orbit orbit, TransferWindow.Data transferWindow)
    {
        if (transferWindow.departure.type == CelestialBodyData.Type.Star || (transferWindow.transferType == TransferWindow.TransferType.ToNeighbour && transferWindow.departure != transferWindow.firstNeighbour))
        {
            return;
        }
        if (transferWindow.transferType == TransferWindow.TransferType.ToNeighbour || transferWindow.transferType == TransferWindow.TransferType.ToParent)
        {
            CelestialBodyData celestialBodyData = (transferWindow.transferType != TransferWindow.TransferType.ToNeighbour) ? transferWindow.departure : transferWindow.firstNeighbour;
            double            orbitHeightM      = celestialBodyData.orbitData.orbitHeightM;
            double            num        = (transferWindow.transferType != TransferWindow.TransferType.ToNeighbour) ? (transferWindow.target.radius + transferWindow.target.atmosphereData.atmosphereHeightM) : transferWindow.secondNeighbour.orbitData.orbitHeightM;
            double            num2       = Math.Min(num, orbitHeightM);
            double            num3       = (orbitHeightM + num) * 0.5;
            double            e          = 1.0 - num2 / num3;
            double            mass       = celestialBodyData.parentBody.mass;
            double            meanMotion = Kepler.GetMeanMotion(Kepler.GetPeriod(e, num3, mass), e, mass, num3);
            bool   flag           = num > orbitHeightM;
            double magnitude2d    = Kepler.GetVelocity(num3, orbitHeightM, meanMotion, (!flag) ? 3.1415926535897931 : 0.0, (!flag) ? 3.1415926535897931 : 0.0, e, 0.0).magnitude2d;
            double escapeVelocity = magnitude2d - -celestialBodyData.orbitData.orbitalVelocity;
            float  num4           = (float)(Kepler.GetEjectionAngle(escapeVelocity, ejectionOrbitHeight, celestialBodyData.mass, celestialBodyData.orbitData.SOI) * (double)Math.Sign(-orbit.meanMotion) + ((!flag) ? 3.1415926535897931 : 0.0));
            float  ejectionAngle  = num4 + (float)(Ref.controller.globalTime * celestialBodyData.orbitData._meanMotion) - 1.57079637f;
            TransferWindow.GenerateMeshOrbitTW(ref meshFilterOrbit, ref show, ejectionAngle, orbit);
            return;
        }
        if (transferWindow.transferType != TransferWindow.TransferType.ToSatellite)
        {
            return;
        }
        if (ejectionOrbitHeight > transferWindow.target.orbitData.orbitHeightM * 0.75)
        {
            return;
        }
        float num5           = (float)Kepler.GetPhaseAngle(ejectionOrbitHeight, transferWindow.target.orbitData.orbitHeightM);
        float ejectionAngle2 = num5 + (float)(Ref.controller.globalTime * transferWindow.target.orbitData._meanMotion);

        TransferWindow.GenerateMeshOrbitTW(ref meshFilterOrbit, ref show, ejectionAngle2, orbit);
    }
 public static void OpenTransferWindow(ViewModel.MainViewModel main)
 {
     OpenWindow(ref winTransfer, () => new TransferWindow(main), () => winTransfer = null);
 }
Beispiel #17
0
 private void CreateNewTransferWindow()
 {
     this.transferWindowData = TransferWindow.Data.GetTransferType((!(Ref.selectedVessel != null)) ? Ref.mainVessel : Ref.selectedVessel, this.targetPlanet);
     TransferWindow.SetParents(this.transferWindowData, this.transferWindowPlanet.transform, this.transferWindowOrbit.transform, this.transferWindowPlanet.GetComponent <MeshRenderer>().sharedMaterial);
 }
    public bool?ShowTransferDialog(Account fromAccount, IEnumerable <Account> allAccountsOfCustomer)
    {
        var transferWindow = new TransferWindow(fromAccount, allAccountsOfCustomer, _accountRepository);

        return(transferWindow.ShowDialog());
    }
Beispiel #19
0
 private void Transfer_Click(object sender, RoutedEventArgs e)
 {
     TransferWindow transfer = new TransferWindow(ref account); transfer.Show();
 }