Skip to content
Snippets Groups Projects
Commit c874c8b7 authored by Reeves, David E's avatar Reeves, David E
Browse files

* cleaned up snippets

* added ability to strip imports and comments
parent c7dea410
No related branches found
No related tags found
No related merge requests found
Showing
with 71 additions and 12 deletions
No preview for this file type
......@@ -77,7 +77,12 @@ namespace CodeCompleteTool
int ss = selStar - initIndex;
//Console.WriteLine("Test: " + test + " - " + ss + " - " + selLen);
if (selLen == 0)
if (Selecting.Length==0)
{
ResetList();
UpdateSelection(Selecting);
}
else if (selLen == 0)
{
Selecting = Selecting.Substring(0, Selecting.Length - 1);
ResetList();
......@@ -227,7 +232,7 @@ namespace CodeCompleteTool
{
while ((str = readtext.ReadLine()) != null)
{
if (str == null || str.Length == 0 || str.StartsWith("#") || str.StartsWith("//")
if (str == null || str.Length == 0 || str.StartsWith("//")
|| str.Trim().Length==0)
continue;
lines.Add(str);
......@@ -360,7 +365,7 @@ namespace CodeCompleteTool
{
CodeCompleteLabel form = new CodeCompleteLabel();
form.Width = 200;
form.Width = 400;
form.SuspendLayout();
form.Label = new CCLabel();
......
......@@ -108,6 +108,33 @@
<ItemGroup>
<EmbeddedResource Include="res\observe_sector_fixed.snp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="res\execute_order.snp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="res\get_control_measure.snp" />
<EmbeddedResource Include="res\get_dmi.snp" />
<EmbeddedResource Include="res\get_entity.snp" />
<EmbeddedResource Include="res\get_entity_heading.snp" />
<EmbeddedResource Include="res\get_entity_location.snp" />
<EmbeddedResource Include="res\get_last_trigger.snp" />
<EmbeddedResource Include="res\get_move_order_route.snp" />
<EmbeddedResource Include="res\get_orbit_locations.snp" />
<EmbeddedResource Include="res\get_orbit_order_route.snp" />
<EmbeddedResource Include="res\get_param.snp" />
<EmbeddedResource Include="res\get_sensor.snp" />
<EmbeddedResource Include="res\get_target_list.snp" />
<EmbeddedResource Include="res\get_unit_name.snp" />
<EmbeddedResource Include="res\get_var.snp" />
<EmbeddedResource Include="res\get_weapon_list.snp" />
<EmbeddedResource Include="res\if_last_trigger.snp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="res\loop_over_unit.snp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="res\set_var.snp" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CodeCompleteTool
{
......@@ -24,7 +25,7 @@ namespace CodeCompleteTool
{
string[] descs = data[0].Split('|');
SnippetName = descs[0];
SnippetHelp = "Snippet: " + descs[1];
//SnippetHelp = "Snippet: " + descs[1];
List<string> rd = new List<string>();
List<string> imp = new List<string>();
List<string> cd = new List<string>();
......@@ -46,10 +47,21 @@ namespace CodeCompleteTool
Import = imp.ToArray();
Code = cd.ToArray();
string helpStr = "";
foreach (string i in Import)
{
helpStr += i + Environment.NewLine;
}
foreach (string c in Code)
{
helpStr += c + Environment.NewLine;
}
if (snippets == null)
{
snippets = new Dictionary<string, CodeSnippet>();
}
SnippetHelp = helpStr;
snippets[SnippetName] = this;
}
......@@ -59,18 +71,27 @@ namespace CodeCompleteTool
if (!snippets.ContainsKey(key))
return null;
bool strip = (Control.ModifierKeys & Keys.Control) == Keys.Control;
string desc = "";
CodeSnippet cs = snippets[key];
//foreach(string str in cs.RawData)
//{
// desc += str + Environment.NewLine;
//}
foreach (string str in cs.Import)
if (!strip)
{
desc += str + Environment.NewLine;
foreach (string str in cs.Import)
{
desc += str + Environment.NewLine;
}
}
foreach (string str in cs.Code)
{
if (strip && str.StartsWith("#"))
continue;
desc += str + Environment.NewLine;
}
......
add_goal|Add a goal to an entity. Goal is added to the "default" stack.
UtilityFuncsExp.%NAME(
UtilityFuncsExp.addGoal(
%NAME, # entity name string
%DELAY, # delay double
%GOALPATH, # goal path string
......
add_goal_specific|Add a goal to an entity. Goal is added to the specified stack.
UtilityFuncsExp.%NAME(
UtilityFuncsExp.addSpecificGoal(
%NAME, # entity name string
%DELAY, # delay double
%GOALPATH, # goal path string
......
add_replan_trigger|Add a replan trigger event to the tree
goalContainer.getCurrentExecutingStack().addReplanTrigger("%EVENT_NAME")
goalContainer.getCurrentExecutingStack().addReplanTrigger(%EVENT_NAME)
......@@ -4,4 +4,8 @@ import cxxi.model.behavior.OrderUtilities as OrderUtilities
# this action needs some work it's a place holder for now
prims = Vector()
ordr = orders.createOrder("HTN Plan Auto Generated", 0.0, prims)
orders.execute_options(ordr)
# pick one method
orders.addOrder(ordr)
orders.insertOrder(ordr)
orders.preemptCurrentOrder(ordr)
orders.preemptAllOrders(ordr)
get_weapon_list|Get the weapon list from the entity
if_last_trigger|If the last trigger encounted was a specific value
if state.getLastTrigger() == "do"+%TRIGGER_NAME:
# TODO: Add code
_htn_precon_ret = 1
observe_sector_relative|Start observe relative to the entity
observe_sector_fixed|Start observe in a fixed direction
sensorName = %SENSOR_NAME
# start observe
if obs.observeSectorFixed(sensorName, %DIRECTION, %FIELDOFREGARD_ANGLE): # direction angle of sensor double, for angle to scan double
......
set_var|Set tree variable
# %VAR_NAME name of the variable to set string
# %VALUE value of the object to set object
_gt_activeNode.putVar(%VAR_NAME, %VALUE)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment