//this will show the add ally menu where the user adds/edits allies. void Add_Ally() { //Close Button. if (GUI.Button(new Rect(20, 20, 120, 20), "Close")) { b_Ally_Menu = true; b_Add_Ally = false; Temp_Tower = null; i_Tower_Location_Number = -1; f_scroll = 0; } //Save Button. if (GUI.Button(new Rect(20, 50, 120, 20), "Save")) { //save the temp tower. if (i_Tower_Location_Number != -1) { //set the tower in that place. Stats.Tower_List[i_Tower_Location_Number] = Temp_Tower; } else { //we add the new tower if has a name. no name means no tower has been selected. if (Temp_Tower.Tower_Name != "") { Stats.Tower_List.Add(Temp_Tower); } } b_Ally_Menu = true; b_Add_Ally = false; Temp_Tower = null; i_Tower_Location_Number = -1; f_scroll = 0; } //no tower, so we make one. if (Temp_Tower == null) { //Debug.Log("Made new temp enemy"); Temp_Tower = new Assets.Scripts.Level_Scripts.LE.Tower_Template("Temp", 1, 1, 1, 1, 1, new Sprite()); Temp_Tower.Tower_Sprite = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 0, 0), new Vector2(1, 1)); } //no temp sprite so make a placeholder one. if (Second_Sprite == null) { Second_Sprite = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 0, 0), new Vector2(1, 1)); } //the y offset. float y_offset = 20 + f_scroll; //NAME //name label //[sprite] [<-Fuze] [sprite] we use the tower sprite, and then the temp sprite. //Name GUI.Box(new Rect(Screen.width / 2 / 2, y_offset, Screen.width / 2, i_Size_Height_Amount / 2), "Name"); y_offset += i_Size_Height_Amount / 2; //Name GUI.Box(new Rect(Screen.width / 2 - (i_Level_Size / 2), y_offset, i_Level_Size, i_Size_Height_Amount / 2), Temp_Tower.Tower_Name); y_offset += i_Size_Height_Amount / 2; //First Sprite Box if (GUI.Button(new Rect(Screen.width / 2 - ((i_Sprite_Edit_Size) / 2) - (i_Sprite_Edit_Size * 1.5f), y_offset, i_Sprite_Edit_Size, i_Size_Height_Amount), Temp_Tower.Tower_Sprite.texture)) { //open the sprite menu for the first sprite. b_Ally_Pick_Screen = true; b_First_Sprite = true; b_Add_Ally = false; Ally_Sprite_Table.transform.position = new Vector3(0, 0); } //button for fuze if (GUI.Button(new Rect(Screen.width / 2 - ((i_Sprite_Edit_Size) / 2) - (i_Sprite_Edit_Size * .5f), y_offset, i_Sprite_Edit_Size * 2, i_Size_Height_Amount), "<<Fuse!")) { //we will perform a fuse as long as it can be.. this logic will be manually entered with each combination. } //Second sprite box. if (GUI.Button(new Rect(Screen.width / 2 - ((i_Sprite_Edit_Size) / 2) + (i_Sprite_Edit_Size * 1.5f), y_offset, i_Sprite_Edit_Size, i_Size_Height_Amount), Second_Sprite.texture)) { //open the sprite menu for the second sprite. b_Ally_Pick_Screen = true; b_First_Sprite = false; b_Add_Ally = false; Ally_Sprite_Table.transform.position = new Vector3(0, 0); } y_offset += i_Size_Height_Amount * 1.5f; //LEVEL GUI.Box(new Rect(Screen.width / 2 / 2, y_offset, Screen.width / 2, i_Size_Height_Amount / 2), "Level"); y_offset += i_Size_Height_Amount / 2; string Temp_Value = Temp_Tower.Tower_Level.ToString(); Temp_Value = GUI.TextField(new Rect(Screen.width / 2 - (i_Level_Size / 2), y_offset, i_Level_Size, i_Size_Height_Amount / 2), Temp_Value, 3); int.TryParse(Temp_Value, out Temp_Tower.Tower_Level); y_offset += i_Size_Height_Amount; //POWER GUI.Box(new Rect(Screen.width / 2 / 2, y_offset, Screen.width / 2, i_Size_Height_Amount / 2), "Power"); y_offset += i_Size_Height_Amount / 2; Temp_Value = Temp_Tower.Tower_Power.ToString(); Temp_Value = GUI.TextField(new Rect(Screen.width / 2 - (i_Power_Size / 2), y_offset, i_Power_Size, i_Size_Height_Amount / 2), Temp_Value, 3); int.TryParse(Temp_Value, out Temp_Tower.Tower_Power); y_offset += i_Size_Height_Amount; //SPEED GUI.Box(new Rect(Screen.width / 2 / 2, y_offset, Screen.width / 2, i_Size_Height_Amount / 2), "Speed"); y_offset += i_Size_Height_Amount / 2; Temp_Value = Temp_Tower.Tower_Speed.ToString(); Temp_Value = GUI.TextField(new Rect(Screen.width / 2 - (i_Speed_Size / 2), y_offset, i_Speed_Size, i_Size_Height_Amount / 2), Temp_Value, 3); int.TryParse(Temp_Value, out Temp_Tower.Tower_Speed); y_offset += i_Size_Height_Amount; //RANGE GUI.Box(new Rect(Screen.width / 2 / 2, y_offset, Screen.width / 2, i_Size_Height_Amount / 2), "Range"); y_offset += i_Size_Height_Amount / 2; Temp_Value = Temp_Tower.Tower_Range.ToString(); Temp_Value = GUI.TextField(new Rect(Screen.width / 2 - (i_Range_Size / 2), y_offset, i_Range_Size, i_Size_Height_Amount / 2), Temp_Value, 3); int.TryParse(Temp_Value, out Temp_Tower.Tower_Range); y_offset += i_Size_Height_Amount; //POINTS GUI.Box(new Rect(Screen.width / 2 / 2, y_offset, Screen.width / 2, i_Size_Height_Amount / 2), "HP"); y_offset += i_Size_Height_Amount / 2; Temp_Value = Temp_Tower.Tower_Points.ToString(); Temp_Value = GUI.TextField(new Rect(Screen.width / 2 - (i_Free_Points_Size / 2), y_offset, i_Free_Points_Size, i_Size_Height_Amount / 2), Temp_Value, 3); int.TryParse(Temp_Value, out Temp_Tower.Tower_Points); y_offset += i_Size_Height_Amount; }
void Ally_Menu() { //Close Button. if (GUI.Button(new Rect(20, 20, 120, 20), "Close")) { b_Stats_Menu_Enabled = true; b_Ally_Menu = false; } //Add a new ally Button. if (GUI.Button(new Rect(20, 50, 120, 20), "Add Ally")) { b_Add_Ally = true; b_Ally_Menu = false; } //we will go through and show all the allies the player has. //now we will go through each of the enemies and list them out and display all their info along with an edit and remove button. for (int i = 0; i < Stats.Tower_List.Count; i++) { //the x offset. int x_start = 0; //the sprite box. GUI.Box(new Rect(i_To_Center_X_Start, f_scroll + i_Sprite_Edit_Size + (i * (i_Sprite_Edit_Size + 5)), i_Sprite_Edit_Size, i_Size_Height_Amount), Stats.Tower_List[i].Tower_Sprite.texture); //the edit box over the sprite box. if (GUI.Button(new Rect(i_To_Center_X_Start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Sprite_Edit_Size, i_Size_Height_Amount), "Edit")) { //set what tower we are editing. i_Tower_Location_Number = i; //we set the temp enemy to this one to edit. Temp_Tower = (Assets.Scripts.Level_Scripts.LE.Tower_Template)Stats.Tower_List[i].Clone(); //reset scroll. f_scroll = 0; //still need to open said menu here. b_Add_Ally = true; b_Ally_Menu = false; } //This is to update the x spot with the new spot value. x_start += i_Sprite_Edit_Size; //Name GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Name_Size, i_Size_Height_Amount / 2), "Name"); GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i_Size_Height_Amount / 2) + (i * (i_Size_Height_Amount + 5)), i_Name_Size, i_Size_Height_Amount / 2), Stats.Tower_List[i].Tower_Name); //This is to update the x spot with the new spot value. x_start += i_Name_Size; //Level GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Level_Size, i_Size_Height_Amount / 2), "Level"); GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i_Size_Height_Amount / 2) + (i * (i_Size_Height_Amount + 5)), i_Level_Size, i_Size_Height_Amount / 2), Stats.Tower_List[i].Tower_Level.ToString()); //This is to update the x spot with the new spot value. x_start += i_Level_Size; //Power GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Power_Size, i_Size_Height_Amount / 2), "Power"); GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i_Size_Height_Amount / 2) + (i * (i_Size_Height_Amount + 5)), i_Power_Size, i_Size_Height_Amount / 2), Stats.Tower_List[i].Tower_Power.ToString()); //This is to update the x spot with the new spot value. x_start += i_Power_Size; //Speed GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Speed_Size, i_Size_Height_Amount / 2), "Speed"); GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i_Size_Height_Amount / 2) + (i * (i_Size_Height_Amount + 5)), i_Speed_Size, i_Size_Height_Amount / 2), Stats.Tower_List[i].Tower_Speed.ToString()); //This is to update the x spot with the new spot value. x_start += i_Speed_Size; //Range GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Range_Size, i_Size_Height_Amount / 2), "Range"); GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i_Size_Height_Amount / 2) + (i * (i_Size_Height_Amount + 5)), i_Range_Size, i_Size_Height_Amount / 2), Stats.Tower_List[i].Tower_Range.ToString()); //This is to update the x spot with the new spot value. x_start += i_Range_Size; //Points GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Free_Points_Size, i_Size_Height_Amount / 2), "Points"); GUI.Box(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i_Size_Height_Amount / 2) + (i * (i_Size_Height_Amount + 5)), i_Free_Points_Size, i_Size_Height_Amount / 2), Stats.Tower_List[i].Tower_Points.ToString()); //This is to update the x spot with the new spot value. x_start += i_Free_Points_Size; //now we add the delete button. if (GUI.Button(new Rect(i_To_Center_X_Start + x_start, f_scroll + i_Size_Height_Amount + (i * (i_Size_Height_Amount + 5)), i_Delete_Size, i_Size_Height_Amount), "Delete")) { //this is the remove tower button. pretty simple. Stats.Tower_List.RemoveAt(i); } } }