Skip to content

Commit

Permalink
fixed Custom Group in any Mission Preset causing the app to hang
Browse files Browse the repository at this point in the history
  • Loading branch information
GlowPuff committed Jun 28, 2021
1 parent 206f6b2 commit 481813b
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 24 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LORAI/Assets/Resources/Languages/De/instructions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
{
"instName": "Manuelle Aufstellung",
"instID": "DG1000",
"instID": "DG070",
"content": [
{
"instruction": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,6 @@
"expansion": "Other",
"ignored": "Coordinated Raid",
"isElite": true
}
}
]
}
2 changes: 1 addition & 1 deletion LORAI/Assets/Resources/Languages/En/instructions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
{
"instName": "Manual Deployment",
"instID": "DG1000",
"instID": "DG070",
"content": [
{
"instruction": [
Expand Down
2 changes: 1 addition & 1 deletion LORAI/Assets/Resources/Languages/Es/instructions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
{
"instName": "Despliegue manual",
"instID": "DG1000",
"instID": "DG070",
"content": [
{
"instruction": [
Expand Down
2 changes: 1 addition & 1 deletion LORAI/Assets/Resources/Languages/Fr/instructions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
{
"instName": "Déploiement Manuel",
"instID": "DG1000",
"instID": "DG070",
"content": [
{
"instruction": [
Expand Down
6 changes: 3 additions & 3 deletions LORAI/Assets/Scripts/Common/DGPrefab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public void Init( CardDescriptor cd )
iconImage.sprite = Resources.Load<Sprite>( $"Cards/Villains/{cd.id.Replace( "DG", "M" )}" );
outline.effectColor = eliteColor;
}
else if ( cd.id == "DG1000" )//handle custom group
else if ( cd.id == "DG070" )//handle custom group
{
iconImage.sprite = Resources.Load<Sprite>( "Cards/Enemies/Other/M1000" );
iconImage.sprite = Resources.Load<Sprite>( "Cards/Enemies/Other/M070" );
}
else//otherwise it's an ally
{
Expand Down Expand Up @@ -151,7 +151,7 @@ public void RemoveSelf()
{
//add card back to dep hand ONLY IF IT'S NOT THE CUSTOM GROUP
//AND if it's NOT a villain
if ( cardDescriptor.id != "DG1000" && !DataStore.villainCards.cards.Contains( cardDescriptor ) )
if ( cardDescriptor.id != "DG070" && !DataStore.villainCards.cards.Contains( cardDescriptor ) )
DataStore.deploymentHand.Add( cardDescriptor );
//remove it from deployed list
DataStore.deployedEnemies.Remove( cardDescriptor );
Expand Down
2 changes: 1 addition & 1 deletion LORAI/Assets/Scripts/Common/DataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public static class DataStore
{
public static readonly string appVersion = "v.1.0.14";
public static readonly string appVersion = "v.1.0.15";
public static readonly string[] languageCodeList = { "En", "De", "Es", "Fr" };

public static Dictionary<string, List<Card>> missionCards;
Expand Down
8 changes: 4 additions & 4 deletions LORAI/Assets/Scripts/MainGame/EnemyActivationPopup.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using TMPro;
using DG.Tweening;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class EnemyActivationPopup : MonoBehaviour
{
Expand Down
12 changes: 6 additions & 6 deletions LORAI/Assets/Scripts/MainGame/GenericChooser.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using DG.Tweening;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class GenericChooser : MonoBehaviour
{
Expand Down Expand Up @@ -47,10 +47,10 @@ public void Show( ChooserMode mode, List<CardDescriptor> cards, Action<CardDescr
chooserMode = mode;

//add custom group IF mode != ally/hero
CardDescriptor custom = new CardDescriptor() { cost = 0, expansion = "Other", name = "Custom Group", faction = "None", id = "DG1000", ignored = "", priority = 2, rcost = 0, size = 1, tier = 1 };
CardDescriptor custom = new CardDescriptor() { cost = 0, expansion = "Other", name = "Custom Group", faction = "None", id = "DG070", ignored = "", priority = 2, rcost = 0, size = 1, tier = 1 };

cardDescriptors = new List<CardDescriptor>( cards );
if ( mode == ChooserMode.DeploymentGroups )
if ( mode == ChooserMode.DeploymentGroups && !cardDescriptors.Any( x => x.id == "DG070" ) )
cardDescriptors.Add( custom );

OnChangeExpansion( "Core" );
Expand Down
11 changes: 9 additions & 2 deletions LORAI/Assets/Scripts/Title/GroupToggleContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public void OnToggle( Toggle toggle )
else
previewImage.sprite = Resources.Load<Sprite>( $"Cards/Enemies/{selectedExpansion}/{enemyCards[index].id}" );

if ( enemyCards[index].id == "DG070" )
previewImage.gameObject.SetActive( false );

previewNameText.text = enemyCards[index].name;

if ( buttonToggles[index].isOn )
Expand Down Expand Up @@ -87,7 +90,11 @@ public void OnChangeExpansion( string expansion )
else if ( groupIndex == 3 )
deploymentCards = DataStore.deploymentCards;

CardDescriptor custom = new CardDescriptor() { cost = 0, expansion = "Other", name = "Custom Group", faction = "None", id = "DG070", ignored = "", priority = 2, rcost = 0, size = 1, tier = 1 };

enemyCards = deploymentCards.cards.Where( x => x.expansion == expansion ).ToList();
if ( expansion == "Other" )
enemyCards.Add( custom );
DeploymentCards prevSelected = DataStore.sessionData.selectedDeploymentCards[groupIndex];

Sprite thumbNail = null;
Expand All @@ -102,15 +109,15 @@ public void OnChangeExpansion( string expansion )
child.gameObject.SetActive( true );//re-enable the Toggle

var id = int.Parse( enemyCards[i].id.Substring( 2 ).TrimStart( '0' ) );
if ( id <= 69 )//groupIndex != 2 )//if NOT villains
if ( id <= 70 )//groupIndex != 2 )//if NOT villains
thumbNail = Resources.Load<Sprite>( $"Cards/Enemies/{selectedExpansion}/{enemyCards[i].id.Replace( "DG", "M" )}" );
else//villain thumb directory
thumbNail = Resources.Load<Sprite>( $"Cards/Villains/{enemyCards[i].id.Replace( "DG", "M" )}" );

//set the thumbnail texture
var thumb = child.Find( "Image" );
thumb.GetComponent<Image>().sprite = thumbNail;
if ( enemyCards[i].isElite || id > 69 )
if ( enemyCards[i].isElite || id > 70 )
thumb.GetComponent<Image>().color = new Color( 1, .5f, .5f, 1 );
else
thumb.GetComponent<Image>().color = new Color( 1, 1, 1, 1 );
Expand Down
5 changes: 4 additions & 1 deletion LORAI/Assets/Scripts/Title/NewGameScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ public void LoadMissionPreset()
mercenaryToggle.isOn = DataStore.sessionData.includeMercs;
imperialToggle.isOn = DataStore.sessionData.includeImperials;

var allCards = DataStore.deploymentCards.cards.Concat( DataStore.villainCards.cards );
CardDescriptor custom = new CardDescriptor() { cost = 0, expansion = "Other", name = "Custom Group", faction = "None", id = "DG070", ignored = "", priority = 2, rcost = 0, size = 1, tier = 1 };

var allCards = DataStore.deploymentCards.cards.Concat( DataStore.villainCards.cards ).ToList();
allCards.Add( custom );

DataStore.sessionData.MissionStarting.Clear();
foreach ( var card in mp.initialGroups )
Expand Down

0 comments on commit 481813b

Please sign in to comment.