コード例 #1
0
 public void Launch(TreeSearchResult Search, PointOfInterest point)
 {
     _search = Search;
     _point = point;
     BuildList();
     Show();
 }
コード例 #2
0
 private void HandleClick(object o, PointerUpEventArgs e)
 {
     // drag generates clicks too, and we dont want those:
     if(!actualclick){
         actualclick = true;
         return;
     }
     // SEARCH FOR POI
     if(travelling) return;
     Ray panpoint = camera.ScreenPointToRay( new Vector3(e.Position.x , e.Position.y));
     RaycastHit hitinfo;
     if(Physics.Raycast(panpoint, out hitinfo, 30, poiMask)){
         if(hitinfo.transform.GetComponent<PointOfInterest>() != null){
             notInOriginalPosition = true;
             poi = hitinfo.transform.GetComponent<PointOfInterest>();
             start = transform.position;
             target = poi.cameraoffset.position;
             travelling = true;
             gameObject.GetComponent<SmoothLookAt>().target = hitinfo.transform;
             timetravelled = 0;
         }
         else if(hitinfo.transform.GetComponent<Interactable>() != null){
             hitinfo.transform.GetComponent<Interactable>().GetClicked();
         }
     }
     actualclick = true;
 }
コード例 #3
0
 void Start()
 {
     player = GameObject.Find("Player");
     poi = transform.GetComponent<PointOfInterest>();
     poigui = Camera.mainCamera.GetComponent<POIGUI>();
     InvokeRepeating("calculateClosestPOI", 0.0f, 1.0f);
 }
コード例 #4
0
ファイル: HouseManager.cs プロジェクト: JadeLens/TrashPanda
 public static void Register(PointOfInterest poi)
 {
     if (!list.Contains(poi))
     {
         list.Add(poi);
     }
 }
コード例 #5
0
ファイル: HouseManager.cs プロジェクト: JadeLens/TrashPanda
 public static void Unregister(PointOfInterest poi)
 {
     if (list.Contains(poi))
     {
         list.Remove(poi);
     }
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: MikhailoMMX/AspectMarkup
 int PointsCount(PointOfInterest pt)
 {
     if (pt == null)
         return 0;
     int result = 1;
     foreach (PointOfInterest p in pt.Items)
         result += PointsCount(p);
     return result;
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: MikhailoMMX/AspectMarkup
 private void SetNotes(PointOfInterest point)
 {
     if (point == null)
         return;
     if (point.Context != null && point.Context.Count != 0)
         point.Note = point.Context[0].Type;
     foreach (PointOfInterest p in point.Items)
         SetNotes(p);
 }
コード例 #8
0
 private void Start()
 {
     interestPoint = gameObject.GetComponent<PointOfInterest>();
     if (interestPoint == null)
     {
         Debug.LogError("TargetSizer: There is no point of interest for the TargetSizer on '" + gameObject.name + "'");
         Destroy(gameObject);
         return;
     }
 }
コード例 #9
0
 partial void Merge(PointOfInterest entity, PointOfInterestDTO dto, object state)
 {
     entity.PointOfInterestId = dto.PointOfInterestId;
     entity.Name = dto.Name;
     entity.Floor = dto.Floor;
     var coordinates = dto.Coordinates;
     if (coordinates != null && coordinates.Length == 2)
     {
         entity.Coordinates = this.vector2DConverter.Convert(coordinates, dto);
     }
 }
コード例 #10
0
ファイル: UnitOrders.cs プロジェクト: JadeLens/TrashPanda
 public static aiBehaviorNode CapturePoint(baseRtsAI rabbit,PointOfInterest poi)
 {
     aiBehaviorNode commande = new Node_Sequence
         (
             new  aiBehaviorNode[]
             {
                 moveComand(rabbit,poi.gameObject.transform.position),
                 new Node_Call_Delegate(poi.CapturePT,rabbit)
             }
         );
     return commande;
 }
コード例 #11
0
 private void UpdateNodeImage(TreeNode Node, PointOfInterest pt)
 {
     //0 - Empty, 1 - Aspect, 2 - Folder, 3 - Note
     int imageindex = 0;
     if (pt.Context != null && pt.Context.Count > 0)
         imageindex = 1;
     else if (pt.Items != null && pt.Items.Count > 0)
         imageindex = 2;
     else if (!string.IsNullOrWhiteSpace(pt.Note))
         imageindex = 3;
     Node.ImageIndex = imageindex;
     Node.SelectedImageIndex = imageindex;
 }
コード例 #12
0
        public static void UpdateSubAspectProperties(PointOfInterest point, TreeNode node, ITrackSelection trackSel)
        {
            VSSubAspectProperties prop = new VSSubAspectProperties(point, node);

            ArrayList listObjects = new ArrayList();
            listObjects.Add(prop);

            selContainer = new SelectionContainer(true, false);
            selContainer.SelectableObjects = listObjects;
            selContainer.SelectedObjects = listObjects;

            trackSel.OnSelectChange((ISelectionContainer)selContainer);
        }
コード例 #13
0
        /// <summary>
        /// Создавет экземпляр UndoAction по нынешнему состоянию точки
        /// При kind == move, параметр newParent обязателен
        /// </summary>
        /// <param name="point">Исходная точка</param>
        /// <param name="parent">Исходный родитель точки</param>
        /// <param name="kind">Тип действия</param>
        private UndoUnit CreateUndoUnit(PointOfInterest point, PointOfInterest parent, ActionKind kind, PointOfInterest newParent = null)
        {
            if (kind == ActionKind.Move && newParent == null)
                throw new ArgumentException();
            UndoUnit undo = new UndoUnit();
            undo.Kind = kind;
            undo.OriginalParent = parent;
            undo.OriginalPosition = parent == null ? 0 : parent.Items.IndexOf(point);
            undo.OriginalPointRef = point;
            if (kind == ActionKind.Edit)
                undo.OriginalPointContent = point.ClonePointAssignItems();
            if (kind == ActionKind.Move)
                undo.OriginalPointContent = newParent;

            return undo;
        }
コード例 #14
0
 public static TreeSearchResult FindPointInTree2(PointOfInterest TreeRoot, PointOfInterest Point, string SourceText)
 {
     TreeSearchResult result = InitializeResultFromTree(TreeRoot, Point.Context[0].Type);
     if (result._result.Count == 0)
         return result;
     ProcessIDs(result, Point, true);
     ProcessHeaders(result, Point, true);
     ProcessOuterContext(result, Point, true);
     ProcessInnerContext(result, Point, true);
     ProcessText(result, Point, SourceText, true);
     result.Sort();
     if (result.GetTotalMatch(0) == TreeSearchOptions.Equility &&
         (result._result.Count == 1 || result._result.Count >= 2 && result.GetTotalMatch(1) != TreeSearchOptions.Equility))
     {
         //result._result.RemoveRange(1, result._result.Count - 1);
         result.Singular = true;
     }
     return result;
 }
コード例 #15
0
        /// <summary>
        /// Поиск точки в дереве разбора и выдача результата в виде класса TreeSearchResult.
        /// Это либо единственный узел (Если поле Singular == true), либо отсортированный по степени похожести список узлов
        /// </summary>
        /// <param name="TreeRoot"></param>
        /// <param name="Point"></param>
        /// <param name="SourceText"></param>
        /// <returns></returns>
        public static TreeSearchResult FindPointInTree(PointOfInterest TreeRoot, PointOfInterest Point, string SourceText)
        {
            TreeSearchResult result = InitializeResultFromTree(TreeRoot, Point.Context[0].Type);
            ProcessIDs(result, Point);
            if (result.Singular)
            {
                FillLocationForSingularResult(result, SourceText, Point.Text);
                return result;
            }
            ProcessHeaders(result, Point);
            if (result.Singular)
            {
                FillLocationForSingularResult(result, SourceText, Point.Text);
                return result;
            }

            ProcessOuterContext(result, Point);
            if (result.Singular)
            {
                FillLocationForSingularResult(result, SourceText, Point.Text);
                return result;
            }

            ProcessInnerContext(result, Point);
            if (result.Singular)
            {
                FillLocationForSingularResult(result, SourceText, Point.Text);
                return result;
            }

            ProcessText(result, Point, SourceText);
            if (result.Singular)
            {
                FillLocationForSingularResult(result, SourceText, Point.Text);
                return result;
            }

            result.Sort();
            return result;
        }
コード例 #16
0
        public void SerializeAspect(PointOfInterest subAspect, string FileName, bool Force = false)
        {
            if (subAspect.Items.Count == 0 && !File.Exists(FileName) && !Force)
                return;

            string tempFileName = FileName + "~";
            if (File.Exists(tempFileName))
                File.Delete(tempFileName);

            if (File.Exists(FileName))
                File.Move(FileName, tempFileName);

            XmlDocument Doc = new XmlDocument();
            XmlElement Root = AspectFileBuilder.BuildXMLTree(subAspect, Doc);
            Doc.AppendChild(Root);

            var stringWriter = new StringWriter(new StringBuilder());
            var xmlTextWriter = new XmlTextWriter(stringWriter) { Formatting = Formatting.Indented };
            Doc.Save(xmlTextWriter);
            string XMLFile = stringWriter.ToString();
            File.WriteAllText(FileName, XMLFile);
        }
コード例 #17
0
ファイル: TerrainChunk.cs プロジェクト: tedmunds/HunterGame
    // Spawn a given type of poi in this chunk: suppliued by the world manager since poi are more relevant to it
    public void AddPointOfInterest(PointOfInterest poiType)
    {
        float spawnRange = 0.5f;
        float posWidthRatio = Random.Range(-spawnRange, spawnRange);
        float xPos = WorldGenerator.CHUNK_HALF_WIDTH * posWidthRatio + centroid.x;

        Vector3 spawnLoc = new Vector3(xPos, centroid.y + WorldGenerator.CHUNK_HALF_HEIGHT, 0.0f);
        myPoi = (PointOfInterest)Instantiate(poiType, spawnLoc, Quaternion.identity);

        // remove any trees that are too near th poi and may block it visually
        if(treesList.Count > 0) {
            float minObscureDistance = 1.5f;

            for(int i = treesList.Count - 1; i >= 0; i--) {
                if((treesList[i].transform.position - myPoi.transform.position).magnitude < minObscureDistance) {
                    GameObject tempObj = treesList[i];
                    treesList.RemoveAt(i);

                    Destroy(tempObj);
                }
            }

        }
    }
コード例 #18
0
 public void DeletePointOfInterest(PointOfInterest pointOfInterest)
 {
     _ctx.PointOfInterests.Remove(pointOfInterest);
 }
コード例 #19
0
 // In our case, we are using EntityFramework for persistance which tracks the updated entities
 // Some framework may not track it, so a general repository should have Update method
 public void Update(int cityId, PointOfInterest pointOfInterest)
 {
 }
コード例 #20
0
 public void DeletePointOfInterest(PointOfInterest pointOfInterest)
 {
     _context.PointsOfInterest.Remove(pointOfInterest);
 }
コード例 #21
0
ファイル: VSInterop.cs プロジェクト: MikhailoMMX/AspectMarkup
 public override void UpdateSubAspectProperties(PointOfInterest point, System.Windows.Forms.TreeNode node)
 {
     Helpers.AspectPropertiesHelper.UpdateSubAspectProperties(point, node, aw.GetITrackSelectionService());
 }
コード例 #22
0
 protected override void ShowPointOfInterestModal(PointOfInterest poi)
 {
     ShowPoiCalled = true;
 }
コード例 #23
0
 void Update()
 {
     if ((Vector3.Distance(player.transform.position, closestPOI.position)) <= interactionDistance && !poigui.mainWindowVisible && !poigui.optionWindowVisible)
     {
         interactPanelVisible = true;
         //poigui.poi = poi;
         poi = closestPOI.GetComponent<PointOfInterest>();
         poigui.updateGUIs(poi);
     }
     else if ((Vector3.Distance(player.transform.position, closestPOI.position)) <= interactionDistance && poigui.mainWindowVisible)
     {
         interactPanelVisible = false;
         poi = closestPOI.GetComponent<PointOfInterest>();
         poigui.updateGUIs(poi);
     }
     else
     {
         interactPanelVisible = false;
         poigui.poi = null;
     }
     if ((Vector3.Distance(player.transform.position, closestPOI.position)) > interactionDistance && poigui.mainWindowVisible)
     {
         poigui.toggleMainWindowVisible();
         poigui.poi = null;
     }
     //Debug.Log ("****"+transform.name+"****");
 }
コード例 #24
0
 public void AddPoiForSingleCity(int cityId, PointOfInterest poi)
 {
     GetSingleCity(cityId, false).PointsOfInterests.Add(poi);
     SaveChanges();
 }
コード例 #25
0
    public static bool IsFacilityUnique(PointOfInterest facility)
    {
        string a;

        return(facility != null && facility.PointOfInterestDefinition.TryGetValue("IsUniqueFacility", out a) && a == "true");
    }
コード例 #26
0
        protected override async Task RouteAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Get the conversation state from the turn context
            var state = await _accessors.PointOfInterestSkillState.GetAsync(dc.Context, () => new PointOfInterestSkillState());

            var dialogState = await _accessors.ConversationDialogState.GetAsync(dc.Context, () => new DialogState());

            PointOfInterest luisResult = null;

            if (_services?.LuisRecognizer != null)
            {
                // When run in normal mode or 2+ turn of a skill we use LUIS ourselves as the parent Dispatcher doesn't do this
                luisResult = await _services.LuisRecognizer.RecognizeAsync <PointOfInterest>(dc.Context, cancellationToken);
            }
            else if (_skillMode && state.LuisResultPassedFromSkill != null)
            {
                // If invoked by a Skill we get the Luis IRecognizerConvert passed to us on first turn so we don't have to do that locally
                luisResult = (PointOfInterest)state.LuisResultPassedFromSkill;
            }
            else
            {
                throw new Exception("PointOfInterestSkill: Could not get Luis Recognizer result.");
            }

            await DigestPointOfInterestLuisResult(dc, luisResult);

            var intent = luisResult?.TopIntent().intent;

            var skillOptions = new PointOfInterestSkillDialogOptions
            {
                SkillMode = _skillMode,
            };

            var result = EndOfTurn;

            switch (intent)
            {
            case PointOfInterest.Intent.NAVIGATION_ROUTE_FROM_X_TO_Y:
            {
                result = await dc.BeginDialogAsync(nameof(RouteDialog), skillOptions);

                break;
            }

            case PointOfInterest.Intent.NAVIGATION_CANCEL_ROUTE:
            {
                result = await dc.BeginDialogAsync(nameof(CancelRouteDialog), skillOptions);

                break;
            }

            case PointOfInterest.Intent.NAVIGATION_FIND_POINTOFINTEREST:
            {
                result = await dc.BeginDialogAsync(nameof(FindPointOfInterestDialog), skillOptions);

                break;
            }

            case PointOfInterest.Intent.None:
            case null:
            default:
            {
                result = new DialogTurnResult(DialogTurnStatus.Complete);
                await _responder.ReplyWith(dc.Context, PointOfInterestSkillResponses.Confused);

                break;
            }
            }

            if (result.Status == DialogTurnStatus.Complete)
            {
                await CompleteAsync(dc);
            }
        }
コード例 #27
0
        private void TryEarnAchievement(PointOfInterest dto)
        {
            string achievementKey = GetAchievementKey(dto.Name);

            achievementsUI.TryEarnAchievement(dto.Name, HasBeenAddedToPlayerPrefs(achievementKey), achievementKey);
        }
    protected override State Execute(AIBehaviorTree aiBehaviorTree, params object[] parameters)
    {
        DepartmentOfScience agency = aiBehaviorTree.AICommander.Empire.GetAgency <DepartmentOfScience>();

        if (agency != null && !agency.CanPillage())
        {
            return(State.Failure);
        }
        if (!this.downloadableContentService.IsShared(DownloadableContent11.ReadOnlyName))
        {
            return(State.Failure);
        }
        Army army;

        if (base.GetArmyUnlessLocked(aiBehaviorTree, "$Army", out army) != AIArmyMission.AIArmyMissionErrorCode.None)
        {
            return(State.Failure);
        }
        if (!aiBehaviorTree.Variables.ContainsKey(this.TargetListVarName))
        {
            return(State.Failure);
        }
        if (!string.IsNullOrEmpty(this.OpportunityMaximumTurnName) && aiBehaviorTree.Variables.ContainsKey(this.OpportunityMaximumTurnName))
        {
            this.OpportunityMaximumTurn = (float)aiBehaviorTree.Variables[this.OpportunityMaximumTurnName];
        }
        List <IWorldPositionable> list = aiBehaviorTree.Variables[this.TargetListVarName] as List <IWorldPositionable>;

        if (list == null)
        {
            aiBehaviorTree.ErrorCode = 10;
            return(State.Failure);
        }
        if (list.Count == 0)
        {
            aiBehaviorTree.ErrorCode = 10;
            return(State.Failure);
        }
        AIEntity_Empire entity          = aiBehaviorTree.AICommander.AIPlayer.GetEntity <AIEntity_Empire>();
        float           num             = 0.1f;
        float           propertyValue   = army.GetPropertyValue(SimulationProperties.MaximumMovement);
        PointOfInterest pointOfInterest = null;

        for (int i = 0; i < list.Count; i++)
        {
            PointOfInterest pointOfInterest2 = list[i] as PointOfInterest;
            if (pointOfInterest2 != null && pointOfInterest2.Region.City != null && pointOfInterest2.PointOfInterestImprovement != null && DepartmentOfDefense.CanStartPillage(army, pointOfInterest2, false))
            {
                float num2 = 0.5f;
                if (entity != null)
                {
                    num2 = this.ComputePillageInterest(pointOfInterest2, entity, army) * 0.5f;
                }
                if (num2 >= 0f)
                {
                    float num3 = (float)this.worldPositionningService.GetDistance(army.WorldPosition, pointOfInterest2.WorldPosition) / propertyValue;
                    if (num3 <= this.MaximumTurnDistance)
                    {
                        float num4 = 0.5f - num3 / this.MaximumTurnDistance;
                        num2 = AILayer.Boost(num2, num4 * 0.5f);
                        float propertyValue2 = pointOfInterest2.GetPropertyValue(SimulationProperties.PillageDefense);
                        float propertyValue3 = pointOfInterest2.GetPropertyValue(SimulationProperties.MaximumPillageDefense);
                        num2 = AILayer.Boost(num2, (1f - propertyValue2 / propertyValue3) * 0.2f);
                        if (num2 > num)
                        {
                            num             = num2;
                            pointOfInterest = pointOfInterest2;
                        }
                    }
                }
            }
        }
        if (pointOfInterest != null)
        {
            if (this.OpportunityMaximumTurn > 0f)
            {
                int num5 = 0;
                int num6 = 0;
                if (aiBehaviorTree.Variables.ContainsKey(this.OpportunityMainTargetPosition))
                {
                    WorldPosition mainTargetPosition = (WorldPosition)aiBehaviorTree.Variables[this.OpportunityMainTargetPosition];
                    if (!AIBehaviorTreeNode_Decorator_EvaluateOpportunity.IsDetourWorthCheckingFast(this.worldPositionningService, army, pointOfInterest.WorldPosition, mainTargetPosition, out num6, out num5))
                    {
                        return(State.Failure);
                    }
                }
                int remainingTurnToPillage        = DepartmentOfDefense.GetRemainingTurnToPillage(army, pointOfInterest);
                IAIDataRepositoryAIHelper service = AIScheduler.Services.GetService <IAIDataRepositoryAIHelper>();
                Diagnostics.Assert(service != null);
                float       num7 = 1f;
                AIData_Army aidata_Army;
                if (service.TryGetAIData <AIData_Army>(army.GUID, out aidata_Army))
                {
                    num7 = aiBehaviorTree.AICommander.GetPillageModifier(aidata_Army.CommanderMission);
                }
                if ((float)(num5 - num6 + remainingTurnToPillage) > this.OpportunityMaximumTurn * num7)
                {
                    return(State.Failure);
                }
            }
            if (aiBehaviorTree.Variables.ContainsKey(this.Output_TargetVarName))
            {
                aiBehaviorTree.Variables[this.Output_TargetVarName] = pointOfInterest;
            }
            else
            {
                aiBehaviorTree.Variables.Add(this.Output_TargetVarName, pointOfInterest);
            }
            return(State.Success);
        }
        return(State.Failure);
    }
コード例 #29
0
            /// <summary>
            /// Compares two POIs according to some pre-defined metrics
            /// </summary>
            private int ComparePointOfInterest(PointOfInterest poiA, PointOfInterest poiB)
            {
                // High alert POIs take priority
                bool highAlertA = IsPoiAtHighAlert(poiA);
                bool highAlertB = IsPoiAtHighAlert(poiB);
                int alertComparison = highAlertA.CompareTo(highAlertB);
                if (alertComparison != 0) return alertComparison;

                // Compare POI types
                if (poiA.POIType >= PointOfInterestType.UnknownEntity && poiB.POIType >= PointOfInterestType.UnknownEntity)
                {
                    int poiTypeComparison = poiA.POIType.CompareTo(poiB.POIType);
                    if (poiTypeComparison != 0)
                        return poiTypeComparison;
                }

                // If we get here, POI Type is equal or POI is considered a mostly irrelevant point

                // If both POIs are grids, return the largest grid size
                if (poiA.IsGrid() && poiB.IsGrid())
                {
                    MyCubeBlock blockA = poiA.Entity as MyCubeBlock;
                    MyCubeBlock blockB = poiB.Entity as MyCubeBlock;

                    if (blockA != null && blockB != null)
                    {
                        int gridSizeComparison = blockA.CubeGrid.BlocksCount.CompareTo(blockB.CubeGrid.BlocksCount);
                        if (gridSizeComparison != 0)
                            return gridSizeComparison;
                    }
                }

                // Closer by is more important than further away
                return poiB.Distance.CompareTo(poiA.Distance);
            }
コード例 #30
0
 public override void UpdateSubAspectProperties(PointOfInterest point, System.Windows.Forms.TreeNode node)
 {  }
コード例 #31
0
            /// <summary>
            /// Checks if some given POI is within a radius matching an angle from the POV of a given location.
            /// </summary>
            /// <param name="poi">POI to check</param>
            /// <param name="cameraPosition">Position from which to check.</param>
            /// <param name="angle">Angle within the POI must fall from the camera position's POV, defaults to ClusterAngle.</param>
            /// <returns>True if it is within the radius, false otherwise.</returns>
            public bool IsPOINearby(PointOfInterest poi, Vector3D cameraPosition, double angle = ClusterAngle)
            {
                // Compute POI distance to camera
                Vector3D deltaPos = (cameraPosition - WorldPosition);
                double distance = deltaPos.Length();

                if (distance < ClusterNearDistance)
                {
                    /*
                     * TODO: Come up with a better way to improve screen space clustering
                     * This algorithm kinda works, but there are annoying edge cases
                     * For example, if you have a base, and at 900m you have a fighter, aligning both will merge them into a POI
                     * 
                     * Using the next bit of code achieves the best results with a ClusterNearDistance of 4000m instead
                     * 
                    // Use screen space clustering for POIs that are close to the camera
                    Vector2 myScreenPosition;
                    bool myIsBehind;
                    Vector2 theirScreenPosition;
                    bool theirIsBehind;

                    if (!TryComputeScreenPoint(WorldPosition, out myScreenPosition, out myIsBehind))
                        return false;
                    if (!TryComputeScreenPoint(poi.WorldPosition, out theirScreenPosition, out theirIsBehind))
                        return false;

                    if (myIsBehind != theirIsBehind) return false;

                    // Check for sufficient screen position overlap
                    Vector2 screenDist = (myScreenPosition - theirScreenPosition);
                    float sqrDist = screenDist.LengthSquared();

                    double acceptedDistance = 0.034;
                    // Enemies cluster a little later because this is more urgent information
                    if (this.Relationship == MyRelationsBetweenPlayerAndBlock.Enemies && poi.Relationship == MyRelationsBetweenPlayerAndBlock.Enemies)
                        acceptedDistance = 0.012;

                    if (sqrDist > acceptedDistance * acceptedDistance)
                        return false;

                    if (!IsRelationHostile(Relationship, poi.Relationship))
                        return true;*/

                    // No clustering possibility
                    return false;
                }

                // Compute max distance to make a ClusterAngle degree difference from the camera's PoV
                // The angle scales a bit based on distance, but will never be larger than twice the specified degrees
                double ratio = (distance - ClusterNearDistance) / ClusterScaleDistance;
                ratio = Math.Min(Math.Max(0, ratio), 1);
                double scaledAngle = angle + angle * ratio;

                double maxDistance = Math.Sin(scaledAngle * (Math.PI / 180f)) * distance;
                double maxDistanceSqr = maxDistance * maxDistance;

                // Compute POI distance to POI distance
                Vector3D deltaPOI = (poi.WorldPosition - WorldPosition);
                double poiDistance = deltaPOI.LengthSquared();

                // If poiDistance is within the max distance for ClusterAngle degree angle, then it can be considered clustered.
                bool isInRange = (poiDistance <= maxDistanceSqr);
                return isInRange;
            }
コード例 #32
0
 public void UpdatePointOfInterestForCity(int cityId, PointOfInterest pointOfInterest)
 {
 }
コード例 #33
0
 public void DeletePointOfInterestForCity(int cityId, PointOfInterest pointOfInterest)
 {
     _context.PointsOfInterest.Remove(pointOfInterest);
 }
コード例 #34
0
        private static XmlNode BuildPoint(PointOfInterest Point, XmlDocument Doc)
        {
            XmlElement Result = Doc.CreateElement("Node");
            if (!string.IsNullOrWhiteSpace(Point.ID))
            {
                XmlAttribute Name = Doc.CreateAttribute("ID");
                Result.Attributes.Append(Name);
                Name.InnerText = Point.ID;
            }
            if (!string.IsNullOrWhiteSpace(Point.Title))
            {
                XmlAttribute Name = Doc.CreateAttribute("Name");
                Result.Attributes.Append(Name);
                Name.InnerText = Point.Title;
            }
            if (!string.IsNullOrWhiteSpace(Point.FileName))
            {
                XmlElement FileName = Doc.CreateElement("FileName");
                FileName.InnerText = Point.FileName;
                Result.AppendChild(FileName);
            }
            if (!string.IsNullOrWhiteSpace(Point.Note))
            {
                XmlElement Note = Doc.CreateElement("Note");
                Note.InnerText = Point.Note;
                Result.AppendChild(Note);
            }
            if (!string.IsNullOrWhiteSpace(Point.Text))
            {
                XmlElement Text = Doc.CreateElement("Text");
                Text.InnerText = Point.Text;
                Result.AppendChild(Text);
            }
            
            if (Point.Context != null && Point.Context.Count != 0)
                Result.AppendChild(BuildOuterContext(Point.Context, Doc));
            if (Point.InnerContext != null && Point.InnerContext.Count != 0)
                Result.AppendChild(BuildInnerContext(Point.InnerContext, Doc));
            if (Point.Items != null && Point.Items.Count != 0)
            {
                XmlElement Items = Doc.CreateElement("Items");
                foreach (PointOfInterest p in Point.Items)
                    Items.AppendChild(BuildPoint(p, Doc));
                Result.AppendChild(Items);
            }

            XmlAttribute NearLAttr = Doc.CreateAttribute("NL");
            XmlAttribute NearGAttr = Doc.CreateAttribute("NG");
            NearLAttr.InnerText = Point.NearL.ToString();
            NearGAttr.InnerText = Point.NearG.ToString();
            Result.Attributes.Append(NearLAttr);
            Result.Attributes.Append(NearGAttr);

            return Result;
        }
コード例 #35
0
 public async Task <bool> DeletePointOfInterestAsync(PointOfInterest pointOfInterest, CancellationToken cancellationToken)
 {
     _context.PointsOfInterest.Remove(pointOfInterest);
     return(await _context.SaveChangesAsync(cancellationToken) >= 0);
 }
コード例 #36
0
        public void AddPointOfInterestForCity(PointOfInterest pointOfInterest, int cityId)
        {
            var city = GetCity(cityId, false);

            city.PointOfInterests.Add(pointOfInterest);
        }
コード例 #37
0
 public void addPoi(PointOfInterest poi)
 {
     db.pointsOfInterests.InsertOnSubmit(poi);
     db.SubmitChanges();
 }
コード例 #38
0
ファイル: POIQuest.cs プロジェクト: SamuelZelenka/Marooned
 private void CompleteQuest(PointOfInterest pointOfInterest) => CompleteQuest();
コード例 #39
0
        public void AddPointOfInterestForCity(int cityId, PointOfInterest pointOfInterest)
        {
            var city = GetCity(cityId, false);

            city.PointsOfInterest.Add(pointOfInterest);
        }
コード例 #40
0
ファイル: POIQuest.cs プロジェクト: SamuelZelenka/Marooned
 public override void Setup(Player player, PointOfInterest poi)
 {
     base.Setup(player, poi);
     poi.OnInteractedWith += CompleteQuest;
 }
コード例 #41
0
        public void AddPointOfInterest(int cityId, PointOfInterest pointOfInterestfinal)
        {
            var city = GetCity(cityId, false);

            city.PointOfInterests.Add(pointOfInterestfinal);
        }
コード例 #42
0
        private void Source_OnClick(PointOfInterest poi)
        {
            var coords = new CLLocationCoordinate2D(poi.Latitude, poi.Longitude);

            MyMap.Region = new MapKit.MKCoordinateRegion(coords, new MapKit.MKCoordinateSpan(0.1, 0.1));
        }
コード例 #43
0
ファイル: Game.cs プロジェクト: JakubVanek/openBVE-1
		// ================================

		internal static void Reset(bool ResetLogs) {
			// track manager
			TrackManager.CurrentTrack = new TrackManager.Track();
			// train manager
			TrainManager.Trains = new TrainManager.Train[] { };
			// game
			Debug.ClearMessages();
			CurrentInterface = InterfaceType.Normal;
			RouteComment = "";
			RouteImage = "";
			RouteAccelerationDueToGravity = 9.80665;
			RouteRailGauge = 1.435;
			RouteInitialAirPressure = 101325.0;
			RouteInitialAirTemperature = 293.15;
			RouteInitialElevation = 0.0;
			RouteSeaLevelAirPressure = 101325.0;
			RouteSeaLevelAirTemperature = 293.15;
			Stations = new Station[] { };
			Sections = new Section[] { };
			BufferTrackPositions = new double[] { };
			Messages = new Message[] { };
			MarkerTextures = new Textures.Texture[] { };
			PointsOfInterest = new PointOfInterest[] { };
			PrecedingTrainTimeDeltas = new double[] { };
			PrecedingTrainSpeedLimit = double.PositiveInfinity;
			BogusPretrainInstructions = new BogusPretrainInstruction[] { };
			TrainName = "";
			TrainStart = TrainStartMode.EmergencyBrakesNoAts;
			NoFogStart = (float)Math.Max(1.33333333333333 * Options.Current.ViewingDistance, 800.0);
			NoFogEnd = (float)Math.Max(2.66666666666667 * Options.Current.ViewingDistance, 1600.0);
			PreviousFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.0);
			CurrentFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.5);
			NextFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 1.0);
			InfoTotalTriangles = 0;
			InfoTotalTriangleStrip = 0;
			InfoTotalQuads = 0;
			InfoTotalQuadStrip = 0;
			InfoTotalPolygon = 0;
			InfoStaticOpaqueFaceCount = 0;
			if (ResetLogs) {
				LogRouteName = "";
				LogTrainName = "";
				LogDateTime = DateTime.Now;
				CurrentScore = new Score();
				ScoreMessages = new ScoreMessage[] { };
				ScoreLogs = new ScoreLog[64];
				ScoreLogCount = 0;
				BlackBoxEntries = new BlackBoxEntry[256];
				BlackBoxEntryCount = 0;
				BlackBoxNextUpdate = 0.0;
			}
			// renderer
			Renderer.Reset();
		}
コード例 #44
0
 public void UpdatePointOfInterestForCity(int cityId, PointOfInterest pointOfInterest)
 {
     // I andre implementatiober af ICityRepository skal der muligvis adderes kode
     // her for at få gemt opdaterede PointOfInterest for City.
 }
コード例 #45
0
 /// <summary>
 /// Сохраняет состояние точки перед действием
 /// Вызывается при любом изменении аспектного дерева
 /// </summary>
 /// <param name="point">Исходная точка</param>
 /// <param name="parent">Исходный родитель точки</param>
 /// <param name="kind">Тип действия</param>
 public void SavePointState(PointOfInterest point, PointOfInterest parent, ActionKind kind, PointOfInterest newParent = null)
 {
     UndoStack.Push(CreateUndoUnit(point, parent, kind, newParent));
     RedoStack.Clear();
 }
コード例 #46
0
 /// <summary>
 /// The add point of interest for city.
 /// </summary>
 /// <param name="cityId">
 /// The city id.
 /// </param>
 /// <param name="pointOfInterest">
 /// The point of interest.
 /// </param>
 public void AddPointOfInterestForCity(int cityId, PointOfInterest pointOfInterest)
 {
     cities.FirstOrDefault(c => c.Id == cityId)?.PointsOfInterest.Add(pointOfInterest);
 }
コード例 #47
0
            /// <summary>
            /// Checks if this POI has any kind of hostile activity nearby, by comparing it against the other elements in the group.
            /// </summary>
            private bool IsPoiAtHighAlert(PointOfInterest poi)
            {
                // Neutral parties are never at high alert
                if (poi.Relationship == MyRelationsBetweenPlayerAndBlock.Neutral) return false;

                foreach (var otherPOI in m_group)
                {
                    if (IsRelationHostile(poi.Relationship, otherPOI.Relationship))
                    {
                        Vector3 deltaPos = otherPOI.WorldPosition - poi.WorldPosition;
                        if (deltaPos.LengthSquared() < 1000000)
                            return true;
                    }
                }

                return false;
            }
コード例 #48
0
    void loadLevel()
    {
        Color currentColor;
        spawnPicked = false;
        tileColors = new Color[levelWidth * levelHeight];
        tileColors = levelTexture.GetPixels();
        bool cameraSet = false;
        int Framecounter = 0;
        int sideCounter = 0;

        for (int y = 0; y < levelHeight; y++)
        {
            for (int x = 0; x < levelWidth; x++)
            {
                currentColor = tileColors[x + y * levelWidth];
                if (currentColor == grassColor)
                {
                    System.Random rng = new System.Random();
                    int i = rng.Next(15);
                    Debug.Log("Grass #: " + i);
                    switch(i)
                    {
                        case 1:
                            Instantiate(grassTile2, new Vector3(x, y), Quaternion.identity);
                            break;
                        case 2:
                            Instantiate(grassTile3, new Vector3(x, y), Quaternion.identity);
                            break;
                        default:
                            Instantiate(grassTile, new Vector3(x, y), Quaternion.identity);
                            break;
                    }
                }

                else if (currentColor == schoolColor)
                    Instantiate(school, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == levelSelectSwitchColor)
                    Instantiate(levelSelectSwitch, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == roadTileColor)
                    Instantiate(roadTile, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == sidewalkTileColor)
                    Instantiate(sidewalkTile, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == lockerColor)
                {
                    if (y == 8 || y == 41)
                        Instantiate(lockerDown, new Vector3(x, y), Quaternion.identity);
                    else
                        Instantiate(lockerup, new Vector3(x, y), Quaternion.identity);
                }

                else if (currentColor == walkwayColor)
                    Instantiate(stonePath, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == areaSwitchColor)
                    Instantiate(areaSwitch, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == stairsColor)
                    Instantiate(stairs, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == stoneColor)
                    Instantiate(school, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == doorColor)
                {
                    Instantiate(door, new Vector3(x, y), Quaternion.identity);
                    Instantiate(schoolFloor, new Vector3(x, y), Quaternion.identity);
                }

                else if (currentColor == keyColor)
                {
                    if (Application.loadedLevel == 1)
                        Instantiate(waterTile, new Vector3(x, y), Quaternion.identity);
                    else if (Application.loadedLevel == 2)
                        Instantiate(soccerLine, new Vector3(x, y), Quaternion.identity);
                    else if (Application.loadedLevel == 5)
                        Instantiate(schoolFloor, new Vector3(x, y), Quaternion.identity);
                    Vector2 pos = new Vector2(x, y);
                    if (!player.hasWaterKey || !player.hasBossKey || !player.hasSchoolKey)
                        keyy.transform.position = pos;
                }

                else if (currentColor == waterColor)
                    Instantiate(waterTile, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == areaSwitchColor)
                    Instantiate(areaSwitch, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == schoolArea)
                {
                    if (sideCounter < 2 || sideCounter > 4)
                    {
                        Instantiate(school, new Vector3(x, y), Quaternion.identity);
                        sideCounter++;
                    }
                    else
                    {
                        Instantiate(schoolSwitch, new Vector3(x, y), Quaternion.identity);
                        sideCounter++;
                    }
                }

                else if (currentColor == schoolDoorColor)
                    Instantiate(schoolDoor, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == fenceColor)
                {
                    if (x <= 10 || x >= 94)
                    {
                        Instantiate(fence, new Vector3(x, y), Quaternion.identity);
                        Instantiate(sidewalkTile, new Vector3(x, y), Quaternion.identity);
                    }
                    else
                    {
                        Instantiate(fence2, new Vector3(x, y), Quaternion.identity);
                        Instantiate(sidewalkTile, new Vector3(x, y), Quaternion.identity);
                    }
                }

                else if (currentColor == soccersGrassColor)
                    Instantiate(soccerGrass, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == grassBlockColor)
                    Instantiate(grassBlock, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == soccerLinesColor)
                    Instantiate(soccerLine, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == bossSwitchColor)
                    Instantiate(bossSwitch, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == windowColor)
                    Instantiate(Window, new Vector3(x, y), Quaternion.identity);

                else if (currentColor == doorFrameSideColor)
                {
                    if (Framecounter == 0)
                    {
                        Framecounter++;
                        Instantiate(doorFrameSide, new Vector3(x, y), Quaternion.identity);
                    }
                    else
                    {
                        Instantiate(doorFrameSide1, new Vector3(x, y), Quaternion.identity);
                    }
                }

                else if (currentColor == spawnColor)
                {
                    PlayerTempPos = GameObject.FindWithTag("Preserve").GetComponent<Preserve>().pos;
                    if (Application.loadedLevel == 2)
                    {
                        Instantiate(grassTile, new Vector3(x, y), Quaternion.identity);
                        if (!spawnPicked)
                        {
                            if (GameObject.FindWithTag("Preserve").GetComponent<Preserve>().loaded)
                            {
                                if ((PlayerTempPos.x >= 14 && PlayerTempPos.x <= 24) && x == 15)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                else if ((PlayerTempPos.x >= 58 && PlayerTempPos.x <= 69) && x == 89)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                else if ((PlayerTempPos.x >= 100 && PlayerTempPos.x <= 120) && x == 52)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                else if ((PlayerTempPos.x >= 23 && PlayerTempPos.x <= 26) && x == 52)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                            }
                        }
                    }
                    else if (Application.loadedLevel == 1)
                    {
                        Instantiate(stonePath, new Vector3(x, y), Quaternion.identity);
                        if (!spawnPicked)
                        {
                            if (GameObject.FindWithTag("Preserve").GetComponent<Preserve>().loaded)
                            {
                                if (PlayerTempPos.y == 0 && x == 41)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                if (GameObject.FindGameObjectWithTag("Preserve").GetComponent<Preserve>().deathload)
                                {
                                    pos = new Vector2(41, 27);
                                    spawnPicked = true;
                                    GameObject.FindGameObjectWithTag("Preserve").GetComponent<Preserve>().deathLoad();
                                }
                                else if (PlayerTempPos.x >= 10 && PlayerTempPos.x <= 24 && x == 19)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                else if (PlayerTempPos.x >= 78 && PlayerTempPos.x <= 93 && x == 63)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                else if (PlayerTempPos.x >= 23 && PlayerTempPos.x <= 26 && x == 41 && y >= 30)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                            }
                            else
                            {
                                pos = new Vector2(41, 27);
                                spawnPicked = true;
                            }
                        }
                    }
                    else if (Application.loadedLevel == 5)
                    {
                        Instantiate(schoolFloor, new Vector3(x, y), Quaternion.identity);
                        if (!spawnPicked)
                        {
                            if (GameObject.FindWithTag("Preserve").GetComponent<Preserve>().loaded)
                            {
                                if (PlayerTempPos.x >= 40 && PlayerTempPos.x <= 42 && x == 24)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                                else if (PlayerTempPos.x >= 46 && PlayerTempPos.x <= 56 && x == 25)
                                {
                                    pos = new Vector2(x, y);
                                    spawnPicked = true;
                                }
                            }
                            else
                            {
                                pos = new Vector2(26, 41);
                                spawnPicked = true;
                            }
                        }
                    }
                    if (spawnPicked && !cameraSet)
                    {
                        Vector3 posCam = new Vector3(x, y, -10);
                        maincam.transform.position = posCam;
                        cameraSet = true;
                    }
                    player.transform.position = pos;
                }

                else if (currentColor == enemyColor || currentColor == rangedColor)
                {
                    if (Application.loadedLevel != 5)
                        Instantiate(grassTile, new Vector3(x, y), Quaternion.identity);
                    else
                        Instantiate(schoolFloor, new Vector3(x, y), Quaternion.identity);
                    Vector2 pos = new Vector2(x, y);
                    tempPOI = poiList[poiCounter];
                    poiCounter++;
                    tempPOI.transform.position = pos;
                    tempEnemy = enemyList[enemyCounter];
                    enemyCounter++;
                    tempEnemy.transform.position = pos;
                }
            }
        }
    }
コード例 #49
0
            /// <summary>
            /// Adds another POI to this POI, turning this into a POI group.
            /// </summary>
            /// <param name="poi"></param>
            /// <returns>True if POI was added, false if not. Probable cause for failure is that this is not a group POI.</returns>
            public bool AddPOI(PointOfInterest poi)
            {
                if (POIType != PointOfInterestType.Group) return false;

                // Add poi to group and recompute average world position
                Vector3D worldPosition = WorldPosition;
                worldPosition *= m_group.Count;

                m_group.Add(poi);

                Text.Clear();
                Text.Append(m_group.Count);

                MyRelationsBetweenPlayerAndBlock groupRelation = GetGroupRelation();
                switch (groupRelation)
                {
                    case MyRelationsBetweenPlayerAndBlock.Owner:
                        Text.Append(" Own Signals");
                        break;
                    case MyRelationsBetweenPlayerAndBlock.FactionShare:
                        Text.Append(" Friendly Signals");
                        break;
                    case MyRelationsBetweenPlayerAndBlock.Neutral:
                        Text.Append(" Neutral Signals");
                        break;
                    case MyRelationsBetweenPlayerAndBlock.Enemies:
                        Text.Append(" Enemy Signals");
                        break;
                    case MyRelationsBetweenPlayerAndBlock.NoOwnership:
                        Text.Append(" Mixed Signals");
                        break;
                }

                worldPosition += poi.WorldPosition;
                WorldPosition = worldPosition / m_group.Count;

                Vector3D viewDirection = WorldPosition - MyHudMarkerRender.ActiveWorldMatrix.Translation;
                Distance = viewDirection.Length();

                if (poi.Relationship > Relationship)
                    Relationship = poi.Relationship;

                return true;
            }
コード例 #50
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AddProximityTriggerPage"/> class.
        /// </summary>
        /// <param name="proximityProbe">Proximity probe to add trigger to.</param>
        public AddProximityTriggerPage(IPointsOfInterestProximityProbe proximityProbe)
        {
            _proximityProbe = proximityProbe;

            Title = "Add Trigger";

            List <PointOfInterest> pointsOfInterest = SensusServiceHelper.Get().PointsOfInterest.Union(_proximityProbe.Protocol.PointsOfInterest).ToList();

            if (pointsOfInterest.Count == 0)
            {
                Content = new Label
                {
                    Text     = "No points of interest defined. Please define one or more before creating triggers.",
                    FontSize = 20
                };

                return;
            }

            StackLayout contentLayout = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            #region point of interest
            Label pointOfInterestLabel = new Label
            {
                Text     = "POI:",
                FontSize = 20
            };

            Picker pointOfInterestPicker = new Picker
            {
                Title             = "Select POI",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            foreach (string poiDesc in pointsOfInterest.Select(poi => poi.ToString()))
            {
                pointOfInterestPicker.Items.Add(poiDesc);
            }

            pointOfInterestPicker.SelectedIndexChanged += (o, e) =>
            {
                if (pointOfInterestPicker.SelectedIndex < 0)
                {
                    _pointOfInterestName = _pointOfInterestType = null;
                }
                else
                {
                    PointOfInterest poi = pointsOfInterest[pointOfInterestPicker.SelectedIndex];
                    _pointOfInterestName = poi.Name;
                    _pointOfInterestType = poi.Type;
                }
            };

            contentLayout.Children.Add(new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { pointOfInterestLabel, pointOfInterestPicker }
            });
            #endregion

            #region distance threshold
            Label distanceThresholdLabel = new Label
            {
                Text     = "Distance Threshold (Meters):",
                FontSize = 20
            };

            Entry distanceThresholdEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Keyboard          = Keyboard.Numeric
            };

            distanceThresholdEntry.TextChanged += (o, e) =>
            {
                if (!double.TryParse(distanceThresholdEntry.Text, out _distanceThresholdMeters))
                {
                    _distanceThresholdMeters = -1;
                }
                else if (_distanceThresholdMeters < GpsReceiver.Get().MinimumDistanceThreshold)
                {
                    SensusServiceHelper.Get().FlashNotificationAsync("Distance threshold must be at least " + GpsReceiver.Get().MinimumDistanceThreshold + ".");
                }
            };

            contentLayout.Children.Add(new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { distanceThresholdLabel, distanceThresholdEntry }
            });
            #endregion

            #region threshold direction
            Label thresholdDirectionLabel = new Label
            {
                Text     = "Threshold Direction:",
                FontSize = 20
            };

            ProximityThresholdDirection[] thresholdDirections = new ProximityThresholdDirection[] { ProximityThresholdDirection.Within, ProximityThresholdDirection.Outside };
            Picker thresholdDirectionPicker = new Picker
            {
                Title             = "Select Threshold Direction",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            foreach (ProximityThresholdDirection thresholdDirection in thresholdDirections)
            {
                thresholdDirectionPicker.Items.Add(thresholdDirection.ToString());
            }

            thresholdDirectionPicker.SelectedIndexChanged += (o, e) =>
            {
                if (thresholdDirectionPicker.SelectedIndex < 0)
                {
                    _thresholdDirection = ProximityThresholdDirection.Within;
                }
                else
                {
                    _thresholdDirection = thresholdDirections[thresholdDirectionPicker.SelectedIndex];
                }
            };

            contentLayout.Children.Add(new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { thresholdDirectionLabel, thresholdDirectionPicker }
            });
            #endregion

            Button okButton = new Button
            {
                Text     = "OK",
                FontSize = 20
            };

            okButton.Clicked += async(o, e) =>
            {
                try
                {
                    _proximityProbe.Triggers.Add(new PointOfInterestProximityTrigger(_pointOfInterestName, _pointOfInterestType, _distanceThresholdMeters, _thresholdDirection));
                    await Navigation.PopAsync();
                }
                catch (Exception ex)
                {
                    string message = "Failed to add trigger:  " + ex.Message;
                    SensusServiceHelper.Get().FlashNotificationAsync(message);
                    SensusServiceHelper.Get().Logger.Log(message, LoggingLevel.Normal, GetType());
                }
            };

            contentLayout.Children.Add(okButton);

            Content = new ScrollView
            {
                Content = contentLayout
            };
        }
コード例 #51
0
 public void DeletePointOfInterest(PointOfInterest pointOfInterest)
 {
     _ctx.PointsOfInterest.Remove(pointOfInterest); // remove from dbset
 }
コード例 #52
0
    private bool IsNodeValid(int i)
    {
        PointOfInterest pointOfInterest = this.availableNodes[i].pointOfInterest;

        return(pointOfInterest != null && pointOfInterest.CreepingNodeImprovement == null);
    }
コード例 #53
0
 public void updateInfo()
 {
     poi = poigui.poi;
     rp = poi.RPSalvage;
 }
コード例 #54
0
 public EvaluableCreepingNode(PointOfInterest poi, CreepingNodeImprovementDefinition definition)
 {
     this.pointOfInterest = poi;
     this.nodeDefinition  = definition;
     this.score           = 0f;
 }
コード例 #55
0
        public void InsertPointOfInterest(int cityId, PointOfInterest pointOfInterest)
        {
            var city = GetCity(cityId, false);

            city.PointsOfInterest.Add(pointOfInterest);
        }
コード例 #56
0
 public void DetelePointOfInterest(PointOfInterest pointOfInterest)
 {
     _ctx.PointsOfInterest.Remove(pointOfInterest);
 }
コード例 #57
0
 public void updateInfo()
 {
     poi = poigui.poi;
     rp = poi.RPShop;
     inventory.shop = rp;
     if (!rp.isNull)
     {
         updateTradeList();
     }
 }
コード例 #58
0
        public async Task AddPointOfInterestForCityAsync(int cityId, PointOfInterest pointOfInterest, CancellationToken cancellationToken)
        {
            var city = await GetCityAsync(cityId, false, cancellationToken);

            city.PointsOfInterest.Add(pointOfInterest);
        }
コード例 #59
0
    private bool IsPoiUnlocked(PointOfInterest pointOfInterest)
    {
        string empty = string.Empty;

        return(!pointOfInterest.PointOfInterestDefinition.TryGetValue("VisibilityTechnology", out empty) || this.departmentOfScience.GetTechnologyState(empty) == DepartmentOfScience.ConstructibleElement.State.Researched);
    }
コード例 #60
0
    private void ComputeScoresByResource()
    {
        Dictionary <StaticString, int> dictionary            = new Dictionary <StaticString, int>();
        IEnumerable <EvaluableMessage_ResourceNeed> messages = base.AIEntity.AIPlayer.Blackboard.GetMessages <EvaluableMessage_ResourceNeed>(BlackboardLayerID.Empire, (EvaluableMessage_ResourceNeed match) => match.EvaluationState == EvaluableMessage.EvaluableMessageState.Pending || match.EvaluationState == EvaluableMessage.EvaluableMessageState.Validate);

        if (messages.Any <EvaluableMessage_ResourceNeed>())
        {
            foreach (EvaluableMessage_ResourceNeed evaluableMessage_ResourceNeed in messages)
            {
                if (evaluableMessage_ResourceNeed.MissingResources != null)
                {
                    foreach (MissingResource missingResource in evaluableMessage_ResourceNeed.MissingResources)
                    {
                        if (dictionary.ContainsKey(missingResource.ResourceName))
                        {
                            Dictionary <StaticString, int> dictionary2 = dictionary;
                            StaticString resourceName;
                            int          num = dictionary2[resourceName = missingResource.ResourceName];
                            dictionary2[resourceName] = num + 1;
                        }
                        else
                        {
                            dictionary.Add(missingResource.ResourceName, 1);
                        }
                    }
                }
            }
        }
        List <float> list = new List <float>();
        int          i    = 0;

        while (i < this.availableNodes.Count)
        {
            AILayer_CreepingNode.EvaluableCreepingNode evaluableCreepingNode = this.availableNodes[i];
            PointOfInterest pointOfInterest = evaluableCreepingNode.pointOfInterest;
            CreepingNodeImprovementDefinition nodeDefinition = evaluableCreepingNode.nodeDefinition;
            float num2 = 0f;
            if (!(pointOfInterest.Type == "ResourceDeposit"))
            {
                goto IL_184;
            }
            string x;
            if (pointOfInterest.PointOfInterestDefinition.TryGetValue("ResourceName", out x))
            {
                num2 = 0.5f;
                if (dictionary.ContainsKey(x))
                {
                    num2 = Mathf.Max(num2, (float)dictionary[x]);
                    goto IL_184;
                }
                goto IL_184;
            }
IL_17E:
            i++;
            continue;
IL_184:
            list.Add(num2);
            goto IL_17E;
        }
        if (list.Count > 0)
        {
            float num3 = list.Min();
            float num4 = list.Max();
            for (int j = 0; j < list.Count; j++)
            {
                if (!(this.availableNodes[j].pointOfInterest.Type != "ResourceDeposit"))
                {
                    float num5        = (num3 == num4) ? this.NormalizationFailSafeValue : Mathf.InverseLerp(num3, num4, list[j]);
                    float score       = this.availableNodes[j].score;
                    float boostFactor = num5 * this.ResourceWeight;
                    this.availableNodes[j].score = AILayer.Boost(score, boostFactor);
                }
            }
        }
    }