Skip to content

Commit

Permalink
Display summon cards in CardAllList
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizeta committed Jun 5, 2017
1 parent f7e2e63 commit 22ae493
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
97 changes: 97 additions & 0 deletions Observer/Deck/CardAllListEnhancer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using ShadowWatcher.Socket;
using System.Collections.Generic;
using UnityEngine;

namespace ShadowWatcher.Deck
{
public class CardAllListEnhancer : MonoBehaviour
{
private static readonly List<int> summonCards = new List<int> {
900021011,
900031011,
900041011,
900041021,
900041031,
900044011,
900044021,
900111011,
900131011,
900141011,
900144011,
900211011,
900211021,
900211031,
900211041,
900211051,
900211061,
900211071,
900232011,
900241011,
900242011,
900311011,
900311021,
900311031,
900311041,
900311051,
900311061,
900312011,
900314011,
900314021,
900334011,
900334021,
900411011,
900411021,
900411031,
900441041,
900511011,
900511021,
900511031,
900511041,
900541011,
900541021,
900541031,
900544011,
900544021,
900611011,
900711011,
900711021,
900711031,
900711041,
900711051,
900711061,
900711071,
900711081,
900711091,
900733011,
900743011,
900743021,
900743031,
};

public void OnEnable()
{
var ownCards = GameMgr.GetIns().GetDataMgrIns().GetUserOwnCardData();
foreach (var id in summonCards)
{
ownCards.Add(id, 1);
}
Sender.Send($"AddSummonCard.");
}

public void OnDisable()
{
var ownCards = GameMgr.GetIns().GetDataMgrIns().GetUserOwnCardData();
foreach (var id in summonCards)
{
ownCards.Remove(id);
}
Sender.Send("RemoveSummonCard.");
}

public static void SetUp()
{
var target = UIManager.GetInstance().GetUIBase(UIManager.ViewScene.CardAllList);
target?.gameObject.AddMissingComponent<CardAllListEnhancer>();
}
}
}
2 changes: 2 additions & 0 deletions Observer/Observer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ShadowWatcher.Battle;
using ShadowWatcher.Deck;
using ShadowWatcher.Replay;
using ShadowWatcher.Socket;
using System;
Expand Down Expand Up @@ -34,6 +35,7 @@ public void LateUpdate()
{
battleManager.Loop();
replayManager.Loop();
CardAllListEnhancer.SetUp();
}
catch (Exception e)
{
Expand Down
1 change: 1 addition & 0 deletions Observer/Observer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Compile Include="Contract\CardData.cs" />
<Compile Include="Contract\ConstData.cs" />
<Compile Include="Contract\ReplayData.cs" />
<Compile Include="Deck\CardAllListEnhancer.cs" />
<Compile Include="Loader.cs" />
<Compile Include="Observer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down

0 comments on commit 22ae493

Please sign in to comment.