예제 #1
0
 void ItemsDropdown()
 {
     itemsDropdown = panel.AddUIComponent <UIDropDown>();
     UIX.DropDown(itemsDropdown);
     itemsDropdown.selectedIndex              = 0;
     itemsDropdown.eventSelectedIndexChanged += itemsDropdown_eventSelectedIndexChanged;
     itemsDropdown.eventClick += itemsDropdown_eventClick;
 }
예제 #2
0
        public void ServiceDropdown()
        {
            serviceDropdown = panel.AddUIComponent <UIDropDown>();
            UIX.DropDown(serviceDropdown);
            var values = Enum.GetValues(typeof(ItemClass.Service));

            foreach (var itemClass in values)
            {
                var name = Enum.GetName(typeof(ItemClass.Service), itemClass);
                serviceDropdown.AddItem(name);
            }

            serviceDropdown.selectedIndex              = 0;
            serviceDropdown.eventSelectedIndexChanged += serviceDropdown_eventSelectedIndexChanged;
        }
예제 #3
0
        void ModesDropdown()
        {
            modesDropdown = panel.AddUIComponent <UIDropDown>();
            UIX.DropDown(modesDropdown);
            var values = Enum.GetValues(typeof(BuildingInfo.PlacementMode));


            foreach (var itemClass in values)
            {
                var name = Enum.GetName(typeof(BuildingInfo.PlacementMode), itemClass);
                modesDropdown.AddItem(name);
            }

            modesDropdown.selectedIndex              = 0;
            modesDropdown.eventSelectedIndexChanged += modesDropdown_eventSelectedIndexChanged;
        }
예제 #4
0
        public void LevelDropdown()
        {
            levelDropdown = panel.AddUIComponent <UIDropDown>();
            UIX.DropDown(levelDropdown);
            var values = Enum.GetValues(typeof(ItemClass.Level));

            levelDropdown.AddItem("All");

            foreach (var itemClass in values)
            {
                var name = Enum.GetName(typeof(ItemClass.Level), itemClass);
                levelDropdown.AddItem(name);
            }

            levelDropdown.selectedIndex              = 0;
            levelDropdown.eventSelectedIndexChanged += levelDropdown_eventSelectedIndexChanged;
        }
예제 #5
0
        void PropToolDropdown()
        {
            propToolDropdown = panel.AddUIComponent <UIDropDown>();
            UIX.DropDown(propToolDropdown);

            for (uint i = 0; i < PrefabCollection <PropInfo> .PrefabCount(); i++)
            {
                var prefab = PrefabCollection <PropInfo> .GetPrefab(i);

                if (prefab != null)
                {
                    propToolDropdown.AddItem(prefab.name);
                }
            }
            propToolDropdown.selectedIndex              = 0;
            propToolDropdown.eventSelectedIndexChanged += propToolDropdown_eventSelectedIndexChanged;
        }
예제 #6
0
        void NetToolDropdown()
        {
            netToolDropdown = panel.AddUIComponent <UIDropDown>();
            UIX.DropDown(netToolDropdown);

            for (uint i = 0; i < PrefabCollection <NetInfo> .PrefabCount(); i++)
            {
                var prefab = PrefabCollection <NetInfo> .GetPrefab(i);

                if (prefab != null)
                {
                    netToolDropdown.AddItem(prefab.name);
                }
            }
            netToolDropdown.selectedIndex              = 0;
            netToolDropdown.eventSelectedIndexChanged += netToolDropdown_eventSelectedIndexChanged;
            netToolDropdown.eventClick += netToolDropdown_eventClick;
        }
예제 #7
0
        public void CreateButtons()
        {
            buttons = new List <UIButton>();
            UIView uiView = UIView.GetAView();

            UIComponent tsBar = uiView.FindUIComponent("TSBar");

            if (mainButton == null)
            {
                var atlas = UIX.CreateTextureAtlas("AdvancedBuildingUI", new string[] { "AdvancedBuilding" }, "AdvancedBuilding.");

                panel = tsBar.AddUIComponent <UIPanel>();

                panel.backgroundSprite = "MenuPanel2";
                panel.name             = "BuildingPanel";
                panel.isVisible        = false;
                panel.width            = 300;
                panel.height           = 400;
                panel.absolutePosition = new Vector2(40, 80);

                panel.eventVisibilityChanged += panel_eventVisibilityChanged;

                UIX.Panel(panel, "Advanced building");


                var bulldozeButton = UIView.GetAView().FindUIComponent <UIMultiStateButton>("BulldozerButton");
                mainButton       = bulldozeButton.parent.AddUIComponent <UIButton>();
                mainButton.atlas = atlas;
                UIX.Button(mainButton, "AdvancedBuilding", new Vector2(43, 49));

                mainButton.relativePosition = new Vector2
                                              (
                    bulldozeButton.relativePosition.x + bulldozeButton.width / 2.0f - (mainButton.width + bulldozeButton.width) * 2,
                    bulldozeButton.relativePosition.y + bulldozeButton.height / 2.0f - mainButton.height / 2.0f
                                              );

                mainButton.eventClick += buttonClick;
                mainButton.name        = "AdvancedBuildButton";

                ServiceDropdown();
                LevelDropdown();
                ItemsDropdown();
                ModesDropdown();
                NetToolDropdown();
                PropToolDropdown();

                serviceDropdown.relativePosition  = new Vector3(110.0f, 50.0f);
                levelDropdown.relativePosition    = new Vector3(110.0f, 90.0f);
                itemsDropdown.relativePosition    = new Vector3(110.0f, 130.0f);
                modesDropdown.relativePosition    = new Vector3(110.0f, 170.0f);
                netToolDropdown.relativePosition  = new Vector3(110.0f, 230.0f);
                propToolDropdown.relativePosition = new Vector3(110.0f, 270.0f);

                var label1 = UIX.Label(panel, "Service", new Vector3(10, 50));
                label1.textAlignment     = UIHorizontalAlignment.Right;
                label1.verticalAlignment = UIVerticalAlignment.Middle;
                label1.size = new Vector2(90, 30);

                var label2 = UIX.Label(panel, "Level", new Vector3(10, 90));
                label2.textAlignment     = UIHorizontalAlignment.Right;
                label2.verticalAlignment = UIVerticalAlignment.Middle;
                label2.size = new Vector2(90, 30);

                var label3 = UIX.Label(panel, "Items", new Vector3(10, 130));
                label3.textAlignment     = UIHorizontalAlignment.Right;
                label3.verticalAlignment = UIVerticalAlignment.Middle;
                label3.size = new Vector2(90, 30);

                var label4 = UIX.Label(panel, "Build mode", new Vector3(10, 170));
                label4.textAlignment     = UIHorizontalAlignment.Right;
                label4.verticalAlignment = UIVerticalAlignment.Middle;
                label4.size = new Vector2(90, 30);

                var label5 = UIX.Label(panel, "Networks", new Vector3(10, 230));
                label5.textAlignment     = UIHorizontalAlignment.Right;
                label5.verticalAlignment = UIVerticalAlignment.Middle;
                label5.size = new Vector2(90, 30);

                var label6 = UIX.Label(panel, "Props", new Vector3(10, 270));
                label6.textAlignment     = UIHorizontalAlignment.Right;
                label6.verticalAlignment = UIVerticalAlignment.Middle;
                RefreshButtons();
            }
        }