|
|
@ -1,6 +1,8 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections; |
|
|
using System.Collections; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
using Unity.Collections.LowLevel.Unsafe; |
|
|
using UnityEngine; |
|
|
using UnityEngine; |
|
|
using UnityEngine.UI; |
|
|
using UnityEngine.UI; |
|
|
|
|
|
|
|
|
@ -626,6 +628,7 @@ public class GameManager : Singleton<GameManager> |
|
|
} |
|
|
} |
|
|
yield return null;*/ |
|
|
yield return null;*/ |
|
|
|
|
|
|
|
|
|
|
|
List<int> colorCount = PlayerStatsManager.Instance.GetCardDeckColor(PlayerStatsManager.Instance.cardDeck.cardDeckList); |
|
|
List<MapUnity> whiteMapUnities = new List<MapUnity>(); |
|
|
List<MapUnity> whiteMapUnities = new List<MapUnity>(); |
|
|
for(int i=0;i< X .Count;i++) |
|
|
for(int i=0;i< X .Count;i++) |
|
|
{ |
|
|
{ |
|
|
@ -637,18 +640,60 @@ public class GameManager : Singleton<GameManager> |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if(colorCount[0]<=whiteMapUnities .Count) |
|
|
|
|
|
{ |
|
|
|
|
|
for (int i = 0; i < colorCount[0]; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (whiteMapUnities.Count <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
for(int j=1;j<colorCount .Count;j++) |
|
|
|
|
|
{ |
|
|
|
|
|
if(colorCount[j]>0) |
|
|
|
|
|
{ |
|
|
|
|
|
int index = UnityEngine.Random.Range(0, whiteMapUnities.Count); |
|
|
|
|
|
whiteMapUnities[index].switchColor(j); |
|
|
|
|
|
colorCount[j] -= 1; |
|
|
|
|
|
whiteMapUnities.RemoveAt(index); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for(int i = 0; i < playerState.canColorCount ; i++) |
|
|
yield return null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
//当涂色数大于地块数时按照比例转化
|
|
|
|
|
|
float multiplier = (float)whiteMapUnities.Count / (float)colorCount[0]; |
|
|
|
|
|
for (int i=0;i< colorCount.Count;i++ ) |
|
|
|
|
|
{ |
|
|
|
|
|
colorCount[i] = (int)(colorCount[i] * multiplier); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < colorCount[0]; i++) |
|
|
{ |
|
|
{ |
|
|
if (whiteMapUnities.Count <= 0) |
|
|
if (whiteMapUnities.Count <= 0) |
|
|
{ |
|
|
{ |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
for (int j = 1; j < colorCount.Count; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (colorCount[j] > 0) |
|
|
|
|
|
{ |
|
|
int index = UnityEngine.Random.Range(0, whiteMapUnities.Count); |
|
|
int index = UnityEngine.Random.Range(0, whiteMapUnities.Count); |
|
|
whiteMapUnities[index].switchColor(PlayerStatsManager.Instance.colorSortList[UnityEngine.Random.Range(0, 3)]); |
|
|
whiteMapUnities[index].switchColor(j); |
|
|
|
|
|
colorCount[j] -= 1; |
|
|
whiteMapUnities.RemoveAt(index); |
|
|
whiteMapUnities.RemoveAt(index); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
yield return null; |
|
|
yield return null; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for (int i = 0; i < 20; i++) |
|
|
for (int i = 0; i < 20; i++) |
|
|
{ |
|
|
{ |
|
|
if(whiteMapUnities.Count<=0) |
|
|
if(whiteMapUnities.Count<=0) |
|
|
|