Esempio n. 1
0
        /// <summary>
        /// Creates slides collection.
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="preSettings"></param>
        /// <returns></returns>
        public static SlideCollection Create(PresentationDocument xmlDoc, IPreSettings preSettings)
        {
            var xmlPrePart      = xmlDoc.PresentationPart;
            var slideCollection = new List <Slide>();
            var sldNumDic       = new Dictionary <Slide, SlideNumber>();

            for (var sldIndex = 0; sldIndex < xmlPrePart.SlideParts.Count(); sldIndex++)
            {
                var xmlSldPart   = xmlPrePart.GetSlidePartByIndex(sldIndex);
                var sldNumEntity = new SlideNumber(sldIndex + 1);
                var newSlide     = new Slide(xmlSldPart, sldNumEntity, preSettings);
                sldNumDic.Add(newSlide, sldNumEntity);
                slideCollection.Add(newSlide);
            }

            return(new SlideCollection(slideCollection, xmlDoc, sldNumDic));
        }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        tickCallback = () => UpdateSliders(false);
        // BUY
        buyButton   = buyButtonObj.GetComponent <Button>();
        buyList     = buyListObj.GetComponent <TradeDropDown>();
        boat        = player.GetComponent <Boat>();
        buySlider   = buySliderObj.GetComponent <SlideNumber>();
        buyDropdown = buyList.GetComponent <Dropdown>();
        buyDropdown.onValueChanged.AddListener(newValue => {
            buySlider.UpdateCost(
                city.GetCost(Common.ParseResource(buyDropdown.options[newValue].text)),
                boat.gold,
                true);
            buySlider.value = 0;
        });
        buyButton.onClick.AddListener(() => {
            boat.BuyFromCityInRange(buyList.GetSelectedResource(), buySlider.value);
            buySlider.value = 0;
        });

        // SELL
        sellButton   = sellButtonObj.GetComponent <Button>();
        sellList     = sellListObj.GetComponent <TradeDropDown>();
        boat         = player.GetComponent <Boat>();
        sellSlider   = sellSliderObj.GetComponent <SlideNumber>();
        sellDropdown = sellList.GetComponent <Dropdown>();
        sellDropdown.onValueChanged.AddListener(newValue => {
            sellSlider.UpdateCost(
                city.GetCost(Common.ParseResource(sellDropdown.options[newValue].text)),
                boat.GetStock(Common.ParseResource(sellDropdown.options[newValue].text)),
                false);
            sellSlider.value = 0;
        });
        sellButton.onClick.AddListener(() => {
            boat.SellFromCityInRange(sellList.GetSelectedResource(), sellSlider.value);
            sellSlider.value = 0;
        });

        // begin as inactive
        gameObject.SetActive(false);
    }
Esempio n. 3
0
        /// <summary>
        /// Creates slides collection.
        /// </summary>
        /// <returns></returns>
        public static SlideCollection Create(PresentationPart sdkPrePart, IPreSettings preSettings)
        {
            Check.NotNull(sdkPrePart, nameof(sdkPrePart));
            Check.NotNull(preSettings, nameof(preSettings));

            var numSlides       = sdkPrePart.SlideParts.Count();
            var slideCollection = new List <Slide>(numSlides);
            var sldNumDic       = new Dictionary <Slide, SlideNumber>(numSlides);

            for (var sldIndex = 0; sldIndex < numSlides; sldIndex++)
            {
                var sdkSldPart   = sdkPrePart.GetSlidePartByIndex(sldIndex);
                var sldNumEntity = new SlideNumber(sldIndex + 1);
                var newSlide     = new Slide(sdkSldPart, sldNumEntity, preSettings);
                sldNumDic.Add(newSlide, sldNumEntity);
                slideCollection.Add(newSlide);
            }

            return(new SlideCollection(slideCollection, sdkPrePart, sldNumDic));
        }