void Start() { body = GetComponent <Rigidbody2D>(); pathToFollow = Path.GetComponent <CustomPath>(); target = pathToFollow.GetFirstNode(); }
private IEnumerable <Command> ValidateOfCreate(ProcedureParser context, string target, string subTarget) { List <Command> ret = new List <Command>(); CustomPath path = new CustomPath(subTarget); IProcedureParsable tempTarget = CustomPath.FindAssetWithPath(path); if (tempTarget != null) { Debug.Log($"{path} already exists."); return(ret); } else { List <string> tempTargets = CustomPath.FindAssetOnlyName(path); if (tempTargets.Count > 2) { Debug.Log($"{path} : have more than one."); ret.Add(new Command(DefaultCommandType.Log, $"{path} : have more than one.", $"Create {target} in {subTarget}")); return(ret); } else if (tempTargets.Count == 0) { return(null); } else { ret.Add(new Command(DefaultCommandType.Move, tempTargets[0], subTarget)); context.ChangeAllCommandPath(path.FilePath, tempTargets[0]); return(ret); } } }
private void BackToMainViewButton_OnClick(object sender, RoutedEventArgs e) { MainViewGrid.Visibility = Visibility.Visible; var iniFilePath = CustomPath.GetUserSettingIniPath(); IniUtility.WriteValue(IniSection, IniSection, nameof(MainViewGrid), iniFilePath); }
public override IEnumerable <Command> GenerateCommand(CustomPath path) { List <Command> ret = new List <Command>(); CustomPath refPath = path.GenerateLowerPath(Name + CustomPath.PrefabExtension); CustomPath compPath = refPath.GenerateLowerPath(IdComponent); ret.Add(new Command(DefaultCommandType.Create, nameof(TestComponent), compPath.FullPath)); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdStringValue).FullPath, StringValue)); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdIntValue).FullPath, IntValue.ToString())); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdFloatValuesLength).FullPath, FloatValues.Count.ToString())); for (int i = 0; i < FloatValues.Count; i++) { ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath($"{IdFloatValues}/{i}").FullPath, FloatValues[i].ToString())); } ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdColCenterX).FullPath, Collider.centerX.ToString())); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdColCenterY).FullPath, Collider.centerY.ToString())); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdColCenterZ).FullPath, Collider.centerZ.ToString())); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdExtentX).FullPath, Collider.extentX.ToString())); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdExtentY).FullPath, Collider.extentY.ToString())); ret.Add(new Command(DefaultCommandType.Set, compPath.GenerateLowerPath(IdExtentZ).FullPath, Collider.extentZ.ToString())); ret.AddRange(SubComponent.GenerateCommand(refPath)); return(ret); }
public override void MakeVisible(bool visible) { if (visible) { GD.Print("Visible"); curveCreate.Show(); curveEdit.Show(); curveDel.Show(); curveClose.Show(); handleMenu.Show(); sep.Show(); } else { GD.Print("Hide"); curveCreate.Hide(); curveEdit.Hide(); curveDel.Hide(); curveClose.Hide(); handleMenu.Hide(); sep.Hide(); { CustomPath pre = path; path = null; if (IsInstanceValid(pre) && IsInstanceValid(pre.curve)) { pre.curve.EmitSignal("changed"); } } } }
private void MoreOperationsButton_OnClick(object sender, RoutedEventArgs e) { MainViewGrid.Visibility = Visibility.Collapsed; var iniFilePath = CustomPath.GetUserSettingIniPath(); IniUtility.ClearSection(IniSection, iniFilePath); }
public override void Move() { //곡선으로 이동하는 것을 보이게 하기 위해 노드를 3개 사용한다. //노드 수를 홀수로 맞춰놓아야 이용이 가능하다. if (m_customIndex < m_customPath.m_nodeCount - 1) { m_pathdata = BetweenMove(m_customPath, m_customIndex); if (null != m_moveCommand) { CoroutineManager.Instance.Unregister(m_moveCommand); } m_moveCommand = CoroutineManager.Instance.Register(m_pathdata.FinishActionPutOnPath(this.transform, m_pathdata, true, () => Attack())); m_customIndex += 2; } else { m_customPath.m_nodes = GetReaptPatrolPath(m_customPath); m_customPath.NodeReset(); m_customIndex = 0; m_pathdata = BetweenMove(m_customPath, m_customIndex); if (null != m_moveCommand) { CoroutineManager.Instance.Unregister(m_moveCommand); } m_moveCommand = CoroutineManager.Instance.Register(m_pathdata.FinishActionPutOnPath(this.transform, m_pathdata, true, () => Attack())); m_customIndex += 2; } }
public PathGizmo(CustomPathEditorPlugin plugin, PathGizmoPlugin gizmoPlug, EditorInterface editor, CustomPath path) { this.editor = editor; this.path = path; this.plugin = plugin; gizmoPlugin = gizmoPlug; }
private IEnumerable <Command> ReactionOfMove(ProcedureParser context, string target, string subTarget) { CustomPath targetPath = new CustomPath(target), subTargetPath = new CustomPath(subTarget); AssetDatabase.MoveAsset(targetPath.FilePath, subTargetPath.FilePath); context.ChangeAllCommandPath(targetPath.FilePath, subTargetPath.FilePath); return(null); }
private void OnAddCustomPath(object sender, RoutedEventArgs e) { InstallationPaths?paths = CustomPath.GuiAddCustomPath(); if (paths != null) { this.AddInstallationPath(paths); } }
public override IEnumerable <Command> GenerateCommand(CustomPath path) { List <Command> ret = new List <Command>(); CustomPath objPath = GetReferencePath(path); ret.Add(new Command(DefaultCommandType.Create, nameof(TestSubScriptableObject), objPath.FullPath)); ret.Add(new Command(DefaultCommandType.Set, objPath.GenerateLowerPath(IdStrValue).FullPath, StrValue)); return(ret); }
public static List <string> GetFolders() { var iniFilePath = CustomPath.GetUserSettingIniPath(); //获取配置清理路径 var toCleanUpFolders = IniUtility.GetKeyValuesBySection(IniSection, iniFilePath); //重置待清理路径列表 var allFolders = ResetToCleanFolers(toCleanUpFolders, iniFilePath); return(allFolders); }
//곡선으로 이동하는 것을 보이게 하기 위해 노드를 3개 사용한다. public CustomPath BetweenMove(CustomPath customPath, int index) { CustomPath m_pathData = new CustomPath(); m_pathData.m_nodeCount = 3; m_pathData.m_nodes.Add(customPath.m_nodes[index]); m_pathData.m_nodes.Add(customPath.m_nodes[index + 1]); m_pathData.m_nodes.Add(customPath.m_nodes[index + 2]); return(m_pathData); }
public override IEnumerable <Command> GenerateCommand(CustomPath path) { List <Command> ret = new List <Command>(); CustomPath refPath = GetReferencePath(path); ret.Add(new Command(DefaultCommandType.Set, refPath.GenerateLowerPath(IdStringValue).FullPath, StringValue)); ret.Add(new Command(DefaultCommandType.Set, refPath.GenerateLowerPath(IdIntValue).FullPath, IntValue.ToString())); ret.Add(new Command(DefaultCommandType.Set, refPath.GenerateLowerPath(IdDataBool).FullPath, DataSet.BoolVal.ToString())); ret.Add(new Command(DefaultCommandType.Set, refPath.GenerateLowerPath(IdDataStr).FullPath, DataSet.StrVal)); return(ret); }
//custompath에 reapt체크 된것만 찾아서 역순으로 반환한다. public List <PathData> GetReaptPatrolPath(CustomPath m_customPath) { List <PathData> path = m_customPath.m_nodes.FindAll(rhs => rhs.Repeat == true); if (path.Count == 1) { Debug.LogError("ItweenPath : AutoPath Checkbox has one. : Recommend More than 1 or None Checkboxes [ex : 2, 3... or 0] "); } m_customPath.m_nodeCount = path.Count; path.Reverse(); return(path); }
public override void _ExitTree() { RemoveCustomType("Custom3DPath"); path = null; handleMenu.QueueFree(); curveClose.QueueFree(); curveDel.QueueFree(); curveCreate.QueueFree(); curveEdit.QueueFree(); RemoveSpatialGizmoPlugin(gizmoPlugin); gizmoPlugin = null; sep.QueueFree(); }
private static IEnumerable <Command> ValidateOfSet(ProcedureParser context, string target, string subTarget) { List <Command> ret = new List <Command>(); ret.Add(new Command(DefaultCommandType.Set, target, subTarget)); CustomPath path = new CustomPath(target); IProcedureParsable tempTarget = CustomPath.FindAssetWithPath(path); if (tempTarget == null) { if (context.WillBeCreated(new CustomPath(path.FilePath))) { Command buff = ret[0]; buff.PastValue = Command.NaN; ret[0] = buff; return(ret); } ret.Clear(); ret.Add(new Command(DefaultCommandType.Log, "CannotFoundTarget", $"Set {target} into {subTarget}")); return(ret); } if (path.FromLast(1).StartsWith(CustomPath.RefPrefix)) { string tempValue = tempTarget.Get($"{path.FromLast(1)}/{path.FromLast(0)}"); if (tempValue == subTarget) { ret.Clear(); } else { Command buff = ret[0]; buff.PastValue = tempValue; ret[0] = buff; } } else { string tempValue = tempTarget.Get(path.FromLast(0)); if (tempValue == subTarget) { ret.Clear(); } else { Command buff = ret[0]; buff.PastValue = tempValue; ret[0] = buff; } } return(ret); }
private IEnumerable <Command> ReactionOfCreate(ProcedureParser context, string target, string subTarget) { List <Command> ret = new List <Command>(); IProcedureParsable targetAsset = CreateNewObject(target); CustomPath targetPath = new CustomPath(subTarget); CustomPath assetPath = null; { int altIndex = 0; for (; altIndex < targetPath.Length; altIndex++) { if (targetPath.FromLast(altIndex).Contains(CustomPath.ExtensionDiff)) { break; } } assetPath = targetPath.GenerateHigherPath(altIndex); } Debug.LogWarning(assetPath?.FullPath); CustomPath tempPath = new CustomPath(Empty); for (int i = 0; i < assetPath.Length - 1; i++) { tempPath = tempPath.GenerateLowerPath(assetPath[i]); if (!AssetDatabase.IsValidFolder(tempPath.FullPath)) { Debug.Log($"{tempPath} creating directory"); AssetDatabase.CreateFolder(tempPath.GenerateHigherPath(1).FullPath, tempPath.FromLast(0)); } } if (targetAsset is ScriptableObject) { AssetDatabase.CreateAsset(targetAsset as ScriptableObject, assetPath.FullPath); targetAsset.InitializeAsset(); } else if (targetAsset is Component) { targetAsset.InitializeAsset(); PrefabUtility.SaveAsPrefabAsset((targetAsset as Component).gameObject, assetPath.FullPath); Object.DestroyImmediate((targetAsset as Component).gameObject); } else { ret.Add(new Command(DefaultCommandType.Log, "Invalid Type")); return(ret); } return(null); }
public override IEnumerable <Command> GenerateCommand(CustomPath path) { List <Command> ret = new List <Command>(); CustomPath refPath = GetReferencePath(path); foreach (TestScriptableObjectContainer t in TestScriptableObjects) { ret.AddRange(t.GenerateCommand(refPath)); } foreach (TestComponentContainer t in TestPrefabs) { ret.AddRange(t.GenerateCommand(refPath)); } return(ret); }
public void Start() { CharacterSetting(); m_customIndex = 0; m_rotSpeed = MoveSpeedTimeDelta * 20f; if (null != m_customPath) { m_pathdata = new CustomPath(); m_pathdata.m_nodeCount = 2; Move(); } else { Attack(); } }
private static string GetLogPath() { var currentDirectory = CustomPath.GetAppdataFolder(); var logFolder = Path.Combine(currentDirectory, "Log"); if (!Directory.Exists(logFolder)) { Directory.CreateDirectory(logFolder); } var iniFilePath = Path.Combine(logFolder, "output.txt"); if (!File.Exists(iniFilePath)) { var fileStream = File.Create(iniFilePath); fileStream.Close(); } return(iniFilePath); }
public override IEnumerable <Command> GenerateCommand(CustomPath path) { List <Command> ret = new List <Command>(); CustomPath objPath = GetReferencePath(path); ret.Add(new Command(DefaultCommandType.Create, nameof(TestScriptableObject), objPath.FullPath)); ret.Add(new Command(DefaultCommandType.Set, objPath.GenerateLowerPath(IdIntValue).FullPath, IntValue.ToString())); ret.Add(new Command(DefaultCommandType.Set, objPath.GenerateLowerPath(IdStringValue).FullPath, StringValue)); ret.Add(new Command(DefaultCommandType.Set, objPath.GenerateLowerPath(IdFloatValuesLength).FullPath, FloatValues.Count.ToString())); for (int i = 0; i < FloatValues.Capacity; i++) { ret.Add(new Command(DefaultCommandType.Set, objPath.GenerateLowerPath($"{IdFloatValues}/{i}").FullPath, FloatValues[i].ToString())); } ret.AddRange(SubObject.GenerateCommand(path)); ret.Add(new Command(DefaultCommandType.Set, objPath.GenerateLowerPath(IdSubObject).FullPath, SubObject.GetReferencePath(path).FullPath)); return(ret); }
private static IEnumerable <Command> ReactionOfSet(ProcedureParser context, string target, string subTarget) { List <Command> ret = new List <Command>(); CustomPath path = new CustomPath(target); IProcedureParsable tempTarget = CustomPath.FindAssetWithPath(path); if (tempTarget == null) { ret.Add(new Command(DefaultCommandType.Log, "CannotFoundTarget", $"Set {target} into {subTarget}")); return(ret); } if (path.FromLast(1).StartsWith(CustomPath.RefPrefix)) { tempTarget.Set($"{path.FromLast(1)}/{path.FromLast(0)}", subTarget); } else { tempTarget.Set(path.FromLast(0), subTarget); } return(null); }
public string GenerateTooltipText(Command com) { string ret = string.Empty; switch (com.Type) { case DefaultCommandType.Log: ret += $"<color=red>{com.Target}</color>"; break; case DefaultCommandType.Create: ret += $"<color=green>{com.Target}</color>"; break; case DefaultCommandType.Move: { CustomPath targetPath = new CustomPath(com.SubTarget); if (com.PastValue == MoveCommand.MoveTo) { ret += $"<color=#4080FF>{com.PastValue} {com.SubTarget}</color>"; } else { ret += $"<color=#4080FF>{com.PastValue} {com.Target}</color>"; } } break; case DefaultCommandType.Set: { CustomPath targetPath = new CustomPath(com.Target); ret += $"<color={(com.PastValue==Command.NaN?"green":"black")}>{targetPath.FromLast(0).Split('_').Last()} : {com.PastValue} -> {com.SubTarget}</color>"; } break; } return(ret); }
public void AddCommand(Command command) { string targetPath = new CustomPath(command.Target).FullPath, subTargetPath = new CustomPath(command.SubTarget).FullPath; switch (command.Type) { case DefaultCommandType.Log: GetRootNode().Commands.Add(command); break; case DefaultCommandType.Create: AddPath(subTargetPath); GetNode(subTargetPath).Commands.Add(command); break; case DefaultCommandType.Move: { Command cpy = command; cpy.PastValue = MoveCommand.MoveTo; AddPath(targetPath); GetNode(targetPath).Commands.Add(cpy); cpy.PastValue = MoveCommand.MoveFrom; AddPath(subTargetPath); GetNode(subTargetPath).Commands.Add(cpy); } break; case DefaultCommandType.Set: AddPath(targetPath); GetNode(targetPath).Commands.Add(command); break; default: throw new ArgumentOutOfRangeException(); } }
public MainWindow() { InitializeComponent(); //Loaded += MainWindow_Loaded; ViewTabControl.SelectedItem = ViewTabControl.Items.Cast <TabItem>().FirstOrDefault(); Loaded += (s, e) => { var iniFilePath = CustomPath.GetUserSettingIniPath(); Task.Run(() => { CleanCacheVeiwModel.Instance.RefreshCommand.Execute(null); }); //获取配置清理路径 var viewName = IniUtility.ReadValue(IniSection, IniSection, iniFilePath); if (string.IsNullOrWhiteSpace(viewName)) { MainViewGrid.Visibility = Visibility.Visible; } else { MainViewGrid.Visibility = viewName == nameof(MainViewGrid) ? Visibility.Visible : Visibility.Collapsed; } }; }
public override void Edit(Godot.Object obj) { if (IsInstanceValid(obj)) { if (obj is CustomPath pth) { path = pth; if (IsInstanceValid(path.curve)) { path.curve.EmitSignal("changed"); } GD.Print("Edit"); } } else { CustomPath pre = path; path = null; if (IsInstanceValid(pre)) { pre.curve.EmitSignal("changed"); } } }
public override CustomPath GetReferencePath(CustomPath path) { return(path.GenerateLowerPath(Name + CustomPath.PrefabExtension)); }
public abstract CustomPath GetReferencePath(CustomPath path);
public abstract IEnumerable <Command> GenerateCommand(CustomPath path);