private void OnEndEditCalulatorInputCard(UICardDesk desk, UICardPile pile, UICard card) { if (card != null && card == calculatorInputCard) { RefreshCalculator(); } }
private void OnSwitchDesk(UICardDesk newDesk) { if (deskBuilder != null) { deskBuilder.Build(newDesk); } }
private void OnEndEditDatabaseCard(UICardDesk desk, UICardPile pile, UICard card) { if (card != null && card == databaseCard) { Database editedData = databaseCard.Data as Database; DatapackSerializer.Serialize(editedData, databaseSavePath); databaseCard.Data = editedData; //onSaveDatabase?.Invoke((Database)card.Data); } }
//private void OnEnable() //{ // List<UICardPile> piles = new List<UICardPile>(); // pileBuilders = GetComponentsInChildren<UICardPileBuilder>(true); // foreach (UICardPileBuilder builder in pileBuilders) // { // builder.ResetPile(); // piles.Add(builder.CurrentPile); // } // CurrentDesk = new UICardDesk(piles.ToArray()); //} public void Build(UICardDesk desk) { Clear(); CurrentDesk = desk; if (CurrentDesk != null) { if (CurrentDesk.PileCount != pileBuilders.Length) { Debug.LogError("Desk / DeskBuilder size mismatch"); } else { for (int i = 0, iend = pileBuilders.Length; i < iend; i++) { if (pileBuilders[i] == null) { continue; } pileBuilders[i].BuildPile(CurrentDesk.CardPiles[i]); } } } }