void DrawAllSpawnUI() { AddButtonAction(Color.red, Color.black, "Remove all zones", p_target.RemoveSpawnElementAll); Separator(); for (int i = 0; i < p_target.AllSpawnElements.Count; i++) { CreatorElement _s = p_target.AllSpawnElements[i]; _s.IsVisible = EditorGUILayout.Foldout(_s.IsVisible, "Show/Hide", true); if (_s.IsVisible) { GUILayout.BeginHorizontal(); AddButtonAction(i == p_target.CurrentSpawnSelection ? Color.yellow : Color.grey, Color.black, "Select", p_target.SetSelection, i, Save); AddButtonAction(Color.red, Color.black, "X", p_target.RemoveSpawnElementAt, i, Save, "Remove this element"); GUILayout.EndHorizontal(); Separator(2); _s.SpawnColor = EditorGUILayout.ColorField(_s.SpawnColor); Separator(2); _s.ElementToCreate = (GameObject)EditorGUILayout.ObjectField("Item to spawn", _s.ElementToCreate, typeof(GameObject), false); Separator(2); DrawSpawnElementSettings(_s); Separator(3); } Space(3); } }
private MetaData GenerateMetaData() { CreatorElement creator = new CreatorElement(); creator.Text = "Charles Petzold"; IdentifierElement identifier = new IdentifierElement(); identifier.Identifier = "urn:isbn:9780735656680"; TitleElement title = new TitleElement(); //title.Text = "Microsoft XNA Framework Edition: Programming Windows Phone 7"; title.Text = doc.Name; RightsElement rights = new RightsElement(); rights.Text = "Copyright © 2010"; PublisherElement publisher = new PublisherElement(); publisher.Text = "Microsoft Press"; SubjectElement subject = new SubjectElement(); subject.Text = "COMPUTERS / Programming / Microsoft Programming"; DateElement date = new DateElement(); date.Text = "2010-12-15"; DescriptionElement description = new DescriptionElement(); description.Text = "<p>Focusing on XNA and the C# language, you&#8217;ll learn how to extend your existing skills to the Windows Phone 7 platform&#8212;mastering the core tools and techniques for creating your own games for the phone.</p>"; LanguageElement language = new LanguageElement(); language.Text = "en"; MetaData meta = new MetaData() { Identifier = identifier, Title = title, Rights = rights, Publisher = publisher, Subject = subject, Date = date, Description = description, Creator = creator, Language = language }; return(meta); }
void DrawSpawnElementSettings(CreatorElement _s) { GUILayout.BeginHorizontal(); _s.CircleSpawnRadius = (int)EditorGUILayout.Slider("Radius", _s.CircleSpawnRadius, 1, 100); AddButtonAction(Color.magenta, Color.black, "-", _s.UpdateRadiusValue, false, Save); AddButtonAction(Color.cyan, Color.black, "+", _s.UpdateRadiusValue, true, Save); GUILayout.EndHorizontal(); Separator(2); GUILayout.BeginHorizontal(); _s.NumberToCreate = (int)EditorGUILayout.Slider("Number elements to spawn", _s.NumberToCreate, 1, 100); AddButtonAction(Color.magenta, Color.black, "-", _s.ChangeNumberToSpawnValue, false, Save); AddButtonAction(Color.cyan, Color.black, "+", _s.ChangeNumberToSpawnValue, true, Save); GUILayout.EndHorizontal(); Separator(3); AddButtonAction(Color.green, Color.black, "Create Elements", p_target.MakeItSpawn); if (GUI.changed) { SceneView.RepaintAll(); } }
void DrawSceneGraphicsUI() { Handles.Label(p_target.transform.position + Vector3.up * 5, p_target.name, StyleLabel(Color.black, 15, TextAnchor.MiddleCenter)); for (int i = 0; i < p_target.AllSpawnElements.Count; i++) { bool _isCurrent = p_target.CurrentSpawnSelection == i; CreatorElement _s = p_target.AllSpawnElements[i]; if (Application.isPlaying) { return; } Handles.color = _s.SpawnColor; if (_isCurrent) { _s.SpawnCenterLogic = Handles.PositionHandle(_s.SpawnCenterLogic, Quaternion.identity); Handles.DrawWireDisc(_s.SpawnCenterLogic, Vector3.up, _s.CircleSpawnRadius); Handles.color = new Color(_s.SpawnColor.r, _s.SpawnColor.g, _s.SpawnColor.b, .05f); Handles.DrawSolidDisc(_s.SpawnCenterLogic, Vector3.up, _s.CircleSpawnRadius); Handles.color = _s.SpawnColor; for (int j = 0; j < _s.NumberToCreate; j++) { Handles.color = _s.SpawnColor; Handles.DrawDottedLine(_s.SpawnCenterLogic, _s.TargetOnCirclePosition(j), 3); Handles.color = new Color(_s.SpawnColor.r, _s.SpawnColor.g, _s.SpawnColor.b, .5f); Handles.SphereHandleCap(j, _s.TargetOnCirclePosition(j), Quaternion.identity, 1, EventType.Repaint); } } else { Handles.color = Color.grey; Handles.DrawWireDisc(_s.SpawnCenterLogic, Vector3.up, _s.CircleSpawnRadius); } break; } Handles.color = Color.white; }