public Entity AddPath(int newNode, float newStartY, float newDuration, PathModel newPath) { var component = CreateComponent<PathComponent>(ComponentIds.Path); component.node = newNode; component.startY = newStartY; component.duration = newDuration; component.path = newPath; return AddComponent(ComponentIds.Path, component); }
public void Init(PathModel component, Material material) { this.component = component; lineMaterial = material; foreach (Vector2 position in component.points) { currentPosition = new Vector3(position.x, position.y, 0.0f); createNode(); } }
public override void ParseResult() { Component = JsonConvert.DeserializeObject<PathModel>(result); }
/// <summary> /// Check whether a string has basic properties that /// (not null, at least 2 characters) it could contain /// a path reference. /// </summary> /// <param name="path"></param> /// <returns></returns> public static bool CheckValidString(string path) { return(PathModel.CheckValidString(path)); }
/// <summary> /// Compare the paths for 2 <see cref="PathModel"/> objects /// and return false if they are not equal, otherwise true. /// </summary> /// <param name="m"></param> /// <param name="m1"></param> /// <returns></returns> public static bool Compare(IPathModel m, IPathModel m1) { return(PathModel.Compare(m, m1)); }
/// <summary> /// Load all sub-folders into the Folders collection via /// IEnumerable/Yield. /// </summary> public static IEnumerable <IPathModel> LoadFolders(string fullPath) { return(PathModel.LoadFolders(fullPath)); }
/// <summary> /// Create a new folder new standard sub folder in <paramref name="folderPath"/>. /// The new folder has a standard name like 'New folder n'. /// </summary> /// <param name="folderPath"></param> /// <param name="newDefaultFolderName">Compute default name for new folder</param> /// <returns>PathModel object to new folder or null</returns> public static IPathModel CreateDir(IPathModel folderPath, string newDefaultFolderName = "New Folder") { return(PathModel.CreateDir(folderPath, newDefaultFolderName)); }
/// <summary> /// Determine whether a special folder has physical information on current computer or not. /// </summary> /// <param name="specialFolder"></param> /// <returns>Path to special folder (if any) or null</returns> public static string SpecialFolderHasPath(System.Environment.SpecialFolder specialFolder) { return(PathModel.SpecialFolderHasPath(specialFolder)); }
/// <summary> /// Hidden class constructor /// </summary> protected FileSystemModel() { mModel = null; }
private FolderViewModel CreateFolderItem(PathModel model) { var f = new FolderViewModel(model); return(f); }
public override void ExploreVirtualPath(PathModel path) { base.ExploreVirtualPath(path); }
void onPathLoaded(PathModel component) { (viewService.SetView(ViewTypes.EDITOR_EDIT_PATH) as EditPathView).SetData(component); }
public void UpdatePath(PathModel component, Action onPathUpdated) { wwwService.Send<UpdatePath>(new UpdatePath(component), (request) => onPathUpdated(), onRequestFailed); }
public void SetData(PathModel component) { this.component = component; pathCreatorScript.Init(component, pool.GetGroup(Matcher.MaterialReference).GetSingleEntity().materialReference.storage.Default); }
public static void Parse(PathModel path, Context context) { LibParser inst = new LibParser(path, context); inst.Run(); }
public FolderModel(PathModel model) : base(model) { mDir = new DirectoryInfo(model.Path); }
private void Start() { pathModel = GetComponent <PathModel>(); specialActions = SpecialActions.instance; }
public async Task <PathMinDisplayed> CreatePath(PathModel path) { int mapId = 0; List <string> zones = new List <string>(); string userId = User.Claims.First(c => c.Type == "UserID").Value; var user = await _userManager.FindByIdAsync(userId); TrajetDB trajetDB = new TrajetDB() { Name = path.Name, Type = (TypePath)path.Type, GroupLevelMax = path.GroupLevelMax, GroupLevelMin = path.GroupLevelMin, CaptureItem = path.CaptureItem, Fk_User = new Guid(userId), MaxPod = path.MaxPod, MonsterQuantityMin = path.MonsterQuantityMin, MonsterQuantityMax = path.MonsterQuantityMax, LeaderBank = path.LeaderBank, IsCapture = path.IsCapture, ListRessource = path.ListRessource, Key = Guid.NewGuid() }; foreach (var monstreLevel in path.MonsterLevel) { if (trajetDB.MonsterLevel == null) { trajetDB.MonsterLevel = new List <SpecificMonsterLevel>(); } trajetDB.MonsterLevel.Add(new SpecificMonsterLevel() { MonsterId = monstreLevel.MonsterId, MonsterLevelMax = monstreLevel.MonsterLevelmax, MonsterLevelMin = monstreLevel.MonsterLevelMin }); } foreach (var monstreQuantity in path.MonsterQuantity) { if (trajetDB.MonsterQuantity == null) { trajetDB.MonsterQuantity = new List <SpecificMonsterQuantity>(); } trajetDB.MonsterQuantity.Add(new SpecificMonsterQuantity() { MonsterId = monstreQuantity.MonsterId, MonsterQuantityMax = monstreQuantity.MonsterQuantityMax, MontserQuantityMin = monstreQuantity.MonsterQuantityMin }); } foreach (var monstreCapture in path.MonsterCapture) { if (trajetDB.MonsterCapture == null) { trajetDB.MonsterCapture = new List <CaptureMonsterQuantity>(); } trajetDB.MonsterCapture.Add(new CaptureMonsterQuantity() { MonsterId = monstreCapture.MonsterId, MonsterQuantity = monstreCapture.MonsterQuantity }); } /* actions du trajet */ trajetDB.PathAction = new List <PathAction>(); foreach (PathActionModel action in path.PathAction) { PathAction pathActionToCreate = new PathAction(); if (!ListBank.Contains(action.MapPos)) { MapDB map = Database.Maps.Find(o => o.Coordinate == ("[" + action.MapPos.Replace(';', ',') + "]")).First(); mapId = map.Key; if (!zones.Contains(map.AreaName)) { zones.Add(map.AreaName); } pathActionToCreate.MapId = mapId; foreach (MapActionModel item in action.Actions) { if (pathActionToCreate.Actions == null) { pathActionToCreate.Actions = new List <MapAction>(); } if (item.FightAction != null) { FightAction fightActionToCreate = new FightAction() { Order = item.Order, IsAlone = item.FightAction.IsAlone }; pathActionToCreate.Actions.Add(fightActionToCreate); } else if (item.GatherAction != null) { GatherAction GatherActionToCreate = new GatherAction() { Order = item.Order }; pathActionToCreate.Actions.Add(GatherActionToCreate); } else if (item.InteractionAction != null) { InteractionAction InteractionActionToCreate = new InteractionAction() { Order = item.Order, InteractiveIdObject = item.InteractionAction.InteractiveidObject, InteractiveIdResponse = item.InteractionAction.InteractiveIdResponse, ToBackBank = item.InteractionAction.ToBackBank, ToGoBank = item.InteractionAction.ToGoBank }; pathActionToCreate.Actions.Add(InteractionActionToCreate); } else if (item.moveAction != null) { MoveAction MoveActionToCreate = new MoveAction() { Order = item.Order, ToBackBank = item.moveAction.ToBackBank, ToGoBank = item.moveAction.ToGoBank, CellId = item.moveAction.Cellid }; if (item.moveAction.Direction != null) { foreach (string direc in item.moveAction.Direction) { if (MoveActionToCreate.Direction == null) { MoveActionToCreate.Direction = new List <MovementDirectionEnum>(); } MoveActionToCreate.Direction.Add((MovementDirectionEnum)System.Enum.Parse(typeof(MovementDirectionEnum), direc.ToUpper())); } } pathActionToCreate.Actions.Add(MoveActionToCreate); } else if (item.UseItemAction != null) { UseItemAction UseItemActionToCreate = new UseItemAction() { Order = item.Order, ItemId = item.UseItemAction.ItemId, ToBackBank = item.UseItemAction.ToBackBank, ToGoBank = item.UseItemAction.ToGoBank }; pathActionToCreate.Actions.Add(UseItemActionToCreate); } else if (item.ZaapAction != null) { int zaapDestination = Database.Maps.Find(o => o.Coordinate == ("[" + action.MapPos.Replace(';', ',') + "]")).First().Key; ZaapAction UseItemActionctionToCreate = new ZaapAction() { Order = item.Order, Destination = zaapDestination, ZaapId = item.ZaapAction.ZaapId, ToBackBank = item.ZaapAction.ToBackBank, ToGoBank = item.ZaapAction.ToGoBank }; pathActionToCreate.Actions.Add(UseItemActionctionToCreate); } else if (item.ZaapiAction != null) { int zaapiDestination = Database.Maps.Find(o => o.Coordinate == ("[" + action.MapPos.Replace(';', ',') + "]")).First().Key; ZaapAction UseItemActionctionToCreate = new ZaapAction() { Order = item.Order, Destination = zaapiDestination, ZaapId = item.ZaapiAction.ZaapiId, ToBackBank = item.ZaapiAction.ToBackBank, ToGoBank = item.ZaapiAction.ToGoBank }; pathActionToCreate.Actions.Add(UseItemActionctionToCreate); } } trajetDB.PathAction.Add(pathActionToCreate); } else { foreach (MapActionModel item in action.Actions) { pathActionToCreate = new PathAction(); if (item.moveAction != null) { mapId = item.moveAction.MapId.Value; pathActionToCreate.MapId = mapId; MoveAction MoveActionToCreate = new MoveAction() { Order = item.Order, ToBackBank = item.moveAction.ToBackBank, ToGoBank = item.moveAction.ToGoBank, CellId = item.moveAction.Cellid, MapId = mapId }; if (item.moveAction.Direction != null) { foreach (string direc in item.moveAction.Direction) { if (MoveActionToCreate.Direction == null) { MoveActionToCreate.Direction = new List <MovementDirectionEnum>(); } MoveActionToCreate.Direction.Add((MovementDirectionEnum)System.Enum.Parse(typeof(MovementDirectionEnum), direc.ToUpper())); } } if (trajetDB.PathAction.Exists(o => o.MapId == mapId)) { trajetDB.PathAction.Find(o => o.MapId == mapId).Actions.Add(MoveActionToCreate); } else { pathActionToCreate.Actions = new List <MapAction>(); pathActionToCreate.Actions.Add(MoveActionToCreate); trajetDB.PathAction.Add(pathActionToCreate); } } else if (item.BankAction != null) { mapId = item.BankAction.MapId.Value; pathActionToCreate.MapId = mapId; BankAction BankActionToCreate = new BankAction() { MapId = mapId, Order = item.Order }; if (trajetDB.PathAction.Exists(o => o.MapId == mapId)) { trajetDB.PathAction.Find(o => o.MapId == mapId).Actions.Add(BankActionToCreate); } else { pathActionToCreate.Actions = new List <MapAction>(); pathActionToCreate.Actions.Add(BankActionToCreate); trajetDB.PathAction.Add(pathActionToCreate); } } } } } trajetDB.Zones = zones; PathMinDisplayed retourPath = new PathMinDisplayed() { IsCapture = trajetDB.IsCapture, Key = trajetDB.Key, Name = trajetDB.Name, Type = trajetDB.Type, UsedNumber = 0, Zones = trajetDB.Zones }; await Database.Paths.InsertOneAsync(trajetDB); return(retourPath); }
public async Task <PathModel> GetPathByKey(pathKey key) { string userId = User.Claims.First(c => c.Type == "UserID").Value; var user = await _userManager.FindByIdAsync(userId); TrajetDB trajet = _paths.FirstOrDefault(o => o.Key == key.Key); PathModel pathToSend = new PathModel() { Name = trajet.Name, Type = trajet.Type, GroupLevelMax = trajet.GroupLevelMax, GroupLevelMin = trajet.GroupLevelMin, CaptureItem = trajet.CaptureItem, MaxPod = trajet.MaxPod, MonsterQuantityMin = trajet.MonsterQuantityMin, MonsterQuantityMax = trajet.MonsterQuantityMax, ListRessource = trajet.ListRessource, LeaderBank = trajet.LeaderBank, IsCapture = trajet.IsCapture, Key = trajet.Key.ToString() }; pathToSend.PathAction = new List <PathActionModel>(); foreach (var item in trajet.PathAction) { PathActionModel pathactionmodelToAdd = new PathActionModel(); pathactionmodelToAdd.MapPos = Database.Maps.Find(o => o.Key == item.MapId).First().Coordinate.Replace(',', ';').Replace("[", "").Replace("]", ""); pathactionmodelToAdd.Actions = new List <MapActionModel>(); foreach (var action in item.Actions) { MapActionModel mapaction = new MapActionModel() { Order = action.Order }; if (action is FightAction) { FightActionModel fight = new FightActionModel() { IsAlone = ((FightAction)action).IsAlone }; mapaction.FightAction = fight; } else if (action is BankAction) { BankActionModel bank = new BankActionModel() { MapId = item.MapId }; mapaction.BankAction = bank; } else if (action is GatherAction) { GatherActionModel gather = new GatherActionModel() { }; mapaction.GatherAction = gather; } else if (action is InteractionAction) { InteractionActionModel interaction = new InteractionActionModel() { InteractiveidObject = ((InteractionAction)action).InteractiveIdObject, InteractiveIdResponse = ((InteractionAction)action).InteractiveIdResponse, ToBackBank = ((InteractionAction)action).ToBackBank, ToGoBank = ((InteractionAction)action).ToGoBank }; mapaction.InteractionAction = interaction; } else if (action is MoveAction) { MoveActionModel move = null; if (((MoveAction)action).Direction != null) { move = new MoveActionModel() { Cellid = ((MoveAction)action).CellId, ToGoBank = ((MoveAction)action).ToGoBank, ToBackBank = ((MoveAction)action).ToBackBank, Direction = ((MoveAction)action).Direction.ConvertAll(o => o.ToString()), MapId = ((MoveAction)action).MapId }; } else { move = new MoveActionModel() { Cellid = ((MoveAction)action).CellId, ToGoBank = ((MoveAction)action).ToGoBank, ToBackBank = ((MoveAction)action).ToBackBank, Direction = null, MapId = ((MoveAction)action).MapId }; } mapaction.moveAction = move; } else if (action is UseItemAction) { UseItemActionModel useitem = new UseItemActionModel() { ToBackBank = ((UseItemAction)action).ToBackBank, ItemId = ((UseItemAction)action).ItemId, ToGoBank = ((UseItemAction)action).ToGoBank }; mapaction.UseItemAction = useitem; } else if (action is ZaapAction) { ZaapActionModel zaap = new ZaapActionModel() { ToGoBank = ((ZaapAction)action).ToGoBank, ToBackBank = ((ZaapAction)action).ToBackBank, Destination = Database.Maps.Find(o => o.Key == ((ZaapAction)action).Destination).First().Coordinate.Replace(',', ';').Replace("[", "").Replace("]", ""), ZaapId = ((ZaapAction)action).ZaapId }; mapaction.ZaapAction = zaap; } else if (action is ZaapiAction) { ZaapiActionModel zaapi = new ZaapiActionModel() { ToGoBank = ((ZaapAction)action).ToGoBank, ToBackBank = ((ZaapAction)action).ToBackBank, Destination = Database.Maps.Find(o => o.Key == ((ZaapAction)action).Destination).First().Coordinate.Replace(',', ';').Replace("[", "").Replace("]", ""), ZaapiId = ((ZaapAction)action).ZaapId }; mapaction.ZaapiAction = zaapi; } pathactionmodelToAdd.Actions.Add(mapaction); } ; pathToSend.PathAction.Add(pathactionmodelToAdd); } ; return(pathToSend); }
/// <summary> /// Determine whether a special folder has physical information on current computer or not. /// </summary> /// <param name="specialFolder"></param> /// <returns>Path to special folder (if any) or null</returns> public static Task <string> SpecialFolderHasPathAsync(System.Environment.SpecialFolder specialFolder) { return(PathModel.SpecialFolderHasPathAsync(specialFolder)); }
protected List <ChartLine> AddAdditionalLines(PathModel path, List <decimal?> mainSavingsLine) { var additionalLine = new List <decimal?>(mainSavingsLine); return(additionalPathProcessor.Execute(path, additionalLine)); }
/// <summary> /// Create a new folder new standard sub folder in <paramref name="folderPath"/>. /// The new folder has a standard name like 'New folder n'. /// </summary> /// <param name="folderPath"></param> /// <param name="newDefaultFolderName">Compute default name for new folder</param> /// <returns>PathModel object to new folder or null</returns> public static Task <IPathModel> CreateDirAsync(IPathModel folderPath, string newDefaultFolderName = "New Folder") { return(PathModel.CreateDirAsync(folderPath, newDefaultFolderName)); }
//Border border = new Border(); /// <summary> /// /// </summary> /// <param name="orientation">0正向 1反向</param> /// <param name="data">路径数据</param> private void MatrixStory(UserControls.AgvCar agvCar, PathModel pathModel) { //border.Width = 10; //border.Height = 10; //border.Visibility = Visibility.Visible; //if (orientation == 0) //{ // border.Background = new SolidColorBrush(Colors.Blue); //} //else //{ // border.Background = new SolidColorBrush(Colors.Green); //} //if (!this.MainContent.Children.Contains(agvCar)) //{ // this.MainContent.Children.Add(agvCar); //} Canvas.SetLeft(agvCar, -agvCar.Width / 2); Canvas.SetTop(agvCar, -agvCar.Height / 2); agvCar.RenderTransformOrigin = new Point(0.5, 0.5); MatrixTransform matrix = new MatrixTransform(); TransformGroup groups = new TransformGroup(); groups.Children.Add(matrix); agvCar.RenderTransform = groups; //NameScope.SetNameScope(this, new NameScope()); string registname = "matrix" + Guid.NewGuid().ToString().Replace("-", ""); agvCar.RegisterName(registname, matrix); MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath(); //matrixAnimation.PathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse( ( mainContent.FindChild(path.Key.ToString() + path.Value.ToString()) as Path ) .Data )); matrixAnimation.PathGeometry = PathGeometry.CreateFromGeometry(mainContent.FindChild <Path>(pathModel.Name).Data); matrixAnimation.Duration = new Duration(TimeSpan.FromSeconds(10)); matrixAnimation.DoesRotateWithTangent = false;//旋转 matrixAnimation.AccelerationRatio = 0.4; matrixAnimation.DecelerationRatio = 0.4; //matrixAnimation.FillBehavior //matrixAnimation.FillBehavior = FillBehavior.Stop; Storyboard story = new Storyboard(); story.Children.Add(matrixAnimation); Storyboard.SetTargetName(matrixAnimation, registname); Storyboard.SetTargetProperty(matrixAnimation, new PropertyPath(MatrixTransform.MatrixProperty)); //#region 控制显示与隐藏 //ObjectAnimationUsingKeyFrames ObjectAnimation = new ObjectAnimationUsingKeyFrames(); //ObjectAnimation.Duration = matrixAnimation.Duration; //DiscreteObjectKeyFrame kf1 = new DiscreteObjectKeyFrame(Visibility.Visible, TimeSpan.FromMilliseconds(1)); //ObjectAnimation.KeyFrames.Add(kf1); //story.Children.Add(ObjectAnimation); ////Storyboard.SetTargetName(border, border.Name); //Storyboard.SetTargetProperty(ObjectAnimation, new PropertyPath(UIElement.VisibilityProperty)); //#endregion story.FillBehavior = FillBehavior.HoldEnd; agvCar.Tag = story; story.Begin(agvCar, true); }
/// <summary> /// Load all sub-folders into the Folders collection via /// Async method with complete list return. /// </summary> public static async Task <IEnumerable <IPathModel> > LoadFoldersAsync(string fullPath) { return(await PathModel.LoadFoldersAsync(fullPath)); }
/// <summary> /// Returns a normalized directory reference from a path reference /// or the parent directory path if the <paramref name="dirPath"/> /// reference points to a file. /// </summary> /// <param name="dirPath"></param> /// <returns></returns> public static string ExtractDirectoryRoot(string dirPath) { return(PathModel.ExtractDirectoryRoot(dirPath)); }
/// <summary> /// Compare 2 <see cref="string"/> objects that represent a path /// and returns false if they are equal. /// </summary> /// <param name="path"></param> /// <param name="path1"></param> /// <returns></returns> public static bool Compare(string path, string path1) { return(PathModel.Compare(path, path1)); }
/// <summary> /// Determine whether a given path is an existing directory or not. /// </summary> /// <param name="path"></param> /// <returns>true if this directory exists and otherwise false</returns> public static bool DirectoryPathExists(string path) { return(PathModel.DirectoryPathExists(path)); }
/// <summary> /// Make sure that a path reference does actually work with /// <see cref="System.IO.DirectoryInfo"/> by replacing 'C:' by 'C:\'. /// </summary> /// <param name="dirOrfilePath"></param> /// <returns></returns> public static string NormalizePath(string dirOrfilePath) { return(PathModel.NormalizePath(dirOrfilePath)); }
/// <summary> /// Determine whether a given path is an existing directory or not. /// </summary> /// <param name="path"></param> /// <returns>true if this directory exists and otherwise false</returns> public static Task <bool> DirectoryPathExistsAsync(string path) { return(PathModel.DirectoryPathExistsAsync(path)); }
public LibParser(PathModel path, Context context) { this.path = path; this.context = context; }
/// <summary> /// Split the current folder in an array of sub-folder names and return it. /// </summary> /// <returns>Returns a string array of su-folder names (including drive) or null if there are no sub-folders.</returns> public static string[] GetDirectories(string folder) { return(PathModel.GetDirectories(folder)); }
public FileModel(PathModel model) : base(model) { mFile = new FileInfo(model.Path); }
/// <summary> /// Split the current folder in an array of sub-folder names and return it. /// </summary> /// <returns>Returns a string array of su-folder names (including drive) or null if there are no sub-folders.</returns> public static Task <string[]> GetDirectoriesAsync(string path) { return(PathModel.GetDirectoriesAsync(path)); }
/// <summary> /// Parameterized class constructor /// </summary> public FileSystemModel(PathModel model) { mModel = model; Debug.Assert(model != null, "Construction of FSItem without PathModel is not supported!"); }
/// <summary> /// Joins all string elements in <paramref name="dirs"/> tp one valid string. /// Inverse function of string[] GetDirectories(string path) method. /// </summary> /// <param name="dirs"></param> /// <param name="idxStart"></param> /// <param name="idxEnd"></param> /// <returns></returns> public static string Join(string[] dirs, int idxStart, int idxEnd) { return(PathModel.Join(dirs, idxStart, idxEnd)); }
public DriveModel(PathModel model) : base(model) { mDrive = new DriveInfo(model.Path); }
public UpdatePath(PathModel component) { urlData.Add("paths"); urlData.Add("update"); postData.Add("data", JsonConvert.SerializeObject(component, Formatting.None, new JsonConverter[] { new Vector2Converter() })); }