本文整理汇总了C#中FastList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# FastList.Add方法的具体用法?C# FastList.Add怎么用?C# FastList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastList
的用法示例。
在下文中一共展示了FastList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OptionPopUp
public OptionPopUp(string message)
: this(message, true)
{
//load saved values here
options = new FastList<OptionFunc>();
options.Add(ChangeMusicVol);
options.Add(ChangeFxVol);
options.Add(ChangeGore);
options.Add(ChangeMoreGore);
options.Add(ChangeStrum);
if (!Stage.Editor)
{
strumMode = Stage.SaveGame.getStrumMode();
Stage.SaveGame.getGores(out gore, out moreGore);
Stage.SaveGame.getVolumes(out musicVol, out fxVol);
}
origFXVol = fxVol;
origGore = gore;
origMoreGore = moreGore;
origMusicVol = musicVol;
PlayerAgent.isStrumMode = strumMode;
origStrumMode = strumMode;
Stage.ActiveStage.PauseGame();
}
示例2: FindPath
public static bool FindPath(Vector2d End, GridNode startNode, GridNode endNode, FastList<Vector2d> outputVectorPath)
{
if (startNode.Unwalkable || endNode.Unwalkable) return false;
if (FindPath (startNode, endNode, OutputPath)) {
outputVectorPath.FastClear ();
length = OutputPath.Count - 1;
for (i = 0; i < length; i++) {
outputVectorPath.Add (OutputPath [i].WorldPos);
}
outputVectorPath.Add (End);
return true;
}
return false;
}
示例3: Blueprint
/// <summary>
/// Deserialization constructor.
/// </summary>
/// <param name="group">Market Group the Blueprint will be a member of.</param>
/// <param name="src">Source serializable blueprint.</param>
internal Blueprint(BlueprintMarketGroup group, SerializableBlueprint src)
: base(group, src)
{
m_maxProductionLimit = src.MaxProductionLimit;
m_produceItemID = src.ProduceItemID;
m_productionTime= src.ProductionTime;
m_productivityModifier = src.ProductivityModifier;
m_researchCopyTime = src.ResearchCopyTime;
m_researchMaterialTime = src.ResearchMaterialTime;
m_researchProductivityTime = src.ResearchProductivityTime;
m_researchTechTime = src.ResearchTechTime;
m_techLevel = src.TechLevel;
m_wasteFactor = src.WasteFactor;
// Invented blueprint
m_inventBlueprint = new FastList<int>(src.InventionTypeID != null ? src.InventionTypeID.Length : 0);
if (src.InventionTypeID != null)
{
foreach (var blueprintID in src.InventionTypeID)
{
m_inventBlueprint.Add(blueprintID);
}
}
// Materials prerequisites
m_materialRequirements = new FastList<StaticRequiredMaterial>(src.ReqMaterial != null ? src.ReqMaterial.Length : 0);
if (src.ReqMaterial == null)
return;
foreach (var prereq in src.ReqMaterial)
{
m_materialRequirements.Add(new StaticRequiredMaterial(prereq));
}
}
示例4: RemoveProps
public static void RemoveProps()
{
var prefabs = Resources.FindObjectsOfTypeAll<BuildingInfo>();
foreach (var buildingInfo in prefabs)
{
var fastList = new FastList<BuildingInfo.Prop>();
if (buildingInfo == null)
{
continue;
}
if (buildingInfo.m_props != null)
{
var props = buildingInfo.m_props;
foreach (var prop in props.Where(prop => prop != null))
{
if (prop.m_finalProp != null)
{
if (
(!OptionsHolder.Options.removeSmoke || !prop.m_finalProp.name.Contains("Smoke") && !prop.m_finalProp.name.Contains("smoke")) &&
(!OptionsHolder.Options.removeSteam || !prop.m_finalProp.name.Contains("Steam") && !prop.m_finalProp.name.Contains("steam")) &&
(!OptionsHolder.Options.removeClownHeads || !prop.m_finalProp.name.Contains("Clown") && !prop.m_finalProp.name.Contains("clown")) &&
(!OptionsHolder.Options.removeIceCones || !prop.m_finalProp.name.Contains("Cream") && !prop.m_finalProp.name.Contains("cream")) &&
(!OptionsHolder.Options.removeDoughnutSquirrels || !prop.m_finalProp.name.Contains("Squirrel") && !prop.m_finalProp.name.Contains("squirrel")) &&
(!OptionsHolder.Options.removeRandom3dBillboards || prop.m_finalProp.name != "Billboard_3D_variation") &&
(!OptionsHolder.Options.removeFlatBillboards || prop.m_finalProp.name != "Hologram Ad Game Arcade") &&
(!OptionsHolder.Options.removeNeonChirpy || !BillboardCategories.Contains(prop.m_finalProp.editorCategory)) &&
(!OptionsHolder.Options.removeOctopodes || !prop.m_finalProp.name.Contains("Octopus") && !prop.m_finalProp.name.Contains("octopus")) &&
(!OptionsHolder.Options.removeWallFlags || prop.m_finalProp.name != "flag_pole_wall") &&
(!OptionsHolder.Options.removeSolarPanels || !prop.m_finalProp.name.Contains("Solar panel"))
)
{
fastList.Add(prop);
}
}
else
{
fastList.Add(prop);
}
}
}
buildingInfo.m_props = fastList.ToArray();
}
}
示例5: FillParameterCollections
public override void FillParameterCollections(FastList<ParameterCollection> parameterCollections)
{
// Test common types to avoid struct enumerator boxing
var localParameterCollectionsList = localParameterCollections as List<ParameterCollection>;
if (localParameterCollectionsList != null)
{
foreach (var parameter in localParameterCollectionsList)
{
if (parameter != null)
{
parameterCollections.Add(parameter);
}
}
}
else
{
var localParameterCollectionsArray = localParameterCollections as ParameterCollection[];
if (localParameterCollectionsArray != null)
{
foreach (var parameter in localParameterCollectionsArray)
{
if (parameter != null)
{
parameterCollections.Add(parameter);
}
}
}
else
{
// Slow: enumerator will be boxed
foreach (var parameter in localParameterCollections)
{
if (parameter != null)
{
parameterCollections.Add(parameter);
}
}
}
}
}
示例6: AlternateEndingsBarRenderer
public AlternateEndingsBarRenderer(Bar bar)
: base(bar)
{
var alternateEndings = Bar.MasterBar.AlternateEndings;
_endings = new FastList<int>();
for (var i = 0; i < MasterBar.MaxAlternateEndings; i++)
{
if ((alternateEndings & (0x01 << i)) != 0)
{
_endings.Add(i);
}
}
}
示例7: ShouldCreateGlyph
public virtual bool ShouldCreateGlyph(EffectBarRenderer renderer, Beat beat)
{
LastCreateInfo = new FastList<Note>();
for (int i = 0, j = beat.Notes.Count; i < j; i++)
{
var n = beat.Notes[i];
if (ShouldCreateGlyphForNote(renderer, n))
{
LastCreateInfo.Add(n);
}
}
return LastCreateInfo.Count > 0;
}
示例8: Item
/// <summary>
/// Base constructor for blueprints.
/// </summary>
/// <param name="id"></param>
/// <param name="name"></param>
internal Item(BlueprintMarketGroup group, SerializableBlueprint src)
: this(src.ID, src.Name)
{
m_icon = src.Icon;
m_metaGroup = src.MetaGroup;
m_marketGroup = group;
m_family = ItemFamily.Bpo;
m_prerequisites = new FastList<StaticSkillLevel>(src.PrereqSkill != null ? src.PrereqSkill.Length : 0);
if (src.PrereqSkill == null)
return;
foreach (var prereq in src.PrereqSkill)
{
m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level, prereq.Activity));
}
}
示例9: DoLayout
public override void DoLayout()
{
base.DoLayout();
_bendGlyphs = new FastList<BendGlyph>();
for (int i = 0; i < Beat.Notes.Count; i++)
{
var n = Beat.Notes[i];
if (n.HasBend)
{
var bendValueHeight = 6;
var bendHeight = n.MaxBendPoint.Value * bendValueHeight;
Renderer.RegisterOverflowTop(bendHeight);
var bend = new BendGlyph(n, bendValueHeight);
bend.X = OnNotes.X + OnNotes.Width;
bend.Renderer = Renderer;
_bendGlyphs.Add(bend);
}
}
}
示例10: Duplicate
internal void Duplicate(int start, int finish)
{
var sh = Offset - start;
ops.AddRange(ops, start, finish);
opData.AddRange(opData, start, finish);
var nf = new FastList<Int32>();
foreach (var i in fixups)
{
if (i >= start && i <= finish)
{
var l = labels[opData[i]];
var nl = DefineLabel();
opData[sh + i] = nl.GetIndex();
labels[nl.GetIndex()] = l + sh;
nf.Add(sh + i);
}
}
fixups.AddRange(nf);
}
示例11: DoLayoutAndRender
public override void DoLayoutAndRender()
{
if (Renderer.Settings.Staves.Count == 0) return;
var score = Renderer.Score;
var canvas = Renderer.Canvas;
var startIndex = Renderer.Settings.Layout.Get("start", 1);
startIndex--; // map to array index
startIndex = Math.Min(score.MasterBars.Count - 1, Math.Max(0, startIndex));
var currentBarIndex = startIndex;
var endBarIndex = Renderer.Settings.Layout.Get("count", score.MasterBars.Count);
endBarIndex = startIndex + endBarIndex - 1; // map count to array index
endBarIndex = Math.Min(score.MasterBars.Count - 1, Math.Max(0, endBarIndex));
_group = CreateEmptyStaveGroup();
_group.X = PagePadding[0];
_group.Y = PagePadding[1];
var countPerPartial = Renderer.Settings.Layout.Get("countPerPartial", 10);
var partials = new FastList<HorizontalScreenLayoutPartialInfo>();
var currentPartial = new HorizontalScreenLayoutPartialInfo();
while (currentBarIndex <= endBarIndex)
{
var result = _group.AddBars(Renderer.Tracks, currentBarIndex);
// if we detect that the new renderer is linked to the previous
// renderer, we need to put it into the previous partial
var renderer = _group.GetBarRenderer(currentBarIndex);
if (currentPartial.MasterBars.Count == 0 && result.IsLinkedToPrevious && partials.Count > 0)
{
var previousPartial = partials[partials.Count - 1];
previousPartial.MasterBars.Add(score.MasterBars[currentBarIndex]);
previousPartial.Width += renderer.Width;
}
else
{
currentPartial.MasterBars.Add(score.MasterBars[currentBarIndex]);
currentPartial.Width += renderer.Width;
// no targetPartial here because previous partials already handled this code
if (currentPartial.MasterBars.Count >= countPerPartial)
{
if (partials.Count == 0)
{
currentPartial.Width += _group.X + _group.AccoladeSpacing;
}
partials.Add(currentPartial);
currentPartial = new HorizontalScreenLayoutPartialInfo();
}
}
currentBarIndex++;
}
// don't miss the last partial if not empty
if (currentPartial.MasterBars.Count >= 0)
{
if (partials.Count == 0)
{
currentPartial.Width += _group.X + _group.AccoladeSpacing;
}
partials.Add(currentPartial);
}
_group.FinalizeGroup(this);
Height = _group.Y + _group.Height + PagePadding[3];
Width = _group.X + _group.Width + PagePadding[2];
// TODO: Find a good way to render the score partwise
// we need to precalculate the final height somehow
//canvas.BeginRender(Width, Height);
//canvas.Color = Renderer.RenderingResources.MainGlyphColor;
//canvas.TextAlign = TextAlign.Left;
//_group.Paint(0, 0, Renderer.Canvas);
//var result = canvas.EndRender();
//OnPartialRenderFinished(new RenderFinishedEventArgs
//{
// TotalWidth = Width,
// TotalHeight = y,
// Width = Width,
// Height = Height,
// RenderResult = result
//});
currentBarIndex = 0;
for (var i = 0; i < partials.Count; i++)
{
var partial = partials[i];
canvas.BeginRender(partial.Width, Height);
canvas.Color = Renderer.RenderingResources.MainGlyphColor;
canvas.TextAlign = TextAlign.Left;
var renderer = _group.GetBarRenderer(partial.MasterBars[0].Index);
//.........这里部分代码省略.........
示例12: SetTracks
public void SetTracks(dynamic tracksData, bool render = true)
{
FastList<int> tracks = new FastList<int>();
// decode string
if (JsTypeOf(tracksData) == [email protected])
{
try
{
tracksData = JSON.parse((string)tracksData);
}
catch
{
tracksData = new[] { 0 };
}
}
// decode array
if (JsTypeOf(tracksData) == JsTypes.number)
{
tracks.Add((int)tracksData);
}
else if (tracksData.length)
{
for (var i = 0; i < tracksData.length; i++)
{
int value;
if (JsTypeOf(tracksData[i]) == JsTypes.number)
{
value = (int)tracksData[i];
}
else
{
value = Std.ParseInt(tracksData[i].ToString());
}
if (value >= 0)
{
tracks.Add(value);
}
}
}
TrackIndexes = tracks.ToArray();
if (render)
{
Render();
}
}
示例13: LayoutAndRenderScoreInfo
private float LayoutAndRenderScoreInfo(float x, float y)
{
HeaderFooterElements flags = Renderer.Settings.Layout.Get("hideInfo", false) ? HeaderFooterElements.None : HeaderFooterElements.All;
var score = Renderer.Score;
var scale = Scale;
var canvas = Renderer.Canvas;
var res = Renderer.RenderingResources;
var glyphs = new FastList<TextGlyph>();
string str;
if (!string.IsNullOrEmpty(score.Title) && (flags & HeaderFooterElements.Title) != 0)
{
glyphs.Add(new TextGlyph(Width / 2f, y, score.Title, res.TitleFont, TextAlign.Center));
y += (35 * scale);
}
if (!string.IsNullOrEmpty(score.SubTitle) && (flags & HeaderFooterElements.SubTitle) != 0)
{
glyphs.Add(new TextGlyph(Width / 2f, y, score.SubTitle, res.SubTitleFont, TextAlign.Center));
y += (20 * scale);
}
if (!string.IsNullOrEmpty(score.Artist) && (flags & HeaderFooterElements.Artist) != 0)
{
glyphs.Add(new TextGlyph(Width / 2f, y, score.Artist, res.SubTitleFont, TextAlign.Center));
y += (20 * scale);
}
if (!string.IsNullOrEmpty(score.Album) && (flags & HeaderFooterElements.Album) != 0)
{
glyphs.Add(new TextGlyph(Width / 2f, y, score.Album, res.SubTitleFont, TextAlign.Center));
y += (20 * scale);
}
if (!string.IsNullOrEmpty(score.Music) && score.Music == score.Words && (flags & HeaderFooterElements.WordsAndMusic) != 0)
{
glyphs.Add(new TextGlyph(Width / 2f, y, "Music and Words by " + score.Words, res.WordsFont, TextAlign.Center));
y += (20 * scale);
}
else
{
if (!string.IsNullOrEmpty(score.Music) && (flags & HeaderFooterElements.Music) != 0)
{
glyphs.Add(new TextGlyph(Width - PagePadding[2], y, "Music by " + score.Music, res.WordsFont, TextAlign.Right));
}
if (!string.IsNullOrEmpty(score.Words) && (flags & HeaderFooterElements.Words) != 0)
{
glyphs.Add(new TextGlyph(x, y, "Words by " + score.Music, res.WordsFont, TextAlign.Left));
}
y += (20 * scale);
}
y += (20 * scale);
// tuning info
if (Renderer.Tracks.Length == 1 && !Renderer.Tracks[0].IsPercussion)
{
var tuning = Tuning.FindTuning(Renderer.Tracks[0].Tuning);
if (tuning != null)
{
// Name
glyphs.Add(new TextGlyph(x, y, tuning.Name, res.EffectFont, TextAlign.Left));
y += (15 * scale);
if (!tuning.IsStandard)
{
// Strings
var stringsPerColumn = (int)Math.Ceiling(Renderer.Tracks[0].Tuning.Length / 2.0);
var currentX = x;
var currentY = y;
for (int i = 0, j = Renderer.Tracks[0].Tuning.Length; i < j; i++)
{
str = "(" + (i + 1) + ") = " + Tuning.GetTextForTuning(Renderer.Tracks[0].Tuning[i], false);
glyphs.Add(new TextGlyph(currentX, currentY, str, res.EffectFont, TextAlign.Left));
currentY += (15 * scale);
if (i == stringsPerColumn - 1)
{
currentY = y;
currentX += (43 * scale);
}
}
y += (stringsPerColumn * (15 * scale));
}
}
}
y += 25 * scale;
canvas.BeginRender(Width, y);
canvas.Color = res.ScoreInfoColor;
canvas.TextAlign = TextAlign.Center;
for (int i = 0; i < glyphs.Count; i++)
{
glyphs[i].Paint(0, 0, canvas);
}
var result = canvas.EndRender();
OnPartialRenderFinished(new RenderFinishedEventArgs
{
//.........这里部分代码省略.........
示例14: LayoutAndRenderScore
private float LayoutAndRenderScore(float x, float y)
{
var score = Renderer.Score;
var canvas = Renderer.Canvas;
var startIndex = Renderer.Settings.Layout.Get("start", 1);
startIndex--; // map to array index
startIndex = Math.Min(score.MasterBars.Count - 1, Math.Max(0, startIndex));
var currentBarIndex = startIndex;
var endBarIndex = Renderer.Settings.Layout.Get("count", score.MasterBars.Count);
if (endBarIndex < 0) endBarIndex = score.MasterBars.Count;
endBarIndex = startIndex + endBarIndex - 1; // map count to array index
endBarIndex = Math.Min(score.MasterBars.Count - 1, Math.Max(0, endBarIndex));
_groups = new FastList<StaveGroup>();
if (Renderer.Settings.Staves.Count > 0)
{
while (currentBarIndex <= endBarIndex)
{
// create group and align set proper coordinates
var group = CreateStaveGroup(currentBarIndex, endBarIndex);
_groups.Add(group);
group.X = x;
group.Y = y;
// finalize group (sizing etc).
FitGroup(group);
group.FinalizeGroup(this);
// paint into canvas
var height = group.Height + (GroupSpacing * Scale);
canvas.BeginRender(Width, height);
Renderer.Canvas.Color = Renderer.RenderingResources.MainGlyphColor;
Renderer.Canvas.TextAlign = TextAlign.Left;
// NOTE: we use this negation trick to make the group paint itself to 0/0 coordinates
// since we use partial drawing
group.Paint(0, -group.Y, canvas);
// calculate coordinates for next group
y += height;
currentBarIndex = group.LastBarIndex + 1;
var result = canvas.EndRender();
OnPartialRenderFinished(new RenderFinishedEventArgs
{
TotalWidth = Width,
TotalHeight = y,
Width = Width,
Height = height,
RenderResult = result
});
}
}
return y;
}
示例15: FillParameterCollections
public override void FillParameterCollections(FastList<ParameterCollection> parameterCollections)
{
var material = Material;
if (material != null && material.Parameters != null)
{
parameterCollections.Add(material.Parameters);
}
var modelInstance = RenderModel.ModelComponent;
if (modelInstance != null && modelInstance.Parameters != null)
{
parameterCollections.Add(modelInstance.Parameters);
}
// TODO: Should we add RenderMesh.Parameters before ModelComponent.Parameters to allow user overiddes at component level?
parameterCollections.Add(parameters);
}