Sélectionner une révision Git
-
Amar Takhar a rédigé
Commit the beginings of the Path class to hold the internal representation of paths, this is extremely rough since I have to wait until we can do charset conversion in libaegisub to handle windows paths before going any further. Originally committed to SVN as r4359.
Amar Takhar a rédigéCommit the beginings of the Path class to hold the internal representation of paths, this is extremely rough since I have to wait until we can do charset conversion in libaegisub to handle windows paths before going any further. Originally committed to SVN as r4359.
Dump.cs 1,37 Kio
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dump : MonoBehaviour
{
public Stack<Card> dumpStack;
public static Dump Instance
{
private set;
get;
}
private void Awake()
{
if(Instance == null)
{
Instance = this;
}
else
{
DestroyImmediate(this);
}
dumpStack = new Stack<Card>();
}
public void Discard(Card card)
{
// duplication flags are cleared on discard
card.OnCardPlayed(delegate {
DiscardNoAnim(card);
});
}
public void DiscardNoAnim(Card card)
{
CardEvent<Card>.Trigger(Event.CARD_DISCARD, card);
card.transform.SetParent(transform);
card.gameObject.SetActive(false); dumpStack.Push(card);
}
public void Init()
{
if (Instance == null)
{
Instance = this;
}
else if(Instance != this)
{
DestroyImmediate(this);
}
dumpStack = new Stack<Card>();
}
public Stack<Card> Recycle ()
{
Stack<Card> result = new Stack<Card>();
while(dumpStack.Count >0)
{
result.Push(dumpStack.Pop());
}
return result;
}
public Card Draw()
{
return dumpStack.Pop();
}
}