本文整理汇总了C#中WinterLeaf.Engine.Classes.View.Creators.ObjectCreator.delete方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectCreator.delete方法的具体用法?C# ObjectCreator.delete怎么用?C# ObjectCreator.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WinterLeaf.Engine.Classes.View.Creators.ObjectCreator
的用法示例。
在下文中一共展示了ObjectCreator.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createAndConnectToLocalServer
public static bool createAndConnectToLocalServer(string serverType, string level)
{
if (!createServer(serverType, level))
return false;
GameConnection conn = new ObjectCreator("GameConnection", "ServerConnection", t3d.sGlobal["$Pref::Server::Net::ClientGameConnectionModelClass"]).Create();
((SimGroup) "RootGroup").add(conn);
conn.setConnectArgs(t3d.sGlobal["$pref::Player::Name"]);
conn.setJoinPassword(t3d.sGlobal["$Client::Password"]);
if (conn.connectLocal() != string.Empty)
{
conn.delete();
destroyServer();
return false;
}
return true;
}
示例2: EditorSaveMissionAs
//.........这里部分代码省略.........
case DialogResult.Ignore:
case DialogResult.No:
case DialogResult.Cancel:
case DialogResult.None:
return;
}
}
if (omni.Util.fileExt(missionName) != ".mis")
missionName = missionName + ".mis";
EWorldEditor.isDirty = true;
string saveMissionFile = omni.sGlobal["$Server::MissionFile"];
omni.sGlobal["$Server::MissionFile"] = missionName;
bool copyTerrainsFailed = false;
// Rename all the terrain files. Save all previous names so we can
// reset them if saving fails.
string newMissionName = omni.Util.fileBase(missionName);
string oldMissionName = omni.Util.fileBase(saveMissionFile);
omni.Util.initContainerTypeSearch(omni.uGlobal["$TypeMasks::TerrainObjectType"]);
ScriptObject savedTerrNames = new ObjectCreator("ScriptObject").Create();
for (int i = 0;; i++)
{
string nterrainObject = omni.Util.containerSearchNext(false);
if (nterrainObject == "")
break;
TerrainBlock terrainObject = nterrainObject; //omni.Util.containerSearchNext(false);
//if (terrainObject == null)
// break;
savedTerrNames["array[" + i + "]"] = terrainObject["terrainFile"];
string terrainFilePath = omni.Util.makeRelativePath(omni.Util.filePath(terrainObject["terrainFile"]), omni.Util.getMainDotCsDir());
string terrainFileName = omni.Util.fileName(terrainObject["terrainFile"]);
// Workaround to have terrains created in an unsaved "New Level..." mission
// moved to the correct place.
if (EditorGui["saveAs"].AsBool() && terrainFilePath == "tools/art/terrains")
terrainFilePath = "art/terrains";
// Try and follow the existing naming convention.
// If we can't, use systematic terrain file names.
if (omni.Util.strstr(terrainFileName, oldMissionName) >= 0)
terrainFileName = omni.Util.strreplace(terrainFileName, oldMissionName, newMissionName);
else
terrainFileName = newMissionName + "_" + i + ".ter";
string newTerrainFile = terrainFilePath + "/" + terrainFileName;
if (!omni.Util.isWriteableFileName(newTerrainFile))
{
if (omni.Util.messageBox("Error", "Terrain file \"" + newTerrainFile + "\" is read-only. Continue?", "Ok", "Stop") == omni.iGlobal["$MROk"])
continue;
else
{
copyTerrainsFailed = true;
break;
}
}
if (!terrainObject.save(newTerrainFile))
{
omni.Util._error("Failed to save '" + newTerrainFile + "'");
copyTerrainsFailed = true;
break;
}
terrainObject["terrainFile"] = newTerrainFile;
}
ETerrainEditor.isDirty = false;
// Save the mission.
if (copyTerrainsFailed || !EditorSaveMission())
{
// It failed, so restore the mission and terrain filenames.
omni.sGlobal["$Server::MissionFile"] = saveMissionFile;
omni.Util.initContainerTypeSearch(omni.uGlobal["$TypeMasks::TerrainObjectType"], false);
for (int i = 0;; i++)
{
TerrainBlock terrainObject = omni.Util.containerSearchNext(false);
if (terrainObject == null)
break;
terrainObject["terrainFile"] = savedTerrNames["array[" + i + "]"];
}
}
savedTerrNames.delete();
}
else
EditorSaveMissionMenuDisableSave();
}
示例3: loadFilter
public void loadFilter(string selectedFilter, string staticFilter = "")
{
ArrayObject MatEdScheduleArray = "MatEdScheduleArray";
ArrayObject MatEdPreviewArray = "MatEdPreviewArray";
GuiDynamicCtrlArrayControl materialSelection = this.FOT("materialSelection");
GuiStackControl materialPreviewPagesStack = this.FOT("materialPreviewPagesStack");
GuiPopUpMenuCtrlEx materialPreviewCountPopup = this.FOT("materialPreviewCountPopup");
// manage schedule array properly
if (!MatEdScheduleArray.isObject())
MatEdScheduleArray = new ObjectCreator("ArrayObject", "MatEdScheduleArray").Create();
// if we select another list... delete all schedules that were created by
// previous load
for (int i = 0; i < MatEdScheduleArray.count(); i++)
Util.cancel(MatEdScheduleArray.getKey(i).AsInt());
// we have to empty out the list; so when we create new schedules, these dont linger
MatEdScheduleArray.empty();
// manage preview array
if (!MatEdPreviewArray.isObject())
MatEdPreviewArray = new ObjectCreator("ArrayObject", "MatEdPreviewArray").Create();
// we have to empty out the list; so when we create new guicontrols, these dont linger
MatEdPreviewArray.empty();
materialSelection.deleteAllObjects();
materialPreviewPagesStack.deleteAllObjects();
// changed to accomadate tagging. dig through the array for each tag name,
// call unique value, sort, and we have a perfect set of materials
if (staticFilter != "")
this.currentStaticFilter = staticFilter;
this.currentFilter = selectedFilter;
ArrayObject filteredObjectsArray = new ObjectCreator("ArrayObject").Create();
int previewsPerPage = materialPreviewCountPopup.getTextById(materialPreviewCountPopup.getSelected()).AsInt();
int tagCount = Util.getWordCount(this.currentFilter);
if (tagCount != 0)
{
for (int j = 0; j < tagCount; j++)
{
for (int i = 0; i < this.currentStaticFilter.count(); i++)
{
string currentTag = Util.getWord(this.currentFilter, j);
if (this.currentStaticFilter.getKey(i) == currentTag)
filteredObjectsArray.add(this.currentStaticFilter.getKey(i), this.currentStaticFilter.getValue(i));
}
}
filteredObjectsArray.uniqueValue();
filteredObjectsArray.sortd();
this.totalPages = Util.mCeil(filteredObjectsArray.count()/previewsPerPage);
//Can we maintain the current preview page, or should we go to page 1?
if ((this.currentPreviewPage*previewsPerPage) >= filteredObjectsArray.count())
this.currentPreviewPage = 0;
// Build out the pages buttons
this.buildPagesButtons(this.currentPreviewPage, this.totalPages);
int previewCount = previewsPerPage;
int possiblePreviewCount = filteredObjectsArray.count() - this.currentPreviewPage*previewsPerPage;
if (possiblePreviewCount < previewCount)
previewCount = possiblePreviewCount;
int start = this.currentPreviewPage*previewsPerPage;
for (int i = start; i < start + previewCount; i++)
this.buildPreviewArray(filteredObjectsArray.getValue(i));
filteredObjectsArray.delete();
}
else
{
this.currentStaticFilter.sortd();
// Rebuild the static filter list without tagged materials
ArrayObject noTagArray = new ObjectCreator("ArrayObject").Create();
for (int i = 0; i < this.currentStaticFilter.count(); i++)
{
if (this.currentStaticFilter.getKey(i) != "")
continue;
SimObject material = this.currentStaticFilter.getValue(i);
// CustomMaterials are not available for selection
if (!material.isObject() || material.isMemberOfClass("CustomMaterial"))
continue;
noTagArray.add("", material);
}
this.totalPages = Util.mCeil(noTagArray.count()/previewsPerPage);
//Can we maintain the current preview page, or should we go to page 1?
//.........这里部分代码省略.........
示例4: loadMaterialFilters
public void loadMaterialFilters()
{
ArrayObject MaterialFilterAllArray = "MaterialFilterAllArray";
GuiDynamicCtrlArrayControl filterArray = this.FOT("filterArray");
ArrayObject filteredTypesArray = new ObjectCreator("ArrayObject").Create();
filteredTypesArray.duplicate(MaterialFilterAllArray);
filteredTypesArray.uniqueKey();
// sort the the keys before we do anything
filteredTypesArray.sortkd();
Util.eval(this.currentStaticFilter.name + "Checkbox.setStateOn(1);");
// it may seem goofy why the checkbox can't be instanciated inside the container
// reason being its because we need to store the checkbox ctrl in order to make changes
// on it later in the function.
string selectedFilter = "";
for (int i = 0; i < filteredTypesArray.count(); i++)
{
string filter = filteredTypesArray.getKey(i);
if (filter == "")
continue;
#region GuiControl () oc_Newobject67
ObjectCreator oc_Newobject67 = new ObjectCreator("GuiControl", "");
oc_Newobject67["profile"] = "ToolsGuiDefaultProfile";
oc_Newobject67["Position"] = "0 0";
oc_Newobject67["Extent"] = "128 18";
oc_Newobject67["HorizSizing"] = "right";
oc_Newobject67["VertSizing"] = "bottom";
oc_Newobject67["isContainer"] = "1";
#endregion
GuiControl container = oc_Newobject67.Create();
#region GuiCheckBoxCtrl () oc_Newobject68
ObjectCreator oc_Newobject68 = new ObjectCreator("GuiCheckBoxCtrl", "");
oc_Newobject68["Profile"] = "ToolsGuiCheckBoxListProfile";
oc_Newobject68["position"] = "5 1";
oc_Newobject68["Extent"] = "118 18";
oc_Newobject68["Command"] = "";
oc_Newobject68["groupNum"] = "0";
oc_Newobject68["buttonType"] = "ToggleButton";
oc_Newobject68["text"] = filter + " ( " + MaterialFilterAllArray.countKey(filter) + " )";
oc_Newobject68["filter"] = filter;
oc_Newobject68["Command"] = "MaterialSelector.preloadFilter();";
#endregion
GuiCheckBoxCtrl checkbox = oc_Newobject68.Create();
container.add(checkbox);
filterArray.add(container);
int tagCount = Util.getWordCount(this.currentFilter);
for (int j = 0; j < tagCount; j++)
{
if (filter == Util.getWord(this.currentFilter, j))
{
if (selectedFilter == "")
selectedFilter = filter;
else
selectedFilter = selectedFilter + " " + filter;
checkbox.setStateOn(true);
}
}
}
this.loadFilter(selectedFilter);
filteredTypesArray.delete();
}
示例5: save
//.........这里部分代码省略.........
currentFile = GuiEditor["LastPath"] + "/" + name;
currentFile = Util.makeRelativePath(currentFile, Util.getMainDotCsDir());
}
else
currentFile = Util._expandFilename(name);
}
else
currentFile = Util._expandFilename(currentFile);
}
// Get the filename.
string filename;
if (!noPrompt)
{
filename = GuiEditorFileDialog.GuiBuilder.GetSaveName(currentFile);
// console.Call_Classname("GuiBuilder", "getSaveName", new string[] {currentFile} );
if (filename == "")
return;
}
else
filename = currentFile;
// Save the Gui.
if (Util.isWriteableFileName(filename))
{
//
// Extract any existent TorqueScript before writing out to disk
//
FileObject fileObject = new ObjectCreator("FileObject").Create();
fileObject.openForRead(filename);
bool skipLines = true;
bool beforeObject = true;
// var++ does not post-increment var, in torquescript, it pre-increments it,
// because ++var is illegal.
//int lines = -1;
//int beforeLines = -1;
skipLines = false;
//string[] beforeNewFileLines = new string[]{};
//string[] newFileLines = new string[]{};
List<string> beforeNewFileLines = new List<string>();
List<string> newFileLines = new List<string>();
while (!fileObject.isEOF())
{
string line = fileObject.readLine();
if (line == "//--- OBJECT WRITE BEGIN ---")
skipLines = true;
else if (line == "//--- OBJECT WRITE END ---")
{
skipLines = false;
beforeObject = false;
}
else if (skipLines == false)
{
if (beforeObject)
beforeNewFileLines.Add(line);
//beforeNewFileLines[ beforeLines++ ] = line;
else
//newFileLines[ lines++ ] = line;
newFileLines.Add(line);
}
}
fileObject.close();
fileObject.delete();
FileObject fo = new ObjectCreator("FileObject").Create();
fo.openForWrite(filename);
// Write out the captured TorqueScript that was before the object before the object
foreach (string line in beforeNewFileLines)
fo.writeLine(line);
//for(int i = 0; i <= beforeLines; i++)
// fo.writeLine( beforeNewFileLines[ i ] );
fo.writeLine("//--- OBJECT WRITE BEGIN ---");
fo.writeObject(currentObject, "%guiContent = ");
fo.writeLine("//--- OBJECT WRITE END ---");
// Write out captured TorqueScript below Gui object
//for( int i = 0; i <= lines; i++ )
// fo.writeLine( newFileLines[ i ] );
foreach (string line in newFileLines)
fo.writeLine(line);
fo.close();
fo.delete();
currentObject.setFilename(Util.makeRelativePath(filename, Util.getMainDotCsDir()));
GuiEditorStatusBar.print("Saved file '" + currentObject.getFilename() + "'");
}
else
Util.messageBox("Error writing to file", "There was an error writing to file '" + currentFile + "'. The file may be read-only.", "Ok", "Error");
}
示例6: onWake
public override void onWake()
{
string text = "";
FileObject f = new ObjectCreator("FileObject").Create();
f.openForRead(this["fileName"]);
while (!f.isEOF())
text = text + f.readLine() + "\n";
f.delete();
((GuiMLTextCtrl) FOT("TextBox")).setText(text);
}
示例7: onControlInspectPostApply
public override void onControlInspectPostApply(GuiControl control)
{
GuiEditorTreeView GuiEditorTreeView = "GuiEditorTreeView";
SimSet set = new ObjectCreator("SimSet").Create();
set.add(control);
this.onPostEdit(set);
set.delete();
GuiEditorTreeView.update();
}
示例8: sfxAutodetect
public static bool sfxAutodetect()
{
// Get all the available devices.
string devices = omni.Util.sfxGetAvailableDevices();
// Collect and sort the devices by preferentiality.
int count = omni.Util.getRecordCount(devices);
ArrayObject deviceTrySequence = new ObjectCreator("ArrayObject").Create().AsString();
for (int i = 0; i < count; i++)
{
string info = omni.Util.getRecord(devices, i);
string provider = omni.Util.getField(info, 0);
deviceTrySequence.push_back(provider, info);
}
deviceTrySequence.sortfk("sfxCompareProvider");
// Try the devices in order.
count = deviceTrySequence.count();
for (int i = 0; i < count; i++)
{
string provider = deviceTrySequence.getKey(i);
string info = deviceTrySequence.getValue(i);
omni.sGlobal["$pref::SFX::provider"] = provider;
omni.sGlobal["$pref::SFX::device"] = omni.Util.getField(info, 1);
omni.sGlobal["$pref::SFX::useHardware"] = omni.Util.getField(info, 2);
// By default we've decided to avoid hardware devices as
// they are buggy and prone to problems.
omni.bGlobal["$pref::SFX::useHardware"] = false;
if (!sfxInit())
continue;
omni.bGlobal["$pref::SFX::autoDetect"] = false;
deviceTrySequence.delete();
return true;
}
// Found no suitable device.
omni.console.error("sfxAutodetect - Could not initialize a valid SFX device.");
omni.sGlobal["$pref::SFX::provider"] = "";
omni.sGlobal["$pref::SFX::device"] = "";
omni.sGlobal["$pref::SFX::useHardware"] = "";
deviceTrySequence.delete();
return false;
}
示例9: onAddNewCtrl
public override void onAddNewCtrl(GuiControl ctrl)
{
GuiEditorUndo.UndoActionAddObject UndoActionAddObject = "UndoActionAddObject";
GuiEditorTreeView GuiEditorTreeView = "GuiEditorTreeView";
SimSet set = new ObjectCreator("SimSet").Create();
set.add(ctrl);
GuiEditorUndo.UndoActionAddObject act = UndoActionAddObject.create(set, this.getTrash(), GuiEditorTreeView, false);
set.delete();
act.addToManager(this.getUndoManager());
this.updateUndoMenu();
//GuiEditorInspectFields.update(0);
}
示例10: onControlInspectPreApply
public override void onControlInspectPreApply(GuiControl control)
{
SimSet set = new ObjectCreator("SimSet").Create();
set.add(control);
this.onPreEdit(set);
this.pendingGenericUndoAction.actionName = "Change Properties";
set.delete();
}
示例11: deleteControl
public void deleteControl(SimObject ctrl)
{
GuiEditorUndo.UndoActionDeleteObject UndoActionDeleteObject = "UndoActionDeleteObject";
GuiEditorTreeView GuiEditorTreeView = "GuiEditorTreeView";
// Unselect.
this.removeSelection(ctrl);
// Record undo.
SimSet set = new ObjectCreator("SimSet").Create();
set.parentGroup = "RootGroup";
set.add(ctrl);
GuiEditorUndo.UndoActionDeleteObject action = UndoActionDeleteObject.create(set, this.getTrash(), GuiEditorTreeView, true);
action.addToManager(this.getUndoManager());
this.updateUndoMenu();
GuiEditorTreeView.update();
set.delete();
// Remove.
((SimSet) this.getTrash()).add(ctrl);
}
示例12: loadLights
public void loadLights()
{
SimGroup MissionGroup = "MissionGroup";
EditorTree EditorTree = "EditorTree";
// Get the ID of the last object added
SimObject obj = MissionGroup.getObject((uint) MissionGroup.getCount() - 1);
// Create a new SimGroup to hold the model and lights
SimGroup group = new ObjectCreator("SimGroup").Create();
Util.loadColladaLights(this.path, group, obj);
// Delete the SimGroup if no lights were found. Otherwise, add the model to
// the group as well.
if (group.getCount() > 0)
{
group.add(obj);
group.bringToFront(obj);
MissionGroup.add(group);
if (EditorTree.isVisible())
{
EditorTree.removeItem(EditorTree.findItemByObjectId(obj));
EditorTree.buildVisibleTree(true);
}
}
else
group.delete();
}
示例13: writeDtsConfig
public void writeDtsConfig()
{
string filename = Util.filePath(this.path) + "/" + Util.fileBase(this.path) + ".cfg";
FileObject fo = new ObjectCreator("FileObject").Create();
if (fo.openForWrite(filename))
{
// AlwaysImport
fo.writeLine("AlwaysExport:");
string alwaysImport = Util.trim(Util.strreplace(((GuiTextEditCtrl) this.FOT("alwaysImport")).getText(), ";", "\t"));
int count1 = Util.getFieldCount(alwaysImport);
for (int i = 0; i < count1; i++)
fo.writeLine(Util.getField(alwaysImport, i));
fo.writeLine("");
// NeverImport
fo.writeLine("NeverExport:");
string neverImport = Util.trim(Util.strreplace(((GuiTextEditCtrl) this.FOT("neverImport")).getText(), ";", "\t"));
int count = Util.getFieldCount(neverImport);
for (int i = 0; i < count; i++)
fo.writeLine(Util.getField(neverImport, i));
fo.writeLine("");
fo.close();
}
else
Util._error("Failed to open " + filename + " for writing");
fo.delete();
}
示例14: readDtsConfig
public void readDtsConfig()
{
string filename = Util.filePath(this.path) + "/" + Util.fileBase(this.path) + ".cfg";
string filename2 = Util.filePath(this.path) + "/" + "dtsScene.cfg";
FileObject fo = new ObjectCreator("FileObject").Create();
if (fo.openForRead(filename) || fo.openForRead(filename2))
{
string alwaysImport = "";
string neverImport = "";
string mode = "none";
while (!fo.isEOF())
{
string line = Util.trim(fo.readLine());
if (line == "AlwaysExport:") // Start of the AlwaysExport list
mode = "always";
else if (line == "NeverExport:") // Start of the NeverExport list
mode = "never";
else if (Util.startsWith(line, "+", false) || Util.startsWith(line, "-", false))
// Boolean parameters (not supported)
mode = "none";
else if (Util.startsWith(line, "=", false)) // Float and integer parameters (not supported)
mode = "none";
else if (!Util.startsWith(line, "//", false)) // Non-commented lines
{
switch (mode)
{
case "always":
alwaysImport = alwaysImport + '\t' + line;
break;
case "never":
neverImport = neverImport + '\t' + line;
break;
}
}
}
fo.close();
alwaysImport = Util.strreplace(Util.trim(alwaysImport), "\t", ";");
neverImport = Util.strreplace(Util.trim(neverImport), "\t", ";");
((GuiTextEditCtrl) this.FOT(alwaysImport)).setText(alwaysImport);
((GuiTextEditCtrl) this.FOT(neverImport)).setText(neverImport);
}
else
Util._error("Failed to open " + filename + " or " + filename2 + " for reading");
fo.delete();
}
示例15: setViewTypeAlphabetical
public void setViewTypeAlphabetical()
{
GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";
string controls = Util.enumerateConsoleClassesByCategory("Gui");
ArrayObject classes = new ObjectCreator("ArrayObject").Create();
// Collect relevant classes.
foreach (string className in controls.Split('\t'))
{
if (GuiEditor.isFilteredClass(className) || !(Util.isMemberOfClass(className, "GuiControl")))
continue;
classes.push_back(className, "");
}
// Sort classes alphabetically.
classes.sortk(true);
// Add toolbox buttons.
int numClasses = classes.count();
for (int i = 0; i < numClasses; i ++)
{
string className = classes.getKey(i);
#region GuiIconButtonCtrl () oc_Newobject2
ObjectCreator oc_Newobject2 = new ObjectCreator("GuiIconButtonCtrl", "", typeof (GuiEditorToolboxButton));
oc_Newobject2["profile"] = "ToolsGuiIconButtonSmallProfile";
oc_Newobject2["extent"] = "128 18";
oc_Newobject2["text"] = className;
oc_Newobject2["iconBitmap"] = console.Call_Classname("EditorIconRegistry", "findIconByClassName", new string[] {className});
oc_Newobject2["buttonMargin"] = "2 2";
oc_Newobject2["iconLocation"] = "left";
oc_Newobject2["textLocation"] = "left";
oc_Newobject2["textMargin"] = "24";
oc_Newobject2["AutoSize"] = new Creator.StringNoQuote("true");
oc_Newobject2["command"] = "GuiEditor.createControl( " + className + " );";
oc_Newobject2["useMouseEvents"] = new Creator.StringNoQuote("true");
oc_Newobject2["tooltip"] = className + '\n' + "\n" + Util.getDescriptionOfClass(className);
oc_Newobject2["tooltipProfile"] = "ToolsGuiToolTipProfile";
#endregion
GuiIconButtonCtrl ctrl = oc_Newobject2.Create();
this.add(ctrl);
}
classes.delete();
this.currentViewType = "Alphabetical";
}