Exemple #1
0
        public TaxCollectorSimpleDialog(string title, int funds, List <ObjectPicker.TabInfo> listObjs, List <ObjectPicker.HeaderInfo> headers, bool viewTypeToggle, Vector2 position)
            : base("SimplePurchaseDialog", 1, true, ModalDialog.PauseMode.PauseSimulator, null)
        {
            if (this.mModalDialogWindow != null)
            {
                Text text = this.mModalDialogWindow.GetChildByID(99576787u, false) as Text;
                text.Caption = title;
                this.mFunds  = funds;
                text         = (this.mModalDialogWindow.GetChildByID(99576788u, false) as Text);
                text.Caption = Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Shopping/Cart:AvailableFunds", new object[]
                {
                    UIUtils.FormatMoney(funds)
                });
                this.mTable = (this.mModalDialogWindow.GetChildByID(99576784u, false) as ObjectPicker);
                this.mTable.ObjectTable.TableChanged     += new TableContainer.TableChangedEventHandler(this.OnTableChanged);
                this.mTable.ObjectTable.SelectionChanged += new UIEventHandler <UISelectionChangeEventArgs>(this.OnSelectionChanged);
                this.mOkayButton         = (this.mModalDialogWindow.GetChildByID(99576785u, false) as Button);
                this.mOkayButton.Enabled = false;
                this.mOkayButton.Click  += new UIEventHandler <UIButtonClickEventArgs>(this.OnOkayButtonClick);
                this.mOkayButton.Caption = CommonMethodsTaxCollector.LocalizeString("Select", new object[0]);

                base.OkayID              = this.mOkayButton.ID;
                base.SelectedID          = this.mOkayButton.ID;
                this.mCloseButton        = (this.mModalDialogWindow.GetChildByID(99576786u, false) as Button);
                this.mCloseButton.Click += new UIEventHandler <UIButtonClickEventArgs>(this.OnCloseButtonClick);
                base.CancelID            = this.mCloseButton.ID;
                this.mTableOffset        = this.mModalDialogWindow.Area.BottomRight - this.mModalDialogWindow.Area.TopLeft - (this.mTable.Area.BottomRight - this.mTable.Area.TopLeft);
                this.mTable.Populate(listObjs, headers, 1);
                this.mTable.ViewTypeToggle   = viewTypeToggle;
                this.mModalDialogWindow.Area = new Rect(this.mModalDialogWindow.Area.TopLeft, this.mModalDialogWindow.Area.TopLeft + this.mTable.TableArea.BottomRight + this.mTableOffset);
                float x = position.x;
                float y = position.y;
                if (x < 0f && y < 0f)
                {
                    this.mModalDialogWindow.CenterInParent();
                }
                else
                {
                    Rect  area = this.mModalDialogWindow.Area;
                    float num  = area.BottomRight.x - area.TopLeft.x;
                    float num2 = area.BottomRight.y - area.TopLeft.y;
                    area.Set(x, y, x + num, y + num2);
                    this.mModalDialogWindow.Area = area;
                }
                this.mModalDialogWindow.Visible = true;
            }
        }
Exemple #2
0
        public static GameObject ReturnTaxCollector(TaxCollector active, List <GameObject> objects)
        {
            ThumbnailKey thumbnail           = ThumbnailKey.kInvalidThumbnailKey;
            string       text                = string.Empty;
            List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>();

            foreach (GameObject t in objects)
            {
                List <ObjectPicker.ColumnInfo> list2 = new List <ObjectPicker.ColumnInfo>();

                int num = 0;
                thumbnail = t.GetThumbnailKey();

                if (t.GetType() == typeof(TaxCollector))
                {
                    text = (t as TaxCollector).info.Name;
                    num  = (t as TaxCollector).info.Funds;
                }

                if (t.GetType() == typeof(DonationBox))
                {
                    text = (t as DonationBox).info.Name;
                    num  = (t as DonationBox).info.Funds;
                }

                //common
                list2.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, text));
                list2.Add(new ObjectPicker.MoneyColumn(num));
                ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(t, list2);
                list.Add(item);
            }


            List <ObjectPicker.HeaderInfo> list3 = new List <ObjectPicker.HeaderInfo>();
            List <ObjectPicker.TabInfo>    list4 = new List <ObjectPicker.TabInfo>();

            list3.Add(new ObjectPicker.HeaderInfo(string.Empty, string.Empty, 200));
            list3.Add(new ObjectPicker.HeaderInfo(CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]), CommonMethodsTaxCollector.LocalizeString("Funds", new object[0])));
            list4.Add(new ObjectPicker.TabInfo("coupon", ShoppingRegister.LocalizeString("AvailableConcessionsFoods", new object[0]), list));
            List <ObjectPicker.RowInfo> list5 = TaxCollectorSimpleDialog.Show(CommonMethodsTaxCollector.LocalizeString("TransferToObject", new object[0]), 0, list4, list3, true);

            if (list5 == null || list5.Count != 1)
            {
                return(null);
            }
            return(list5[0].Item as GameObject);
        }