Exemple #1
0
    public IEnumerator LoadArt(bool light = false)
    {
        coll.enabled = false;
        string loadedArtPath = "";

        yield return(dirViewer.StartCoroutine(dirViewer.SearchForFile(CardLoader.GetSavePath(""), result => loadedArtPath = result)));

        if (!string.IsNullOrEmpty(loadedArtPath))
        {
            loadedArtPath = SanitizePath(loadedArtPath);
            ArtTab currTab = tabs.ActiveToggles().First().GetComponent <ArtTab>();
            if (currTab.artLayer == art)
            {
                if (light)
                {
                    data.mainArt.lightingDir = loadedArtPath;
                }
                else
                {
                    data.mainArt.imageDir = loadedArtPath;
                }
                currTab.artLayer.LoadArt(data.mainArt);
            }
            else
            {
                for (int i = 0; i < foregroundLayers.Count; i++)
                {
                    if (currTab.artLayer == foregroundLayers[i])
                    {
                        if (light)
                        {
                            data.foregroundLayers[i].lightingDir = loadedArtPath;
                        }
                        else
                        {
                            data.foregroundLayers[i].imageDir = loadedArtPath;
                        }
                        currTab.artLayer.LoadArt(data.foregroundLayers[i]);
                    }
                }
                for (int i = 0; i < backgroundLayers.Count; i++)
                {
                    if (currTab.artLayer == backgroundLayers[i])
                    {
                        if (light)
                        {
                            data.backgroundLayers[i].lightingDir = loadedArtPath;
                        }
                        else
                        {
                            data.backgroundLayers[i].imageDir = loadedArtPath;
                        }
                        currTab.artLayer.LoadArt(data.backgroundLayers[i]);
                    }
                }
            }
        }
        coll.enabled = true;
        Save();
    }
Exemple #2
0
 public const int DECKLIMIT = 10;                                     // the size of the deck
 // Use this for initialization
 void Start()
 {
     //loaderObject = GameObject.Find ("CardLoader");
     CL = GameObject.Find("CardLoarder").GetComponent <CardLoader> ();
     // Get the current number of cards each type has
     armsLimit     = CL.armsCards.Keys.Count;
     creatureLimit = CL.creatureCards.Keys.Count;
     spellLimit    = CL.spellCards.Keys.Count;
     // initialize the number of cards to display
     armsCount     = 0;
     creatureCount = 0;
     spellCount    = 0;
     // intialize where to start to display cards
     armsStart     = new Vector3(-140f, 150f, 0);
     creatureStart = new Vector3(-303, 150f, 0);
     spellStart    = new Vector3(23, 150f, 0);
     deckStart     = new Vector3(240, 150f, 0);
     // Get each set of cards and assign them to a list
     deckList  = new List <string> ();
     armsNames = new List <string>();
     foreach (string key in CL.armsCards.Keys)
     {
         armsNames.Add(key);
     }
     creatureNames = new List <string> ();
     foreach (string key in CL.creatureCards.Keys)
     {
         creatureNames.Add(key);
     }
     spellNames = new List <string> ();
     foreach (string key in CL.spellCards.Keys)
     {
         spellNames.Add(key);
     }
 }
Exemple #3
0
 public void LoadArt(CardArt artData)
 {
     if (string.IsNullOrEmpty(artData.imageDir))
     {
         print("no dir");
         art.color = Color.clear;
     }
     else if (!File.Exists(Path.Combine(CardLoader.GetSavePath(""), artData.imageDir)))
     {
         print("dir doesn't exist");
         art.color = Color.clear;
     }
     else
     {
         LoadArt(CastleTools.LoadImage(Path.Combine(CardLoader.GetSavePath(""), artData.imageDir)));
         art.color = Color.white;
     }
     if (string.IsNullOrEmpty(artData.lightingDir))
     {
         print("no dir");
         lighting.color = Color.clear;
     }
     else if (!File.Exists(Path.Combine(CardLoader.GetSavePath(""), artData.lightingDir)))
     {
         print("dir doesn't exist");
         lighting.color = Color.clear;
     }
     else
     {
         LoadLighting(CastleTools.LoadImage(Path.Combine(CardLoader.GetSavePath(""), artData.lightingDir)));
         lighting.color = Color.white;
     }
     ApplyMask(artData.masked);
 }
Exemple #4
0
    void Awake()
    {
        player1HandPosition = GameObject.Find("Canvas/Player1Hand");
        CL = GameObject.Find("CardLoader").GetComponent <CardLoader>();
        using (XmlReader reader = XmlReader.Create(new StreamReader(Application.persistentDataPath + "/Decks/DeckList.xml"))) {
            XmlWriterSettings ws = new XmlWriterSettings();
            ws.Indent = true;
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    switch (reader.Name)
                    {
                    case "Deck":
                        deckName = reader.GetAttribute("Name");
                        //Debug.Log (deckName);
                        break;
                    }
                    break;

                case XmlNodeType.Text:
                    //Debug.Log (reader.Value);
                    line = reader.Value;
                    break;
                }
            }
        }
        player1Deck = line.Split(',').ToList <string> ();
        player1Deck.RemoveAt(player1Deck.Count - 1);          // Remove the blank string at the end of the list of cards
        RandomizeDeck(player1Deck);
        DrawStartingHands(player1Deck);
        //Debug.Log (player1Deck.Count);
        DisplayHand(player1HandPosition, player1Hand);
    }
        public static void LoadCards()
        {
            CardLoader.LoadCards();

            whiteDeck = new Deck(CardType.White);
            blackDeck = new Deck(CardType.Black);
        }
    // 从XML中载入卡牌模板信息
    public void LoadCardFromXML()
    {
        Card InitCard = new Card();

        InitCard.SetMainGameController(MainGameController);

        CardLoader NewCardLoader = new CardLoader();

        string filePath = Application.dataPath + "/Resources/Card.xml";

        if (File.Exists(filePath))
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(filePath);
            XmlNodeList node = xmlDoc.SelectSingleNode("Card").ChildNodes;
            foreach (XmlElement CardInfo in node)
            {
                Card NewCard = null;

                foreach (XmlElement CardInfoItem in CardInfo.ChildNodes)
                {
                    if (CardInfoItem.Name == "CardType")
                    {
                        NewCard = NewCardLoader.GetNewCardByType(CardInfoItem.InnerText);
                    }
                    else if (CardInfoItem.Name == "CardSubInfo")
                    {
                        NewCard.LoadInfoFromXML(CardInfoItem);
                    }
                }
                AddCard(NewCard);
            }
        }
    }
Exemple #7
0
	void Awake(){
		player1HandPosition = GameObject.Find ("Canvas/Player1Hand");
		CL = GameObject.Find ("CardLoader").GetComponent<CardLoader>();
		using (XmlReader reader = XmlReader.Create (new StreamReader (Application.persistentDataPath + "/Decks/DeckList.xml"))) {
			XmlWriterSettings ws = new XmlWriterSettings ();
			ws.Indent = true;
			while (reader.Read ()) {
				switch (reader.NodeType) {
				case XmlNodeType.Element:
					switch (reader.Name) {
					case "Deck":
						deckName = reader.GetAttribute ("Name");
						//Debug.Log (deckName);
						break;
					}
					break;
				case XmlNodeType.Text:
					//Debug.Log (reader.Value);
					line = reader.Value;
					break;
				}
			}
		}
		player1Deck = line.Split (',').ToList<string> ();
		player1Deck.RemoveAt (player1Deck.Count - 1); // Remove the blank string at the end of the list of cards
		RandomizeDeck(player1Deck);
		DrawStartingHands (player1Deck);
		//Debug.Log (player1Deck.Count);
		DisplayHand(player1HandPosition, player1Hand);

	}
        private BoardState LoadUpdatedBoardState()
        {
            CardLoader.ResetIds();
            var chips    = ChipLoader.LoadChips(Rarity.None);
            var spaces   = SpaceLoader.LoadSpaces();
            var trainers = TrainerLoader.LoadTrainers();
            var items    = CardLoader.LoadItems();
            var events   = CardLoader.LoadEvents();
            var elites   = EliteLoader.LoadElites();

            var boardStateData = LoadBoardState();
            var catchSpaceData = LoadCatchSpaces();
            var chipData       = LoadChips();
            var playerData     = LoadPlayers();
            var spaceData      = LoadSpaces();
            var trainerData    = LoadTrainers();

            UpdateTrainers(trainers, trainerData);
            UpdateChips(chips, chipData);
            UpdateSpaces(spaces, spaceData, catchSpaceData, chips);

            var players = CreatePlayers(playerData, trainers, chips, items, spaces.Item1);

            return(CreateBoardState(boardStateData, chips, items, events, players, spaces, elites));
        }
Exemple #9
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        List <Card> toInstantiate = Shuffle(CardLoader.LoadCards(path, GameConfig.deckNum));

        cards      = new List <CardDisplay>();
        cardsToUse = new List <CardDisplay>();

        foreach (Card card in toInstantiate)
        {
            CardDisplay c = Instantiate(cardPrefab).GetComponent <CardDisplay>();
            c.LoadCard(card);
            c.ColliderActive(false);
            cards.Add(c);
        }

        PosisionateCards();
    }
Exemple #10
0
	public const int DECKLIMIT = 10; // the size of the deck
	// Use this for initialization
	void Start () {
		//loaderObject = GameObject.Find ("CardLoader");
		CL = GameObject.Find("CardLoarder").GetComponent<CardLoader> ();
		// Get the current number of cards each type has
		armsLimit =  CL.armsCards.Keys.Count;
		creatureLimit = CL.creatureCards.Keys.Count;
		spellLimit = CL.spellCards.Keys.Count;
		// initialize the number of cards to display
		armsCount = 0;
		creatureCount = 0;
		spellCount = 0;
		// intialize where to start to display cards
		armsStart = new Vector3 (-140f, 150f, 0);
		creatureStart = new Vector3 (-303, 150f, 0);
		spellStart = new Vector3 (23, 150f, 0);
		deckStart = new Vector3 (240, 150f, 0);
		// Get each set of cards and assign them to a list
		deckList = new List<string> ();
		armsNames = new List<string>() ;
		foreach (string key in CL.armsCards.Keys)
			armsNames.Add (key);
		creatureNames = new List<string> ();
		foreach (string key in CL.creatureCards.Keys)
			creatureNames.Add (key);
		spellNames = new List<string> ();
		foreach (string key in CL.spellCards.Keys)
			spellNames.Add (key);
	}
Exemple #11
0
        static Cards()
        {
            // Fetch all cards.
            var cardLoader = new CardLoader();

            Card[] cards = cardLoader.Load();

            //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json");
            //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json");
            //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson);
            //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented));
            // Set as card definitions

            Data = new CardContainer();
            Data.Load(cards);

            //Log.Debug("Standard:");
            //Enum.GetValues(typeof(CardClass)).Cast<CardClass>().ToList().ForEach(heroClass =>
            for (int i = 0; i < HeroClasses.Length; i++)
            {
                CardClass heroClass = HeroClasses[i];
                Standard.Add(heroClass, All.Where(c =>
                                                  c.Collectible &&
                                                  (c.Class == heroClass ||
                                                   c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                                   c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER ||
                                                                              c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                                   c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID ||
                                                                              c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                                   c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE ||
                                                                              c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                                  c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly());
                //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards.");
                //});
            }

            //Log.Debug("AllStandard:");
            AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList().AsReadOnly();

            //Log.Debug("Wild:");
            Enum.GetValues(typeof(CardClass)).Cast <CardClass>().ToList().ForEach(heroClass =>
            {
                Wild.Add(heroClass, All.Where(c =>
                                              c.Collectible &&
                                              (c.Class == heroClass ||
                                               c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                               c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                               c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                               c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                              c.Type != CardType.HERO).ToList().AsReadOnly());
                //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards.");
            });

            //Log.Debug("AllWild:");
            AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList().AsReadOnly();

            StandardCostMinionCards = AllStandard.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList());
            WildCostMinionCards     = AllWild.Where(c => c.Type == CardType.MINION).GroupBy(c => c.Cost).ToDictionary(g => g.Key, g => g.ToList());
        }
Exemple #12
0
        public HomeController(ILogger <HomeController> logger)
        {
            _logger = logger;

            CardLoader cardLoader = new CardLoader();

            _cardData = cardLoader.LoadCards();
        }
Exemple #13
0
 /// <summary>
 /// Sets singleton instance.
 /// </summary>
 /// <exception cref="Exception">Throws exception if there are more than one CardLoader</exception>
 private void Awake()
 {
     if (instance != null)
     {
         throw new Exception("Multiple CardLoaders exist!");
     }
     instance = this;
 }
Exemple #14
0
 private void Filter()
 {
     lbCards.Items.Clear();
     foreach (CardItem item in CardLoader.GetFilteredCards(tbSearch.Text, cbDescription.IsChecked, cbbRole.SelectedIndex, Convert.ToInt16(slCost.Value)).OrderBy(x => x.CardData.Name))
     {
         lbCards.Items.Add(item);
     }
 }
 public TurnPhase(XmlElement from, CardLoader loader)
 {
     Name   = from.GetAttribute("name");
     Deltas = from
              .GetElementsByTagName("delta")
              .OfType <XmlElement>()
              .Select(element => Delta.FromXml(element, loader))
              .ToList();
 }
Exemple #16
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     Screen.SetResolution(720, 720, false);
     Load();
     cardLoaders = new List <CardLoad>();
     CreateCardLoaders();
     card.Load(loadedData.data[loadedCard]);
 }
    void Start()
    {
        CardLoader.loadCards();

        shuffledCards = new List <Card>(CardLoader.deckBang);
        Shuffle(shuffledCards);

        sprite = gameObject.GetComponent <CardSprite>();
    }
 // Use this for initialization
 void Start()
 {
     DeckEditorButtons = new List <GameObject>();
     cardLoader        = GetComponent <CardLoader>();
     deckLoader        = GetComponent <DeckLoader>();
     deckBuilder       = GetComponent <DeckBuilder>();
     CurrentDeckToEdit = null;
     CurrentDeckToPlay = null;
 }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            var loader = new CardLoader();

            fullCardView.FrontSide = new CardView()
            {
                Card = loader.LoadFromFile("card.card")
            };
        }
Exemple #20
0
 public SwapPositionDelta(XmlElement from, CardLoader loader)
     : base(from, loader)
 {
     SendableLane1   = new SendableTarget <Lane>("lane1", from, Lane.IdIssuer);
     this.SideIndex1 = Int32.Parse(from.Attributes["sideIndex1"].Value);
     this.Position1  = Int32.Parse(from.Attributes["position1"].Value);
     SendableLane2   = new SendableTarget <Lane>("lane2", from, Lane.IdIssuer);
     this.SideIndex2 = Int32.Parse(from.Attributes["sideIndex2"].Value);
     this.Position2  = Int32.Parse(from.Attributes["position2"].Value);
 }
        private void FillCards(string[] Sources)
        {
#if WINDOWS && EDITOR
            CardLoader.FillCardsFromLoader();
#endif
#if !WINDOWS || !EDITOR
            CardLoader.FillCards(Sources);
#endif
            PickRandom(CardLoader.SortedCardLists);
        }
        public AddToLaneDelta(XmlElement from, CardLoader loader)
            : base(from, Lane.IdIssuer, loader)
        {
            this.SendableCard = new SendableTarget <Card>("card", from, loader);
            this.SideIndex    = Int32.Parse(from.Attributes["sideIndex"].Value);
            this.Position     = Int32.Parse(from.Attributes["position"].Value);
#if (UNITY_EDITOR || UNITY_STANDALONE)
            this.Unit = new Unit(SendableCard.Target as UnitCard, Int32.Parse(from.Attributes["unitId"].Value), Driver.instance.gameManager);
#endif
        }
Exemple #23
0
        public MainMenu()
        {
            Program.HandleNetworking = true;
            CardLoader.Reset();

            ClearColor            = Color.White;
            persistentDisplayName = "";

            personValue = slogans[new Random().Next(slogans.Count)];
        }
        private void Close(object sender, CancelEventArgs e)
        {
            var loader = new CardLoader();
            var bitmap = MakeThumbnail(cardView.Image);

            using (var thumb = new MemoryStream())
            {
                bitmap.Save(thumb, System.Drawing.Imaging.ImageFormat.Png);
                loader.SaveToFile("last.card", Card, thumb);
            }
        }
Exemple #25
0
 private static void ProcessDeltas(XmlDocument doc, CardLoader cl, bool verbose = false)
 {
     foreach (XmlElement e in doc.GetElementsByTagName("delta"))
     {
         Delta d = Delta.FromXml(e, cl);
         if (verbose)
         {
             Console.WriteLine("Processing delta: '{0}'", e.OuterXml);
         }
         d.Apply();
     }
 }
Exemple #26
0
 void Start()
 {
     _abandon    = transform.Find("Abandon").gameObject;
     _buy        = transform.Find("Buy").gameObject;
     _cards      = transform.Find("Cards").gameObject;
     _cardsList  = new List <GameObject>();
     _cardLoader = CardLoader.GetComponent <CardLoader>();
     foreach (Transform child in _cards.transform)
     {
         _cardsList.Add(child.gameObject);
     }
 }
Exemple #27
0
        static Cards()
        {
            var cardLoader = new CardLoader();
            var cards      = cardLoader.Load();

            //string json = File.ReadAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardData.json");
            //string json = File.ReadAllText(Environment.CurrentDirectory + @"\cardData.json");
            //var cards = JsonConvert.DeserializeObject<IEnumerable<Card>>(Resources.cardDataJson);
            //File.WriteAllText(CardLoader.Path + @"SabberStone\HSProtoSim\Loader\Data\cardDataJson.txt", JsonConvert.SerializeObject(cards, Formatting.Indented));
            // Set as card definitions

            Data = new CardDefinitions();
            Data.Load(cards);

            //Log.Info($"Loaded {All.Count()} cards.");

            // Wild
            //Log.Debug("Wild:");
            foreach (var heroClass in Enum.GetValues(typeof(CardClass)).Cast <CardClass>())
            {
                Wild.Add(heroClass, All.Where(c =>
                                              c.Collectible &&
                                              (c.Class == heroClass ||
                                               c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                               c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                               c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                               c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                              c.Type != CardType.HERO).ToList());
                //Log.Debug($"-> [{heroClass}] - {Wild[heroClass].Count} cards.");
            }

            //Log.Debug("Standard:");
            foreach (var heroClass in Enum.GetValues(typeof(CardClass)).Cast <CardClass>())
            {
                Standard.Add(heroClass, All.Where(c =>
                                                  c.Collectible &&
                                                  (c.Class == heroClass ||
                                                   c.Class == CardClass.NEUTRAL && c.MultiClassGroup == 0 ||
                                                   c.MultiClassGroup == 1 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.HUNTER || c.Class == CardClass.PALADIN || c.Class == CardClass.WARRIOR) ||
                                                   c.MultiClassGroup == 2 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.DRUID || c.Class == CardClass.ROGUE || c.Class == CardClass.SHAMAN) ||
                                                   c.MultiClassGroup == 3 && (c.Class == CardClass.NEUTRAL || c.Class == CardClass.MAGE || c.Class == CardClass.PRIEST || c.Class == CardClass.WARLOCK)) &&
                                                  c.Type != CardType.HERO && StandardSets.Contains(c.Set)
                                                  ).ToList());
                //Log.Debug($"-> [{heroClass}] - {Standard[heroClass].Count} cards.");
            }

            //Log.Debug("AllStandard:");
            AllStandard = All.Where(c => c.Collectible && c.Type != CardType.HERO && StandardSets.Contains(c.Set)).ToList();

            //Log.Debug("AllWild:");
            AllWild = All.Where(c => c.Collectible && c.Type != CardType.HERO).ToList();
        }
Exemple #28
0
	// Use this for initialization
	void Start () {
		CL = GameObject.Find ("CardLoader").GetComponent<CardLoader> ();
		player1HandStart = Player1HandObject.transform.position;
		/*
		foreach (string s in Deck)
			Debug.Log (s);*/
		RandomizeDeck (Deck);
		/*
		Debug.Log ("After Random");
		foreach (string s in Deck)
			Debug.Log (s);*/
		DrawStartingHand ();
		DisplayHand (player1Hand, player1HandStart);
	}
Exemple #29
0
    private IEnumerator DEBUG_AnimateChooseCard()
    {
        CardLoader    cardLoader = Driver.instance.cardLoader;
        StringBuilder output     = new StringBuilder();

        yield return(ChooseCard(new[] {
            cardLoader.GetByID("Commercial Coms Relay"),
            cardLoader.GetByID("Ancillary Medical Officer"),
            cardLoader.GetByID("Cannoneer Drone"),
            cardLoader.GetByID("Paladin-Class XS Marines")
        }, output));

        Debug.Log(output.ToString());
    }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Closing += Close;

            if (File.Exists("last.card"))
            {
                var loader = new CardLoader();
                Card = loader.LoadFromFile("last.card");
            }
            else
            {
                Card = new Card();
            }
        }
Exemple #31
0
        // this will return a new instance of the Delta type specified in the XML
        // and return it
        // DO THIS INSTEAD OF CALLING ANY SUBCLASSES XML CONSTRUCTOR
        public static Delta FromXml(XmlElement from, CardLoader cl)
        {
            string t    = from.Attributes["type"].Value;
            Type   type = Type.GetType(t);

            if (type.IsSubclassOf(typeof(Delta))) //refuse to construct types that aren't Deltas; do this for safety
            {
                ConstructorInfo con = type.GetConstructor(new Type[] { typeof(XmlElement), typeof(CardLoader) });
                return(con?.Invoke(new object[] { from, cl }) as Delta);
            }
            else
            {
                return(null);
            }
        }
Exemple #32
0
        public void Object_Manager_Test_Load_Card_A_GUI()
        {
            // Use the Assert class to test conditions

            int cardID = 1;

            manager = freshManager;
            CardLoader loader = new GameObject().AddComponent <CardLoader>();

            CardLoader.SetInstance(loader);
            loader.loadCards();
            manager.LoadCardAGUI(cardID);

            Assert.AreEqual(true, manager.PlayerACardGui.enabled);
        }
Exemple #33
0
    void Start()
    {
        // Get the component scripts
        CL = GameObject.Find("CardLoader").GetComponent <CardLoader> ();
        GL = GameObject.Find("GamePlay").GetComponent <GameLoop> ();

        //These are the objects which each card will be displayed in
        Player1Hand      = GameObject.Find("Player1Hand");      // this is the players hand, cards when drawn will be displayed here
        Player1Tactics   = GameObject.Find("Player1Tactics");   // this is the player's tactics zone, when a spell/arms card is played it goes here
        Player1Creatures = GameObject.Find("Player1Creatures"); // this is the player's creatures zone, when a creature is played it goes here
        Player1Stack     = GameObject.Find("Player1Stack");     // this is player1's view of the stack

        // this is the player2's view of the cards player1 has
        Player2ViewTactics   = GameObject.Find("Player2ViewTactics");   // player2's view of player1's tactics zone
        Player2ViewCreatures = GameObject.Find("Player2ViewCreatures"); // player2's view of player1's creature zone
        Player2ViewHand      = GameObject.Find("Player2ViewHand");      // player2's view of player1's hand
        Player2Stack         = GameObject.Find("Player2Stack");         // player2's view of the stack

        // The positions to display the cards at
        Player1HandPos    = Player1Hand.transform.position; // the hand position
        Player1HandPos.z -= 1f;                             // move the position to be just infront of the gameobject
        Player1TacticsPos = Player1Tactics.transform.position;
        // position the card in the correct place in relation to the gameobject
        Player1TacticsPos.z -= 1f;
        Player1TacticsPos.y += 3f;
        Player1CreaturesPos  = Player1Creatures.transform.position;
        // position the card in the correct place in relation to the game object
        Player1CreaturesPos.z -= 1f;
        Player1CreaturesPos.y += 3f;
        Player1StackPos.z      = -1f;

        // the positions to display the cards player 2 can see
        Player2HandViewPos    = Player2ViewHand.transform.position;
        Player2HandViewPos.z -= 1f;         // move the position to be just in front of the game object
        Player2TacticsViewPos = Player2ViewTactics.transform.position;
        // position the card in the correct place in relation to the game object
        Player2TacticsViewPos.z -= 1f;
        Player2TacticsViewPos.y += 3f;
        Player2CreatureViewPos   = Player2ViewCreatures.transform.position;
        // position the card in the correct place in relation to the game object
        Player2CreatureViewPos.z -= 1f;
        Player2CreatureViewPos.y += 3f;
        Player2StackPos           = Player2Stack.transform.position;
        // position the card in the correct place in relation to the game object
        Player2StackPos.z -= 1f;
        Player2StackPos.x -= 21f;
        Player2StackPos.y += 9f;
    }
Exemple #34
0
	void Start () {
		// Get the component scripts
		CL = GameObject.Find ("CardLoader").GetComponent<CardLoader> ();
		GL = GameObject.Find ("GamePlay").GetComponent<GameLoop> ();

		//These are the objects which each card will be displayed in
		Player1Hand = GameObject.Find("Player1Hand"); // this is the players hand, cards when drawn will be displayed here
		Player1Tactics = GameObject.Find("Player1Tactics"); // this is the player's tactics zone, when a spell/arms card is played it goes here
		Player1Creatures = GameObject.Find("Player1Creatures"); // this is the player's creatures zone, when a creature is played it goes here
		Player1Stack = GameObject.Find("Player1Stack"); // this is player1's view of the stack

		// this is the player2's view of the cards player1 has
		Player2ViewTactics = GameObject.Find ("Player2ViewTactics"); // player2's view of player1's tactics zone
		Player2ViewCreatures = GameObject.Find ("Player2ViewCreatures"); // player2's view of player1's creature zone
		Player2ViewHand = GameObject.Find ("Player2ViewHand"); // player2's view of player1's hand
		Player2Stack = GameObject.Find ("Player2Stack"); // player2's view of the stack

		// The positions to display the cards at
		Player1HandPos = Player1Hand.transform.position; // the hand position 
		Player1HandPos.z -= 1f; // move the position to be just infront of the gameobject
		Player1TacticsPos = Player1Tactics.transform.position;
		// position the card in the correct place in relation to the gameobject
		Player1TacticsPos.z -= 1f; 
		Player1TacticsPos.y += 3f; 
		Player1CreaturesPos = Player1Creatures.transform.position;
		// position the card in the correct place in relation to the game object
		Player1CreaturesPos.z -= 1f;
		Player1CreaturesPos.y += 3f;
		Player1StackPos.z = -1f;

		// the positions to display the cards player 2 can see
		Player2HandViewPos = Player2ViewHand.transform.position;
		Player2HandViewPos.z -= 1f; // move the position to be just in front of the game object
		Player2TacticsViewPos = Player2ViewTactics.transform.position;
		// position the card in the correct place in relation to the game object
		Player2TacticsViewPos.z -= 1f;
		Player2TacticsViewPos.y += 3f;
		Player2CreatureViewPos = Player2ViewCreatures.transform.position;
		// position the card in the correct place in relation to the game object
		Player2CreatureViewPos.z -= 1f;
		Player2CreatureViewPos.y += 3f;
		Player2StackPos = Player2Stack.transform.position;
		// position the card in the correct place in relation to the game object
		Player2StackPos.z -= 1f;
		Player2StackPos.x -= 21f;
		Player2StackPos.y += 9f;
	}
Exemple #35
0
	// Use this for initialization
	void Start () {
		// both players start with no creatures on the stack
		numPlayer1Creatures = 0; 
		numPlayer2Creatures = 0;
		HP = transform.GetComponent<Health> (); // get the component to track player's health
		player1.enabled = true; // view player 1's board
		player2.enabled = false;
		CL = GameObject.Find ("CardLoader").GetComponent<CardLoader> (); // get the script to view hand card info
		player1HandObject = GameObject.Find ("Player1Hand"); // get Player1's hand object to display cards on
		player1ViewHand = GameObject.Find ("Player1ViewHand"); // get the view player1 has of player2's hand
		player2HandObject = GameObject.Find ("Player2Hand"); // get player2's hand object to view hand card info
		player2ViewHand = GameObject.Find ("Player2ViewHand"); // get the view player2 has of player 1's hand
		DisplayHand (player1HandObject, player2ViewHand, player1Hand); // display palyer 1's hand/;
		isPlayer1 = false; // player1's field has been filled, switch to player2
		isPlayer2 = true;
		DisplayHand (player2HandObject, player1ViewHand, player2Hand); // display player2's board
		turnCount = 0;
	}
Exemple #36
0
	void Start () {
		CL = GameObject.Find ("CardLoader").GetComponent<CardLoader> ();
		GP = GameObject.Find ("GamePlayHandler").GetComponent<GamePlay1> ();
	}
Exemple #37
0
	// Use this for initialization
	void Start () {
		CL = GameObject.Find ("CardLoader").GetComponent<CardLoader> ();

	}