예제 #1
0
    static UIElement CreateDockPanel(UIElement parent)
    {
        var dock = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 800), "DockPanel", parent);

        dock.MainColor     = new Color32(56, 56, 56, 255);
        dock.compositeType = CompositeType.DockPanel;
        dock.Sprite        = EditorModelManager.FindSprite(icons, background);
        dock.SprType       = SpriteType.Sliced;


        var AreaLevel = new UIElement();//new GameObject("AreaLevel");

        AreaLevel.name = "AreaLevel";
        AreaLevel.SetParent(dock);

        var LineLevel = new UIElement();//new GameObject("LineLevel");

        LineLevel.name = "LineLevel";
        LineLevel.SetParent(dock);

        var Line = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 8), "Line", dock);

        Line.MainColor = Color.black;
        UICreator.CreateHImage(new Vector3(0, -60, 0), new Vector2(100, 100), "Area", dock);

        return(dock);
    }
예제 #2
0
    static public UIElement AddScrollX(UIElement parent)
    {
        UIElement p      = UICreator.CreateElement(Vector3.zero, new Vector2(400, 420), "Scroll", parent);
        var       scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollX", p);

        scroll.marginType    = MarginType.Margin;
        scroll.margin.down   = 20;
        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollX;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;

        CreateItem(scroll, "Item");

        var go = CreateSliderH();

        go.SetParent(p);
        go.localPosition   = new Vector3(200, 0, 0);
        go.anchorType      = AnchorType.Alignment;
        go.anchorPointType = AnchorPointType.Down;
        go.marginType      = MarginType.MarginX;
        //var help = scroll.gameObject.AddComponent<ScrollHelper>();
        //help.Slider = go.transform;
        return(p);
    }
예제 #3
0
        //creates an item for an advertisering type
        private UIElement createAdvertisementTypeItem(AdvertisementType.AirlineAdvertisementType type)
        {
            if (this.Airline.IsHuman)
            {
                ComboBox cbType = new ComboBox();
                cbType.ItemTemplate = this.Resources["AdvertisementItem"] as DataTemplate;
                cbType.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                cbType.Width = 200;

                cbAdvertisements.Add(type, cbType);

                foreach (AdvertisementType aType in AdvertisementTypes.GetTypes(type))
                {
                    cbType.Items.Add(aType);
                }

                cbType.SelectedItem = this.Airline.getAirlineAdvertisement(type);

                return(cbType);
            }
            // chs, 2011-17-10 changed so it is not possible to change the advertisement type for a CPU airline
            else
            {
                return(UICreator.CreateTextBlock(this.Airline.getAirlineAdvertisement(type).Name));
            }
        }
예제 #4
0
    private void Start()
    {
        // EventSystemが存在しない場合一緒に生成します
        Canvas canvas = UICreator.CreateCanvas();


        // キャンバスの子としてテキストを生成する
        Text text = UICreator.CreateText(canvas.gameObject);

        text.rectTransform.localPosition = Vector3.left * 140f;
        text.text      = "Hello World!!";
        text.alignment = TextAnchor.MiddleCenter;
        text.color     = Color.green;

        // オブジェクト名やコンポーネントの初期値を設定する
        Dropdown dropdown = UICreator.CreateDropdown(canvas.gameObject, "Gender", "性別");

        dropdown.GetComponent <RectTransform>().localPosition = Vector3.right * 140f;
        dropdown.options.Clear();
        dropdown.options.Add(new Dropdown.OptionData {
            text = "男性"
        });
        dropdown.options.Add(new Dropdown.OptionData {
            text = "女性"
        });
    }
예제 #5
0
        //creates the tool tip for an entry
        private Border createToolTip(KeyValuePair <TimeSpan, KeyValuePair <int, int> > value)
        {
            double maxFlightsPerSlot = 10 * this.Airport.Runways.Count;

            double slotValue = Convert.ToDouble(value.Value.Value + value.Value.Key) / maxFlightsPerSlot;

            Border brdToolTip = new Border();

            brdToolTip.Margin  = new Thickness(-4, 0, -4, -3);
            brdToolTip.Padding = new Thickness(5);
            brdToolTip.SetResourceReference(Border.BackgroundProperty, "HeaderBackgroundBrush2");

            StackPanel panelToolTip = new StackPanel();

            TextBlock txtTime = UICreator.CreateTextBlock(new TimeSpanConverter().Convert(value.Key).ToString());

            txtTime.FontWeight      = FontWeights.Bold;
            txtTime.TextDecorations = TextDecorations.Underline;

            panelToolTip.Children.Add(txtTime);
            panelToolTip.Children.Add(UICreator.CreateTextBlock(string.Format("Departures: {0}", value.Value.Key)));
            panelToolTip.Children.Add(UICreator.CreateTextBlock(string.Format("Arrivals: {0}", value.Value.Value)));
            panelToolTip.Children.Add(UICreator.CreateTextBlock(string.Format("Percent of capacity: {0:P}", slotValue)));

            brdToolTip.Child = panelToolTip;

            return(brdToolTip);
        }
예제 #6
0
        public void AddRuleListItem(string name = null)
        {
            if (name == null)
            {
                name = "item" + ruleListItems.Count.ToString();
            }
            /////////////////////////////
            //resize the parent container
            /////////////////////////////
            Vector2 offset  = new Vector2(0, 20);
            Vector3 offset3 = new Vector3(0, 20, 0);

            //Debug.LogWarningFormat("rectPanelContent={0}", rectPanelContent);
            //Debug.LogWarningFormat("rectPanelContent.sizeDelta={0}", rectPanelContent.sizeDelta);
            rectPanelContent.sizeDelta += offset;

            int        i    = ruleListItems.Count;
            GameObject item = Instantiate(UICreator.GetDefaultButtonAsset(), rectPanelContent);

            item.GetComponent <Button>().onClick.AddListener(delegate { SelectRuleListItem(i); });
            float         pos   = ruleListItems.Count * 20 + 5;
            RectTransform trans = item.transform as RectTransform;

            trans.anchoredPosition = new Vector2(0, -pos);
            Vector2 size = new Vector2(200, 20);

            trans.sizeDelta = size;
            trans.Find("Text").GetComponent <Text>().text = name;
            ruleListItems.Add(item);
        }
예제 #7
0
    public PageInformation()
    {
        this.Background = Brushes.Transparent;

        WrapPanel panelContent = new WrapPanel();

        panelContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
        panelContent.VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
        panelContent.Margin = new Thickness(0, 0, 5, 0);


        Image imgLogo = new Image();

        imgLogo.Source = new BitmapImage(new Uri(@"/Data/images/gas-white.png", UriKind.RelativeOrAbsolute));
        imgLogo.Height = 16;
        RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality);

        panelContent.Children.Add(imgLogo);

        txtGasPrice = UICreator.CreateTextBlock(string.Format("{0}/{1}.", new ValueCurrencyConverter().Convert(new FuelUnitConverter().Convert(GameObject.GetInstance().FuelPrice)), new StringToLanguageConverter().Convert("ltr")));
        txtGasPrice.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
        txtGasPrice.FontWeight        = FontWeights.Bold;
        txtGasPrice.Margin            = new Thickness(5, 0, 0, 0);

        panelContent.Children.Add(txtGasPrice);

        this.Content = panelContent;
    }
예제 #8
0
        //creates the slider for a wage type
        private WrapPanel createWageSlider(FeeType type)
        {
            WrapPanel sliderPanel = new WrapPanel();

            TextBlock txtValue = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.FeeValues[type]).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", this.FeeValues[type]));

            txtValue.VerticalAlignment = VerticalAlignment.Bottom;
            txtValue.Margin            = new Thickness(5, 0, 0, 0);
            txtValue.Tag = type;

            Slider slider = new Slider();

            slider.Width                = 200;
            slider.Value                = this.FeeValues[type];
            slider.Tag                  = txtValue;
            slider.Maximum              = type.MaxValue;
            slider.Minimum              = type.MinValue;
            slider.ValueChanged        += new RoutedPropertyChangedEventHandler <double>(slider_ValueChanged);
            slider.TickFrequency        = (type.MaxValue - type.MinValue) / slider.Width;
            slider.IsSnapToTickEnabled  = true;
            slider.IsMoveToPointEnabled = true;
            sliderPanel.Children.Add(slider);

            sliderPanel.Children.Add(txtValue);

            return(sliderPanel);
        }
        public PageAirlinerAdvancedRoute(FleetAirliner airliner, PopUpAirlinerAutoRoutes parent, OnRouteChanged routeChanged)
        {
            this.ParentPage    = parent;
            this.Airliner      = airliner;
            this.RouteChanged += routeChanged;

            InitializeComponent();

            StackPanel panelMain = new StackPanel();

            panelMain.Children.Add(createNewEntryPanel());

            WrapPanel panelFlightTime = new WrapPanel();

            txtStopovers            = UICreator.CreateTextBlock("");
            txtStopovers.Visibility = System.Windows.Visibility.Collapsed;
            txtStopovers.Margin     = new Thickness(0, 0, 10, 0);
            panelFlightTime.Children.Add(txtStopovers);

            txtFlightTime = UICreator.CreateTextBlock("Flight time:");
            panelFlightTime.Children.Add(txtFlightTime);

            panelMain.Children.Add(panelFlightTime);

            this.Content = panelMain;

            cbOrigin.SelectedIndex = 0;
        }
        private void btnHub_Click(object sender, RoutedEventArgs e)
        {
            StackPanel panelHubs = new StackPanel();

            foreach (HubType type in HubTypes.GetHubTypes())
            {
                if (AirlineHelpers.CanCreateHub(GameObject.GetInstance().HumanAirline, this.Airport, type))
                {
                    panelHubs.Children.Add(createHubType(type, panelHubs));
                }
            }

            if (panelHubs.Children.Count == 0)
            {
                panelHubs.Children.Add(UICreator.CreateTextBlock("You can't etablish any hubs at this airport"));
            }

            if (PopUpSingleElement.ShowPopUp("Select hub type", panelHubs) == PopUpSingleElement.ButtonSelected.OK && panelHubs.Tag != null)
            {
                HubType type = (HubType)panelHubs.Tag;

                if (AirportHelpers.GetHubPrice(this.Airport, type) > GameObject.GetInstance().HumanAirline.Money)
                {
                    WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2212"), Translator.GetInstance().GetString("MessageBox", "2212", "message"), WPFMessageBoxButtons.Ok);
                }
                else
                {
                    this.Airport.addHub(new Hub(GameObject.GetInstance().HumanAirline, type));

                    showHubs();

                    AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -AirportHelpers.GetHubPrice(this.Airport, type));
                }
            }
        }
예제 #11
0
    static UIElement CreateDockPanel(Transform parent)
    {
        var dock = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 800), "DockPanel", parent);

        dock.MainColor     = new Color32(56, 56, 56, 255);
        dock.compositeType = CompositeType.DockPanel;
        dock.Sprite        = EditorModelManager.FindSprite(icons, background);
        dock.SprType       = SpriteType.Sliced;


        var AreaLevel = new GameObject("AreaLevel");
        var trans     = AreaLevel.transform;

        trans.SetParent(dock.transform);
        trans.localPosition = Vector3.zero;
        trans.localScale    = Vector3.one;
        trans.localRotation = Quaternion.identity;

        var LineLevel = new GameObject("LineLevel");

        trans = LineLevel.transform;
        trans.SetParent(dock.transform);
        trans.localPosition = Vector3.zero;
        trans.localScale    = Vector3.one;
        trans.localRotation = Quaternion.identity;

        var Line = UICreator.CreateHImage(Vector3.zero, new Vector2(800, 8), "Line", dock.transform);

        Line.MainColor = Color.black;
        UICreator.CreateHImage(new Vector3(0, -60, 0), new Vector2(100, 100), "Area", dock.transform);

        return(dock);
    }
예제 #12
0
 public void CreateControls()
 {
     if (interfaceCanvasObject != null)
     {
         if (loadVirtualKeypad)
         {
             /*if( (buttonPrefabAction != null) && (buttonObjectAction == null) )
              * {
              *      if( UICreator.CreateButton( buttonPrefabAction, ref buttonObjectAction, ref buttonComponentAction, interfaceCanvasObject ) )
              *      {
              *              actionPressAction = new UnityAction<BaseEventData>( OnPressAction );
              *              AddListenerToObject( buttonObjectAction, ref buttonTriggerAction, EventTriggerType.PointerDown, actionPressAction );
              *              actionReleaseAction = new UnityAction<BaseEventData>( OnReleaseAction );
              *              AddListenerToObject( buttonObjectAction, ref buttonTriggerAction, EventTriggerType.PointerUp, actionReleaseAction );
              *              AddListenerToObject( buttonObjectAction, ref buttonTriggerAction, EventTriggerType.PointerExit, actionReleaseAction );
              *              buttonImageAction = buttonObjectAction.GetComponent<Image>();
              *      }
              * }*/
             if ((buttonPrefabPause != null) && (buttonObjectPause == null))
             {
                 if (UICreator.CreateButton(buttonPrefabPause, ref buttonObjectPause, ref buttonComponentPause, interfaceCanvasObject))
                 {
                     actionPressPause = new UnityAction <BaseEventData>(OnPressPause);
                     AddListenerToObject(buttonObjectPause, ref buttonTriggerPause, EventTriggerType.PointerDown, actionPressPause);
                     AddListenerToObject(buttonObjectPause, ref buttonTriggerPause, EventTriggerType.PointerEnter, actionPressPause);
                     buttonImagePause = buttonObjectPause.GetComponent <Image>();
                 }
             }
         }
         /*halmeida - if there are no blocking conditions, enable the keypad.*/
         ToggleControls(true, true);
     }
 }
예제 #13
0
        //creates the panel for airline value
        private WrapPanel createAirlineValuePanel()
        {
            WrapPanel panelValue = new WrapPanel();

            panelValue.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            for (int i = 0; i <= (int)this.Airline.getAirlineValue(); i++)
            {
                Image imgValue = new Image();
                imgValue.Source = new BitmapImage(new Uri(@"/Data/images/coins.png", UriKind.RelativeOrAbsolute));
                imgValue.Height = 20;
                RenderOptions.SetBitmapScalingMode(imgValue, BitmapScalingMode.HighQuality);

                panelValue.Children.Add(imgValue);
            }
            for (int i = (int)this.Airline.getAirlineValue(); i < (int)Airline.AirlineValue.Very_high; i++)
            {
                Image imgValue = new Image();
                imgValue.Source = new BitmapImage(new Uri(@"/Data/images/coins_gray.png", UriKind.RelativeOrAbsolute));
                imgValue.Height = 20;
                RenderOptions.SetBitmapScalingMode(imgValue, BitmapScalingMode.HighQuality);

                panelValue.Children.Add(imgValue);
            }
            // chs, 2011-13-10 added value in $ of an airline to the value text
            //   TextBlock txtValue = UICreator.CreateTextBlock(string.Format(" ({0})", string.Format("{0:c}", this.Airline.getValue())));
            TextBlock txtValue = UICreator.CreateTextBlock(string.Format(" ({0})", new ValueCurrencyConverter().Convert(this.Airline.getValue() * 1000000).ToString()));

            txtValue.FontStyle = FontStyles.Italic;
            panelValue.Children.Add(txtValue);

            return(panelValue);
        }
예제 #14
0
    static public UIElement AddScrollY(UIElement parent)
    {
        UIElement p      = UICreator.CreateElement(new Vector3(-10, 200, 0), new Vector2(420, 400), "Scroll", parent);
        var       scroll = UICreator.CreateHImage(Vector3.zero, new Vector2(400, 400), "ScrollY", p);

        scroll.marginType    = MarginType.Margin;
        scroll.margin.right  = 20;
        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollY;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var item = CreateItem(scroll, "Item");

        item.Pivot = new Vector2(0.5f, 1);
        item.Find("Image").localPosition = new Vector3(0, -50, 0);
        item.Find("Text").localPosition  = new Vector3(0, -50, 0);

        var go = CreateSliderV();

        go.SetParent(p);
        go.localPosition = new Vector3(200, 0, 0);

        go.anchorType      = AnchorType.Alignment;
        go.anchorPointType = AnchorPointType.Right;
        go.marginType      = MarginType.MarginY;
        //var help = scroll.gameObject.AddComponent<ScrollHelper>();
        //help.Slider = go.transform;
        return(p);
    }
예제 #15
0
        //creates the slider for the money
        private WrapPanel createMoneySlider()
        {
            double    minValue    = 100000;
            double    maxValue    = GameObject.GetInstance().MainAirline.Money / 2;
            WrapPanel sliderPanel = new WrapPanel();

            TextBlock txtValue = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(minValue).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", minValue));

            txtValue.VerticalAlignment = VerticalAlignment.Bottom;
            txtValue.Margin            = new Thickness(5, 0, 0, 0);

            slMoney                      = new Slider();
            slMoney.Width                = 200;
            slMoney.Value                = minValue;
            slMoney.Tag                  = txtValue;
            slMoney.Maximum              = maxValue;
            slMoney.Minimum              = minValue;
            slMoney.ValueChanged        += new RoutedPropertyChangedEventHandler <double>(slider_ValueChanged);
            slMoney.TickFrequency        = (maxValue - minValue) / slMoney.Width;
            slMoney.IsSnapToTickEnabled  = true;
            slMoney.IsMoveToPointEnabled = true;
            sliderPanel.Children.Add(slMoney);

            sliderPanel.Children.Add(txtValue);

            return(sliderPanel);
        }
예제 #16
0
        public PopUpAirlinerRoutes(FleetAirliner airliner, Boolean isEditable)
        {
            this.Entries         = new Dictionary <Route, List <RouteTimeTableEntry> >();
            this.EntriesToDelete = new Dictionary <Route, List <RouteTimeTableEntry> >();

            this.Airliner   = airliner;
            this.IsEditable = isEditable;

            InitializeComponent();

            this.Title = this.Airliner.Name;

            this.Width = 1200;

            this.Height = this.IsEditable ? 325 : 275;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            ScrollViewer scroller = new ScrollViewer();

            //scroller.Margin = new Thickness(10, 10, 10, 10);
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.MaxHeight = this.Height;

            StackPanel mainPanel = new StackPanel();

            mainPanel.Margin = new Thickness(10, 10, 10, 10);
            scroller.Content = mainPanel;


            Grid grdFlights = UICreator.CreateGrid(2);

            grdFlights.ColumnDefinitions[1].Width = new GridLength(200);
            mainPanel.Children.Add(grdFlights);

            lbFlights = new ListBox();
            lbFlights.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbFlights.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbFlights.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            Grid.SetColumn(lbFlights, 0);
            grdFlights.Children.Add(lbFlights);

            ScrollViewer panelRoutes = createRoutesPanel();

            Grid.SetColumn(panelRoutes, 1);
            grdFlights.Children.Add(panelRoutes);

            if (this.IsEditable)
            {
                mainPanel.Children.Add(createNewEntryPanel());
                mainPanel.Children.Add(createButtonsPanel());
            }

            this.Content = scroller;

            showFlights();
        }
예제 #17
0
        // chs 11-04-11: changed for making it possible to extending an existing terminal
        //for extending an existing terminal
        public PopUpTerminal(Terminal terminal)
        {
            this.Terminal = terminal;

            InitializeComponent();

            this.Title = "Extend terminal";

            this.Width = 400;

            this.Height = 175;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            StackPanel mainPanel = new StackPanel();

            mainPanel.Margin = new Thickness(10, 10, 10, 10);

            ListBox lbTerminal = new ListBox();

            lbTerminal.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbTerminal.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            mainPanel.Children.Add(lbTerminal);

            txtName             = new TextBox();
            txtName.Background  = Brushes.Transparent;
            txtName.BorderBrush = Brushes.Black;
            txtName.IsEnabled   = this.Terminal == null;
            txtName.Width       = 100;
            txtName.Text        = this.Terminal == null ? "Terminal" : this.Terminal.Name;
            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1007"), txtName));


            lbTerminal.Items.Add(new QuickInfoValue("Current gates", UICreator.CreateTextBlock(string.Format("{0} gates", this.Terminal.Gates.getGates().Count))));

            // chs 11-09-11: added numericupdown for selecting number of gates
            nudGates               = new ucNumericUpDown();
            nudGates.Height        = 30;
            nudGates.MaxValue      = 50;
            nudGates.MinValue      = 1;
            nudGates.ValueChanged += new RoutedPropertyChangedEventHandler <decimal>(nudGates_ValueChanged);

            lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1001"), nudGates));

            txtDaysToCreate = UICreator.CreateTextBlock("0 days");
            lbTerminal.Items.Add(new QuickInfoValue("Days to extend terminal", txtDaysToCreate));

            txtTotalPrice = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(0).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", 0));
            lbTerminal.Items.Add(new QuickInfoValue("Price for extending", txtTotalPrice));


            mainPanel.Children.Add(createButtonsPanel());

            nudGates.Value = 1;


            this.Content = mainPanel;
        }
예제 #18
0
        void Start()
        {
            uiCreator = GetComponent <UICreator>();
            CreateBasicMenu();
            uiCreator.Spawn();

            ToggleUI();
        }
예제 #19
0
    static public UIElement AddDataGrid(UIElement parent)
    {
        var dg = UICreator.CreateElement(Vector3.zero, new Vector2(1280, 720), "DataGrid", parent);

        dg.Pivot         = new Vector2(0f, 1);
        dg.compositeType = CompositeType.DataGrid;
        var grid = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), "Grid", dg);

        grid.Pivot      = new Vector2(0f, 1f);
        grid.marginType = MarginType.Margin;
        grid.Mask       = true;
        grid.margin.top = 60;

        var items = UICreator.CreateElement(Vector3.zero, new Vector2(100, 100), "Items", grid);

        items.Pivot = new Vector2(0f, 1);

        var line = UICreator.CreateHLine(Vector3.zero, new Vector2(200, 60), "Line", grid);

        line.MainColor  = new Color32(85, 85, 85, 255);
        line.marginType = MarginType.Margin;

        var heads = new UIElement();//new GameObject("Heads");

        heads.name = "Heads";
        heads.SetParent(dg);
        var drags = new UIElement();//new GameObject("Drags");

        drags.name = "Drags";
        drags.SetParent(dg);

        var head = UICreator.CreateElement(Vector3.zero, new Vector2(200, 60), "Head", dg);

        head.Pivot = new Vector2(0f, 1);
        var img = UICreator.CreateHImage(Vector3.zero, new Vector2(200, 60), "Image", head);

        img.marginType = MarginType.Margin;
        var txt = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", head);

        txt.marginType = MarginType.Margin;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 32;
        txt.Text       = "字段名";
        txt.MainColor  = Color.black;
        var item = UICreator.CreateElement(Vector3.zero, new Vector2(200, 60), "Item", dg);

        item.Pivot     = new Vector2(0f, 1);
        txt            = UICreator.CreateHText(Vector3.zero, new Vector2(200, 60), "Text", item);
        txt.marginType = MarginType.Margin;
        txt.TextAnchor = TextAnchor.MiddleLeft;
        txt.FontSize   = 28;
        txt.Text       = "数据";

        var drag = UICreator.CreateElement(Vector3.zero, new Vector2(40, 60), "Drag", dg);

        drag.eventType = HEventType.UserEvent;
        return(dg);
    }
        public PageAirlineFleet(Airline airline)
        {
            InitializeComponent();

            this.Airline = airline;

            foreach (FleetAirliner fa in this.Airline.DeliveredFleet)
            {
                _FleetDelivered.Add(fa);
            }

            StackPanel panelFleet = new StackPanel();

            WrapPanel panelMenuButtons = new WrapPanel();

            panelFleet.Children.Add(panelMenuButtons);

            ucSelectButton sbOverview = new ucSelectButton();

            sbOverview.Uid        = "1001";
            sbOverview.Content    = Translator.GetInstance().GetString("PageAirlineFleet", sbOverview.Uid);
            sbOverview.Click     += new RoutedEventHandler(sbOverview_Click);
            sbOverview.IsSelected = true;
            panelMenuButtons.Children.Add(sbOverview);

            ucSelectButton sbDetailed = new ucSelectButton();

            sbDetailed.Uid     = "1002";
            sbDetailed.Content = Translator.GetInstance().GetString("PageAirlineFleet", sbDetailed.Uid);
            sbDetailed.Click  += new RoutedEventHandler(sbDetailed_Click);
            panelMenuButtons.Children.Add(sbDetailed);

            ucSelectButton sbOrdered = new ucSelectButton();

            sbOrdered.Uid     = "1009";
            sbOrdered.Content = Translator.GetInstance().GetString("PageAirlineFleet", sbOrdered.Uid);
            sbOrdered.Click  += new RoutedEventHandler(sbOrdered_Click);
            panelMenuButtons.Children.Add(sbOrdered);


            panelOverview = createOverviewPanel();

            panelDetailed            = createDetailedPanel();
            panelDetailed.Visibility = System.Windows.Visibility.Collapsed;
            panelDetailed.ToolTip    = UICreator.CreateToolTip("View detailed information for this aircraft");

            panelOrdered            = createOrderedPanel();
            panelOrdered.Visibility = System.Windows.Visibility.Collapsed;
            panelOrdered.ToolTip    = UICreator.CreateToolTip("View ordered airliners");

            panelFleet.Children.Add(panelOverview);
            panelFleet.Children.Add(panelDetailed);
            panelFleet.Children.Add(panelOrdered);



            this.Content = panelFleet;
        }
    public void SetActive_Letter()
    {
        for (int i = 1; i <= BasicInformation.Day; i++)//Letter_DB.GetAddressableLetter()
        {
            creator = new UICreator(Parent, atlas, f, i);
        }

        this.transform.parent.gameObject.SetActive(false);
        this.transform.parent.parent.Find("LetterInterface").gameObject.SetActive(true);
    }
예제 #22
0
        /// <summary>
        /// Initalizes the map with the loaded file
        /// </summary>
        /// <param name="map"></param>
        public static void Start(Map map, TPLayer[] layers)
        {
            MapCreator mc = new MapCreator(map);

            mc.load("CurrentMapData.txt");
            Enemy.findend();
            TDLayers = layers;
            UICreator.CreateUI();
            LastWaveUpdate = TimeSpan.Zero;
        }
예제 #23
0
        private void LoadImages()
        {
            if (string.IsNullOrEmpty(configData.UIConfig))
            {
                PrintError("You must set the \"UI Configuration Name\" in your config. Unable to continue!");
                Interface.Oxide.UnloadPlugin(Title);
                return;
            }
            if (!configData.PanelTypes.ContainsKey(configData.UIConfig))
            {
                PrintError("Invalid \"UI Configuration Name\" set in your config. Unable to continue!");
                Interface.Oxide.UnloadPlugin(Title);
                return;
            }

            Dictionary <string, string> newLoadOrder = new Dictionary <string, string>();
            UICreator uiConfig = configData.PanelTypes[configData.UIConfig];

            foreach (var element in uiConfig.ImageElements)
            {
                if (!string.IsNullOrEmpty(element.URL) && !newLoadOrder.ContainsKey(element.URL))
                {
                    newLoadOrder.Add(element.URL, element.URL);
                }
            }
            foreach (var element in uiConfig.TimeProgress)
            {
                if (!string.IsNullOrEmpty(element.URL) && !newLoadOrder.ContainsKey(element.URL))
                {
                    newLoadOrder.Add(element.URL, element.URL);
                }
            }
            foreach (var element in uiConfig.VoteProgress)
            {
                if (!string.IsNullOrEmpty(element.URL) && !newLoadOrder.ContainsKey(element.URL))
                {
                    newLoadOrder.Add(element.URL, element.URL);
                }
            }

            if (newLoadOrder.Count > 0)
            {
                if (!ImageLibrary)
                {
                    PrintError("Image Library is not installed. It is required to load the images. Unable to continue!");
                    Interface.Oxide.UnloadPlugin(Title);
                    return;
                }

                ImageLibrary.Call("ImportImageList", Title, newLoadOrder);
            }

            BeginUICreation();
        }
예제 #24
0
        //creates the panel for arrivals
        private ScrollViewer createArrivalsPanel()
        {
            ScrollViewer svArrivals = new ScrollViewer();

            svArrivals.Margin = new Thickness(0, 10, 0, 0);
            svArrivals.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            svArrivals.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            svArrivals.MaxHeight = GraphicsHelpers.GetContentHeight() / 3;

            StackPanel panelArrivals = new StackPanel();

            panelArrivals.Margin = new Thickness(0, 10, 0, 0);

            Grid grdType = UICreator.CreateGrid(2);

            grdType.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelArrivals.Children.Add(grdType);

            Image imgLogo = new Image();

            imgLogo.Source = new BitmapImage(new Uri(@"/Data/images/Arrivals.png", UriKind.RelativeOrAbsolute));
            imgLogo.Height = 20;
            RenderOptions.SetBitmapScalingMode(imgLogo, BitmapScalingMode.HighQuality);

            Grid.SetColumn(imgLogo, 0);
            grdType.Children.Add(imgLogo);

            TextBlock txtType = UICreator.CreateTextBlock(Translator.GetInstance().GetString("PageAirport", "1002"));

            txtType.FontStyle = FontStyles.Oblique;
            txtType.FontSize  = 16;

            Grid.SetColumn(txtType, 1);
            grdType.Children.Add(txtType);

            ContentControl txtHeader = new ContentControl();

            txtHeader.Uid                 = "1003";
            txtHeader.ContentTemplate     = this.Resources["FlightHeader"] as DataTemplate;
            txtHeader.Content             = Translator.GetInstance().GetString("PageAirport", txtHeader.Uid);
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            panelArrivals.Children.Add(txtHeader);

            lbArrivals = new ListBox();
            lbArrivals.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbArrivals.ItemTemplate = this.Resources["FlightItem"] as DataTemplate;

            panelArrivals.Children.Add(lbArrivals);

            svArrivals.Content = panelArrivals;

            return(svArrivals);
        }
예제 #25
0
        private void Awake()
        {
            backgroundView = UICreator
                             .GetInstance()
                             .Create <MenuBackgroundImage>(UICanvasLayer.Background);

            if (backgroundView != null)
            {
                backgroundView.PointerClicked += OnPointerClicked;
            }
        }
예제 #26
0
        private void CreateAndSubscribeToMinimapWindow()
        {
            minimapView = UICreator
                          .GetInstance()
                          .Create <MinimapWindow>();

            if (minimapView != null)
            {
                minimapView.MarkSelectionChanged += OnMarkSelectionChanged;
            }
        }
예제 #27
0
        private void CreateAndSubscribeToNoticeWindow()
        {
            noticeView = UICreator
                         .GetInstance()
                         .Create <NoticeWindow>(UICanvasLayer.Foreground, UIIndex.End);

            if (noticeView != null)
            {
                noticeView.OkButtonClicked += Hide;
            }
        }
예제 #28
0
        private void Awake()
        {
            var sampleMessage = UICreator
                                .GetInstance()
                                .Create <SampleMessage>(UICanvasLayer.Background);

            if (sampleMessage != null)
            {
                sampleMessage.Show();
            }
        }
예제 #29
0
        private void CreateAndSubscribeToSampleWindow()
        {
            sampleWindow = UICreator
                           .GetInstance()
                           .Create <SampleWindow>();

            if (sampleWindow != null)
            {
                sampleWindow.PointerClicked += OnPointerClicked;
            }
        }
예제 #30
0
    static public void AddScrollYExtand(MenuCommand menuCommand)
    {
        GameObject parent = menuCommand.context as GameObject;
        Transform  pt     = null;

        if (parent != null)
        {
            pt = parent.transform;
        }
        var sl     = UICreator.CreateHImage(new Vector3(0, 400, 0), new Vector2(400, 800), "ScrollEx", pt);
        var scroll = sl.Content;

        scroll.Mask          = true;
        scroll.MainColor     = new Color32(224, 224, 224, 255);
        scroll.eventType     = HEventType.UserEvent;
        scroll.compositeType = CompositeType.ScrollYExtand;
        scroll.Sprite        = EditorModelManager.FindSprite(icons, background);
        scroll.SprType       = SpriteType.Sliced;
        scroll.Pivot         = new Vector2(0.5f, 1);

        var bds = UICreator.CreateElement(Vector3.zero, new Vector2(400, 100), "Bodys", sl.transform).Content;

        bds.anchorType      = AnchorType.Alignment;
        bds.anchorPointType = AnchorPointType.Top;
        bds.marginType      = MarginType.MarginX;
        bds.Pivot           = new Vector2(0.5f, 1);

        bds                 = UICreator.CreateElement(Vector3.zero, new Vector2(400, 100), "Titles", sl.transform).Content;
        bds.anchorType      = AnchorType.Alignment;
        bds.anchorPointType = AnchorPointType.Top;
        bds.marginType      = MarginType.MarginX;
        bds.Pivot           = new Vector2(0.5f, 1);

        CreateItemE(sl.transform, "Title");
        var item = CreateItemE(sl.transform, "Item");

        item.transform.localPosition = new Vector3(0, -100, 0);
        var tail = CreateItemE(sl.transform, "Tail");

        tail.transform.localPosition = new Vector3(0, -200, 0);

        var body = new GameObject("Body");
        var son  = body.transform;

        son.SetParent(sl.transform);
        son.localPosition = new Vector3(0, -300, 0);
        son.localScale    = Vector3.one;
        son.localRotation = Quaternion.identity;
        var ui = body.AddComponent <UIElement>().Content;

        ui.SizeDelta = new Vector2(400, 100);
        ui.Pivot     = new Vector2(0.5f, 1);
        ui.Mask      = true;
    }
예제 #31
0
    // Use this for initialization
    void Start()
    {
            
        try
        {
            GameObject uiGO = GameObject.Find("UI");

            if(uiGO!=null)
            {
                UICreator uic = uiGO.GetComponent<UICreator>();
                if(uic!=null)
                {
                    creator = uic;
                }
            }
        }
        catch(System.Exception e)
        {
        }


        if (StereoController3D == null)
        {
            GameObject cardboard3dGo = GameObject.Find("CardboardMain 3D");
            if (cardboard3dGo != null)
            {
                Transform mcTransform = cardboard3dGo.transform.FindChild("Head/Main Camera");
                if (mcTransform != null)
                {
                    StereoController sc = mcTransform.GetComponent<StereoController>();
                    if (sc != null)
                    {
                        StereoController3D = sc;
                    }
                }
            }
        }
        if (StereoController3D == null)
        {
            Debug.LogError("找不到StereoController3D");
        }

        if (LookCamera == null)
        {
            GameObject cardboard3dGo = GameObject.Find("CardboardMain 3D");
            if (cardboard3dGo != null)
            {
                Transform mcTransform = cardboard3dGo.transform.FindChild("Head/Main Camera");
                if (mcTransform != null)
                {
                    LookCamera = mcTransform.GetComponent<Camera>();
                }
            }
        }
        if (LookCamera == null)
        {
            Debug.LogError("找不到Camera3D");
        }

        //SetGazedAt(false);

 //       Color notForceColor = CanControl ? CanControlColor : DontControlColor;
 //       GetComponent<Renderer>().material.color = notForceColor;

        DebugSystem.AddLogSystem(SystemName);
    }