public void CreateButtons() { if (nodes.Count > 0) { isHolder = true; ButtonArray buttonArray = new ButtonArray(title); collection.Add(buttonArray); foreach (var item in nodes) { item.SetUpNodeData(buttonArray.GetControlls(), clickCaller, buttons); } } else { MyButton butt = new MyButton(); butt.Text = title; collection.Add(butt); buttons.Add(value, butt); butt.Click += ClickEvent; } }
void Start() { g_fade_Script = GameObject.Find("Fade_Image").GetComponent <Fade_In_Out>(); g_button_array_Script = GameObject.Find("ButtonParent").GetComponent <ButtonArray>(); g_se_source_Script = GameObject.Find("SEList").GetComponent <Se_Source>(); g_button = GetComponent <Image>(); }
public void LoadContent() { ContentManager Content = Game.game.Content; controlRibbon = Content.Load <Texture2D>(@"GameGUI\ControlRibbon"); infoBox = Content.Load <Texture2D>(@"GameGUI\InfoBox"); buildingBox = Content.Load <Texture2D>(@"GameGUI\BuildingBox"); energyBox = Content.Load <Texture2D>(@"GameGUI\EnergyBox"); // Building Box Buttons buildboxButtons = new ImageButton[2, 3]; ImageButton.OnMouseDown[,] buildboxActions = { { OnButton0_0, OnButton0_1, OnButton0_2 }, { OnButton1_0, OnButton1_1, OnButton1_2 } }; String[,] infoString = { { "Build Level 1 DNA", "Build Level 2 DNA", "Build Level 3 DNA" }, { "Build Level 1 Factories", "Build Level 2 Factories", "Build Level 3 Factories" } }; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { Texture2D temp = Content.Load <Texture2D>(@"GameGUI\Buttons\BuildButton" + j + "_" + i); buildboxButtons[j, i] = new ImageButton(temp, 327 + 110 * i, 520 + 35 * j, 100, 30); buildboxButtons[j, i].MouseEvent = buildboxActions[j, i]; buildboxButtons[j, i].info = infoString[j, i]; if (i != 0) { buildboxButtons[j, i].Active = false; buildboxButtons[j, i].info += " *LOCKED*"; } } } // Building Box Button Submenus (Arrays) buildboxArrays = new ButtonArray[2, 3]; int[,] ArraySizes = { { 2, 1, 1 }, { 1, 1, 1 } }; ImageButton.OnMouseDown[, ,] buildboxArrayActions = { { { }, { }, { } }, { { }, { }, { } } }; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { Texture2D[] temp = new Texture2D[ArraySizes[j, i]]; for (int k = 0; k < temp.Length; ++k) { temp[k] = Content.Load <Texture2D>(@"GameGUI\Buttons\BuildArray" + j + "_" + i + "_" + k); } buildboxArrays[j, i] = new ButtonArray(temp, buildboxButtons[j, i].X + 50, buildboxButtons[j, i].Y); } } Texture2D menuButton = Content.Load <Texture2D>(@"GameGUI\MenuButton"); MenuButton = new ImageButton(menuButton, 199, 491, 32, 105); MenuButton.MouseEvent = OnMenuButton; MenuButton.info = "Return to the Main Menu"; font = Content.Load <SpriteFont>("guiFontSmall"); }