Exemple #1
0
        private void Initialise()
        {
            if (_helper == null)
            {
                width         = 400;
                height        = 500;
                isInteractive = true;
                enabled       = true;

                _helper           = new UIHelper(this);
                _titleBar         = AddUIComponent <UITitleBar>();
                _informationLabel = AddUIComponent <UILabel>();
                _totalPanel       = AddUIComponent <UIPanel>();
                _totalAmountLabel = _totalPanel.AddUIComponent <UILabel>();
                _totalIncomeLabel = _totalPanel.AddUIComponent <UILabel>();
                _costLabel        = _totalPanel.AddUIComponent <UILabel>();
                _incomeLabel      = _totalPanel.AddUIComponent <UILabel>();
                _incentiveList    = UIFastList.Create <UIFastListIncentives>(this);

                _titleBar.Initialise(CimTools.CimToolsHandler.CimToolBase);

                _ticketSlider = _helper.AddSlider("Tickets", 100, 9000, 10, 500, delegate(float value)
                {
                    if (_incentiveList != null)
                    {
                        FastList <object> optionItems = _incentiveList.rowsData;

                        foreach (IncentiveOptionItem optionItemObject in optionItems)
                        {
                            optionItemObject.ticketCount = value;
                            optionItemObject.UpdateTicketSize();
                        }
                    }
                }) as UISlider;

                _startDaySlider = _helper.AddSlider("Days", 0, 7, 1, 0, delegate(float value)
                {
                    CalculateTotal();
                }) as UISlider;

                TimeOfDaySlider startTimeSliderOptions = new TimeOfDaySlider()
                {
                    uniqueName = "Time", value = 12f
                };
                _startTimeSlider = startTimeSliderOptions.Create(_helper) as UISlider;
                _startTimeSlider.eventValueChanged += delegate(UIComponent component, float value)
                {
                    CalculateTotal();
                };

                _createButton = _helper.AddButton("Create", new OnButtonClicked(CreateEvent)) as UIButton;

                CimTools.CimToolsHandler.CimToolBase.Translation.OnLanguageChanged += Translation_OnLanguageChanged;
            }
        }
Exemple #2
0
        private static void BuildDropdownList(UIComponent component)
        {
            UIFastList eventSelection = component.parent.Find <UIFastList>("EventSelectionList");

            if (eventSelection == null)
            {
                eventSelection                            = UIFastList.Create <UIFastListLabel>(component.parent);
                eventSelection.name                       = "EventSelectionList";
                eventSelection.backgroundSprite           = "UnlockingPanel";
                eventSelection.size                       = new Vector2(120, 60);
                eventSelection.canSelect                  = true;
                eventSelection.relativePosition           = component.relativePosition + new Vector3(0, component.height);
                eventSelection.rowHeight                  = 20f;
                eventSelection.selectedIndex              = -1;
                eventSelection.eventClicked              += EventSelection_eventClicked;
                eventSelection.eventSelectedIndexChanged += EventSelection_eventSelectedIndexChanged;
                eventSelection.Hide();
            }
        }