public void Init() { if (gitServerList == null || gitServerList.Count == 0) { gitServerList = new List <GitServerItem>(); GitServerItem gitServer; List <string> centerNames; gitServer = new GitServerItem("国内服务器", Application.dataPath + "/../../../test.version/"); centerNames = new List <string> { "Official", "XiaoMi", "WeiXin", "UC" }; foreach (CenterSwitcher.CenterItem item in CenterSwitcher.centerItemList) { if (centerNames.IndexOf(item.name) != -1) { gitServer.AddCenter(item); } } gitServerList.Add(gitServer); gitServer = new GitServerItem("海外服务器", Application.dataPath + "/../../../test.version/"); centerNames = new List <string> { "Official" }; foreach (CenterSwitcher.CenterItem item in CenterSwitcher.centerItemList) { if (centerNames.IndexOf(item.name) != -1) { gitServer.AddCenter(item); } } gitServerList.Add(gitServer); gitServerNames = new string[gitServerList.Count]; for (int i = 0; i < gitServerList.Count; i++) { gitServerNames[i] = gitServerList[i].name; } gitServerSelectIndex = 0; gitServer = gitServerList[gitServerSelectIndex]; } }
public void OnGUI() { gitServerSelectIndex = EditorGUILayout.Popup("git server:", gitServerSelectIndex, gitServerNames); gitServer = gitServerList[gitServerSelectIndex]; }