Here are the examples of the csharp api System.Collections.Generic.List.RemoveAt(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
7926 Examples
19
Source : DataUnparsed.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public override void Set<T>(DataContext ctx, [AllowNull] T value) {
string id = ctx.MetaTypeToID[typeof(T)];
if (value == null) {
for (int i = 0; i < InnerMeta.Count; i++)
if (InnerMeta[i].ID == id) {
InnerMeta.RemoveAt(i);
InnerMetaStatus++;
return;
}
return;
}
foreach (MetaTypeWrap meta in InnerMeta)
if (meta.ID == id) {
meta.Wrap(ctx, value);
return;
}
MetaTypeWrap wrap = new();
wrap.Wrap(ctx, value);
InnerMeta.Add(wrap);
InnerMetaStatus++;
}
19
Source : GhostEmote.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
public static MTexture GetIcon(string emote, float time) {
Atlas atlas;
if ((atlas = GetIconAtlas(ref emote)) == null)
return null;
List<string> iconPaths = new(emote.Split(' '));
if (iconPaths.Count > 1 && int.TryParse(iconPaths[0], out int fps)) {
iconPaths.RemoveAt(0);
} else {
fps = 7; // Default FPS.
}
List<MTexture> icons = iconPaths.SelectMany(iconPath => {
iconPath = iconPath.Trim();
List<MTexture> subs = atlas.orig_GetAtlreplacedubtextures(iconPath);
if (subs.Count != 0)
return subs;
if (atlas.Has(iconPath))
return new List<MTexture>() { atlas[iconPath] };
if (iconPath.ToLowerInvariant() == "end")
return new List<MTexture>() { null };
return new List<MTexture>();
}).ToList();
if (icons.Count == 0)
return null;
if (icons.Count == 1)
return icons[0];
int index = (int) Math.Floor(time * fps);
if (index >= icons.Count - 1 && icons[icons.Count - 1] == null)
return icons[icons.Count - 2];
return icons[index % icons.Count];
}
19
Source : CelesteNetConnection.cs
with MIT License
from 0x0ade
with MIT License
from 0x0ade
protected virtual void ThreadLoop() {
try {
while (Con.IsAlive) {
DedupeTimestamp++;
int waited = 0;
if (Interlocked.CompareExchange(ref QueueCount, 0, 0) == 0)
waited = WaitHandle.WaitAny(EventHandles, 1000);
if ((waited == WaitHandle.WaitTimeout || DedupeTimestamp % 10 == 0) && LastSent.Count > 0) {
for (int i = Dedupes.Count - 1; i >= 0; --i) {
DataDedupe slot = Dedupes[i];
if (!slot.Update(DedupeTimestamp)) {
Dedupes.RemoveAt(i);
if (LastSent.TryGetValue(slot.Type, out Dictionary<uint, DataDedupe>? slotByID)) {
slotByID.Remove(slot.ID);
if (slotByID.Count == 0) {
LastSent.Remove(slot.Type);
}
}
}
}
}
if (!Con.IsAlive)
return;
DateTime now = DateTime.UtcNow;
while (Interlocked.CompareExchange(ref QueueCount, 0, 0) != 0) {
DataType? data;
lock (QueueLock) {
int next = QueueSendNext;
data = Queue[next];
Queue[next] = null;
QueueSendNext = (next + 1) % Queue.Length;
Interlocked.Decrement(ref QueueCount);
}
if (data == null)
continue;
if (data is DataInternalDisconnect) {
Con.Dispose();
return;
}
if ((data.DataFlags & DataFlags.OnlyLatest) == DataFlags.OnlyLatest) {
string type = data.GetTypeID(Con.Data);
uint id = data.GetDuplicateFilterID();
lock (QueueLock) {
int next = QueueSendNext;
int count = Interlocked.CompareExchange(ref QueueCount, 0, 0);
int length = Queue.Length;
for (int ii = 0; ii < count; ii++) {
int i = (next + ii) % length;
DataType? d = Queue[i];
if (d != null && d.GetTypeID(Con.Data) == type && d.GetDuplicateFilterID() == id) {
data = d;
Queue[i] = null;
}
}
}
}
if ((data.DataFlags & DataFlags.SkipDuplicate) == DataFlags.SkipDuplicate) {
string type = data.GetTypeID(Con.Data);
uint id = data.GetDuplicateFilterID();
if (!LastSent.TryGetValue(type, out Dictionary<uint, DataDedupe>? slotByID))
LastSent[type] = slotByID = new();
if (slotByID.TryGetValue(id, out DataDedupe? slot)) {
if (slot.Data.ConsideredDuplicate(data))
continue;
slot.Data = data;
slot.Timestamp = DedupeTimestamp;
slot.Iterations = 0;
} else {
Dedupes.Add(slotByID[id] = new(type, id, data, DedupeTimestamp));
}
}
Con.SendRaw(this, data);
if ((data.DataFlags & DataFlags.Update) == DataFlags.Update)
LastUpdate = now;
else
LastNonUpdate = now;
}
if (Con.SendStringMap) {
List<Tuple<string, int>> added = Strings.PromoteRead();
if (added.Count > 0) {
foreach (Tuple<string, int> mapping in added)
Con.SendRaw(this, new DataLowLevelStringMapping {
IsUpdate = SendStringMapUpdate,
StringMap = Strings.Name,
Value = mapping.Item1,
ID = mapping.Item2
});
if (SendStringMapUpdate)
LastUpdate = now;
else
LastNonUpdate = now;
}
}
if (Con.SendKeepAlive) {
if (SendKeepAliveUpdate && (now - LastUpdate).TotalSeconds >= 1D) {
Con.SendRaw(this, new DataLowLevelKeepAlive {
IsUpdate = true
});
LastUpdate = now;
}
if (SendKeepAliveNonUpdate && (now - LastNonUpdate).TotalSeconds >= 1D) {
Con.SendRaw(this, new DataLowLevelKeepAlive {
IsUpdate = false
});
LastNonUpdate = now;
}
}
Con.SendRawFlush();
lock (QueueLock)
if (Interlocked.CompareExchange(ref QueueCount, 0, 0) == 0)
Event.Reset();
}
} catch (ThreadInterruptedException) {
} catch (ThreadAbortException) {
} catch (Exception e) {
if (!(e is IOException) && !(e is ObjectDisposedException))
Logger.Log(LogLevel.CRI, "conqueue", $"Failed sending data:\n{e}");
Con.Dispose();
} finally {
Event.Dispose();
}
}
19
Source : PInvokeHooks.cs
with zlib License
from 0x0ade
with zlib License
from 0x0ade
public static bool UnhookWindowsHookEx(IntPtr hhk) {
int index = (int) hhk - 1;
if (index < 0 || PInvoke.Hooks.Count <= index ||
PInvoke.AllHooks[index] == null)
return true; // Too lazy to implement Set/GetLastError with Windows' 16000 error codes...
Tuple<HookType, Delegate, int> hook = PInvoke.AllHooks[index];
PInvoke.AllHooks[index] = null;
PInvoke.Hooks[hook.Item1].RemoveAt(hook.Item3);
return true;
}
19
Source : DInput.cs
with zlib License
from 0x0ade
with zlib License
from 0x0ade
public static void Update() {
for (int player = 0; player < States.Length; player++) {
GamePadState stateX = GamePad.GetState((PlayerIndex) player);
DInputState stateD = States[player];
stateD.connected = stateX.IsConnected;
if (!stateD.connected)
continue;
// TODO: Finalize DInput mappings
GamePadThumbSticks sticks = stateX.ThumbSticks;
stateD.leftX = sticks.Left.X;
stateD.leftY = sticks.Left.Y;
stateD.leftZ = 0f; // ???
stateD.rightX = sticks.Right.X;
stateD.rightY = sticks.Right.Y;
stateD.rightZ = 0f; // ???
GamePadTriggers triggers = stateX.Triggers;
stateD.slider1 = stateX.Triggers.Left;
stateD.slider2 = stateX.Triggers.Right;
GamePadDPad dpad = stateX.DPad;
stateD.left = dpad.Left == ButtonState.Pressed;
stateD.right = dpad.Right == ButtonState.Pressed;
stateD.up = dpad.Up == ButtonState.Pressed;
stateD.down = dpad.Down == ButtonState.Pressed;
GamePadButtons buttonsX = stateX.Buttons;
List<bool> buttonsD = stateD.buttons ?? new List<bool>();
for (int i = buttonsD.Count; i < 13; i++)
buttonsD.Add(false);
while (buttonsD.Count > 13)
buttonsD.RemoveAt(0);
buttonsD[0] = buttonsX.X == ButtonState.Pressed;
buttonsD[1] = buttonsX.A == ButtonState.Pressed;
buttonsD[2] = buttonsX.B == ButtonState.Pressed;
buttonsD[3] = buttonsX.Y == ButtonState.Pressed;
buttonsD[4] = buttonsX.LeftShoulder == ButtonState.Pressed;
buttonsD[5] = buttonsX.RightShoulder == ButtonState.Pressed;
buttonsD[6] = triggers.Left >= 0.999f;
buttonsD[7] = triggers.Right >= 0.999f;
buttonsD[8] = buttonsX.Back == ButtonState.Pressed;
buttonsD[9] = buttonsX.Start == ButtonState.Pressed;
buttonsD[10] = buttonsX.BigButton == ButtonState.Pressed; // ???
buttonsD[11] = buttonsX.LeftStick == ButtonState.Pressed;
buttonsD[12] = buttonsX.RightStick == ButtonState.Pressed;
stateD.buttons = buttonsD;
}
}
19
Source : ConversationStatusEditor.cs
with MIT License
from 0xbustos
with MIT License
from 0xbustos
private static void DisplayNameAndRemoveButton( int i )
{
statusFoldoutDisplay = i;
GUILayout.BeginHorizontal();
status[i].Name = EditorGUILayout.TextField( "Status Name", status[i].Name );
if (GUILayout.Button( EditorButtons.RemoveStatusButton, EditorStyles.miniButton, EditorButtons.MiniButtonWidth ))
{
status.RemoveAt( i );
statusFoldoutDisplay = -1;
return;
}
GUILayout.EndHorizontal();
}
19
Source : DialogueEditor.cs
with MIT License
from 0xbustos
with MIT License
from 0xbustos
public static void Display( Dialogue dialogue )
{
if (dialogue.Sentences == null)
{
dialogue.Sentences = new List<Sentence>();
}
List<Sentence> sentences = dialogue.Sentences;
EditorGUILayout.LabelField( "Dialogue List", EditorStyles.boldLabel );
EditorGUI.indentLevel++;
for (int i = 0; i < sentences.Count; i++)
{
GUILayout.BeginHorizontal();
bool display = i == dialogueFoldoutDisplay;
display = EditorGUILayout.Foldout( display, "Dialogue" + ( i + 1 ) );
if (GUILayout.Button( EditorButtons.RemoveDialogueButton, EditorStyles.miniButton, EditorButtons.MiniButtonWidth ))
{
sentences.RemoveAt( i );
dialogueFoldoutDisplay = -1;
break;
}
GUILayout.EndHorizontal();
if (!display && i == dialogueFoldoutDisplay)
{
dialogueFoldoutDisplay = -1;
}
if (display)
{
dialogueFoldoutDisplay = i;
EditorGUI.indentLevel++;
SentenceEditor.Display( sentences[i] );
EditorGUI.indentLevel--;
}
}
if (GUILayout.Button( EditorButtons.AddDialogueButton, EditorStyles.miniButton, EditorButtons.NormalButtonWidth ))
{
Sentence newSentence = new Sentence();
sentences.Add( newSentence );
}
EditorGUI.indentLevel--;
}
19
Source : ExpressionEditor.cs
with MIT License
from 0xbustos
with MIT License
from 0xbustos
public static void Display(List<Expression> expressions)
{
for (int i = 0; i < expressions.Count; i++)
{
bool display = i == expressionFoldoutDisplay;
display = EditorGUILayout.Foldout( display, expressions[i].Name );
if (!display && i == expressionFoldoutDisplay)
{
expressionFoldoutDisplay = -1;
}
if (display)
{
expressionFoldoutDisplay = i;
EditorGUILayout.BeginVertical( GUI.skin.box );
GUILayout.BeginHorizontal();
expressions[i].Name = EditorGUILayout.TextField( "Expression Name", expressions[i].Name );
if (GUILayout.Button( EditorButtons.RemoveExpressionButton, EditorStyles.miniButton, EditorButtons.MiniButtonWidth ))
{
expressions.RemoveAt( i );
expressionFoldoutDisplay = -1;
return;
}
GUILayout.EndHorizontal();
expressions[i].Image = EditorGUILayout.ObjectField( "Image", expressions[i].Image, typeof( Sprite ), true ) as Sprite;
EditorGUILayout.EndVertical();
}
}
}
19
Source : NewConversationsEditor.cs
with MIT License
from 0xbustos
with MIT License
from 0xbustos
public static void Display( List<PendingStatus> conversations )
{
if (conversations == null)
{
conversations = new List<PendingStatus>();
}
EditorGUILayout.LabelField( "New Conversations", EditorStyles.boldLabel );
for (int i = 0; i < conversations.Count; i++)
{
EditorGUI.indentLevel++;
GUILayout.BeginHorizontal();
bool display = i == newConversationsFoldoutDisplay;
display = EditorGUILayout.Foldout( display, conversations[i].ConversationName );
if (GUILayout.Button( EditorButtons.RemovePendingStatusButton, EditorStyles.miniButton, EditorButtons.MiniButtonWidth ))
{
conversations.RemoveAt( i );
newConversationsFoldoutDisplay = -1;
break;
}
GUILayout.EndHorizontal();
if (!display && i == newConversationsFoldoutDisplay)
{
newConversationsFoldoutDisplay = -1;
}
if (display)
{
newConversationsFoldoutDisplay = i;
EditorGUI.indentLevel++;
conversations[i].ConversationName = EditorGUILayout.TextField( "Conversation", conversations[i].ConversationName );
conversations[i].StatusName = EditorGUILayout.TextField( "Status", conversations[i].StatusName );
conversations[i].Importance = EditorGUILayout.IntField( "Importance", conversations[i].Importance );
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;
}
if (GUILayout.Button( EditorButtons.AddPendingStatusButton, EditorStyles.miniButton, EditorButtons.NormalButtonWidth ))
{
PendingStatus pendingStatus = new PendingStatus();
conversations.Add( pendingStatus );
}
}
19
Source : CompressedAV1ImageCollection.cs
with MIT License
from 0xC0000054
with MIT License
from 0xC0000054
public void RemoveAt(int index)
{
if ((uint)index >= (uint)this.items.Count)
{
ExceptionUtil.ThrowArgumentOutOfRangeException(nameof(index));
}
this.items[index]?.Dispose();
this.items.RemoveAt(index);
this.version++;
}
19
Source : TextureCollection.cs
with MIT License
from 0xC0000054
with MIT License
from 0xC0000054
public void RemoveAt(int index)
{
DisposePreviousItem(index);
this.items.RemoveAt(index);
}
19
Source : ProxyGenerator.cs
with MIT License
from 1100100
with MIT License
from 1100100
private static MemberDeclarationSyntax GenerateMethod(string routePrefix, MethodInfo methodInfo, string serviceName)
{
if (methodInfo.ReturnType.Namespace != typeof(Task).Namespace)
throw new NotSupportedException($"Only support proxy asynchronous methods.[{methodInfo.DeclaringType?.Namespace}.{methodInfo.DeclaringType?.Name}.{methodInfo.Name}]");
var methodAttr = methodInfo.GetCustomAttribute<ServiceRouteAttribute>();
var serviceRoute = $"{routePrefix}/{(methodAttr == null ? methodInfo.Name : methodAttr.Route)}";
var returnDeclaration = GenerateType(methodInfo.ReturnType);
var argDeclarations = new List<SyntaxNodeOrToken>();
foreach (var arg in methodInfo.GetParameters())
{
argDeclarations.Add(arg.ParameterType.IsGenericType
? SyntaxFactory.Parameter(SyntaxFactory.Identifier(arg.Name))
.WithType(GenerateType(arg.ParameterType))
: SyntaxFactory.Parameter(SyntaxFactory.Identifier(arg.Name))
.WithType(GenerateQualifiedNameSyntax(arg.ParameterType)));
argDeclarations.Add(SyntaxFactory.Token(SyntaxKind.CommaToken));
}
if (argDeclarations.Any())
{
argDeclarations.RemoveAt(argDeclarations.Count - 1);
}
//Generate return type.
var methodDeclaration = SyntaxFactory.MethodDeclaration(methodInfo.ReturnType == typeof(void) ? SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)) : returnDeclaration, SyntaxFactory.Identifier(methodInfo.Name));
if (methodInfo.ReturnType.Namespace == typeof(Task).Namespace)
{
methodDeclaration = methodDeclaration.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PublicKeyword),
SyntaxFactory.Token(SyntaxKind.AsyncKeyword)));
}
else
{
methodDeclaration = methodDeclaration.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PublicKeyword)));
}
methodDeclaration = methodDeclaration.WithParameterList(
SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList<ParameterSyntax>(argDeclarations)));
ExpressionSyntax expressionSyntax;
if (methodInfo.ReturnType == typeof(Task))
{
expressionSyntax = SyntaxFactory.IdentifierName("InvokeAsync");
}
else
{
expressionSyntax = SyntaxFactory.GenericName(SyntaxFactory.Identifier("InvokeAsync"))
.WithTypeArgumentList(((GenericNameSyntax)returnDeclaration).TypeArgumentList);
}
var argNames = methodInfo.GetParameters().Select(p => SyntaxFactory.IdentifierName(SyntaxFactory.Identifier(p.Name))).ToList();
var token = new SyntaxNodeOrToken[]
{
SyntaxFactory.Argument(SyntaxFactory
.ArrayCreationExpression(SyntaxFactory
.ArrayType(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ObjectKeyword)))
.WithRankSpecifiers(SyntaxFactory.SingletonList(
SyntaxFactory.ArrayRankSpecifier(
SyntaxFactory.SingletonSeparatedList<ExpressionSyntax>(
SyntaxFactory.OmittedArraySizeExpression())))))
.WithInitializer(SyntaxFactory.InitializerExpression(SyntaxKind.CollectionInitializerExpression,
SyntaxFactory.SeparatedList<ExpressionSyntax>(argNames)))),
SyntaxFactory.Token(SyntaxKind.CommaToken),
SyntaxFactory.Argument(
SyntaxFactory.LiteralExpression(
SyntaxKind.StringLiteralExpression,
SyntaxFactory.Literal(serviceRoute))),
SyntaxFactory.Token(SyntaxKind.CommaToken),
SyntaxFactory.Argument(
SyntaxFactory.LiteralExpression(
SyntaxKind.StringLiteralExpression,
SyntaxFactory.Literal(serviceName)))
};
expressionSyntax = SyntaxFactory.AwaitExpression(SyntaxFactory.InvocationExpression(expressionSyntax)
.WithArgumentList(
SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList<ArgumentSyntax>(token))
));
StatementSyntax statementSyntax;
if (methodInfo.ReturnType != typeof(Task) && methodInfo.ReturnType != typeof(void))
{
statementSyntax = SyntaxFactory.ReturnStatement(expressionSyntax);
}
else
{
statementSyntax = SyntaxFactory.ExpressionStatement(expressionSyntax);
}
return methodDeclaration.WithBody(SyntaxFactory.Block(SyntaxFactory.SingletonList(statementSyntax)));
}
19
Source : CollectionAbstract.cs
with MIT License
from 17MKH
with MIT License
from 17MKH
public void RemoveAt(int index)
{
Collection.RemoveAt(index);
}
19
Source : Player.cs
with MIT License
from 1ZouLTReX1
with MIT License
from 1ZouLTReX1
public void MergeWithBuffer()
{
lock (userCommandBufferList)
{
// TODO work out why some User Commands are null
// it works for now tho
for (int i = userCommandBufferList.Count - 1; i >= 0; i--)
{
if (userCommandBufferList[i] == null)
{
userCommandBufferList.RemoveAt(i);
}
else
{
jitter.Update(userCommandBufferList[i].serverRecTime - lastRecTime);
lastRecTime = userCommandBufferList[i].serverRecTime;
}
}
userCommandList.AddRange(userCommandBufferList);
userCommandBufferList.Clear();
}
userCommandList.Sort((a, b) => a.serverRecTime.CompareTo(b.serverRecTime));
// DEBUG Jitter
//Debug.Log(jitter.stdDeviation + ", " + jitter.average);
}
19
Source : Server.cs
with MIT License
from 1ZouLTReX1
with MIT License
from 1ZouLTReX1
public ushort GetPlayerId()
{
var newID = playerIdList[0];
playerIdList.RemoveAt(0);
return newID;
}
19
Source : DefaultConfig.cs
with Apache License 2.0
from 214175590
with Apache License 2.0
from 214175590
public static void RemoveShellLisreplacedem(List<string> shellList, int index)
{
if (index < shellList.Count)
{
shellList.RemoveAt(index);
}
AppConfig.Instance.SaveConfig(2);
}
19
Source : CommandPacket.cs
with MIT License
from 2881099
with MIT License
from 2881099
public CommandPacket Command(string cmd, string subcmd = null)
{
if (!string.IsNullOrWhiteSpace(_command) && _command.Equals(_input.FirstOrDefault())) _input.RemoveAt(0);
if (!string.IsNullOrWhiteSpace(_subcommand) && _subcommand.Equals(_input.FirstOrDefault())) _input.RemoveAt(0);
_command = cmd;
_subcommand = subcmd;
if (!string.IsNullOrWhiteSpace(_command))
{
if (!string.IsNullOrWhiteSpace(_subcommand)) _input.Insert(0, _subcommand);
_input.Insert(0, _command);
}
return this;
}
19
Source : DbContextSync.cs
with MIT License
from 2881099
with MIT License
from 2881099
internal void ExecCommand() {
if (isExecCommanding) return;
if (_actions.Any() == false) return;
isExecCommanding = true;
ExecCommandInfo oldinfo = null;
var states = new List<object>();
Func<string, int> dbContextBetch = methodName => {
if (_dicExecCommandDbContextBetch.TryGetValue(oldinfo.stateType, out var trydic) == false)
trydic = new Dictionary<string, Func<object, object[], int>>();
if (trydic.TryGetValue(methodName, out var tryfunc) == false) {
var arrType = oldinfo.stateType.MakeArrayType();
var dbsetType = oldinfo.dbSet.GetType().BaseType;
var dbsetTypeMethod = dbsetType.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { arrType }, null);
var returnTarget = Expression.Label(typeof(int));
var parm1DbSet = Expression.Parameter(typeof(object));
var parm2Vals = Expression.Parameter(typeof(object[]));
var var1Vals = Expression.Variable(arrType);
tryfunc = Expression.Lambda<Func<object, object[], int>>(Expression.Block(
new[] { var1Vals },
Expression.replacedign(var1Vals, Expression.Convert(global::FreeSql.Internal.Utils.GetDataReaderValueBlockExpression(arrType, parm2Vals), arrType)),
Expression.Return(returnTarget, Expression.Call(Expression.Convert(parm1DbSet, dbsetType), dbsetTypeMethod, var1Vals)),
Expression.Label(returnTarget, Expression.Default(typeof(int)))
), new[] { parm1DbSet, parm2Vals }).Compile();
trydic.Add(methodName, tryfunc);
}
return tryfunc(oldinfo.dbSet, states.ToArray());
};
Action funcDelete = () => {
_affrows += dbContextBetch("DbContextBetchRemove");
states.Clear();
};
Action funcInsert = () => {
_affrows += dbContextBetch("DbContextBetchAdd");
states.Clear();
};
Action<bool> funcUpdate = isLiveUpdate => {
var affrows = 0;
if (isLiveUpdate) affrows = dbContextBetch("DbContextBetchUpdateNow");
else affrows = dbContextBetch("DbContextBetchUpdate");
if (affrows == -999) { //最后一个元素已被删除
states.RemoveAt(states.Count - 1);
return;
}
if (affrows == -998 || affrows == -997) { //没有执行更新
var laststate = states[states.Count - 1];
states.Clear();
if (affrows == -997) states.Add(laststate); //保留最后一个
}
if (affrows > 0) {
_affrows += affrows;
var islastNotUpdated = states.Count != affrows;
var laststate = states[states.Count - 1];
states.Clear();
if (islastNotUpdated) states.Add(laststate); //保留最后一个
}
};
while (_actions.Any() || states.Any()) {
var info = _actions.Any() ? _actions.Dequeue() : null;
if (oldinfo == null) oldinfo = info;
var isLiveUpdate = false;
if (_actions.Any() == false && states.Any() ||
info != null && oldinfo.actionType != info.actionType ||
info != null && oldinfo.stateType != info.stateType) {
if (info != null && oldinfo.actionType == info.actionType && oldinfo.stateType == info.stateType) {
//最后一个,合起来发送
states.Add(info.state);
info = null;
}
switch (oldinfo.actionType) {
case ExecCommandInfoType.Insert:
funcInsert();
break;
case ExecCommandInfoType.Delete:
funcDelete();
break;
}
isLiveUpdate = true;
}
if (isLiveUpdate || oldinfo.actionType == ExecCommandInfoType.Update) {
if (states.Any())
funcUpdate(isLiveUpdate);
}
if (info != null) {
states.Add(info.state);
oldinfo = info;
}
}
isExecCommanding = false;
}
19
Source : DbSetAsync.cs
with MIT License
from 2881099
with MIT License
from 2881099
async Task<int> DbContextBetchUpdatePrivAsync(EnreplacedyState[] ups, bool isLiveUpdate) {
if (ups.Any() == false) return 0;
var uplst1 = ups[ups.Length - 1];
var uplst2 = ups.Length > 1 ? ups[ups.Length - 2] : null;
if (_states.TryGetValue(uplst1.Key, out var lstval1) == false) return -999;
var lstval2 = default(EnreplacedyState);
if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception($"特别错误:更新失败,数据未被跟踪:{_fsql.GetEnreplacedyString(_enreplacedyType, uplst2.Value)}");
var cuig1 = _fsql.CompareEnreplacedyValueReturnColumns(_enreplacedyType, uplst1.Value, lstval1.Value, true);
var cuig2 = uplst2 != null ? _fsql.CompareEnreplacedyValueReturnColumns(_enreplacedyType, uplst2.Value, lstval2.Value, true) : null;
List<EnreplacedyState> data = null;
string[] cuig = null;
if (uplst2 != null && string.Compare(string.Join(",", cuig1), string.Join(",", cuig2)) != 0) {
//最后一个不保存
data = ups.ToList();
data.RemoveAt(ups.Length - 1);
cuig = cuig2;
} else if (isLiveUpdate) {
//立即保存
data = ups.ToList();
cuig = cuig1;
}
if (data?.Count > 0) {
if (cuig.Length == _table.Columns.Count)
return ups.Length == data.Count ? -998 : -997;
var updateSource = data.Select(a => a.Value).ToArray();
var update = this.OrmUpdate(null).SetSource(updateSource).IgnoreColumns(cuig);
var affrows = await update.ExecuteAffrowsAsync();
foreach (var newval in data) {
if (_states.TryGetValue(newval.Key, out var tryold))
_fsql.MapEnreplacedyValue(_enreplacedyType, newval.Value, tryold.Value);
if (newval.OldValue != null)
_fsql.MapEnreplacedyValue(_enreplacedyType, newval.Value, newval.OldValue);
}
return affrows;
}
//等待下次对比再保存
return 0;
}
19
Source : DbContextAsync.cs
with MIT License
from 2881099
with MIT License
from 2881099
async internal Task ExecCommandAsync() {
if (isExecCommanding) return;
if (_actions.Any() == false) return;
isExecCommanding = true;
ExecCommandInfo oldinfo = null;
var states = new List<object>();
Func<string, Task<int>> dbContextBetch = methodName => {
if (_dicExecCommandDbContextBetchAsync.TryGetValue(oldinfo.stateType, out var trydic) == false)
trydic = new Dictionary<string, Func<object, object[], Task<int>>>();
if (trydic.TryGetValue(methodName, out var tryfunc) == false) {
var arrType = oldinfo.stateType.MakeArrayType();
var dbsetType = oldinfo.dbSet.GetType().BaseType;
var dbsetTypeMethod = dbsetType.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { arrType }, null);
var returnTarget = Expression.Label(typeof(Task<int>));
var parm1DbSet = Expression.Parameter(typeof(object));
var parm2Vals = Expression.Parameter(typeof(object[]));
var var1Vals = Expression.Variable(arrType);
tryfunc = Expression.Lambda<Func<object, object[], Task<int>>>(Expression.Block(
new[] { var1Vals },
Expression.replacedign(var1Vals, Expression.Convert(global::FreeSql.Internal.Utils.GetDataReaderValueBlockExpression(arrType, parm2Vals), arrType)),
Expression.Return(returnTarget, Expression.Call(Expression.Convert(parm1DbSet, dbsetType), dbsetTypeMethod, var1Vals)),
Expression.Label(returnTarget, Expression.Default(typeof(Task<int>)))
), new[] { parm1DbSet, parm2Vals }).Compile();
trydic.Add(methodName, tryfunc);
}
return tryfunc(oldinfo.dbSet, states.ToArray());
};
Func<Task> funcDelete = async () => {
_affrows += await dbContextBetch("DbContextBetchRemoveAsync");
states.Clear();
};
Func<Task> funcInsert = async () => {
_affrows += await dbContextBetch("DbContextBetchAddAsync");
states.Clear();
};
Func<bool, Task> funcUpdate = async (isLiveUpdate) => {
var affrows = 0;
if (isLiveUpdate) affrows = await dbContextBetch("DbContextBetchUpdateNowAsync");
else affrows = await dbContextBetch("DbContextBetchUpdateAsync");
if (affrows == -999) { //最后一个元素已被删除
states.RemoveAt(states.Count - 1);
return;
}
if (affrows == -998 || affrows == -997) { //没有执行更新
var laststate = states[states.Count - 1];
states.Clear();
if (affrows == -997) states.Add(laststate); //保留最后一个
}
if (affrows > 0) {
_affrows += affrows;
var islastNotUpdated = states.Count != affrows;
var laststate = states[states.Count - 1];
states.Clear();
if (islastNotUpdated) states.Add(laststate); //保留最后一个
}
};
while (_actions.Any() || states.Any()) {
var info = _actions.Any() ? _actions.Dequeue() : null;
if (oldinfo == null) oldinfo = info;
var isLiveUpdate = false;
if (_actions.Any() == false && states.Any() ||
info != null && oldinfo.actionType != info.actionType ||
info != null && oldinfo.stateType != info.stateType) {
if (info != null && oldinfo.actionType == info.actionType && oldinfo.stateType == info.stateType) {
//最后一个,合起来发送
states.Add(info.state);
info = null;
}
switch (oldinfo.actionType) {
case ExecCommandInfoType.Insert:
await funcInsert();
break;
case ExecCommandInfoType.Delete:
await funcDelete();
break;
}
isLiveUpdate = true;
}
if (isLiveUpdate || oldinfo.actionType == ExecCommandInfoType.Update) {
if (states.Any())
await funcUpdate(isLiveUpdate);
}
if (info != null) {
states.Add(info.state);
oldinfo = info;
}
}
isExecCommanding = false;
}
19
Source : DbSetSync.cs
with MIT License
from 2881099
with MIT License
from 2881099
int DbContextBetchUpdatePriv(EnreplacedyState[] ups, bool isLiveUpdate) {
if (ups.Any() == false) return 0;
var uplst1 = ups[ups.Length - 1];
var uplst2 = ups.Length > 1 ? ups[ups.Length - 2] : null;
if (_states.TryGetValue(uplst1.Key, out var lstval1) == false) return -999;
var lstval2 = default(EnreplacedyState);
if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception($"特别错误:更新失败,数据未被跟踪:{_fsql.GetEnreplacedyString(_enreplacedyType, uplst2.Value)}");
var cuig1 = _fsql.CompareEnreplacedyValueReturnColumns(_enreplacedyType, uplst1.Value, lstval1.Value, true);
var cuig2 = uplst2 != null ? _fsql.CompareEnreplacedyValueReturnColumns(_enreplacedyType, uplst2.Value, lstval2.Value, true) : null;
List<EnreplacedyState> data = null;
string[] cuig = null;
if (uplst2 != null && string.Compare(string.Join(",", cuig1), string.Join(",", cuig2)) != 0) {
//最后一个不保存
data = ups.ToList();
data.RemoveAt(ups.Length - 1);
cuig = cuig2;
} else if (isLiveUpdate) {
//立即保存
data = ups.ToList();
cuig = cuig1;
}
if (data?.Count > 0) {
if (cuig.Length == _table.Columns.Count)
return ups.Length == data.Count ? -998 : -997;
var updateSource = data.Select(a => a.Value).ToArray();
var update = this.OrmUpdate(null).SetSource(updateSource).IgnoreColumns(cuig);
var affrows = update.ExecuteAffrows();
foreach (var newval in data) {
if (_states.TryGetValue(newval.Key, out var tryold))
_fsql.MapEnreplacedyValue(_enreplacedyType, newval.Value, tryold.Value);
if (newval.OldValue != null)
_fsql.MapEnreplacedyValue(_enreplacedyType, newval.Value, newval.OldValue);
}
return affrows;
}
//等待下次对比再保存
return 0;
}
19
Source : LeapVRTemporalWarping.cs
with MIT License
from 39M
with MIT License
from 39M
private void updateHistory(Vector3 currLocalPosition, Quaternion currLocalRotation) {
long leapNow = provider.GetLeapController().Now();
_history.Add(new TransformData() {
leapTime = leapNow,
localPosition = currLocalPosition,
localRotation = currLocalRotation
});
// Reduce history length
while (_history.Count > 0 &&
MAX_LATENCY < leapNow - _history[0].leapTime) {
_history.RemoveAt(0);
}
}
19
Source : SlidingMaxTest.cs
with MIT License
from 39M
with MIT License
from 39M
[Test]
public void IsFunctional() {
List<float> list = new List<float>();
for (int i = 0; i < 1000; i++) {
float newValue = Random.value;
_slidingMax.AddValue(newValue);
list.Add(newValue);
while (list.Count > MAX_HISTORY) {
list.RemoveAt(0);
}
float max = list[0];
for (int j = 1; j < list.Count; j++) {
max = Mathf.Max(max, list[j]);
}
replacedert.That(max, Is.EqualTo(_slidingMax.Max));
}
}
19
Source : HandPool.cs
with MIT License
from 39M
with MIT License
from 39M
public IHandModel TryGetModel(Chirality chirality, ModelType modelType) {
for (int i = 0; i < modelList.Count; i++) {
if (modelList[i].HandModelType == modelType && modelList[i].Handedness == chirality) {
IHandModel model = modelList[i];
modelList.RemoveAt(i);
modelsCheckedOut.Add(model);
return model;
}
}
if (CanDuplicate) {
for (int i = 0; i < modelsCheckedOut.Count; i++) {
if (modelsCheckedOut[i].HandModelType == modelType && modelsCheckedOut[i].Handedness == chirality) {
IHandModel modelToSpawn = modelsCheckedOut[i];
IHandModel spawnedModel = GameObject.Instantiate(modelToSpawn);
spawnedModel.transform.parent = _handPool.ModelsParent;
_handPool.modelGroupMapping.Add(spawnedModel, this);
modelsCheckedOut.Add(spawnedModel);
return spawnedModel;
}
}
}
return null;
}
19
Source : PostEffectsBase.cs
with MIT License
from 39M
with MIT License
from 39M
private void RemoveCreatedMaterials ()
{
while (createdMaterials.Count > 0)
{
Material mat = createdMaterials[0];
createdMaterials.RemoveAt (0);
#if UNITY_EDITOR
DestroyImmediate (mat);
#else
Destroy(mat);
#endif
}
}
19
Source : GameManager.cs
with MIT License
from 39M
with MIT License
from 39M
void HitNote(int i)
{
hitCount++;
comboBonus += comboCount;
comboCount++;
if (comboCount > maxCombo)
{
maxCombo = comboCount;
}
ShowCombo();
AddHP();
GameObject noteGameObject = noteObjectList[i].gameObject;
audio.PlayOneShot(hitSoundClip);
CreateHitParticle(noteGameObject.transform.position, hitParticlePrefab);
ShowHitJudgement();
Destroy(noteGameObject);
noteObjectList.RemoveAt(i);
if (!RuntimeData.useCustomMusic && noteObjectList.Count <= 0 && currentNote == null)
{
EndGame();
}
}
19
Source : GameManager.cs
with MIT License
from 39M
with MIT License
from 39M
void MissedNote(int i)
{
missCount++;
comboCount = 0;
ResetCombo();
SubHP();
ShowMissJudgement();
GameObject noteGameObject = noteObjectList[i].gameObject;
CreateHitParticle(noteGameObject.transform.position, missParticlePrefab);
Destroy(noteGameObject);
noteObjectList.RemoveAt(i);
if (!RuntimeData.useCustomMusic && noteObjectList.Count <= 0 && currentNote == null)
{
EndGame();
}
}
19
Source : GCodeParser.cs
with MIT License
from 3RD-Dimension
with MIT License
from 3RD-Dimension
static void Parse(string line, int lineNumber)
{
MatchCollection matches = GCodeSplitter.Matches(line);
List<Word> Words = new List<Word>(matches.Count);
foreach (Match match in matches)
{
Words.Add(new Word() { Command = match.Groups[1].Value[0], Parameter = double.Parse(match.Groups[2].Value, Constants.DecimalParseFormat) });
}
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command == 'N')
{
Words.RemoveAt(i--);
continue;
}
if (IgnoreAxes.Contains(Words[i].Command) && Properties.Settings.Default.IgnoreAdditionalAxes)
{
Words.RemoveAt(i--);
continue;
}
if (!ValidWords.Contains(Words[i].Command))
{
Warnings.Add($"ignoring unknown word (letter): \"{Words[i]}\". (line {lineNumber})");
Words.RemoveAt(i--);
continue;
}
if (Words[i].Command != 'F')
continue;
State.Feed = Words[i].Parameter;
if (State.Unit == ParseUnit.Imperial)
State.Feed *= 25.4;
Words.RemoveAt(i--);
continue;
}
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command == 'M')
{
int param = (int)Words[i].Parameter;
if (param != Words[i].Parameter || param < 0)
throw new ParseException("M code can only have positive integer parameters", lineNumber);
Commands.Add(new MCode() { Code = param, LineNumber = lineNumber });
Words.RemoveAt(i);
i--;
continue;
}
if (Words[i].Command == 'S')
{
double param = Words[i].Parameter;
if (param < 0)
Warnings.Add($"spindle speed must be positive. (line {lineNumber})");
Commands.Add(new Spindle() { Speed = Math.Abs(param), LineNumber = lineNumber });
Words.RemoveAt(i);
i--;
continue;
}
if (Words[i].Command == 'G' && !MotionCommands.Contains(Words[i].Parameter))
{
#region UnitPlaneDistanceMode
double param = Words[i].Parameter;
if (param == 90)
{
State.DistanceMode = ParseDistanceMode.Absolute;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 91)
{
State.DistanceMode = ParseDistanceMode.Incremental;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 90.1)
{
State.ArcDistanceMode = ParseDistanceMode.Absolute;
Words.RemoveAt(i);
continue;
}
if (param == 91.1)
{
State.ArcDistanceMode = ParseDistanceMode.Incremental;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 21)
{
State.Unit = ParseUnit.Metric;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 20)
{
State.Unit = ParseUnit.Imperial;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 17)
{
State.Plane = ArcPlane.XY;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 18)
{
State.Plane = ArcPlane.ZX;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 19)
{
State.Plane = ArcPlane.YZ;
Words.RemoveAt(i);
i--;
continue;
}
if (param == 4)
{
if (Words.Count >= 2 && Words[i + 1].Command == 'P')
{
if (Words[i + 1].Parameter < 0)
Warnings.Add($"dwell time must be positive. (line {lineNumber})");
Commands.Add(new Dwell() { Seconds = Math.Abs(Words[i + 1].Parameter), LineNumber = lineNumber });
Words.RemoveAt(i + 1);
Words.RemoveAt(i);
i--;
continue;
}
}
Warnings.Add($"ignoring unknown command G{param}. (line {lineNumber})");
Words.RemoveAt(i--);
#endregion
}
}
if (Words.Count == 0)
return;
int MotionMode = State.LastMotionMode;
if (Words.First().Command == 'G')
{
MotionMode = (int)Words.First().Parameter;
State.LastMotionMode = MotionMode;
Words.RemoveAt(0);
}
if (MotionMode < 0)
throw new ParseException("no motion mode active", lineNumber);
double UnitMultiplier = (State.Unit == ParseUnit.Metric) ? 1 : 25.4;
Vector3 EndPos = State.Position;
if (State.DistanceMode == ParseDistanceMode.Incremental && State.PositionValid.Any(isValid => !isValid))
{
throw new ParseException("incremental motion is only allowed after an absolute position has been established (eg. with \"G90 G0 X0 Y0 Z5\")", lineNumber);
}
if ((MotionMode == 2 || MotionMode == 3) && State.PositionValid.Any(isValid => !isValid))
{
throw new ParseException("arcs (G2/G3) are only allowed after an absolute position has been established (eg. with \"G90 G0 X0 Y0 Z5\")", lineNumber);
}
#region FindEndPos
{
int Incremental = (State.DistanceMode == ParseDistanceMode.Incremental) ? 1 : 0;
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'X')
continue;
EndPos.X = Words[i].Parameter * UnitMultiplier + Incremental * EndPos.X;
Words.RemoveAt(i);
State.PositionValid[0] = true;
break;
}
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'Y')
continue;
EndPos.Y = Words[i].Parameter * UnitMultiplier + Incremental * EndPos.Y;
Words.RemoveAt(i);
State.PositionValid[1] = true;
break;
}
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'Z')
continue;
EndPos.Z = Words[i].Parameter * UnitMultiplier + Incremental * EndPos.Z;
Words.RemoveAt(i);
State.PositionValid[2] = true;
break;
}
}
#endregion
if (MotionMode != 0 && State.Feed <= 0)
{
throw new ParseException("feed rate undefined", lineNumber);
}
if (MotionMode == 1 && State.PositionValid.Any(isValid => !isValid))
{
Warnings.Add($"a feed move is used before an absolute position is established, height maps will not be applied to this motion. (line {lineNumber})");
}
if (MotionMode <= 1)
{
if (Words.Count > 0)
Warnings.Add($"motion command must be last in line (ignoring unused words {string.Join(" ", Words)} in block). (line {lineNumber})");
Line motion = new Line();
motion.Start = State.Position;
motion.End = EndPos;
motion.Feed = State.Feed;
motion.Rapid = MotionMode == 0;
motion.LineNumber = lineNumber;
State.PositionValid.CopyTo(motion.PositionValid, 0);
Commands.Add(motion);
State.Position = EndPos;
return;
}
double U, V;
bool IJKused = false;
switch (State.Plane)
{
default:
U = State.Position.X;
V = State.Position.Y;
break;
case ArcPlane.YZ:
U = State.Position.Y;
V = State.Position.Z;
break;
case ArcPlane.ZX:
U = State.Position.Z;
V = State.Position.X;
break;
}
#region FindIJK
{
int ArcIncremental = (State.ArcDistanceMode == ParseDistanceMode.Incremental) ? 1 : 0;
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'I')
continue;
switch (State.Plane)
{
case ArcPlane.XY:
U = Words[i].Parameter * UnitMultiplier + ArcIncremental * State.Position.X;
break;
case ArcPlane.YZ:
throw new ParseException("current plane is YZ, I word is invalid", lineNumber);
case ArcPlane.ZX:
V = Words[i].Parameter * UnitMultiplier + ArcIncremental * State.Position.X;
break;
}
IJKused = true;
Words.RemoveAt(i);
break;
}
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'J')
continue;
switch (State.Plane)
{
case ArcPlane.XY:
V = Words[i].Parameter * UnitMultiplier + ArcIncremental * State.Position.Y;
break;
case ArcPlane.YZ:
U = Words[i].Parameter * UnitMultiplier + ArcIncremental * State.Position.Y;
break;
case ArcPlane.ZX:
throw new ParseException("current plane is ZX, J word is invalid", lineNumber);
}
IJKused = true;
Words.RemoveAt(i);
break;
}
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'K')
continue;
switch (State.Plane)
{
case ArcPlane.XY:
throw new ParseException("current plane is XY, K word is invalid", lineNumber);
case ArcPlane.YZ:
V = Words[i].Parameter * UnitMultiplier + ArcIncremental * State.Position.Z;
break;
case ArcPlane.ZX:
U = Words[i].Parameter * UnitMultiplier + ArcIncremental * State.Position.Z;
break;
}
IJKused = true;
Words.RemoveAt(i);
break;
}
}
#endregion
#region ResolveRadius
for (int i = 0; i < Words.Count; i++)
{
if (Words[i].Command != 'R')
continue;
if (IJKused)
throw new ParseException("both IJK and R notation used", lineNumber);
if (State.Position == EndPos)
throw new ParseException("arcs in R-notation must have non-coincident start and end points", lineNumber);
double Radius = Words[i].Parameter * UnitMultiplier;
if (Radius == 0)
throw new ParseException("radius can't be zero", lineNumber);
double A, B;
switch (State.Plane)
{
default:
A = EndPos.X;
B = EndPos.Y;
break;
case ArcPlane.YZ:
A = EndPos.Y;
B = EndPos.Z;
break;
case ArcPlane.ZX:
A = EndPos.Z;
B = EndPos.X;
break;
}
A -= U; //(AB) = vector from start to end of arc along the axes of the current plane
B -= V;
//see grbl/gcode.c
double h_x2_div_d = 4.0 * (Radius * Radius) - (A * A + B * B);
if (h_x2_div_d < 0)
{
throw new ParseException("arc radius too small to reach both ends", lineNumber);
}
h_x2_div_d = -Math.Sqrt(h_x2_div_d) / Math.Sqrt(A * A + B * B);
if (MotionMode == 3 ^ Radius < 0)
{
h_x2_div_d = -h_x2_div_d;
}
U += 0.5 * (A - (B * h_x2_div_d));
V += 0.5 * (B + (A * h_x2_div_d));
Words.RemoveAt(i);
break;
}
#endregion
if (Words.Count > 0)
Warnings.Add($"motion command must be last in line (ignoring unused words {string.Join(" ", Words)} in block). (line {lineNumber})");
Arc arc = new Arc();
arc.Start = State.Position;
arc.End = EndPos;
arc.Feed = State.Feed;
arc.Direction = (MotionMode == 2) ? ArcDirection.CW : ArcDirection.CCW;
arc.U = U;
arc.V = V;
arc.LineNumber = lineNumber;
arc.Plane = State.Plane;
Commands.Add(arc);
State.Position = EndPos;
return;
}
19
Source : SynchSubscribers.cs
with MIT License
from 3F
with MIT License
from 3F
public bool Unregister(T listener)
{
lock(sync)
{
int idx = listeners.FindIndex(p => p.Id == listener.Id);
if(idx == -1) {
return false;
}
listeners.RemoveAt(idx);
accessor.TryRemove(listener.Id, out T v);
LSender.Send(this, $"listener has been removed from container - {listener.Id}", Message.Level.Debug);
return true;
}
}
19
Source : RoslynUtil.cs
with MIT License
from 404Lcc
with MIT License
from 404Lcc
public static List<string> ReadCSPROJ(string path, ref List<string> defineList, ref List<string> dllFilePathList)
{
List<string> csFilePathList = new List<string>();
List<string> csprojPathList = new List<string>();
XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
xmlDoreplacedent.Load(path);
XmlNode xmlNode = null;
foreach (XmlNode item in xmlDoreplacedent.ChildNodes)
{
if (item.Name == "Project")
{
xmlNode = item;
break;
}
}
foreach (XmlNode item in xmlNode.ChildNodes)
{
if (item.Name == "PropertyGroup")
{
foreach (XmlNode childItem in item.ChildNodes)
{
if (childItem.Name == "DefineConstants")
{
//宏引用
string define = childItem.InnerText;
defineList.AddRange(define.Split(';'));
}
}
}
if (item.Name == "ItemGroup")
{
foreach (XmlNode childItem in item.ChildNodes)
{
if (childItem.Name == "Reference")
{
//dll引用
string dllFilePath = childItem.FirstChild.InnerText.Replace("\\", "/");
dllFilePathList.Add(dllFilePath);
}
if (childItem.Name == "Compile")
{
//cs引用
string csFilePath = childItem.Attributes[0].Value.Replace("\\", "/");
csFilePathList.Add(csFilePath);
}
if (childItem.Name == "ProjectReference")
{
//工程引用
string csprojFilePath = childItem.Attributes[0].Value;
csprojPathList.Add(csprojFilePath);
}
}
}
}
//遍历工程引用
foreach (string item in csprojPathList)
{
if (item.ToLower().Contains("editor"))
{
continue;
}
ReadCSPROJ(item, ref defineList, ref dllFilePathList);
string dllFilePath = "Library/Scriptreplacedemblies/" + item.Replace(".csproj", ".dll");
if (File.Exists(dllFilePath))
{
dllFilePathList.Add(dllFilePath);
}
}
defineList = defineList.Distinct().ToList();
//移除相关宏
for (int i = defineList.Count - 1; i >= 0; i--)
{
if (defineList[i].Contains("UNITY_EDITOR"))
{
defineList.RemoveAt(i);
}
}
dllFilePathList = dllFilePathList.Distinct().ToList();
return csFilePathList;
}
19
Source : MainWindow.xaml.Macros.cs
with MIT License
from 3RD-Dimension
with MIT License
from 3RD-Dimension
private void RefreshMacroButtons()
{
StackPanelMacros.Children.Clear();
for (int i = 0; i < Macros.Count; i++)
{
int index = i;
Button b = new Button();
b.Content = (Macros[i].Item3 ? "[E] " : "") + Macros[i].Item1;
b.Margin = new Thickness(2, 0, 2, 2);
b.Click += (sender, e) => { RunMacro(Macros[index].Item2, Macros[index].Item3); };
b.ToolTip = Macros[i].Item2;
MenuItem edireplacedem = new MenuItem();
edireplacedem.Header = "Edit";
edireplacedem.Click += (s, e) =>
{
var emiw = new EditMacroItemWindow(Macros[index].Item1, Macros[index].Item2, Macros[index].Item3);
emiw.ShowDialog();
if (emiw.Ok)
{
Macros[index] = new Tuple<string, string, bool>(emiw.MacroName, emiw.Commands, emiw.UseMacros);
SaveMacros();
RefreshMacroButtons();
}
};
MenuItem removeItem = new MenuItem();
removeItem.Header = "Remove";
removeItem.Click += (s, e) => { Macros.RemoveAt(index); RefreshMacroButtons(); };
ContextMenu menu = new ContextMenu();
menu.Items.Add(edireplacedem);
menu.Items.Add(removeItem);
if (i > 0)
{
MenuItem moveUpItem = new MenuItem();
moveUpItem.Header = "Move Up";
moveUpItem.Click += (s, e) =>
{
var macro = Macros[index];
Macros.RemoveAt(index);
Macros.Insert(index - 1, macro);
SaveMacros();
RefreshMacroButtons();
};
menu.Items.Add(moveUpItem);
}
b.ContextMenu = menu;
StackPanelMacros.Children.Add(b);
}
}
19
Source : Console.cs
with MIT License
from 5minlab
with MIT License
from 5minlab
public static void Log(string str, string stacktrace, LogType lv, DateTime time) {
Instance.m_output.Add(new LogEntry(str, stacktrace, lv, time));
if (Instance.m_output.Count > MAX_LINES) {
Instance.m_output.RemoveAt(0);
}
}
19
Source : Shell.cs
with MIT License
from 5minlab
with MIT License
from 5minlab
private void RecordCommand(string command) {
m_history.Insert(0, command);
if (m_history.Count > MAX_HISTORY)
m_history.RemoveAt(m_history.Count - 1);
}
19
Source : SimpleJSON.cs
with MIT License
from 71
with MIT License
from 71
public override JSONNode Remove(int aIndex)
{
if (aIndex < 0 || aIndex >= m_List.Count)
return null;
JSONNode tmp = m_List[aIndex];
m_List.RemoveAt(aIndex);
return tmp;
}
19
Source : Shell.cs
with MIT License
from 5minlab
with MIT License
from 5minlab
public static void Log(string str) {
Instance.m_output.Add(str);
if (Instance.m_output.Count > MAX_LINES) {
Instance.m_output.RemoveAt(0);
}
}
19
Source : AINavMeshGenerator.cs
with MIT License
from 7ark
with MIT License
from 7ark
private void DestroyBadNodes()
{
//First check if each node is inside a destroy mask
for (int i = Grid.Count - 1; i >= 0; i--)
{
Collider2D hit = Physics2D.OverlapCircle(Grid[i].position, 0.01f, destroyNodeMask);
if (hit != null)
{
//At this point, we know this node is bad, and we must destroy it. For humanity itself.
for (int j = 0; j < Grid[i].connections.Length; j++)
{
//Go through all the connections to this node
if (Grid[i].connections[j] != null)
{
for (int k = 0; k < Grid[i].connections[j].connections.Length; k++)
{
//Set the nodes connections reference to this node to null, because it no longer exists.
//Is that confusing? It sounds confusing.
if (Grid[i].connections[j].connections[k] != null)
{
if (Grid[i].connections[j].connections[k] == Grid[i])
{
Grid[i].connections[j].connections[k] = null;
}
}
}
}
}
Grid.RemoveAt(i);
}
}
}
19
Source : Geometry.cs
with GNU Lesser General Public License v3.0
from 9and3
with GNU Lesser General Public License v3.0
from 9and3
public static List<IntPoint> ToPath2D(this Polyline pl, Plane pln, double tolerance) {
List<IntPoint> path = new List<IntPoint>();
foreach (Point3d pt in pl) {
path.Add(pt.ToIntPoint2D(pln, tolerance));
}
if (pl.IsClosed) {
path.RemoveAt(pl.Count - 1);
}
return path;
}
19
Source : AssetBundleManager.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
void Update()
{
// Update all in progress operations
for (int i = 0; i < m_InProgressOperations.Count;)
{
var operation = m_InProgressOperations[i];
if (operation.Update())
{
i++;
}
else
{
m_InProgressOperations.RemoveAt(i);
ProcessFinishedOperation(operation);
}
}
}
19
Source : OverlayLibraryEditor.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public override void OnInspectorGUI(){
m_Object.Update();
serializedObject.Update();
GUILayout.Label ("overlayList", EditorStyles.boldLabel);
OverlayDatareplacedet[] overlayElementList = GetOverlayDataArray();
GUILayout.Space(30);
GUILayout.Label ("Overlays reduced " + scaleAdjust.intValue +" time(s)");
GUILayout.BeginHorizontal();
if(scaleAdjust.intValue > 0){
if(GUILayout.Button("Resolution +")){
ScaleUpTextures();
isDirty = true;
canUpdate = false;
scaleAdjust.intValue --;
}
}
if(GUILayout.Button("Resolution -")){
ScaleDownTextures();
isDirty = true;
canUpdate = false;
scaleAdjust.intValue ++;
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
GUILayout.BeginHorizontal();
compress.boolValue = GUILayout.Toggle (compress.boolValue ? true : false," Compress Textures");
readWrite.boolValue = GUILayout.Toggle (readWrite.boolValue ? true : false," Read/Write");
if(GUILayout.Button(" Apply")){
ConfigureTextures();
isDirty = true;
canUpdate = false;
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
GUILayout.BeginHorizontal();
if(GUILayout.Button("Order by Name")){
canUpdate = false;
List<OverlayDatareplacedet> OverlayDataTemp = overlayElementList.ToList();
//Make sure there's no invalid data
for(int i = 0; i < OverlayDataTemp.Count; i++){
if(OverlayDataTemp[i] == null){
OverlayDataTemp.RemoveAt(i);
i--;
}
}
OverlayDataTemp.Sort((x,y) => x.name.CompareTo(y.name));
for(int i = 0; i < OverlayDataTemp.Count; i++){
SetOverlayData(i,OverlayDataTemp[i]);
}
}
if(GUILayout.Button("Update List")){
isDirty = true;
canUpdate = false;
}
if (GUILayout.Button("Remove Duplicates"))
{
HashSet<OverlayDatareplacedet> Overlays = new HashSet<OverlayDatareplacedet>();
foreach(OverlayDatareplacedet oda in overlayElementList)
{
Overlays.Add(oda);
}
m_OverlayDataCount.intValue = Overlays.Count;
for(int i=0;i<Overlays.Count;i++)
{
SetOverlayData(i,Overlays.ElementAt(i));
}
isDirty = true;
canUpdate = false;
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
Rect dropArea = GUILayoutUtility.GetRect(0.0f,50.0f, GUILayout.ExpandWidth(true));
GUI.Box(dropArea,"Drag Overlays here");
GUILayout.Space(20);
for(int i = 0; i < m_OverlayDataCount.intValue; i ++){
GUILayout.BeginHorizontal();
var result = EditorGUILayout.ObjectField(overlayElementList[i], typeof(OverlayDatareplacedet), true) as OverlayDatareplacedet;
if(GUI.changed && canUpdate){
SetOverlayData(i,result);
}
if(GUILayout.Button("-", GUILayout.Width(20.0f))){
canUpdate = false;
RemoveOverlayDataAtIndex(i);
}
GUILayout.EndHorizontal();
if(i == m_OverlayDataCount.intValue -1){
canUpdate = true;
if(isDirty){
overlayLibrary.UpdateDictionary();
isDirty = false;
}
}
}
DropAreaGUI(dropArea);
if(GUILayout.Button("Add OverlayData")){
AddOverlayData(null);
}
if(GUILayout.Button("Clear List")){
m_OverlayDataCount.intValue = 0;
}
m_Object.ApplyModifiedProperties();
serializedObject.ApplyModifiedProperties();
}
19
Source : SlotLibraryEditor.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public override void OnInspectorGUI()
{
m_Object.Update();
GUILayout.Label("slotElementList", EditorStyles.boldLabel);
SlotDatareplacedet[] slotElementList = GetSlotDatareplacedetArray();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Order by Name"))
{
canUpdate = false;
List<SlotDatareplacedet> SlotDatareplacedetTemp = slotElementList.ToList();
//Make sure there's no invalid data
for (int i = 0; i < SlotDatareplacedetTemp.Count; i++)
{
if (SlotDatareplacedetTemp[i] == null)
{
SlotDatareplacedetTemp.RemoveAt(i);
i--;
}
}
SlotDatareplacedetTemp.Sort((x, y) => x.name.CompareTo(y.name));
for (int i = 0; i < SlotDatareplacedetTemp.Count; i++)
{
SetSlotDatareplacedet(i, SlotDatareplacedetTemp[i]);
}
}
if (GUILayout.Button("Update List"))
{
isDirty = true;
canUpdate = false;
}
if (GUILayout.Button("Remove Duplicates"))
{
HashSet<SlotDatareplacedet> Slots = new HashSet<SlotDatareplacedet>();
foreach(SlotDatareplacedet osa in slotElementList)
{
Slots.Add(osa);
}
m_SlotDatareplacedetCount.intValue = Slots.Count;
for(int i=0;i<Slots.Count;i++)
{
SetSlotDatareplacedet(i,Slots.ElementAt(i));
}
isDirty = true;
canUpdate = false;
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
Rect dropArea = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));
GUI.Box(dropArea, "Drag Slots here");
GUILayout.Space(20);
for (int i = 0; i < m_SlotDatareplacedetCount.intValue; i++)
{
GUILayout.BeginHorizontal();
SlotDatareplacedet result = EditorGUILayout.ObjectField(slotElementList[i], typeof(SlotDatareplacedet), true) as SlotDatareplacedet;
if (GUI.changed && canUpdate)
{
SetSlotDatareplacedet(i, result);
}
if (GUILayout.Button("-", GUILayout.Width(20.0f)))
{
canUpdate = false;
RemoveSlotDatareplacedetAtIndex(i);
}
GUILayout.EndHorizontal();
if (i == m_SlotDatareplacedetCount.intValue - 1)
{
canUpdate = true;
if (isDirty)
{
slotLibrary.UpdateDictionary();
isDirty = false;
}
}
}
DropAreaGUI(dropArea);
if (GUILayout.Button("Add SlotDatareplacedet"))
{
AddSlotDatareplacedet(null);
}
if (GUILayout.Button("Clear List"))
{
m_SlotDatareplacedetCount.intValue = 0;
}
if (GUILayout.Button("Remove Invalid Slot Data"))
{
RemoveInvalidSlotDatareplacedet(slotElementList);
}
m_Object.ApplyModifiedProperties();
}
19
Source : pRaceData.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public void Remove(string crossCompatibleRace)
{
int removeAt = -1;
for (int i = 0; i < settingsData.Count; i++)
{
if (settingsData[i].ccRace == crossCompatibleRace)
removeAt = i;
}
if (removeAt > -1)
settingsData.RemoveAt(removeAt);
}
19
Source : DynamicDNAConverterBehaviour.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public bool RemoveDnaCallbackDelegate(UnityAction<string, float> callback, string targetDnaName)
{
bool removed = false;
if (!_dnaCallbackDelegates.ContainsKey(targetDnaName))
{
removed = true;
}
else
{
int removeIndex = -1;
for (int i = 0; i < _dnaCallbackDelegates[targetDnaName].Count; i++)
{
if (_dnaCallbackDelegates[targetDnaName][i] == callback)
{
removeIndex = i;
break;
}
}
if (removeIndex > -1)
{
_dnaCallbackDelegates[targetDnaName].RemoveAt(removeIndex);
if(_dnaCallbackDelegates[targetDnaName].Count == 0)
{
_dnaCallbackDelegates.Remove(targetDnaName);
}
removed = true;
}
}
return removed;
}
19
Source : MaxRectsBinPack.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public Rect Insert(int width, int height, FreeRectChoiceHeuristic method) {
Rect newNode = new Rect();
int score1 = 0; // Unused in this function. We don't need to know the score after finding the position.
int score2 = 0;
switch(method) {
case FreeRectChoiceHeuristic.RectBestShortSideFit: newNode = FindPositionForNewNodeBestShortSideFit(width, height, ref score1, ref score2); break;
case FreeRectChoiceHeuristic.RectBottomLeftRule: newNode = FindPositionForNewNodeBottomLeft(width, height, ref score1, ref score2); break;
case FreeRectChoiceHeuristic.RectContactPointRule: newNode = FindPositionForNewNodeContactPoint(width, height, ref score1); break;
case FreeRectChoiceHeuristic.RectBestLongSideFit: newNode = FindPositionForNewNodeBestLongSideFit(width, height, ref score2, ref score1); break;
case FreeRectChoiceHeuristic.RectBestAreaFit: newNode = FindPositionForNewNodeBestAreaFit(width, height, ref score1, ref score2); break;
}
if (newNode.height == 0)
return newNode;
int numRectanglesToProcess = freeRectangles.Count;
for(int i = 0; i < numRectanglesToProcess; ++i) {
if (SplitFreeNode(freeRectangles[i], ref newNode)) {
freeRectangles.RemoveAt(i);
--i;
--numRectanglesToProcess;
}
}
PruneFreeList();
usedRectangles.Add(newNode);
return newNode;
}
19
Source : MaxRectsBinPack.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public void Insert(List<Rect> rects, List<Rect> dst, FreeRectChoiceHeuristic method) {
dst.Clear();
while(rects.Count > 0) {
int bestScore1 = int.MaxValue;
int bestScore2 = int.MaxValue;
int bestRectIndex = -1;
Rect bestNode = new Rect();
for(int i = 0; i < rects.Count; ++i) {
int score1 = 0;
int score2 = 0;
Rect newNode = ScoreRect((int)rects[i].width, (int)rects[i].height, method, ref score1, ref score2);
if (score1 < bestScore1 || (score1 == bestScore1 && score2 < bestScore2)) {
bestScore1 = score1;
bestScore2 = score2;
bestNode = newNode;
bestRectIndex = i;
}
}
if (bestRectIndex == -1)
return;
PlaceRect(bestNode);
rects.RemoveAt(bestRectIndex);
}
}
19
Source : MaxRectsBinPack.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
void PlaceRect(Rect node) {
int numRectanglesToProcess = freeRectangles.Count;
for(int i = 0; i < numRectanglesToProcess; ++i) {
if (SplitFreeNode(freeRectangles[i], ref node)) {
freeRectangles.RemoveAt(i);
--i;
--numRectanglesToProcess;
}
}
PruneFreeList();
usedRectangles.Add(node);
}
19
Source : MaxRectsBinPack.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
void PruneFreeList() {
for(int i = 0; i < freeRectangles.Count; ++i)
for(int j = i+1; j < freeRectangles.Count; ++j) {
if (IsContainedIn(freeRectangles[i], freeRectangles[j])) {
freeRectangles.RemoveAt(i);
--i;
break;
}
if (IsContainedIn(freeRectangles[j], freeRectangles[i])) {
freeRectangles.RemoveAt(j);
--j;
}
}
}
19
Source : SlotData.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public bool RemoveOverlay(params string[] names)
{
bool changed = false;
foreach (var name in names)
{
for (int i = 0; i < overlayList.Count; i++)
{
if (overlayList[i].overlayName == name)
{
overlayList.RemoveAt(i);
changed = true;
break;
}
}
}
return changed;
}
19
Source : SmoothMouseLook.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
void Update ()
{
if (axes == RotationAxes.MouseXAndY)
{
rotAverageY = 0f;
rotAverageX = 0f;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotArrayY.Add(rotationY);
rotArrayX.Add(rotationX);
if (rotArrayY.Count >= frameCounter) {
rotArrayY.RemoveAt(0);
}
if (rotArrayX.Count >= frameCounter) {
rotArrayX.RemoveAt(0);
}
for(int j = 0; j < rotArrayY.Count; j++) {
rotAverageY += rotArrayY[j];
}
for(int i = 0; i < rotArrayX.Count; i++) {
rotAverageX += rotArrayX[i];
}
rotAverageY /= rotArrayY.Count;
rotAverageX /= rotArrayX.Count;
rotAverageY = ClampAngle (rotAverageY, minimumY, maximumY);
rotAverageX = ClampAngle (rotAverageX, minimumX, maximumX);
Quaternion yQuaternion = Quaternion.AngleAxis (rotAverageY, Vector3.left);
Quaternion xQuaternion = Quaternion.AngleAxis (rotAverageX, Vector3.up);
// alter camera pitch
transform.localRotation = originalRotation * yQuaternion;
// alter parent facing
transform.parent.localRotation = parentRotation * xQuaternion;
}
else if (axes == RotationAxes.MouseX)
{
rotAverageX = 0f;
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotArrayX.Add(rotationX);
if (rotArrayX.Count >= frameCounter) {
rotArrayX.RemoveAt(0);
}
for(int i = 0; i < rotArrayX.Count; i++) {
rotAverageX += rotArrayX[i];
}
rotAverageX /= rotArrayX.Count;
rotAverageX = ClampAngle (rotAverageX, minimumX, maximumX);
Quaternion xQuaternion = Quaternion.AngleAxis (rotAverageX, Vector3.up);
transform.parent.localRotation = parentRotation * xQuaternion;
}
else
{
rotAverageY = 0f;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotArrayY.Add(rotationY);
if (rotArrayY.Count >= frameCounter) {
rotArrayY.RemoveAt(0);
}
for(int j = 0; j < rotArrayY.Count; j++) {
rotAverageY += rotArrayY[j];
}
rotAverageY /= rotArrayY.Count;
rotAverageY = ClampAngle (rotAverageY, minimumY, maximumY);
Quaternion yQuaternion = Quaternion.AngleAxis (rotAverageY, Vector3.left);
transform.localRotation = originalRotation * yQuaternion;
}
}
19
Source : UMAGeneratorBuiltin.cs
with Apache License 2.0
from A7ocin
with Apache License 2.0
from A7ocin
public virtual void OnDirtyUpdate()
{
try
{
if (HandleDirtyUpdate(umaDirtyList[0]))
{
umaDirtyList.RemoveAt(0);
umaData.MoveToList(cleanUmas);
umaData = null;
}
else if (fastGeneration && HandleDirtyUpdate(umaDirtyList[0]))
{
umaDirtyList.RemoveAt(0);
umaData.MoveToList(cleanUmas);
umaData = null;
}
}
catch (Exception ex)
{
UnityEngine.Debug.LogWarning("Exception in UMAGeneratorBuiltin.OnDirtyUpdate: " + ex);
}
}
19
Source : MainMenu.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
[HarmonyPrefix]
public static void Prefix(Rect rect, List<ListableOption> optList)
{
if (optList.Count > 0 && optList[0].GetType() == typeof(ListableOption))
{
if (Current.ProgramState == ProgramState.Entry)
{
var item = new ListableOption("OCity_LAN_btn".Translate(), delegate
{
MainMenu.OnMainMenuNetClick();
}, null);
optList.Insert(0, item);
}
else
{
if (SessionClient.Get.IsLogined)
{
for (int i = 0; i < optList.Count; i++)
{
if (optList[i].label == "Save".Translate()
|| optList[i].label == "LoadGame".Translate()
|| optList[i].label == "ReviewScenario".Translate()
|| optList[i].label == "SaveAndQuitToMainMenu".Translate()
|| optList[i].label == "SaveAndQuitToOS".Translate()
|| optList[i].label == "ConfirmQuit".Translate()
|| optList[i].label == "QuitToMainMenu".Translate()
|| optList[i].label == "QuitToOS".Translate())
{
optList.RemoveAt(i--);
}
}
var item = new ListableOption("OCity_MainMenu_Online".Translate(), delegate
{
Dialog_MainOnlineCity.ShowHide();
}, null);
optList.Add(item);
if (SessionClientController.Data.AttackModule != null)
{
item = new ListableOption("OCity_MainMenu_Withdraw".Translate(), delegate
{
Loger.Log("Client MainMenu VictoryHost");
SessionClientController.Data.AttackModule.VictoryHostToHost = true;
}, null);
optList.Add(item);
}
if (SessionClientController.Data.AttackUsModule != null)
{
item = new ListableOption("OCity_MainMenu_Surrender".Translate(), delegate
{
Loger.Log("Client MainMenu VictoryAttacker");
SessionClientController.Data.AttackUsModule.ConfirmedVictoryAttacker = true;
}, null);
optList.Add(item);
}
item = new ListableOption("QuitToMainMenu".Translate(), delegate
{
if (GameExit.BeforeExit != null)
{
GameExit.BeforeExit();
}
GenScene.GoToMainMenu();
}, null);
optList.Add(item);
item = new ListableOption("QuitToOS".Translate(), delegate
{
if (GameExit.BeforeExit != null)
{
GameExit.BeforeExit();
}
Root.Shutdown();
}, null);
optList.Add(item);
}
}
}
if (Inited) return;
Inited = true;
SessionClientController.Init();
}
See More Examples