private void Awake() { cardStorage = new CardStorage(defaultCharacterSprite, loadRemoteCollectionFirst); progressStorage = new ProgressStorage(cardStorage); GameStartOverlay.FadeOutCallback = StartGameplayLoop; }
private void Awake() { transitionController = FindObjectOfType <MenuTransitionController>(); variantMenu = FindObjectOfType <VariantGameMenu>(); wordbookMenu = FindObjectOfType <WordBookMenuControl>(); patientDataManager = FindObjectOfType <PatientDataManager>(); categoryStorage = FindObjectOfType <CategoryStorage>(); cardStorage = FindObjectOfType <CardStorage>(); categoryLibraryControl = FindObjectOfType <CategoryLibraryUIControl>(); cardLibraryControl = FindObjectOfType <CardLibraryUIControl>(); categoryCreator = FindObjectOfType <CategoryCreator>(); cardCreator = FindObjectOfType <CardCreator>(); contentLoader = FindObjectOfType <ContentLoader>(); Signals.SetImgForCardEvent.AddListener(SetUpNewImgForCard); Signals.SetImgForCategoryEvent.AddListener(SetUpImgForCategory); Signals.CardLoadEnd.AddListener((value) => { if (value) { transitionController.ReturnToBack(); Debug.Log("load end"); } else { Debug.Log("load error"); } }); BindBtn(); }
public void Initialize() { storage = FindObjectOfType <CardStorage>(); FindObjectOfType <LibraryCardSelector>().Initialize(); Signals.AddCardEvent.AddListener(AddCard); FillLibrary(); }
static void Main(string[] args) { // GameProcess cardGame = new GameProcess(); //cardGame.CollectingCards(); CardStorage cardSimulator = new CardStorage(); cardSimulator.suitRandomizer(); }
private void Awake() { storage = FindObjectOfType <CardStorage>(); saveSystem = FindObjectOfType <SaveSystem>(); patientDataManager = FindObjectOfType <PatientDataManager>(); categoryManager = FindObjectOfType <CategoryManager>(); transitionController = FindObjectOfType <MenuTransitionController>(); BindUI(); }
public void Initialize(List <GameObject> _cards) { cardStorage = FindObjectOfType <CardStorage>(); playClauseBtn.onClick.AddListener(PlayClause); Signals.AddWordToClause.AddListener(AddCardInClause); Signals.AddCategoryWord.AddListener(AddCardInClause); Signals.RemoveWordFromClause.AddListener(RemoveCardFromClause); Signals.ResetWordComposingMenu.AddListener(ClearClausePanel); }
private void Awake() { // Listen for Escape key ('Back' on Android) to quit the game inputDispatcher.AddKeyDownHandler(KeyCode.Escape, keyCode => Application.Quit()); cardStorage = new CardStorage(defaultCharacterSprite); progressStorage = new ProgressStorage(cardStorage); GameStartOverlay.FadeOutCallback = StartGameplayLoop; }
private void Awake() { variantGameUI = FindObjectOfType <VariantGameMenu>(); wordbookGameUI = FindObjectOfType <WordBookMenuControl>(); wordCompositngUI = FindObjectOfType <WordComposingMenuControl>(); cardStorage = FindObjectOfType <CardStorage>(); categoryStorage = FindObjectOfType <CategoryStorage>(); mainMenuUI = FindObjectOfType <MainMenuUIControl>(); patientManager = FindObjectOfType <PatientDataManager>(); saveSystem = FindObjectOfType <SaveSystem>(); cardLibrary = FindObjectOfType <CardLibraryUIControl>(); categoryLibrary = FindObjectOfType <CategoryLibraryUIControl>(); if (patientManager != null) { patientManager.Initialize(); } if (saveSystem != null) { saveSystem.Initialize(); } if (categoryStorage != null) { categoryStorage.Initialize(); } if (cardStorage != null) { cardStorage.Initialize(); } if (variantGameUI != null) { variantGameUI.Initialize(); } if (wordbookGameUI != null) { wordbookGameUI.Initialize(); } if (wordCompositngUI != null) { wordCompositngUI.Initialize(); } if (categoryLibrary != null) { categoryLibrary.Initialize(); } if (cardLibrary != null) { cardLibrary.Initialize(); } if (mainMenuUI != null) { mainMenuUI.Initialize(); } }
public void ResolvePrerequisites(CardStorage cardStorage) { unsatisfiedPrerequisites = new Dictionary <ICard, ICardPrerequisite>(); foreach (ICardPrerequisite prerequisite in prerequisites) { ICard card = prerequisite.GetCard(cardStorage); if (card != null && (card.Progress.Status & prerequisite.Status) != prerequisite.Status && !unsatisfiedPrerequisites.ContainsKey(card)) { unsatisfiedPrerequisites.Add(card, prerequisite); card.AddDependentCard(this); } } }
public virtual void Initialize() { patientDataManager = FindObjectOfType <PatientDataManager>(); categoryManager = FindObjectOfType <CategoryManager>(); categoryStorage = FindObjectOfType <CategoryStorage>(); cardStorage = FindObjectOfType <CardStorage>(); mainMenu = FindObjectOfType <MainMenuUIControl>(); ConfigurateCategories(); cardSelector.Initialize(Cards); Signals.AddCategoryEvent.AddListener(AddNewCategory); Signals.AddCardEvent.AddListener(AddNewCard); Signals.DeleteCategoryFromGame.AddListener(DeleteCategory); Signals.DeleteCardFromCategory.AddListener(DeleteCard); }
public void Initialize(List <GameObject> _cards) { categoryStorage = FindObjectOfType <CategoryStorage>(); cardStorage = FindObjectOfType <CardStorage>(); content = FindObjectOfType <WordBookContent>(); foreach (var card in _cards) { cards.Add(card.GetComponent <CardBase>()); } Signals.DownSwipeEvent.AddListener(() => ScrollCards(-1)); Signals.UpSwipeEvent.AddListener(() => ScrollCards(1)); Signals.LeftSwipeEvent.AddListener(() => ScrollImages(1)); Signals.RightSwipeEvent.AddListener(() => ScrollImages(-1)); }
public CardsViewModel() { cardStorage = new CardStorage(); PublicCards = cardStorage.PublicCards; //cardStorage.PropertyChanged += (sender, args) => // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PublicCards")); AddCard = new RelayCommand(async(strTitle) => { var file = GetFileBodyCreate(); if (file == null) { return; } await cardStorage.AddValueAsync((string)strTitle, file); }); RemoveCard = new ActionCommand(async() => { if (SelectedCard == null) { return; } await cardStorage.RemoveCard(SelectedCard); SelectedCard = null; }); UpdateCard = new ActionCommand(async() => { if (SelectedCard == null) { return; } var image = GetFileBodyUpdate(); await cardStorage.UpdateCard(selectedCardWithautChanges, SelectedCard, image); SelectedCard = null; }); SortCards = new ActionCommand(() => { cardStorage.Order(); }); }
private void Awake() { // Listen for Escape key ('Back' on Android) that suspends the game on Android // or ends it on any other platform #if UNITY_ANDROID inputDispatcher.AddKeyUpHandler(KeyCode.Escape, keyCode => { AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer") .GetStatic <AndroidJavaObject>("currentActivity"); activity.Call <bool>("moveTaskToBack", true); }); #else inputDispatcher.AddKeyDownHandler(KeyCode.Escape, keyCode => Application.Quit()); #endif cardStorage = new CardStorage(defaultCharacterSprite, loadRemoteCollectionFirst); progressStorage = new ProgressStorage(cardStorage); GameStartOverlay.FadeOutCallback = StartGameplayLoop; }
public void CheckPrerequisite(ICard dependency, CardStorage cardStorage) { if (PrerequisitesSatisfied() || !unsatisfiedPrerequisites.ContainsKey(dependency)) { dependency.RemoveDependentCard(this); return; } ICardPrerequisite prerequisite = unsatisfiedPrerequisites[dependency]; if ((dependency.Progress.Status & prerequisite?.Status) == prerequisite?.Status) { unsatisfiedPrerequisites.Remove(dependency); dependency.RemoveDependentCard(this); } if (PrerequisitesSatisfied()) { // Duplicate-proof because we've verified that this card's // prerequisites were not satisfied before cardStorage.AddDrawableCard(this); } }
public Card Fetch(CardStorage cardStorage) { return(cardStorage.ForId(id)); }
private void Awake() { storage = FindObjectOfType <CardStorage>(); Signals.VariantGameCardSelect.AddListener(HideUnselectedCards); }
public Card GetCard(CardStorage cardStorage) { return(cardStorage.ForId(id)); }
public Dictionary <String, object> CloneDictionary(CardGame newgame) { Dictionary <String, object> ret = new Dictionary <String, object>(); foreach (KeyValuePair <String, object> entry in vars) { var key = entry.Key; var o = entry.Value; if (o is int i) { ret.Add(key, i); } else if (o is bool b) { ret.Add(key, b); } else if (o is string s) { ret.Add(key, s); } else if (o is string[] sa) { string[] str = (string[])sa.Clone(); ret.Add(key, str); } else if (o is Player p) { ret.Add(key, newgame.players[p.id]); } else if (o is List <Player> lp) { List <Player> newlist = new List <Player>(); foreach (Player player in lp) { int idx = player.id; newlist.Add(newgame.players[idx]); } ret.Add(key, newlist); } else if (o is Team t) { ret.Add(key, newgame.teams[t.id]); } else if (o is List <Team> lt) // NEED TO TEST { List <Team> newlist = new List <Team>(); foreach (Team team in lt) { int idx = team.id; newlist.Add(newgame.teams[idx]); } ret.Add(key, newlist); } else if (o is Card c) { ret.Add(key, newgame.sourceDeck[c.id]); } else if (o is List <Card> ) { List <Card> l = new List <Card>(); foreach (Card card in o as List <Card> ) { l.Add(newgame.sourceDeck[card.id]); } ret.Add(key, l); } else if (o is CardCollection cc) // NEED TO TEST XX { string tempcc = cc.name; CCType temptype = cc.type; if (temptype == CCType.VIRTUAL) { CardCollection ccclone = cc.Clone(); foreach (Card oldc in cc.AllCards()) { ccclone.Add(newgame.sourceDeck[oldc.id]); } ret.Add(key, ccclone); } else { CardStorage collectionowner = cc.owner; Owner owner = collectionowner.owner; int idx = owner.id; Owner newowner; if (owner as Player != null) { newowner = newgame.players[owner.id]; } else if (owner as Team != null) { newowner = newgame.teams[owner.id]; } else { if (idx == 0) { newowner = newgame.table[0]; } else { throw new Exception(); } // NOT IMPLEMENTED OTHER TYPES OF OWNER } ret.Add(key, newowner.cardBins[temptype, tempcc]); } } /*else if (o is CardLocReference) * { * throw new NotImplementedException(); * var l = fancyCardLocMap[(o as CardLocReference).name]; * ret.Add(key, l); * } * else if (o is IntStorageReference) * { * throw new NotImplementedException(); * var rs = FancyIntStorageMap[(o as IntStorageReference).key]; * ret.Add(key, rs); * } * else if (o is GameActionCollection) //TODO what do i do here? * { * throw new NotImplementedException(); * Console.WriteLine("You're copying a GameActionCollection???"); * var coll = o as GameActionCollection; * var newcoll = new GameActionCollection(); * foreach (GameAction ac in coll) * { * newcoll.Add(ac); * } * ret.Add(key, newcoll); * }*/ else { Console.WriteLine("Error: object " + o + " is type " + o.GetType()); throw new Exception(); } } /*Console.WriteLine("original:"); * foreach (object o in original){ * Console.WriteLine(o.ToString()); * } * Console.WriteLine(original.Count); * Console.WriteLine("new:"); * foreach (object o in original){ * Console.WriteLine(o.ToString()); * } * Console.WriteLine(ret.Count);*/ return(ret); }
public ProgressStorage(CardStorage cardStorage) { this.cardStorage = cardStorage; ProgressStorageInit = Load(); }
public ICard GetCard(CardStorage cardStorage) { return(cardStorage.SpecialCard(id)); }
public Card Fetch(CardStorage cardStorage) { return(cardStorage.SpecialCard(id)); }
/* * [Range(1, 24)] * public int numberOfCard; */ private void Awake() { cardsStored = GetComponentInParent <CardStorage>(); cards = new Card[cardNumb.Length]; }