Example #1
0
        private bool ApplyReshapePath(
            [NotNull] IGeometry geometryToReshape,
            [NotNull] AdjustedCutSubcurve adjustCurve,
            NotificationCollection notifications,
            IDictionary <IGeometry, NotificationCollection> reshapedGeometries)
        {
            // if the connect line crosses the geometry's boundary only reshape to the first intersection
            // and subsequently try the remaining bits. Otherwise this could result in a flipped geometry (reshape to the wrong side)

            IPath remainderAtFrom, remainderAtTo;

            IPath cutConnectLineAtFrom = SplitConnectline(adjustCurve, geometryToReshape, true,
                                                          out remainderAtFrom);
            IPath cutConnectLineAtTo = SplitConnectline(adjustCurve, geometryToReshape, false,
                                                        out remainderAtTo);

            var mainSubcurve = new AdjustedCutSubcurve(
                adjustCurve.PathOnTarget, cutConnectLineAtFrom,
                cutConnectLineAtTo);

            IPath reshapePath = mainSubcurve.Path;

            bool reshaped = Reshape(geometryToReshape, reshapePath);

            reshaped |= remainderAtFrom != null &&
                        Reshape(geometryToReshape, remainderAtFrom);

            reshaped |= remainderAtTo != null &&
                        Reshape(geometryToReshape, remainderAtTo);

            if (reshaped)
            {
                // to avoid incorrect relational operator results in for the next path on target
                ((ISegmentCollection)geometryToReshape).SegmentsChanged();
            }

            NotificationCollection reshapeNotifications = null;

            // TODO: get from out ReshapeInfo;

            // move adding notfications to caller?
            if (reshaped && !reshapedGeometries.ContainsKey(geometryToReshape))
            {
                reshapedGeometries.Add(geometryToReshape, reshapeNotifications);
            }
            else
            {
                if (reshapeNotifications != null)
                {
                    NotificationUtils.Add(notifications, reshapeNotifications.Concatenate(" "));
                }
            }

            return(reshaped);
        }
Example #2
0
        private static bool ValidateFlowDirection(
            [NotNull] IFeature feature,
            [NotNull] ILinearNetworkFeatureFinder featureFinder,
            [NotNull] NotificationCollection notifications)
        {
            if (((IFeatureClass)feature.Class).ShapeType != esriGeometryType.esriGeometryPolyline)
            {
                return(true);
            }

            IGeometry newGeometry = feature.Shape;

            IPolyline polyline = (IPolyline)newGeometry;

            bool hasCorrectOrientation = false;
            bool hasWrongOrientation   = false;
            int  fromEdgeCount         = ValidateConnections(feature, LineEnd.From, featureFinder,
                                                             ref hasCorrectOrientation,
                                                             ref hasWrongOrientation);

            int toEdgeCount = ValidateConnections(feature, LineEnd.To, featureFinder,
                                                  ref hasCorrectOrientation,
                                                  ref hasWrongOrientation);

            if (!hasWrongOrientation)
            {
                return(true);
            }

            if (!hasCorrectOrientation)
            {
                // all other connections are different -> flip
                polyline.ReverseOrientation();
                feature.Shape = polyline;
                feature.Store();

                _msg.InfoFormat("Feature {0} was flipped to enforce flow direction",
                                GdbObjectUtils.ToString(feature));
                return(true);
            }

            // Mixed situation:
            if (fromEdgeCount <= 1 && toEdgeCount <= 1)
            {
                // No bifurcation or confluence but still incorrect at one end -> error?
                NotificationUtils.Add(notifications,
                                      "Feature {0} does not have a consistent flow direction with respect to its connected edges",
                                      GdbObjectUtils.ToString(feature));
                return(false);
            }

            // Confluence or bifurcation -> probably ok
            return(true);
        }
Example #3
0
        internal static void PromoteToCorporation(GameEntity company, GameContext gameContext)
        {
            if (!IsPromotableToCorporation(company))
            {
                return;
            }

            company.ReplaceCompany(company.company.Id, company.company.Name, CompanyType.Corporation);

            NotificationUtils.NotifyAboutCorporationSpawn(gameContext, company.company.Id);
        }
Example #4
0
    public override void Execute()
    {
        var companyId = Popup.companyId;
        var humanId   = Popup.humanId;

        NotificationUtils.ClosePopup(Q);

        var company = Companies.Get(Q, companyId);

        Teams.FireManager(company, Q, humanId);
    }
    void CloseBankruptCompanies(GameEntity company)
    {
        Debug.Log("Bankrupt: " + company.company.Name);

        if (Companies.IsPlayerCompany(gameContext, company))
        {
            NotificationUtils.AddPopup(gameContext, new PopupMessageGameOver(company.company.Id));
        }

        Companies.CloseCompany(gameContext, company);
    }
Example #6
0
    public override bool HideIf()
    {
        var hasPopups = NotificationUtils.IsHasActivePopups(Q);

        if (hasPopups)
        {
            ScheduleUtils.PauseGame(Q);
        }

        return(!hasPopups);
    }
Example #7
0
    public override void Execute()
    {
        MyCompany.isAutomaticInvestments = true;

        //while (Economy.IsWillBecomeBankruptOnNextPeriod(Q, MyCompany) && !Economy.IsHasCashOverflow(Q, MyCompany))
        //{
        //    SoundManager.PlayFastCashSound();
        //}

        NotificationUtils.ClosePopup(Q);
    }
Example #8
0
        public VlcIptvHost(string elementName) :
            base(elementName)
        {
            NotificationUtils.Initialize();
            InitializeComponent();

            vlcIptvControl.ChannelChanged += (o, e) =>
            {
                TvChannels?.RaiseValueChanged(e.Value?.Title ?? TvOffCommandTitle);
            };
        }
Example #9
0
    public override void Execute()
    {
        var companyId = Popup.companyId;

        var offer = Companies.GetAcquisitionOffer(Q, Companies.Get(Q, companyId), MyCompany);

        // FLIP TURN
        offer.acquisitionOffer.Turn = AcquisitionTurn.Buyer;

        Navigate(ScreenMode.AcquisitionScreen, C.MENU_SELECTED_COMPANY, companyId);
        NotificationUtils.ClosePopup(Q);
    }
        public static IList <IFeature> StoreResult(
            [NotNull] IFeature originalFeature,
            [NotNull] IGeometry remainingGeometry,
            [NotNull] ICollection <IGeometry> newGeometries,
            [CanBeNull] NotificationCollection warnings)
        {
            // Only store the result if all components can be stored:
            var notifications = new NotificationCollection();

            foreach (IGeometry newGeometry in newGeometries)
            {
                if (!MakeGeometryStorable(newGeometry, notifications))
                {
                    NotificationUtils.Add(warnings,
                                          "Unable to store new result geometry for feature <oid> {0}: {1}",
                                          originalFeature.OID,
                                          notifications.Concatenate(", "));

                    return(null);
                }
            }

            if (!MakeGeometryStorable(remainingGeometry, notifications))
            {
                NotificationUtils.Add(warnings,
                                      "Unable to store largest result geometry for feature <oid> {0}: {1}",
                                      originalFeature.OID,
                                      notifications.Concatenate(", "));

                return(null);
            }

            // Presumably everything can be stored:
            var newFeatures = new List <IFeature>();

            foreach (IGeometry newGeometry in newGeometries)
            {
                IFeature newFeature =
                    GdbObjectUtils.DuplicateFeature(originalFeature, true);

                GdbObjectUtils.SetFeatureShape(newFeature, newGeometry);

                newFeature.Store();

                newFeatures.Add(newFeature);
            }

            GdbObjectUtils.SetFeatureShape(originalFeature, remainingGeometry);

            originalFeature.Store();

            return(newFeatures);
        }
    public override void Execute()
    {
        NotificationUtils.ClosePopup(Q);

        // copied from
        // Exit.cs
        #if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false;
        #else
        Application.Quit();
        #endif
    }
Example #12
0
    public override void Execute()
    {
        //var relay = FindObjectOfType<FlagshipRelayInCompanyView>();

        //var teamId = relay.ChosenTeamId;

        NavigateToMainScreen();
        Teams.RemoveTeam(Flagship, Q, SelectedTeam);

        NotificationUtils.AddSimplePopup(Q, Visuals.Positive("Team was removed"));
        //relay.ChooseMainScreen();
    }
Example #13
0
    public override void Execute()
    {
        var companyId = Popup.companyId;

        var company = Companies.Get(Q, companyId);

        Marketing.ReleaseApp(Q, company);


        NotificationUtils.ClosePopup(Q);

        NotificationUtils.AddPopup(Q, new PopupMessageRelease(companyId));
    }
Example #14
0
    public override void Execute()
    {
        NotificationUtils.ClearNotification(Q, NotificationId);

        if (NotificationUtils.GetNotifications(Q).Count > 0)
        {
            GetComponentInParent <NotificationsListView2>().ViewRender();
        }
        else
        {
            HideNotificationMenu();
        }
    }
Example #15
0
    void AcceptOffer(int targetId, int shareholderId)
    {
        var investor = Investments.GetInvestorById(gameContext, shareholderId);

        if (investor.isControlledByPlayer)
        {
            NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfferResponse(targetId, shareholderId));
        }
        else
        {
            Companies.ConfirmAcquisitionOffer(gameContext, targetId, shareholderId);
        }
    }
    NotificationMessage[] GetMostImportant()
    {
        var notifications = NotificationUtils.GetNotifications(Q);

        if (notifications.Count > 0)
        {
            var notification = notifications[notifications.Count - 1];

            return(new NotificationMessage[] { notification });
        }

        return(new NotificationMessage[0]);
    }
Example #17
0
        /// <summary>
        /// Initializes BackgroundEngine.
        /// </summary>
        public async Task InitializeAsync()
        {
            await SdkEngine.InitializeAsync();

            AppSettings = await ServiceManager.SettingsManager.GetSettings();

            //TODO verfiy
            if (BackgroundTaskManager.CheckIfBackgroundFilterUpdateIsRequired())
            {
                ToastNotification toastNotification = NotificationUtils.CreateToastNotification("New beacon signature available", "Launch the application to update");
                NotificationUtils.ShowToastNotification(toastNotification);
            }
        }
Example #18
0
        public MainWindow()
        {
            InitializeComponent();

            NotificationUtils.Initialize();

            var pl       = PlaylistsHelper.FromPath(@"https://smarttvnews.ru/apps/iptvchannels.m3u", (p) => NotificationUtils.ShowNotification(p, NotificationUtils.InfoType.Loading), CancellationToken.None);
            var channels = (pl as Playlist).Expand();

            vlc.Initialize(channels);
            vlc.Start();
            KeyDown += MainWindow_KeyDown;
        }
Example #19
0
 // Update is called once per frame
 void Update()
 {
     foreach (Star s in allStars)
     {
         s.gObj.transform.RotateAround(Vector3.zero, Vector3.up, Time.deltaTime * (-0.002f) * warp);
     }
     years = years + (Time.deltaTime * warp / 26.0f);
     GameObject.Find("ElapsedTime").GetComponent <TMPro.TextMeshProUGUI>().SetText("T: +" + (years * 10f).ToString("0.00") + " years");
     StUpdate(Time.deltaTime);
     UpdateDisplay();
     if ((years - yearDelta) > 1.0f)
     {
         yearDelta = years;
         LaunchAllSupernovae(allStars.Count);
         LaunchTechnosignatures();
     }
     for (int i = 0; i < flareList.Count; i++)
     {
         if (flareList[i].timeLeft <= -4.5f)
         {
             flareList[i].Kill();
             flareList.RemoveAt(i);
             i = i - 1;
         }
         else if (flareList[i].timeLeft <= 0.0f)
         {
             flareList[i].flash.GetComponent <Light>().intensity = 10f - (-20f * flareList[i].timeLeft);
             flareList[i].timeLeft = flareList[i].timeLeft - Time.deltaTime;
         }
         else
         {
             flareList[i].timeLeft = flareList[i].timeLeft - Time.deltaTime;
         }
     }
     foreach (Faction fac in allFactions)
     {
         for (int i = 0; i < fac.incomingTechSig.Count; i++)
         {
             if (years > fac.incomingTechSig[i].timeToReceive)
             {
                 fac.ReadTechSig(i);
                 fac.RemoveTechSig(i);
                 i--;
             }
         }
     }
     // each frame call the notification control, which manages the display of notable events (e.g. Supernovae) to the user
     NotificationUtils.NotificationControl();
     InputController.CheckInputs();
 }
Example #20
0
        public static IDbCommand CreateSqlTextCommand(
            [NotNull] IDbConnection connection,
            [NotNull] string sqlText, [CanBeNull] NotificationCollection notifications)
        {
            IDbCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = sqlText;

            //_msg.DebugFormat("Created command with following SQL Text: {0}", sqlText);
            NotificationUtils.Add(notifications, "Created command with following SQL Text: {0}",
                                  sqlText);
            return(command);
        }
    void Render()
    {
        var notifications = NotificationUtils.GetNotifications(Q);

        //var list = new List<NotificationMessage>();

        //for (var i = notifications.Count - 1; i >= 0; i--)
        //    list.Add(notifications[i]);

        //SetItems(list.ToArray());
        SetItems(notifications.ToArray());

        Scroll();
    }
Example #22
0
        public static void BuyCompany(GameContext gameContext, GameEntity company, GameEntity buyer, long offer) //  int buyerInvestorId
        {
            // can afford acquisition
            if (!IsEnoughResources(buyer, offer))
            {
                return;
            }

            var shareholders = GetShareholders(company);

            foreach (var sellerInvestorId in GetShareholdersCopy(company))
            {
                BuyShares(gameContext, company, buyer, GetInvestorById(gameContext, sellerInvestorId), shareholders[sellerInvestorId].amount, offer, true);
            }


            RemoveAllPartnerships(company, gameContext);

            RemoveAcquisitionOffer(gameContext, company, buyer);

            SetIndependence(company, false);

            if (company.hasProduct)
            {
                NotifyAboutAcquisition(gameContext, buyer, company, offer);
            }

            ScheduleUtils.TweakCampaignStats(gameContext, CampaignStat.Acquisitions);

            if (IsGroup(company))
            {
                //var daughters = GetDaughters(gameContext, company);

                //// transfer all products to buyer
                //foreach (var d in daughters)
                //{
                //    AttachToGroup(gameContext, buyer, d);
                //}

                // and close group
                NotificationUtils.AddSimplePopup(gameContext, Visuals.Positive("You've bought GROUP company " + company.company.Name), "We will INDIRECTLY control all their products");

                //CloseCompany(gameContext, company);
            }

            if (Companies.IsPlayerCompany(buyer))
            {
                AttachToPlayer(company);
            }
        }
Example #23
0
    public override void Execute()
    {
        // render cash overflow popup
        if (Economy.IsHasCashOverflow(Q, MyCompany))
        {
            NotificationUtils.AddPopup(Q, new PopupMessageInfo("You have too much cash!", "Spend it first"));
            return;
        }

        SoundManager.Play(Sound.MoneyIncome);
        //Economy.RaiseFastCash(Q, MyCompany);

        ShareholdersOnMainScreenListView.RenderShareholderData();
    }
Example #24
0
    public override void Execute()
    {
        try
        {
            // LOGS AND PICK
            Debug.Log("TRY AcquireCompany");

            var companyId = Popup.companyId;
            var buyerId   = Popup.buyerInvestorId;

            Debug.Log("CompanyId=" + companyId + " BuyerId=" + buyerId);

            var company  = Companies.Get(Q, companyId);
            var investor = Companies.GetInvestorById(Q, buyerId);

            Debug.Log("AcquireCompanyPopupButton : will buy " + company.company.Name + " as " + Companies.GetInvestorName(investor));

            var offer = Companies.GetAcquisitionOffer(Q, company, investor);

            var bid     = offer.acquisitionOffer.BuyerOffer.Price;
            var balance = Economy.BalanceOf(MyCompany);

            if (Companies.IsEnoughResources(MyCompany, bid))
            {
                // CONFIRM ACQUISITION
                Companies.ConfirmAcquisitionOffer(Q, company, investor);

                // SOUND
                PlaySound(Assets.Sound.MoneySpent);
            }
            else
            {
                PlaySound(Assets.Sound.Notification);

                NotificationUtils.AddSimplePopup(Q, Visuals.Negative("Not enough cash :("), $"You need {Format.Money(bid)}, but only have {Format.Money(balance)}");
            }


            // NAVIGATE
            NavigateToProjectScreen(companyId);

            // CLOSE POPUP
            NotificationUtils.ClosePopup(Q);
        }
        catch (Exception ex)
        {
            Debug.LogError("Acquire Popup button fail");
            Debug.LogError(ex);
        }
    }
Example #25
0
        protected static bool HasLocalOverride <T>(
            [NotNull] CentralizableSetting <T> centralizableSetting,
            [NotNull] string settingDescription,
            [CanBeNull] NotificationCollection notifications) where T : struct
        {
            if (centralizableSetting.IsLocalOverrideDifferentFromCentralValue())
            {
                NotificationUtils.Add(notifications, "{0} ({1})", settingDescription,
                                      centralizableSetting.CurrentValue);
                return(true);
            }

            return(false);
        }
Example #26
0
        public bool IsResultAllowed(ReshapeInfo reshapeInfo,
                                    NotificationCollection notifications)
        {
            if (_allowedExtents != null &&
                !ChangesVisibleInAnyExtent(
                    _allowedExtents, GetChangedSegments(
                        reshapeInfo, reshapeInfo.RingReshapeSide)))
            {
                NotificationUtils.Add(notifications,
                                      "Some of the updated segments are outside the visible extent. The reshape is not allowed due to the option 'Exclude reshapes that are not completely within main map extent'");
                return(false);
            }

            return(true);
        }
Example #27
0
    void AcceptOffer(GameEntity target, int shareholderId)
    {
        var buyer = Investments.GetInvestor(gameContext, shareholderId);

        Companies.LogSuccess(target, "WILL ACCEPT OFFER FROM " + Companies.GetInvestorName(buyer));

        if (buyer.isControlledByPlayer)
        {
            NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfferResponse(target.company.Id, shareholderId));
        }
        else
        {
            Companies.ConfirmAcquisitionOffer(gameContext, target, buyer);
        }
    }
Example #28
0
        private bool CanSelectFromLayer([CanBeNull] Layer layer,
                                        NotificationCollection notifications = null)
        {
            var featureLayer = layer as FeatureLayer;

            if (featureLayer == null)
            {
                NotificationUtils.Add(notifications, "No feature layer");
                return(false);
            }

            string layerName = layer.Name;

            if (!featureLayer.IsVisible)
            {
                NotificationUtils.Add(notifications, $"Layer {layerName} not visible");
                return(false);
            }

            if (!featureLayer.IsSelectable)
            {
                NotificationUtils.Add(notifications, $"Layer {layerName} not selectable");
                return(false);
            }

            if (SelectOnlyEditFeatures &&
                !featureLayer.IsEditable)
            {
                NotificationUtils.Add(notifications, $"Layer {layerName} not editable");
                return(false);
            }

            if (!CanSelectGeometryType(
                    GeometryUtils.TranslateEsriGeometryType(featureLayer.ShapeType)))
            {
                NotificationUtils.Add(notifications,
                                      $"Layer {layerName}: Cannot use geometry type {featureLayer.ShapeType}");
                return(false);
            }

            if (featureLayer.GetFeatureClass() == null)
            {
                NotificationUtils.Add(notifications, $"Layer {layerName} is invalid");
                return(false);
            }

            return(CanSelectFromLayerCore(featureLayer));
        }
Example #29
0
        public override async Task <WindowHandle> OpenChannelWindowAsync(DiscordChannel channel, WindowHandle currentWindow = null)
        {
            if (!Supported)
            {
                return(null);
            }

            if (await ActivateOtherWindowAsync(channel, currentWindow))
            {
                return(null);
            }

            Analytics.TrackEvent("AppWindowWindowingService_OpenChannelWindowAsync");

            var window = await AppWindow.TryCreateAsync();

            window.RequestMoveRelativeToCurrentViewContent(new Point(276, 0));
            window.RequestSize(new Size(Window.Current.Bounds.Width - 276, Window.Current.Bounds.Height));
            window.Title = NotificationUtils.GetChannelHeaderName(channel);

            var frame = new Frame();

            frame.Navigate(typeof(MainPage), new MainPageArgs()
            {
                ChannelId = channel.Id, FullFrame = true
            });

            ElementCompositionPreview.SetAppWindowContent(window, frame);
            var frame2 = ElementCompositionPreview.GetAppWindowContent(window);

            await window.TryShowAsync();

            var handle = (AppWindowHandle)CreateOrUpdateHandle(frame, window);

            window.Closed += (o, e) =>
            {
                _uiContextDictionary.TryRemove(handle.Context, out _);
                _windowChannelDictionary.TryRemove(handle, out _);

                handle        = null;
                frame.Content = null;
                window        = null;
            };

            HandleTitleBarForWindow(null, frame);

            return(handle);
        }
Example #30
0
    public override void Execute()
    {
        var cost = Economy.CostOf(MyCompany, Q);
        var goal = C.CORPORATION_REQUIREMENTS_COMPANY_COST;

        if (cost < goal)
        {
            NotificationUtils.AddPopup(Q, new PopupMessageCorporationRequirements(MyCompany.company.Id));
        }
        else
        {
            Companies.PromoteToCorporation(MyCompany, Q);

            Navigate(ScreenMode.CorporationScreen);
        }
    }