private void WorldSystemSettingGUI() { GUILayout.Space(5); List <string> allWorldNames = worldSettingData.GetAllWorldNames(); selectWorldName = EditorDrawGUIUtil.DrawPopup("Select World :", selectWorldName, allWorldNames); WorldSettingData settingData = worldSettingData.GetWorldSettingData(selectWorldName); List <SystemsSettingData> ssd = new List <SystemsSettingData>(settingData.allSystemSettingDatas.Values); GUILayout.Space(5); pos = GUILayout.BeginScrollView(pos, "box"); foreach (var item in ssd) { GUILayout.BeginVertical("box"); GUILayout.Label("System Name :" + item.systemName); item.delayExecute = (int)EditorDrawGUIUtil.DrawBaseValue("每次Update间隔时间(毫秒):", item.delayExecute); GUILayout.Space(8); GUILayout.EndVertical(); } GUILayout.EndScrollView(); }
private bool AddNewWorldSettingData(string name) { if (worldSettingData.GetWorldSettingData(name) == null) { WorldSettingData w = new WorldSettingData(); w.worldName = name; w.useSystemList.AddRange(systemNames); worldSettingData.allWorldSettingData.Add(w); foreach (var item in systemNames) { SystemsSettingData settingData = new SystemsSettingData(); settingData.systemName = item; settingData.delayExecute = 0; w.allSystemSettingDatas.Add(item, settingData); } return(true); } return(false); }
private void DrawWorldSettingGUI(WorldSettingData worldSetting) { int hash = worldSetting.GetHashCode(); bool isFold = true; if (foldStateDic.ContainsKey(hash)) { isFold = foldStateDic[hash]; } else { foldStateDic.Add(hash, isFold); } isFold = EditorGUILayout.Foldout(isFold, "World Setting"); if (isFold) { if (worldSetting.worldName == RealWorldName) { GUILayout.Label("World Name: " + worldSetting.worldName); } else { string temp = EditorDrawGUIUtil.DrawBaseValue("World Name: ", worldSetting.worldName).ToString(); while (worldSettingData.IsHaveRepeatName(worldSetting)) { temp += "_0"; } worldSetting.worldName = temp; } GUILayout.BeginVertical("box"); GUILayout.Box("Use System:"); int LineNumber = 3; for (int i = 0; i < systemNames.Count;) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); for (int j = 0; j < LineNumber; j++) { string sName = systemNames[i]; if (worldSetting.useSystemList.Contains(sName)) { GUI.color = Color.green; } if (GUILayout.Button(sName, GUILayout.MaxWidth(Screen.width / LineNumber))) { if (worldSetting.useSystemList.Contains(sName)) { worldSetting.useSystemList.Remove(sName); } else { worldSetting.useSystemList.Add(sName); } } GUI.color = Color.white; i++; if (i >= systemNames.Count) { break; } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.EndVertical(); } foldStateDic[hash] = isFold; }