Hi, i just made a script for clan manager, how can i choose an item from Clanlist after i create clan?
public class Clan : MonoBehaviour
{
public GameObject ClanContainer;
public GameObject ClanMembersContainer;
public GameObject ClanDescriptionContainer;
public GameObject ClanListPrefab;
public GameObject ClanMembersPrefab;
public GameObject ClanDescriptionPrefab;
public InputField ClanName;
public InputField ClanDescripiton;
public GameObject ClanPanel;
public GameObject OpenCreateClan;
List<string> ClanList = new List<string>();
List<string> ClanMembers = new List<string>();
string[] Ranks = { "Founder", "Leader", "Member", "Trial" };
void Start()
{
ClanList.Add("Admins");
ClanMembers.Add("Ibrahim");
//ClanList
GameObject go = Instantiate(ClanListPrefab, ClanContainer.transform) as GameObject;
go.transform.Find("Clan").GetComponentInChildren<Text>().text = ClanList[0];
go.transform.Find("PlayersCount").GetComponentInChildren<Text>().text = ClanMembers.Count.ToString() + "/50";
go.transform.Find("Clan").GetComponentInChildren<Text>().color = Color.red;
}
public void CreateClan()
{
if (ClanName.text == "Admins" || ClanName.text == "Staff")
{
Debug.Log("You can't Create clan with this name");
} else if (ClanList.Contains(ClanName.text))
{
Debug.Log("Exist clan name");
}else if(ClanName.text == "")
{
Debug.Log("Plese write clan name");
}
else
{
ClanList.Add(ClanName.text);
GameObject Name = Instantiate(ClanListPrefab, ClanContainer.transform) as GameObject;
Name.transform.Find("Clan").GetComponentInChildren<Text>().text = ClanName.text;
GameObject Descripition = Instantiate(ClanDescriptionPrefab, ClanDescriptionContainer.transform) as GameObject;
Descripition.transform.Find("ClanName").GetComponentInChildren<Text>().text = ClanName.text;
Descripition.transform.Find("ClanDescription").GetComponentInChildren<Text>().text = ClanDescripiton.text;
GameObject ClanMember = Instantiate(ClanMembersPrefab, ClanMembersContainer.transform) as GameObject;
ClanMember.transform.Find("NameTxt").GetComponentInChildren<Text>().text = "Ibrahim";
ClanMember.transform.Find("RankTxt").GetComponentInChildren<Text>().text = Ranks[0];
ClanPanel.SetActive(true);
OpenCreateClan.SetActive(false);
}
}
}