Ejemplo n.º 1
0
        public void Load(Func <SCCMListPresenter, int, int, Task <LoadFuncResult> > loadFunc, SCCMListScrollbar sb, HUDImage wc, bool async = true)
        {
            Clear();
            _currentRequest++;

            _scrollbar  = sb;
            _waitingCog = wc;

            _scrollbar.Presenter = this;

            this.IsVisible        = false;
            _scrollbar.IsVisible  = false;
            _waitingCog.IsVisible = true;

            _loadFunc = loadFunc;

            _mode = PresenterMode.Loading;
            if (async)
            {
                DoLoad(0, _currentRequest, true).RunAsync();
            }
            else
            {
                DoLoad(0, _currentRequest, false).Wait();
            }
        }
Ejemplo n.º 2
0
    private void OnCardClicked(StandardEnums.CardEnum cardEnum)
    {
        if (this.CurrentMode == PresenterMode.PickSuggestionProve)
        {
            // TODO: Send message to server

            this.CurrentMode = PresenterMode.ViewCards;
            MoveCameraBackToDefaultLocation();
        }
    }
Ejemplo n.º 3
0
    private void HandleGameCardsDealt(List <StandardEnums.CardEnum> cards)
    {
        foreach (StandardEnums.CardEnum cardID in cards)
        {
            GameObject instantiatedCard = Instantiate(CardPrefab);
            instantiatedCard.transform.SetParent(this.CardItemHost.transform, false);
            Button cardButton = instantiatedCard.gameObject.GetComponent <Button>();
            cardButton.gameObject.GetComponent <Image>().sprite = StandardValueRepository.Instance.GetCardSprite(cardID);
            instantiatedCardButtons[cardID] = instantiatedCard;
            cardButton.onClick.AddListener(() => OnCardClicked(cardID));
        }

        ViewCardButton.enabled = true;
        this.CurrentMode       = PresenterMode.ViewCards;
    }
Ejemplo n.º 4
0
        private async Task DoLoad(int page, int reqid, bool async)
        {
            _mode = PresenterMode.Loading;
            var r = await _loadFunc(this, page, reqid);

            void FinishAction()
            {
                if (IsCurrentRequest(reqid))
                {
                    switch (r)
                    {
                    case LoadFuncResult.Success:
                        _mode        = PresenterMode.Normal;
                        _currentPage = page;
                        break;

                    case LoadFuncResult.LastPage:
                        _mode        = PresenterMode.FullyLoaded;
                        _currentPage = page;
                        break;

                    case LoadFuncResult.Error:
                        _mode = PresenterMode.Normal;
                        break;

                    default:
                        SAMLog.Error("SCCMLP::EnumSwitch_DoLoad", "r = " + r);
                        break;
                    }

                    this.IsVisible        = true;
                    _scrollbar.IsVisible  = true;
                    _waitingCog.IsVisible = false;
                }
            }

            if (async)
            {
                MainGame.Inst.DispatchBeginInvoke(FinishAction);
            }
            else
            {
                FinishAction();
            }
        }
Ejemplo n.º 5
0
 private void HandleDebunkSelection(List <StandardEnums.CardEnum> cardEnums)
 {
     this.CurrentMode = PresenterMode.PickSuggestionProve;
     SetAllActive();
     this.instantiatedCardButtons.Where(kvp => !cardEnums.Contains(kvp.Key)).ToList().ForEach(item => item.Value.SetActive(false));
 }