Theos
Theos
CC#
Created by Theos on 4/8/2024 in #help
List not returning all matching elements
No description
5 replies
CC#
Created by Theos on 4/8/2024 in #help
List not returning all matching elements
but the foreach loop fails
5 replies
CC#
Created by Theos on 4/8/2024 in #help
List not returning all matching elements
No description
5 replies
CC#
Created by Theos on 3/28/2024 in #help
✅ Throw error without showing the call stack
okay, I just remembered that Environment.Exit exists...
private static void Log(string message)
{
Console.WriteLine($"\n{message}");
Environment.Exit(-1);
}

public static void Custom(string message)
{
Log(message);
}

public static void Expected(string message, int line)
{
Log($"[{line}] Expected '{message}'!");
}
private static void Log(string message)
{
Console.WriteLine($"\n{message}");
Environment.Exit(-1);
}

public static void Custom(string message)
{
Log(message);
}

public static void Expected(string message, int line)
{
Log($"[{line}] Expected '{message}'!");
}
3 replies
CC#
Created by Theos on 3/28/2024 in #help
✅ Throw error without showing the call stack
How can this be achieved?
3 replies
CC#
Created by Theos on 2/8/2024 in #help
How to find coordinates of a region
and yes, my coordinate system works like that
7 replies
CC#
Created by Theos on 2/8/2024 in #help
How to find coordinates of a region
yeah, that makes sense
7 replies
CC#
Created by Theos on 9/28/2023 in #help
❔ Unity Zenject qustion
public class Test
{
[Inject] public Something _Smth;
[Inject] public Foo _Foo;
private int Id;

public Test(int id)
{
Id = id;
}
}
public class Test
{
[Inject] public Something _Smth;
[Inject] public Foo _Foo;
private int Id;

public Test(int id)
{
Id = id;
}
}
var test = new Test(1)
4 replies
CC#
Created by Theos on 9/28/2023 in #help
❔ Unity Zenject qustion
can I do something like
4 replies
CC#
Created by Theos on 9/20/2023 in #help
❔ LLVM problem with creating number
its from LLVMSharp library
6 replies
CC#
Created by Theos on 9/18/2023 in #help
❔ LLVM problem with creating number
bump
3 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
bump
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
will something like this work?
Dictionary<AIUnitType, int> availableUnits = player.Units
.GroupBy(unit => unit.AIType)
.ToDictionary(group => group.Key, group => group.Count());

foreach (AIUnitType neededUnit in _recruitSettings.Units)
{
if (availableUnits.ContainsKey(neededUnit) && availableUnits[neededUnit] > 0)
{
availableUnits[neededUnit]--;
}
else
{
AIUnitType replacementUnit = availableUnits.FirstOrDefault(pair => pair.Value > 0).Key;
player.Units.First(unit => unit.AIType == replacementUnit).AIType = neededUnit;
availableUnits[replacementUnit]--;
}
}
Dictionary<AIUnitType, int> availableUnits = player.Units
.GroupBy(unit => unit.AIType)
.ToDictionary(group => group.Key, group => group.Count());

foreach (AIUnitType neededUnit in _recruitSettings.Units)
{
if (availableUnits.ContainsKey(neededUnit) && availableUnits[neededUnit] > 0)
{
availableUnits[neededUnit]--;
}
else
{
AIUnitType replacementUnit = availableUnits.FirstOrDefault(pair => pair.Value > 0).Key;
player.Units.First(unit => unit.AIType == replacementUnit).AIType = neededUnit;
availableUnits[replacementUnit]--;
}
}
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
and my code looks ugly ;p
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
I can't find a good way to do this
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
i need to change player units types so he has neededUnits hero, hero, scout, courier
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
and player has units with types scout, courier, courier, hero
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
lets say in neededUnits i have hero, hero, scout, courier
10 replies
CC#
Created by Theos on 9/13/2023 in #help
❔ Adjust lists
What I need to do is
10 replies