本文整理汇总了C#中FStage.HandleAddedToFutile方法的典型用法代码示例。如果您正苦于以下问题:C# FStage.HandleAddedToFutile方法的具体用法?C# FStage.HandleAddedToFutile怎么用?C# FStage.HandleAddedToFutile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FStage
的用法示例。
在下文中一共展示了FStage.HandleAddedToFutile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddStageAtIndex
public static void AddStageAtIndex(FStage stageToAdd, int newIndex)
{
int stageIndex = _stages.IndexOf(stageToAdd);
if(newIndex > _stages.Count) //if it's past the end, make it at the end
{
newIndex = _stages.Count;
}
if(stageIndex == newIndex) return; //if it's already at the right index, just leave it there
if(stageIndex == -1) //add it if it's not in the stages already
{
stageToAdd.HandleAddedToFutile();
_stages.Insert(newIndex, stageToAdd);
}
else //if stage is already in the stages, move it to the desired index
{
_stages.RemoveAt(stageIndex);
if(stageIndex < newIndex)
{
_stages.Insert(newIndex-1, stageToAdd); //gotta subtract 1 to account for it moving in the order
}
else
{
_stages.Insert(newIndex, stageToAdd);
}
}
UpdateStageIndices();
}
示例2: AddStage
public static void AddStage(FStage stageToAdd)
{
int stageIndex = _stages.IndexOf(stageToAdd);
if(stageIndex == -1) //add it if it's not a stage
{
stageToAdd.HandleAddedToFutile();
_stages.Add(stageToAdd);
UpdateStageIndices();
}
else if(stageIndex != _stages.Count-1) //if stage is already in the stages, put it at the top of the stages if it's not already
{
_stages.RemoveAt(stageIndex);
_stages.Add(stageToAdd);
UpdateStageIndices();
}
}