commit
This commit is contained in:
44
Assets/BitWise.cs
Normal file
44
Assets/BitWise.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
public class BitWise
|
||||||
|
{
|
||||||
|
public static int HammingWeight(long x)
|
||||||
|
{
|
||||||
|
const long h01 = 0x0101010101010101;
|
||||||
|
const long m1 = 0x5555555555555555; // 0101...
|
||||||
|
const long m2 = 0x3333333333333333; // 00110011..
|
||||||
|
const long m4 = 0x0f0f0f0f0f0f0f0f;
|
||||||
|
x -= (x >> 1) & m1; // put count of each 2 bits into those 2 bits
|
||||||
|
x = (x & m2) + ((x >> 2) & m2); // put count of each 4 bits into those 4 bits
|
||||||
|
x = (x + (x >> 4)) & m4; // put count of each 8 bits into those 8 bits
|
||||||
|
return (int)((x * h01) >> 56);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// return all the permutation of n choose p, long output are bitflags were 1 bit represent selected.
|
||||||
|
/// Exactly n bits are set to 1, among the p first bits.
|
||||||
|
/// n parmi p
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="totalNumberOfElement"></param>
|
||||||
|
/// <param name="numberOfElementToSelect"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static HashSet<long> GetAllPermutation(int numberOfElementToSelect, int totalNumberOfElement)
|
||||||
|
{
|
||||||
|
HashSet<long> result = new HashSet<long>();
|
||||||
|
if (numberOfElementToSelect>totalNumberOfElement)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
long v = (1L << numberOfElementToSelect) - 1;
|
||||||
|
long end = 1L << totalNumberOfElement;
|
||||||
|
while (v < end)
|
||||||
|
{
|
||||||
|
result.Add(v);
|
||||||
|
long t = (v | (v - 1)) + 1;
|
||||||
|
v = t | ((((t & -t) / (v & -v)) >> 1) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/BitWise.cs.meta
Normal file
2
Assets/BitWise.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2a6dff4eb0cc0aa44a847ee093734b7a
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
public enum ChampionsEnum
|
|
||||||
{
|
|
||||||
ASHE = 0,
|
|
||||||
BLITZCRANK = 1 << 0,
|
|
||||||
ELISE = 1 << 1,
|
|
||||||
JAX = 1 << 2,
|
|
||||||
JAYCE = 1 << 3,
|
|
||||||
LILLIA = 1 << 4,
|
|
||||||
NOMSY = 1 << 5,
|
|
||||||
POPPY = 1 << 6,
|
|
||||||
SERAPHINE = 1 << 7,
|
|
||||||
SORAKA = 1 << 8,
|
|
||||||
TWITCH = 1 << 9,
|
|
||||||
WARWICK = 1 << 10,
|
|
||||||
ZIGGS = 1 << 11,
|
|
||||||
ZOE = 1 << 12,
|
|
||||||
AHRI = 1 << 13,
|
|
||||||
AKALI = 1 << 14,
|
|
||||||
CASSIOPEIA = 1 << 15,
|
|
||||||
GALIO = 1 << 16,
|
|
||||||
KASSADIN = 1 << 17,
|
|
||||||
KOGMAW = 1 << 18,
|
|
||||||
NILAH = 1 << 19,
|
|
||||||
NUNU = 1 << 20,
|
|
||||||
RUMBLE = 1 << 21,
|
|
||||||
SHYVANA = 1 << 22,
|
|
||||||
SYNDRA = 1 << 23,
|
|
||||||
TRISTANA = 1 << 24,
|
|
||||||
ZILEAN = 1 << 25,
|
|
||||||
BARD = 1 << 26,
|
|
||||||
EZREAL = 1 << 27,
|
|
||||||
HECARIM = 1 << 28,
|
|
||||||
HWEI = 1 << 29,
|
|
||||||
JINX = 1 << 30,
|
|
||||||
KATARINA = 1 << 31,
|
|
||||||
MORDEKAISER = 1 << 32,
|
|
||||||
NEEKO = 1 << 33,
|
|
||||||
SHEN = 1 << 34,
|
|
||||||
SWAIN = 1 << 35,
|
|
||||||
VEIGAR = 1 << 36,
|
|
||||||
VEX = 1 << 37,
|
|
||||||
WUKONG = 1 << 38,
|
|
||||||
FIORA = 1 << 39,
|
|
||||||
GWEN = 1 << 40,
|
|
||||||
KALISTA = 1 << 41,
|
|
||||||
KARMA = 1 << 42,
|
|
||||||
NAMI = 1 << 43,
|
|
||||||
NASUS = 1 << 44,
|
|
||||||
OLAF = 1 << 45,
|
|
||||||
RAKAN = 1 << 46,
|
|
||||||
RYZE = 1 << 47,
|
|
||||||
TAHMKENCH = 1 << 48,
|
|
||||||
TARIC = 1 << 49,
|
|
||||||
VARUS = 1 << 50,
|
|
||||||
BRIAR = 1 << 51,
|
|
||||||
CAMILLE = 1 << 52,
|
|
||||||
DIANA = 1 << 53,
|
|
||||||
MILLIO = 1 << 54,
|
|
||||||
MORGANA = 1 << 55,
|
|
||||||
NORRA = 1 << 56,
|
|
||||||
SMOLDER = 1 << 57,
|
|
||||||
XERATH = 1 << 58,
|
|
||||||
}
|
|
||||||
67
Assets/Data/ChampionUtils.cs
Normal file
67
Assets/Data/ChampionUtils.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Assets.Data
|
||||||
|
{
|
||||||
|
public class ChampionUtils
|
||||||
|
{
|
||||||
|
public static HashSet<ChampionsEnum> FromLong(long champions)
|
||||||
|
{
|
||||||
|
HashSet<ChampionsEnum> result = new HashSet<ChampionsEnum>();
|
||||||
|
foreach (ChampionsEnum champion in System.Enum.GetValues(typeof(ChampionsEnum)))
|
||||||
|
{
|
||||||
|
if ((champions & (long)champion) != 0)
|
||||||
|
{
|
||||||
|
result.Add(champion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long ToLong(HashSet<ChampionsEnum> champions)
|
||||||
|
{
|
||||||
|
long result = 0;
|
||||||
|
foreach (ChampionsEnum champion in champions)
|
||||||
|
{
|
||||||
|
result |= (long)champion;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long ToLong(ChampionsEnum champions)
|
||||||
|
{
|
||||||
|
return (long)champions;
|
||||||
|
}
|
||||||
|
public static bool ContainsChampion(long champions, ChampionsEnum champion)
|
||||||
|
{
|
||||||
|
return (champions & (long)champion) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static bool ContainsChampion(long champions, long champion)
|
||||||
|
{
|
||||||
|
return (champions & champion) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int NumberOfChampions(long champions)
|
||||||
|
{
|
||||||
|
return BitWise.HammingWeight(champions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long GetNthChampion(long champions, int n)
|
||||||
|
{
|
||||||
|
int kThFoundChampion = 0;
|
||||||
|
for (int i = 0; i < 64; i++)
|
||||||
|
{
|
||||||
|
if ((champions & (1L << i)) != 0)
|
||||||
|
{
|
||||||
|
if (kThFoundChampion == n)
|
||||||
|
{
|
||||||
|
return 1L << i;
|
||||||
|
}
|
||||||
|
kThFoundChampion++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Assets/Data/ChampionUtils.cs.meta
Normal file
7
Assets/Data/ChampionUtils.cs.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ae22ada17bccee84b817a24470d45e6a
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
66
Assets/Data/ChampionsEnum.cs
Normal file
66
Assets/Data/ChampionsEnum.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum ChampionsEnum : long
|
||||||
|
{
|
||||||
|
ASHE = 1L << 0,
|
||||||
|
BLITZCRANK = 1L << 1,
|
||||||
|
ELISE = 1L << 2,
|
||||||
|
JAX = 1L << 3,
|
||||||
|
JAYCE = 1L << 4,
|
||||||
|
LILLIA = 1L << 5,
|
||||||
|
NOMSY = 1L << 6,
|
||||||
|
POPPY = 1L << 7,
|
||||||
|
SERAPHINE = 1L << 8,
|
||||||
|
SORAKA = 1L << 9,
|
||||||
|
TWITCH = 1L << 10,
|
||||||
|
WARWICK = 1L << 11,
|
||||||
|
ZIGGS = 1L << 12,
|
||||||
|
ZOE = 1L << 13,
|
||||||
|
AHRI = 1L << 14,
|
||||||
|
AKALI = 1L << 15,
|
||||||
|
CASSIOPEIA = 1L << 16,
|
||||||
|
GALIO = 1L << 17,
|
||||||
|
KASSADIN = 1L << 18,
|
||||||
|
KOGMAW = 1L << 19,
|
||||||
|
NILAH = 1L << 20,
|
||||||
|
NUNU = 1L << 21,
|
||||||
|
RUMBLE = 1L << 22,
|
||||||
|
SHYVANA = 1L << 23,
|
||||||
|
SYNDRA = 1L << 24,
|
||||||
|
TRISTANA = 1L << 25,
|
||||||
|
ZILEAN = 1L << 26,
|
||||||
|
BARD = 1L << 27,
|
||||||
|
EZREAL = 1L << 28,
|
||||||
|
HECARIM = 1L << 29,
|
||||||
|
HWEI = 1L << 30,
|
||||||
|
JINX = 1L << 31,
|
||||||
|
KATARINA = 1L << 32,
|
||||||
|
MORDEKAISER = 1L << 33,
|
||||||
|
NEEKO = 1L << 34,
|
||||||
|
SHEN = 1L << 35,
|
||||||
|
SWAIN = 1L << 36,
|
||||||
|
VEIGAR = 1L << 37,
|
||||||
|
VEX = 1L << 38,
|
||||||
|
WUKONG = 1L << 39,
|
||||||
|
FIORA = 1L << 40,
|
||||||
|
GWEN = 1L << 41,
|
||||||
|
KALISTA = 1L << 42,
|
||||||
|
KARMA = 1L << 43,
|
||||||
|
NAMI = 1L << 44,
|
||||||
|
NASUS = 1L << 45,
|
||||||
|
OLAF = 1L << 46,
|
||||||
|
RAKAN = 1L << 47,
|
||||||
|
RYZE = 1L << 48,
|
||||||
|
TAHMKENCH = 1L << 49,
|
||||||
|
TARIC = 1L << 50,
|
||||||
|
VARUS = 1L << 51,
|
||||||
|
BRIAR = 1L << 52,
|
||||||
|
CAMILLE = 1L << 53,
|
||||||
|
DIANA = 1L << 54,
|
||||||
|
MILLIO = 1L << 55,
|
||||||
|
MORGANA = 1L << 56,
|
||||||
|
NORRA = 1L << 57,
|
||||||
|
SMOLDER = 1L << 58,
|
||||||
|
XERATH = 1L << 59,
|
||||||
|
}
|
||||||
@@ -9,10 +9,13 @@ public class TraitSelectorManager : MonoBehaviour
|
|||||||
private TMP_InputField _compositionSize;
|
private TMP_InputField _compositionSize;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ChampionSelector _championSelector;
|
private ChampionSelector _mandatorychampionSelector;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private UIToLogic _emblemSelector;
|
private ChampionSelector _acceptablechampionSelector;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private EmblemSelector _emblemSelector;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int _traitThreshold = 7;
|
private int _traitThreshold = 7;
|
||||||
@@ -22,25 +25,28 @@ public class TraitSelectorManager : MonoBehaviour
|
|||||||
public void ListAllActivableCompo()
|
public void ListAllActivableCompo()
|
||||||
{
|
{
|
||||||
emblemList = _emblemSelector.GetEmblems();
|
emblemList = _emblemSelector.GetEmblems();
|
||||||
var champList = _championSelector.GetSelectedChampions();
|
var mandatoryChampions = ChampionUtils.ToLong(_mandatorychampionSelector.GetSelectedChampions());
|
||||||
|
var acceptableChampions = ChampionUtils.ToLong(_acceptablechampionSelector.GetSelectedChampions());
|
||||||
int compositionSize = _compositionSize.text == "" ? 1 : int.Parse(_compositionSize.text);
|
int compositionSize = _compositionSize.text == "" ? 1 : int.Parse(_compositionSize.text);
|
||||||
var coroutine = StartCoroutine(TraitsMapping.GetChampionSubsetsAsync(champList, compositionSize,emblemList, HandleCombination));
|
var composition = TraitsMapping.GenerateCombinations(mandatoryChampions, acceptableChampions, compositionSize);
|
||||||
|
Coroutine coroutine = StartCoroutine(TraitsMapping.DisplayCompositions(composition));
|
||||||
|
//var coroutine = StartCoroutine(TraitsMapping.GetChampionSubsetsAsync(champList, compositionSize,emblemList, HandleCombination));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleCombination(HashSet<ChampionsEnum> combination)
|
private void HandleCombination(long combination)
|
||||||
{
|
{
|
||||||
var synergies = TraitsMapping.MergeEmblems(
|
// var synergies = TraitsMapping.MergeEmblems(
|
||||||
TraitsMapping.TraitCountInCompo(combination),
|
// TraitsMapping.TraitCountInCompo(combination),
|
||||||
emblemList
|
// emblemList
|
||||||
);
|
// );
|
||||||
var activeSynergies = TraitsMapping.FilterActiveTraits(synergies);
|
// var activeSynergies = TraitsMapping.FilterActiveTraits(synergies);
|
||||||
if (activeSynergies.Count >= _traitThreshold)
|
// if (TraitUtils.TraitCountFromInt(activeSynergies) >= _traitThreshold)
|
||||||
{
|
// {
|
||||||
var s = TraitsMapping.CompositionToString(combination, activeSynergies);
|
// var s = TraitsMapping.CompositionToString(combination, activeSynergies);
|
||||||
Debug.Log(s);
|
// Debug.Log(s);
|
||||||
} else {
|
// } else {
|
||||||
Debug.LogWarning("Combination not valid");
|
// Debug.LogWarning("Combination not valid");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,52 @@
|
|||||||
namespace Assets.Data
|
using System.Collections.Generic;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace Assets.Data
|
||||||
{
|
{
|
||||||
public class TraitUtils
|
public class TraitUtils
|
||||||
{
|
{
|
||||||
|
public static HashSet<TraitsEnum> FromInt(int traits)
|
||||||
|
{
|
||||||
|
HashSet<TraitsEnum> result = new HashSet<TraitsEnum>();
|
||||||
|
foreach (TraitsEnum trait in System.Enum.GetValues(typeof(TraitsEnum)))
|
||||||
|
{
|
||||||
|
if ((traits & (int)trait) != 0)
|
||||||
|
{
|
||||||
|
result.Add(trait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ToInt(HashSet<TraitsEnum> traits)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
foreach (TraitsEnum trait in traits)
|
||||||
|
{
|
||||||
|
result |= (int)trait;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int TraitCountFromInt(int traits)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
while (traits != 0)
|
||||||
|
{
|
||||||
|
count += traits & 1;
|
||||||
|
traits >>= 1;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ContainsTrait(int traits, TraitsEnum trait)
|
||||||
|
{
|
||||||
|
return (traits & (int)trait) != 0;
|
||||||
|
}
|
||||||
|
public static bool ContainsTrait(int traits, int trait)
|
||||||
|
{
|
||||||
|
return (traits & trait) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,29 @@
|
|||||||
public enum TraitsEnum
|
using System;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum TraitsEnum : int
|
||||||
{
|
{
|
||||||
ARCANA = 0,
|
ARCANA = 1 << 0,
|
||||||
CHRONO = 1 << 0,
|
CHRONO = 1 << 1,
|
||||||
DRAGON = 1 << 1,
|
DRAGON = 1 << 2,
|
||||||
DRUID = 1 << 2,
|
DRUID = 1 << 3,
|
||||||
ELDRICHT = 1 << 3,
|
ELDRICHT = 1 << 4,
|
||||||
FAERIE = 1 << 4,
|
FAERIE = 1 << 5,
|
||||||
FROST = 1 << 5,
|
FROST = 1 << 6,
|
||||||
HONEYMANCY = 1 << 6,
|
HONEYMANCY = 1 << 7,
|
||||||
PORTAL = 1 << 7,
|
PORTAL = 1 << 8,
|
||||||
PYRO = 1 << 8,
|
PYRO = 1 << 9,
|
||||||
SUGARCRAFT = 1 << 9,
|
SUGARCRAFT = 1 << 10,
|
||||||
WITCHCRAFT = 1 << 10,
|
WITCHCRAFT = 1 << 11,
|
||||||
BASTION = 1 << 11,
|
BASTION = 1 << 12,
|
||||||
BLASTER = 1 << 12,
|
BLASTER = 1 << 13,
|
||||||
HUNTER = 1 << 13,
|
HUNTER = 1 << 14,
|
||||||
INCANTATOR = 1 << 14,
|
INCANTATOR = 1 << 15,
|
||||||
MAGE = 1 << 15,
|
MAGE = 1 << 16,
|
||||||
MULTISTRIKER = 1 << 16,
|
MULTISTRIKER = 1 << 17,
|
||||||
PRESERVER = 1 << 17,
|
PRESERVER = 1 << 18,
|
||||||
SCHOLAR = 1 << 18,
|
SCHOLAR = 1 << 19,
|
||||||
SHAPESHIFTER = 1 << 19,
|
SHAPESHIFTER = 1 << 20,
|
||||||
VANGUARD = 1 << 20,
|
VANGUARD = 1 << 21,
|
||||||
WARRIOR = 1 << 21
|
WARRIOR = 1 << 22
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
77
Assets/Tests/Editor/TestBitWise.cs
Normal file
77
Assets/Tests/Editor/TestBitWise.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Assets.Data
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestBitWise
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
[TestCaseSource(typeof(BitwiseCase), "BitwiseCombination")]
|
||||||
|
public void TestBitwiseCombination(int n, int p, HashSet<long> expected)
|
||||||
|
{
|
||||||
|
HashSet<long> output = BitWise.GetAllPermutation(n, p);
|
||||||
|
Assert.IsTrue(output.SetEquals(expected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BitwiseCase
|
||||||
|
{
|
||||||
|
public static IEnumerable BitwiseCombination
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return new TestCaseData(
|
||||||
|
3,
|
||||||
|
5,
|
||||||
|
new HashSet<long>()
|
||||||
|
{
|
||||||
|
0b11100,
|
||||||
|
0b11010,
|
||||||
|
0b10110,
|
||||||
|
0b01110,
|
||||||
|
0b11001,
|
||||||
|
0b10101,
|
||||||
|
0b01101,
|
||||||
|
0b10011,
|
||||||
|
0b01011,
|
||||||
|
0b00111,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
new HashSet<long>()
|
||||||
|
{
|
||||||
|
0b001
|
||||||
|
}
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
new HashSet<long>()
|
||||||
|
{
|
||||||
|
0b011,
|
||||||
|
0b110,
|
||||||
|
0b101
|
||||||
|
}
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
2,
|
||||||
|
4,
|
||||||
|
new HashSet<long>()
|
||||||
|
{
|
||||||
|
0b0011,
|
||||||
|
0b0101,
|
||||||
|
0b1001,
|
||||||
|
0b0110,
|
||||||
|
0b1010,
|
||||||
|
0b1100
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
2
Assets/Tests/Editor/TestBitWise.cs.meta
Normal file
2
Assets/Tests/Editor/TestBitWise.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 82274463f1eeb5a4daa090c4c6de1d51
|
||||||
76
Assets/Tests/Editor/TestChampionUtils.cs
Normal file
76
Assets/Tests/Editor/TestChampionUtils.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Assets.Data
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestChampionUtils
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
[TestCaseSource(typeof(ChampionCase), "championsEnum")]
|
||||||
|
public void TestIntChampion(long champlong)
|
||||||
|
{
|
||||||
|
var champs = ChampionUtils.FromLong(champlong);
|
||||||
|
long output = ChampionUtils.ToLong(champs);
|
||||||
|
Assert.IsTrue(champlong == output);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCaseSource(typeof(ChampionCase), "championsNth")]
|
||||||
|
public void TestGetNthChampion(long champlons, int n, long expected)
|
||||||
|
{
|
||||||
|
long output = ChampionUtils.GetNthChampion(champlons, n);
|
||||||
|
Assert.IsTrue(output == expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChampionCase
|
||||||
|
{
|
||||||
|
public static IEnumerable championsEnum
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return 1223456L;
|
||||||
|
yield return 3422L;
|
||||||
|
yield return 97352L;
|
||||||
|
yield return 67855324254L;
|
||||||
|
yield return 432742125L;
|
||||||
|
yield return 76578256785L;
|
||||||
|
yield return 12345678912345678L;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable championsNth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(ChampionsEnum.ASHE),
|
||||||
|
0,
|
||||||
|
ChampionUtils.ToLong(ChampionsEnum.ASHE)
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(ChampionsEnum.SMOLDER),
|
||||||
|
0,
|
||||||
|
ChampionUtils.ToLong(ChampionsEnum.SMOLDER)
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.AHRI }),
|
||||||
|
0,
|
||||||
|
ChampionUtils.ToLong(ChampionsEnum.AHRI)
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() {
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.POPPY,
|
||||||
|
ChampionsEnum.SORAKA,
|
||||||
|
ChampionsEnum.HWEI }),
|
||||||
|
1,
|
||||||
|
ChampionUtils.ToLong(ChampionsEnum.SORAKA)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Tests/Editor/TestChampionUtils.cs.meta
Normal file
2
Assets/Tests/Editor/TestChampionUtils.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5a66db3ba63d3984aa0460ad3ec3852a
|
||||||
168
Assets/Tests/Editor/TestTraitsMapping.cs
Normal file
168
Assets/Tests/Editor/TestTraitsMapping.cs
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Assets.Data
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestTraitsMapping
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
[TestCaseSource(typeof(TraitsMappingCase), "ChampCombination")]
|
||||||
|
public void TestChampCombination(
|
||||||
|
long mandatoryChamps,
|
||||||
|
long possibleChamps,
|
||||||
|
int n,
|
||||||
|
List<long> expected
|
||||||
|
)
|
||||||
|
{
|
||||||
|
List<long> output = TraitsMapping.GenerateCombinations(
|
||||||
|
mandatoryChamps,
|
||||||
|
possibleChamps,
|
||||||
|
n
|
||||||
|
);
|
||||||
|
foreach (long champ in expected)
|
||||||
|
{
|
||||||
|
Assert.IsTrue(output.Contains(champ));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (long champ in output)
|
||||||
|
{
|
||||||
|
Assert.IsTrue(expected.Contains(champ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TraitsMappingCase
|
||||||
|
{
|
||||||
|
public static IEnumerable ChampCombination
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.ELISE }),
|
||||||
|
3,
|
||||||
|
new List<long>()
|
||||||
|
{
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
ChampionsEnum.ELISE,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ELISE,
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.CASSIOPEIA,
|
||||||
|
ChampionsEnum.EZREAL
|
||||||
|
}
|
||||||
|
),
|
||||||
|
5,
|
||||||
|
new List<long>()
|
||||||
|
{
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
ChampionsEnum.ELISE,
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.CASSIOPEIA
|
||||||
|
}
|
||||||
|
),
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
ChampionsEnum.ELISE,
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.EZREAL
|
||||||
|
}
|
||||||
|
),
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
ChampionsEnum.ELISE,
|
||||||
|
ChampionsEnum.CASSIOPEIA,
|
||||||
|
ChampionsEnum.EZREAL
|
||||||
|
}
|
||||||
|
),
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.ASHE,
|
||||||
|
ChampionsEnum.BLITZCRANK,
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.CASSIOPEIA,
|
||||||
|
ChampionsEnum.EZREAL
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.ELISE }),
|
||||||
|
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.AHRI }),
|
||||||
|
1,
|
||||||
|
new List<long>()
|
||||||
|
{
|
||||||
|
ChampionUtils.ToLong(new HashSet<ChampionsEnum>() { ChampionsEnum.ELISE }),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
yield return new TestCaseData(
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.POPPY,
|
||||||
|
ChampionsEnum.SORAKA,
|
||||||
|
ChampionsEnum.HWEI,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>() { ChampionsEnum.SMOLDER, ChampionsEnum.XERATH }
|
||||||
|
),
|
||||||
|
4,
|
||||||
|
new List<long>()
|
||||||
|
{
|
||||||
|
ChampionUtils.ToLong(
|
||||||
|
new HashSet<ChampionsEnum>()
|
||||||
|
{
|
||||||
|
ChampionsEnum.AHRI,
|
||||||
|
ChampionsEnum.POPPY,
|
||||||
|
ChampionsEnum.SORAKA,
|
||||||
|
ChampionsEnum.HWEI,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/Tests/Editor/TestTraitsMapping.cs.meta
Normal file
2
Assets/Tests/Editor/TestTraitsMapping.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bfc2ba87bb8472c4d9164a522a57147f
|
||||||
@@ -8,37 +8,26 @@ namespace Assets.Data
|
|||||||
public class TestTraitsUtils
|
public class TestTraitsUtils
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[TestCaseSource(typeof(BinaryCases), "EmblemsSynergies")]
|
[TestCaseSource(typeof(TraitTestCases), "EmblemsSynergies")]
|
||||||
public void TestMergeEmblems(
|
public void TestMergeEmblems(
|
||||||
Dictionary<TraitsEnum, int> emblem,
|
Dictionary<int, int> emblem,
|
||||||
Dictionary<TraitsEnum, int> synergies,
|
Dictionary<int, int> synergies,
|
||||||
Dictionary<TraitsEnum, int> expected
|
Dictionary<int, int> expected
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var output = TraitsMapping.MergeEmblems(emblem, synergies);
|
var output = TraitsMapping.MergeEmblems(emblem, synergies);
|
||||||
foreach (KeyValuePair<TraitsEnum, int> pair in expected)
|
foreach (KeyValuePair<int, int> pair in expected)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(output[pair.Key] == pair.Value);
|
Assert.IsTrue(output[pair.Key] == pair.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[TestCaseSource(typeof(BinaryCases), "ActiveTraits")]
|
[TestCaseSource(typeof(TraitTestCases), "ActiveTraits")]
|
||||||
public void TestActiveSynergyFilter(
|
public void TestActiveSynergyFilter(Dictionary<int, int> synergies, int expected)
|
||||||
Dictionary<TraitsEnum, int> synergies,
|
|
||||||
HashSet<TraitsEnum> expected
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
var output = TraitsMapping.FilterActiveTraits(synergies);
|
int output = TraitsMapping.FilterActiveTraits(synergies);
|
||||||
foreach (TraitsEnum trait in expected)
|
Assert.IsTrue(Equals(output, expected));
|
||||||
{
|
|
||||||
Assert.IsTrue(expected.Contains(trait));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (TraitsEnum trait in output)
|
|
||||||
{
|
|
||||||
Assert.IsTrue(output.Contains(trait));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -46,68 +35,94 @@ namespace Assets.Data
|
|||||||
{
|
{
|
||||||
foreach (var champTraits in TraitsMapping.ChampsTraits)
|
foreach (var champTraits in TraitsMapping.ChampsTraits)
|
||||||
{
|
{
|
||||||
foreach (var trait in champTraits.Value)
|
var champion = champTraits.Key;
|
||||||
|
var traits = TraitUtils.FromInt(champTraits.Value);
|
||||||
|
foreach (var trait in traits)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(TraitsMapping.TraitsChamp[trait].Contains(champTraits.Key));
|
var allChampofTrait = TraitsMapping.TraitsChamp[(int)trait];
|
||||||
|
HashSet<ChampionsEnum> champions = ChampionUtils.FromLong(allChampofTrait);
|
||||||
|
Assert.IsTrue(
|
||||||
|
ChampionUtils.ContainsChampion(
|
||||||
|
allChampofTrait,
|
||||||
|
champion
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var traitChamps in TraitsMapping.TraitsChamp)
|
foreach (var traitChamp in TraitsMapping.TraitsChamp)
|
||||||
{
|
{
|
||||||
foreach (var champ in traitChamps.Value)
|
var trait = traitChamp.Key;
|
||||||
|
var champions = ChampionUtils.FromLong(traitChamp.Value);
|
||||||
|
foreach (var champion in champions)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(TraitsMapping.ChampsTraits[champ].Contains(traitChamps.Key));
|
var allTraitsOfChamp = TraitsMapping.ChampsTraits[(long)champion];
|
||||||
|
Assert.IsTrue(
|
||||||
|
TraitUtils.ContainsTrait(
|
||||||
|
allTraitsOfChamp,
|
||||||
|
trait
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[TestCaseSource(typeof(BinaryCases), "con")]
|
[TestCaseSource(typeof(TraitTestCases), "traitsEnum")]
|
||||||
public void TestChampionCombination(HashSet<ChampionsEnum> champList, int compositionSize, int expectedCombinationCount)
|
public void TestIntTrait(int traitInt)
|
||||||
{
|
{
|
||||||
var combination = TraitsMapping.GetChampionSubsets(champList, compositionSize);
|
var traits = TraitUtils.FromInt(traitInt);
|
||||||
Assert.IsTrue(combination.Count == expectedCombinationCount);
|
long output = TraitUtils.ToInt(traits);
|
||||||
|
Assert.IsTrue(traitInt == output);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCaseSource(typeof(TraitTestCases), "traitsToInt")]
|
||||||
|
public void TestTraitToInt(HashSet<TraitsEnum> traits, int expectedInt)
|
||||||
|
{
|
||||||
|
int output = TraitUtils.ToInt(traits);
|
||||||
|
Assert.IsTrue(output == expectedInt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BinaryCases
|
public class TraitTestCases
|
||||||
{
|
{
|
||||||
public static IEnumerable EmblemsSynergies
|
public static IEnumerable EmblemsSynergies
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
yield return new TestCaseData(
|
yield return new TestCaseData(
|
||||||
new Dictionary<TraitsEnum, int> { { TraitsEnum.ARCANA, 1 } },
|
new Dictionary<int, int> { { (int)TraitsEnum.ARCANA, 1 } },
|
||||||
new Dictionary<TraitsEnum, int> { { TraitsEnum.ARCANA, 1 } },
|
new Dictionary<int, int> { { (int)TraitsEnum.ARCANA, 1 } },
|
||||||
new Dictionary<TraitsEnum, int> { { TraitsEnum.ARCANA, 2 } }
|
new Dictionary<int, int> { { (int)TraitsEnum.ARCANA, 2 } }
|
||||||
);
|
);
|
||||||
yield return new TestCaseData(
|
yield return new TestCaseData(
|
||||||
new Dictionary<TraitsEnum, int>
|
new Dictionary<int, int>
|
||||||
{
|
{
|
||||||
{ TraitsEnum.ARCANA, 1 },
|
{ (int)TraitsEnum.ARCANA, 1 },
|
||||||
{ TraitsEnum.DRAGON, 2 },
|
{ (int)TraitsEnum.DRAGON, 2 },
|
||||||
{ TraitsEnum.FROST, 3 },
|
{ (int)TraitsEnum.FROST, 3 },
|
||||||
{ TraitsEnum.HONEYMANCY, 4 },
|
{ (int)TraitsEnum.HONEYMANCY, 4 },
|
||||||
{ TraitsEnum.PYRO, 5 },
|
{ (int)TraitsEnum.PYRO, 5 },
|
||||||
{ TraitsEnum.WARRIOR, 6 },
|
{ (int)TraitsEnum.WARRIOR, 6 },
|
||||||
},
|
},
|
||||||
new Dictionary<TraitsEnum, int>
|
new Dictionary<int, int>
|
||||||
{
|
{
|
||||||
{ TraitsEnum.ARCANA, 1 },
|
{ (int)TraitsEnum.ARCANA, 1 },
|
||||||
{ TraitsEnum.DRAGON, 2 },
|
{ (int)TraitsEnum.DRAGON, 2 },
|
||||||
{ TraitsEnum.FROST, 3 },
|
{ (int)TraitsEnum.FROST, 3 },
|
||||||
{ TraitsEnum.HONEYMANCY, 4 },
|
{ (int)TraitsEnum.HONEYMANCY, 4 },
|
||||||
{ TraitsEnum.PYRO, 5 },
|
{ (int)TraitsEnum.PYRO, 5 },
|
||||||
{ TraitsEnum.WARRIOR, 6 },
|
{ (int)TraitsEnum.WARRIOR, 6 },
|
||||||
},
|
},
|
||||||
new Dictionary<TraitsEnum, int>
|
new Dictionary<int, int>
|
||||||
{
|
{
|
||||||
{ TraitsEnum.ARCANA, 2 },
|
{ (int)TraitsEnum.ARCANA, 2 },
|
||||||
{ TraitsEnum.DRAGON, 4 },
|
{ (int)TraitsEnum.DRAGON, 4 },
|
||||||
{ TraitsEnum.FROST, 6 },
|
{ (int)TraitsEnum.FROST, 6 },
|
||||||
{ TraitsEnum.HONEYMANCY, 8 },
|
{ (int)TraitsEnum.HONEYMANCY, 8 },
|
||||||
{ TraitsEnum.PYRO, 10 },
|
{ (int)TraitsEnum.PYRO, 10 },
|
||||||
{ TraitsEnum.WARRIOR, 12 },
|
{ (int)TraitsEnum.WARRIOR, 12 },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
/*
|
||||||
@@ -145,41 +160,107 @@ namespace Assets.Data
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
yield return new TestCaseData(
|
yield return new TestCaseData(
|
||||||
new Dictionary<TraitsEnum, int>
|
new Dictionary<int, int>
|
||||||
{
|
{
|
||||||
{ TraitsEnum.ARCANA, 1 },
|
{ (int)TraitsEnum.ARCANA, 1 },
|
||||||
{ TraitsEnum.DRAGON, 2 },
|
{ (int)TraitsEnum.DRAGON, 2 },
|
||||||
{ TraitsEnum.FROST, 3 },
|
{ (int)TraitsEnum.FROST, 3 },
|
||||||
{ TraitsEnum.HONEYMANCY, 4 },
|
{ (int)TraitsEnum.HONEYMANCY, 4 },
|
||||||
{ TraitsEnum.PYRO, 1 },
|
{ (int)TraitsEnum.PYRO, 1 },
|
||||||
{ TraitsEnum.WARRIOR, 1 },
|
{ (int)TraitsEnum.WARRIOR, 1 },
|
||||||
},
|
},
|
||||||
|
TraitUtils.ToInt(
|
||||||
|
new HashSet<TraitsEnum>
|
||||||
|
{
|
||||||
|
TraitsEnum.DRAGON,
|
||||||
|
TraitsEnum.FROST,
|
||||||
|
TraitsEnum.HONEYMANCY
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
yield return new TestCaseData(
|
||||||
|
new Dictionary<int, int>
|
||||||
|
{
|
||||||
|
{ (int)TraitsEnum.ARCANA, 5 },
|
||||||
|
{ (int)TraitsEnum.FROST, 2 },
|
||||||
|
{ (int)TraitsEnum.HONEYMANCY, 7 },
|
||||||
|
{ (int)TraitsEnum.PYRO, 4 },
|
||||||
|
{ (int)TraitsEnum.WARRIOR, 3 },
|
||||||
|
},
|
||||||
|
TraitUtils.ToInt(
|
||||||
|
new HashSet<TraitsEnum>
|
||||||
|
{
|
||||||
|
TraitsEnum.ARCANA,
|
||||||
|
TraitsEnum.HONEYMANCY,
|
||||||
|
TraitsEnum.PYRO,
|
||||||
|
TraitsEnum.WARRIOR,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable traitsEnum
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return 156;
|
||||||
|
yield return 621;
|
||||||
|
yield return 123456;
|
||||||
|
yield return 5;
|
||||||
|
yield return 4194303; // max value
|
||||||
|
yield return 4194302;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable traitsToInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
yield return new TestCaseData(
|
||||||
new HashSet<TraitsEnum>
|
new HashSet<TraitsEnum>
|
||||||
{
|
{
|
||||||
|
TraitsEnum.ARCANA,
|
||||||
|
TraitsEnum.DRAGON
|
||||||
|
},
|
||||||
|
1<<0 | 1<<2
|
||||||
|
);
|
||||||
|
yield return new TestCaseData(
|
||||||
|
new HashSet<TraitsEnum>
|
||||||
|
{
|
||||||
|
TraitsEnum.ARCANA,
|
||||||
TraitsEnum.DRAGON,
|
TraitsEnum.DRAGON,
|
||||||
TraitsEnum.FROST,
|
TraitsEnum.FROST,
|
||||||
TraitsEnum.HONEYMANCY,
|
TraitsEnum.HONEYMANCY,
|
||||||
TraitsEnum.PYRO,
|
TraitsEnum.PYRO,
|
||||||
}
|
TraitsEnum.WARRIOR
|
||||||
);
|
|
||||||
|
|
||||||
yield return new TestCaseData(
|
|
||||||
new Dictionary<TraitsEnum, int>
|
|
||||||
{
|
|
||||||
{ TraitsEnum.ARCANA, 5 },
|
|
||||||
{ TraitsEnum.FROST, 2 },
|
|
||||||
{ TraitsEnum.HONEYMANCY, 7 },
|
|
||||||
{ TraitsEnum.PYRO, 4 },
|
|
||||||
{ TraitsEnum.WARRIOR, 3 },
|
|
||||||
},
|
},
|
||||||
new HashSet<TraitsEnum>
|
1<<0 | 1<<2 | 1<<6 | 1<<7 | 1<<9 | 1<<22
|
||||||
{
|
);
|
||||||
TraitsEnum.ARCANA,
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.ARCANA},1 << 0);
|
||||||
TraitsEnum.HONEYMANCY,
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.CHRONO},1 << 1);
|
||||||
TraitsEnum.PYRO,
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.DRAGON},1 << 2);
|
||||||
TraitsEnum.WARRIOR,
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.DRUID},1 << 3);
|
||||||
}
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.ELDRICHT},1 << 4);
|
||||||
);
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.FAERIE},1 << 5);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.FROST},1 << 6);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.HONEYMANCY},1 << 7);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.PORTAL},1 << 8);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.PYRO},1 << 9);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.SUGARCRAFT},1 << 10);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.WITCHCRAFT},1 << 11);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.BASTION},1 << 12);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.BLASTER},1 << 13);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.HUNTER},1 << 14);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.INCANTATOR},1 << 15);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.MAGE},1 << 16);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.MULTISTRIKER},1 << 17);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.PRESERVER},1 << 18);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.SCHOLAR},1 << 19);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.SHAPESHIFTER},1 << 20);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.VANGUARD},1 << 21);
|
||||||
|
yield return new TestCaseData(new HashSet<TraitsEnum>{TraitsEnum.WARRIOR},1 << 22);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class ChampionSelector : MonoBehaviour
|
public class ChampionSelector : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] private bool _defaultSelection = false;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
Toggle _ASHESelector;
|
Toggle _ASHESelector;
|
||||||
|
|
||||||
@@ -255,65 +256,65 @@ public class ChampionSelector : MonoBehaviour
|
|||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_ASHESelector.enabled = true;
|
_ASHESelector.isOn = _defaultSelection;
|
||||||
_BLITZCRANKSelector.enabled = true;
|
_BLITZCRANKSelector.isOn = _defaultSelection;
|
||||||
_ELISESelector.enabled = true;
|
_ELISESelector.isOn = _defaultSelection;
|
||||||
_JAXSelector.enabled = true;
|
_JAXSelector.isOn = _defaultSelection;
|
||||||
_JAYCESelector.enabled = true;
|
_JAYCESelector.isOn = _defaultSelection;
|
||||||
_LILLIASelector.enabled = true;
|
_LILLIASelector.isOn = _defaultSelection;
|
||||||
_NOMSYSelector.enabled = true;
|
_NOMSYSelector.isOn = _defaultSelection;
|
||||||
_POPPYSelector.enabled = true;
|
_POPPYSelector.isOn = _defaultSelection;
|
||||||
_SERAPHINESelector.enabled = true;
|
_SERAPHINESelector.isOn = _defaultSelection;
|
||||||
_SORAKASelector.enabled = true;
|
_SORAKASelector.isOn = _defaultSelection;
|
||||||
_TWITCHSelector.enabled = true;
|
_TWITCHSelector.isOn = _defaultSelection;
|
||||||
_WARWICKSelector.enabled = true;
|
_WARWICKSelector.isOn = _defaultSelection;
|
||||||
_ZIGGSSelector.enabled = true;
|
_ZIGGSSelector.isOn = _defaultSelection;
|
||||||
_ZOESelector.enabled = true;
|
_ZOESelector.isOn = _defaultSelection;
|
||||||
_AHRISelector.enabled = true;
|
_AHRISelector.isOn = _defaultSelection;
|
||||||
_AKALISelector.enabled = true;
|
_AKALISelector.isOn = _defaultSelection;
|
||||||
_CASSIOPEIASelector.enabled = true;
|
_CASSIOPEIASelector.isOn = _defaultSelection;
|
||||||
_GALIOSelector.enabled = true;
|
_GALIOSelector.isOn = _defaultSelection;
|
||||||
_KASSADINSelector.enabled = true;
|
_KASSADINSelector.isOn = _defaultSelection;
|
||||||
_KOGMAWSelector.enabled = true;
|
_KOGMAWSelector.isOn = _defaultSelection;
|
||||||
_NILAHSelector.enabled = true;
|
_NILAHSelector.isOn = _defaultSelection;
|
||||||
_NUNUSelector.enabled = true;
|
_NUNUSelector.isOn = _defaultSelection;
|
||||||
_RUMBLESelector.enabled = true;
|
_RUMBLESelector.isOn = _defaultSelection;
|
||||||
_SHYVANASelector.enabled = true;
|
_SHYVANASelector.isOn = _defaultSelection;
|
||||||
_SYNDRASelector.enabled = true;
|
_SYNDRASelector.isOn = _defaultSelection;
|
||||||
_TRISTANASelector.enabled = true;
|
_TRISTANASelector.isOn = _defaultSelection;
|
||||||
_ZILEANSelector.enabled = true;
|
_ZILEANSelector.isOn = _defaultSelection;
|
||||||
_BARDSelector.enabled = true;
|
_BARDSelector.isOn = _defaultSelection;
|
||||||
_EZREALSelector.enabled = true;
|
_EZREALSelector.isOn = _defaultSelection;
|
||||||
_HECARIMSelector.enabled = true;
|
_HECARIMSelector.isOn = _defaultSelection;
|
||||||
_HWEISelector.enabled = true;
|
_HWEISelector.isOn = _defaultSelection;
|
||||||
_JINXSelector.enabled = true;
|
_JINXSelector.isOn = _defaultSelection;
|
||||||
_KATARINASelector.enabled = true;
|
_KATARINASelector.isOn = _defaultSelection;
|
||||||
_MORDEKAISERSelector.enabled = true;
|
_MORDEKAISERSelector.isOn = _defaultSelection;
|
||||||
_NEEKOSelector.enabled = true;
|
_NEEKOSelector.isOn = _defaultSelection;
|
||||||
_SHENSelector.enabled = true;
|
_SHENSelector.isOn = _defaultSelection;
|
||||||
_SWAINSelector.enabled = true;
|
_SWAINSelector.isOn = _defaultSelection;
|
||||||
_VEIGARSelector.enabled = true;
|
_VEIGARSelector.isOn = _defaultSelection;
|
||||||
_VEXSelector.enabled = true;
|
_VEXSelector.isOn = _defaultSelection;
|
||||||
_WUKONGSelector.enabled = true;
|
_WUKONGSelector.isOn = _defaultSelection;
|
||||||
_FIORASelector.enabled = true;
|
_FIORASelector.isOn = _defaultSelection;
|
||||||
_GWENSelector.enabled = true;
|
_GWENSelector.isOn = _defaultSelection;
|
||||||
_KALISTASelector.enabled = true;
|
_KALISTASelector.isOn = _defaultSelection;
|
||||||
_KARMASelector.enabled = true;
|
_KARMASelector.isOn = _defaultSelection;
|
||||||
_NAMISelector.enabled = true;
|
_NAMISelector.isOn = _defaultSelection;
|
||||||
_NASUSSelector.enabled = true;
|
_NASUSSelector.isOn = _defaultSelection;
|
||||||
_OLAFSelector.enabled = true;
|
_OLAFSelector.isOn = _defaultSelection;
|
||||||
_RAKANSelector.enabled = true;
|
_RAKANSelector.isOn = _defaultSelection;
|
||||||
_RYZESelector.enabled = true;
|
_RYZESelector.isOn = _defaultSelection;
|
||||||
_TAHMKENCHSelector.enabled = true;
|
_TAHMKENCHSelector.isOn = _defaultSelection;
|
||||||
_TARICSelector.enabled = true;
|
_TARICSelector.isOn = _defaultSelection;
|
||||||
_VARUSSelector.enabled = true;
|
_VARUSSelector.isOn = _defaultSelection;
|
||||||
_BRIARSelector.enabled = true;
|
_BRIARSelector.isOn = _defaultSelection;
|
||||||
_CAMILLESelector.enabled = true;
|
_CAMILLESelector.isOn = _defaultSelection;
|
||||||
_DIANASelector.enabled = true;
|
_DIANASelector.isOn = _defaultSelection;
|
||||||
_MILLIOSelector.enabled = true;
|
_MILLIOSelector.isOn = _defaultSelection;
|
||||||
_MORGANASelector.enabled = true;
|
_MORGANASelector.isOn = _defaultSelection;
|
||||||
_NORRASelector.enabled = true;
|
_NORRASelector.isOn = _defaultSelection;
|
||||||
_SMOLDERSelector.enabled = true;
|
_SMOLDERSelector.isOn = _defaultSelection;
|
||||||
_XERATHSelector.enabled = true;
|
_XERATHSelector.isOn = _defaultSelection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class UIToLogic : MonoBehaviour
|
public class EmblemSelector : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] private int _defaultEmblemCount = 0;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private TMP_InputField _arcanaEmblems;
|
private TMP_InputField _arcanaEmblems;
|
||||||
|
|
||||||
@@ -107,28 +108,28 @@ public class UIToLogic : MonoBehaviour
|
|||||||
}
|
}
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_arcanaEmblems.text = "0";
|
_arcanaEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_chronoEmblems.text = "0";
|
_chronoEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_dragonEmblems.text = "0";
|
_dragonEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_druidEmblems.text = "0";
|
_druidEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_eldrichtEmblems.text = "0";
|
_eldrichtEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_faerieEmblems.text = "0";
|
_faerieEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_frostEmblems.text = "0";
|
_frostEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_honeymancyEmblems.text = "0";
|
_honeymancyEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_portalEmblems.text = "0";
|
_portalEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_pyroEmblems.text = "0";
|
_pyroEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_sugarcraftEmblems.text = "0";
|
_sugarcraftEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_witchcraftEmblems.text = "0";
|
_witchcraftEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_bastionEmblems.text = "0";
|
_bastionEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_blasterEmblems.text = "0";
|
_blasterEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_hunterEmblems.text = "0";
|
_hunterEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_incantatorEmblems.text = "0";
|
_incantatorEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_mageEmblems.text = "0";
|
_mageEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_multistrikerEmblems.text = "0";
|
_multistrikerEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_preserverEmblems.text = "0";
|
_preserverEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_scholarEmblems.text = "0";
|
_scholarEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_shapeshifterEmblems.text = "0";
|
_shapeshifterEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_vanguardEmblems.text = "0";
|
_vanguardEmblems.text = _defaultEmblemCount.ToString();
|
||||||
_warriorEmblems.text = "0";
|
_warriorEmblems.text = _defaultEmblemCount.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,8 @@ PlayerSettings:
|
|||||||
androidSupportedAspectRatio: 1
|
androidSupportedAspectRatio: 1
|
||||||
androidMaxAspectRatio: 2.1
|
androidMaxAspectRatio: 2.1
|
||||||
androidMinAspectRatio: 1
|
androidMinAspectRatio: 1
|
||||||
applicationIdentifier: {}
|
applicationIdentifier:
|
||||||
|
Standalone: com.DefaultCompany.TraitTracker
|
||||||
buildNumber:
|
buildNumber:
|
||||||
Bratwurst: 0
|
Bratwurst: 0
|
||||||
Standalone: 0
|
Standalone: 0
|
||||||
@@ -664,6 +665,7 @@ PlayerSettings:
|
|||||||
platformArchitecture: {}
|
platformArchitecture: {}
|
||||||
scriptingBackend:
|
scriptingBackend:
|
||||||
Android: 1
|
Android: 1
|
||||||
|
Standalone: 0
|
||||||
il2cppCompilerConfiguration: {}
|
il2cppCompilerConfiguration: {}
|
||||||
il2cppCodeGeneration: {}
|
il2cppCodeGeneration: {}
|
||||||
il2cppStacktraceInformation: {}
|
il2cppStacktraceInformation: {}
|
||||||
@@ -691,7 +693,7 @@ PlayerSettings:
|
|||||||
gcIncremental: 1
|
gcIncremental: 1
|
||||||
gcWBarrierValidation: 0
|
gcWBarrierValidation: 0
|
||||||
apiCompatibilityLevelPerPlatform: {}
|
apiCompatibilityLevelPerPlatform: {}
|
||||||
editorAssembliesCompatibilityLevel: 1
|
editorAssembliesCompatibilityLevel: 3
|
||||||
m_RenderingPath: 1
|
m_RenderingPath: 1
|
||||||
m_MobileRenderingPath: 1
|
m_MobileRenderingPath: 1
|
||||||
metroPackageName: TraitTracker
|
metroPackageName: TraitTracker
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user