Exemple #1
0
        /// <summary>Prepares to adapt a command entry to CIL.</summary>
        /// <param name="values">The adaptation-relevant values.</param>
        /// <param name="entry">The present entry ID.</param>
        public override void PreAdaptToCIL(CILAdaptationValues values, int entry)
        {
            CommandEntry cent = values.Entry.Entries[entry];
            MapTag       mt   = MapTag.For(cent.Arguments[0].ToString());

            if (mt.Internal.Count == 0)
            {
                throw new ErrorInducedException("Empty map input to require!");
            }
            foreach (KeyValuePair <string, TemplateObject> pair in mt.Internal)
            {
                TagType tagType;
                if (pair.Value is TagTypeTag tag)
                {
                    tagType = tag.Internal;
                }
                else if (!cent.System.TagSystem.Types.RegisteredTypes.TryGetValue(pair.Value.ToString(), out tagType))
                {
                    throw new ErrorInducedException("Invalid local variable type: " + pair.Value.ToString() + "!");
                }
                int loc = values.LocalVariableLocation(pair.Key);
                if (loc >= 0)
                {
                    TagReturnType type = values.LocalVariableType(loc);
                    if (type.Type != tagType)
                    {
                        throw new ErrorInducedException("Required local variable '" + pair.Key + "' already exists, but is of type '"
                                                        + type.Type.TypeName + "', when '" + pair.Value.ToString() + "' was required!");
                    }
                }
                values.AddVariable(pair.Key, tagType);
            }
        }
Exemple #2
0
 public void ClearMapTag(MapTag tag)
 {
     if (tag && tags.Remove(tag))
     {
         Destroy(tag);
     }
 }
Exemple #3
0
        /// <summary>Adapts a command entry to CIL.</summary>
        /// <param name="values">The adaptation-relevant values.</param>
        /// <param name="entry">The present entry ID.</param>
        public override void AdaptToCIL(CILAdaptationValues values, int entry)
        {
            CommandEntry cent  = values.CommandAt(entry);
            bool         debug = cent.DBMode <= DebugMode.FULL;
            MapTag       mt    = MapTag.For(cent.Arguments[0].ToString());

            if (mt.Internal.Count == 0)
            {
                throw new ErrorInducedException("Empty map input to require!");
            }
            foreach (string varn in mt.Internal.Keys)
            {
                values.LoadQueue();
                values.LoadEntry(entry);
                values.LoadLocalVariable(cent.VarLoc(varn));
                values.ILGen.Emit(OpCodes.Ldstr, varn);
                values.ILGen.Emit(OpCodes.Call, REQUIRECOMMAND_CHECKFORVALIDITY);
            }
            if (debug)
            {
                values.LoadQueue();
                values.LoadEntry(entry);
                values.ILGen.Emit(OpCodes.Call, REQUIRECOMMAND_OUTPUTSUCCESS);
            }
        }
Exemple #4
0
        public static void OnMapTagAdded(IMapTag tag)
        {
            if (Sim.ActiveActor == null || Sim.ActiveActor.MapTagManager == null || !CameraController.IsMapViewModeEnabled())
            {
                return;
            }

            if (tag.TagType == MapTagType.Venue)
            {
                MapTagsModel  model   = MapTagsModel.Singleton;
                MapTagManager manager = Sim.ActiveActor.MapTagManager;
                MapTag        mTag    = tag as MapTag;
                if (model != null && manager != null && mTag != null)
                {
                    Lot lot = LotManager.GetLot(mTag.LotId);
                    if (lot != null && ShouldReplace(lot))
                    {
                        CustomTagNRaas customTag = new CustomTagNRaas(lot, mTag.Owner);
                        manager.RemoveTag(tag.ObjectGuid);
                        Tagger.sReplaced.Add(lot.LotId);
                        manager.AddTag(customTag);
                    }
                }
            }
        }
Exemple #5
0
    void ScanWholeHierarchy()
    {
        allMapTag.Clear();

        MapTag[] allMaptag = GameObject.FindObjectsOfType <MapTag>();

        //旧版本遗留
        foreach (var tg in allMaptag)
        {
            if ((int)tg.distance == -1)
            {
                tg.distance = PathFinder.MapDistance.INF;
            }
        }

        for (int i = 0; i < allMaptag.Length; ++i)
        {
            MapTag tag = allMaptag[i];

            if (!allMapTag.ContainsKey(tag.gameObject))
            {
                allMapTag.Add(tag.gameObject, true);
            }

            if (!allGameObject.Contains(tag.gameObject))
            {
                allGameObject.Add(tag.gameObject);
            }
        }
    }
Exemple #6
0
        /// <summary>Generates a basic Require command entry.</summary>
        /// <param name="expectedMap">The expected variables maps.</param>
        /// <param name="scriptName">The script name.</param>
        /// <param name="line">The script line.</param>
        public CommandEntry GenerateEntry(MapTag expectedMap, string scriptName, int line)
        {
            string mapText = expectedMap.ToString();

            return(new CommandEntry("require \"" + mapText + "\" \0AUTOGENNED", 0, 0, this,
                                    new Argument[] { new Argument(new TextArgumentBit(expectedMap, Engine)) }, Meta.Name, CommandPrefix.NONE, scriptName, line, "", Engine));
        }
Exemple #7
0
 public void OpenTooltip(MapTag tag)
 {
     place = tag.place;
     OpenTooltip();
     tooltipRoot.transform.position = tag.transform.position;
     Update();
 }
Exemple #8
0
        /// <summary>
        /// 显示所有信标数据
        /// </summary>
        /// <param name="Beacon"></param>
        /// <param name="arr"></param>
        public ObservableCollection <MapTag> TagManagement(long UTC)
        {
            MySqlDataReader data = IO_AGVMapService.RataTableBLL(UTC);
            ObservableCollection <MapTag> tags = new ObservableCollection <MapTag>();

            while (data.Read())
            {
                MapTag tag = new MapTag();
                tag.TagName           = data["TagName"].ToString();
                tag.NextTag           = data["NextTag"].ToString();
                tag.NextTagColor      = data["NextTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                tag.PreLeftTag        = data["PreLeftTag"].ToString();
                tag.PreLeftTagColor   = data["PreLeftTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                tag.PreRightTag       = data["PreRightTag"].ToString();
                tag.PreRightTagColor  = data["PreRightTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                tag.PreTag            = data["PreTag"].ToString();
                tag.PreTagColor       = data["PreTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                tag.NextLeftTag       = data["NextLeftTag"].ToString();
                tag.NextLeftTagColor  = data["NextLeftTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                tag.NextRightTag      = data["NextRightTag"].ToString();
                tag.NextRightTagColor = data["NextRightTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                tag.Speed             = MainInfo.agvSpeed[Convert.ToInt32(data["Speed"].ToString())];
                tag.SpeedColor        = Convert.ToInt32(data["Speed"].ToString()) != 0 && Convert.ToInt32(data["Speed"].ToString()) != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                tag.SpeedRev          = MainInfo.agvSpeed[Convert.ToInt32(data["SpeedRev"].ToString())];
                tag.SpeedRevColor     = Convert.ToInt32(data["SpeedRev"].ToString()) != 0 && Convert.ToInt32(data["SpeedRev"].ToString()) != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                tag.StopTime          = data["StopTime"].ToString();
                tag.Pbs         = MainInfo.agvPbs[Convert.ToInt32(data["Pbs"].ToString())];
                tag.PbsColor    = Convert.ToInt32(data["Pbs"].ToString()) != 16 && Convert.ToInt32(data["Pbs"].ToString()) != 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                tag.PbsRev      = MainInfo.agvPbs[Convert.ToInt32(data["PbsRev"].ToString())];
                tag.PbsRevColor = Convert.ToInt32(data["PbsRev"].ToString()) != 16 && Convert.ToInt32(data["PbsRev"].ToString()) != 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                tag.TagTerminal = data["TagTerminal"] is DBNull ? "" : data["TagTerminal"].ToString();

                if (CheckColumnName(data, "PreTurnSpeed"))
                {
                    tag.PreTurnSpeed      = MainInfo.agvSpeed[data.GetInt32("PreTurnSpeed")];
                    tag.PreTurnSpeedColor = (data.GetInt32("PreTurnSpeed") != 0 && data.GetInt32("PreTurnSpeed") != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black));
                    tag.RevTurnSpeed      = MainInfo.agvSpeed[data.GetInt32("RevTurnSpeed")];
                    tag.RevTurnSpeedColor = (data.GetInt32("RevTurnSpeed") != 0 && data.GetInt32("RevTurnSpeed") != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black));
                    tag.PreTurnPBS        = MainInfo.agvPbs[data.GetInt32("PreTurnPBS")];
                    tag.PreTurnPBSColor   = (data.GetInt32("PreTurnPBS") != 0 && data.GetInt32("PreTurnPBS") != 16 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black));
                    tag.RevTurnPBS        = MainInfo.agvPbs[data.GetInt32("RevTurnPBS")];
                    tag.RevTurnPBSColor   = (data.GetInt32("RevTurnPBS") != 0 && data.GetInt32("RevTurnPBS") != 16 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black));
                }
                else
                {
                    tag.PreTurnSpeed      = MainInfo.agvSpeed[0];
                    tag.PreTurnSpeedColor = new SolidColorBrush(Colors.Black);
                    tag.RevTurnSpeed      = MainInfo.agvSpeed[0];
                    tag.RevTurnSpeedColor = new SolidColorBrush(Colors.Black);
                    tag.PreTurnPBS        = MainInfo.agvPbs[0];
                    tag.PreTurnPBSColor   = new SolidColorBrush(Colors.Black);
                    tag.RevTurnPBS        = MainInfo.agvPbs[0];
                    tag.RevTurnPBSColor   = new SolidColorBrush(Colors.Black);
                }
                tags.Add(tag);
            }
            data.Close();
            return(tags);
        }
Exemple #9
0
 public static byte[] ToByteArray(this MapTag tag)
 {
     using (BinaryStream stream = new BinaryStream())
     {
         tag.Write(stream);
         return(stream.ToArray());
     }
 }
Exemple #10
0
 public static MapTag ToMapTag(this byte[] buf)
 {
     using (BinaryStream stream = new BinaryStream(buf))
     {
         MapTag tag = new MapTag();
         tag.Read(stream);
         return(tag);
     }
 }
Exemple #11
0
        public static void SetupSimTag(Sim sim)
        {
            Sim active = Sims3.Gameplay.Actors.Sim.ActiveActor;

            if (active == null)
            {
                return;
            }

            MapTagManager mtm = active.MapTagManager;

            if (mtm == null)
            {
                return;
            }

            try
            {
                if (sim == null)
                {
                    return;
                }

                MapTag tag = mtm.GetTag(sim);

                if ((sim.Household == Household.ActiveHousehold) ||
                    (sim.SimDescription.AssignedRole is RoleSpecialMerchant) ||
                    (sim.SimDescription.AssignedRole is Proprietor) ||
                    (Tagger.Settings.mTaggedSims.Contains(sim.SimDescription.SimDescriptionId)) ||
                    (Tagger.Settings.mEnableSimTags && (!Tagger.Settings.HasSimFilterActive() || Tagger.Settings.DoesSimMatchSimFilters(sim.SimDescription.SimDescriptionId))))
                {
                    if (((tag is NPCSimMapTag) || (tag is SelectedSimMapTag)) || (tag is FamilySimMapTag))
                    {
                        mtm.RemoveTag(tag);
                    }

                    if (!mtm.HasTag(sim))
                    {
                        mtm.AddTag(new TrackedSim(sim, mtm.Actor));
                    }
                    else
                    {
                        mtm.RefreshTag(tag);
                    }
                }
                else if (tag is TrackedSim)
                {
                    mtm.RemoveTag(tag);
                }
            }
            catch (Exception exception)
            {
                Common.DebugException(sim, exception);
            }
        }
Exemple #12
0
        public static void RemoveTags()
        {
            Sim active = Sims3.Gameplay.Actors.Sim.ActiveActor;

            if (active == null)
            {
                return;
            }

            MapTagManager mtm = active.MapTagManager;

            if (mtm == null)
            {
                return;
            }

            if (!Tagger.Settings.mEnableLotTags)
            {
                foreach (Lot lot in LotManager.AllLots)
                {
                    if (lot.Household != null && lot.ObjectId != ObjectGuid.InvalidObjectGuid)
                    {
                        MapTag tag = mtm.GetTag(lot);

                        if (tag != null && tag is TrackedLot)
                        {
                            mtm.RemoveTag(tag);
                        }
                    }
                }
            }

            if (!Tagger.Settings.mEnableSimTags)
            {
                foreach (Sim sim in LotManager.Actors)
                {
                    if (sim.SimDescription.CreatedSim != null)
                    {
                        MapTag tag = mtm.GetTag(sim);

                        if (tag != null && tag is TrackedSim && !Tagger.Settings.mTaggedSims.Contains(sim.SimDescription.SimDescriptionId))
                        {
                            mtm.RemoveTag(tag);
                        }
                    }
                }
            }
        }
Exemple #13
0
        public static bool ShouldReplace(Lot lot)
        {
            if (lot != null)
            {
                if (MapTagManager.ActiveMapTagManager == null)
                {
                    return(false);
                }

                MapTag tag = MapTagManager.ActiveMapTagManager.GetTag(lot);

                return(Tagger.staticData.ContainsKey((uint)lot.CommercialLotSubType) && !(tag is CustomTagNRaas));
            }

            return(false);
        }
Exemple #14
0
    public MapTag ShowPlaceOnMap(Coords location, string name, Color?color = null)
    {
        if (location == null || name == null)
        {
            return(null);
        }

        Vector3 pos = MapCamera.LatLongToUnity(location);
        MapTag  tag = Instantiate(tagPrefab, tagsHolder).GetComponent <MapTag>();

        tag.transform.position = pos;
        tag.placeName.text     = name;
        tag.placeName.color    = color.HasValue ? color.Value : tag.placeName.color;

        tags.Add(tag);
        return(tag);
    }
Exemple #15
0
        public static void SetupLotTag(Lot lot)
        {
            Sim active = Sims3.Gameplay.Actors.Sim.ActiveActor;

            if (active == null)
            {
                return;
            }

            MapTagManager mtm = active.MapTagManager;

            if (mtm == null)
            {
                return;
            }

            try
            {
                MapTag tag = mtm.GetTag(lot);

                if ((!Tagger.Settings.HasLotFilterActive() || Tagger.Settings.DoesHouseholdMatchLotFilters(lot.Household.AllSimDescriptions)) && Tagger.Settings.mEnableLotTags)
                {
                    if ((tag != null) && (!(tag is TrackedLot)) && (!(tag is HomeLotMapTag)))
                    {
                        mtm.RemoveTag(tag);
                    }
                    if (!mtm.HasTag(lot))
                    {
                        mtm.AddTag(new TrackedLot(lot, mtm.Actor));
                    }
                    else
                    {
                        mtm.RefreshTag(tag);
                    }
                }
                else if (tag is TrackedLot)
                {
                    mtm.RemoveTag(tag);
                }
            }
            catch (Exception exception)
            {
                Common.DebugException(lot, exception);
            }
        }
Exemple #16
0
    void GenMapOrder()
    {
        MapTag[] mapTags = GameObject.FindObjectsOfType <MapTag>();

        //分配序列号
        int mapTagIndex = 0;

        for (int i = 0; i < mapTags.Length; ++i)
        {
            MapTag mapTag = mapTags[i];

            MapTagIndex index = mapTag.GetComponent <MapTagIndex>();
            if (index == null)
            {
                index          = mapTag.gameObject.AddComponent <MapTagIndex>();
                index.tagIndex = mapTagIndex++;
            }

            List <MapTag> tagDest;
            if (_allMaptags.TryGetValue(index, out tagDest))
            {
                tagDest.Add(mapTag);
            }
            else
            {
                tagDest = new List <MapTag>();
                tagDest.Add(mapTag);
                _allMaptags.Add(index, tagDest);
            }
        }

        int len = 0;

        if (CheckMap(out len))
        {
            if (FillMapData(len))
            {
                _dijidalas.SetMapData(_mapBinaryData, len);
            }
        }
        else
        {
            Debug.LogWarning("检查地图失败, 地图可能为空");
        }
    }
Exemple #17
0
    public MapTag ShowPlaceOnMap(PlaceDetails place, Color?color = null)
    {
        if (place?.result?.geometry == null || place?.result?.name == null)
        {
            return(null);
        }

        Vector3 pos = MapCamera.LatLongToUnity(place.result.geometry.location);
        MapTag  tag = Instantiate(tagPrefab, tagsHolder).GetComponent <MapTag>();

        tag.transform.position = pos;
        tag.placeName.text     = place.result.name;
        tag.placeName.color    = color.HasValue ? color.Value : tag.placeName.color;
        tag.place = place;

        tags.Add(tag);
        return(tag);
    }
 protected override void execute(CSteamID executorID, string parameter)
 {
     CommandQueue queue = ExecScript.ToQueue(UnturnedFreneticMod.Instance.CommandSystem.System);
     MapTag map = new MapTag();
     if (executorID == CSteamID.Nil)
     {
         map.Internal["is_server"] = new BooleanTag(true);
     }
     else
     {
         map.Internal["player"] = new PlayerTag(PlayerTool.getSteamPlayer(executorID));
         map.Internal["is_server"] = new BooleanTag(false);
     }
     map.Internal["raw_arguments"] = new TextTag(parameter);
     queue.SetVariable("context", map);
     queue.CommandStack.Peek().Debug = DebugMode.MINIMAL; // Just in case
     queue.Execute();
 }
        protected override void execute(CSteamID executorID, string parameter)
        {
            FreneticScript.CommandSystem.CommandQueue queue = ExecScript.ToQueue(UnturnedFreneticMod.Instance.CommandSystem.System);
            MapTag map = new MapTag();

            if (executorID == CSteamID.Nil)
            {
                map.Internal["is_server"] = new BooleanTag(true);
            }
            else
            {
                map.Internal["player"]    = new PlayerTag(PlayerTool.getSteamPlayer(executorID));
                map.Internal["is_server"] = new BooleanTag(false);
            }
            map.Internal["raw_arguments"] = new TextTag(parameter);
            queue.SetVariable("context", map);
            queue.CommandStack.Peek().Debug = DebugMode.MINIMAL; // Just in case
            queue.Execute();
        }
Exemple #20
0
    IEnumerator GetPlaceCoroutine(string place_id)
    {
        if (place_id == "")
        {
            yield break;
        }

        // do we need to retrieve Place Details?
        if (data.placeDetails == null || place_id != data.placeDetails.result.place_id)
        {
            WWW www = new WWW(PHPProxy.Escape(PlaceDetails.BuildURL(place_id,
                                                                    PlaceDetails.Fields.name | PlaceDetails.Fields.geometry |
                                                                    PlaceDetails.Fields.photo | PlaceDetails.Fields.place_id)));
            yield return(www);

            if (www.error != null)
            {
                Debug.Log(www.error);
                yield break;
            }

            data.placeDetails = JsonUtility.FromJson <PlaceDetails>(www.text);
        }

        if (data.placeDetails.status != "OK")
        {
            Debug.Log(data.placeDetails.error_message);
            yield break;
        }

        nameLabel.text = gameObject.name = data.placeDetails.result.name;

        yield return(GetTravelTimes());

        data.pos = MapCamera.LatLongToUnity(data.placeDetails.result.geometry.location);
        // create a map tag on the world map
        mapTag    = MapTagManager.Instance.ShowPlaceOnMap(data.placeDetails);
        IsLoading = false;         // done with loading
    }
 /// <summary>Handles the base input for a tag.</summary>
 /// <param name="data">The tag data.</param>
 /// <returns>The correct object.</returns>
 public static MapTag HandleOne(TagData data)
 {
     return(MapTag.CreateFor(data.GetModifierObjectCurrent(), data));
 }
Exemple #22
0
 public void ToggleRemovePlaceTooltip(MapTag tag)
 {
     ToggleTooltip(RemovePlaceTooltip, place => Sidebar.Instance.OnClickRemovePlaceTooltip(place), tag);
 }
Exemple #23
0
 public void ToggleAddPlaceTooltip(MapTag tag)
 {
     ToggleTooltip(AddPlaceTooltip, place => Sidebar.Instance.OnClickAddPlaceTooltip(place), tag);
 }
Exemple #24
0
        private void SerialPortData_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            int    indexs = e.Column.DisplayIndex;
            int    index  = e.Row.GetIndex();
            MapTag route  = e.Row.DataContext as MapTag;

            if (route != null)
            {
                if (indexs.Equals(1))
                {
                    Tags[index].NextTagColor = route.NextTag != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(2))
                {
                    Tags[index].NextLeftTagColor = route.NextLeftTag != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(3))
                {
                    Tags[index].NextRightTagColor = route.NextRightTag != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(4))
                {
                    Tags[index].PreTagColor = route.PreTag != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(5))
                {
                    Tags[index].PreLeftTagColor = route.PreLeftTag != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(6))
                {
                    Tags[index].PreRightTagColor = route.PreRightTag != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black);
                    AssociatedTag(Convert.ToInt32(route.TagName));
                }
                else if (indexs.Equals(7))
                {
                    Tags[index].SpeedColor = route.Speed != "0: 5" && route.Speed != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(8))
                {
                    Tags[index].SpeedRevColor = route.SpeedRev != "0: 5" && route.SpeedRev != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(9))
                {
                    Tags[index].PreTurnSpeedColor = route.PreTurnSpeed != "0: 5" && route.PreTurnSpeed != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(10))
                {
                    Tags[index].RevTurnSpeedColor = route.RevTurnSpeed != "0: 5" && route.RevTurnSpeed != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(11))
                {
                    Tags[index].PbsColor = route.Pbs != "区域0" && route.Pbs != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(12))
                {
                    Tags[index].PbsRevColor = route.PbsRev != "区域0" && route.PbsRev != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(13))
                {
                    Tags[index].PreTurnPBSColor = route.PreTurnPBS != "区域0" && route.PreTurnPBS != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                else if (indexs.Equals(14))
                {
                    Tags[index].RevTurnPBSColor = route.RevTurnPBS != "区域0" && route.RevTurnPBS != "无变化" ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black);
                }
                TagRecover();
            }
        }
Exemple #25
0
        public override TemplateObject Handle(TagData data)
        {
            if (data.Remaining == 0)
            {
                return(this);
            }
            switch (data[0])
            {
            // <--[tag]
            // @Name ItemTag.item_type
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the name of the type of this item.
            // @Example "blocks/dirt" .item_type returns "block".
            // -->
            case "item_type":
                return(new TextTag(Internal.Name).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.item_type_secondary
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the name of the secondary type of this item, or null if none.
            // @Example "ammo/rifle" .item_type_secondary returns "rifle_gun".
            // @Example "blocks/dirt" .item_type_secondary returns null.
            // -->
            case "item_type_secondary":
                return(string.IsNullOrEmpty(Internal.SecondaryName) ? new NullTag() : new TextTag(Internal.SecondaryName).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.count
            // @Group General Information
            // @ReturnType IntegerTag
            // @Returns the number of this item held in this stack.
            // @Example "blocks/dirt" .count returns "1".
            // @Example "blocks/dirt" .with_count[5].count returns "5".
            // -->
            case "count":
                return(new IntegerTag(Internal.Count).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.is_bound
            // @Group General Information
            // @ReturnType BooleanTag
            // @Returns whether the item is 'bound' to the player (Can't be moved or lost).
            // @Example "blocks/dirt" .is_bound returns "false".
            // -->
            case "is_bound":
                return(new BooleanTag(Internal.IsBound).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.datum
            // @Group General Information
            // @ReturnType IntegerTag
            // @Returns the "datum" number for this item.
            // @Example "blocks/dirt" .datum returns "3".
            // -->
            case "datum":
                return(new IntegerTag(Internal.Datum).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.draw_color
            // @Group General Information
            // @ReturnType ColorTag
            // @Returns the color that this item is to be drawn (rendered) with.
            // @Example "blocks/dirt" .draw_color returns "white".
            // @Example "blocks/dirt" .with_draw_color[red].draw_color returns "red".
            // -->
            case "draw_color":
                return(new ColorTag(Internal.DrawColor).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.description
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the description of the item.
            // @Example "blocks/dirt" .description returns "Dirty!".
            // -->
            case "description":
                return(new TextTag(Internal.Description).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.display_name
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the display name of the item.
            // @Example "blocks/dirt" .display_name returns "Dirt".
            // -->
            case "display_name":
                return(new TextTag(Internal.DisplayName).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.texture_name
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the name of the item's texture/icon.
            // @Example "blocks/dirt" .texture_name returns "blocks/solid/natural/dirt".
            // -->
            case "texture_name":
                return(new TextTag(Internal.GetTextureName()).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.model_name
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the name of the item's 3D model.
            // @Example "blocks/dirt" .model_name returns "block".
            // -->
            case "model_name":
                return(new TextTag(Internal.GetModelName()).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.shared_attributes
            // @Group General Information
            // @ReturnType MapTag
            // @Returns a full map of all this items shared attributes.
            // @Example "blocks/dirt" .shared_attributes returns an empty map.
            // -->
            case "shared_attributes":
                return(new MapTag(Internal.SharedAttributes).Handle(data.Shrink()));

            // <--[tag]
            // @Name ItemTag.local_attributes
            // @Group General Information
            // @ReturnType MapTag
            // @Returns a full map of all this items local attributes.
            // @Example "blocks/dirt" .local_attributes returns an empty map.
            // -->
            case "local_attributes":
                return(new MapTag(Internal.Attributes).Handle(data.Shrink()));

            // TODO: All other item properties!
            // <--[tag]
            // @Name ItemTag.with_count[<IntegerTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified count of items. An input of 0 or less will result in an air item being returned.
            // @Example "blocks/dirt" .with_count[5] returns 5x "blocks/dirt".
            // -->
            case "with_count":
            {
                ItemStack items = Internal.Duplicate();
                items.Count = (int)IntegerTag.For(data, data.GetModifierObject(0)).Internal;
                if (items.Count <= 0)
                {
                    items = Internal.TheServer.Items.Air;
                }
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_bound_status[<BooleanTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified 'bound' status.
            // @Example "blocks/dirt" .with_bound_status[true] returns a dirt block that can't be moved.
            // -->
            case "with_bound_status":
            {
                ItemStack items = Internal.Duplicate();
                items.IsBound = BooleanTag.For(data, data.GetModifierObject(0)).Internal;
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_datum[<IntegerTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified item datum value.
            // @Example "blocks/dirt" .with_datum[1] returns a dirt block that is secretly made of stone.
            // -->
            case "with_datum":
            {
                ItemStack items = Internal.Duplicate();
                items.Datum = (int)IntegerTag.For(data, data.GetModifierObject(0)).Internal;
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_item_type[<TextTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified type name.
            // @Example "blocks/dirt" .with_item_type[rifle_gun] returns a rifle that looks like a block of dirt.
            // -->
            case "with_item_type":
            {
                ItemStack items = Internal.Duplicate();
                items.SetName(data.GetModifier(0));
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_secondary_type[<TextTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified secondary type name.
            // @Example "blocks/dirt" .with_item_type[bullet].with_secondary_type[rifle_gun] returns ammo for a rifle that looks like a block of dirt.
            // -->
            case "with_secondary_type":
            {
                ItemStack items = Internal.Duplicate();
                items.SecondaryName = data.GetModifier(0).ToLowerFast();
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_description[<TextTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified description.
            // @Example "blocks/dirt" .with_description[hello world] returns a rather friendly block of dirt.
            // -->
            case "with_description":
            {
                ItemStack items = Internal.Duplicate();
                items.Description = data.GetModifier(0);
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_display_name[<TextTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified display name.
            // @Example "blocks/dirt" .with_display_name[hello world] returns a rather friendly block of dirt.
            // -->
            case "with_display_name":
            {
                ItemStack items = Internal.Duplicate();
                items.DisplayName = data.GetModifier(0);
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_texture_name[<TextTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified texture name.
            // @Example "blocks/dirt" .with_texture_name[clear] returns an invisible block of dirt.
            // -->
            case "with_texture_name":
            {
                ItemStack items = Internal.Duplicate();
                items.SetTextureName(data.GetModifier(0));
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_model_name[<TextTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified model name.
            // @Example "blocks/dirt" .with_model_name[sphere] returns a rather round block of dirt.
            // -->
            case "with_model_name":
            {
                ItemStack items = Internal.Duplicate();
                items.SetModelName(data.GetModifier(0));
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_draw_color[<ColorTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified draw_color.
            // @Example "blocks/dirt" .with_draw_color[red] returns "blocks/dirt" colored red.
            // -->
            case "with_draw_color":
            {
                ItemStack items = Internal.Duplicate();
                items.DrawColor = ColorTag.For(data.GetModifierObject(0)).Internal;
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_shared_attributes[<MapTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified shared attributes map.
            // -->
            case "with_shared_attributes":
            {
                ItemStack items = Internal.Duplicate();
                items.SharedAttributes.Clear();
                foreach (KeyValuePair <string, TemplateObject> entry in MapTag.For(data.GetModifierObject(0)).Internal)
                {
                    items.SharedAttributes[entry.Key] = entry.Value;
                }
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // <--[tag]
            // @Name ItemTag.with_local_attributes[<MapTag>]
            // @Group Modification
            // @ReturnType ItemTag
            // @Returns a copy of this item with the specified local attributes map.
            // -->
            case "with_local_attributes":
            {
                ItemStack items = Internal.Duplicate();
                items.Attributes.Clear();
                foreach (KeyValuePair <string, TemplateObject> entry in MapTag.For(data.GetModifierObject(0)).Internal)
                {
                    items.Attributes[entry.Key] = entry.Value;
                }
                return(new ItemTag(items).Handle(data.Shrink()));
            }

            // TODO: Modifiers for all other item properties!
            default:
                return(new TextTag(ToString()).Handle(data));
            }
        }
Exemple #26
0
    void ToggleTooltip(TooltipWorld tooltip, Action <GoogleMaps.PlaceDetails> action, MapTag tag)
    {
        currentTooltip?.CloseTooltip();

        if (currentTooltip != tooltip || currentTooltip.place != tag.place)
        {
            currentTooltip = tooltip;
            tooltip.action = action;
            tooltip.OpenTooltip(tag);
        }
        else
        {
            currentTooltip = null;
        }
    }
Exemple #27
0
        private void SerialPortData_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
        {
            int    Columnindex = e.Column.DisplayIndex;
            int    Rowsindex   = e.Row.GetIndex();
            MapTag route       = e.Row.DataContext as MapTag;

            if (route != null)
            {
                List <Ga_agvStatus> agv = new List <Ga_agvStatus>();
                agv.Add(new Ga_agvStatus()
                {
                    StatusName = "N/A", StatusValue = "N/A"
                });
                mapService.SelectTagSystem(UTCTime, route.TagName).Select(p => new Ga_agvStatus()
                {
                    StatusName = p, StatusValue = p
                }).ToList().ForEach(p => agv.Add(p));
                if (Columnindex.Equals(1))
                {
                    Tags[Rowsindex].NextTagList = agv;
                }
                else if (Columnindex.Equals(2))
                {
                    Tags[Rowsindex].NextLeftTagList = agv;
                }
                else if (Columnindex.Equals(3))
                {
                    Tags[Rowsindex].NextRightTagList = agv;
                }
                else if (Columnindex.Equals(4))
                {
                    Tags[Rowsindex].PreTagList = agv;
                }
                else if (Columnindex.Equals(5))
                {
                    Tags[Rowsindex].PreLeftTagList = agv;
                }
                else if (Columnindex.Equals(6))
                {
                    Tags[Rowsindex].PreRightTagList = agv;
                }
                else if (Columnindex.Equals(7))
                {
                    Tags[Rowsindex].SpeedList = MapRegulate.speed;
                }
                else if (Columnindex.Equals(8))
                {
                    Tags[Rowsindex].SpeedRevList = MapRegulate.speed;
                }
                else if (Columnindex.Equals(9))
                {
                    Tags[Rowsindex].PreTurnSpeedList = MapRegulate.speed;
                }
                else if (Columnindex.Equals(10))
                {
                    Tags[Rowsindex].RevTurnSpeedList = MapRegulate.speed;
                }
                else if (Columnindex.Equals(11))
                {
                    Tags[Rowsindex].PbsList = MapRegulate.pbs;
                }
                else if (Columnindex.Equals(12))
                {
                    Tags[Rowsindex].PbsRevList = MapRegulate.pbs;
                }
                else if (Columnindex.Equals(13))
                {
                    Tags[Rowsindex].PreTurnPBSList = MapRegulate.pbs;
                }
                else if (Columnindex.Equals(14))
                {
                    Tags[Rowsindex].RevTurnPBSList = MapRegulate.pbs;
                }
                AssociatedTag(Convert.ToInt32(route.TagName));
            }
        }
 /// <summary>Constructs the argument with input text.</summary>
 /// <param name="_text">The input text.</param>
 /// <param name="wasquoted">Whether the argument was quoted at input time.</param>
 /// <param name="perfect">Whether the argument must parse back "perfectly" (meaning, it will ToString to the exact original input).</param>
 /// <param name="_engine">The backing script engine.</param>
 public TextArgumentBit(string _text, bool wasquoted, bool perfect, ScriptEngine _engine)
 {
     Engine = _engine;
     if (wasquoted)
     {
         InputValue = new TextTag(_text);
         ResType    = TextTag.TYPE;
         return;
     }
     else if (_text == "true")
     {
         InputValue = BooleanTag.TRUE;
         ResType    = BooleanTag.TYPE;
         return;
     }
     else if (_text == "false")
     {
         InputValue = BooleanTag.FALSE;
         ResType    = BooleanTag.TYPE;
         return;
     }
     else if (_text == "&{NULL}")
     {
         InputValue = NullTag.NULL_VALUE;
         ResType    = NullTag.TYPE;
         return;
     }
     else if (long.TryParse(_text, out long ti) && ti.ToString() == _text)
     {
         InputValue = new IntegerTag(ti);
         ResType    = IntegerTag.TYPE;
         return;
     }
     else if (double.TryParse(_text, out double tn) && (!perfect || tn.ToString() == _text))
     {
         InputValue = new NumberTag(tn);
         ResType    = NumberTag.TYPE;
         return;
     }
     else if (_text.Contains('|'))
     {
         if (_text.Contains(':'))
         {
             MapTag map = MapTag.For(_text);
             if (map.ToString() == _text)
             {
                 InputValue = map;
                 ResType    = MapTag.TYPE;
                 return;
             }
         }
         ListTag list = ListTag.For(_text);
         if (list.ToString() == _text)
         {
             InputValue = list;
             ResType    = ListTag.TYPE;
             return;
         }
     }
     InputValue = new TextTag(_text);
     ResType    = TextTag.TYPE;
 }