本文整理汇总了C#中ICodeBlock.Line方法的典型用法代码示例。如果您正苦于以下问题:C# ICodeBlock.Line方法的具体用法?C# ICodeBlock.Line怎么用?C# ICodeBlock.Line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICodeBlock
的用法示例。
在下文中一共展示了ICodeBlock.Line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateInitializeEnd
public override void GenerateInitializeEnd(ICodeBlock codeBlock)
{
codeBlock.Line("#if DEBUG && WINDOWS");
codeBlock.Line("InitializeFileWatch();");
codeBlock.Line("#endif");
}
示例2: GenerateFields
public override ICodeBlock GenerateFields(ICodeBlock codeBlock, SaveClasses.IElement element)
{
#region Get the ContentManager variable to use
string contentManagerName = "ContentManagerName";
if (element is ScreenSave)
{
contentManagerName = (element as ScreenSave).ContentManagerForCodeGeneration;
}
#endregion
if (element is EntitySave)
{
codeBlock.Line("static object mLockObject = new object();");
codeBlock.Line("static System.Collections.Generic.List<string> mRegisteredUnloads = new System.Collections.Generic.List<string>();");
#region Keep track of whether we've already registered an unload method and if StaticContent has been loaded
codeBlock.Line("static System.Collections.Generic.List<string> LoadedContentManagers = new System.Collections.Generic.List<string>();");
#endregion
}
for (int i = 0; i < element.ReferencedFiles.Count; i++)
{
AppendFieldOrPropertyForReferencedFile(codeBlock,
element.ReferencedFiles[i], element.Name, element, contentManagerName);
//stringBuilder.AppendLine(GetFieldForReferencedFile(mSaveObject.ReferencedFiles[i]));
}
return codeBlock;
}
示例3: GenerateAddToManagers
public override ICodeBlock GenerateAddToManagers(ICodeBlock codeBlock, IElement element)
{
if (ShouldGenerate)
{
foreach (var layer in GetObjectsForGumLayers(element))
{
var rfs = GetScreenRfsIn(element);
if (rfs != null)
{
codeBlock.Line(layer.InstanceName + "Gum = RenderingLibrary.SystemManagers.Default.Renderer.AddLayer();");
codeBlock.Line(rfs.GetInstanceName() + ".AddGumLayerToFrbLayer(" + layer.InstanceName + "Gum, " + layer.InstanceName + ");");
}
}
// todo: Need to register the layer here
foreach (var item in element.AllNamedObjects.Where(item =>
GumPluginCodeGenerator.IsGue(item) &&
!string.IsNullOrEmpty(item.LayerOn) &&
NamedObjectSaveCodeGenerator.GetFieldCodeGenerationType(item) == CodeGenerationType.Full))
{
codeBlock.Line(item.FieldName + ".MoveToLayer(" + item.LayerOn + "Gum);");
}
}
return base.GenerateAddToManagers(codeBlock, element);
}
示例4: GenerateFields
public override ICodeBlock GenerateFields(ICodeBlock codeBlock, SaveClasses.IElement element)
{
codeBlock.Line("#if DEBUG");
codeBlock.Line("static bool HasBeenLoadedWithGlobalContentManager = false;");
codeBlock.Line("#endif");
return codeBlock;
}
示例5: GenerateFields
public override ICodeBlock GenerateFields(ICodeBlock codeBlock, IElement element)
{
if (IsLoadingScreen(element))
{
codeBlock.Line("double mSavedTargetElapedTime;");
codeBlock.Line("private static System.Action<FlatRedBall.Screens.Screen> nextCallback;");
}
return codeBlock;
}
示例6: GenerateAdditionalMethods
public override void GenerateAdditionalMethods(ICodeBlock codeBlock)
{
codeBlock.Line("#if DEBUG && WINDOWS");
codeBlock.Line("static System.IO.FileSystemWatcher watcher;");
GenerateInitialize(codeBlock);
GenerateHandleFileChanged(codeBlock);
codeBlock.Line("#endif");
}
示例7: GenerateInitialize
public override ICodeBlock GenerateInitialize(ICodeBlock codeBlock, IElement element)
{
if (element is EntitySave && ((EntitySave)element).ImplementsIWindow &&
((EntitySave)element).GetInheritsFromIWindow() == false)
{
codeBlock.Line("this.Click += CallLosePush;");
codeBlock.Line("this.RollOff += CallLosePush;");
}
return codeBlock;
}
示例8: GenerateAdditionalMethods
public override ICodeBlock GenerateAdditionalMethods(ICodeBlock codeBlock, IElement element)
{
if (element is EntitySave && ((EntitySave)element).ImplementsIDrawableBatch)
{
var entitySave = element as EntitySave;
codeBlock.Line("void FlatRedBall.Graphics.IDrawableBatch.Update(){}");
codeBlock.Line("void FlatRedBall.Graphics.IDrawableBatch.Destroy(){}");
}
return codeBlock;
}
示例9: GenerateFields
public override ICodeBlock GenerateFields(ICodeBlock codeBlock, FlatRedBall.Glue.SaveClasses.IElement element)
{
if (element.SupportsAdvancedInterpolation())
{
foreach (var enumName in element.GetStateEnumNames())
{
codeBlock.Line("FlatRedBall.Glue.StateInterpolation.Tweener " + TweenerNameFor(enumName) + ";");
codeBlock.Line(enumName + " mFrom" + enumName + "Tween;");
codeBlock.Line(enumName + " mTo" + enumName + "Tween;");
}
}
return codeBlock;
}
示例10: GenerateInterpolateBetween
private void GenerateInterpolateBetween(ElementSave elementSave, ICodeBlock currentBlock,
string enumType, IEnumerable<StateSave> states)
{
// We used to only generate these if there was were any states in this category, but
// since Gum generated code supports dynamic states, there could be states in a category
// even if they're not defined in Gum.
//if (states.Count() > 0)
{
currentBlock = currentBlock.Function("public void",
"InterpolateBetween", enumType + " firstState, " + enumType + " secondState, float interpolationValue");
GenerateDebugCheckForInterpolationValueNaN(currentBlock);
Dictionary<VariableSave, InterpolationCharacteristic> interpolationCharacteristics =
new Dictionary<VariableSave, InterpolationCharacteristic>();
CreateStartingValueVariables(elementSave, states, currentBlock, interpolationCharacteristics);
currentBlock = currentBlock.Switch("firstState");
currentBlock = SetInterpolateBetweenValuesForStates(elementSave, enumType, states, currentBlock,
interpolationCharacteristics, FirstValue);
currentBlock = currentBlock.End();
currentBlock = currentBlock.Switch("secondState");
currentBlock = SetInterpolateBetweenValuesForStates(elementSave, enumType, states, currentBlock,
interpolationCharacteristics, SecondValue);
currentBlock = currentBlock.End();
currentBlock = AssignValuesUsingStartingValues(elementSave, currentBlock, interpolationCharacteristics);
currentBlock = currentBlock.If("interpolationValue < 1");
string fieldToAssign;
if (enumType == "VariableState")
{
fieldToAssign = "mCurrentVariableState";
}
else
{
fieldToAssign = "mCurrent" + enumType + "State";
}
currentBlock.Line(fieldToAssign + " = firstState;");
currentBlock = currentBlock.End().Else();
currentBlock.Line(fieldToAssign + " = secondState;");
currentBlock = currentBlock.End();
}
}
示例11: GenerateAnimateForCategory
private void GenerateAnimateForCategory(ICodeBlock currentBlock, string categoryName, List<Gum.DataTypes.Variables.StateSave> states)
{
string propertyToAssign;
if (categoryName == "VariableState")
{
propertyToAssign = "this.CurrentVariableState";
}
else
{
propertyToAssign = "this.Current" + categoryName + "State";
}
currentBlock = currentBlock.Function("public void", "Animate",
"System.Collections.Generic.IEnumerable<FlatRedBall.Gum.Keyframe<" + categoryName + ">> keyframes");
{
currentBlock.Line("bool isFirst = true;");
currentBlock.Line("FlatRedBall.Gum.Keyframe<" + categoryName + "> lastKeyframe = null;");
var foreachBlock = currentBlock.ForEach("var frame in keyframes");
{
var ifBlock = foreachBlock.If("isFirst");
{
ifBlock.Line("isFirst = false;");
ifBlock.Line(propertyToAssign + " = frame.State;");
}
var elseBlock = ifBlock.End().Else();
{
elseBlock.Line("float timeToTake = frame.Time - lastKeyframe.Time;");
elseBlock.Line("var fromState = lastKeyframe.State;");
elseBlock.Line("var toState = frame.State;");
elseBlock.Line("var interpolationType = lastKeyframe.InterpolationType;");
elseBlock.Line("var easing = lastKeyframe.Easing;");
elseBlock.Line(
"System.Action action = () => this.InterpolateTo(fromState, toState, timeToTake, interpolationType, easing, {});");
elseBlock.Line(
"FlatRedBall.Instructions.DelegateInstruction instruction = new FlatRedBall.Instructions.DelegateInstruction(action);");
elseBlock.Line("instruction.Target = this;");
elseBlock.Line("instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + lastKeyframe.Time;");
elseBlock.Line("FlatRedBall.Instructions.InstructionManager.Instructions.Add(instruction);");
}
foreachBlock.Line("lastKeyframe = frame;");
}
}
}
示例12: GenerateTimedEmit
public static void GenerateTimedEmit(ICodeBlock codeBlock, NamedObjectSave nos)
{
if (!nos.IsDisabled && nos.AddToManagers && !nos.DefinedByBase && nos.IsEmitter())
{
codeBlock.Line(nos.InstanceName + ".TimedEmit();");
}
}
示例13: GenerateInitializeLevel
private void GenerateInitializeLevel(ICodeBlock codeBlock, IElement element)
{
#region /////////////////////////////////Early out////////////////////////////////
bool shouldGenerate = GetIfShouldGenerate(element);
if (!shouldGenerate)
{
return;
}
///////////////////////////////End early out/////////////////////////////
#endregion
codeBlock.Line("FlatRedBall.TileGraphics.LayeredTileMap CurrentTileMap;");
var function = codeBlock.Function("void", "InitializeLevel", "string levelName");
GenerateInitializeLevelObjects(function);
GenerateInitializeCamera(function);
GenerateAddCollisionAndEntities(function);
GenerateInitializeAnimations(function);
}
示例14: GenerateFields
public override ICodeBlock GenerateFields(ICodeBlock codeBlock, IElement element)
{
foreach (EventResponseSave ers in element.Events)
{
bool isTunneling = ers.GetIsTunneling();
bool isExposing = ers.GetIsExposing();
bool shouldCreateMember =
isExposing || isTunneling;
if (!shouldCreateMember)
{
shouldCreateMember = !string.IsNullOrEmpty(ers.DelegateType);
}
if (shouldCreateMember)
{
string delegateType = ers.GetEffectiveDelegateType(element);
codeBlock.Line("public event " + delegateType + " " + ers.EventName + ";");
}
}
return codeBlock;
}
示例15: TryGenerateRemoveShapeCollectionFromManagers
private static void TryGenerateRemoveShapeCollectionFromManagers(ICodeBlock codeBlock, IElement element)
{
if (element.IsICollidable())
{
codeBlock.Line("mGeneratedCollision.RemoveFromManagers(clearThis: false);");
}
}