public void AddCard(CardSelectorView selector, string cardId) { cardSelectorScroll.AutoFocus(selector.SelectorTransform, out Vector2 selectorFinalPosition); IShowable showablewCard = cardManager.GetDeckCard(cardId); Move(showablewCard, selectorFinalPosition); }
public void AddShowableAndShow(IShowable showableCard) { ShowCardView showCard = cardShowerManager.GetVoidShowCard(); showCard.SetShowableCard(showableCard); showCard.ShowAnimation(showableCard.ShowPosition); }
public void RemoveCard(string cardId) { cardsScroll.AutoFocus(cardManager.GetDeckCard(cardId).transform, out Vector2 cardPosition); IShowable showablewCard = cardSelectorManager.GetSelectorByCardIdOrEmpty(cardId); Move(showablewCard, cardPosition); }
private void Move(IShowable showableCard, Vector2 positionToMove) { ShowCardView showCard = cardShowerManager.GetThisShowCard(showableCard); showCard.Clean(); showCard.MoveAnimation(positionToMove); }
/*******************************************************************/ public void AddInvestigator(InvestigatorSelectorView selector, string investigatorId) { IShowable showablewCard = cardManager.GetInvestigatorCard(investigatorId); Move(showablewCard, selector.SensorPosition); selector.SetImageAnimation(); }
public static string ShowString(IShowable showable, string format, IFormatProvider formatProvider) { var rest = maxLength(format); var stringBuilder = new StringBuilder(); showable.Show(stringBuilder, ref rest, formatProvider); return(stringBuilder.ToString()); }
public void RemoveShowableAndHide(IShowable showableCar) { foreach (ShowCardView showCard in cardShowerManager.GetAllThisShowCards(showableCar)) { showCard.Clean(); showCard.Hide(); } }
/// <summary> /// /// </summary> /// <param name="showable"></param> /// <param name="format"></param> /// <param name="formatProvider"></param> /// <returns></returns> public static String ShowString(IShowable showable, String format, IFormatProvider formatProvider) { int rest = maxLength(format); StringBuilder sb = new StringBuilder(); showable.Show(sb, ref rest, formatProvider); return(sb.ToString()); }
public void ReshowCardInvestigator(string cardId) { IShowable showablewCard = cardManager.GetInvestigatorCard(cardId); if (showablewCard.MustReshow) { AddShowableAndShow(showablewCard); } }
public void ReshowCardSelector(string cardId) { IShowable showablewCard = cardSelectorManager.GetSelectorByCardIdOrEmpty(cardId); if (showablewCard.MustReshow) { AddShowableAndShow(showablewCard); } }
public void ReshowCardDeck(string cardId) { IShowable showablewCard = cardManager.GetDeckCard(cardId); if (showablewCard.MustReshow) { AddShowableAndShow(showablewCard); } }
/// <summary> /// Sets the showable to show in the UI. /// </summary> /// <param name="showable">The showable.</param> public void SetShowable(IShowable showable) { if (lastShowableButtons != null && lastShowableButtons == showable) { return; } ClearLastShowable(); KeepNewShowable(showable); }
private void Init() { if (_initiated) { return; } _initiated = true; _showable = GetComponent <IShowable>(); _focusable = GetComponent <IFocusable>(); }
/// <summary> /// Colled when the showable does not need to be shown. /// </summary> /// <param name="showable">The showable.</param> public void OnStopShowingHandler(IShowable showable) { if (showableHealth != showable) { return; } showable.OnStopShowing -= OnStopShowingHandler; showableHealth.OnHealthChanges -= OnHealthChangesHandler; showableHealth = null; DestroyAsPoolableObject(); }
/// <summary> /// Changes the last showable with new showable object. /// </summary> /// <param name="showable">The showable.</param> private void ChangeLastShowable(IShowable showable) { if (lastShowable != null) { lastShowable.OnStopShowing -= OnStopShowingHandler; lastShowable = null; } if (showable != null) { showable.OnStopShowing += OnStopShowingHandler; lastShowable = showable; } }
/// <summary> /// Remove the last shown showable from the UI. /// </summary> public void ClearLastShowable() { if (lastShowable == null) { return; } lastShowable.OnShowableDataChanges -= UpdateShowableData; if (lastShowable is IShowableHealth lastShowableHealth) { lastShowableHealth.OnHealthChanges -= OnHealthChangesHandler; } lastShowable = null; }
/// <summary> /// Colled when the showable does not need to be shown. /// </summary> /// <param name="showable">The showable.</param> /// <exception cref="NullReferenceException">showable</exception> private void OnStopShowingHandler(IShowable showable) { if (showable == null) { throw new NullReferenceException(nameof(showable)); } showable.OnStopShowing -= OnStopShowingHandler; if (lastShowable == showable) { lastShowable = null; } panels.OfType <IShowablesPresenter>().ForEach(presenter => presenter.ClearLastShowable()); HidePanels(); }
/// <summary> /// Keeps the new showable. /// </summary> /// <param name="showable">The showable.</param> protected override void KeepNewShowable(IShowable showable) { var showableButtons = showable as IShowableButtonsLevelUps; var data = showableButtons?.GetButtonsLevelUps(); var show = data != null && data.Any(); SetVisible(show); if (showableButtons == null) { return; } UpdateButtons(data); showableButtons.OnButtonsLevelUpsChanges += OnButtonsLevelUpsChangesHandler; lastShowableButtons = showableButtons; }
/// <summary> /// Keeps the new showable. /// </summary> /// <param name="showable">The showable.</param> private void KeepNewShowable(IShowable showable) { SetVisible(showable != null); if (showable == null) { return; } showable.OnShowableDataChanges += UpdateShowableData; if (showable is IShowableHealth showableHealth) { showableHealth.OnHealthChanges += OnHealthChangesHandler; } UpdateShowableData(showable.GetShowableData()); lastShowable = showable; }
/// <summary> /// Keeps the new showable. /// </summary> /// <param name="showable">The showable.</param> protected virtual void KeepNewShowable(IShowable showable) { var showableButtons = showable as IShowableButtons; var show = showable != null && showableButtons != null; SetVisible(show); if (showableButtons == null) { return; } var data = showableButtons.GetButtons(); UpdateButtons(data); showableButtons.OnButtonsChanges += UpdateButtons; showableButtons.OnButtonChange += UpdateButton; lastShowableButtons = showableButtons; }
/*******************************************************************/ public void SetShowableCard(IShowable showableCard) { IsShowing = true; ShowableCard = showableCard; transform.localScale = Vector3.zero; transform.position = showableCard.StartPosition; ActiveFrontImage(); ActiveBackImage(); void ActiveFrontImage() { frontImage.gameObject.SetActive(showableCard.FrontImage != null); frontImage.sprite = showableCard.FrontImage; frontImage.color = showableCard.IsInactive ? Color.gray : Color.white; } void ActiveBackImage() { backImage.gameObject.SetActive(showableCard.BackImage != null); backImage.sprite = showableCard.BackImage; backImage.color = showableCard.IsInactive ? Color.gray : Color.white; } }
public bool CheckIsShow(IShowable showable) => GetThisShowCard(showable)?.IsShowing ?? false;
public IEnumerable <ShowCardView> GetAllThisShowCards(IShowable showable) => showCards.FindAll(showCard => showCard.ShowableCard == showable);
private void ShowStats(IShowable show) { show.ShowStats(); }
public void RemoveMenuItem(IShowable i_MenuItemToRemove) { r_MenuItemsList.Remove(i_MenuItemToRemove); }
public void AddMenuItem(IShowable i_MenuItemToAdd) { r_MenuItemsList.Add(i_MenuItemToAdd); }
public MainCommand(IShowable ShowableObject) { this.ShowableObject = ShowableObject; }
public ShowCardView GetThisShowCard(IShowable showable) => showCards.Find(showCard => showCard.ShowableCard == showable);
public void Clean() { IsShowing = false; ShowableCard = null; }
static void Main(string[] args) { School s = new School("ISEL"); var t1 = new Teacher("Pedro",6863886); s.AddPerson(t1); var s1 = new Student("Luis",33542,27); t1.addStudent(s1); s.AddPerson(s1); var s2 = new Student("Rui", 12345, 28); t1.addStudent(s2); s.AddPerson(s2); Console.WriteLine(s2); foreach (Student st in t1.Alunos) { st.Show(); } //Console.WriteLine(s); //foreach (Student st in t1.Alunos) //{ // st.Show(); //} // Interface IShowable[] stuff = new IShowable[4]; stuff[0] = s; stuff[1] = t1; stuff[2] = s1; stuff[3] = s2; //Print via interface foreach (IShowable p in stuff) { p.Show(); } Student[] nordem = new Student[4]; nordem[0] = s1; nordem[1] = s2; nordem[2] = new Student("Ze",23456,10); nordem[3] = new Student("Barnabé", 14567, 5); Console.WriteLine("Ordenação por BI"); Array.Sort(nordem); foreach (Student n in nordem) n.Show(); CompareStudentbyNumber inum = new CompareStudentbyNumber(); Console.WriteLine("Ordenação por Numero Aluno"); Array.Sort(nordem,inum); foreach (Student n in nordem) n.Show(); ComparfeStudentbyName iname = new ComparfeStudentbyName(); Console.WriteLine("Ordenação por Nome Aluno"); Array.Sort(nordem, iname); foreach (Student n in nordem) n.Show(); var s3 = new Student("Luis", 33542, 27); Console.WriteLine("{0}", t1.hasStudent(s3)); // use DELEGATE string word; Console.WriteLine("Qual o nome a pesquisar? "); word = Console.ReadLine(); if (word != null) { Console.WriteLine("A lista de estudantes é:"); ShowAluno(t1.getFilterStudent(p => p.Name.Contains(word))); } else { Console.WriteLine("Não introdoziu nenhum nome!!"); } t1.Msg += s1.ReceiveMsg; t1.Msg += s2.ReceiveMsg; t1.SendMsg("publicou as notas"); t1.Msg -= s2.ReceiveMsg; t1.SendMsg("publicou as notas 2 vezes"); }
static void Main(string[] args) { School s = new School("ISEL"); var t1 = new Teacher("Pedro", 6863886); s.AddPerson(t1); var s1 = new Student("Luis", 33542, 27); t1.addStudent(s1); s.AddPerson(s1); var s2 = new Student("Rui", 12345, 28); t1.addStudent(s2); s.AddPerson(s2); Console.WriteLine(s2); foreach (Student st in t1.Alunos) { st.Show(); } //Console.WriteLine(s); //foreach (Student st in t1.Alunos) //{ // st.Show(); //} // Interface IShowable[] stuff = new IShowable[4]; stuff[0] = s; stuff[1] = t1; stuff[2] = s1; stuff[3] = s2; //Print via interface foreach (IShowable p in stuff) { p.Show(); } Student[] nordem = new Student[4]; nordem[0] = s1; nordem[1] = s2; nordem[2] = new Student("Ze", 23456, 10); nordem[3] = new Student("Barnabé", 14567, 5); Console.WriteLine("Ordenação por BI"); Array.Sort(nordem); foreach (Student n in nordem) { n.Show(); } CompareStudentbyNumber inum = new CompareStudentbyNumber(); Console.WriteLine("Ordenação por Numero Aluno"); Array.Sort(nordem, inum); foreach (Student n in nordem) { n.Show(); } ComparfeStudentbyName iname = new ComparfeStudentbyName(); Console.WriteLine("Ordenação por Nome Aluno"); Array.Sort(nordem, iname); foreach (Student n in nordem) { n.Show(); } var s3 = new Student("Luis", 33542, 27); Console.WriteLine("{0}", t1.hasStudent(s3)); // use DELEGATE string word; Console.WriteLine("Qual o nome a pesquisar? "); word = Console.ReadLine(); if (word != null) { Console.WriteLine("A lista de estudantes é:"); ShowAluno(t1.getFilterStudent(p => p.Name.Contains(word))); } else { Console.WriteLine("Não introdoziu nenhum nome!!"); } t1.Msg += s1.ReceiveMsg; t1.Msg += s2.ReceiveMsg; t1.SendMsg("publicou as notas"); t1.Msg -= s2.ReceiveMsg; t1.SendMsg("publicou as notas 2 vezes"); }